Package org.eclipse.emf.ecore

Examples of org.eclipse.emf.ecore.EAttribute


   * @param eClass
   *            EClass instance
   */
  static public void addEAttributeToEClass(String name, EClassifier eType,
      EClass eClass) {
    EAttribute eAttribute = theCoreFactory.createEAttribute();
    eAttribute.setName(name);
    eAttribute.setEType(eType);
    eClass.getEStructuralFeatures().add(eAttribute);
  }
View Full Code Here


   * @param eClass
   *            EClass instance
   */
  static public void addOprionalEAttributeToEClass(String name,
      EClassifier eType, EClass eClass) {
    EAttribute eAttribute = theCoreFactory.createEAttribute();
    eAttribute.setName(name);
    eAttribute.setEType(eType);
    eAttribute.setLowerBound(0);
    eAttribute.setUpperBound(1);
    eClass.getEStructuralFeatures().add(eAttribute);
  }
View Full Code Here

      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) {
          final EDataType type = attr.getEAttributeType();
          if (attr.isMany()) {
            final ArrayList<Object> list = new ArrayList<>();
            final String[] values = spliter.split((CharSequence) value);
            for (final String string : values) {
              list.add(EcoreUtil.createFromString(type, string.trim()));
            }
View Full Code Here

    model.setName("com_security");

    // 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");
    EAttribute pObjectRegionAttr = getRegionAttr();
    pObject.getEStructuralFeatures().add(pObjectRegionAttr);
    pObject.getPermission().add(permission);
    // permission.setPObject(pObject);
    // EMFUtil.addPobject(permission, pObject);
    model.getEClassifiers().add(pObject);
View Full Code Here

    return evaluator.evaluate(pObjectInstance, roleInstance, operation);
  }

  private EAttribute getRegionAttr() {
    EAttribute region = EcoreFactory.eINSTANCE.createEAttribute();
    region.setName("region"); //$NON-NLS-1$
    region.setEType(EcorePackage.eINSTANCE.getEString());
    return region;
  }
View Full Code Here

      DBObject dbObject = builder.buildDBObject(eObject);
      dbObject.put(Keywords.TIME_STAMP_KEY, timeStamp);

      if (useIdAttributeAsPrimaryKey != null && useIdAttributeAsPrimaryKey)
      {
        EAttribute idAttribute = eObject.eClass().getEIDAttribute();

        if (idAttribute != null)
          dbObject.put(Keywords.ID_KEY, eObject.eGet(idAttribute));
      }
View Full Code Here

    {
      // The id was not specified in the URI, so we can let MongoDB generate the id or use the value
      // of the ID attribute

      Boolean useIdAttributeAsPrimaryKey = (Boolean) options.get(Options.OPTION_USE_ID_ATTRIBUTE_AS_PRIMARY_KEY);
      EAttribute idAttribute = eObject.eClass().getEIDAttribute();

      boolean idSpecifiedByClient = useIdAttributeAsPrimaryKey != null && useIdAttributeAsPrimaryKey && idAttribute != null;

      if (idSpecifiedByClient)
      {
View Full Code Here

            //  selected IDs within this boundary and one
            //  outside the boundary which should be an
            //  EFeatureCompatibleData instance.
            // ---------------------------------------------------
            //
            EAttribute eAttribute = EFeaturePackage.eINSTANCE.getEFeature_ID();
            EObjectCondition eCondition = newIsEqual(eAttribute, "F1");
            eCondition = eCondition.OR(newIsEqual(eAttribute, "F22"));
            eCondition = eCondition.OR(newIsEqual(eAttribute, "F73"));
            eCondition = eCondition.OR(newIsEqual(eAttribute, "F100"));
            eCondition = eCondition.OR(newIsEqual(eAttribute, "F101", eFeatureCompatibleDataInfo));
View Full Code Here

            //  instances are added to the resource. The test
            //  uses this information to check the matched
            //  geometries.
            // ---------------------------------------------------
            //
            EAttribute eAttribute = EFeatureTestsPackage.eINSTANCE.getEFeatureData_Geometry();
            EObjectCondition eCondition = newIsEqual(eAttribute, GEOMETRIES[0]);
            for(int i=1;i<GEOMETRIES.length;i++) {
                eCondition = eCondition.OR(newIsEqual(eAttribute, GEOMETRIES[i]));
            }
            WHERE where = new WHERE(eCondition);
View Full Code Here

            // Prepare common objects
            //
            Map<String,Serializable> params = eParams.createParams(eResourceURI.toString(), null);
            EFeatureDataStore eStore = eStoreFactory.createDataStore(params);

            EAttribute eAttribute = EFeaturePackage.eINSTANCE.getEFeature_ID();
            EObjectCondition eCondition = newIsEqual(eAttribute, "F1");
            WHERE where = new WHERE(eCondition);
            eAttribute = EFeatureTestsPackage.eINSTANCE.getEFeatureData_Attribute();
           
            TreeIterator<EObject> eObjects = eResource.getAllContents();               
View Full Code Here

TOP

Related Classes of org.eclipse.emf.ecore.EAttribute

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.