Package org.jresearch.flexess.client

Examples of org.jresearch.flexess.client.UamClientException


  @Override
  public EObject getPOInstance(PObject po) {
    assert po != null;
    String mapperId = EcoreUtil.getAnnotation(po, UamPackage.eNS_URI, IPObjectConstant.MAPPER_CLASS_NAME_ATTR);
    if (mapperId == null) {
      throw new UamClientException("Mapper is not specified");
    }
    IInstanceMapper mapper = mappers.get(mapperId);
    if (mapper == null) {
      throw new UamClientException(MessageFormat.format("Unable to create EObject: can''t find {0} mapper ", mapperId));
    }
    try {
      return mapper.createPObjectInstance(object, po);
    } catch (Exception e) {
      throw new UamClientException("Unable to create EObject", e);
    }
  }
View Full Code Here


    EObject eObject = null;
    try {
      IInstanceMapper mapper = new DefaultMapper();
      eObject = mapper.createPObjectInstance(null, po);
    } catch (Exception e) {
      throw new UamClientException("Unable to create EObject", e);
    }
    return eObject;
  }
View Full Code Here

  @Override
  public IUser getUser(final String userId) throws UamClientException {
    try {
      return userService.getUser(applicationId, userId);
    } catch (final UmiException e) {
      throw new UamClientException(MessageFormat.format("Unable to find application: {0}.", e.getLocalizedMessage()), e); //$NON-NLS-1$
    } catch (final RemoteAccessException e) {
      throw new FlexessConnectException(MessageFormat.format("Can't connect: {0}.", e.getLocalizedMessage()), e); //$NON-NLS-1$
    }
  }
View Full Code Here

  @Override
  public boolean isResetEnable() {
    try {
      return userService.isResetEnable(applicationId);
    } catch (final UmiException e) {
      throw new UamClientException(MessageFormat.format("Some UNI problem: {0}.", e.getLocalizedMessage()), e); //$NON-NLS-1$
    }
  }
View Full Code Here

  @Override
  public void reset(final IResetAuthenticationData resetAuthData) throws ResetAuthenticationException, UnsupportedAuthenticationMethodException {
    try {
      userService.reset(applicationId, resetAuthData);
    } catch (final UmiException e) {
      throw new UamClientException(MessageFormat.format("Some UMI problem: {0}.", e.getLocalizedMessage()), e); //$NON-NLS-1$
    }
  }
View Full Code Here

  @Override
  public boolean isSignUpEnable() {
    try {
      return userService.isSignUpEnable(applicationId);
    } catch (final UmiException e) {
      throw new UamClientException(MessageFormat.format("Some UNI problem: {0}.", e.getLocalizedMessage()), e); //$NON-NLS-1$
    }
  }
View Full Code Here

  }

  @Override
  public void check(final Object object, final String operation) throws AccessControlException, UamClientException {
    if (object == null) {
      throw new UamClientException("The object in check method can't be a null"); //$NON-NLS-1$
    }
    if (operation == null) {
      throw new UamClientException("The operation in check method can't be a null"); //$NON-NLS-1$
    }
    checkAllModels(getSecurityModels(), object, operation, new SimpleCheckerFlow(object));
  }
View Full Code Here

        objectFound = true;
        break;
      } catch (final PObjectNotFoundException e) {
        // do nothing
      } catch (final ObjectNotFoundException e) {
        throw new UamClientException(e);
      }
    }
    if (!objectFound) {
      throw new PObjectNotFoundException(MessageFormat.format("Can''t find pObject mapping for {0} class", currentClass.getName()), operation); //$NON-NLS-1$
    }
View Full Code Here

  private List<EObject> loadRoles(final String applicationId, final String modelId, final String userId) throws UamClientException {
    final SecurityModel securityModel = getSecurityModel(modelId);
    final IUser user = userManager.getUser(userId);
    if (user == null) {
      throw new UamClientException(MessageFormat.format("User {0} is not found.", userId)); //$NON-NLS-1$
    }
    try {
      IRoleInstanceMetaInfo[] roleInstances = userRoles.getRoleInstances(applicationId, userId);
      // Load default roles if no roles assigned to user
      if (roleInstances.length == 0) {
        final List<IRoleInstanceMetaInfo> defaultRoleInstances = userRoles.getDefaultRoleInstances(applicationId);
        roleInstances = defaultRoleInstances.toArray(new IRoleInstanceMetaInfo[defaultRoleInstances.size()]);
      }
      final List<EObject> emfRoles = new ArrayList<>();
      for (final IRoleInstanceMetaInfo roleInst : roleInstances) {
        try {
          emfRoles.add(loadRoleInstance(roleInst, user, securityModel));
        } catch (final Exception e) {
          throw new UamClientException(MessageFormat.format("Unable to load role instance {0}: {1}", roleInst.getRoleId(), e.getLocalizedMessage()), e); //$NON-NLS-1$
        }
      }
      return emfRoles;
    } catch (final LoadRoleInstanceException e) {
      throw new UamClientException(MessageFormat.format("Unable to get roles: {0}.", e.getLocalizedMessage()), e); //$NON-NLS-1$
    } catch (final RemoteAccessException e) {
      throw new FlexessConnectException(MessageFormat.format("Can't connect: {0}.", e.getLocalizedMessage()), e); //$NON-NLS-1$
    }
  }
View Full Code Here

    if (roles == null || roles.size() == 0) {
      throw new AccessControlException("Role list is empty"); //$NON-NLS-1$
    }
    final EObject eObject = checkerFlow.getPOInstance(po);
    if (eObject == null) {
      throw new UamClientException(MessageFormat.format("Error creating EObject for PObject{0}", po)); //$NON-NLS-1$
    }
    return checker.check(roles, eObject, operation);

  }
View Full Code Here

TOP

Related Classes of org.jresearch.flexess.client.UamClientException

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.