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
def __commitGrid(self, requests): ssr = ServerResponse() request = CommitGridsRequest() request.setCommits(requests) sr = self.__makeRequest(request) ssr.setMessages(sr.getMessages()) return ssr
def getSiteID(self): ssr = ServerResponse() request = GetActiveSitesRequest() sr = self.__makeRequest(request) ssr.setMessages(sr.getMessages()) ids = sr.getPayload() if sr.getPayload() is not None else [] sr.setPayload(ids) return sr
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
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
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