Package org.jresearch.flexess.client

Examples of org.jresearch.flexess.client.InconsistentModelException


    final EObject roInstance = securityFactory.create(role);
    final Set<IPermissionInstanceMetaInfo> permissionInstances = roleInst.getPermissionInstances();
    for (final IPermissionInstanceMetaInfo instance : permissionInstances) {
      final Permission permission = findPermission(securityModel, instance.getPermissionId());
      if (permission == null) {
        throw new InconsistentModelException("Inconsistent model. Permission " + instance.getPermissionId() //$NON-NLS-1$
            + " is not found. It can be caused by model upgrade on the server. Restart application to load new model."); //$NON-NLS-1$
      }
      final EReference permissionRef = EMFUtil.getPermission(role, permission);
      final EObject permissionInstance = securityFactory.create(permission);
      roInstance.eSet(permissionRef, permissionInstance);
      final Set<IPermissionParameter> parameters = instance.getPermissionParameters();
      for (final IPermissionParameter parameter : parameters) {
        final EAttribute attr = findAttribute(permission, parameter.getAttributeName());
        if (attr == null) {
          throw new InconsistentModelException(MessageFormat.format("Inconsistent model. Attribute {0} of {1} permission is not found. It can be caused by model upgrade on the server. Restart application to load new model.", //$NON-NLS-1$
              instance.getPermissionId(), parameter.getAttributeName()));
        }
        final String isUser = EcoreUtil.getAnnotation(attr, UamPackage.eNS_URI, IAttributeConstant.ANNOTATION_KEY_RUNTIME);
        boolean isUserAttr = false;
        if (isUser != null) {
          try {
            isUserAttr = Boolean.parseBoolean(isUser);
          } catch (final Exception e) {
            // do nothing
          }
        }
        Object value = null;
        if (isUserAttr) {
          try {
            if ("uid".equals(parameter.getAttributeName())) { //$NON-NLS-1$
              value = user.getUid();
            } else {
              value = user.getAttribute(parameter.getAttributeName());
            }
          } catch (final UserAttributeNotFoundException ex) {
            throw new InconsistentModelException(ex);
          }
        } else {
          value = parameter.getValue();
        }
        if (value instanceof String) {
View Full Code Here


    role.setName(roleInst.getName());
    final Set<IPermissionInstanceMetaInfo> permissionInstances = roleInst.getPermissionInstances();
    for (final IPermissionInstanceMetaInfo info : permissionInstances) {
      final Permission permission = findPermission(model, info.getPermissionId());
      if (permission == null) {
        throw new InconsistentModelException(MessageFormat.format("Inconsistent model. Permission {0} is not found. It can be caused by model upgrade on the server. Restart application to load new model.", info.getPermissionId())); //$NON-NLS-1$
      }
      EMFUtil.addPermission(role, permission);
    }
    model.getEClassifiers().add(role);
    return role;
View Full Code Here

TOP

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

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.