Package com.zycus.pm.script.utilities

Source Code of com.zycus.pm.script.utilities.PMScriptsUtility

package com.zycus.pm.script.utilities;

import com.zycus.pm.api.bo.IPermisibleResource;
@SuppressWarnings("PMD")
public class PMScriptsUtility {

  public static void assignRight(int assignmentId, int entityId, int entityTypeId, String resourceName,
      String rightGroupName, String rightName, boolean isAllowed) {
    assignRight(assignmentId, entityId, entityTypeId, resourceName, rightGroupName, rightName, isAllowed, false);
  }

  public static void assignRight(int assignmentId, int entityId, int entityTypeId, String resourceName,
      String rightGroupName, String rightName, boolean isAllowed, boolean isInherited) {
    IPermisibleResource resource = ResourceUtility.getResource(resourceName);
    String sql = "insert into PM_PERMISSION_MASTER(PERMISSION_MASTER_PK,RESOURCE_ID,RESOURCE_TYPE_ID,ENTITY_ID,ENTITY_TYPE_ID,BASE_RIGHT_ID,IS_ALLOWED,IS_INHERITED) values ("
        + assignmentId
        + ","
        + resource.getResourceID()
        + ","
        + resource.getResourceTypeID()
        + ","
        + entityId
        + ","
        + entityTypeId
        + ","
        + RightsUtility.getRightId(rightGroupName, rightName)
        + ","
        + (isAllowed ? 1 : 0) + "," + (isInherited ? 1 : 0) + ")";
    System.out.println(sql);
  }
}
TOP

Related Classes of com.zycus.pm.script.utilities.PMScriptsUtility

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.