org.eclipse.emf.ecore.util.FeatureMapUtil Java Examples
The following examples show how to use
org.eclipse.emf.ecore.util.FeatureMapUtil.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: AbstractHiveFactory.java From neoscada with Eclipse Public License 1.0 | 6 votes |
protected Object getConfigurationData ( final HiveConfigurationType configuration ) { for ( FeatureMap.Entry entry : configuration.getAny () ) { if ( entry.getValue () instanceof EObject ) { return entry.getValue (); } else if ( FeatureMapUtil.isText ( entry ) ) { return entry.getValue (); } else if ( FeatureMapUtil.isCDATA ( entry ) ) { return entry.getValue (); } } return null; }
Example #2
Source File: AbstractPojosItemProvider.java From hybris-commerce-eclipse-plugin with Apache License 2.0 | 6 votes |
/** * This adds {@link org.eclipse.emf.edit.command.CommandParameter}s describing the children * that can be created under this object. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override protected void collectNewChildDescriptors(Collection<Object> newChildDescriptors, Object object) { super.collectNewChildDescriptors(newChildDescriptors, object); newChildDescriptors.add (createChildParameter (BeansPackage.Literals.ABSTRACT_POJOS__GROUP, FeatureMapUtil.createEntry (BeansPackage.Literals.ABSTRACT_POJOS__BEAN, BeansFactory.eINSTANCE.createBean()))); newChildDescriptors.add (createChildParameter (BeansPackage.Literals.ABSTRACT_POJOS__GROUP, FeatureMapUtil.createEntry (BeansPackage.Literals.ABSTRACT_POJOS__ENUM, BeansFactory.eINSTANCE.createEnum()))); }
Example #3
Source File: VariableFormalExpressionTransformer.java From bonita-studio with GNU General Public License v2.0 | 6 votes |
@Override protected TFormalExpression addContent(final Expression bonitaExpression, final TFormalExpression formalExpression) { requireNonNull(bonitaExpression); requireNonNull(formalExpression); if (!ExpressionConstants.VARIABLE_TYPE.equals(bonitaExpression.getType())) { throw new IllegalArgumentException( String.format("Expression type is invalid. Expected %s but was %s", ExpressionConstants.VARIABLE_TYPE, bonitaExpression.getType())); } final EList<EObject> referencedElements = bonitaExpression.getReferencedElements(); if (referencedElements.isEmpty()) { throw new IllegalArgumentException( String.format("Missing referenced elements for variable expression %s", bonitaExpression.getName())); } final Data bonitaData = requireNonNull((Data) referencedElements.get(0)); final TItemDefinition bpmnData = dataScope.get(resolveData(bonitaData.getName(), bonitaExpression)); FeatureMapUtil.addText(formalExpression.getMixed(), createContentFor(bpmnData, bonitaData, bonitaExpression.getContent())); return formalExpression; }
Example #4
Source File: BonitaToBPMNExporter.java From bonita-studio with GNU General Public License v2.0 | 6 votes |
private TTimerEventDefinition createTimerEventDef(final AbstractTimerEvent bonitaEvent) { final TTimerEventDefinition eventDef = ModelFactory.eINSTANCE.createTTimerEventDefinition(); final Expression conditionExpression = bonitaEvent.getCondition(); if (conditionExpression != null) { final String condition = conditionExpression.getContent();//FIXME if (condition != null) { final TExpression expression = ModelFactory.eINSTANCE.createTExpression(); FeatureMapUtil.addText(expression.getMixed(), condition); if (DateUtil.isDuration(condition)) { eventDef.setTimeDuration(expression); } else if (DateUtil.isDate(condition)) { eventDef.setTimeDate(expression); } else { eventDef.setTimeCycle(expression); } } } eventDef.setId("eventdef-" + bonitaEvent.getName()); return eventDef; }
Example #5
Source File: DerivedEObjectEList.java From statecharts with Eclipse Public License 1.0 | 6 votes |
protected boolean scanNext(EStructuralFeature nextFeature, ListIterator<Object> nextValuesIterator) { boolean isFeatureMap = FeatureMapUtil.isFeatureMap(nextFeature); while (nextValuesIterator.hasNext()) { Object nextValue = nextValuesIterator.next(); if (isFeatureMap) { FeatureMap.Entry entry = (FeatureMap.Entry) nextValue; nextFeature = entry.getEStructuralFeature(); nextValue = entry.getValue(); } if ((isIncluded(nextFeature) ? nextValue != null : isIncluded(nextValue)) && ((index < preparedValues.size() && nextValue == preparedValues .get(index)) || preparedValues.add(nextValue))) { valuesIterator = nextValuesIterator; preparedFeature = nextFeature; return true; } } return false; }
Example #6
Source File: BonitaToBPMNExporter.java From bonita-studio with GNU General Public License v2.0 | 6 votes |
private void setCommonAttributes(final Element bonitaElement, final TBaseElement bpmnElement) { bpmnElement.setId(modelSearch.getEObjectID(bonitaElement)); if (bpmnElement instanceof TFlowElement) { ((TFlowElement) bpmnElement).setName(bonitaElement.getName()); } else if (bpmnElement instanceof TProcess) { ((TProcess) bpmnElement).setName(bonitaElement.getName()); } else if (bpmnElement instanceof TParticipant) { ((TParticipant) bpmnElement).setName(bonitaElement.getName()); } final String documentation = bonitaElement.getDocumentation(); if (documentation != null && !documentation.isEmpty()) { final TDocumentation doc = ModelFactory.eINSTANCE.createTDocumentation(); FeatureMapUtil.addText(doc.getMixed(), documentation); bpmnElement.getDocumentation().add(doc); } }
Example #7
Source File: DerivedEObjectEList.java From statecharts with Eclipse Public License 1.0 | 6 votes |
protected boolean scanPrevious(EStructuralFeature previousFeature, ListIterator<Object> previousValuesIterator) { boolean isFeatureMap = FeatureMapUtil.isFeatureMap(previousFeature); while (previousValuesIterator.hasPrevious()) { Object previousValue = previousValuesIterator.previous(); if (isFeatureMap) { FeatureMap.Entry entry = (FeatureMap.Entry) previousValue; previousFeature = entry.getEStructuralFeature(); previousValue = entry.getValue(); } if (index > 0 && previousValue == preparedValues.get(index - 1)) { valuesIterator = previousValuesIterator; preparedFeature = previousFeature; return true; } } return false; }
Example #8
Source File: BonitaToBPMNExporter.java From bonita-studio with GNU General Public License v2.0 | 6 votes |
private TDataInputAssociation createDataInputAssociation(final TDataInput tDataInput, final Expression defaultValue) { final TDataInputAssociation tDataInputAssociation = ModelFactory.eINSTANCE.createTDataInputAssociation(); tDataInputAssociation.setId(EcoreUtil.generateUUID()); tDataInputAssociation.setTargetRef(tDataInput.getId()); final EList<TAssignment> assignment = tDataInputAssociation.getAssignment(); final TAssignment tAssignment = ModelFactory.eINSTANCE.createTAssignment(); final TFormalExpression toExpression = ModelFactory.eINSTANCE.createTFormalExpression(); toExpression.setId(EcoreUtil.generateUUID()); FeatureMapUtil.addText(toExpression.getMixed(), /* "getDataInput('"+ */tDataInput.getId()/* +"')" */); tAssignment.setTo(toExpression); final TFormalExpression fromExpression = convertExpression(defaultValue); tAssignment.setFrom(fromExpression); assignment.add(tAssignment); return tDataInputAssociation; }
Example #9
Source File: CustomExtractorTypeItemProvider.java From neoscada with Eclipse Public License 1.0 | 5 votes |
/** * This adds {@link org.eclipse.emf.edit.command.CommandParameter}s describing the children * that can be created under this object. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override protected void collectNewChildDescriptors ( Collection<Object> newChildDescriptors, Object object ) { super.collectNewChildDescriptors ( newChildDescriptors, object ); newChildDescriptors.add ( createChildParameter ( ConfigurationPackage.Literals.CUSTOM_EXTRACTOR_TYPE__ANY, FeatureMapUtil.createEntry ( ConfigurationPackage.Literals.DOCUMENT_ROOT__ROOT, ConfigurationFactory.eINSTANCE.createRootType () ) ) ); }
Example #10
Source File: BPMNToProc.java From bonita-studio with GNU General Public License v2.0 | 5 votes |
protected String retrieveDocumentation(final TBaseElement baseElement) { final StringBuilder sb = new StringBuilder(); for (final TDocumentation doc : baseElement.getDocumentation()) { final Iterator<org.eclipse.emf.ecore.util.FeatureMap.Entry> iterator = doc .getMixed().iterator(); while (iterator.hasNext()) { final FeatureMap.Entry entry = iterator.next(); if (FeatureMapUtil.isText(entry)) { sb.append(entry.getValue()).append("\n"); } } } final String documentation = sb.toString(); return documentation; }
Example #11
Source File: ItemDefinitionFunction.java From bonita-studio with GNU General Public License v2.0 | 5 votes |
@Override public TItemDefinition apply(final Data sourceElement) { final ModelFactory modelFactory = ModelFactory.eINSTANCE; final TItemDefinition dataItemDefinition = modelFactory.createTItemDefinition(); dataItemDefinition.setId(modelSearch.getEObjectID(sourceElement)); final String documentation = sourceElement.getDocumentation(); if (documentation != null && !documentation.isEmpty()) { final TDocumentation doc = modelFactory.createTDocumentation(); FeatureMapUtil.addText(doc.getMixed(), documentation); dataItemDefinition.getDocumentation().add(doc); } dataItemDefinition.setStructureRef(getStructureRef(sourceElement)); bpmnDefinitions.getRootElement().add(dataItemDefinition); return dataItemDefinition; }
Example #12
Source File: DerivedSubsetEObjectEList.java From statecharts with Eclipse Public License 1.0 | 5 votes |
public DerivedSubsetEObjectEList(Class<?> dataClass, InternalEObject owner, int featureID, int[] sourceFeatureIDs) { super(dataClass, owner, featureID, sourceFeatureIDs); EStructuralFeature feature = sourceFeatureIDs.length == 1 ? getEStructuralFeature(sourceFeatureIDs[0]) : null; if (feature == null || !feature.isMany() || FeatureMapUtil.isFeatureMap(feature)) { throw new IllegalArgumentException(String.valueOf(sourceFeatureIDs)); } }
Example #13
Source File: StatechartEqualityHelper.java From statecharts with Eclipse Public License 1.0 | 5 votes |
@Override protected boolean haveEqualAttribute(EObject eObject1, EObject eObject2, EAttribute attribute) { Object value1 = eObject1.eGet(attribute); Object value2 = eObject2.eGet(attribute); // If the first value is null, the second value must be null. // if (value1 == null) { return value2 == null; } // Since the first value isn't null, if the second one is, they aren't equal. // if (value2 == null) { return false; } // If this is a feature map... // if (FeatureMapUtil.isFeatureMap(attribute)) { // The feature maps must be equal. // FeatureMap featureMap1 = (FeatureMap)value1; FeatureMap featureMap2 = (FeatureMap)value2; return equalFeatureMaps(featureMap1, featureMap2); } else { if (value1 instanceof String && value2 instanceof String) { String wsFreeValue1 = removeWhitespaces((String)value1); String wsFreeValue2 = removeWhitespaces((String)value2); return wsFreeValue1.equals(wsFreeValue2); } return value1.equals(value2); } }
Example #14
Source File: RootTypeItemProvider.java From neoscada with Eclipse Public License 1.0 | 5 votes |
/** * This adds {@link org.eclipse.emf.edit.command.CommandParameter}s describing the children * that can be created under this object. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override protected void collectNewChildDescriptors ( Collection<Object> newChildDescriptors, Object object ) { super.collectNewChildDescriptors ( newChildDescriptors, object ); newChildDescriptors.add ( createChildParameter ( ConfigurationPackage.Literals.ROOT_TYPE__GROUP, FeatureMapUtil.createEntry ( ConfigurationPackage.Literals.ROOT_TYPE__QUEUE, ConfigurationFactory.eINSTANCE.createQueueType () ) ) ); newChildDescriptors.add ( createChildParameter ( ConfigurationPackage.Literals.ROOT_TYPE__GROUP, FeatureMapUtil.createEntry ( ConfigurationPackage.Literals.ROOT_TYPE__COMMAND, ConfigurationFactory.eINSTANCE.createSplitContinuousCommandType () ) ) ); newChildDescriptors.add ( createChildParameter ( ConfigurationPackage.Literals.ROOT_TYPE__GROUP, FeatureMapUtil.createEntry ( ConfigurationPackage.Literals.ROOT_TYPE__HIVE_PROCESS, ConfigurationFactory.eINSTANCE.createHiveProcessCommandType () ) ) ); newChildDescriptors.add ( createChildParameter ( ConfigurationPackage.Literals.ROOT_TYPE__GROUP, FeatureMapUtil.createEntry ( ConfigurationPackage.Literals.ROOT_TYPE__TRIGGER, ConfigurationFactory.eINSTANCE.createTriggerCommandType () ) ) ); newChildDescriptors.add ( createChildParameter ( ConfigurationPackage.Literals.ROOT_TYPE__GROUP, FeatureMapUtil.createEntry ( ConfigurationPackage.Literals.ROOT_TYPE__ADDITIONAL_CONFIGURATION_DIRECTORY, "" ) ) ); //$NON-NLS-1$ }
Example #15
Source File: DerivedEObjectEList.java From statecharts with Eclipse Public License 1.0 | 4 votes |
@Override public boolean contains(Object object) { if (sourceFeatureIDs != null) { for (int i = 0; i < sourceFeatureIDs.length; i++) { int sourceFeatureID = sourceFeatureIDs[i]; if (owner.eIsSet(sourceFeatureID)) { EStructuralFeature sourceFeature = getEStructuralFeature(sourceFeatureID); Object value = owner.eGet(sourceFeatureID, true, true); if (FeatureMapUtil.isFeatureMap(sourceFeature)) { FeatureMap featureMap = (FeatureMap) value; for (int j = 0, size = featureMap.size(); j < size; j++) { value = featureMap.getValue(j); if (isIncluded(featureMap.getEStructuralFeature(j)) ? value == object : isIncluded(value) && derive(value) == object) { return true; } } } else if (isIncluded(sourceFeature)) { if (sourceFeature.isMany() ? ((List<?>) value) .contains(object) : value == object) { return true; } } else { if (sourceFeature.isMany()) { InternalEList<?> valuesList = (InternalEList<?>) value; if (valuesList instanceof RandomAccess) { for (int j = 0, size = valuesList.size(); j < size; j++) { value = valuesList.basicGet(j); if (isIncluded(value) && derive(value) == object) { return true; } } } else { for (Iterator<?> v = valuesList.basicIterator(); v .hasNext();) { value = v.next(); if (isIncluded(value) && derive(value) == object) { return true; } } } } else if (isIncluded(value) && derive(value) == object) { return true; } } } } } return false; }
Example #16
Source File: CreateRegionCommand.java From statecharts with Eclipse Public License 1.0 | 4 votes |
@SuppressWarnings({ "rawtypes", "unchecked" }) protected EObject doDefaultElementCreation(int index) { EObject result = null; EReference reference = getContainmentFeature(); EClass eClass = getElementType().getEClass(); if (reference != null) { EObject container = getElementToEdit(); if (container != null) { IResourceHelper helper = Util.getHelper(container.eResource()); if (helper != null) { result = helper.create(eClass); } else { result = eClass.getEPackage().getEFactoryInstance() .create(eClass); } if (FeatureMapUtil.isMany(container, reference)) { ((List) container.eGet(reference)).add(index, result); } else { container.eSet(reference, result); } return result; } } IStatus status = (result != null) ? Status.OK_STATUS : new Status( Status.ERROR, DiagramActivator.PLUGIN_ID, "CreateRegionCommand: No Region created: " + getElementType().getDisplayName()); setDefaultElementCreationStatus(status); return result; }
Example #17
Source File: DerivedEObjectEList.java From statecharts with Eclipse Public License 1.0 | 4 votes |
@Override public boolean isEmpty() { if (sourceFeatureIDs != null) { for (int i = 0; i < sourceFeatureIDs.length; i++) { int sourceFeatureID = sourceFeatureIDs[i]; if (owner.eIsSet(sourceFeatureID)) { EStructuralFeature sourceFeature = getEStructuralFeature(sourceFeatureID); Object value = owner.eGet(sourceFeatureID, false, true); if (FeatureMapUtil.isFeatureMap(sourceFeature)) { FeatureMap featureMap = (FeatureMap) value; for (int j = 0, size = featureMap.size(); j < size; j++) { if (isIncluded(featureMap.getEStructuralFeature(j)) ? featureMap .getValue(j) != null : isIncluded(featureMap.getValue(j))) { return false; } } } else if (isIncluded(sourceFeature)) { if (sourceFeature.isMany() ? ((List<?>) value).size() > 0 : value != null) { return false; } } else { if (sourceFeature.isMany()) { InternalEList<?> valuesList = (InternalEList<?>) value; if (valuesList instanceof RandomAccess) { for (int j = 0, size = valuesList.size(); j < size; j++) { if (isIncluded(valuesList.basicGet(j))) { return false; } } } else { for (Iterator<?> v = valuesList.basicIterator(); v .hasNext();) { if (isIncluded(v.next())) { return false; } } } } else if (isIncluded(value)) { return false; } } } } } return true; }
Example #18
Source File: DerivedEObjectEList.java From statecharts with Eclipse Public License 1.0 | 4 votes |
protected boolean preparePrevious() { if (valuesIterator == null || !scanPrevious(preparedFeature, valuesIterator)) { while (featureIndex > 0) { int sourceFeatureID = sourceFeatureIDs[--featureIndex]; if (owner.eIsSet(sourceFeatureID)) { EStructuralFeature sourceFeature = getEStructuralFeature(sourceFeatureID); Object value = owner.eGet(sourceFeatureID, resolve(), true); if (sourceFeature.isMany() || FeatureMapUtil.isFeatureMap(sourceFeature)) { @SuppressWarnings("unchecked") InternalEList<Object> valuesList = (InternalEList<Object>) value; int valuesListSize = valuesList.size(); if (scanPrevious( sourceFeature, resolve() ? valuesList .listIterator(valuesListSize) : valuesList .basicListIterator(valuesListSize))) { prepared = -3; return true; } } else if (index > 0 && value == preparedValues.get(index - 1)) { valuesIterator = null; preparedFeature = sourceFeature; prepared = -2; return true; } } } prepared = -1; return false; } else { prepared = -3; return true; } }
Example #19
Source File: BonitaToBPMNExporter.java From bonita-studio with GNU General Public License v2.0 | 4 votes |
private TExpression createBPMNExpressionFromString(final String value) { final TExpression fromExpression = ModelFactory.eINSTANCE.createTExpression(); fromExpression.setId(EcoreUtil.generateUUID()); FeatureMapUtil.addText(fromExpression.getMixed(), value == null ? "" : value); return fromExpression; }
Example #20
Source File: DerivedEObjectEList.java From statecharts with Eclipse Public License 1.0 | 4 votes |
protected boolean prepareNext() { if (valuesIterator == null || !scanNext(preparedFeature, valuesIterator)) { while (featureIndex < sourceFeatureIDs.length) { int sourceFeatureID = sourceFeatureIDs[featureIndex++]; if (owner.eIsSet(sourceFeatureID)) { EStructuralFeature sourceFeature = getEStructuralFeature(sourceFeatureID); Object value = owner.eGet(sourceFeatureID, resolve(), true); if (sourceFeature.isMany() || FeatureMapUtil.isFeatureMap(sourceFeature)) { @SuppressWarnings("unchecked") InternalEList<Object> valuesList = (InternalEList<Object>) value; if (scanNext(sourceFeature, resolve() ? valuesList.listIterator() : valuesList.basicListIterator())) { prepared = 3; return true; } } else if ((isIncluded(sourceFeature) ? value != null : isIncluded(value)) && ((index < preparedValues.size() && value == preparedValues .get(index)) || preparedValues .add(value))) { valuesIterator = null; preparedFeature = sourceFeature; prepared = 2; return true; } } } prepared = 1; return false; } else { prepared = 3; return true; } }
Example #21
Source File: FormalExpressionFunction.java From bonita-studio with GNU General Public License v2.0 | 4 votes |
protected TFormalExpression addContent(final Expression bonitaExpression, final TFormalExpression formalExpression) { FeatureMapUtil.addText(formalExpression.getMixed(), bonitaExpression.getContent()); return formalExpression; }