Subversion Repositories SmartDukaan

Rev

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

Rev 750 Rev 764
Line 25... Line 25...
25
 
25
 
26
public class HelperService {
26
public class HelperService {
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 void sendMail(Mail mail) throws HelperServiceException, TException;
35
    public void sendMail(Mail mail) throws HelperServiceException, TException;
31
 
36
 
32
    public void sendText(TextMessage message) throws HelperServiceException, TException;
37
    public void sendText(TextMessage message) throws HelperServiceException, TException;
33
 
38
 
34
    public void addMessage(Message message) throws HelperServiceException, TException;
39
    public void addMessage(Message message) throws HelperServiceException, TException;
Line 91... Line 96...
91
    public TProtocol getOutputProtocol()
96
    public TProtocol getOutputProtocol()
92
    {
97
    {
93
      return this.oprot_;
98
      return this.oprot_;
94
    }
99
    }
95
 
100
 
-
 
101
    public void closeSession() throws TException
-
 
102
    {
-
 
103
      send_closeSession();
-
 
104
      recv_closeSession();
-
 
105
    }
-
 
106
 
-
 
107
    public void send_closeSession() throws TException
-
 
108
    {
-
 
109
      oprot_.writeMessageBegin(new TMessage("closeSession", TMessageType.CALL, seqid_));
-
 
110
      closeSession_args args = new closeSession_args();
-
 
111
      args.write(oprot_);
-
 
112
      oprot_.writeMessageEnd();
-
 
113
      oprot_.getTransport().flush();
-
 
114
    }
-
 
115
 
-
 
116
    public void recv_closeSession() throws TException
-
 
117
    {
-
 
118
      TMessage msg = iprot_.readMessageBegin();
-
 
119
      if (msg.type == TMessageType.EXCEPTION) {
-
 
120
        TApplicationException x = TApplicationException.read(iprot_);
-
 
121
        iprot_.readMessageEnd();
-
 
122
        throw x;
-
 
123
      }
-
 
124
      closeSession_result result = new closeSession_result();
-
 
125
      result.read(iprot_);
-
 
126
      iprot_.readMessageEnd();
-
 
127
      return;
-
 
128
    }
-
 
129
 
96
    public void sendMail(Mail mail) throws HelperServiceException, TException
130
    public void sendMail(Mail mail) throws HelperServiceException, TException
97
    {
131
    {
98
      send_sendMail(mail);
132
      send_sendMail(mail);
99
      recv_sendMail();
133
      recv_sendMail();
100
    }
134
    }
Line 489... Line 523...
489
  public static class Processor implements TProcessor {
523
  public static class Processor implements TProcessor {
490
    private static final Logger LOGGER = LoggerFactory.getLogger(Processor.class.getName());
524
    private static final Logger LOGGER = LoggerFactory.getLogger(Processor.class.getName());
491
    public Processor(Iface iface)
525
    public Processor(Iface iface)
492
    {
526
    {
493
      iface_ = iface;
527
      iface_ = iface;
-
 
528
      processMap_.put("closeSession", new closeSession());
494
      processMap_.put("sendMail", new sendMail());
529
      processMap_.put("sendMail", new sendMail());
495
      processMap_.put("sendText", new sendText());
530
      processMap_.put("sendText", new sendText());
496
      processMap_.put("addMessage", new addMessage());
531
      processMap_.put("addMessage", new addMessage());
497
      processMap_.put("updateMessage", new updateMessage());
532
      processMap_.put("updateMessage", new updateMessage());
498
      processMap_.put("getMessage", new getMessage());
533
      processMap_.put("getMessage", new getMessage());
Line 527... Line 562...
527
      }
562
      }
528
      fn.process(msg.seqid, iprot, oprot);
563
      fn.process(msg.seqid, iprot, oprot);
529
      return true;
564
      return true;
530
    }
565
    }
531
 
566
 
-
 
567
    private class closeSession implements ProcessFunction {
-
 
568
      public void process(int seqid, TProtocol iprot, TProtocol oprot) throws TException
-
 
569
      {
-
 
570
        closeSession_args args = new closeSession_args();
-
 
571
        args.read(iprot);
-
 
572
        iprot.readMessageEnd();
-
 
573
        closeSession_result result = new closeSession_result();
-
 
574
        iface_.closeSession();
-
 
575
        oprot.writeMessageBegin(new TMessage("closeSession", TMessageType.REPLY, seqid));
-
 
576
        result.write(oprot);
-
 
577
        oprot.writeMessageEnd();
-
 
578
        oprot.getTransport().flush();
-
 
579
      }
-
 
580
 
-
 
581
    }
-
 
582
 
532
    private class sendMail implements ProcessFunction {
583
    private class sendMail implements ProcessFunction {
533
      public void process(int seqid, TProtocol iprot, TProtocol oprot) throws TException
584
      public void process(int seqid, TProtocol iprot, TProtocol oprot) throws TException
534
      {
585
      {
535
        sendMail_args args = new sendMail_args();
586
        sendMail_args args = new sendMail_args();
536
        args.read(iprot);
587
        args.read(iprot);
Line 841... Line 892...
841
 
892
 
842
    }
893
    }
843
 
894
 
844
  }
895
  }
845
 
896
 
-
 
897
  public static class closeSession_args implements TBase<closeSession_args._Fields>, java.io.Serializable, Cloneable, Comparable<closeSession_args>   {
-
 
898
    private static final TStruct STRUCT_DESC = new TStruct("closeSession_args");
-
 
899
 
-
 
900
 
-
 
901
 
-
 
902
    /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
-
 
903
    public enum _Fields implements TFieldIdEnum {
-
 
904
;
-
 
905
 
-
 
906
      private static final Map<Integer, _Fields> byId = new HashMap<Integer, _Fields>();
-
 
907
      private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();
-
 
908
 
-
 
909
      static {
-
 
910
        for (_Fields field : EnumSet.allOf(_Fields.class)) {
-
 
911
          byId.put((int)field._thriftId, field);
-
 
912
          byName.put(field.getFieldName(), field);
-
 
913
        }
-
 
914
      }
-
 
915
 
-
 
916
      /**
-
 
917
       * Find the _Fields constant that matches fieldId, or null if its not found.
-
 
918
       */
-
 
919
      public static _Fields findByThriftId(int fieldId) {
-
 
920
        return byId.get(fieldId);
-
 
921
      }
-
 
922
 
-
 
923
      /**
-
 
924
       * Find the _Fields constant that matches fieldId, throwing an exception
-
 
925
       * if it is not found.
-
 
926
       */
-
 
927
      public static _Fields findByThriftIdOrThrow(int fieldId) {
-
 
928
        _Fields fields = findByThriftId(fieldId);
-
 
929
        if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!");
-
 
930
        return fields;
-
 
931
      }
-
 
932
 
-
 
933
      /**
-
 
934
       * Find the _Fields constant that matches name, or null if its not found.
-
 
935
       */
-
 
936
      public static _Fields findByName(String name) {
-
 
937
        return byName.get(name);
-
 
938
      }
-
 
939
 
-
 
940
      private final short _thriftId;
-
 
941
      private final String _fieldName;
-
 
942
 
-
 
943
      _Fields(short thriftId, String fieldName) {
-
 
944
        _thriftId = thriftId;
-
 
945
        _fieldName = fieldName;
-
 
946
      }
-
 
947
 
-
 
948
      public short getThriftFieldId() {
-
 
949
        return _thriftId;
-
 
950
      }
-
 
951
 
-
 
952
      public String getFieldName() {
-
 
953
        return _fieldName;
-
 
954
      }
-
 
955
    }
-
 
956
    public static final Map<_Fields, FieldMetaData> metaDataMap = Collections.unmodifiableMap(new EnumMap<_Fields, FieldMetaData>(_Fields.class) {{
-
 
957
    }});
-
 
958
 
-
 
959
    static {
-
 
960
      FieldMetaData.addStructMetaDataMap(closeSession_args.class, metaDataMap);
-
 
961
    }
-
 
962
 
-
 
963
    public closeSession_args() {
-
 
964
    }
-
 
965
 
-
 
966
    /**
-
 
967
     * Performs a deep copy on <i>other</i>.
-
 
968
     */
-
 
969
    public closeSession_args(closeSession_args other) {
-
 
970
    }
-
 
971
 
-
 
972
    public closeSession_args deepCopy() {
-
 
973
      return new closeSession_args(this);
-
 
974
    }
-
 
975
 
-
 
976
    @Deprecated
-
 
977
    public closeSession_args clone() {
-
 
978
      return new closeSession_args(this);
-
 
979
    }
-
 
980
 
-
 
981
    public void setFieldValue(_Fields field, Object value) {
-
 
982
      switch (field) {
-
 
983
      }
-
 
984
    }
-
 
985
 
-
 
986
    public void setFieldValue(int fieldID, Object value) {
-
 
987
      setFieldValue(_Fields.findByThriftIdOrThrow(fieldID), value);
-
 
988
    }
-
 
989
 
-
 
990
    public Object getFieldValue(_Fields field) {
-
 
991
      switch (field) {
-
 
992
      }
-
 
993
      throw new IllegalStateException();
-
 
994
    }
-
 
995
 
-
 
996
    public Object getFieldValue(int fieldId) {
-
 
997
      return getFieldValue(_Fields.findByThriftIdOrThrow(fieldId));
-
 
998
    }
-
 
999
 
-
 
1000
    /** Returns true if field corresponding to fieldID is set (has been asigned a value) and false otherwise */
-
 
1001
    public boolean isSet(_Fields field) {
-
 
1002
      switch (field) {
-
 
1003
      }
-
 
1004
      throw new IllegalStateException();
-
 
1005
    }
-
 
1006
 
-
 
1007
    public boolean isSet(int fieldID) {
-
 
1008
      return isSet(_Fields.findByThriftIdOrThrow(fieldID));
-
 
1009
    }
-
 
1010
 
-
 
1011
    @Override
-
 
1012
    public boolean equals(Object that) {
-
 
1013
      if (that == null)
-
 
1014
        return false;
-
 
1015
      if (that instanceof closeSession_args)
-
 
1016
        return this.equals((closeSession_args)that);
-
 
1017
      return false;
-
 
1018
    }
-
 
1019
 
-
 
1020
    public boolean equals(closeSession_args that) {
-
 
1021
      if (that == null)
-
 
1022
        return false;
-
 
1023
 
-
 
1024
      return true;
-
 
1025
    }
-
 
1026
 
-
 
1027
    @Override
-
 
1028
    public int hashCode() {
-
 
1029
      return 0;
-
 
1030
    }
-
 
1031
 
-
 
1032
    public int compareTo(closeSession_args other) {
-
 
1033
      if (!getClass().equals(other.getClass())) {
-
 
1034
        return getClass().getName().compareTo(other.getClass().getName());
-
 
1035
      }
-
 
1036
 
-
 
1037
      int lastComparison = 0;
-
 
1038
      closeSession_args typedOther = (closeSession_args)other;
-
 
1039
 
-
 
1040
      return 0;
-
 
1041
    }
-
 
1042
 
-
 
1043
    public void read(TProtocol iprot) throws TException {
-
 
1044
      TField field;
-
 
1045
      iprot.readStructBegin();
-
 
1046
      while (true)
-
 
1047
      {
-
 
1048
        field = iprot.readFieldBegin();
-
 
1049
        if (field.type == TType.STOP) { 
-
 
1050
          break;
-
 
1051
        }
-
 
1052
        _Fields fieldId = _Fields.findByThriftId(field.id);
-
 
1053
        if (fieldId == null) {
-
 
1054
          TProtocolUtil.skip(iprot, field.type);
-
 
1055
        } else {
-
 
1056
          switch (fieldId) {
-
 
1057
          }
-
 
1058
          iprot.readFieldEnd();
-
 
1059
        }
-
 
1060
      }
-
 
1061
      iprot.readStructEnd();
-
 
1062
      validate();
-
 
1063
    }
-
 
1064
 
-
 
1065
    public void write(TProtocol oprot) throws TException {
-
 
1066
      validate();
-
 
1067
 
-
 
1068
      oprot.writeStructBegin(STRUCT_DESC);
-
 
1069
      oprot.writeFieldStop();
-
 
1070
      oprot.writeStructEnd();
-
 
1071
    }
-
 
1072
 
-
 
1073
    @Override
-
 
1074
    public String toString() {
-
 
1075
      StringBuilder sb = new StringBuilder("closeSession_args(");
-
 
1076
      boolean first = true;
-
 
1077
 
-
 
1078
      sb.append(")");
-
 
1079
      return sb.toString();
-
 
1080
    }
-
 
1081
 
-
 
1082
    public void validate() throws TException {
-
 
1083
      // check for required fields
-
 
1084
    }
-
 
1085
 
-
 
1086
  }
-
 
1087
 
-
 
1088
  public static class closeSession_result implements TBase<closeSession_result._Fields>, java.io.Serializable, Cloneable, Comparable<closeSession_result>   {
-
 
1089
    private static final TStruct STRUCT_DESC = new TStruct("closeSession_result");
-
 
1090
 
-
 
1091
 
-
 
1092
 
-
 
1093
    /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
-
 
1094
    public enum _Fields implements TFieldIdEnum {
-
 
1095
;
-
 
1096
 
-
 
1097
      private static final Map<Integer, _Fields> byId = new HashMap<Integer, _Fields>();
-
 
1098
      private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();
-
 
1099
 
-
 
1100
      static {
-
 
1101
        for (_Fields field : EnumSet.allOf(_Fields.class)) {
-
 
1102
          byId.put((int)field._thriftId, field);
-
 
1103
          byName.put(field.getFieldName(), field);
-
 
1104
        }
-
 
1105
      }
-
 
1106
 
-
 
1107
      /**
-
 
1108
       * Find the _Fields constant that matches fieldId, or null if its not found.
-
 
1109
       */
-
 
1110
      public static _Fields findByThriftId(int fieldId) {
-
 
1111
        return byId.get(fieldId);
-
 
1112
      }
-
 
1113
 
-
 
1114
      /**
-
 
1115
       * Find the _Fields constant that matches fieldId, throwing an exception
-
 
1116
       * if it is not found.
-
 
1117
       */
-
 
1118
      public static _Fields findByThriftIdOrThrow(int fieldId) {
-
 
1119
        _Fields fields = findByThriftId(fieldId);
-
 
1120
        if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!");
-
 
1121
        return fields;
-
 
1122
      }
-
 
1123
 
-
 
1124
      /**
-
 
1125
       * Find the _Fields constant that matches name, or null if its not found.
-
 
1126
       */
-
 
1127
      public static _Fields findByName(String name) {
-
 
1128
        return byName.get(name);
-
 
1129
      }
-
 
1130
 
-
 
1131
      private final short _thriftId;
-
 
1132
      private final String _fieldName;
-
 
1133
 
-
 
1134
      _Fields(short thriftId, String fieldName) {
-
 
1135
        _thriftId = thriftId;
-
 
1136
        _fieldName = fieldName;
-
 
1137
      }
-
 
1138
 
-
 
1139
      public short getThriftFieldId() {
-
 
1140
        return _thriftId;
-
 
1141
      }
-
 
1142
 
-
 
1143
      public String getFieldName() {
-
 
1144
        return _fieldName;
-
 
1145
      }
-
 
1146
    }
-
 
1147
    public static final Map<_Fields, FieldMetaData> metaDataMap = Collections.unmodifiableMap(new EnumMap<_Fields, FieldMetaData>(_Fields.class) {{
-
 
1148
    }});
-
 
1149
 
-
 
1150
    static {
-
 
1151
      FieldMetaData.addStructMetaDataMap(closeSession_result.class, metaDataMap);
-
 
1152
    }
-
 
1153
 
-
 
1154
    public closeSession_result() {
-
 
1155
    }
-
 
1156
 
-
 
1157
    /**
-
 
1158
     * Performs a deep copy on <i>other</i>.
-
 
1159
     */
-
 
1160
    public closeSession_result(closeSession_result other) {
-
 
1161
    }
-
 
1162
 
-
 
1163
    public closeSession_result deepCopy() {
-
 
1164
      return new closeSession_result(this);
-
 
1165
    }
-
 
1166
 
-
 
1167
    @Deprecated
-
 
1168
    public closeSession_result clone() {
-
 
1169
      return new closeSession_result(this);
-
 
1170
    }
-
 
1171
 
-
 
1172
    public void setFieldValue(_Fields field, Object value) {
-
 
1173
      switch (field) {
-
 
1174
      }
-
 
1175
    }
-
 
1176
 
-
 
1177
    public void setFieldValue(int fieldID, Object value) {
-
 
1178
      setFieldValue(_Fields.findByThriftIdOrThrow(fieldID), value);
-
 
1179
    }
-
 
1180
 
-
 
1181
    public Object getFieldValue(_Fields field) {
-
 
1182
      switch (field) {
-
 
1183
      }
-
 
1184
      throw new IllegalStateException();
-
 
1185
    }
-
 
1186
 
-
 
1187
    public Object getFieldValue(int fieldId) {
-
 
1188
      return getFieldValue(_Fields.findByThriftIdOrThrow(fieldId));
-
 
1189
    }
-
 
1190
 
-
 
1191
    /** Returns true if field corresponding to fieldID is set (has been asigned a value) and false otherwise */
-
 
1192
    public boolean isSet(_Fields field) {
-
 
1193
      switch (field) {
-
 
1194
      }
-
 
1195
      throw new IllegalStateException();
-
 
1196
    }
-
 
1197
 
-
 
1198
    public boolean isSet(int fieldID) {
-
 
1199
      return isSet(_Fields.findByThriftIdOrThrow(fieldID));
-
 
1200
    }
-
 
1201
 
-
 
1202
    @Override
-
 
1203
    public boolean equals(Object that) {
-
 
1204
      if (that == null)
-
 
1205
        return false;
-
 
1206
      if (that instanceof closeSession_result)
-
 
1207
        return this.equals((closeSession_result)that);
-
 
1208
      return false;
-
 
1209
    }
-
 
1210
 
-
 
1211
    public boolean equals(closeSession_result that) {
-
 
1212
      if (that == null)
-
 
1213
        return false;
-
 
1214
 
-
 
1215
      return true;
-
 
1216
    }
-
 
1217
 
-
 
1218
    @Override
-
 
1219
    public int hashCode() {
-
 
1220
      return 0;
-
 
1221
    }
-
 
1222
 
-
 
1223
    public int compareTo(closeSession_result other) {
-
 
1224
      if (!getClass().equals(other.getClass())) {
-
 
1225
        return getClass().getName().compareTo(other.getClass().getName());
-
 
1226
      }
-
 
1227
 
-
 
1228
      int lastComparison = 0;
-
 
1229
      closeSession_result typedOther = (closeSession_result)other;
-
 
1230
 
-
 
1231
      return 0;
-
 
1232
    }
-
 
1233
 
-
 
1234
    public void read(TProtocol iprot) throws TException {
-
 
1235
      TField field;
-
 
1236
      iprot.readStructBegin();
-
 
1237
      while (true)
-
 
1238
      {
-
 
1239
        field = iprot.readFieldBegin();
-
 
1240
        if (field.type == TType.STOP) { 
-
 
1241
          break;
-
 
1242
        }
-
 
1243
        _Fields fieldId = _Fields.findByThriftId(field.id);
-
 
1244
        if (fieldId == null) {
-
 
1245
          TProtocolUtil.skip(iprot, field.type);
-
 
1246
        } else {
-
 
1247
          switch (fieldId) {
-
 
1248
          }
-
 
1249
          iprot.readFieldEnd();
-
 
1250
        }
-
 
1251
      }
-
 
1252
      iprot.readStructEnd();
-
 
1253
      validate();
-
 
1254
    }
-
 
1255
 
-
 
1256
    public void write(TProtocol oprot) throws TException {
-
 
1257
      oprot.writeStructBegin(STRUCT_DESC);
-
 
1258
 
-
 
1259
      oprot.writeFieldStop();
-
 
1260
      oprot.writeStructEnd();
-
 
1261
    }
-
 
1262
 
-
 
1263
    @Override
-
 
1264
    public String toString() {
-
 
1265
      StringBuilder sb = new StringBuilder("closeSession_result(");
-
 
1266
      boolean first = true;
-
 
1267
 
-
 
1268
      sb.append(")");
-
 
1269
      return sb.toString();
-
 
1270
    }
-
 
1271
 
-
 
1272
    public void validate() throws TException {
-
 
1273
      // check for required fields
-
 
1274
    }
-
 
1275
 
-
 
1276
  }
-
 
1277
 
846
  public static class sendMail_args implements TBase<sendMail_args._Fields>, java.io.Serializable, Cloneable, Comparable<sendMail_args>   {
1278
  public static class sendMail_args implements TBase<sendMail_args._Fields>, java.io.Serializable, Cloneable, Comparable<sendMail_args>   {
847
    private static final TStruct STRUCT_DESC = new TStruct("sendMail_args");
1279
    private static final TStruct STRUCT_DESC = new TStruct("sendMail_args");
848
 
1280
 
849
    private static final TField MAIL_FIELD_DESC = new TField("mail", TType.STRUCT, (short)1);
1281
    private static final TField MAIL_FIELD_DESC = new TField("mail", TType.STRUCT, (short)1);
850
 
1282