Subversion Repositories SmartDukaan

Rev

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

Rev 730 Rev 764
Line 26... Line 26...
26
public class LogisticsService {
26
public class LogisticsService {
27
 
27
 
28
  public interface Iface {
28
  public interface Iface {
29
 
29
 
30
    /**
30
    /**
-
 
31
     * For closing the open session in sqlalchemy
-
 
32
     */
-
 
33
    public void closeSession() throws TException;
-
 
34
 
-
 
35
    /**
31
     * Returns a provider for a given provider ID. Throws an exception if none found.
36
     * Returns a provider for a given provider ID. Throws an exception if none found.
32
     * 
37
     * 
33
     * @param providerId
38
     * @param providerId
34
     */
39
     */
35
    public Provider getProvider(long providerId) throws LogisticsServiceException, TException;
40
    public Provider getProvider(long providerId) throws LogisticsServiceException, TException;
Line 108... Line 113...
108
    public TProtocol getOutputProtocol()
113
    public TProtocol getOutputProtocol()
109
    {
114
    {
110
      return this.oprot_;
115
      return this.oprot_;
111
    }
116
    }
112
 
117
 
-
 
118
    public void closeSession() throws TException
-
 
119
    {
-
 
120
      send_closeSession();
-
 
121
      recv_closeSession();
-
 
122
    }
-
 
123
 
-
 
124
    public void send_closeSession() throws TException
-
 
125
    {
-
 
126
      oprot_.writeMessageBegin(new TMessage("closeSession", TMessageType.CALL, seqid_));
-
 
127
      closeSession_args args = new closeSession_args();
-
 
128
      args.write(oprot_);
-
 
129
      oprot_.writeMessageEnd();
-
 
130
      oprot_.getTransport().flush();
-
 
131
    }
-
 
132
 
-
 
133
    public void recv_closeSession() throws TException
-
 
134
    {
-
 
135
      TMessage msg = iprot_.readMessageBegin();
-
 
136
      if (msg.type == TMessageType.EXCEPTION) {
-
 
137
        TApplicationException x = TApplicationException.read(iprot_);
-
 
138
        iprot_.readMessageEnd();
-
 
139
        throw x;
-
 
140
      }
-
 
141
      closeSession_result result = new closeSession_result();
-
 
142
      result.read(iprot_);
-
 
143
      iprot_.readMessageEnd();
-
 
144
      return;
-
 
145
    }
-
 
146
 
113
    public Provider getProvider(long providerId) throws LogisticsServiceException, TException
147
    public Provider getProvider(long providerId) throws LogisticsServiceException, TException
114
    {
148
    {
115
      send_getProvider(providerId);
149
      send_getProvider(providerId);
116
      return recv_getProvider();
150
      return recv_getProvider();
117
    }
151
    }
Line 369... Line 403...
369
  public static class Processor implements TProcessor {
403
  public static class Processor implements TProcessor {
370
    private static final Logger LOGGER = LoggerFactory.getLogger(Processor.class.getName());
404
    private static final Logger LOGGER = LoggerFactory.getLogger(Processor.class.getName());
371
    public Processor(Iface iface)
405
    public Processor(Iface iface)
372
    {
406
    {
373
      iface_ = iface;
407
      iface_ = iface;
-
 
408
      processMap_.put("closeSession", new closeSession());
374
      processMap_.put("getProvider", new getProvider());
409
      processMap_.put("getProvider", new getProvider());
375
      processMap_.put("getAllProviders", new getAllProviders());
410
      processMap_.put("getAllProviders", new getAllProviders());
376
      processMap_.put("getLogisticsEstimation", new getLogisticsEstimation());
411
      processMap_.put("getLogisticsEstimation", new getLogisticsEstimation());
377
      processMap_.put("getLogisticsInfo", new getLogisticsInfo());
412
      processMap_.put("getLogisticsInfo", new getLogisticsInfo());
378
      processMap_.put("getEmptyAWB", new getEmptyAWB());
413
      processMap_.put("getEmptyAWB", new getEmptyAWB());
Line 403... Line 438...
403
      }
438
      }
404
      fn.process(msg.seqid, iprot, oprot);
439
      fn.process(msg.seqid, iprot, oprot);
405
      return true;
440
      return true;
406
    }
441
    }
407
 
442
 
-
 
443
    private class closeSession implements ProcessFunction {
-
 
444
      public void process(int seqid, TProtocol iprot, TProtocol oprot) throws TException
-
 
445
      {
-
 
446
        closeSession_args args = new closeSession_args();
-
 
447
        args.read(iprot);
-
 
448
        iprot.readMessageEnd();
-
 
449
        closeSession_result result = new closeSession_result();
-
 
450
        iface_.closeSession();
-
 
451
        oprot.writeMessageBegin(new TMessage("closeSession", TMessageType.REPLY, seqid));
-
 
452
        result.write(oprot);
-
 
453
        oprot.writeMessageEnd();
-
 
454
        oprot.getTransport().flush();
-
 
455
      }
-
 
456
 
-
 
457
    }
-
 
458
 
408
    private class getProvider implements ProcessFunction {
459
    private class getProvider implements ProcessFunction {
409
      public void process(int seqid, TProtocol iprot, TProtocol oprot) throws TException
460
      public void process(int seqid, TProtocol iprot, TProtocol oprot) throws TException
410
      {
461
      {
411
        getProvider_args args = new getProvider_args();
462
        getProvider_args args = new getProvider_args();
412
        args.read(iprot);
463
        args.read(iprot);
Line 601... Line 652...
601
 
652
 
602
    }
653
    }
603
 
654
 
604
  }
655
  }
605
 
656
 
-
 
657
  public static class closeSession_args implements TBase<closeSession_args._Fields>, java.io.Serializable, Cloneable, Comparable<closeSession_args>   {
-
 
658
    private static final TStruct STRUCT_DESC = new TStruct("closeSession_args");
-
 
659
 
-
 
660
 
-
 
661
 
-
 
662
    /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
-
 
663
    public enum _Fields implements TFieldIdEnum {
-
 
664
;
-
 
665
 
-
 
666
      private static final Map<Integer, _Fields> byId = new HashMap<Integer, _Fields>();
-
 
667
      private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();
-
 
668
 
-
 
669
      static {
-
 
670
        for (_Fields field : EnumSet.allOf(_Fields.class)) {
-
 
671
          byId.put((int)field._thriftId, field);
-
 
672
          byName.put(field.getFieldName(), field);
-
 
673
        }
-
 
674
      }
-
 
675
 
-
 
676
      /**
-
 
677
       * Find the _Fields constant that matches fieldId, or null if its not found.
-
 
678
       */
-
 
679
      public static _Fields findByThriftId(int fieldId) {
-
 
680
        return byId.get(fieldId);
-
 
681
      }
-
 
682
 
-
 
683
      /**
-
 
684
       * Find the _Fields constant that matches fieldId, throwing an exception
-
 
685
       * if it is not found.
-
 
686
       */
-
 
687
      public static _Fields findByThriftIdOrThrow(int fieldId) {
-
 
688
        _Fields fields = findByThriftId(fieldId);
-
 
689
        if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!");
-
 
690
        return fields;
-
 
691
      }
-
 
692
 
-
 
693
      /**
-
 
694
       * Find the _Fields constant that matches name, or null if its not found.
-
 
695
       */
-
 
696
      public static _Fields findByName(String name) {
-
 
697
        return byName.get(name);
-
 
698
      }
-
 
699
 
-
 
700
      private final short _thriftId;
-
 
701
      private final String _fieldName;
-
 
702
 
-
 
703
      _Fields(short thriftId, String fieldName) {
-
 
704
        _thriftId = thriftId;
-
 
705
        _fieldName = fieldName;
-
 
706
      }
-
 
707
 
-
 
708
      public short getThriftFieldId() {
-
 
709
        return _thriftId;
-
 
710
      }
-
 
711
 
-
 
712
      public String getFieldName() {
-
 
713
        return _fieldName;
-
 
714
      }
-
 
715
    }
-
 
716
    public static final Map<_Fields, FieldMetaData> metaDataMap = Collections.unmodifiableMap(new EnumMap<_Fields, FieldMetaData>(_Fields.class) {{
-
 
717
    }});
-
 
718
 
-
 
719
    static {
-
 
720
      FieldMetaData.addStructMetaDataMap(closeSession_args.class, metaDataMap);
-
 
721
    }
-
 
722
 
-
 
723
    public closeSession_args() {
-
 
724
    }
-
 
725
 
-
 
726
    /**
-
 
727
     * Performs a deep copy on <i>other</i>.
-
 
728
     */
-
 
729
    public closeSession_args(closeSession_args other) {
-
 
730
    }
-
 
731
 
-
 
732
    public closeSession_args deepCopy() {
-
 
733
      return new closeSession_args(this);
-
 
734
    }
-
 
735
 
-
 
736
    @Deprecated
-
 
737
    public closeSession_args clone() {
-
 
738
      return new closeSession_args(this);
-
 
739
    }
-
 
740
 
-
 
741
    public void setFieldValue(_Fields field, Object value) {
-
 
742
      switch (field) {
-
 
743
      }
-
 
744
    }
-
 
745
 
-
 
746
    public void setFieldValue(int fieldID, Object value) {
-
 
747
      setFieldValue(_Fields.findByThriftIdOrThrow(fieldID), value);
-
 
748
    }
-
 
749
 
-
 
750
    public Object getFieldValue(_Fields field) {
-
 
751
      switch (field) {
-
 
752
      }
-
 
753
      throw new IllegalStateException();
-
 
754
    }
-
 
755
 
-
 
756
    public Object getFieldValue(int fieldId) {
-
 
757
      return getFieldValue(_Fields.findByThriftIdOrThrow(fieldId));
-
 
758
    }
-
 
759
 
-
 
760
    /** Returns true if field corresponding to fieldID is set (has been asigned a value) and false otherwise */
-
 
761
    public boolean isSet(_Fields field) {
-
 
762
      switch (field) {
-
 
763
      }
-
 
764
      throw new IllegalStateException();
-
 
765
    }
-
 
766
 
-
 
767
    public boolean isSet(int fieldID) {
-
 
768
      return isSet(_Fields.findByThriftIdOrThrow(fieldID));
-
 
769
    }
-
 
770
 
-
 
771
    @Override
-
 
772
    public boolean equals(Object that) {
-
 
773
      if (that == null)
-
 
774
        return false;
-
 
775
      if (that instanceof closeSession_args)
-
 
776
        return this.equals((closeSession_args)that);
-
 
777
      return false;
-
 
778
    }
-
 
779
 
-
 
780
    public boolean equals(closeSession_args that) {
-
 
781
      if (that == null)
-
 
782
        return false;
-
 
783
 
-
 
784
      return true;
-
 
785
    }
-
 
786
 
-
 
787
    @Override
-
 
788
    public int hashCode() {
-
 
789
      return 0;
-
 
790
    }
-
 
791
 
-
 
792
    public int compareTo(closeSession_args other) {
-
 
793
      if (!getClass().equals(other.getClass())) {
-
 
794
        return getClass().getName().compareTo(other.getClass().getName());
-
 
795
      }
-
 
796
 
-
 
797
      int lastComparison = 0;
-
 
798
      closeSession_args typedOther = (closeSession_args)other;
-
 
799
 
-
 
800
      return 0;
-
 
801
    }
-
 
802
 
-
 
803
    public void read(TProtocol iprot) throws TException {
-
 
804
      TField field;
-
 
805
      iprot.readStructBegin();
-
 
806
      while (true)
-
 
807
      {
-
 
808
        field = iprot.readFieldBegin();
-
 
809
        if (field.type == TType.STOP) { 
-
 
810
          break;
-
 
811
        }
-
 
812
        _Fields fieldId = _Fields.findByThriftId(field.id);
-
 
813
        if (fieldId == null) {
-
 
814
          TProtocolUtil.skip(iprot, field.type);
-
 
815
        } else {
-
 
816
          switch (fieldId) {
-
 
817
          }
-
 
818
          iprot.readFieldEnd();
-
 
819
        }
-
 
820
      }
-
 
821
      iprot.readStructEnd();
-
 
822
      validate();
-
 
823
    }
-
 
824
 
-
 
825
    public void write(TProtocol oprot) throws TException {
-
 
826
      validate();
-
 
827
 
-
 
828
      oprot.writeStructBegin(STRUCT_DESC);
-
 
829
      oprot.writeFieldStop();
-
 
830
      oprot.writeStructEnd();
-
 
831
    }
-
 
832
 
-
 
833
    @Override
-
 
834
    public String toString() {
-
 
835
      StringBuilder sb = new StringBuilder("closeSession_args(");
-
 
836
      boolean first = true;
-
 
837
 
-
 
838
      sb.append(")");
-
 
839
      return sb.toString();
-
 
840
    }
-
 
841
 
-
 
842
    public void validate() throws TException {
-
 
843
      // check for required fields
-
 
844
    }
-
 
845
 
-
 
846
  }
-
 
847
 
-
 
848
  public static class closeSession_result implements TBase<closeSession_result._Fields>, java.io.Serializable, Cloneable, Comparable<closeSession_result>   {
-
 
849
    private static final TStruct STRUCT_DESC = new TStruct("closeSession_result");
-
 
850
 
-
 
851
 
-
 
852
 
-
 
853
    /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
-
 
854
    public enum _Fields implements TFieldIdEnum {
-
 
855
;
-
 
856
 
-
 
857
      private static final Map<Integer, _Fields> byId = new HashMap<Integer, _Fields>();
-
 
858
      private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();
-
 
859
 
-
 
860
      static {
-
 
861
        for (_Fields field : EnumSet.allOf(_Fields.class)) {
-
 
862
          byId.put((int)field._thriftId, field);
-
 
863
          byName.put(field.getFieldName(), field);
-
 
864
        }
-
 
865
      }
-
 
866
 
-
 
867
      /**
-
 
868
       * Find the _Fields constant that matches fieldId, or null if its not found.
-
 
869
       */
-
 
870
      public static _Fields findByThriftId(int fieldId) {
-
 
871
        return byId.get(fieldId);
-
 
872
      }
-
 
873
 
-
 
874
      /**
-
 
875
       * Find the _Fields constant that matches fieldId, throwing an exception
-
 
876
       * if it is not found.
-
 
877
       */
-
 
878
      public static _Fields findByThriftIdOrThrow(int fieldId) {
-
 
879
        _Fields fields = findByThriftId(fieldId);
-
 
880
        if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!");
-
 
881
        return fields;
-
 
882
      }
-
 
883
 
-
 
884
      /**
-
 
885
       * Find the _Fields constant that matches name, or null if its not found.
-
 
886
       */
-
 
887
      public static _Fields findByName(String name) {
-
 
888
        return byName.get(name);
-
 
889
      }
-
 
890
 
-
 
891
      private final short _thriftId;
-
 
892
      private final String _fieldName;
-
 
893
 
-
 
894
      _Fields(short thriftId, String fieldName) {
-
 
895
        _thriftId = thriftId;
-
 
896
        _fieldName = fieldName;
-
 
897
      }
-
 
898
 
-
 
899
      public short getThriftFieldId() {
-
 
900
        return _thriftId;
-
 
901
      }
-
 
902
 
-
 
903
      public String getFieldName() {
-
 
904
        return _fieldName;
-
 
905
      }
-
 
906
    }
-
 
907
    public static final Map<_Fields, FieldMetaData> metaDataMap = Collections.unmodifiableMap(new EnumMap<_Fields, FieldMetaData>(_Fields.class) {{
-
 
908
    }});
-
 
909
 
-
 
910
    static {
-
 
911
      FieldMetaData.addStructMetaDataMap(closeSession_result.class, metaDataMap);
-
 
912
    }
-
 
913
 
-
 
914
    public closeSession_result() {
-
 
915
    }
-
 
916
 
-
 
917
    /**
-
 
918
     * Performs a deep copy on <i>other</i>.
-
 
919
     */
-
 
920
    public closeSession_result(closeSession_result other) {
-
 
921
    }
-
 
922
 
-
 
923
    public closeSession_result deepCopy() {
-
 
924
      return new closeSession_result(this);
-
 
925
    }
-
 
926
 
-
 
927
    @Deprecated
-
 
928
    public closeSession_result clone() {
-
 
929
      return new closeSession_result(this);
-
 
930
    }
-
 
931
 
-
 
932
    public void setFieldValue(_Fields field, Object value) {
-
 
933
      switch (field) {
-
 
934
      }
-
 
935
    }
-
 
936
 
-
 
937
    public void setFieldValue(int fieldID, Object value) {
-
 
938
      setFieldValue(_Fields.findByThriftIdOrThrow(fieldID), value);
-
 
939
    }
-
 
940
 
-
 
941
    public Object getFieldValue(_Fields field) {
-
 
942
      switch (field) {
-
 
943
      }
-
 
944
      throw new IllegalStateException();
-
 
945
    }
-
 
946
 
-
 
947
    public Object getFieldValue(int fieldId) {
-
 
948
      return getFieldValue(_Fields.findByThriftIdOrThrow(fieldId));
-
 
949
    }
-
 
950
 
-
 
951
    /** Returns true if field corresponding to fieldID is set (has been asigned a value) and false otherwise */
-
 
952
    public boolean isSet(_Fields field) {
-
 
953
      switch (field) {
-
 
954
      }
-
 
955
      throw new IllegalStateException();
-
 
956
    }
-
 
957
 
-
 
958
    public boolean isSet(int fieldID) {
-
 
959
      return isSet(_Fields.findByThriftIdOrThrow(fieldID));
-
 
960
    }
-
 
961
 
-
 
962
    @Override
-
 
963
    public boolean equals(Object that) {
-
 
964
      if (that == null)
-
 
965
        return false;
-
 
966
      if (that instanceof closeSession_result)
-
 
967
        return this.equals((closeSession_result)that);
-
 
968
      return false;
-
 
969
    }
-
 
970
 
-
 
971
    public boolean equals(closeSession_result that) {
-
 
972
      if (that == null)
-
 
973
        return false;
-
 
974
 
-
 
975
      return true;
-
 
976
    }
-
 
977
 
-
 
978
    @Override
-
 
979
    public int hashCode() {
-
 
980
      return 0;
-
 
981
    }
-
 
982
 
-
 
983
    public int compareTo(closeSession_result other) {
-
 
984
      if (!getClass().equals(other.getClass())) {
-
 
985
        return getClass().getName().compareTo(other.getClass().getName());
-
 
986
      }
-
 
987
 
-
 
988
      int lastComparison = 0;
-
 
989
      closeSession_result typedOther = (closeSession_result)other;
-
 
990
 
-
 
991
      return 0;
-
 
992
    }
-
 
993
 
-
 
994
    public void read(TProtocol iprot) throws TException {
-
 
995
      TField field;
-
 
996
      iprot.readStructBegin();
-
 
997
      while (true)
-
 
998
      {
-
 
999
        field = iprot.readFieldBegin();
-
 
1000
        if (field.type == TType.STOP) { 
-
 
1001
          break;
-
 
1002
        }
-
 
1003
        _Fields fieldId = _Fields.findByThriftId(field.id);
-
 
1004
        if (fieldId == null) {
-
 
1005
          TProtocolUtil.skip(iprot, field.type);
-
 
1006
        } else {
-
 
1007
          switch (fieldId) {
-
 
1008
          }
-
 
1009
          iprot.readFieldEnd();
-
 
1010
        }
-
 
1011
      }
-
 
1012
      iprot.readStructEnd();
-
 
1013
      validate();
-
 
1014
    }
-
 
1015
 
-
 
1016
    public void write(TProtocol oprot) throws TException {
-
 
1017
      oprot.writeStructBegin(STRUCT_DESC);
-
 
1018
 
-
 
1019
      oprot.writeFieldStop();
-
 
1020
      oprot.writeStructEnd();
-
 
1021
    }
-
 
1022
 
-
 
1023
    @Override
-
 
1024
    public String toString() {
-
 
1025
      StringBuilder sb = new StringBuilder("closeSession_result(");
-
 
1026
      boolean first = true;
-
 
1027
 
-
 
1028
      sb.append(")");
-
 
1029
      return sb.toString();
-
 
1030
    }
-
 
1031
 
-
 
1032
    public void validate() throws TException {
-
 
1033
      // check for required fields
-
 
1034
    }
-
 
1035
 
-
 
1036
  }
-
 
1037
 
606
  public static class getProvider_args implements TBase<getProvider_args._Fields>, java.io.Serializable, Cloneable, Comparable<getProvider_args>   {
1038
  public static class getProvider_args implements TBase<getProvider_args._Fields>, java.io.Serializable, Cloneable, Comparable<getProvider_args>   {
607
    private static final TStruct STRUCT_DESC = new TStruct("getProvider_args");
1039
    private static final TStruct STRUCT_DESC = new TStruct("getProvider_args");
608
 
1040
 
609
    private static final TField PROVIDER_ID_FIELD_DESC = new TField("providerId", TType.I64, (short)1);
1041
    private static final TField PROVIDER_ID_FIELD_DESC = new TField("providerId", TType.I64, (short)1);
610
 
1042