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

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


    // Create permission with region attribute
    Permission permission = uamFactory.createPermission();
    permission.setName("TestPermission");
    EAttribute permRegionAttr = getRegionAttr();
    permission.getEStructuralFeatures().add(permRegionAttr);
    Constraint constraint = uamFactory.createConstraint();
    permission.setConstraint(constraint);
    constraint.setExpession(expression);
    model.getEClassifiers().add(permission);

    // Create protected object with region attribute
    PObject pObject = uamFactory.createPObject();
    pObject.setName("TestProtectedObject");
View Full Code Here


  protected void tearDown() throws Exception {
    setFixture(null);
  }

  public void testCheck() {
    Constraint tested = getFixture();
    String iId = "testId";
    String iExpression = "testExpression";
    Permission iPermission = UamFactory.eINSTANCE.createPermission();
   
    tested.setId(iId);
    tested.setExpession(iExpression);
    tested.setPermission(iPermission);
   
    assertEquals(iId, tested.getId());
    assertEquals(iExpression, tested.getExpession());
    assertEquals(iPermission, tested.getPermission());
  }
View Full Code Here

   
    String iId = "testId";   
    tested.setId(iId);
    assertEquals(iId, tested.getId());
   
    Constraint iConstraint = UamFactory.eINSTANCE.createConstraint()
    PObject iPObject = UamFactory.eINSTANCE.createPObject();
   
    tested.setConstraint( iConstraint );
    tested.setPObject( iPObject );
   
View Full Code Here

  protected IPermissionMetaInfo loadPermission(String modelId, Permission permission) {
    PermissionMetaInfo pm = new PermissionMetaInfo();
    pm.setModelId(modelId);
    String description = EcoreUtil.getAnnotation(permission, UamPackage.eNS_URI, IPObjectConstant.DESCRIPTION_ATTR);
    pm.setDescription(description);
    Constraint constraint = permission.getConstraint();
    if (constraint != null) {
      pm.setConstraint(constraint.getExpession());
    }
    pm.setId(permission.getId());
    pm.setName(permission.getName());
    for (Iterator<EAttribute> it = permission.getEAttributes().iterator(); it.hasNext();) {
      EAttribute attr = it.next();
View Full Code Here

  /**
   * <!-- begin-user-doc --> <!-- end-user-doc -->
   * @generated
   */
  public NotificationChain basicSetConstraint(Constraint newConstraint, NotificationChain msgs) {
    Constraint oldConstraint = constraint;
    constraint = newConstraint;
    if (eNotificationRequired()) {
      ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, UamPackage.PERMISSION__CONSTRAINT, oldConstraint, newConstraint);
      if (msgs == null) msgs = notification; else msgs.add(notification);
    }
View Full Code Here

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

    Permission regionalPermission = UamFactory.eINSTANCE.createPermission();
    regionalPermission.setId("regional_permission"); //$NON-NLS-1$
    regionalPermission.setName("regional_permission"); //$NON-NLS-1$
    Constraint constraint = UamFactory.eINSTANCE.createConstraint();
    regionalPermission.setConstraint(constraint);
    constraint.setExpession(REGION_EXPRESSION);
    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());
    regionalPermission.getEStructuralFeatures().add(region);
    regionalPermission.setPObject(order);
    // EMFUtil.addPobject(regionalPermission, order);
    pack.getEClassifiers().add(regionalPermission);

    // viewOp.getPermission().add(regionalPermission);
    // createOp.getPermission().add(regionalPermission);
    // deleteOp.getPermission().add(regionalPermission);
    // updateOp.getPermission().add(regionalPermission);

    Permission userPermission = UamFactory.eINSTANCE.createPermission();
    userPermission.setId("user_permission"); //$NON-NLS-1$
    userPermission.setName("user_permission"); //$NON-NLS-1$
    Constraint userConstraint = UamFactory.eINSTANCE.createConstraint();
    userPermission.setConstraint(userConstraint);
    userConstraint.setExpession(USER_EXPRESSION);
    userID = EcoreFactory.eINSTANCE.createEAttribute();
    EcoreUtil.setAnnotation(userID, UamPackage.eNS_URI, IAttributeConstant.ANNOTATION_KEY_RUNTIME, "true"); //$NON-NLS-1$
    userID.setName("login"); //$NON-NLS-1$
    userID.setEType(EcorePackage.eINSTANCE.getEString());
    userPermission.getEStructuralFeatures().add(userID);
View Full Code Here

  public Permission rawConvert() throws LoadModelException {
    Permission result = super.rawConvert();
    for (PermissionAttributeType attribute : getXmlElement().getPermissionAttribute()) {
      result.getEStructuralFeatures().add(new PermissionAttributeConverter(attribute).convert());
    }
    Constraint constraint = UamFactory.eINSTANCE.createConstraint();
    String expression = getXmlElement().getConstraint();
    constraint.setExpession(expression == null ? "true" : expression);
    result.setConstraint(constraint);
    return result;
  }
View Full Code Here

TOP

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

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.