def getUnchecked(self, key): if (self.get(key=key) != None): return self.m_convertorJsonToPb.converjsontoPBProper( response=self.get(key=key), instanceType=worker_pb2.WorkerPb()) else: self.set(key=key, value=self.m_convertorPbToJson.converPbtojsonString( builder=self.m_workerService.get(id=key))) return self.m_convertorJsonToPb.converjsontoPBProper( response=self.get(key=key), instanceType=worker_pb2.WorkerPb())
def getEntityId(self): workerPb = self.m_queryExecutor.get(id=self.id, table=Tables.WORKER_DATA.name) if (workerPb != None): self.builder = self.m_converterJsonToPb.converjsontoPBProper( response=workerPb, instanceType=worker_pb2.WorkerPb()) self.controlFlow(currentState=States.DONE)
def workerResponse(self, workerResp): self.workerlist.clear() workerSearchResponse = WorkerSearchResponsePb() workerSearchResponse.summary.totalHits = len(workerResp) for index, worker in enumerate(workerResp): # workerSearchResponse.results.add() try: self.workerlist.append( self.m_converterJsonToPb.converjsontoPBProper( response=worker[0], instanceType=worker_pb2.WorkerPb())) except ValueError: pass workerSearchResponse.results.extend(self.workerlist) return workerSearchResponse
def updateWorker(builder): service = WorkerService() m_converter = ConvertJSONToPb() builder = m_converter.converjsontoPBProper( response=builder, instanceType=worker_pb2.WorkerPb()) return service.update(id=builder.dbInfo.id, builder=builder)