Package org.jresearch.flexess.core.model.uam

Examples of org.jresearch.flexess.core.model.uam.PObject


  }

  @SuppressWarnings("unchecked")
  @Override
  public PObject rawConvert() throws LoadModelException {
    PObject result = super.rawConvert();

    EMFUtil.setAnnotation(result, IPObjectConstant.CLASSNAME_ATTR, getXmlElement().getClass_());
    EMFUtil.setAnnotation(result, IPObjectConstant.MAPPER_ID_ATTR, JAVA_MAPPER_ID);
    EMFUtil.setAnnotation(result, IPObjectConstant.MAPPER_CLASS_NAME_ATTR, ID);

    for (AttributeType attribute : getXmlElement().getObjectAttribute()) {
      result.getEStructuralFeatures().add(new AttributeConverter<AttributeType>(attribute).convert());
    }
    for (ProtectedOperationType xmlOperation : getXmlElement().getOperation()) {
      POperation operation = new OperationConverter(xmlOperation, getConverted()).convert();
      result.getPermission().addAll(operation.getPermission());
      result.getEOperations().add(operation);
    }
    for (PermissionType permission : getXmlElement().getPermission()) {
      result.getPermission().add(new PermissionConverter(permission, getConverted()).convert());
    }
    return result;
  }
View Full Code Here


    pack.setName("orders"); //$NON-NLS-1$
    pack.setNsPrefix("ord"); //$NON-NLS-1$
    pack.setNsURI("http://www.jresearchsoft.com/schemas/orders"); //$NON-NLS-1$
    EcoreUtil.setAnnotation(pack, UamPackage.eNS_URI, "#description", "test application"); //$NON-NLS-1$ //$NON-NLS-2$

    PObject order = UamFactory.eINSTANCE.createPObject();
    order.setId("order_pobject"); //$NON-NLS-1$
    order.setName("order"); //$NON-NLS-1$

    EcoreUtil.setAnnotation(order, UamPackage.eNS_URI, "#class_name", "com.jresearchsoft.uam.client.tests.Order"); //$NON-NLS-1$ //$NON-NLS-2$
    EcoreUtil.setAnnotation(order, UamPackage.eNS_URI, "#mapper_name", "com.jresearchsoft.uam.client.mappers.impl.JavaInstanceMapper"); //$NON-NLS-1$ //$NON-NLS-2$
    EcoreUtil.setAnnotation(order, UamPackage.eNS_URI, "#description", "customer order"); //$NON-NLS-1$ //$NON-NLS-2$
    pack.getEClassifiers().add(order);

    // region is an attribute for pObject and
    EAttribute region = EcoreFactory.eINSTANCE.createEAttribute();
    region.setName("region"); //$NON-NLS-1$
    EcoreUtil.setAnnotation(region, UamPackage.eNS_URI, "#description", "region where the order comes"); //$NON-NLS-1$ //$NON-NLS-2$
    region.setEType(EcorePackage.eINSTANCE.getEString());

    order.getEStructuralFeatures().add(region);
    // user id is an attribute - id of the current user
    EAttribute userID = EcoreFactory.eINSTANCE.createEAttribute();
    EcoreUtil.setAnnotation(userID, UamPackage.eNS_URI, IAttributeConstant.ANNOTATION_KEY_RUNTIME, "true"); //$NON-NLS-1$
    userID.setName("userId"); //$NON-NLS-1$
    userID.setEType(EcorePackage.eINSTANCE.getEString());
    order.getEStructuralFeatures().add(userID);

    // Now we create basic operations and add them to order
    POperation createOp = UamFactory.eINSTANCE.createPOperation();
    createOp.setId("create_operation"); //$NON-NLS-1$
    createOp.setName("create"); //$NON-NLS-1$

    POperation viewOp = UamFactory.eINSTANCE.createPOperation();
    viewOp.setId("view_operation"); //$NON-NLS-1$
    viewOp.setName("view"); //$NON-NLS-1$

    POperation deleteOp = UamFactory.eINSTANCE.createPOperation();
    deleteOp.setId("delete_operation"); //$NON-NLS-1$
    deleteOp.setName("delete"); //$NON-NLS-1$

    POperation updateOp = UamFactory.eINSTANCE.createPOperation();
    updateOp.setId("update_operation"); //$NON-NLS-1$
    updateOp.setName("update"); //$NON-NLS-1$

    order.getEOperations().add(createOp);
    order.getEOperations().add(viewOp);
    order.getEOperations().add(deleteOp);
    order.getEOperations().add(updateOp);

    final String USER_EXPRESSION = "context orders::user_permission inv: login=object.userId"; //$NON-NLS-1$
    final String REGION_EXPRESSION = "context orders::regional_permission inv: region=object.region"; //$NON-NLS-1$

    Permission regionalPermission = UamFactory.eINSTANCE.createPermission();
View Full Code Here

  @SuppressWarnings("unchecked")
  @Override
  public SecurityModel rawConvert() throws LoadModelException {
    SecurityModel result = super.rawConvert();
    for (ProtectedObjectType object : getXmlElement().getProtectedObject()) {
      PObject pObject = new PObjectConverter(object, getConverted()).convert();
      result.getEClassifiers().add(pObject);
      for (Permission permission : (EList<Permission>)pObject.getPermission()) {
        result.getEClassifiers().add(permission);
      }
    }
    for (RoleTemplateType role : getXmlElement().getRoleTemplate()) {
      result.getEClassifiers().add(new RoleTemplateConverter(role, getConverted()).convert());
View Full Code Here

TOP

Related Classes of org.jresearch.flexess.core.model.uam.PObject

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.