Package org.jresearch.flexess.core.model

Examples of org.jresearch.flexess.core.model.ObjectNotFoundException


  @Override
  public void addPermission(String dynamicRoleId, String permissionId) throws ObjectNotFoundException {
    IDynamicRoleMetaInfo role = getDynamicRole(dynamicRoleId);
    if (role == null) {
      throw new ObjectNotFoundException(MessageFormat.format("Dynamic role {0} is not found", dynamicRoleId), dynamicRoleId);
    }
    addPermissionInternal(permissionId, (DynamicRoleMetaInfo) role);
  }
View Full Code Here


  @Override
  public void assignPermissions(String dynamicRoleId, Set<IPermissionMetaInfo> permissions) throws ObjectNotFoundException {
    DynamicRoleMetaInfo role = (DynamicRoleMetaInfo) getDynamicRole(dynamicRoleId);
    if (role == null) {
      throw new ObjectNotFoundException("Dynamic role is not found", dynamicRoleId);
    }
    String appId = role.getModelId();
    Set<PermissionRole> perm = role.getPermissionRoles();
    if (permissions == null) {
      perm.clear();
      save(role);
      // getHibernateTemplate().save(role);
      return;
    }
    Set<PermissionRole> permToDelete = new HashSet<PermissionRole>();
    for (PermissionRole prole : perm) {
      String permissionId = prole.getPermissionId();
      boolean containsPermission = false;
      for (IPermissionMetaInfo permission : permissions) {
        if (permission.getId().equals(permissionId)) {
          containsPermission = true;
          break;
        }
      }
      if (!containsPermission) {
        permToDelete.add(prole);
      }
    }
    perm.removeAll(permToDelete);
    for (IPermissionMetaInfo permission : permissions) {
      boolean permissionExists = permissionDAO.existsPermission(appId, permission.getId());
      if (!permissionExists) {
        throw new ObjectNotFoundException("Permission is not found", permission.getId());
      }
      PermissionRole prole = new PermissionRole();
      prole.setRole(role);
      prole.setPermissionId(permission.getId());
      if (!perm.contains(prole)) {
View Full Code Here

   *             - if model or role template with given id wasn't found
   */
  public IRoleInstanceMetaInfo createRoleInstance(String modelId, String roleTemplateId) throws ObjectNotFoundException {
    IRoleMetaInfo roleMetaInfo = roleService.getRole(modelId, roleTemplateId);
    if (roleMetaInfo == null) {
      throw new ObjectNotFoundException(MessageFormat.format("Can''t find role template with id {0} in the model {1}.", roleTemplateId, modelId), roleTemplateId); //$NON-NLS-1$
    }
    return createRoleInstance(roleMetaInfo);
  }
View Full Code Here

  @Override
  public void addUserRole(String userId, String applicationId, IRoleInstanceMetaInfo rm) throws ObjectNotFoundException, DataModelException {
    IApplicationMetaInfo app = applicationService.getApplication(applicationId);
    if (app == null) {
      throw new ObjectNotFoundException("Application is not found", applicationId); //$NON-NLS-1$
    }
    addUserRole(userId, app, rm);
  }
View Full Code Here

  @Override
  public void addUserRole(String userId, String applicationId, String id) throws ObjectNotFoundException, DataModelException {
    IRoleInstanceMetaInfo rm = roleInstanceService.getRoleInstance(id);
    if (rm == null) {
      throw new ObjectNotFoundException("Role instance is not found", id); //$NON-NLS-1$
    }
    addUserRole(userId, applicationId, rm);
  }
View Full Code Here

  @Override
  public IRoleInstanceMetaInfo getRoleInstanceImpl(String modelId) throws ObjectNotFoundException {
    IModelMetaInfo mm = modelService.getSerializedModel(modelId);
    if (mm == null) {
      throw new ObjectNotFoundException("Model is not found", modelId); //$NON-NLS-1$
    }
    RoleInstanceMetaInfo rm = new RoleInstanceMetaInfo();
    rm.setModelId(modelId);
    return rm;
  }
View Full Code Here

    return null;
  }

  public PObject getPObjectByName(String modelId, String name) throws ObjectNotFoundException {
    if (!modelDao.hasModel(modelId)) {
      throw new ObjectNotFoundException("Application not found", modelId);
    }
    SecurityModel securityModel = modelDao.getSecurityModel(modelId);
    Collection<PObject> pobjects = EcoreUtil.getObjectsByType(securityModel.getEClassifiers(), UamPackage.eINSTANCE.getPObject());
    for (PObject object : pobjects) {
      if (object.getName().equals(name)) {
View Full Code Here

    return null;
  }

  public Permission getPermissionByName(String modelId, String name) throws ObjectNotFoundException {
    if (!modelDao.hasModel(modelId)) {
      throw new ObjectNotFoundException("Application not found", modelId);
    }
    SecurityModel securityModel = modelDao.getSecurityModel(modelId);
    Collection<Permission> permissions = EcoreUtil.getObjectsByType(securityModel.getEClassifiers(), UamPackage.eINSTANCE.getPermission());
    for (Permission object : permissions) {
      if (object.getName().equals(name)) {
View Full Code Here

    return null;
  }

  public Role getRoleByName(String modelId, String name) throws ObjectNotFoundException {
    if (!modelDao.hasModel(modelId)) {
      throw new ObjectNotFoundException("Application not found", modelId);
    }
    SecurityModel securityModel = modelDao.getSecurityModel(modelId);
    Collection<Role> roles = EcoreUtil.getObjectsByType(securityModel.getEClassifiers(), UamPackage.eINSTANCE.getRole());
    for (Role role : roles) {
      if (role.getName().equals(name)) {
View Full Code Here

TOP

Related Classes of org.jresearch.flexess.core.model.ObjectNotFoundException

Copyright © 2018 www.massapicom. 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.