예제 #1
0
    def __makeRequest(self, request):
        try:
            request.setSiteID(self.__siteId)
        except AttributeError:
            pass
        try:
            request.setWorkstationID(self.__wsId)
        except AttributeError:
            pass

        sr = ServerResponse()
        response = None
        try:
            response = self.__thrift.sendRequest(request)
        except ThriftClient.ThriftRequestException as e:
            sr.setMessages([str(e)])
        try:
            sr.setPayload(response.getPayload())
        except AttributeError:
            sr.setPayload(response)
        try:
            sr.setMessages(response.getMessages())
        except AttributeError:
            # not a server response, nothing else to do
            pass

        return sr
예제 #2
0
    def __makeRequest(self, request):
        try:
            request.setSiteID(self.__siteId)
        except AttributeError:
            pass
        try:
            request.setWorkstationID(self.__wsId)
        except AttributeError:
            pass

        sr = ServerResponse()
        response = None
        try:
            response = self.__thrift.sendRequest(request)
        except ThriftClient.ThriftRequestException as e:
            sr.setMessages([str(e)])
        try:
            sr.setPayload(response.getPayload())
        except AttributeError:
            sr.setPayload(response)
        try:
            sr.setMessages(response.getMessages())
        except AttributeError:
            # not a server response, nothing else to do
            pass

        return sr
예제 #3
0
 def getSelectTR(self, name):
     request = GetSelectTimeRangeRequest()
     request.setName(name)
     sr = self.__makeRequest(request)
     ssr = ServerResponse()
     ssr.setMessages(sr.getMessages())
     ssr.setPayload(sr.getPayload())
     return ssr
예제 #4
0
 def getSelectTR(self, name):
     request = GetSelectTimeRangeRequest()
     request.setName(name)
     sr = self.__makeRequest(request)
     ssr = ServerResponse()
     ssr.setMessages(sr.getMessages())
     ssr.setPayload(sr.getPayload())
     return ssr
예제 #5
0
 def __getParmList(self, ids):
     ssr = ServerResponse()
     request = GetParmListRequest()
     request.setDbIds(ids)
     sr = self.__makeRequest(request)
     ssr.setMessages(sr.getMessages())
     list = sr.getPayload() if sr.getPayload() is not None else []
     ssr.setPayload(list)
     return ssr
예제 #6
0
 def __getGridInventory(self, parmIDs):
     ssr = ServerResponse()
     request = GetGridInventoryRequest()
     request.setParmIds(parmIDs)
     sr = self.__makeRequest(request)
     ssr.setMessages(sr.getMessages())
     trs = sr.getPayload() if sr.getPayload() is not None else {}
     ssr.setPayload(trs)
     return ssr
예제 #7
0
 def __getParmList(self, ids):
     ssr = ServerResponse()
     request = GetParmListRequest()
     request.setDbIds(ids)
     sr = self.__makeRequest(request)
     ssr.setMessages(sr.getMessages())
     list = sr.getPayload() if sr.getPayload() is not None else []
     ssr.setPayload(list)
     return ssr
예제 #8
0
 def __getGridInventory(self, parmIDs):
     ssr = ServerResponse()
     request = GetGridInventoryRequest()
     request.setParmIds(parmIDs)
     sr = self.__makeRequest(request)
     ssr.setMessages(sr.getMessages())
     trs = sr.getPayload() if sr.getPayload() is not None else {}
     ssr.setPayload(trs)
     return ssr