Subversion Repositories SmartDukaan

Rev

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

Rev 1860 Rev 1891
Line 203... Line 203...
203
     * @param userType
203
     * @param userType
204
     */
204
     */
205
    public long getUserCount(UserType userType) throws TException;
205
    public long getUserCount(UserType userType) throws TException;
206
 
206
 
207
    /**
207
    /**
208
     * Returns list of users of type userType. If userType is null, then returns all the users.
208
     * Returns list of users of type userType who registered between startDate and endDate (both inclusive).
-
 
209
     * If any of startDate or endDate is -1, then that filter is ignored.
-
 
210
     * If userType is null, then returns all the users, irrespective of anonymous flag
-
 
211
     * 
209
     * 
212
     * 
210
     * @param userType
213
     * @param userType
-
 
214
     * @param startDate
-
 
215
     * @param endDate
211
     */
216
     */
212
    public List<User> getAllUsers(UserType userType) throws TException;
217
    public List<User> getAllUsers(UserType userType, long startDate, long endDate) throws TException;
213
 
218
 
214
  }
219
  }
215
 
220
 
216
  public static class Client implements Iface {
221
  public static class Client implements Iface {
217
    public Client(TProtocol prot)
222
    public Client(TProtocol prot)
Line 2504... Line 2509...
2504
        return result.success;
2509
        return result.success;
2505
      }
2510
      }
2506
      throw new TApplicationException(TApplicationException.MISSING_RESULT, "getUserCount failed: unknown result");
2511
      throw new TApplicationException(TApplicationException.MISSING_RESULT, "getUserCount failed: unknown result");
2507
    }
2512
    }
2508
 
2513
 
2509
    public List<User> getAllUsers(UserType userType) throws TException
2514
    public List<User> getAllUsers(UserType userType, long startDate, long endDate) throws TException
2510
    {
2515
    {
2511
      send_getAllUsers(userType);
2516
      send_getAllUsers(userType, startDate, endDate);
2512
      return recv_getAllUsers();
2517
      return recv_getAllUsers();
2513
    }
2518
    }
2514
 
2519
 
2515
    public void send_getAllUsers(UserType userType) throws TException
2520
    public void send_getAllUsers(UserType userType, long startDate, long endDate) throws TException
2516
    {
2521
    {
2517
      oprot_.writeMessageBegin(new TMessage("getAllUsers", TMessageType.CALL, seqid_));
2522
      oprot_.writeMessageBegin(new TMessage("getAllUsers", TMessageType.CALL, seqid_));
2518
      getAllUsers_args args = new getAllUsers_args();
2523
      getAllUsers_args args = new getAllUsers_args();
2519
      args.userType = userType;
2524
      args.userType = userType;
-
 
2525
      args.startDate = startDate;
-
 
2526
      args.endDate = endDate;
2520
      args.write(oprot_);
2527
      args.write(oprot_);
2521
      oprot_.writeMessageEnd();
2528
      oprot_.writeMessageEnd();
2522
      oprot_.getTransport().flush();
2529
      oprot_.getTransport().flush();
2523
    }
2530
    }
2524
 
2531
 
Line 4363... Line 4370...
4363
      {
4370
      {
4364
        getAllUsers_args args = new getAllUsers_args();
4371
        getAllUsers_args args = new getAllUsers_args();
4365
        args.read(iprot);
4372
        args.read(iprot);
4366
        iprot.readMessageEnd();
4373
        iprot.readMessageEnd();
4367
        getAllUsers_result result = new getAllUsers_result();
4374
        getAllUsers_result result = new getAllUsers_result();
4368
        result.success = iface_.getAllUsers(args.userType);
4375
        result.success = iface_.getAllUsers(args.userType, args.startDate, args.endDate);
4369
        oprot.writeMessageBegin(new TMessage("getAllUsers", TMessageType.REPLY, seqid));
4376
        oprot.writeMessageBegin(new TMessage("getAllUsers", TMessageType.REPLY, seqid));
4370
        result.write(oprot);
4377
        result.write(oprot);
4371
        oprot.writeMessageEnd();
4378
        oprot.writeMessageEnd();
4372
        oprot.getTransport().flush();
4379
        oprot.getTransport().flush();
4373
      }
4380
      }
Line 47766... Line 47773...
47766
 
47773
 
47767
  public static class getAllUsers_args implements TBase<getAllUsers_args._Fields>, java.io.Serializable, Cloneable, Comparable<getAllUsers_args>   {
47774
  public static class getAllUsers_args implements TBase<getAllUsers_args._Fields>, java.io.Serializable, Cloneable, Comparable<getAllUsers_args>   {
47768
    private static final TStruct STRUCT_DESC = new TStruct("getAllUsers_args");
47775
    private static final TStruct STRUCT_DESC = new TStruct("getAllUsers_args");
47769
 
47776
 
47770
    private static final TField USER_TYPE_FIELD_DESC = new TField("userType", TType.I32, (short)1);
47777
    private static final TField USER_TYPE_FIELD_DESC = new TField("userType", TType.I32, (short)1);
-
 
47778
    private static final TField START_DATE_FIELD_DESC = new TField("startDate", TType.I64, (short)2);
-
 
47779
    private static final TField END_DATE_FIELD_DESC = new TField("endDate", TType.I64, (short)3);
47771
 
47780
 
47772
    private UserType userType;
47781
    private UserType userType;
-
 
47782
    private long startDate;
-
 
47783
    private long endDate;
47773
 
47784
 
47774
    /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
47785
    /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
47775
    public enum _Fields implements TFieldIdEnum {
47786
    public enum _Fields implements TFieldIdEnum {
47776
      /**
47787
      /**
47777
       * 
47788
       * 
47778
       * @see UserType
47789
       * @see UserType
47779
       */
47790
       */
47780
      USER_TYPE((short)1, "userType");
47791
      USER_TYPE((short)1, "userType"),
-
 
47792
      START_DATE((short)2, "startDate"),
-
 
47793
      END_DATE((short)3, "endDate");
47781
 
47794
 
47782
      private static final Map<Integer, _Fields> byId = new HashMap<Integer, _Fields>();
47795
      private static final Map<Integer, _Fields> byId = new HashMap<Integer, _Fields>();
47783
      private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();
47796
      private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();
47784
 
47797
 
47785
      static {
47798
      static {
Line 47829... Line 47842...
47829
        return _fieldName;
47842
        return _fieldName;
47830
      }
47843
      }
47831
    }
47844
    }
47832
 
47845
 
47833
    // isset id assignments
47846
    // isset id assignments
-
 
47847
    private static final int __STARTDATE_ISSET_ID = 0;
-
 
47848
    private static final int __ENDDATE_ISSET_ID = 1;
-
 
47849
    private BitSet __isset_bit_vector = new BitSet(2);
47834
 
47850
 
47835
    public static final Map<_Fields, FieldMetaData> metaDataMap = Collections.unmodifiableMap(new EnumMap<_Fields, FieldMetaData>(_Fields.class) {{
47851
    public static final Map<_Fields, FieldMetaData> metaDataMap = Collections.unmodifiableMap(new EnumMap<_Fields, FieldMetaData>(_Fields.class) {{
47836
      put(_Fields.USER_TYPE, new FieldMetaData("userType", TFieldRequirementType.DEFAULT, 
47852
      put(_Fields.USER_TYPE, new FieldMetaData("userType", TFieldRequirementType.DEFAULT, 
47837
          new EnumMetaData(TType.ENUM, UserType.class)));
47853
          new EnumMetaData(TType.ENUM, UserType.class)));
-
 
47854
      put(_Fields.START_DATE, new FieldMetaData("startDate", TFieldRequirementType.DEFAULT, 
-
 
47855
          new FieldValueMetaData(TType.I64)));
-
 
47856
      put(_Fields.END_DATE, new FieldMetaData("endDate", TFieldRequirementType.DEFAULT, 
-
 
47857
          new FieldValueMetaData(TType.I64)));
47838
    }});
47858
    }});
47839
 
47859
 
47840
    static {
47860
    static {
47841
      FieldMetaData.addStructMetaDataMap(getAllUsers_args.class, metaDataMap);
47861
      FieldMetaData.addStructMetaDataMap(getAllUsers_args.class, metaDataMap);
47842
    }
47862
    }
47843
 
47863
 
47844
    public getAllUsers_args() {
47864
    public getAllUsers_args() {
47845
    }
47865
    }
47846
 
47866
 
47847
    public getAllUsers_args(
47867
    public getAllUsers_args(
47848
      UserType userType)
47868
      UserType userType,
-
 
47869
      long startDate,
-
 
47870
      long endDate)
47849
    {
47871
    {
47850
      this();
47872
      this();
47851
      this.userType = userType;
47873
      this.userType = userType;
-
 
47874
      this.startDate = startDate;
-
 
47875
      setStartDateIsSet(true);
-
 
47876
      this.endDate = endDate;
-
 
47877
      setEndDateIsSet(true);
47852
    }
47878
    }
47853
 
47879
 
47854
    /**
47880
    /**
47855
     * Performs a deep copy on <i>other</i>.
47881
     * Performs a deep copy on <i>other</i>.
47856
     */
47882
     */
47857
    public getAllUsers_args(getAllUsers_args other) {
47883
    public getAllUsers_args(getAllUsers_args other) {
-
 
47884
      __isset_bit_vector.clear();
-
 
47885
      __isset_bit_vector.or(other.__isset_bit_vector);
47858
      if (other.isSetUserType()) {
47886
      if (other.isSetUserType()) {
47859
        this.userType = other.userType;
47887
        this.userType = other.userType;
47860
      }
47888
      }
-
 
47889
      this.startDate = other.startDate;
-
 
47890
      this.endDate = other.endDate;
47861
    }
47891
    }
47862
 
47892
 
47863
    public getAllUsers_args deepCopy() {
47893
    public getAllUsers_args deepCopy() {
47864
      return new getAllUsers_args(this);
47894
      return new getAllUsers_args(this);
47865
    }
47895
    }
Line 47899... Line 47929...
47899
      if (!value) {
47929
      if (!value) {
47900
        this.userType = null;
47930
        this.userType = null;
47901
      }
47931
      }
47902
    }
47932
    }
47903
 
47933
 
-
 
47934
    public long getStartDate() {
-
 
47935
      return this.startDate;
-
 
47936
    }
-
 
47937
 
-
 
47938
    public getAllUsers_args setStartDate(long startDate) {
-
 
47939
      this.startDate = startDate;
-
 
47940
      setStartDateIsSet(true);
-
 
47941
      return this;
-
 
47942
    }
-
 
47943
 
-
 
47944
    public void unsetStartDate() {
-
 
47945
      __isset_bit_vector.clear(__STARTDATE_ISSET_ID);
-
 
47946
    }
-
 
47947
 
-
 
47948
    /** Returns true if field startDate is set (has been asigned a value) and false otherwise */
-
 
47949
    public boolean isSetStartDate() {
-
 
47950
      return __isset_bit_vector.get(__STARTDATE_ISSET_ID);
-
 
47951
    }
-
 
47952
 
-
 
47953
    public void setStartDateIsSet(boolean value) {
-
 
47954
      __isset_bit_vector.set(__STARTDATE_ISSET_ID, value);
-
 
47955
    }
-
 
47956
 
-
 
47957
    public long getEndDate() {
-
 
47958
      return this.endDate;
-
 
47959
    }
-
 
47960
 
-
 
47961
    public getAllUsers_args setEndDate(long endDate) {
-
 
47962
      this.endDate = endDate;
-
 
47963
      setEndDateIsSet(true);
-
 
47964
      return this;
-
 
47965
    }
-
 
47966
 
-
 
47967
    public void unsetEndDate() {
-
 
47968
      __isset_bit_vector.clear(__ENDDATE_ISSET_ID);
-
 
47969
    }
-
 
47970
 
-
 
47971
    /** Returns true if field endDate is set (has been asigned a value) and false otherwise */
-
 
47972
    public boolean isSetEndDate() {
-
 
47973
      return __isset_bit_vector.get(__ENDDATE_ISSET_ID);
-
 
47974
    }
-
 
47975
 
-
 
47976
    public void setEndDateIsSet(boolean value) {
-
 
47977
      __isset_bit_vector.set(__ENDDATE_ISSET_ID, value);
-
 
47978
    }
-
 
47979
 
47904
    public void setFieldValue(_Fields field, Object value) {
47980
    public void setFieldValue(_Fields field, Object value) {
47905
      switch (field) {
47981
      switch (field) {
47906
      case USER_TYPE:
47982
      case USER_TYPE:
47907
        if (value == null) {
47983
        if (value == null) {
47908
          unsetUserType();
47984
          unsetUserType();
47909
        } else {
47985
        } else {
47910
          setUserType((UserType)value);
47986
          setUserType((UserType)value);
47911
        }
47987
        }
47912
        break;
47988
        break;
47913
 
47989
 
-
 
47990
      case START_DATE:
-
 
47991
        if (value == null) {
-
 
47992
          unsetStartDate();
-
 
47993
        } else {
-
 
47994
          setStartDate((Long)value);
-
 
47995
        }
-
 
47996
        break;
-
 
47997
 
-
 
47998
      case END_DATE:
-
 
47999
        if (value == null) {
-
 
48000
          unsetEndDate();
-
 
48001
        } else {
-
 
48002
          setEndDate((Long)value);
-
 
48003
        }
-
 
48004
        break;
-
 
48005
 
47914
      }
48006
      }
47915
    }
48007
    }
47916
 
48008
 
47917
    public void setFieldValue(int fieldID, Object value) {
48009
    public void setFieldValue(int fieldID, Object value) {
47918
      setFieldValue(_Fields.findByThriftIdOrThrow(fieldID), value);
48010
      setFieldValue(_Fields.findByThriftIdOrThrow(fieldID), value);
Line 47921... Line 48013...
47921
    public Object getFieldValue(_Fields field) {
48013
    public Object getFieldValue(_Fields field) {
47922
      switch (field) {
48014
      switch (field) {
47923
      case USER_TYPE:
48015
      case USER_TYPE:
47924
        return getUserType();
48016
        return getUserType();
47925
 
48017
 
-
 
48018
      case START_DATE:
-
 
48019
        return new Long(getStartDate());
-
 
48020
 
-
 
48021
      case END_DATE:
-
 
48022
        return new Long(getEndDate());
-
 
48023
 
47926
      }
48024
      }
47927
      throw new IllegalStateException();
48025
      throw new IllegalStateException();
47928
    }
48026
    }
47929
 
48027
 
47930
    public Object getFieldValue(int fieldId) {
48028
    public Object getFieldValue(int fieldId) {
Line 47934... Line 48032...
47934
    /** Returns true if field corresponding to fieldID is set (has been asigned a value) and false otherwise */
48032
    /** Returns true if field corresponding to fieldID is set (has been asigned a value) and false otherwise */
47935
    public boolean isSet(_Fields field) {
48033
    public boolean isSet(_Fields field) {
47936
      switch (field) {
48034
      switch (field) {
47937
      case USER_TYPE:
48035
      case USER_TYPE:
47938
        return isSetUserType();
48036
        return isSetUserType();
-
 
48037
      case START_DATE:
-
 
48038
        return isSetStartDate();
-
 
48039
      case END_DATE:
-
 
48040
        return isSetEndDate();
47939
      }
48041
      }
47940
      throw new IllegalStateException();
48042
      throw new IllegalStateException();
47941
    }
48043
    }
47942
 
48044
 
47943
    public boolean isSet(int fieldID) {
48045
    public boolean isSet(int fieldID) {
Line 47964... Line 48066...
47964
          return false;
48066
          return false;
47965
        if (!this.userType.equals(that.userType))
48067
        if (!this.userType.equals(that.userType))
47966
          return false;
48068
          return false;
47967
      }
48069
      }
47968
 
48070
 
-
 
48071
      boolean this_present_startDate = true;
-
 
48072
      boolean that_present_startDate = true;
-
 
48073
      if (this_present_startDate || that_present_startDate) {
-
 
48074
        if (!(this_present_startDate && that_present_startDate))
-
 
48075
          return false;
-
 
48076
        if (this.startDate != that.startDate)
-
 
48077
          return false;
-
 
48078
      }
-
 
48079
 
-
 
48080
      boolean this_present_endDate = true;
-
 
48081
      boolean that_present_endDate = true;
-
 
48082
      if (this_present_endDate || that_present_endDate) {
-
 
48083
        if (!(this_present_endDate && that_present_endDate))
-
 
48084
          return false;
-
 
48085
        if (this.endDate != that.endDate)
-
 
48086
          return false;
-
 
48087
      }
-
 
48088
 
47969
      return true;
48089
      return true;
47970
    }
48090
    }
47971
 
48091
 
47972
    @Override
48092
    @Override
47973
    public int hashCode() {
48093
    public int hashCode() {
Line 47988... Line 48108...
47988
      }
48108
      }
47989
      lastComparison = TBaseHelper.compareTo(userType, typedOther.userType);
48109
      lastComparison = TBaseHelper.compareTo(userType, typedOther.userType);
47990
      if (lastComparison != 0) {
48110
      if (lastComparison != 0) {
47991
        return lastComparison;
48111
        return lastComparison;
47992
      }
48112
      }
-
 
48113
      lastComparison = Boolean.valueOf(isSetStartDate()).compareTo(isSetStartDate());
-
 
48114
      if (lastComparison != 0) {
-
 
48115
        return lastComparison;
-
 
48116
      }
-
 
48117
      lastComparison = TBaseHelper.compareTo(startDate, typedOther.startDate);
-
 
48118
      if (lastComparison != 0) {
-
 
48119
        return lastComparison;
-
 
48120
      }
-
 
48121
      lastComparison = Boolean.valueOf(isSetEndDate()).compareTo(isSetEndDate());
-
 
48122
      if (lastComparison != 0) {
-
 
48123
        return lastComparison;
-
 
48124
      }
-
 
48125
      lastComparison = TBaseHelper.compareTo(endDate, typedOther.endDate);
-
 
48126
      if (lastComparison != 0) {
-
 
48127
        return lastComparison;
-
 
48128
      }
47993
      return 0;
48129
      return 0;
47994
    }
48130
    }
47995
 
48131
 
47996
    public void read(TProtocol iprot) throws TException {
48132
    public void read(TProtocol iprot) throws TException {
47997
      TField field;
48133
      TField field;
Line 48012... Line 48148...
48012
                this.userType = UserType.findByValue(iprot.readI32());
48148
                this.userType = UserType.findByValue(iprot.readI32());
48013
              } else { 
48149
              } else { 
48014
                TProtocolUtil.skip(iprot, field.type);
48150
                TProtocolUtil.skip(iprot, field.type);
48015
              }
48151
              }
48016
              break;
48152
              break;
-
 
48153
            case START_DATE:
-
 
48154
              if (field.type == TType.I64) {
-
 
48155
                this.startDate = iprot.readI64();
-
 
48156
                setStartDateIsSet(true);
-
 
48157
              } else { 
-
 
48158
                TProtocolUtil.skip(iprot, field.type);
-
 
48159
              }
-
 
48160
              break;
-
 
48161
            case END_DATE:
-
 
48162
              if (field.type == TType.I64) {
-
 
48163
                this.endDate = iprot.readI64();
-
 
48164
                setEndDateIsSet(true);
-
 
48165
              } else { 
-
 
48166
                TProtocolUtil.skip(iprot, field.type);
-
 
48167
              }
-
 
48168
              break;
48017
          }
48169
          }
48018
          iprot.readFieldEnd();
48170
          iprot.readFieldEnd();
48019
        }
48171
        }
48020
      }
48172
      }
48021
      iprot.readStructEnd();
48173
      iprot.readStructEnd();
Line 48029... Line 48181...
48029
      if (this.userType != null) {
48181
      if (this.userType != null) {
48030
        oprot.writeFieldBegin(USER_TYPE_FIELD_DESC);
48182
        oprot.writeFieldBegin(USER_TYPE_FIELD_DESC);
48031
        oprot.writeI32(this.userType.getValue());
48183
        oprot.writeI32(this.userType.getValue());
48032
        oprot.writeFieldEnd();
48184
        oprot.writeFieldEnd();
48033
      }
48185
      }
-
 
48186
      oprot.writeFieldBegin(START_DATE_FIELD_DESC);
-
 
48187
      oprot.writeI64(this.startDate);
-
 
48188
      oprot.writeFieldEnd();
-
 
48189
      oprot.writeFieldBegin(END_DATE_FIELD_DESC);
-
 
48190
      oprot.writeI64(this.endDate);
-
 
48191
      oprot.writeFieldEnd();
48034
      oprot.writeFieldStop();
48192
      oprot.writeFieldStop();
48035
      oprot.writeStructEnd();
48193
      oprot.writeStructEnd();
48036
    }
48194
    }
48037
 
48195
 
48038
    @Override
48196
    @Override
Line 48053... Line 48211...
48053
        if (userType_name != null) {
48211
        if (userType_name != null) {
48054
          sb.append(")");
48212
          sb.append(")");
48055
        }
48213
        }
48056
      }
48214
      }
48057
      first = false;
48215
      first = false;
-
 
48216
      if (!first) sb.append(", ");
-
 
48217
      sb.append("startDate:");
-
 
48218
      sb.append(this.startDate);
-
 
48219
      first = false;
-
 
48220
      if (!first) sb.append(", ");
-
 
48221
      sb.append("endDate:");
-
 
48222
      sb.append(this.endDate);
-
 
48223
      first = false;
48058
      sb.append(")");
48224
      sb.append(")");
48059
      return sb.toString();
48225
      return sb.toString();
48060
    }
48226
    }
48061
 
48227
 
48062
    public void validate() throws TException {
48228
    public void validate() throws TException {