Ejemplo n.º 1
0
 public boolean delete(
     String id,
     String name,
     String password,
     String identityID,
     String institutionID,
     enumSet.Position work)
     throws RemoteException {
   List<UserPO> userList = this.list;
   UserPO po = new UserPO(id, name, password, identityID, institutionID, work);
   for (UserPO temp : userList) {
     if (temp.getId().equals(id) && temp.getName().equals(name)) {
       po = UserDS.find(identityID);
       UserDS.delete(po);
       userList.remove(po);
     }
   }
   return true;
 }
Ejemplo n.º 2
0
 public boolean add(
     String id,
     String name,
     String password,
     String identityID,
     String institutionID,
     enumSet.Position work)
     throws RemoteException {
   List<UserPO> userList = this.list;
   UserPO po = new UserPO(id, name, password, identityID, institutionID, work);
   for (UserPO temp : userList) {
     if (temp.getId().equals(po)) {
       return false;
     }
   }
   userList.add(po);
   UserDS.add(po);
   return true;
 }
Ejemplo n.º 3
0
 public UserVO(UserPO po) {
   id = po.getID();
   password = po.getPassword();
   authority = po.getAuthority();
   name = po.getName();
   sex = po.getSex();
   job = po.getJob();
   hallId = po.getHallId();
 }
Ejemplo n.º 4
0
 public UserVO findUser(String known, String info) {
   UserPO po = dataFactory.getUserdataService().find(known, info);
   if (po == null) return null;
   String hallName = apartmentbl.getName(po.getHallId());
   return new UserVO(
       po.getID(),
       po.getPassword(),
       po.getAuthority(),
       po.getName(),
       po.getSex(),
       po.getJob(),
       hallName);
 }
 public void driver(UserDataService userData) {
   UserPO user1 = new UserPO("100000001", UserType.DELIVERY, "Feifei", 1, "0011001", "abc123");
   UserPO user2 = new UserPO("000000001", UserType.ADMINISTRATOR, "Shiny", 5, "", "admin");
   if (userData.add(user1).equals(ResultMessage.SUCCEED)) {
     System.out.println("add succeed");
   }
   if (userData.add(user2).equals(ResultMessage.SUCCEED)) {
     System.out.println("add succeed");
   }
   if (userData.add(user1).equals(ResultMessage.EXITED)) {
     System.out.println("add failed,car exited");
   }
   UserPO get = userData.find("100000001");
   if (get != null)
     System.out.println("find:name=" + get.getUserName() + ",password="******"100000002");
   if (get == null) System.out.println("find failed,not found");
   user1.setUserId("100000002");
   if (userData.modify(user1).equals(ResultMessage.SUCCEED)) System.out.println("modify succeed");
   if (userData.delete("100000002").equals(ResultMessage.SUCCEED))
     System.out.println("delete succeed");
   if (userData.delete("100000002").equals(ResultMessage.NOTFOUND))
     System.out.println("delete failed,not found");
 }
Ejemplo n.º 6
0
 public UserPO(UserPO po) {
   id = po.getId();
   name = po.getName();
   password = po.password;
   role = po.role;
 }