Пример #1
0
 @Override
 public void fillResource(IForm iFrom, Resource resource) {
   if (iFrom == null) {
     resource.setCurrentAccountPermission(CommonConstants.PERMISSION.NONE);
     resource.setCurrentGroupPermission(CommonConstants.PERMISSION.NONE);
     resource.setOthersPermission(CommonConstants.PERMISSION.NONE);
     return;
   }
   Map<Integer, Boolean> permissionMap = iFrom.getPermissionMap();
   Boolean[] _temp = new Boolean[3];
   for (int i = 0; i < 3; i++) {
     _temp[i % 3] = permissionMap.get(i);
   }
   resource.setCurrentAccountPermission(PermissionUtil.booleanToInteger(_temp).byteValue());
   for (int i = 3; i < 6; i++) {
     _temp[i % 3] = permissionMap.get(i);
   }
   resource.setCurrentGroupPermission(PermissionUtil.booleanToInteger(_temp).byteValue());
   for (int i = 6; i < 9; i++) {
     _temp[i % 3] = permissionMap.get(i);
   }
   resource.setOthersPermission(PermissionUtil.booleanToInteger(_temp).byteValue());
 }
Пример #2
0
  @Override
  public void fillForm(Resource resource, IForm iFrom) {
    if (resource == null) {
      return;
    }
    Boolean[] pCurrentUser =
        PermissionUtil.integerToBoolean(resource.getCurrentAccountPermission().intValue());
    iFrom.setPermission("0", pCurrentUser[0]);
    iFrom.setPermission("1", pCurrentUser[1]);
    iFrom.setPermission("2", pCurrentUser[2]);

    Boolean[] pCurrentGroup =
        PermissionUtil.integerToBoolean(resource.getCurrentGroupPermission().intValue());
    iFrom.setPermission("3", pCurrentGroup[0]);
    iFrom.setPermission("4", pCurrentGroup[1]);
    iFrom.setPermission("5", pCurrentGroup[2]);

    Boolean[] pOther = PermissionUtil.integerToBoolean(resource.getOthersPermission().intValue());
    iFrom.setPermission("6", pOther[0]);
    iFrom.setPermission("7", pOther[1]);
    iFrom.setPermission("8", pOther[2]);
  }