Subversion Repositories SmartDukaan

Rev

Rev 4502 | Rev 4754 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 4502 Rev 4555
Line 84... Line 84...
84
     - purchaseOrderId
84
     - purchaseOrderId
85
     - open
85
     - open
86
    """
86
    """
87
    pass
87
    pass
88
 
88
 
89
  def getPrice(self, purchaseId, itemId):
89
  def getPurchaseOrderForPurchase(self, purchaseId):
90
    """
90
    """
91
    Returns the price at which we bought an item from a supplier
91
    Returns the purchase order object for a given purchase
92
 
92
 
93
    Parameters:
93
    Parameters:
94
     - purchaseId
94
     - purchaseId
95
     - itemId
-
 
96
    """
95
    """
97
    pass
96
    pass
98
 
97
 
99
 
98
 
100
class Client(shop2020.thriftpy.generic.GenericService.Client, Iface):
99
class Client(shop2020.thriftpy.generic.GenericService.Client, Iface):
Line 346... Line 345...
346
      return result.success
345
      return result.success
347
    if result.e is not None:
346
    if result.e is not None:
348
      raise result.e
347
      raise result.e
349
    raise TApplicationException(TApplicationException.MISSING_RESULT, "getAllPurchases failed: unknown result");
348
    raise TApplicationException(TApplicationException.MISSING_RESULT, "getAllPurchases failed: unknown result");
350
 
349
 
351
  def getPrice(self, purchaseId, itemId):
350
  def getPurchaseOrderForPurchase(self, purchaseId):
352
    """
351
    """
353
    Returns the price at which we bought an item from a supplier
352
    Returns the purchase order object for a given purchase
354
 
353
 
355
    Parameters:
354
    Parameters:
356
     - purchaseId
355
     - purchaseId
357
     - itemId
-
 
358
    """
356
    """
359
    self.send_getPrice(purchaseId, itemId)
357
    self.send_getPurchaseOrderForPurchase(purchaseId)
360
    return self.recv_getPrice()
358
    return self.recv_getPurchaseOrderForPurchase()
361
 
359
 
362
  def send_getPrice(self, purchaseId, itemId):
360
  def send_getPurchaseOrderForPurchase(self, purchaseId):
363
    self._oprot.writeMessageBegin('getPrice', TMessageType.CALL, self._seqid)
361
    self._oprot.writeMessageBegin('getPurchaseOrderForPurchase', TMessageType.CALL, self._seqid)
364
    args = getPrice_args()
362
    args = getPurchaseOrderForPurchase_args()
365
    args.purchaseId = purchaseId
363
    args.purchaseId = purchaseId
366
    args.itemId = itemId
-
 
367
    args.write(self._oprot)
364
    args.write(self._oprot)
368
    self._oprot.writeMessageEnd()
365
    self._oprot.writeMessageEnd()
369
    self._oprot.trans.flush()
366
    self._oprot.trans.flush()
370
 
367
 
371
  def recv_getPrice(self, ):
368
  def recv_getPurchaseOrderForPurchase(self, ):
372
    (fname, mtype, rseqid) = self._iprot.readMessageBegin()
369
    (fname, mtype, rseqid) = self._iprot.readMessageBegin()
373
    if mtype == TMessageType.EXCEPTION:
370
    if mtype == TMessageType.EXCEPTION:
374
      x = TApplicationException()
371
      x = TApplicationException()
375
      x.read(self._iprot)
372
      x.read(self._iprot)
376
      self._iprot.readMessageEnd()
373
      self._iprot.readMessageEnd()
377
      raise x
374
      raise x
378
    result = getPrice_result()
375
    result = getPurchaseOrderForPurchase_result()
379
    result.read(self._iprot)
376
    result.read(self._iprot)
380
    self._iprot.readMessageEnd()
377
    self._iprot.readMessageEnd()
381
    if result.success is not None:
378
    if result.success is not None:
382
      return result.success
379
      return result.success
383
    raise TApplicationException(TApplicationException.MISSING_RESULT, "getPrice failed: unknown result");
380
    raise TApplicationException(TApplicationException.MISSING_RESULT, "getPurchaseOrderForPurchase failed: unknown result");
384
 
381
 
385
 
382
 
386
class Processor(shop2020.thriftpy.generic.GenericService.Processor, Iface, TProcessor):
383
class Processor(shop2020.thriftpy.generic.GenericService.Processor, Iface, TProcessor):
387
  def __init__(self, handler):
384
  def __init__(self, handler):
388
    shop2020.thriftpy.generic.GenericService.Processor.__init__(self, handler)
385
    shop2020.thriftpy.generic.GenericService.Processor.__init__(self, handler)
Line 391... Line 388...
391
    self._processMap["getAllPurchaseOrders"] = Processor.process_getAllPurchaseOrders
388
    self._processMap["getAllPurchaseOrders"] = Processor.process_getAllPurchaseOrders
392
    self._processMap["getSupplier"] = Processor.process_getSupplier
389
    self._processMap["getSupplier"] = Processor.process_getSupplier
393
    self._processMap["startPurchase"] = Processor.process_startPurchase
390
    self._processMap["startPurchase"] = Processor.process_startPurchase
394
    self._processMap["closePurchase"] = Processor.process_closePurchase
391
    self._processMap["closePurchase"] = Processor.process_closePurchase
395
    self._processMap["getAllPurchases"] = Processor.process_getAllPurchases
392
    self._processMap["getAllPurchases"] = Processor.process_getAllPurchases
396
    self._processMap["getPrice"] = Processor.process_getPrice
393
    self._processMap["getPurchaseOrderForPurchase"] = Processor.process_getPurchaseOrderForPurchase
397
 
394
 
398
  def process(self, iprot, oprot):
395
  def process(self, iprot, oprot):
399
    (name, type, seqid) = iprot.readMessageBegin()
396
    (name, type, seqid) = iprot.readMessageBegin()
400
    if name not in self._processMap:
397
    if name not in self._processMap:
401
      iprot.skip(TType.STRUCT)
398
      iprot.skip(TType.STRUCT)
Line 506... Line 503...
506
    oprot.writeMessageBegin("getAllPurchases", TMessageType.REPLY, seqid)
503
    oprot.writeMessageBegin("getAllPurchases", TMessageType.REPLY, seqid)
507
    result.write(oprot)
504
    result.write(oprot)
508
    oprot.writeMessageEnd()
505
    oprot.writeMessageEnd()
509
    oprot.trans.flush()
506
    oprot.trans.flush()
510
 
507
 
511
  def process_getPrice(self, seqid, iprot, oprot):
508
  def process_getPurchaseOrderForPurchase(self, seqid, iprot, oprot):
512
    args = getPrice_args()
509
    args = getPurchaseOrderForPurchase_args()
513
    args.read(iprot)
510
    args.read(iprot)
514
    iprot.readMessageEnd()
511
    iprot.readMessageEnd()
515
    result = getPrice_result()
512
    result = getPurchaseOrderForPurchase_result()
516
    result.success = self._handler.getPrice(args.purchaseId, args.itemId)
513
    result.success = self._handler.getPurchaseOrderForPurchase(args.purchaseId)
517
    oprot.writeMessageBegin("getPrice", TMessageType.REPLY, seqid)
514
    oprot.writeMessageBegin("getPurchaseOrderForPurchase", TMessageType.REPLY, seqid)
518
    result.write(oprot)
515
    result.write(oprot)
519
    oprot.writeMessageEnd()
516
    oprot.writeMessageEnd()
520
    oprot.trans.flush()
517
    oprot.trans.flush()
521
 
518
 
522
 
519
 
Line 1501... Line 1498...
1501
    return isinstance(other, self.__class__) and self.__dict__ == other.__dict__
1498
    return isinstance(other, self.__class__) and self.__dict__ == other.__dict__
1502
 
1499
 
1503
  def __ne__(self, other):
1500
  def __ne__(self, other):
1504
    return not (self == other)
1501
    return not (self == other)
1505
 
1502
 
1506
class getPrice_args:
1503
class getPurchaseOrderForPurchase_args:
1507
  """
1504
  """
1508
  Attributes:
1505
  Attributes:
1509
   - purchaseId
1506
   - purchaseId
1510
   - itemId
-
 
1511
  """
1507
  """
1512
 
1508
 
1513
  thrift_spec = (
1509
  thrift_spec = (
1514
    None, # 0
1510
    None, # 0
1515
    (1, TType.I64, 'purchaseId', None, None, ), # 1
1511
    (1, TType.I64, 'purchaseId', None, None, ), # 1
1516
    (2, TType.I64, 'itemId', None, None, ), # 2
-
 
1517
  )
1512
  )
1518
 
1513
 
1519
  def __init__(self, purchaseId=None, itemId=None,):
1514
  def __init__(self, purchaseId=None,):
1520
    self.purchaseId = purchaseId
1515
    self.purchaseId = purchaseId
1521
    self.itemId = itemId
-
 
1522
 
1516
 
1523
  def read(self, iprot):
1517
  def read(self, iprot):
1524
    if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:
1518
    if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:
1525
      fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec))
1519
      fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec))
1526
      return
1520
      return
Line 1532... Line 1526...
1532
      if fid == 1:
1526
      if fid == 1:
1533
        if ftype == TType.I64:
1527
        if ftype == TType.I64:
1534
          self.purchaseId = iprot.readI64();
1528
          self.purchaseId = iprot.readI64();
1535
        else:
1529
        else:
1536
          iprot.skip(ftype)
1530
          iprot.skip(ftype)
1537
      elif fid == 2:
-
 
1538
        if ftype == TType.I64:
-
 
1539
          self.itemId = iprot.readI64();
-
 
1540
        else:
-
 
1541
          iprot.skip(ftype)
-
 
1542
      else:
1531
      else:
1543
        iprot.skip(ftype)
1532
        iprot.skip(ftype)
1544
      iprot.readFieldEnd()
1533
      iprot.readFieldEnd()
1545
    iprot.readStructEnd()
1534
    iprot.readStructEnd()
1546
 
1535
 
1547
  def write(self, oprot):
1536
  def write(self, oprot):
1548
    if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:
1537
    if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:
1549
      oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))
1538
      oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))
1550
      return
1539
      return
1551
    oprot.writeStructBegin('getPrice_args')
1540
    oprot.writeStructBegin('getPurchaseOrderForPurchase_args')
1552
    if self.purchaseId is not None:
1541
    if self.purchaseId is not None:
1553
      oprot.writeFieldBegin('purchaseId', TType.I64, 1)
1542
      oprot.writeFieldBegin('purchaseId', TType.I64, 1)
1554
      oprot.writeI64(self.purchaseId)
1543
      oprot.writeI64(self.purchaseId)
1555
      oprot.writeFieldEnd()
1544
      oprot.writeFieldEnd()
1556
    if self.itemId is not None:
-
 
1557
      oprot.writeFieldBegin('itemId', TType.I64, 2)
-
 
1558
      oprot.writeI64(self.itemId)
-
 
1559
      oprot.writeFieldEnd()
-
 
1560
    oprot.writeFieldStop()
1545
    oprot.writeFieldStop()
1561
    oprot.writeStructEnd()
1546
    oprot.writeStructEnd()
1562
 
1547
 
1563
  def validate(self):
1548
  def validate(self):
1564
    return
1549
    return
Line 1573... Line 1558...
1573
    return isinstance(other, self.__class__) and self.__dict__ == other.__dict__
1558
    return isinstance(other, self.__class__) and self.__dict__ == other.__dict__
1574
 
1559
 
1575
  def __ne__(self, other):
1560
  def __ne__(self, other):
1576
    return not (self == other)
1561
    return not (self == other)
1577
 
1562
 
1578
class getPrice_result:
1563
class getPurchaseOrderForPurchase_result:
1579
  """
1564
  """
1580
  Attributes:
1565
  Attributes:
1581
   - success
1566
   - success
1582
  """
1567
  """
1583
 
1568
 
1584
  thrift_spec = (
1569
  thrift_spec = (
1585
    (0, TType.I64, 'success', None, None, ), # 0
1570
    (0, TType.STRUCT, 'success', (PurchaseOrder, PurchaseOrder.thrift_spec), None, ), # 0
1586
  )
1571
  )
1587
 
1572
 
1588
  def __init__(self, success=None,):
1573
  def __init__(self, success=None,):
1589
    self.success = success
1574
    self.success = success
1590
 
1575
 
Line 1596... Line 1581...
1596
    while True:
1581
    while True:
1597
      (fname, ftype, fid) = iprot.readFieldBegin()
1582
      (fname, ftype, fid) = iprot.readFieldBegin()
1598
      if ftype == TType.STOP:
1583
      if ftype == TType.STOP:
1599
        break
1584
        break
1600
      if fid == 0:
1585
      if fid == 0:
1601
        if ftype == TType.I64:
1586
        if ftype == TType.STRUCT:
1602
          self.success = iprot.readI64();
1587
          self.success = PurchaseOrder()
-
 
1588
          self.success.read(iprot)
1603
        else:
1589
        else:
1604
          iprot.skip(ftype)
1590
          iprot.skip(ftype)
1605
      else:
1591
      else:
1606
        iprot.skip(ftype)
1592
        iprot.skip(ftype)
1607
      iprot.readFieldEnd()
1593
      iprot.readFieldEnd()
Line 1609... Line 1595...
1609
 
1595
 
1610
  def write(self, oprot):
1596
  def write(self, oprot):
1611
    if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:
1597
    if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:
1612
      oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))
1598
      oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))
1613
      return
1599
      return
1614
    oprot.writeStructBegin('getPrice_result')
1600
    oprot.writeStructBegin('getPurchaseOrderForPurchase_result')
1615
    if self.success is not None:
1601
    if self.success is not None:
1616
      oprot.writeFieldBegin('success', TType.I64, 0)
1602
      oprot.writeFieldBegin('success', TType.STRUCT, 0)
1617
      oprot.writeI64(self.success)
1603
      self.success.write(oprot)
1618
      oprot.writeFieldEnd()
1604
      oprot.writeFieldEnd()
1619
    oprot.writeFieldStop()
1605
    oprot.writeFieldStop()
1620
    oprot.writeStructEnd()
1606
    oprot.writeStructEnd()
1621
 
1607
 
1622
  def validate(self):
1608
  def validate(self):