Subversion Repositories SmartDukaan

Rev

Rev 758 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 758 Rev 764
Line 25... Line 25...
25
 
25
 
26
public class TransactionService {
26
public class TransactionService {
27
 
27
 
28
  public interface Iface {
28
  public interface Iface {
29
 
29
 
-
 
30
    /**
-
 
31
     * For closing the open session in sqlalchemy
-
 
32
     */
-
 
33
    public void closeSession() throws TException;
-
 
34
 
30
    public long createTransaction(Transaction transaction) throws TransactionServiceException, TException;
35
    public long createTransaction(Transaction transaction) throws TransactionServiceException, TException;
31
 
36
 
32
    public Transaction getTransaction(long id) throws TransactionServiceException, TException;
37
    public Transaction getTransaction(long id) throws TransactionServiceException, TException;
33
 
38
 
34
    public List<Transaction> getTransactionsForCustomer(long customerId, long from_date, long to_date, TransactionStatus status) throws TransactionServiceException, TException;
39
    public List<Transaction> getTransactionsForCustomer(long customerId, long from_date, long to_date, TransactionStatus status) throws TransactionServiceException, TException;
Line 94... Line 99...
94
    public TProtocol getOutputProtocol()
99
    public TProtocol getOutputProtocol()
95
    {
100
    {
96
      return this.oprot_;
101
      return this.oprot_;
97
    }
102
    }
98
 
103
 
-
 
104
    public void closeSession() throws TException
-
 
105
    {
-
 
106
      send_closeSession();
-
 
107
      recv_closeSession();
-
 
108
    }
-
 
109
 
-
 
110
    public void send_closeSession() throws TException
-
 
111
    {
-
 
112
      oprot_.writeMessageBegin(new TMessage("closeSession", TMessageType.CALL, seqid_));
-
 
113
      closeSession_args args = new closeSession_args();
-
 
114
      args.write(oprot_);
-
 
115
      oprot_.writeMessageEnd();
-
 
116
      oprot_.getTransport().flush();
-
 
117
    }
-
 
118
 
-
 
119
    public void recv_closeSession() throws TException
-
 
120
    {
-
 
121
      TMessage msg = iprot_.readMessageBegin();
-
 
122
      if (msg.type == TMessageType.EXCEPTION) {
-
 
123
        TApplicationException x = TApplicationException.read(iprot_);
-
 
124
        iprot_.readMessageEnd();
-
 
125
        throw x;
-
 
126
      }
-
 
127
      closeSession_result result = new closeSession_result();
-
 
128
      result.read(iprot_);
-
 
129
      iprot_.readMessageEnd();
-
 
130
      return;
-
 
131
    }
-
 
132
 
99
    public long createTransaction(Transaction transaction) throws TransactionServiceException, TException
133
    public long createTransaction(Transaction transaction) throws TransactionServiceException, TException
100
    {
134
    {
101
      send_createTransaction(transaction);
135
      send_createTransaction(transaction);
102
      return recv_createTransaction();
136
      return recv_createTransaction();
103
    }
137
    }
Line 724... Line 758...
724
  public static class Processor implements TProcessor {
758
  public static class Processor implements TProcessor {
725
    private static final Logger LOGGER = LoggerFactory.getLogger(Processor.class.getName());
759
    private static final Logger LOGGER = LoggerFactory.getLogger(Processor.class.getName());
726
    public Processor(Iface iface)
760
    public Processor(Iface iface)
727
    {
761
    {
728
      iface_ = iface;
762
      iface_ = iface;
-
 
763
      processMap_.put("closeSession", new closeSession());
729
      processMap_.put("createTransaction", new createTransaction());
764
      processMap_.put("createTransaction", new createTransaction());
730
      processMap_.put("getTransaction", new getTransaction());
765
      processMap_.put("getTransaction", new getTransaction());
731
      processMap_.put("getTransactionsForCustomer", new getTransactionsForCustomer());
766
      processMap_.put("getTransactionsForCustomer", new getTransactionsForCustomer());
732
      processMap_.put("getTransactionsForShoppingCartId", new getTransactionsForShoppingCartId());
767
      processMap_.put("getTransactionsForShoppingCartId", new getTransactionsForShoppingCartId());
733
      processMap_.put("getTransactionStatus", new getTransactionStatus());
768
      processMap_.put("getTransactionStatus", new getTransactionStatus());
Line 768... Line 803...
768
      }
803
      }
769
      fn.process(msg.seqid, iprot, oprot);
804
      fn.process(msg.seqid, iprot, oprot);
770
      return true;
805
      return true;
771
    }
806
    }
772
 
807
 
-
 
808
    private class closeSession implements ProcessFunction {
-
 
809
      public void process(int seqid, TProtocol iprot, TProtocol oprot) throws TException
-
 
810
      {
-
 
811
        closeSession_args args = new closeSession_args();
-
 
812
        args.read(iprot);
-
 
813
        iprot.readMessageEnd();
-
 
814
        closeSession_result result = new closeSession_result();
-
 
815
        iface_.closeSession();
-
 
816
        oprot.writeMessageBegin(new TMessage("closeSession", TMessageType.REPLY, seqid));
-
 
817
        result.write(oprot);
-
 
818
        oprot.writeMessageEnd();
-
 
819
        oprot.getTransport().flush();
-
 
820
      }
-
 
821
 
-
 
822
    }
-
 
823
 
773
    private class createTransaction implements ProcessFunction {
824
    private class createTransaction implements ProcessFunction {
774
      public void process(int seqid, TProtocol iprot, TProtocol oprot) throws TException
825
      public void process(int seqid, TProtocol iprot, TProtocol oprot) throws TException
775
      {
826
      {
776
        createTransaction_args args = new createTransaction_args();
827
        createTransaction_args args = new createTransaction_args();
777
        args.read(iprot);
828
        args.read(iprot);
Line 1228... Line 1279...
1228
 
1279
 
1229
    }
1280
    }
1230
 
1281
 
1231
  }
1282
  }
1232
 
1283
 
-
 
1284
  public static class closeSession_args implements TBase<closeSession_args._Fields>, java.io.Serializable, Cloneable, Comparable<closeSession_args>   {
-
 
1285
    private static final TStruct STRUCT_DESC = new TStruct("closeSession_args");
-
 
1286
 
-
 
1287
 
-
 
1288
 
-
 
1289
    /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
-
 
1290
    public enum _Fields implements TFieldIdEnum {
-
 
1291
;
-
 
1292
 
-
 
1293
      private static final Map<Integer, _Fields> byId = new HashMap<Integer, _Fields>();
-
 
1294
      private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();
-
 
1295
 
-
 
1296
      static {
-
 
1297
        for (_Fields field : EnumSet.allOf(_Fields.class)) {
-
 
1298
          byId.put((int)field._thriftId, field);
-
 
1299
          byName.put(field.getFieldName(), field);
-
 
1300
        }
-
 
1301
      }
-
 
1302
 
-
 
1303
      /**
-
 
1304
       * Find the _Fields constant that matches fieldId, or null if its not found.
-
 
1305
       */
-
 
1306
      public static _Fields findByThriftId(int fieldId) {
-
 
1307
        return byId.get(fieldId);
-
 
1308
      }
-
 
1309
 
-
 
1310
      /**
-
 
1311
       * Find the _Fields constant that matches fieldId, throwing an exception
-
 
1312
       * if it is not found.
-
 
1313
       */
-
 
1314
      public static _Fields findByThriftIdOrThrow(int fieldId) {
-
 
1315
        _Fields fields = findByThriftId(fieldId);
-
 
1316
        if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!");
-
 
1317
        return fields;
-
 
1318
      }
-
 
1319
 
-
 
1320
      /**
-
 
1321
       * Find the _Fields constant that matches name, or null if its not found.
-
 
1322
       */
-
 
1323
      public static _Fields findByName(String name) {
-
 
1324
        return byName.get(name);
-
 
1325
      }
-
 
1326
 
-
 
1327
      private final short _thriftId;
-
 
1328
      private final String _fieldName;
-
 
1329
 
-
 
1330
      _Fields(short thriftId, String fieldName) {
-
 
1331
        _thriftId = thriftId;
-
 
1332
        _fieldName = fieldName;
-
 
1333
      }
-
 
1334
 
-
 
1335
      public short getThriftFieldId() {
-
 
1336
        return _thriftId;
-
 
1337
      }
-
 
1338
 
-
 
1339
      public String getFieldName() {
-
 
1340
        return _fieldName;
-
 
1341
      }
-
 
1342
    }
-
 
1343
    public static final Map<_Fields, FieldMetaData> metaDataMap = Collections.unmodifiableMap(new EnumMap<_Fields, FieldMetaData>(_Fields.class) {{
-
 
1344
    }});
-
 
1345
 
-
 
1346
    static {
-
 
1347
      FieldMetaData.addStructMetaDataMap(closeSession_args.class, metaDataMap);
-
 
1348
    }
-
 
1349
 
-
 
1350
    public closeSession_args() {
-
 
1351
    }
-
 
1352
 
-
 
1353
    /**
-
 
1354
     * Performs a deep copy on <i>other</i>.
-
 
1355
     */
-
 
1356
    public closeSession_args(closeSession_args other) {
-
 
1357
    }
-
 
1358
 
-
 
1359
    public closeSession_args deepCopy() {
-
 
1360
      return new closeSession_args(this);
-
 
1361
    }
-
 
1362
 
-
 
1363
    @Deprecated
-
 
1364
    public closeSession_args clone() {
-
 
1365
      return new closeSession_args(this);
-
 
1366
    }
-
 
1367
 
-
 
1368
    public void setFieldValue(_Fields field, Object value) {
-
 
1369
      switch (field) {
-
 
1370
      }
-
 
1371
    }
-
 
1372
 
-
 
1373
    public void setFieldValue(int fieldID, Object value) {
-
 
1374
      setFieldValue(_Fields.findByThriftIdOrThrow(fieldID), value);
-
 
1375
    }
-
 
1376
 
-
 
1377
    public Object getFieldValue(_Fields field) {
-
 
1378
      switch (field) {
-
 
1379
      }
-
 
1380
      throw new IllegalStateException();
-
 
1381
    }
-
 
1382
 
-
 
1383
    public Object getFieldValue(int fieldId) {
-
 
1384
      return getFieldValue(_Fields.findByThriftIdOrThrow(fieldId));
-
 
1385
    }
-
 
1386
 
-
 
1387
    /** Returns true if field corresponding to fieldID is set (has been asigned a value) and false otherwise */
-
 
1388
    public boolean isSet(_Fields field) {
-
 
1389
      switch (field) {
-
 
1390
      }
-
 
1391
      throw new IllegalStateException();
-
 
1392
    }
-
 
1393
 
-
 
1394
    public boolean isSet(int fieldID) {
-
 
1395
      return isSet(_Fields.findByThriftIdOrThrow(fieldID));
-
 
1396
    }
-
 
1397
 
-
 
1398
    @Override
-
 
1399
    public boolean equals(Object that) {
-
 
1400
      if (that == null)
-
 
1401
        return false;
-
 
1402
      if (that instanceof closeSession_args)
-
 
1403
        return this.equals((closeSession_args)that);
-
 
1404
      return false;
-
 
1405
    }
-
 
1406
 
-
 
1407
    public boolean equals(closeSession_args that) {
-
 
1408
      if (that == null)
-
 
1409
        return false;
-
 
1410
 
-
 
1411
      return true;
-
 
1412
    }
-
 
1413
 
-
 
1414
    @Override
-
 
1415
    public int hashCode() {
-
 
1416
      return 0;
-
 
1417
    }
-
 
1418
 
-
 
1419
    public int compareTo(closeSession_args other) {
-
 
1420
      if (!getClass().equals(other.getClass())) {
-
 
1421
        return getClass().getName().compareTo(other.getClass().getName());
-
 
1422
      }
-
 
1423
 
-
 
1424
      int lastComparison = 0;
-
 
1425
      closeSession_args typedOther = (closeSession_args)other;
-
 
1426
 
-
 
1427
      return 0;
-
 
1428
    }
-
 
1429
 
-
 
1430
    public void read(TProtocol iprot) throws TException {
-
 
1431
      TField field;
-
 
1432
      iprot.readStructBegin();
-
 
1433
      while (true)
-
 
1434
      {
-
 
1435
        field = iprot.readFieldBegin();
-
 
1436
        if (field.type == TType.STOP) { 
-
 
1437
          break;
-
 
1438
        }
-
 
1439
        _Fields fieldId = _Fields.findByThriftId(field.id);
-
 
1440
        if (fieldId == null) {
-
 
1441
          TProtocolUtil.skip(iprot, field.type);
-
 
1442
        } else {
-
 
1443
          switch (fieldId) {
-
 
1444
          }
-
 
1445
          iprot.readFieldEnd();
-
 
1446
        }
-
 
1447
      }
-
 
1448
      iprot.readStructEnd();
-
 
1449
      validate();
-
 
1450
    }
-
 
1451
 
-
 
1452
    public void write(TProtocol oprot) throws TException {
-
 
1453
      validate();
-
 
1454
 
-
 
1455
      oprot.writeStructBegin(STRUCT_DESC);
-
 
1456
      oprot.writeFieldStop();
-
 
1457
      oprot.writeStructEnd();
-
 
1458
    }
-
 
1459
 
-
 
1460
    @Override
-
 
1461
    public String toString() {
-
 
1462
      StringBuilder sb = new StringBuilder("closeSession_args(");
-
 
1463
      boolean first = true;
-
 
1464
 
-
 
1465
      sb.append(")");
-
 
1466
      return sb.toString();
-
 
1467
    }
-
 
1468
 
-
 
1469
    public void validate() throws TException {
-
 
1470
      // check for required fields
-
 
1471
    }
-
 
1472
 
-
 
1473
  }
-
 
1474
 
-
 
1475
  public static class closeSession_result implements TBase<closeSession_result._Fields>, java.io.Serializable, Cloneable, Comparable<closeSession_result>   {
-
 
1476
    private static final TStruct STRUCT_DESC = new TStruct("closeSession_result");
-
 
1477
 
-
 
1478
 
-
 
1479
 
-
 
1480
    /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
-
 
1481
    public enum _Fields implements TFieldIdEnum {
-
 
1482
;
-
 
1483
 
-
 
1484
      private static final Map<Integer, _Fields> byId = new HashMap<Integer, _Fields>();
-
 
1485
      private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();
-
 
1486
 
-
 
1487
      static {
-
 
1488
        for (_Fields field : EnumSet.allOf(_Fields.class)) {
-
 
1489
          byId.put((int)field._thriftId, field);
-
 
1490
          byName.put(field.getFieldName(), field);
-
 
1491
        }
-
 
1492
      }
-
 
1493
 
-
 
1494
      /**
-
 
1495
       * Find the _Fields constant that matches fieldId, or null if its not found.
-
 
1496
       */
-
 
1497
      public static _Fields findByThriftId(int fieldId) {
-
 
1498
        return byId.get(fieldId);
-
 
1499
      }
-
 
1500
 
-
 
1501
      /**
-
 
1502
       * Find the _Fields constant that matches fieldId, throwing an exception
-
 
1503
       * if it is not found.
-
 
1504
       */
-
 
1505
      public static _Fields findByThriftIdOrThrow(int fieldId) {
-
 
1506
        _Fields fields = findByThriftId(fieldId);
-
 
1507
        if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!");
-
 
1508
        return fields;
-
 
1509
      }
-
 
1510
 
-
 
1511
      /**
-
 
1512
       * Find the _Fields constant that matches name, or null if its not found.
-
 
1513
       */
-
 
1514
      public static _Fields findByName(String name) {
-
 
1515
        return byName.get(name);
-
 
1516
      }
-
 
1517
 
-
 
1518
      private final short _thriftId;
-
 
1519
      private final String _fieldName;
-
 
1520
 
-
 
1521
      _Fields(short thriftId, String fieldName) {
-
 
1522
        _thriftId = thriftId;
-
 
1523
        _fieldName = fieldName;
-
 
1524
      }
-
 
1525
 
-
 
1526
      public short getThriftFieldId() {
-
 
1527
        return _thriftId;
-
 
1528
      }
-
 
1529
 
-
 
1530
      public String getFieldName() {
-
 
1531
        return _fieldName;
-
 
1532
      }
-
 
1533
    }
-
 
1534
    public static final Map<_Fields, FieldMetaData> metaDataMap = Collections.unmodifiableMap(new EnumMap<_Fields, FieldMetaData>(_Fields.class) {{
-
 
1535
    }});
-
 
1536
 
-
 
1537
    static {
-
 
1538
      FieldMetaData.addStructMetaDataMap(closeSession_result.class, metaDataMap);
-
 
1539
    }
-
 
1540
 
-
 
1541
    public closeSession_result() {
-
 
1542
    }
-
 
1543
 
-
 
1544
    /**
-
 
1545
     * Performs a deep copy on <i>other</i>.
-
 
1546
     */
-
 
1547
    public closeSession_result(closeSession_result other) {
-
 
1548
    }
-
 
1549
 
-
 
1550
    public closeSession_result deepCopy() {
-
 
1551
      return new closeSession_result(this);
-
 
1552
    }
-
 
1553
 
-
 
1554
    @Deprecated
-
 
1555
    public closeSession_result clone() {
-
 
1556
      return new closeSession_result(this);
-
 
1557
    }
-
 
1558
 
-
 
1559
    public void setFieldValue(_Fields field, Object value) {
-
 
1560
      switch (field) {
-
 
1561
      }
-
 
1562
    }
-
 
1563
 
-
 
1564
    public void setFieldValue(int fieldID, Object value) {
-
 
1565
      setFieldValue(_Fields.findByThriftIdOrThrow(fieldID), value);
-
 
1566
    }
-
 
1567
 
-
 
1568
    public Object getFieldValue(_Fields field) {
-
 
1569
      switch (field) {
-
 
1570
      }
-
 
1571
      throw new IllegalStateException();
-
 
1572
    }
-
 
1573
 
-
 
1574
    public Object getFieldValue(int fieldId) {
-
 
1575
      return getFieldValue(_Fields.findByThriftIdOrThrow(fieldId));
-
 
1576
    }
-
 
1577
 
-
 
1578
    /** Returns true if field corresponding to fieldID is set (has been asigned a value) and false otherwise */
-
 
1579
    public boolean isSet(_Fields field) {
-
 
1580
      switch (field) {
-
 
1581
      }
-
 
1582
      throw new IllegalStateException();
-
 
1583
    }
-
 
1584
 
-
 
1585
    public boolean isSet(int fieldID) {
-
 
1586
      return isSet(_Fields.findByThriftIdOrThrow(fieldID));
-
 
1587
    }
-
 
1588
 
-
 
1589
    @Override
-
 
1590
    public boolean equals(Object that) {
-
 
1591
      if (that == null)
-
 
1592
        return false;
-
 
1593
      if (that instanceof closeSession_result)
-
 
1594
        return this.equals((closeSession_result)that);
-
 
1595
      return false;
-
 
1596
    }
-
 
1597
 
-
 
1598
    public boolean equals(closeSession_result that) {
-
 
1599
      if (that == null)
-
 
1600
        return false;
-
 
1601
 
-
 
1602
      return true;
-
 
1603
    }
-
 
1604
 
-
 
1605
    @Override
-
 
1606
    public int hashCode() {
-
 
1607
      return 0;
-
 
1608
    }
-
 
1609
 
-
 
1610
    public int compareTo(closeSession_result other) {
-
 
1611
      if (!getClass().equals(other.getClass())) {
-
 
1612
        return getClass().getName().compareTo(other.getClass().getName());
-
 
1613
      }
-
 
1614
 
-
 
1615
      int lastComparison = 0;
-
 
1616
      closeSession_result typedOther = (closeSession_result)other;
-
 
1617
 
-
 
1618
      return 0;
-
 
1619
    }
-
 
1620
 
-
 
1621
    public void read(TProtocol iprot) throws TException {
-
 
1622
      TField field;
-
 
1623
      iprot.readStructBegin();
-
 
1624
      while (true)
-
 
1625
      {
-
 
1626
        field = iprot.readFieldBegin();
-
 
1627
        if (field.type == TType.STOP) { 
-
 
1628
          break;
-
 
1629
        }
-
 
1630
        _Fields fieldId = _Fields.findByThriftId(field.id);
-
 
1631
        if (fieldId == null) {
-
 
1632
          TProtocolUtil.skip(iprot, field.type);
-
 
1633
        } else {
-
 
1634
          switch (fieldId) {
-
 
1635
          }
-
 
1636
          iprot.readFieldEnd();
-
 
1637
        }
-
 
1638
      }
-
 
1639
      iprot.readStructEnd();
-
 
1640
      validate();
-
 
1641
    }
-
 
1642
 
-
 
1643
    public void write(TProtocol oprot) throws TException {
-
 
1644
      oprot.writeStructBegin(STRUCT_DESC);
-
 
1645
 
-
 
1646
      oprot.writeFieldStop();
-
 
1647
      oprot.writeStructEnd();
-
 
1648
    }
-
 
1649
 
-
 
1650
    @Override
-
 
1651
    public String toString() {
-
 
1652
      StringBuilder sb = new StringBuilder("closeSession_result(");
-
 
1653
      boolean first = true;
-
 
1654
 
-
 
1655
      sb.append(")");
-
 
1656
      return sb.toString();
-
 
1657
    }
-
 
1658
 
-
 
1659
    public void validate() throws TException {
-
 
1660
      // check for required fields
-
 
1661
    }
-
 
1662
 
-
 
1663
  }
-
 
1664
 
1233
  public static class createTransaction_args implements TBase<createTransaction_args._Fields>, java.io.Serializable, Cloneable, Comparable<createTransaction_args>   {
1665
  public static class createTransaction_args implements TBase<createTransaction_args._Fields>, java.io.Serializable, Cloneable, Comparable<createTransaction_args>   {
1234
    private static final TStruct STRUCT_DESC = new TStruct("createTransaction_args");
1666
    private static final TStruct STRUCT_DESC = new TStruct("createTransaction_args");
1235
 
1667
 
1236
    private static final TField TRANSACTION_FIELD_DESC = new TField("transaction", TType.STRUCT, (short)1);
1668
    private static final TField TRANSACTION_FIELD_DESC = new TField("transaction", TType.STRUCT, (short)1);
1237
 
1669