Subversion Repositories SmartDukaan

Rev

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

Rev 506 Rev 513
Line 48... Line 48...
48
 
48
 
49
    public boolean userExists(String email) throws UserContextException, TException;
49
    public boolean userExists(String email) throws UserContextException, TException;
50
 
50
 
51
    public boolean addIpAdressForUser(String ip, long timestamp, long userId) throws UserContextException, TException;
51
    public boolean addIpAdressForUser(String ip, long timestamp, long userId) throws UserContextException, TException;
52
 
52
 
53
    public boolean addAddressForUser(Address address, long userid, long timestamp) throws UserContextException, TException;
53
    public boolean addAddressForUser(Address address, long userid, long timestamp, boolean setDefault) throws UserContextException, TException;
54
 
54
 
55
    public boolean removeAddressForUser(long userid, long addressId) throws UserContextException, TException;
55
    public boolean removeAddressForUser(long userid, long addressId) throws UserContextException, TException;
56
 
56
 
57
    public boolean setUserAsLoggedIn(long userId, long timestamp) throws UserContextException, TException;
57
    public boolean setUserAsLoggedIn(long userId, long timestamp) throws UserContextException, TException;
58
 
58
 
Line 476... Line 476...
476
        throw result.ucx;
476
        throw result.ucx;
477
      }
477
      }
478
      throw new TApplicationException(TApplicationException.MISSING_RESULT, "addIpAdressForUser failed: unknown result");
478
      throw new TApplicationException(TApplicationException.MISSING_RESULT, "addIpAdressForUser failed: unknown result");
479
    }
479
    }
480
 
480
 
481
    public boolean addAddressForUser(Address address, long userid, long timestamp) throws UserContextException, TException
481
    public boolean addAddressForUser(Address address, long userid, long timestamp, boolean setDefault) throws UserContextException, TException
482
    {
482
    {
483
      send_addAddressForUser(address, userid, timestamp);
483
      send_addAddressForUser(address, userid, timestamp, setDefault);
484
      return recv_addAddressForUser();
484
      return recv_addAddressForUser();
485
    }
485
    }
486
 
486
 
487
    public void send_addAddressForUser(Address address, long userid, long timestamp) throws TException
487
    public void send_addAddressForUser(Address address, long userid, long timestamp, boolean setDefault) throws TException
488
    {
488
    {
489
      oprot_.writeMessageBegin(new TMessage("addAddressForUser", TMessageType.CALL, seqid_));
489
      oprot_.writeMessageBegin(new TMessage("addAddressForUser", TMessageType.CALL, seqid_));
490
      addAddressForUser_args args = new addAddressForUser_args();
490
      addAddressForUser_args args = new addAddressForUser_args();
491
      args.address = address;
491
      args.address = address;
492
      args.userid = userid;
492
      args.userid = userid;
493
      args.timestamp = timestamp;
493
      args.timestamp = timestamp;
-
 
494
      args.setDefault = setDefault;
494
      args.write(oprot_);
495
      args.write(oprot_);
495
      oprot_.writeMessageEnd();
496
      oprot_.writeMessageEnd();
496
      oprot_.getTransport().flush();
497
      oprot_.getTransport().flush();
497
    }
498
    }
498
 
499
 
Line 1339... Line 1340...
1339
        addAddressForUser_args args = new addAddressForUser_args();
1340
        addAddressForUser_args args = new addAddressForUser_args();
1340
        args.read(iprot);
1341
        args.read(iprot);
1341
        iprot.readMessageEnd();
1342
        iprot.readMessageEnd();
1342
        addAddressForUser_result result = new addAddressForUser_result();
1343
        addAddressForUser_result result = new addAddressForUser_result();
1343
        try {
1344
        try {
1344
          result.success = iface_.addAddressForUser(args.address, args.userid, args.timestamp);
1345
          result.success = iface_.addAddressForUser(args.address, args.userid, args.timestamp, args.setDefault);
1345
          result.setSuccessIsSet(true);
1346
          result.setSuccessIsSet(true);
1346
        } catch (UserContextException ucx) {
1347
        } catch (UserContextException ucx) {
1347
          result.ucx = ucx;
1348
          result.ucx = ucx;
1348
        } catch (Throwable th) {
1349
        } catch (Throwable th) {
1349
          LOGGER.error("Internal error processing addAddressForUser", th);
1350
          LOGGER.error("Internal error processing addAddressForUser", th);
Line 8908... Line 8909...
8908
    private static final TStruct STRUCT_DESC = new TStruct("addAddressForUser_args");
8909
    private static final TStruct STRUCT_DESC = new TStruct("addAddressForUser_args");
8909
 
8910
 
8910
    private static final TField ADDRESS_FIELD_DESC = new TField("address", TType.STRUCT, (short)1);
8911
    private static final TField ADDRESS_FIELD_DESC = new TField("address", TType.STRUCT, (short)1);
8911
    private static final TField USERID_FIELD_DESC = new TField("userid", TType.I64, (short)2);
8912
    private static final TField USERID_FIELD_DESC = new TField("userid", TType.I64, (short)2);
8912
    private static final TField TIMESTAMP_FIELD_DESC = new TField("timestamp", TType.I64, (short)3);
8913
    private static final TField TIMESTAMP_FIELD_DESC = new TField("timestamp", TType.I64, (short)3);
-
 
8914
    private static final TField SET_DEFAULT_FIELD_DESC = new TField("setDefault", TType.BOOL, (short)4);
8913
 
8915
 
8914
    private Address address;
8916
    private Address address;
8915
    private long userid;
8917
    private long userid;
8916
    private long timestamp;
8918
    private long timestamp;
-
 
8919
    private boolean setDefault;
8917
 
8920
 
8918
    /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
8921
    /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
8919
    public enum _Fields implements TFieldIdEnum {
8922
    public enum _Fields implements TFieldIdEnum {
8920
      ADDRESS((short)1, "address"),
8923
      ADDRESS((short)1, "address"),
8921
      USERID((short)2, "userid"),
8924
      USERID((short)2, "userid"),
8922
      TIMESTAMP((short)3, "timestamp");
8925
      TIMESTAMP((short)3, "timestamp"),
-
 
8926
      SET_DEFAULT((short)4, "setDefault");
8923
 
8927
 
8924
      private static final Map<Integer, _Fields> byId = new HashMap<Integer, _Fields>();
8928
      private static final Map<Integer, _Fields> byId = new HashMap<Integer, _Fields>();
8925
      private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();
8929
      private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();
8926
 
8930
 
8927
      static {
8931
      static {
Line 8973... Line 8977...
8973
    }
8977
    }
8974
 
8978
 
8975
    // isset id assignments
8979
    // isset id assignments
8976
    private static final int __USERID_ISSET_ID = 0;
8980
    private static final int __USERID_ISSET_ID = 0;
8977
    private static final int __TIMESTAMP_ISSET_ID = 1;
8981
    private static final int __TIMESTAMP_ISSET_ID = 1;
-
 
8982
    private static final int __SETDEFAULT_ISSET_ID = 2;
8978
    private BitSet __isset_bit_vector = new BitSet(2);
8983
    private BitSet __isset_bit_vector = new BitSet(3);
8979
 
8984
 
8980
    public static final Map<_Fields, FieldMetaData> metaDataMap = Collections.unmodifiableMap(new EnumMap<_Fields, FieldMetaData>(_Fields.class) {{
8985
    public static final Map<_Fields, FieldMetaData> metaDataMap = Collections.unmodifiableMap(new EnumMap<_Fields, FieldMetaData>(_Fields.class) {{
8981
      put(_Fields.ADDRESS, new FieldMetaData("address", TFieldRequirementType.DEFAULT, 
8986
      put(_Fields.ADDRESS, new FieldMetaData("address", TFieldRequirementType.DEFAULT, 
8982
          new StructMetaData(TType.STRUCT, Address.class)));
8987
          new StructMetaData(TType.STRUCT, Address.class)));
8983
      put(_Fields.USERID, new FieldMetaData("userid", TFieldRequirementType.DEFAULT, 
8988
      put(_Fields.USERID, new FieldMetaData("userid", TFieldRequirementType.DEFAULT, 
8984
          new FieldValueMetaData(TType.I64)));
8989
          new FieldValueMetaData(TType.I64)));
8985
      put(_Fields.TIMESTAMP, new FieldMetaData("timestamp", TFieldRequirementType.DEFAULT, 
8990
      put(_Fields.TIMESTAMP, new FieldMetaData("timestamp", TFieldRequirementType.DEFAULT, 
8986
          new FieldValueMetaData(TType.I64)));
8991
          new FieldValueMetaData(TType.I64)));
-
 
8992
      put(_Fields.SET_DEFAULT, new FieldMetaData("setDefault", TFieldRequirementType.DEFAULT, 
-
 
8993
          new FieldValueMetaData(TType.BOOL)));
8987
    }});
8994
    }});
8988
 
8995
 
8989
    static {
8996
    static {
8990
      FieldMetaData.addStructMetaDataMap(addAddressForUser_args.class, metaDataMap);
8997
      FieldMetaData.addStructMetaDataMap(addAddressForUser_args.class, metaDataMap);
8991
    }
8998
    }
Line 8994... Line 9001...
8994
    }
9001
    }
8995
 
9002
 
8996
    public addAddressForUser_args(
9003
    public addAddressForUser_args(
8997
      Address address,
9004
      Address address,
8998
      long userid,
9005
      long userid,
8999
      long timestamp)
9006
      long timestamp,
-
 
9007
      boolean setDefault)
9000
    {
9008
    {
9001
      this();
9009
      this();
9002
      this.address = address;
9010
      this.address = address;
9003
      this.userid = userid;
9011
      this.userid = userid;
9004
      setUseridIsSet(true);
9012
      setUseridIsSet(true);
9005
      this.timestamp = timestamp;
9013
      this.timestamp = timestamp;
9006
      setTimestampIsSet(true);
9014
      setTimestampIsSet(true);
-
 
9015
      this.setDefault = setDefault;
-
 
9016
      setSetDefaultIsSet(true);
9007
    }
9017
    }
9008
 
9018
 
9009
    /**
9019
    /**
9010
     * Performs a deep copy on <i>other</i>.
9020
     * Performs a deep copy on <i>other</i>.
9011
     */
9021
     */
Line 9015... Line 9025...
9015
      if (other.isSetAddress()) {
9025
      if (other.isSetAddress()) {
9016
        this.address = new Address(other.address);
9026
        this.address = new Address(other.address);
9017
      }
9027
      }
9018
      this.userid = other.userid;
9028
      this.userid = other.userid;
9019
      this.timestamp = other.timestamp;
9029
      this.timestamp = other.timestamp;
-
 
9030
      this.setDefault = other.setDefault;
9020
    }
9031
    }
9021
 
9032
 
9022
    public addAddressForUser_args deepCopy() {
9033
    public addAddressForUser_args deepCopy() {
9023
      return new addAddressForUser_args(this);
9034
      return new addAddressForUser_args(this);
9024
    }
9035
    }
Line 9096... Line 9107...
9096
 
9107
 
9097
    public void setTimestampIsSet(boolean value) {
9108
    public void setTimestampIsSet(boolean value) {
9098
      __isset_bit_vector.set(__TIMESTAMP_ISSET_ID, value);
9109
      __isset_bit_vector.set(__TIMESTAMP_ISSET_ID, value);
9099
    }
9110
    }
9100
 
9111
 
-
 
9112
    public boolean isSetDefault() {
-
 
9113
      return this.setDefault;
-
 
9114
    }
-
 
9115
 
-
 
9116
    public addAddressForUser_args setSetDefault(boolean setDefault) {
-
 
9117
      this.setDefault = setDefault;
-
 
9118
      setSetDefaultIsSet(true);
-
 
9119
      return this;
-
 
9120
    }
-
 
9121
 
-
 
9122
    public void unsetSetDefault() {
-
 
9123
      __isset_bit_vector.clear(__SETDEFAULT_ISSET_ID);
-
 
9124
    }
-
 
9125
 
-
 
9126
    /** Returns true if field setDefault is set (has been asigned a value) and false otherwise */
-
 
9127
    public boolean isSetSetDefault() {
-
 
9128
      return __isset_bit_vector.get(__SETDEFAULT_ISSET_ID);
-
 
9129
    }
-
 
9130
 
-
 
9131
    public void setSetDefaultIsSet(boolean value) {
-
 
9132
      __isset_bit_vector.set(__SETDEFAULT_ISSET_ID, value);
-
 
9133
    }
-
 
9134
 
9101
    public void setFieldValue(_Fields field, Object value) {
9135
    public void setFieldValue(_Fields field, Object value) {
9102
      switch (field) {
9136
      switch (field) {
9103
      case ADDRESS:
9137
      case ADDRESS:
9104
        if (value == null) {
9138
        if (value == null) {
9105
          unsetAddress();
9139
          unsetAddress();
Line 9122... Line 9156...
9122
        } else {
9156
        } else {
9123
          setTimestamp((Long)value);
9157
          setTimestamp((Long)value);
9124
        }
9158
        }
9125
        break;
9159
        break;
9126
 
9160
 
-
 
9161
      case SET_DEFAULT:
-
 
9162
        if (value == null) {
-
 
9163
          unsetSetDefault();
-
 
9164
        } else {
-
 
9165
          setSetDefault((Boolean)value);
-
 
9166
        }
-
 
9167
        break;
-
 
9168
 
9127
      }
9169
      }
9128
    }
9170
    }
9129
 
9171
 
9130
    public void setFieldValue(int fieldID, Object value) {
9172
    public void setFieldValue(int fieldID, Object value) {
9131
      setFieldValue(_Fields.findByThriftIdOrThrow(fieldID), value);
9173
      setFieldValue(_Fields.findByThriftIdOrThrow(fieldID), value);
Line 9140... Line 9182...
9140
        return new Long(getUserid());
9182
        return new Long(getUserid());
9141
 
9183
 
9142
      case TIMESTAMP:
9184
      case TIMESTAMP:
9143
        return new Long(getTimestamp());
9185
        return new Long(getTimestamp());
9144
 
9186
 
-
 
9187
      case SET_DEFAULT:
-
 
9188
        return new Boolean(isSetDefault());
-
 
9189
 
9145
      }
9190
      }
9146
      throw new IllegalStateException();
9191
      throw new IllegalStateException();
9147
    }
9192
    }
9148
 
9193
 
9149
    public Object getFieldValue(int fieldId) {
9194
    public Object getFieldValue(int fieldId) {
Line 9157... Line 9202...
9157
        return isSetAddress();
9202
        return isSetAddress();
9158
      case USERID:
9203
      case USERID:
9159
        return isSetUserid();
9204
        return isSetUserid();
9160
      case TIMESTAMP:
9205
      case TIMESTAMP:
9161
        return isSetTimestamp();
9206
        return isSetTimestamp();
-
 
9207
      case SET_DEFAULT:
-
 
9208
        return isSetSetDefault();
9162
      }
9209
      }
9163
      throw new IllegalStateException();
9210
      throw new IllegalStateException();
9164
    }
9211
    }
9165
 
9212
 
9166
    public boolean isSet(int fieldID) {
9213
    public boolean isSet(int fieldID) {
Line 9205... Line 9252...
9205
          return false;
9252
          return false;
9206
        if (this.timestamp != that.timestamp)
9253
        if (this.timestamp != that.timestamp)
9207
          return false;
9254
          return false;
9208
      }
9255
      }
9209
 
9256
 
-
 
9257
      boolean this_present_setDefault = true;
-
 
9258
      boolean that_present_setDefault = true;
-
 
9259
      if (this_present_setDefault || that_present_setDefault) {
-
 
9260
        if (!(this_present_setDefault && that_present_setDefault))
-
 
9261
          return false;
-
 
9262
        if (this.setDefault != that.setDefault)
-
 
9263
          return false;
-
 
9264
      }
-
 
9265
 
9210
      return true;
9266
      return true;
9211
    }
9267
    }
9212
 
9268
 
9213
    @Override
9269
    @Override
9214
    public int hashCode() {
9270
    public int hashCode() {
Line 9245... Line 9301...
9245
      }
9301
      }
9246
      lastComparison = TBaseHelper.compareTo(timestamp, typedOther.timestamp);
9302
      lastComparison = TBaseHelper.compareTo(timestamp, typedOther.timestamp);
9247
      if (lastComparison != 0) {
9303
      if (lastComparison != 0) {
9248
        return lastComparison;
9304
        return lastComparison;
9249
      }
9305
      }
-
 
9306
      lastComparison = Boolean.valueOf(isSetSetDefault()).compareTo(isSetSetDefault());
-
 
9307
      if (lastComparison != 0) {
-
 
9308
        return lastComparison;
-
 
9309
      }
-
 
9310
      lastComparison = TBaseHelper.compareTo(setDefault, typedOther.setDefault);
-
 
9311
      if (lastComparison != 0) {
-
 
9312
        return lastComparison;
-
 
9313
      }
9250
      return 0;
9314
      return 0;
9251
    }
9315
    }
9252
 
9316
 
9253
    public void read(TProtocol iprot) throws TException {
9317
    public void read(TProtocol iprot) throws TException {
9254
      TField field;
9318
      TField field;
Line 9286... Line 9350...
9286
                setTimestampIsSet(true);
9350
                setTimestampIsSet(true);
9287
              } else { 
9351
              } else { 
9288
                TProtocolUtil.skip(iprot, field.type);
9352
                TProtocolUtil.skip(iprot, field.type);
9289
              }
9353
              }
9290
              break;
9354
              break;
-
 
9355
            case SET_DEFAULT:
-
 
9356
              if (field.type == TType.BOOL) {
-
 
9357
                this.setDefault = iprot.readBool();
-
 
9358
                setSetDefaultIsSet(true);
-
 
9359
              } else { 
-
 
9360
                TProtocolUtil.skip(iprot, field.type);
-
 
9361
              }
-
 
9362
              break;
9291
          }
9363
          }
9292
          iprot.readFieldEnd();
9364
          iprot.readFieldEnd();
9293
        }
9365
        }
9294
      }
9366
      }
9295
      iprot.readStructEnd();
9367
      iprot.readStructEnd();
Line 9309... Line 9381...
9309
      oprot.writeI64(this.userid);
9381
      oprot.writeI64(this.userid);
9310
      oprot.writeFieldEnd();
9382
      oprot.writeFieldEnd();
9311
      oprot.writeFieldBegin(TIMESTAMP_FIELD_DESC);
9383
      oprot.writeFieldBegin(TIMESTAMP_FIELD_DESC);
9312
      oprot.writeI64(this.timestamp);
9384
      oprot.writeI64(this.timestamp);
9313
      oprot.writeFieldEnd();
9385
      oprot.writeFieldEnd();
-
 
9386
      oprot.writeFieldBegin(SET_DEFAULT_FIELD_DESC);
-
 
9387
      oprot.writeBool(this.setDefault);
-
 
9388
      oprot.writeFieldEnd();
9314
      oprot.writeFieldStop();
9389
      oprot.writeFieldStop();
9315
      oprot.writeStructEnd();
9390
      oprot.writeStructEnd();
9316
    }
9391
    }
9317
 
9392
 
9318
    @Override
9393
    @Override
Line 9333... Line 9408...
9333
      first = false;
9408
      first = false;
9334
      if (!first) sb.append(", ");
9409
      if (!first) sb.append(", ");
9335
      sb.append("timestamp:");
9410
      sb.append("timestamp:");
9336
      sb.append(this.timestamp);
9411
      sb.append(this.timestamp);
9337
      first = false;
9412
      first = false;
-
 
9413
      if (!first) sb.append(", ");
-
 
9414
      sb.append("setDefault:");
-
 
9415
      sb.append(this.setDefault);
-
 
9416
      first = false;
9338
      sb.append(")");
9417
      sb.append(")");
9339
      return sb.toString();
9418
      return sb.toString();
9340
    }
9419
    }
9341
 
9420
 
9342
    public void validate() throws TException {
9421
    public void validate() throws TException {