Java 类org.eclipse.emf.ecore.impl.EStructuralFeatureImpl 实例源码

项目:cda2fhir    文件:DataTypesTransformerImpl.java   
/**
 * Extracts the attributes of an HTML element
 * This method is the helper for the method getTags, which is already a helper for tStrucDocText2String.
 * @param entry A EStructuralFeatureImpl.ContainmentUpdatingFeatureMapEntry instance
 * @return A Java String list containing the attributes of an HTML element in form: attributeName="attributeValue". Each element corresponds to distinct attributes for the same tag
 */
private List<String> getAttributesHelperForTStructDocText2String(EStructuralFeatureImpl.ContainmentUpdatingFeatureMapEntry entry) {
    if(entry == null)
        return null;

    List<String> attributeList = new ArrayList<String>();
    if(entry.getValue() instanceof org.eclipse.emf.ecore.xml.type.impl.AnyTypeImpl) {
        for(FeatureMap.Entry attribute : ((org.eclipse.emf.ecore.xml.type.impl.AnyTypeImpl) entry.getValue()).getAnyAttribute()) {
            String name = attribute.getEStructuralFeature().getName();
            String value = attribute.getValue().toString();
            if(name != null && !name.isEmpty()) {
                String attributeToAdd = "";
                // we may have attributes which doesn't have any value
                attributeToAdd = attributeToAdd + name;
                if(value != null && !value.isEmpty()) {
                    attributeToAdd = attributeToAdd + "=\""+value+"\"";
                }
                attributeList.add(attributeToAdd);
            }
        }
    }
    return attributeList;
}
项目:caml2tosca    文件:ToscaUtil.java   
public static FeatureMap.Entry createContainmentFeatureMapEntry(String nsPrefix, String nsURI, String name, Element base, Stereotype refinement) {
    AnyType anyType = XMLTypeFactory.eINSTANCE.createAnyType();

    // create for each property of the refinement an EReference and the SimpleFeatureMapEntry
    for(Property property : refinement.getAllAttributes()) {
        if(!property.getName().startsWith("base_")) {
            AnyType anyTypeForProperty = XMLTypeFactory.eINSTANCE.createAnyType();
            SimpleFeatureMapEntry simpleFeatureMapEntry = new SimpleFeatureMapEntry((EStructuralFeature.Internal) Text_Attribute, getStringRepresentation(base.getValue(refinement, property.getName())));
            anyTypeForProperty.getMixed().add(simpleFeatureMapEntry);

            EStructuralFeatureImpl.ContainmentUpdatingFeatureMapEntry containmentFeatureMapEntry = 
                    new EStructuralFeatureImpl.ContainmentUpdatingFeatureMapEntry((EStructuralFeature.Internal) createTEReference(nsPrefix, nsURI, property.getName()), (InternalEObject) anyTypeForProperty);

            anyType.getMixed().add(containmentFeatureMapEntry);
        }
    }

    return new EStructuralFeatureImpl.ContainmentUpdatingFeatureMapEntry((EStructuralFeature.Internal) createTEReference(nsPrefix, nsURI, name), 
            (InternalEObject) anyType);         
}
项目:caml2tosca    文件:ToscaUtil.java   
public static FeatureMap.Entry createFeatureMapEntryForSlots(String nsPrefix, String nsURI, String name, Collection<Slot> slots) {
    AnyType anyType = XMLTypeFactory.eINSTANCE.createAnyType();

    // create for each property of the refinement an EReference and the SimpleFeatureMapEntry
    for(Slot slot : slots) {
        AnyType anyTypeForProperty = XMLTypeFactory.eINSTANCE.createAnyType();
        // TODO: What about list of values! -> currently we take the first value only
        SimpleFeatureMapEntry simpleFeatureMapEntry = new SimpleFeatureMapEntry((EStructuralFeature.Internal) Text_Attribute, getStringRepresentation(slot.getValues().get(0)));
        anyTypeForProperty.getMixed().add(simpleFeatureMapEntry);

        EStructuralFeatureImpl.ContainmentUpdatingFeatureMapEntry containmentFeatureMapEntry = 
                new EStructuralFeatureImpl.ContainmentUpdatingFeatureMapEntry((EStructuralFeature.Internal) createTEReference(nsPrefix, nsURI, slot.getDefiningFeature().getName()), (InternalEObject) anyTypeForProperty);

        anyType.getMixed().add(containmentFeatureMapEntry);
    }

    return new EStructuralFeatureImpl.ContainmentUpdatingFeatureMapEntry((EStructuralFeature.Internal) createTEReference(nsPrefix, nsURI, name), 
            (InternalEObject) anyType);         
}
项目:kie-wb-common    文件:Utils.java   
public static void setMetaDataExtensionValue(BaseElement element,
                                             String metaDataName,
                                             String metaDataValue) {
    if (element != null) {
        MetaDataType eleMetadata = DroolsFactory.eINSTANCE.createMetaDataType();
        eleMetadata.setName(metaDataName);
        eleMetadata.setMetaValue(metaDataValue);
        if (element.getExtensionValues() == null || element.getExtensionValues().isEmpty()) {
            ExtensionAttributeValue extensionElement = Bpmn2Factory.eINSTANCE.createExtensionAttributeValue();
            element.getExtensionValues().add(extensionElement);
        }
        FeatureMap.Entry eleExtensionElementEntry = new EStructuralFeatureImpl.SimpleFeatureMapEntry(
                (EStructuralFeature.Internal) DroolsPackage.Literals.DOCUMENT_ROOT__META_DATA,
                eleMetadata);
        element.getExtensionValues().get(0).getValue().add(eleExtensionElementEntry);
    }
}
项目:kie-wb-common    文件:BPMNDiagramMarshallerTest.java   
private String getProcessExtensionValue(Process process,
                                        String propertyName) {
    List<ExtensionAttributeValue> extensionValues = process.getExtensionValues();
    for (ExtensionAttributeValue extensionValue : extensionValues) {
        FeatureMap featureMap = extensionValue.getValue();
        for (int i = 0; i < featureMap.size(); i++) {
            EStructuralFeatureImpl.SimpleFeatureMapEntry featureMapEntry = (EStructuralFeatureImpl.SimpleFeatureMapEntry) featureMap.get(i);
            MetaDataType featureMapValue = (MetaDataType) featureMapEntry.getValue();
            if (propertyName.equals(featureMapValue.getName())) {
                return featureMapValue.getMetaValue();
            }
        }
    }
    return "";
}
项目:emf-fragments    文件:FInternalObjectImpl.java   
@Override
protected EStructuralFeature.Internal.SettingDelegate eSettingDelegate(final EStructuralFeature eFeature) {
    FragmentationType type = EMFFragUtil.getFragmentationType(eFeature);
    if (type == FragmentationType.None || type == FragmentationType.FragmentsContainment) {
        return ((EStructuralFeature.Internal) eFeature).getSettingDelegate();
    } else {
        return new EStructuralFeatureImpl.InternalSettingDelegateMany(EStructuralFeatureImpl.InternalSettingDelegateMany.DATA_DYNAMIC, eFeature) {
            @Override
            protected Setting createDynamicSetting(InternalEObject owner) {
                int kind = EcoreEList.Generic.kind(eFeature);
                return new FValueSetList(kind, FInternalObjectImpl.class, FInternalObjectImpl.this, eFeature);
            }
        };
    }
}
项目:cda2fhir    文件:DataTypesTransformerImpl.java   
/**
 * Transforms A CDA StructDocText instance to a Java String containing the transformed text.
 * Since the method is a recursive one and handles with different types of object, parameter is taken as Object. However, parameters of type StructDocText should be given by the caller.
 * @param param A CDA StructDocText instance
 * @return A Java String containing the transformed text
 */
private String tStrucDocText2String(Object param) {
    if(param instanceof org.openhealthtools.mdht.uml.cda.StrucDocText) {
        org.openhealthtools.mdht.uml.cda.StrucDocText paramStrucDocText = (org.openhealthtools.mdht.uml.cda.StrucDocText)param;
        return "<div>" +tStrucDocText2String(paramStrucDocText.getMixed()) + "</div>";
    } 
    else if(param instanceof BasicFeatureMap) {
        String returnValue = "";
        for(Object object : (BasicFeatureMap)param){
            String pieceOfReturn = tStrucDocText2String(object);
            if(pieceOfReturn != null && !pieceOfReturn.isEmpty()) {
                returnValue = returnValue + pieceOfReturn;
            }
        }
        return returnValue;
    } 
    else if(param instanceof EStructuralFeatureImpl.SimpleFeatureMapEntry) {
        String elementBody = ((EStructuralFeatureImpl.SimpleFeatureMapEntry)param).getValue().toString();
        // deletion of unnecessary content (\n, \t)
        elementBody = elementBody.replaceAll("\n", "").replaceAll("\t", "");

        // replacement of special characters
        elementBody = elementBody.replaceAll("<","&lt;").replaceAll(">", "&gt;").replaceAll("&", "&amp;");
        // if there was a well-formed char sequence "&amp;", after replacement it will transform to &amp;amp;
        // the following line of code will remove these type of typos
        elementBody = elementBody.replaceAll("&amp;amp;", "&amp;");

        String typeName = ((EStructuralFeatureImpl.SimpleFeatureMapEntry) param).getEStructuralFeature().getName();
        typeName = typeName.toLowerCase();
        if(typeName.equals("comment")) {
            return "<!-- "+elementBody +" -->";
        } else if(typeName.equals("text")){
            return elementBody;
        } else {
            logger.warn("Unknown element type was found while transforming a StrucDocText instance to Narrative. Returning the value of the element");
            return elementBody;
        }
    } 
    else if(param instanceof EStructuralFeatureImpl.ContainmentUpdatingFeatureMapEntry) {
        EStructuralFeatureImpl.ContainmentUpdatingFeatureMapEntry entry = (EStructuralFeatureImpl.ContainmentUpdatingFeatureMapEntry)param;
        List<String> tagList = getTagsHelperForTStructDocText2String(entry);
        return tagList.get(0) + tStrucDocText2String(entry.getValue()) + tagList.get(1);
    } 
    else if(param instanceof org.eclipse.emf.ecore.xml.type.impl.AnyTypeImpl) {
        // since the name and the attributes are taken already, we just send the mixed of anyTypeImpl
        return tStrucDocText2String(((org.eclipse.emf.ecore.xml.type.impl.AnyTypeImpl)param).getMixed());
    }
    else {
        logger.warn("Parameter for the method tStrucDocText2String is unknown. Returning null", param.getClass());
        return null;
    }
}
项目:clickwatch    文件:FeatureMapUtil.java   
public static boolean isFeatureMap(EStructuralFeature eStructuralFeature)
{
  return ((EStructuralFeatureImpl)eStructuralFeature).isFeatureMap();
}