Esempio n. 1
0
    def test_more_tests(self):
        client = self.getPIWebApiClient()
        pi_data_server_web_id = client.webIdHelper.generate_web_id_by_path(
            "\\\\PISRV1", type(PIDataServer()), None)
        point1_web_id = client.webIdHelper.generate_web_id_by_path(
            "\\\\PISRV1\\SINUSOID", type(PIPoint()))
        point2_web_id = client.webIdHelper.generate_web_id_by_path(
            "\\\\PISRV1\\CDT158", type(PIPoint()))
        point3_web_id = client.webIdHelper.generate_web_id_by_path(
            "\\\\PISRV1\\SINUSOIDU", type(PIPoint()))
        pi_attribute_web_id = client.webIdHelper.generate_web_id_by_path(
            "\\\\PISRV1\\Universities\\UC Davis\\Buildings\\Academic Surge Building|Electricity Totalizer",
            type(PIAttribute()), type(PIElement()))

        pi_element_web_id = client.webIdHelper.generate_web_id_by_path(
            "\\\\PISRV1\\Universities\\UC Davis\\Buildings\\Academic Surge Building",
            type(PIElement()), None)

        pi_data_server = client.dataServer.get(pi_data_server_web_id)
        pi_attribute = client.attribute.get(pi_attribute_web_id)
        pi_element = client.element.get(pi_element_web_id)

        pi_attribute_web_id_info = client.webIdHelper.get_web_id_info(
            pi_attribute_web_id)
        pi_element_web_id_info = client.webIdHelper.get_web_id_info(
            pi_element_web_id)
        pi_dataServer_web_id_info = client.webIdHelper.get_web_id_info(
            pi_data_server_web_id)
Esempio n. 2
0
 def validate_type_and_owner_type(self, object_type, owner_type):
     if isinstance(PIAttribute(), object_type):
         if isinstance(PIElement(), owner_type) and isinstance(
                 PIEventFrame(), owner_type):
             raise WebIdException(
                 "PIAttribte owner type must be a PIElement or a PIEventFrame."
             )
     elif isinstance(PIAttributeTemplate(), object_type):
         if isinstance(PIElementTemplate(), owner_type):
             raise WebIdException(
                 "PIElementTemplate owner type must be a PIElementTemplate."
             )
     elif isinstance(PIEnumerationSet(), object_type) or isinstance(
             PIEnumerationValue(), object_type):
         if isinstance(PIDataServer(), owner_type) == False and isinstance(
                 PIAssetServer(), owner_type) == False:
             raise WebIdException(
                 "PIEnumerationSet and  PIEnumerationValue owner type must be a PIDataServer or PIAssetServer."
             )
     elif isinstance(PITimeRule(), object_type):
         if isinstance(PIAnalysis(), owner_type) and isinstance(
                 PIAnalysisTemplate(), owner_type):
             raise WebIdException(
                 "PITimeRule owner type must be a PIAnalysis and PIAnalysisTemplate."
             )
Esempio n. 3
0
    def get_marker(self, object_type):
        marker = None

        if isinstance(PIAnalysis(), object_type):
            marker = "Xs"
        elif isinstance(PIAnalysisCategory(), object_type):
            marker = "XC"
        elif isinstance(PIAnalysisTemplate(), object_type):
            marker = "XT"
        elif isinstance(PIAnalysisRule(), object_type):
            marker = "XR"
        elif isinstance(PIAnalysisRulePlugIn(), object_type):
            marker = "XP"
        elif isinstance(PIAttribute(), object_type):
            marker = "Ab"
        elif isinstance(PIAttributeCategory(), object_type):
            marker = "AC"
        elif isinstance(PIAttributeTemplate(), object_type):
            marker = "AT"
        elif isinstance(PIAssetDatabase(), object_type):
            marker = "RD"
        elif isinstance(PIAssetServer(), object_type):
            marker = "RS"
        elif isinstance(PIElement(), object_type):
            marker = "Em"
        elif isinstance(PIElementCategory(), object_type):
            marker = "EC"
        elif isinstance(PIElementTemplate(), object_type):
            marker = "ET"
        elif isinstance(PIEnumerationSet(), object_type):
            marker = "MS"
        elif isinstance(PIEnumerationValue(), object_type):
            marker = "MV"
        elif isinstance(PIEventFrame(), object_type):
            marker = "Fm"
        elif isinstance(PITimeRule(), object_type):
            marker = "TR"
        elif isinstance(PITimeRulePlugIn(), object_type):
            marker = "TP"
        elif isinstance(PISecurityIdentity(), object_type):
            marker = "SI"
        elif isinstance(PISecurityMapping(), object_type):
            marker = "SM"
        elif isinstance(PITable(), object_type):
            marker = "Bl"
        elif isinstance(PITableCategory(), object_type):
            marker = "BC"
        elif isinstance(PIPoint(), object_type):
            marker = "DP"
        elif isinstance(PIDataServer(), object_type):
            marker = "DS"
        elif isinstance(PIUnit(), object_type):
            marker = "Ut"
        elif isinstance(PIUnitClass(), object_type):
            marker = "UC"
        if (marker == None):
            raise WebIdException("Invalid object type.")
        return marker
Esempio n. 4
0
 def get_owner_marker(self, owner_type):
     if owner_type == None:
         return ""
     if isinstance(PIAssetServer(), owner_type):
         self.marker_owner = "R"
     elif isinstance(PIDataServer(), owner_type):
         self.marker_owner = "D"
     elif isinstance(PIAnalysis(), owner_type):
         self.marker_owner = "X"
     elif isinstance(PIAnalysisTemplate(), owner_type):
         self.marker_owner = "T"
     elif isinstance(PIElement(), owner_type):
         self.marker_owner = "E"
     if isinstance(PIElementTemplate(), owner_type):
         self.marker_owner = "E"
     elif isinstance(PIEventFrame(), owner_type):
         self.marker_owner = "F"
     return self.marker_owner