Subversion Repositories SmartDukaan

Rev

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

Rev 2024 Rev 2357
Line 99... Line 99...
99
     * @param role
99
     * @param role
100
     */
100
     */
101
    public List<Report> getReports(long role) throws TException;
101
    public List<Report> getReports(long role) throws TException;
102
 
102
 
103
    /**
103
    /**
104
     * Returns the CatalogDashboardUser struct associated with the given username and password if they match.
104
     * Returns the CatalogDashboardUser struct associated with the given username, password and role if they match.
105
     * Throws an exception otherwise.
105
     * Throws an exception otherwise.
106
     * 
106
     * 
107
     * @param username
107
     * @param username
108
     * @param password
108
     * @param password
-
 
109
     * @param role
109
     */
110
     */
110
    public CatalogDashboardUser authenticateCatalogUser(String username, String password) throws HelperServiceException, TException;
111
    public CatalogDashboardUser authenticateCatalogUser(String username, String password, long role) throws HelperServiceException, TException;
111
 
112
 
112
  }
113
  }
113
 
114
 
114
  public static class Client implements Iface {
115
  public static class Client implements Iface {
115
    public Client(TProtocol prot)
116
    public Client(TProtocol prot)
Line 771... Line 772...
771
        return result.success;
772
        return result.success;
772
      }
773
      }
773
      throw new TApplicationException(TApplicationException.MISSING_RESULT, "getReports failed: unknown result");
774
      throw new TApplicationException(TApplicationException.MISSING_RESULT, "getReports failed: unknown result");
774
    }
775
    }
775
 
776
 
776
    public CatalogDashboardUser authenticateCatalogUser(String username, String password) throws HelperServiceException, TException
777
    public CatalogDashboardUser authenticateCatalogUser(String username, String password, long role) throws HelperServiceException, TException
777
    {
778
    {
778
      send_authenticateCatalogUser(username, password);
779
      send_authenticateCatalogUser(username, password, role);
779
      return recv_authenticateCatalogUser();
780
      return recv_authenticateCatalogUser();
780
    }
781
    }
781
 
782
 
782
    public void send_authenticateCatalogUser(String username, String password) throws TException
783
    public void send_authenticateCatalogUser(String username, String password, long role) throws TException
783
    {
784
    {
784
      oprot_.writeMessageBegin(new TMessage("authenticateCatalogUser", TMessageType.CALL, seqid_));
785
      oprot_.writeMessageBegin(new TMessage("authenticateCatalogUser", TMessageType.CALL, seqid_));
785
      authenticateCatalogUser_args args = new authenticateCatalogUser_args();
786
      authenticateCatalogUser_args args = new authenticateCatalogUser_args();
786
      args.username = username;
787
      args.username = username;
787
      args.password = password;
788
      args.password = password;
-
 
789
      args.role = role;
788
      args.write(oprot_);
790
      args.write(oprot_);
789
      oprot_.writeMessageEnd();
791
      oprot_.writeMessageEnd();
790
      oprot_.getTransport().flush();
792
      oprot_.getTransport().flush();
791
    }
793
    }
792
 
794
 
Line 1352... Line 1354...
1352
        authenticateCatalogUser_args args = new authenticateCatalogUser_args();
1354
        authenticateCatalogUser_args args = new authenticateCatalogUser_args();
1353
        args.read(iprot);
1355
        args.read(iprot);
1354
        iprot.readMessageEnd();
1356
        iprot.readMessageEnd();
1355
        authenticateCatalogUser_result result = new authenticateCatalogUser_result();
1357
        authenticateCatalogUser_result result = new authenticateCatalogUser_result();
1356
        try {
1358
        try {
1357
          result.success = iface_.authenticateCatalogUser(args.username, args.password);
1359
          result.success = iface_.authenticateCatalogUser(args.username, args.password, args.role);
1358
        } catch (HelperServiceException hse) {
1360
        } catch (HelperServiceException hse) {
1359
          result.hse = hse;
1361
          result.hse = hse;
1360
        } catch (Throwable th) {
1362
        } catch (Throwable th) {
1361
          LOGGER.error("Internal error processing authenticateCatalogUser", th);
1363
          LOGGER.error("Internal error processing authenticateCatalogUser", th);
1362
          TApplicationException x = new TApplicationException(TApplicationException.INTERNAL_ERROR, "Internal error processing authenticateCatalogUser");
1364
          TApplicationException x = new TApplicationException(TApplicationException.INTERNAL_ERROR, "Internal error processing authenticateCatalogUser");
Line 13483... Line 13485...
13483
  public static class authenticateCatalogUser_args implements TBase<authenticateCatalogUser_args._Fields>, java.io.Serializable, Cloneable, Comparable<authenticateCatalogUser_args>   {
13485
  public static class authenticateCatalogUser_args implements TBase<authenticateCatalogUser_args._Fields>, java.io.Serializable, Cloneable, Comparable<authenticateCatalogUser_args>   {
13484
    private static final TStruct STRUCT_DESC = new TStruct("authenticateCatalogUser_args");
13486
    private static final TStruct STRUCT_DESC = new TStruct("authenticateCatalogUser_args");
13485
 
13487
 
13486
    private static final TField USERNAME_FIELD_DESC = new TField("username", TType.STRING, (short)1);
13488
    private static final TField USERNAME_FIELD_DESC = new TField("username", TType.STRING, (short)1);
13487
    private static final TField PASSWORD_FIELD_DESC = new TField("password", TType.STRING, (short)2);
13489
    private static final TField PASSWORD_FIELD_DESC = new TField("password", TType.STRING, (short)2);
-
 
13490
    private static final TField ROLE_FIELD_DESC = new TField("role", TType.I64, (short)3);
13488
 
13491
 
13489
    private String username;
13492
    private String username;
13490
    private String password;
13493
    private String password;
-
 
13494
    private long role;
13491
 
13495
 
13492
    /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
13496
    /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
13493
    public enum _Fields implements TFieldIdEnum {
13497
    public enum _Fields implements TFieldIdEnum {
13494
      USERNAME((short)1, "username"),
13498
      USERNAME((short)1, "username"),
13495
      PASSWORD((short)2, "password");
13499
      PASSWORD((short)2, "password"),
-
 
13500
      ROLE((short)3, "role");
13496
 
13501
 
13497
      private static final Map<Integer, _Fields> byId = new HashMap<Integer, _Fields>();
13502
      private static final Map<Integer, _Fields> byId = new HashMap<Integer, _Fields>();
13498
      private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();
13503
      private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();
13499
 
13504
 
13500
      static {
13505
      static {
Line 13544... Line 13549...
13544
        return _fieldName;
13549
        return _fieldName;
13545
      }
13550
      }
13546
    }
13551
    }
13547
 
13552
 
13548
    // isset id assignments
13553
    // isset id assignments
-
 
13554
    private static final int __ROLE_ISSET_ID = 0;
-
 
13555
    private BitSet __isset_bit_vector = new BitSet(1);
13549
 
13556
 
13550
    public static final Map<_Fields, FieldMetaData> metaDataMap = Collections.unmodifiableMap(new EnumMap<_Fields, FieldMetaData>(_Fields.class) {{
13557
    public static final Map<_Fields, FieldMetaData> metaDataMap = Collections.unmodifiableMap(new EnumMap<_Fields, FieldMetaData>(_Fields.class) {{
13551
      put(_Fields.USERNAME, new FieldMetaData("username", TFieldRequirementType.DEFAULT, 
13558
      put(_Fields.USERNAME, new FieldMetaData("username", TFieldRequirementType.DEFAULT, 
13552
          new FieldValueMetaData(TType.STRING)));
13559
          new FieldValueMetaData(TType.STRING)));
13553
      put(_Fields.PASSWORD, new FieldMetaData("password", TFieldRequirementType.DEFAULT, 
13560
      put(_Fields.PASSWORD, new FieldMetaData("password", TFieldRequirementType.DEFAULT, 
13554
          new FieldValueMetaData(TType.STRING)));
13561
          new FieldValueMetaData(TType.STRING)));
-
 
13562
      put(_Fields.ROLE, new FieldMetaData("role", TFieldRequirementType.DEFAULT, 
-
 
13563
          new FieldValueMetaData(TType.I64)));
13555
    }});
13564
    }});
13556
 
13565
 
13557
    static {
13566
    static {
13558
      FieldMetaData.addStructMetaDataMap(authenticateCatalogUser_args.class, metaDataMap);
13567
      FieldMetaData.addStructMetaDataMap(authenticateCatalogUser_args.class, metaDataMap);
13559
    }
13568
    }
Line 13561... Line 13570...
13561
    public authenticateCatalogUser_args() {
13570
    public authenticateCatalogUser_args() {
13562
    }
13571
    }
13563
 
13572
 
13564
    public authenticateCatalogUser_args(
13573
    public authenticateCatalogUser_args(
13565
      String username,
13574
      String username,
13566
      String password)
13575
      String password,
-
 
13576
      long role)
13567
    {
13577
    {
13568
      this();
13578
      this();
13569
      this.username = username;
13579
      this.username = username;
13570
      this.password = password;
13580
      this.password = password;
-
 
13581
      this.role = role;
-
 
13582
      setRoleIsSet(true);
13571
    }
13583
    }
13572
 
13584
 
13573
    /**
13585
    /**
13574
     * Performs a deep copy on <i>other</i>.
13586
     * Performs a deep copy on <i>other</i>.
13575
     */
13587
     */
13576
    public authenticateCatalogUser_args(authenticateCatalogUser_args other) {
13588
    public authenticateCatalogUser_args(authenticateCatalogUser_args other) {
-
 
13589
      __isset_bit_vector.clear();
-
 
13590
      __isset_bit_vector.or(other.__isset_bit_vector);
13577
      if (other.isSetUsername()) {
13591
      if (other.isSetUsername()) {
13578
        this.username = other.username;
13592
        this.username = other.username;
13579
      }
13593
      }
13580
      if (other.isSetPassword()) {
13594
      if (other.isSetPassword()) {
13581
        this.password = other.password;
13595
        this.password = other.password;
13582
      }
13596
      }
-
 
13597
      this.role = other.role;
13583
    }
13598
    }
13584
 
13599
 
13585
    public authenticateCatalogUser_args deepCopy() {
13600
    public authenticateCatalogUser_args deepCopy() {
13586
      return new authenticateCatalogUser_args(this);
13601
      return new authenticateCatalogUser_args(this);
13587
    }
13602
    }
Line 13637... Line 13652...
13637
      if (!value) {
13652
      if (!value) {
13638
        this.password = null;
13653
        this.password = null;
13639
      }
13654
      }
13640
    }
13655
    }
13641
 
13656
 
-
 
13657
    public long getRole() {
-
 
13658
      return this.role;
-
 
13659
    }
-
 
13660
 
-
 
13661
    public authenticateCatalogUser_args setRole(long role) {
-
 
13662
      this.role = role;
-
 
13663
      setRoleIsSet(true);
-
 
13664
      return this;
-
 
13665
    }
-
 
13666
 
-
 
13667
    public void unsetRole() {
-
 
13668
      __isset_bit_vector.clear(__ROLE_ISSET_ID);
-
 
13669
    }
-
 
13670
 
-
 
13671
    /** Returns true if field role is set (has been asigned a value) and false otherwise */
-
 
13672
    public boolean isSetRole() {
-
 
13673
      return __isset_bit_vector.get(__ROLE_ISSET_ID);
-
 
13674
    }
-
 
13675
 
-
 
13676
    public void setRoleIsSet(boolean value) {
-
 
13677
      __isset_bit_vector.set(__ROLE_ISSET_ID, value);
-
 
13678
    }
-
 
13679
 
13642
    public void setFieldValue(_Fields field, Object value) {
13680
    public void setFieldValue(_Fields field, Object value) {
13643
      switch (field) {
13681
      switch (field) {
13644
      case USERNAME:
13682
      case USERNAME:
13645
        if (value == null) {
13683
        if (value == null) {
13646
          unsetUsername();
13684
          unsetUsername();
Line 13655... Line 13693...
13655
        } else {
13693
        } else {
13656
          setPassword((String)value);
13694
          setPassword((String)value);
13657
        }
13695
        }
13658
        break;
13696
        break;
13659
 
13697
 
-
 
13698
      case ROLE:
-
 
13699
        if (value == null) {
-
 
13700
          unsetRole();
-
 
13701
        } else {
-
 
13702
          setRole((Long)value);
-
 
13703
        }
-
 
13704
        break;
-
 
13705
 
13660
      }
13706
      }
13661
    }
13707
    }
13662
 
13708
 
13663
    public void setFieldValue(int fieldID, Object value) {
13709
    public void setFieldValue(int fieldID, Object value) {
13664
      setFieldValue(_Fields.findByThriftIdOrThrow(fieldID), value);
13710
      setFieldValue(_Fields.findByThriftIdOrThrow(fieldID), value);
Line 13670... Line 13716...
13670
        return getUsername();
13716
        return getUsername();
13671
 
13717
 
13672
      case PASSWORD:
13718
      case PASSWORD:
13673
        return getPassword();
13719
        return getPassword();
13674
 
13720
 
-
 
13721
      case ROLE:
-
 
13722
        return new Long(getRole());
-
 
13723
 
13675
      }
13724
      }
13676
      throw new IllegalStateException();
13725
      throw new IllegalStateException();
13677
    }
13726
    }
13678
 
13727
 
13679
    public Object getFieldValue(int fieldId) {
13728
    public Object getFieldValue(int fieldId) {
Line 13685... Line 13734...
13685
      switch (field) {
13734
      switch (field) {
13686
      case USERNAME:
13735
      case USERNAME:
13687
        return isSetUsername();
13736
        return isSetUsername();
13688
      case PASSWORD:
13737
      case PASSWORD:
13689
        return isSetPassword();
13738
        return isSetPassword();
-
 
13739
      case ROLE:
-
 
13740
        return isSetRole();
13690
      }
13741
      }
13691
      throw new IllegalStateException();
13742
      throw new IllegalStateException();
13692
    }
13743
    }
13693
 
13744
 
13694
    public boolean isSet(int fieldID) {
13745
    public boolean isSet(int fieldID) {
Line 13724... Line 13775...
13724
          return false;
13775
          return false;
13725
        if (!this.password.equals(that.password))
13776
        if (!this.password.equals(that.password))
13726
          return false;
13777
          return false;
13727
      }
13778
      }
13728
 
13779
 
-
 
13780
      boolean this_present_role = true;
-
 
13781
      boolean that_present_role = true;
-
 
13782
      if (this_present_role || that_present_role) {
-
 
13783
        if (!(this_present_role && that_present_role))
-
 
13784
          return false;
-
 
13785
        if (this.role != that.role)
-
 
13786
          return false;
-
 
13787
      }
-
 
13788
 
13729
      return true;
13789
      return true;
13730
    }
13790
    }
13731
 
13791
 
13732
    @Override
13792
    @Override
13733
    public int hashCode() {
13793
    public int hashCode() {
Line 13756... Line 13816...
13756
      }
13816
      }
13757
      lastComparison = TBaseHelper.compareTo(password, typedOther.password);
13817
      lastComparison = TBaseHelper.compareTo(password, typedOther.password);
13758
      if (lastComparison != 0) {
13818
      if (lastComparison != 0) {
13759
        return lastComparison;
13819
        return lastComparison;
13760
      }
13820
      }
-
 
13821
      lastComparison = Boolean.valueOf(isSetRole()).compareTo(isSetRole());
-
 
13822
      if (lastComparison != 0) {
-
 
13823
        return lastComparison;
-
 
13824
      }
-
 
13825
      lastComparison = TBaseHelper.compareTo(role, typedOther.role);
-
 
13826
      if (lastComparison != 0) {
-
 
13827
        return lastComparison;
-
 
13828
      }
13761
      return 0;
13829
      return 0;
13762
    }
13830
    }
13763
 
13831
 
13764
    public void read(TProtocol iprot) throws TException {
13832
    public void read(TProtocol iprot) throws TException {
13765
      TField field;
13833
      TField field;
Line 13787... Line 13855...
13787
                this.password = iprot.readString();
13855
                this.password = iprot.readString();
13788
              } else { 
13856
              } else { 
13789
                TProtocolUtil.skip(iprot, field.type);
13857
                TProtocolUtil.skip(iprot, field.type);
13790
              }
13858
              }
13791
              break;
13859
              break;
-
 
13860
            case ROLE:
-
 
13861
              if (field.type == TType.I64) {
-
 
13862
                this.role = iprot.readI64();
-
 
13863
                setRoleIsSet(true);
-
 
13864
              } else { 
-
 
13865
                TProtocolUtil.skip(iprot, field.type);
-
 
13866
              }
-
 
13867
              break;
13792
          }
13868
          }
13793
          iprot.readFieldEnd();
13869
          iprot.readFieldEnd();
13794
        }
13870
        }
13795
      }
13871
      }
13796
      iprot.readStructEnd();
13872
      iprot.readStructEnd();
Line 13809... Line 13885...
13809
      if (this.password != null) {
13885
      if (this.password != null) {
13810
        oprot.writeFieldBegin(PASSWORD_FIELD_DESC);
13886
        oprot.writeFieldBegin(PASSWORD_FIELD_DESC);
13811
        oprot.writeString(this.password);
13887
        oprot.writeString(this.password);
13812
        oprot.writeFieldEnd();
13888
        oprot.writeFieldEnd();
13813
      }
13889
      }
-
 
13890
      oprot.writeFieldBegin(ROLE_FIELD_DESC);
-
 
13891
      oprot.writeI64(this.role);
-
 
13892
      oprot.writeFieldEnd();
13814
      oprot.writeFieldStop();
13893
      oprot.writeFieldStop();
13815
      oprot.writeStructEnd();
13894
      oprot.writeStructEnd();
13816
    }
13895
    }
13817
 
13896
 
13818
    @Override
13897
    @Override
Line 13833... Line 13912...
13833
        sb.append("null");
13912
        sb.append("null");
13834
      } else {
13913
      } else {
13835
        sb.append(this.password);
13914
        sb.append(this.password);
13836
      }
13915
      }
13837
      first = false;
13916
      first = false;
-
 
13917
      if (!first) sb.append(", ");
-
 
13918
      sb.append("role:");
-
 
13919
      sb.append(this.role);
-
 
13920
      first = false;
13838
      sb.append(")");
13921
      sb.append(")");
13839
      return sb.toString();
13922
      return sb.toString();
13840
    }
13923
    }
13841
 
13924
 
13842
    public void validate() throws TException {
13925
    public void validate() throws TException {