Package co.cubicode.rbacframework.biz

Source Code of co.cubicode.rbacframework.biz.PermissionBiz

package co.cubicode.rbacframework.biz;

import co.cubicode.jdbcframework.DatabaseFactory;
import co.cubicode.jdbcframework.SQL;
import co.cubicode.jdbcframework.SQLQuery;
import co.cubicode.jdbcframework.exceptions.ObjectNotFoundException;
import co.cubicode.rbacframework.models.Permission;
import co.cubicode.rbacframework.models.catalogs.Application;
import co.cubicode.rbacframework.models.catalogs.ObjectType;
import co.cubicode.rbacframework.models.catalogs.OperationType;

public class PermissionBiz {

  public static Permission findByPrimaryKey(Application application, ObjectType objectType, OperationType operationType)
      throws ObjectNotFoundException {
    return findByPrimaryKey(application.getId(), objectType.getId(), operationType.getId());
  }

  public static Permission findByPrimaryKey(Integer application, Integer objectType, Integer operationType) throws ObjectNotFoundException {
    return findByPrimaryKey(application.toString(), objectType.toString(), operationType.toString());
  }

  public static Permission findByPrimaryKey(String application, String objectType, String operationType) throws ObjectNotFoundException {
    DatabaseFactory instance = DatabaseFactory.getInstance("rbac");
    SQLQuery sql = SQL.getSQL(Permission.class, "findByPrimaryKey");
    sql.setParameter("application", application);
    sql.setParameter("objectType", objectType);
    sql.setParameter("operationType", operationType);
    return instance.query(Permission.class, sql);
  }

}
TOP

Related Classes of co.cubicode.rbacframework.biz.PermissionBiz

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.