Package org.eclipse.emf.ecore.util

Examples of org.eclipse.emf.ecore.util.FeatureMap


    {
      documentRoot = (EObject)resource.getContents().get(0);
      EClass documentRootClass = documentRoot.eClass();
      if ("".equals(extendedMetaData.getName(documentRootClass))) //TODO efficient way to check this? Maybe DataObject.getContainer should also check this?
      {
        FeatureMap featureMap = (FeatureMap)documentRoot.eGet(documentRootClass.getEStructuralFeature(0)); // get mixed feature
        int size = featureMap.size();
        for (int index = 0; index < size; index++)
        {
          EStructuralFeature feature = featureMap.getEStructuralFeature(index);
          boolean isText =
            feature == XMLTypePackage.Literals.XML_TYPE_DOCUMENT_ROOT__TEXT ||
            feature == XMLTypePackage.Literals.XML_TYPE_DOCUMENT_ROOT__CDATA ||   
            feature == XMLTypePackage.Literals.XML_TYPE_DOCUMENT_ROOT__COMMENT;
          if (!isText)
          {
            if (feature instanceof EReference)
            {
              rootObject = (EObject)featureMap.getValue(index);
              documentRoot.eUnset(feature);
            }
            else //EAttribute
            {
              rootObject = (EObject)SDOUtil.createDataTypeWrapper((Type)feature.getEType(), featureMap.getValue(index));
            }
            rootElement = feature;
            break;
          }
        } //for
View Full Code Here


    private Scenario getDefaultScenario(Definitions def) {
      if(def.getRelationships() != null && def.getRelationships().size() > 0) {
          // current support for single relationship
          Relationship relationship = def.getRelationships().get(0);
          for(ExtensionAttributeValue extattrval : relationship.getExtensionValues()) {
                FeatureMap extensionElements = extattrval.getValue();
                @SuppressWarnings("unchecked")
                List<BPSimDataType> bpsimExtension = (List<BPSimDataType>) extensionElements.get(BpsimPackage.Literals.DOCUMENT_ROOT__BP_SIM_DATA, true);
                if(bpsimExtension != null && bpsimExtension.size() > 0) {
                    BPSimDataType bpmsim = bpsimExtension.get(0);
                  if(bpmsim.getScenario() != null && bpmsim.getScenario().size() > 0) {
                    return bpmsim.getScenario().get(0);
                  }
View Full Code Here

    {
      documentRoot = (EObject)resource.getContents().get(0);
      EClass documentRootClass = documentRoot.eClass();
      if ("".equals(extendedMetaData.getName(documentRootClass))) //TODO efficient way to check this? Maybe DataObject.getContainer should also check this?
      {
        FeatureMap featureMap = (FeatureMap)documentRoot.eGet(documentRootClass.getEStructuralFeature(0)); // get mixed feature
        int size = featureMap.size();
        for (int index = 0; index < size; index++)
        {
          EStructuralFeature feature = featureMap.getEStructuralFeature(index);
          boolean isText =
            feature == XMLTypePackage.Literals.XML_TYPE_DOCUMENT_ROOT__TEXT ||
            feature == XMLTypePackage.Literals.XML_TYPE_DOCUMENT_ROOT__CDATA ||   
            feature == XMLTypePackage.Literals.XML_TYPE_DOCUMENT_ROOT__COMMENT;
          if (!isText)
          {
            if (feature instanceof EReference)
            {
              rootObject = (EObject)featureMap.getValue(index);
              documentRoot.eUnset(feature);
            }
            else //EAttribute
            {
              rootObject = (EObject)SDOUtil.createDataTypeWrapper((Type)feature.getEType(), featureMap.getValue(index));
            }
            rootElement = feature;
            break;
          }
        } //for
View Full Code Here

    private Scenario getDefaultScenario(Definitions def) {
      if(def.getRelationships() != null && def.getRelationships().size() > 0) {
          // current support for single relationship
          Relationship relationship = def.getRelationships().get(0);
          for(ExtensionAttributeValue extattrval : relationship.getExtensionValues()) {
                FeatureMap extensionElements = extattrval.getValue();
                @SuppressWarnings("unchecked")
                List<BPSimDataType> bpsimExtensions = (List<BPSimDataType>) extensionElements.get(BpsimPackage.Literals.DOCUMENT_ROOT__BP_SIM_DATA, true);
                if(bpsimExtensions != null && bpsimExtensions.size() > 0) {
                    BPSimDataType processAnalysis = bpsimExtensions.get(0);
                  if(processAnalysis.getScenario() != null && processAnalysis.getScenario().size() > 0) {
                    return processAnalysis.getScenario().get(0);
                  }
View Full Code Here

    EClass docEClass = ExtendedMetaData.INSTANCE.getDocumentRoot(testPackage);
    EObject doc = EcoreUtil.create(docEClass);
    resource.getContents().add(doc);
   
    EStructuralFeature docMixedFeature = ExtendedMetaData.INSTANCE.getMixedFeature(docEClass);
    FeatureMap docMixed = (FeatureMap) doc.eGet(docMixedFeature);
    AnyType test = (AnyType) EcoreUtil.create(XMLTypePackage.Literals.ANY_TYPE);
    docMixed.add(ExtendedMetaData.INSTANCE.demandFeature("urn:test", "test", true), test);
    SimpleAnyType subTest1 = (SimpleAnyType) EcoreUtil.create(XMLTypePackage.Literals.SIMPLE_ANY_TYPE);
    test.getMixed().add(ExtendedMetaData.INSTANCE.demandFeature("urn:test", "subTest", true), subTest1);
    subTest1.setInstanceType(XMLTypePackage.Literals.STRING);
    subTest1.setValue("subTest1");
    SimpleAnyType subTest2 = (SimpleAnyType) EcoreUtil.create(XMLTypePackage.Literals.SIMPLE_ANY_TYPE);
View Full Code Here

      FeatureChange featureChange = (FeatureChange)fIter.next();
      featureChange.apply(oldDataObject);
      EStructuralFeature feature = featureChange.getFeature();
      if (FeatureMapUtil.isFeatureMap(feature))
      {
        FeatureMap featureMap = (FeatureMap) oldDataObject.eGet(feature);
        for (int index = featureMap.size(); index != 0;)
          if (isContainmentReference(featureMap.getEStructuralFeature(--index)))
            featureMap.setValue(index, getOldDataObject((DataObject) featureMap.getValue(index)));
      }
      else if (isContainmentReference(feature))
      {
        Object value = oldDataObject.eGet(feature);
        if (feature.isMany())
View Full Code Here

                copyReference(eReference, eObject, copyEObject);
              }
            }
            else if (FeatureMapUtil.isFeatureMap(eStructuralFeature))
            {
              FeatureMap featureMap = (FeatureMap)eObject.eGet(eStructuralFeature);
              FeatureMap copyFeatureMap = (FeatureMap)copyEObject.eGet(getTarget(eStructuralFeature));
              int copyFeatureMapSize = copyFeatureMap.size();
              for (int k = 0, featureMapSize = featureMap.size(); k < featureMapSize; ++k)
              {
                EStructuralFeature feature = featureMap.getEStructuralFeature(k);
                if (feature instanceof EReference)
                {
                  Object referencedEObject = featureMap.getValue(k);
                  Object copyReferencedEObject = get(referencedEObject);
                  if (copyReferencedEObject == null && referencedEObject != null)
                  {
                    EReference reference = (EReference)feature;
                    if (!useOriginalReferences || reference.isContainment() || reference.getEOpposite() != null)
                    {
                      continue;
                    }
                    copyReferencedEObject = referencedEObject;
                  }
                  // If we can't add it, it must aleady be in the list so find it and move it to the end.
                  //
                  if (!copyFeatureMap.add(feature, copyReferencedEObject))
                  {
                    for (int l = 0; l < copyFeatureMapSize; ++l)
                    {
                      if (copyFeatureMap.getEStructuralFeature(l) == feature && copyFeatureMap.getValue(l) == copyReferencedEObject)
                      {
                        copyFeatureMap.move(copyFeatureMap.size() - 1, l);
                        --copyFeatureMapSize;
                        break;
                      }
                    }
                  }
                }
                else
                {
                  copyFeatureMap.add(featureMap.get(k));
                }
              }
            }
          }
        }
View Full Code Here

    {
      documentRoot = (EObject)resource.getContents().get(0);
      EClass documentRootClass = documentRoot.eClass();
      if ("".equals(extendedMetaData.getName(documentRootClass))) //TODO efficient way to check this? Maybe DataObject.getContainer should also check this?
      {
        FeatureMap featureMap = (FeatureMap)documentRoot.eGet(documentRootClass.getEStructuralFeature(0)); // get mixed feature
        int size = featureMap.size();
        for (int index = 0; index < size; index++)
        {
          EStructuralFeature feature = featureMap.getEStructuralFeature(index);
          boolean isText =
            feature == XMLTypePackage.Literals.XML_TYPE_DOCUMENT_ROOT__TEXT ||
            feature == XMLTypePackage.Literals.XML_TYPE_DOCUMENT_ROOT__CDATA ||   
            feature == XMLTypePackage.Literals.XML_TYPE_DOCUMENT_ROOT__COMMENT;
          if (!isText)
          {
            if (feature instanceof EReference)
            {
              rootObject = (EObject)featureMap.getValue(index);
              documentRoot.eUnset(feature);
            }
            else //EAttribute
            {
              rootObject = (EObject)SDOUtil.createDataTypeWrapper((Type)feature.getEType(), featureMap.getValue(index));
            }
            rootElement = feature;
            break;
          }
        } //for
View Full Code Here

        JsonGenerator generator = f.createJsonGenerator(baos, JsonEncoding.UTF8);
        if(def.getRelationships() != null && def.getRelationships().size() > 0) {
          // current support for single relationship
          Relationship relationship = def.getRelationships().get(0);
            for(ExtensionAttributeValue extattrval : relationship.getExtensionValues()) {
                FeatureMap extensionElements = extattrval.getValue();
                @SuppressWarnings("unchecked")
                List<BPSimDataType> bpsimExtensions = (List<BPSimDataType>) extensionElements.get(BpsimPackage.Literals.DOCUMENT_ROOT__BP_SIM_DATA, true);
                if(bpsimExtensions != null && bpsimExtensions.size() > 0) {
                    BPSimDataType processAnalysis = bpsimExtensions.get(0);
                  if(processAnalysis.getScenario() != null && processAnalysis.getScenario().size() > 0) {
                    _simulationScenario = processAnalysis.getScenario().get(0);
                  }
View Full Code Here

                  if((rootElement).getExtensionValues() != null && (rootElement).getExtensionValues().size() > 0) {
                      String importsStr = "";
                      String globalsStr = "";

                      for(ExtensionAttributeValue extattrval : rootElement.getExtensionValues()) {
                          FeatureMap extensionElements = extattrval.getValue();
                         
                          @SuppressWarnings("unchecked")
                          List<ImportType> importExtensions = (List<ImportType>) extensionElements
                                                               .get(DroolsPackage.Literals.DOCUMENT_ROOT__IMPORT, true);
                          @SuppressWarnings("unchecked")
                          List<GlobalType> globalExtensions = (List<GlobalType>) extensionElements
                                                            .get(DroolsPackage.Literals.DOCUMENT_ROOT__GLOBAL, true);

                            List<MetaDataType> metadataExtensions = (List<MetaDataType>) extensionElements
                                    .get(DroolsPackage.Literals.DOCUMENT_ROOT__META_DATA, true);
                     
                          for(ImportType importType : importExtensions) {
                              importsStr += importType.getName();
                              importsStr += "|default,";
View Full Code Here

TOP

Related Classes of org.eclipse.emf.ecore.util.FeatureMap

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.