Ejemplo n.º 1
0
 /**
  * @see
  *     com.ardais.bigr.iltds.btx.BTXDetails#describeIntoHistoryRecord(com.ardais.bigr.iltds.btx.BTXHistoryRecord)
  */
 public void describeIntoHistoryRecord(BTXHistoryRecord history) {
   super.describeIntoHistoryRecord(history);
   IdList addedPrivilegeIds = new IdList();
   StringList addedPrivilegeNames = new StringList();
   Iterator iterator = getAddedPrivileges().iterator();
   while (iterator.hasNext()) {
     PrivilegeDto privilege = (PrivilegeDto) iterator.next();
     addedPrivilegeIds.add(privilege.getId());
     addedPrivilegeNames.add(privilege.getDescription());
   }
   IdList removedPrivilegeIds = new IdList();
   StringList removedPrivilegeNames = new StringList();
   iterator = getRemovedPrivileges().iterator();
   while (iterator.hasNext()) {
     PrivilegeDto privilege = (PrivilegeDto) iterator.next();
     removedPrivilegeIds.add(privilege.getId());
     removedPrivilegeNames.add(privilege.getDescription());
   }
   history.setAttrib1(getObjectType());
   history.setAttrib2(getUserData().getUserId());
   history.setAttrib3(getUserData().getAccountId());
   history.setAttrib4(getAccountData().getId());
   history.setIdList1(addedPrivilegeIds);
   history.setClob1(addedPrivilegeNames.pack());
   history.setIdList2(removedPrivilegeIds);
   history.setClob2(removedPrivilegeNames.pack());
 }
Ejemplo n.º 2
0
 /**
  * @see
  *     com.ardais.bigr.iltds.btx.BTXDetails#populateFromHistoryRecord(com.ardais.bigr.iltds.btx.BTXHistoryRecord)
  */
 public void populateFromHistoryRecord(BTXHistoryRecord history) {
   super.populateFromHistoryRecord(history);
   IdList addedPrivilegeIds = history.getIdList1();
   StringList addedPrivilegeNames = new StringList(history.getClob1());
   Iterator idIterator = addedPrivilegeIds.iterator();
   Iterator nameIterator = addedPrivilegeNames.iterator();
   List addedPrivileges = new ArrayList();
   while (idIterator.hasNext() && nameIterator.hasNext()) {
     PrivilegeDto privilege = new PrivilegeDto();
     privilege.setDescription((String) nameIterator.next());
     privilege.setId((String) idIterator.next());
     addedPrivileges.add(privilege);
   }
   IdList removedPrivilegeIds = history.getIdList2();
   StringList removedPrivilegeNames = new StringList(history.getClob2());
   idIterator = removedPrivilegeIds.iterator();
   nameIterator = removedPrivilegeNames.iterator();
   List removedPrivileges = new ArrayList();
   while (idIterator.hasNext() && nameIterator.hasNext()) {
     PrivilegeDto privilege = new PrivilegeDto();
     privilege.setDescription((String) nameIterator.next());
     privilege.setId((String) idIterator.next());
     removedPrivileges.add(privilege);
   }
   setObjectType(history.getAttrib1());
   getUserData().setUserId(history.getAttrib2());
   getUserData().setAccountId(history.getAttrib3());
   getAccountData().setId(history.getAttrib4());
   setAddedPrivileges(addedPrivileges);
   setRemovedPrivileges(removedPrivileges);
   // These fields don't correspond to anything in the history record
   // but we must set them anyways.
   setAssignedPrivileges(null);
   setAllPrivileges(null);
   setRoleBasedPrivileges(null);
   setSelectedPrivileges(null);
   setPrivilegeFilter(null);
 }