Advertisement
r4j

User Entity ksoap

r4j
Oct 10th, 2012
99
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 5.16 KB | None | 0 0
  1. package com.org.domains;
  2.  
  3. import java.util.Hashtable;
  4. import org.ksoap2.serialization.KvmSerializable;
  5. import org.ksoap2.serialization.PropertyInfo;
  6.  
  7. public class User implements KvmSerializable  {
  8.     public int user_id;
  9.     public String username;
  10.     public String email;
  11.     public String password;
  12.     public String salt;
  13.     public String id_card;
  14.     public String fullname;
  15.     public String birthdate;
  16.     public String gender;
  17.     public String address;
  18.     public String country;
  19.     public String location;
  20.     public String zipcode;
  21.     public String mobile;
  22.     public int is_active;
  23.     public int is_lock;
  24.     public String active_token;
  25.     public String created_date;
  26.     public double point;
  27.     public double gold;
  28.     public int level;
  29.     public int level_point;
  30.  
  31.     public User() {
  32.  
  33.     }
  34.  
  35.     public Object getProperty(int index) {
  36.         switch (index) {
  37.         case 0:
  38.             return user_id;
  39.         case 1:
  40.             return username;
  41.         case 2:
  42.             return email;
  43.         case 3:
  44.             return password;
  45.         case 4:
  46.             return salt;
  47.         case 5:
  48.             return id_card;
  49.         case 6:
  50.             return fullname;
  51.         case 7:
  52.             return birthdate;
  53.         case 8:
  54.             return gender;
  55.         case 9:
  56.             return address;
  57.         case 10:
  58.             return country;
  59.         case 11:
  60.             return location;
  61.         case 12:
  62.             return zipcode;
  63.         case 13:
  64.             return mobile;
  65.         case 14:
  66.             return is_active;
  67.         case 15:
  68.             return is_lock;
  69.         case 16:
  70.             return active_token;
  71.         case 17:
  72.             return created_date;
  73.         case 18:
  74.             return point;
  75.         case 19:
  76.             return gold;
  77.         case 20:
  78.             return level;
  79.         case 21:
  80.             return level_point;
  81.  
  82.         default:
  83.             return null;
  84.         }
  85.     }
  86.  
  87.     public int getPropertyCount() {
  88.         return 22;
  89.     }
  90.  
  91.     public void getPropertyInfo(int index, Hashtable arg1, PropertyInfo info) {
  92.         switch (index) {
  93.         case 0:
  94.             info.type = PropertyInfo.INTEGER_CLASS;
  95.             info.name = "user_id";
  96.             break;
  97.         case 1:
  98.             info.type = PropertyInfo.STRING_CLASS;
  99.             info.name = "username";
  100.             break;
  101.         case 2:
  102.             info.type = PropertyInfo.STRING_CLASS;
  103.             info.name = "email";
  104.             break;
  105.         case 3:
  106.             info.type = PropertyInfo.STRING_CLASS;
  107.             info.name = "password";
  108.             break;
  109.         case 4:
  110.             info.type = PropertyInfo.STRING_CLASS;
  111.             info.name = "salt";
  112.             break;
  113.         case 5:
  114.             info.type = PropertyInfo.STRING_CLASS;
  115.             info.name = "id_card";
  116.             break;
  117.         case 6:
  118.             info.type = PropertyInfo.STRING_CLASS;
  119.             info.name = "fullname";
  120.             break;
  121.         case 7:
  122.             info.type = PropertyInfo.STRING_CLASS;
  123.             info.name = "birthdate";
  124.             break;
  125.         case 8:
  126.             info.type = PropertyInfo.STRING_CLASS;
  127.             info.name = "gender";
  128.             break;
  129.         case 9:
  130.             info.type = PropertyInfo.STRING_CLASS;
  131.             info.name = "address";
  132.             break;
  133.         case 10:
  134.             info.type = PropertyInfo.STRING_CLASS;
  135.             info.name = "country";
  136.             break;
  137.         case 11:
  138.             info.type = PropertyInfo.STRING_CLASS;
  139.             info.name = "location";
  140.             break;
  141.         case 12:
  142.             info.type = PropertyInfo.STRING_CLASS;
  143.             info.name = "zipcode";
  144.             break;
  145.         case 13:
  146.             info.type = PropertyInfo.STRING_CLASS;
  147.             info.name = "mobile";
  148.             break;
  149.         case 14:
  150.             info.type = PropertyInfo.INTEGER_CLASS;
  151.             info.name = "is_active";
  152.             break;
  153.         case 15:
  154.             info.type = PropertyInfo.INTEGER_CLASS;
  155.             info.name = "is_lock";
  156.             break;
  157.         case 16:
  158.             info.type = PropertyInfo.STRING_CLASS;
  159.             info.name = "active_token";
  160.             break;
  161.         case 17:
  162.             info.type = PropertyInfo.STRING_CLASS;
  163.             info.name = "created_date";
  164.             break;
  165.         case 18:
  166.             info.type = Double.class;
  167.             info.name = "point";
  168.             break;
  169.         case 19:
  170.             info.type = Double.class;
  171.             info.name = "gold";
  172.             break;
  173.  
  174.         case 20:
  175.             info.type = PropertyInfo.INTEGER_CLASS;
  176.             info.name = "level";
  177.             break;
  178.         case 21:
  179.             info.type = PropertyInfo.INTEGER_CLASS;
  180.             info.name = "level_point";
  181.             break;
  182.         default:
  183.             break;
  184.         }
  185.     }
  186.  
  187.     public void setProperty(int index, Object value) {
  188.         if(null == value)
  189.             value = "";
  190.         switch (index) {
  191.         case 0:
  192.             user_id = Integer.parseInt(value.toString());
  193.             break;
  194.         case 1:
  195.             username = value.toString();
  196.             break;
  197.         case 2:
  198.             email = value.toString();
  199.             break;
  200.         case 3:
  201.             password = value.toString();
  202.             break;
  203.         case 4:
  204.             salt = value.toString();
  205.             break;
  206.         case 5:
  207.             id_card = value.toString();
  208.             break;
  209.         case 6:
  210.             fullname = value.toString();
  211.             break;
  212.         case 7:
  213.             birthdate = value.toString();
  214.             break;
  215.         case 8:
  216.             gender = value.toString();
  217.             break;
  218.         case 9:
  219.             address = value.toString();
  220.             break;
  221.         case 10:
  222.             country = value.toString();
  223.             break;
  224.         case 11:
  225.             location = value.toString();
  226.             break;
  227.         case 12:
  228.             zipcode = value.toString();
  229.             break;
  230.         case 13:
  231.             mobile = value.toString();
  232.             break;
  233.         case 14:
  234.             is_active = Integer.parseInt(value.toString());
  235.             break;
  236.         case 15:
  237.             is_lock = Integer.parseInt(value.toString());
  238.             break;
  239.         case 16:
  240.             active_token = value.toString();
  241.             break;
  242.         case 17:
  243.             created_date = value.toString();
  244.             break;
  245.         case 18:
  246.             point = Double.parseDouble(value.toString());
  247.             break;
  248.         case 19:
  249.             gold = Double.parseDouble(value.toString());
  250.             break;
  251.  
  252.         case 20:
  253.             level = Integer.parseInt(value.toString());
  254.             break;
  255.         case 21:
  256.             level_point = Integer.parseInt(value.toString());
  257.             break;
  258.         default:
  259.             break;
  260.         }
  261.  
  262.     }
  263.  
  264. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement