Subversion Repositories SmartDukaan

Rev

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

Rev 4754 Rev 5185
Line 128... Line 128...
128
    Parameters:
128
    Parameters:
129
     - purchaseOrder
129
     - purchaseOrder
130
    """
130
    """
131
    pass
131
    pass
132
 
132
 
-
 
133
  def unFulfillPO(self, purchaseId, itemId, quantity):
-
 
134
    """
-
 
135
    Fulfills a given purchase id with an item and its quantity.
-
 
136
 
-
 
137
    Parameters:
-
 
138
     - purchaseId
-
 
139
     - itemId
-
 
140
     - quantity
-
 
141
    """
-
 
142
    pass
-
 
143
 
133
 
144
 
134
class Client(shop2020.thriftpy.generic.GenericService.Client, Iface):
145
class Client(shop2020.thriftpy.generic.GenericService.Client, Iface):
135
  def __init__(self, iprot, oprot=None):
146
  def __init__(self, iprot, oprot=None):
136
    shop2020.thriftpy.generic.GenericService.Client.__init__(self, iprot, oprot)
147
    shop2020.thriftpy.generic.GenericService.Client.__init__(self, iprot, oprot)
137
 
148
 
Line 544... Line 555...
544
    self._iprot.readMessageEnd()
555
    self._iprot.readMessageEnd()
545
    if result.e is not None:
556
    if result.e is not None:
546
      raise result.e
557
      raise result.e
547
    return
558
    return
548
 
559
 
-
 
560
  def unFulfillPO(self, purchaseId, itemId, quantity):
-
 
561
    """
-
 
562
    Fulfills a given purchase id with an item and its quantity.
-
 
563
 
-
 
564
    Parameters:
-
 
565
     - purchaseId
-
 
566
     - itemId
-
 
567
     - quantity
-
 
568
    """
-
 
569
    self.send_unFulfillPO(purchaseId, itemId, quantity)
-
 
570
    self.recv_unFulfillPO()
-
 
571
 
-
 
572
  def send_unFulfillPO(self, purchaseId, itemId, quantity):
-
 
573
    self._oprot.writeMessageBegin('unFulfillPO', TMessageType.CALL, self._seqid)
-
 
574
    args = unFulfillPO_args()
-
 
575
    args.purchaseId = purchaseId
-
 
576
    args.itemId = itemId
-
 
577
    args.quantity = quantity
-
 
578
    args.write(self._oprot)
-
 
579
    self._oprot.writeMessageEnd()
-
 
580
    self._oprot.trans.flush()
-
 
581
 
-
 
582
  def recv_unFulfillPO(self, ):
-
 
583
    (fname, mtype, rseqid) = self._iprot.readMessageBegin()
-
 
584
    if mtype == TMessageType.EXCEPTION:
-
 
585
      x = TApplicationException()
-
 
586
      x.read(self._iprot)
-
 
587
      self._iprot.readMessageEnd()
-
 
588
      raise x
-
 
589
    result = unFulfillPO_result()
-
 
590
    result.read(self._iprot)
-
 
591
    self._iprot.readMessageEnd()
-
 
592
    if result.e is not None:
-
 
593
      raise result.e
-
 
594
    return
-
 
595
 
549
 
596
 
550
class Processor(shop2020.thriftpy.generic.GenericService.Processor, Iface, TProcessor):
597
class Processor(shop2020.thriftpy.generic.GenericService.Processor, Iface, TProcessor):
551
  def __init__(self, handler):
598
  def __init__(self, handler):
552
    shop2020.thriftpy.generic.GenericService.Processor.__init__(self, handler)
599
    shop2020.thriftpy.generic.GenericService.Processor.__init__(self, handler)
553
    self._processMap["createPurchaseOrder"] = Processor.process_createPurchaseOrder
600
    self._processMap["createPurchaseOrder"] = Processor.process_createPurchaseOrder
Line 560... Line 607...
560
    self._processMap["getPurchaseOrderForPurchase"] = Processor.process_getPurchaseOrderForPurchase
607
    self._processMap["getPurchaseOrderForPurchase"] = Processor.process_getPurchaseOrderForPurchase
561
    self._processMap["getPendingPurchaseOrders"] = Processor.process_getPendingPurchaseOrders
608
    self._processMap["getPendingPurchaseOrders"] = Processor.process_getPendingPurchaseOrders
562
    self._processMap["getSuppliers"] = Processor.process_getSuppliers
609
    self._processMap["getSuppliers"] = Processor.process_getSuppliers
563
    self._processMap["fulfillPO"] = Processor.process_fulfillPO
610
    self._processMap["fulfillPO"] = Processor.process_fulfillPO
564
    self._processMap["updatePurchaseOrder"] = Processor.process_updatePurchaseOrder
611
    self._processMap["updatePurchaseOrder"] = Processor.process_updatePurchaseOrder
-
 
612
    self._processMap["unFulfillPO"] = Processor.process_unFulfillPO
565
 
613
 
566
  def process(self, iprot, oprot):
614
  def process(self, iprot, oprot):
567
    (name, type, seqid) = iprot.readMessageBegin()
615
    (name, type, seqid) = iprot.readMessageBegin()
568
    if name not in self._processMap:
616
    if name not in self._processMap:
569
      iprot.skip(TType.STRUCT)
617
      iprot.skip(TType.STRUCT)
Line 741... Line 789...
741
    oprot.writeMessageBegin("updatePurchaseOrder", TMessageType.REPLY, seqid)
789
    oprot.writeMessageBegin("updatePurchaseOrder", TMessageType.REPLY, seqid)
742
    result.write(oprot)
790
    result.write(oprot)
743
    oprot.writeMessageEnd()
791
    oprot.writeMessageEnd()
744
    oprot.trans.flush()
792
    oprot.trans.flush()
745
 
793
 
-
 
794
  def process_unFulfillPO(self, seqid, iprot, oprot):
-
 
795
    args = unFulfillPO_args()
-
 
796
    args.read(iprot)
-
 
797
    iprot.readMessageEnd()
-
 
798
    result = unFulfillPO_result()
-
 
799
    try:
-
 
800
      self._handler.unFulfillPO(args.purchaseId, args.itemId, args.quantity)
-
 
801
    except PurchaseServiceException, e:
-
 
802
      result.e = e
-
 
803
    oprot.writeMessageBegin("unFulfillPO", TMessageType.REPLY, seqid)
-
 
804
    result.write(oprot)
-
 
805
    oprot.writeMessageEnd()
-
 
806
    oprot.trans.flush()
-
 
807
 
746
 
808
 
747
# HELPER FUNCTIONS AND STRUCTURES
809
# HELPER FUNCTIONS AND STRUCTURES
748
 
810
 
749
class createPurchaseOrder_args:
811
class createPurchaseOrder_args:
750
  """
812
  """
Line 2359... Line 2421...
2359
    if self.e is not None:
2421
    if self.e is not None:
2360
      oprot.writeFieldBegin('e', TType.STRUCT, 1)
2422
      oprot.writeFieldBegin('e', TType.STRUCT, 1)
2361
      self.e.write(oprot)
2423
      self.e.write(oprot)
2362
      oprot.writeFieldEnd()
2424
      oprot.writeFieldEnd()
2363
    oprot.writeFieldStop()
2425
    oprot.writeFieldStop()
-
 
2426
    oprot.writeStructEnd()
-
 
2427
 
-
 
2428
  def validate(self):
-
 
2429
    return
-
 
2430
 
-
 
2431
 
-
 
2432
  def __repr__(self):
-
 
2433
    L = ['%s=%r' % (key, value)
-
 
2434
      for key, value in self.__dict__.iteritems()]
-
 
2435
    return '%s(%s)' % (self.__class__.__name__, ', '.join(L))
-
 
2436
 
-
 
2437
  def __eq__(self, other):
-
 
2438
    return isinstance(other, self.__class__) and self.__dict__ == other.__dict__
-
 
2439
 
-
 
2440
  def __ne__(self, other):
-
 
2441
    return not (self == other)
-
 
2442
 
-
 
2443
class unFulfillPO_args:
-
 
2444
  """
-
 
2445
  Attributes:
-
 
2446
   - purchaseId
-
 
2447
   - itemId
-
 
2448
   - quantity
-
 
2449
  """
-
 
2450
 
-
 
2451
  thrift_spec = (
-
 
2452
    None, # 0
-
 
2453
    (1, TType.I64, 'purchaseId', None, None, ), # 1
-
 
2454
    (2, TType.I64, 'itemId', None, None, ), # 2
-
 
2455
    (3, TType.I64, 'quantity', None, None, ), # 3
-
 
2456
  )
-
 
2457
 
-
 
2458
  def __init__(self, purchaseId=None, itemId=None, quantity=None,):
-
 
2459
    self.purchaseId = purchaseId
-
 
2460
    self.itemId = itemId
-
 
2461
    self.quantity = quantity
-
 
2462
 
-
 
2463
  def read(self, iprot):
-
 
2464
    if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:
-
 
2465
      fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec))
-
 
2466
      return
-
 
2467
    iprot.readStructBegin()
-
 
2468
    while True:
-
 
2469
      (fname, ftype, fid) = iprot.readFieldBegin()
-
 
2470
      if ftype == TType.STOP:
-
 
2471
        break
-
 
2472
      if fid == 1:
-
 
2473
        if ftype == TType.I64:
-
 
2474
          self.purchaseId = iprot.readI64();
-
 
2475
        else:
-
 
2476
          iprot.skip(ftype)
-
 
2477
      elif fid == 2:
-
 
2478
        if ftype == TType.I64:
-
 
2479
          self.itemId = iprot.readI64();
-
 
2480
        else:
-
 
2481
          iprot.skip(ftype)
-
 
2482
      elif fid == 3:
-
 
2483
        if ftype == TType.I64:
-
 
2484
          self.quantity = iprot.readI64();
-
 
2485
        else:
-
 
2486
          iprot.skip(ftype)
-
 
2487
      else:
-
 
2488
        iprot.skip(ftype)
-
 
2489
      iprot.readFieldEnd()
-
 
2490
    iprot.readStructEnd()
-
 
2491
 
-
 
2492
  def write(self, oprot):
-
 
2493
    if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:
-
 
2494
      oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))
-
 
2495
      return
-
 
2496
    oprot.writeStructBegin('unFulfillPO_args')
-
 
2497
    if self.purchaseId is not None:
-
 
2498
      oprot.writeFieldBegin('purchaseId', TType.I64, 1)
-
 
2499
      oprot.writeI64(self.purchaseId)
-
 
2500
      oprot.writeFieldEnd()
-
 
2501
    if self.itemId is not None:
-
 
2502
      oprot.writeFieldBegin('itemId', TType.I64, 2)
-
 
2503
      oprot.writeI64(self.itemId)
-
 
2504
      oprot.writeFieldEnd()
-
 
2505
    if self.quantity is not None:
-
 
2506
      oprot.writeFieldBegin('quantity', TType.I64, 3)
-
 
2507
      oprot.writeI64(self.quantity)
-
 
2508
      oprot.writeFieldEnd()
-
 
2509
    oprot.writeFieldStop()
-
 
2510
    oprot.writeStructEnd()
-
 
2511
 
-
 
2512
  def validate(self):
-
 
2513
    return
-
 
2514
 
-
 
2515
 
-
 
2516
  def __repr__(self):
-
 
2517
    L = ['%s=%r' % (key, value)
-
 
2518
      for key, value in self.__dict__.iteritems()]
-
 
2519
    return '%s(%s)' % (self.__class__.__name__, ', '.join(L))
-
 
2520
 
-
 
2521
  def __eq__(self, other):
-
 
2522
    return isinstance(other, self.__class__) and self.__dict__ == other.__dict__
-
 
2523
 
-
 
2524
  def __ne__(self, other):
-
 
2525
    return not (self == other)
-
 
2526
 
-
 
2527
class unFulfillPO_result:
-
 
2528
  """
-
 
2529
  Attributes:
-
 
2530
   - e
-
 
2531
  """
-
 
2532
 
-
 
2533
  thrift_spec = (
-
 
2534
    None, # 0
-
 
2535
    (1, TType.STRUCT, 'e', (PurchaseServiceException, PurchaseServiceException.thrift_spec), None, ), # 1
-
 
2536
  )
-
 
2537
 
-
 
2538
  def __init__(self, e=None,):
-
 
2539
    self.e = e
-
 
2540
 
-
 
2541
  def read(self, iprot):
-
 
2542
    if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:
-
 
2543
      fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec))
-
 
2544
      return
-
 
2545
    iprot.readStructBegin()
-
 
2546
    while True:
-
 
2547
      (fname, ftype, fid) = iprot.readFieldBegin()
-
 
2548
      if ftype == TType.STOP:
-
 
2549
        break
-
 
2550
      if fid == 1:
-
 
2551
        if ftype == TType.STRUCT:
-
 
2552
          self.e = PurchaseServiceException()
-
 
2553
          self.e.read(iprot)
-
 
2554
        else:
-
 
2555
          iprot.skip(ftype)
-
 
2556
      else:
-
 
2557
        iprot.skip(ftype)
-
 
2558
      iprot.readFieldEnd()
-
 
2559
    iprot.readStructEnd()
-
 
2560
 
-
 
2561
  def write(self, oprot):
-
 
2562
    if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:
-
 
2563
      oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))
-
 
2564
      return
-
 
2565
    oprot.writeStructBegin('unFulfillPO_result')
-
 
2566
    if self.e is not None:
-
 
2567
      oprot.writeFieldBegin('e', TType.STRUCT, 1)
-
 
2568
      self.e.write(oprot)
-
 
2569
      oprot.writeFieldEnd()
-
 
2570
    oprot.writeFieldStop()
2364
    oprot.writeStructEnd()
2571
    oprot.writeStructEnd()
2365
 
2572
 
2366
  def validate(self):
2573
  def validate(self):
2367
    return
2574
    return
2368
 
2575