Exemplo n.º 1
0
 def put(self, aasId):
     aasValid = AASMetaModelValidator(self.pyAAS)
     try:
         data = request.json
         if "interactionElements" in data:
             pass
             #return self.pyAAS.skillInstanceDict["AASHandler"].restAPIHandler(data)
         else:
             if (aasValid.valitdateAAS(data)):
                 if (aasId == data["assetAdministrationShells"][0]
                     ["idShort"]):
                     edm = ExecuteDBModifier(self.pyAAS)
                     dataBaseResponse = edm.executeModifer({
                         "data": {
                             "updateData": data,
                             "aasId": aasId
                         },
                         "method":
                         "putAAS"
                     })
                     return make_response(dataBaseResponse["message"][0],
                                          dataBaseResponse["status"])
                 else:
                     return make_response(
                         "The namspace AASID value and the IdShort value do not match",
                         500)
             else:
                 return make_response(
                     "The syntax of the passed Asset Administration Shell is not valid or malformed request",
                     400)
     except Exception as E:
         return make_response("Internal Server Error", 500)
Exemplo n.º 2
0
 def put(self, aasId, submodelId):
     aasValid = AASMetaModelValidator(self.pyAAS)
     try:
         data = request.json
         if "interactionElements" in data:
             pass
             #return self.pyAAS.skillInstanceDict["AASHandler"].restAPIHandler(data)
         else:
             if (aasValid.valitdateSubmodel({"submodels": [data]})):
                 if (data["idShort"] == submodelId):
                     edm = ExecuteDBModifier(self.pyAAS)
                     dataBaseResponse = edm.executeModifer({
                         "data": {
                             "updateData": {
                                 "submodels": [data]
                             },
                             "aasId": aasId,
                             "submodelId": submodelId
                         },
                         "method":
                         "putSubmodels"
                     })
                     return make_response(dataBaseResponse["message"][0],
                                          dataBaseResponse["status"])
                 else:
                     return make_response(
                         "The namspace SubmodelId value and the IdShort value do not match",
                         500)
             else:
                 return make_response(
                     "The syntax of the passed submodel data is not valid or malformed request",
                     400)
     except Exception as E:
         return make_response("Unexpected Internal Server Error", 500)
Exemplo n.º 3
0
 def put(self, aasId, submodelId):
     descValid = DescriptorValidator(self.pyAAS)
     try:
         data = request.json
         if "interactionElements" in data:
             pass
             #return self.pyAAS.skillInstanceDict["RegistryHandler"].restAPIHandler(data)
         else:
             message = {"submodelDescriptors": [data]}
             if (descValid.valitdateSubmodelDescriptor(message)):
                 if (submodelId == data["idShort"]):
                     edm = ExecuteDBModifier(self.pyAAS)
                     dataBaseResponse = edm.executeModifer({
                         "data": {
                             "updateData": data,
                             "aasId": aasId,
                             "submodelId": submodelId
                         },
                         "method":
                         "putSubmodelDescByID"
                     })
                     return make_response(dataBaseResponse["message"][0],
                                          dataBaseResponse["status"])
                 else:
                     return make_response(
                         "The Namespace SubmodelId value and the IdShort value in the data are not matching",
                         500)
             else:
                 return make_response(
                     "The syntax of the passed Asset Administration Shell is not valid or malformed request",
                     400)
     except Exception as E:
         return make_response("Unexpected Internal Server Error", 500)
 def saveDescriptorDetails_Logic(self):
     data = self.baseClass.WaitforRegisterMessage_In["interactionElements"][
         0]
     aasId = data["idShort"]
     edm = ExecuteDBModifier(self.baseClass.pyAAS)
     dataBaseResponse = edm.executeModifer({
         "data": {
             "updateData": data,
             "aasId": aasId
         },
         "method": "putAASDescByID"
     })
     if (dataBaseResponse["status"] == 500):
         self.baseClass.responseMessage["status"] = "E"
         self.baseClass.responseMessage["code"] = dataBaseResponse["status"]
         self.baseClass.responseMessage["message"] = dataBaseResponse[
             "message"][0]
     elif (dataBaseResponse["status"] == 404):
         self.baseClass.responseMessage["status"] = "S"
         self.baseClass.responseMessage["code"] = dataBaseResponse["status"]
         self.baseClass.responseMessage["message"] = dataBaseResponse[
             "message"][0]
     else:
         self.baseClass.responseMessage["status"] = "S"
         self.baseClass.responseMessage["code"] = dataBaseResponse["status"]
         self.baseClass.responseMessage["message"] = dataBaseResponse[
             "message"][0]
Exemplo n.º 5
0
 def delete(self, aasId):
     try:
         edm = ExecuteDBModifier(self.pyAAS)
         dataBaseResponse = edm.executeModifer({
             "data": {
                 "updateData": "empty",
                 "aasId": aasId
             },
             "method": "deleteAASByID"
         })
         return make_response(dataBaseResponse["message"][0],
                              dataBaseResponse["status"])
     except Exception as E:
         return make_response("Unexpected Internal Server Error", 500)