Examples of BaseRight


Examples of com.zycus.pm.api.bo.BaseRight

  }
 
  public BaseRight getBaseRight(long baseRightID) {
    SessionFactory sessionFactory = null;
    Session session = null;
    BaseRight baseRight = null;
    try {
      sessionFactory = HibernateSessionFactory.getInstance();
      session = sessionFactory.openSession();
      Criteria c = session.createCriteria(BaseRight.class);
      c.add(Restrictions.idEq(baseRightID));
View Full Code Here

Examples of com.zycus.pm.api.bo.BaseRight

      throw new IllegalArgumentException("Invalid right provided");
    }
    int highestPriority = right.getPriority();
    Permission currentHighestRight = getPermission(rights, right);
    for (int iCounter = 0; iCounter < baseRights.size(); iCounter++) {
      BaseRight bRight = (BaseRight) baseRights.get(iCounter);
      // in-case this right is not assigned, ignore this one
      if (isRightPresent(rights, right) == false) {
        continue;
      }
      if (highestPriority > bRight.getPriority()) {
        highestPriority = bRight.getPriority();
        currentHighestRight = getPermission(rights, bRight);
      }
    }
    return currentHighestRight.isAllowed();
  }
View Full Code Here

Examples of com.zycus.pm.api.bo.BaseRight

      throw new IllegalArgumentException("Invalid right provided");
    }
    Permission highestPriorityRight = getPermission(rights, right);
    int highestPriority = right.getPriority();
    for (int iCounter = 0; iCounter < baseRights.size(); iCounter++) {
      BaseRight bRight = (BaseRight) baseRights.get(iCounter);
      // in-case this right is not assigned, ignore this one
      if (isRightPresent(rights, right) == false) {
        continue;
      }
      if (highestPriority > bRight.getPriority()) {
        highestPriority = bRight.getPriority();
        highestPriorityRight = getPermission(rights, bRight);
      }
    }
    return highestPriorityRight;
  }
View Full Code Here

Examples of com.zycus.pm.api.bo.BaseRight

  }

  public BaseRight addRight(RightsGroup group, String rightName, int priority, boolean defaultAllowed)
      throws DuplicateNameException {
    validateNullEntries(group, rightName);
    BaseRight baseRight = null;

    for (BaseRight right : group.getBaseRights()) {
      if (right.getRightDescription().equals(rightName)) {
        baseRight = right;
        break;
      }
    }

    if (baseRight == null) {
      baseRight = new BaseRight(rightName);
      baseRight.setGroup(group);
      baseRight.setPriority(priority);
      baseRight.setDefaultIsAllowed(defaultAllowed);

      dbHandler.upsertBaseRight(baseRight);
    }

    return baseRight;
View Full Code Here

Examples of com.zycus.pm.api.bo.BaseRight

    return group;
  }

  public void addRights(RightsGroup group, String... rightNames) throws DuplicateNameException {
    for (String rightName : rightNames) {
      BaseRight right = group.getBaseRight(rightName);
      if (right == null) {
        right = new BaseRight(rightName);
        right.setGroup(group);
        group.addBaseRights(right);
      }
    }
    dbHandler.upsertRightsGroup(group);
  }
View Full Code Here

Examples of com.zycus.pm.api.bo.BaseRight

    dbHandler.upsertRightsGroup(group);
  }

  public void addRights(RightsGroup group, Map<String, Integer> rights) throws DuplicateNameException {
    for (String rightName : rights.keySet()) {
      BaseRight right = group.getBaseRight(rightName);
      if (right == null) {
        right = new BaseRight(rightName);
        right.setGroup(group);
        group.addBaseRights(right);
      }
      right.setPriority(rights.get(rightName));
    }
    dbHandler.upsertRightsGroup(group);
  }
View Full Code Here

Examples of com.zycus.pm.api.bo.BaseRight

    validateNullEntries(baseRight);
    dbHandler.upsertBaseRight(baseRight);
  }

  public BaseRight updateBaseRightDefaultAllowed(long baseRightID, boolean defaultIsAllowed) {
    BaseRight baseRight = dbHandler.getBaseRight(baseRightID);
    baseRight.setDefaultIsAllowed(defaultIsAllowed);
    return baseRight;
  }
View Full Code Here

Examples of com.zycus.pm.api.bo.BaseRight

    baseRight.setDefaultIsAllowed(defaultIsAllowed);
    return baseRight;
  }

  public BaseRight updateBaseRightName(long baseRightID, String baseRightName) throws DuplicateNameException {
    BaseRight baseRight = dbHandler.getBaseRight(baseRightID);
    if (baseRight.getRightDescription().equals(baseRightName)) {
      return baseRight;
    }
    if (baseRight.getGroup().getBaseRight(baseRightName) != null) {
      throw new DuplicateNameException("Right name can't be duplicate", DuplicateNameType.DuplicateRightName);
    }
    baseRight.setRightDescription(baseRightName);
    dbHandler.upsertBaseRight(baseRight);
    return baseRight;
  }
View Full Code Here

Examples of com.zycus.pm.api.bo.BaseRight

    return baseRight;
  }

  public BaseRight updateBaseRightNameDefaultAllowed(long baseRightID, String baseRightName, boolean defaultIsAllowed)
      throws DuplicateNameException {
    BaseRight baseRight = dbHandler.getBaseRight(baseRightID);
    if (baseRight.getRightDescription().equals(baseRightName)) {
      return baseRight;
    }
    if (baseRight.getGroup().getBaseRight(baseRightName) != null) {
      throw new DuplicateNameException("Right name can't be duplicate", DuplicateNameType.DuplicateRightName);
    }
    baseRight.setRightDescription(baseRightName);
    baseRight.setDefaultIsAllowed(defaultIsAllowed);
    dbHandler.upsertBaseRight(baseRight);
    return baseRight;
  }
View Full Code Here

Examples of com.zycus.pm.api.bo.BaseRight

    return baseRight;
  }

  public BaseRight updateBaseRightNamePriority(long baseRightID, String baseRightName, int priority)
      throws DuplicateNameException {
    BaseRight baseRight = dbHandler.getBaseRight(baseRightID);
    if (baseRight.getRightDescription().equals(baseRightName)) {
      return baseRight;
    }
    if (baseRight.getGroup().getBaseRight(baseRightName) != null) {
      throw new DuplicateNameException("Right name can't be duplicate", DuplicateNameType.DuplicateRightName);
    }
    baseRight.setRightDescription(baseRightName);
    baseRight.setPriority(priority);
    dbHandler.upsertBaseRight(baseRight);
    return baseRight;
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.