Commit 1c978b68 authored by Marco Konersmann's avatar Marco Konersmann

Updates naming of the IDRegistry to match the naming in the process

parent 98e3aa06
......@@ -192,10 +192,10 @@ public class M2MTest {
IJavaProject mockElement = JavaCore.create(root.getProject("mockProject"));
final IDRegistry idRegistry = new IDRegistry();
for (final EObject o : modelRoots) {
idRegistry.registerComponentModelElement(mockElement, o);
idRegistry.registerImplementationModelElement(mockElement, o);
for (final Iterator<EObject> it = o.eAllContents(); it.hasNext();) {
final EObject child = it.next();
idRegistry.registerComponentModelElement(mockElement, child);
idRegistry.registerImplementationModelElement(mockElement, child);
}
}
return idRegistry;
......
......@@ -103,14 +103,14 @@ public class HenshinTGGTransformation extends ModelTransformation {
if (initialObject == null)
continue; // This is a new element in the ADL. Therefore we did not find any id. Ignore
String id = idRegistry.getIDFromIntermediateLanguageElement(initialObject);
String id = idRegistry.getIDFromTranslationModelElement(initialObject);
if (id == null) {
log.warning(MessageFormat.format("Could not find an ID for the initialObject [{0}]",
initialObject.toString()), null);
continue;
}
idRegistry.updateComponentModelElement(id, targetObject);
idRegistry.updateImplementationModelElement(id, targetObject);
} catch (final Throwable t) {
log.warning(
MessageFormat.format("Could not propagate the id of the specification language element [{0}]",
......@@ -179,7 +179,7 @@ public class HenshinTGGTransformation extends ModelTransformation {
if (id == null)
;// This was a new element in the ADL. Therefore we did not find any id. Ignore
else {
idRegistry.updateIntermediateLanguageElement(id, targetObject);
idRegistry.updateTranslationModelElement(id, targetObject);
updatedIDs.add(id);
}
} catch (IllegalArgumentException e) {
......@@ -231,7 +231,7 @@ public class HenshinTGGTransformation extends ModelTransformation {
"The initial element {0} has {1} result elements. Will only add the first initial element. Translations should not create correspondence objects that have multiple sources or multiple targets.",
initialObject, entry.getValue().size()), null);
idRegistry.addIntermediateLanguageElement(targetObject, initialObject);
idRegistry.addTranslationModelElement(targetObject, initialObject);
}
}
}
......@@ -281,7 +281,7 @@ public class HenshinTGGTransformation extends ModelTransformation {
}
try {
final String id = idRegistry.getIDFromIntermediateLanguageElement(initialObject);
final String id = idRegistry.getIDFromTranslationModelElement(initialObject);
if (id != null)
((SpecificationLanguageDefinition) language).setID(targetObject, id);
} catch (final Throwable t) {
......
......@@ -86,16 +86,16 @@ class PriorIlToNewIlCopier extends Copier {
final Collection<EObject> originalTargetList = (Collection<EObject>) originalTarget;
final Collection<EObject> cloneTargetList = new LinkedList<EObject>();
for (final EObject originalTargetElement : originalTargetList) {
final String targetId = priorIdRegistry.getIDFromIntermediateLanguageElement(originalTargetElement);
final String targetId = priorIdRegistry.getIDFromTranslationModelElement(originalTargetElement);
if (targetId == null)
continue; // this happens, when a prior il object has been deleted. Ignore.
final EObject cloneTarget = idRegistry.getIntermediateLanguageModelElement(targetId, ilModelRoots);
final EObject cloneTarget = idRegistry.getTranslationModelElement(targetId, ilModelRoots);
cloneTargetList.add(cloneTarget);
}
clone.eSet(ref, cloneTargetList);
} else {
final String targetId = priorIdRegistry.getIDFromIntermediateLanguageElement((EObject) originalTarget);
final EObject cloneTarget = idRegistry.getIntermediateLanguageModelElement(targetId, ilModelRoots);
final String targetId = priorIdRegistry.getIDFromTranslationModelElement((EObject) originalTarget);
final EObject cloneTarget = idRegistry.getTranslationModelElement(targetId, ilModelRoots);
clone.eSet(ref, cloneTarget);
}
}
......
......@@ -52,15 +52,15 @@ public class ModelExtractionTask extends AbstractTask {
ail2il.schedule();
ail2il.join();
final ProgramCodeToTranslationModelTask codeAndAil2il = new ProgramCodeToTranslationModelTask(implementationLanguage, projects,
final ProgramCodeToTranslationModelTask code2il = new ProgramCodeToTranslationModelTask(implementationLanguage, projects,
ail2il.getIdRegistry(), code2ail.getResultModelRoots(), ail2il.getResultModelRoots(), true);
codeAndAil2il.setProgressGroup(monitor, 1);
codeAndAil2il.schedule();
codeAndAil2il.join();
code2il.setProgressGroup(monitor, 1);
code2il.schedule();
code2il.join();
final InterProfileTransformationToSpecificationModelTask profileTransformation = new InterProfileTransformationToSpecificationModelTask(
implementationLanguage, modelingLanguage, codeAndAil2il.getIdRegistry(),
codeAndAil2il.getResultModelRoots(), true);
implementationLanguage, modelingLanguage, code2il.getIdRegistry(),
code2il.getResultModelRoots(), true);
profileTransformation.setProgressGroup(monitor, 1);
profileTransformation.schedule();
profileTransformation.join();
......
......@@ -67,11 +67,11 @@ public class ModelIntegrationTask extends AbstractTask {
ail2code.join();
if (specificationLanguage != null) {
TranslationModelToProgramCodeTask ilAndAil2code = new TranslationModelToProgramCodeTask(implementationLanguage, projects,
TranslationModelToProgramCodeTask il2code = new TranslationModelToProgramCodeTask(implementationLanguage, projects,
adl2il.getResultModelRoots());
ilAndAil2code.setProgressGroup(monitor, 1);
ilAndAil2code.schedule();
ilAndAil2code.join();
il2code.setProgressGroup(monitor, 1);
il2code.schedule();
il2code.join();
}
return Status.OK_STATUS;
......
......@@ -90,7 +90,7 @@ public class ImplementationModelToProgramCodeTask extends AbstractTask {
HashMap<String, String[]> registryEntries = idregistry.getRegistryEntries();
for (String e : registryEntries.keySet()) {
idregistry.updateCodeElement(e, null);
idregistry.updateComponentModelElement(e, null);
idregistry.updateImplementationModelElement(e, null);
}
}
......
......@@ -703,7 +703,7 @@ public class ASTUtils {
}
public static List<IType> getType(final String typeName, List<IJavaProject> projects) throws JavaModelException {
return getTypes(projects).parallelStream().filter(t -> t.getElementName().equals(typeName))
return getTypes(projects).stream().filter(t -> t.getElementName().equals(typeName))
.collect(Collectors.toList());
}
......
......@@ -51,13 +51,13 @@ public abstract class JavaBasedImplementationLanguageDefinition extends Implemen
* Returns an instance of the root transformation to execute on the given
* projects.
*/
public abstract AbstractModelCodeTransformation<? extends EObject, ? extends IJavaElement> createRootTransformationInstance();
public abstract AbstractModelCodeTransformation<?, ?> createRootTransformationInstance();
@Override
public void transformIMToCode(List<EObject> newModelRoots, List<EObject> oldModelRoots,
IDRegistry idRegistry_newModel, IDRegistry idregistry_oldModel, List<IJavaProject> projects)
throws CodelingException {
final AbstractModelCodeTransformation<? extends EObject, ? extends IJavaElement> rootTransformation = createRootTransformationInstance();
final AbstractModelCodeTransformation<?, ?> rootTransformation = createRootTransformationInstance();
configureRootTransformation(rootTransformation, projects, newModelRoots, idRegistry_newModel, oldModelRoots,
idregistry_oldModel);
monitor.worked(10);
......@@ -97,12 +97,12 @@ public abstract class JavaBasedImplementationLanguageDefinition extends Implemen
public void transformTMToCode(List<EObject> ilRoots, List<EObject> cmRoots, IDRegistry idRegistry,
List<IJavaProject> projects) throws CodelingException {
idRegistry.getRegistryEntries().keySet().parallelStream().forEach(id -> {
final EObject cmElement = idRegistry.getComponentModelElement(id, cmRoots);
idRegistry.getRegistryEntries().keySet().stream().forEach(id -> {
final EObject cmElement = idRegistry.getImplementationModelElement(id, cmRoots);
if (cmElement == null)
return;
final EObject ilElement = idRegistry.getIntermediateLanguageModelElement(id, ilRoots);
if (ilElement == null)
final EObject foundationalIALElement = idRegistry.getTranslationModelElement(id, ilRoots);
if (foundationalIALElement == null)
return;
final IJavaElement codeElement = resolveCodeElement(idRegistry, cmElement);
if (codeElement == null)
......@@ -110,27 +110,17 @@ public abstract class JavaBasedImplementationLanguageDefinition extends Implemen
final List<? extends IALTransformation<?, ?>> referencesTransformations = createIALTransformationInstance(
cmElement);
Resource applicationResource;
try {
applicationResource = getResource(rSet,
CodelingConfiguration.DEBUG_MODELDIR_PATH + "profile-application.pa.xmi");
} catch (IOException e) {
addError("Could not load profile application resource.", e);
return;
}
if (referencesTransformations != null) {
referencesTransformations.parallelStream().forEach(t -> {
referencesTransformations.stream().forEach(t -> {
IALHolder holder = t.getIALHolder();
holder.setIlElement(ilElement);
holder.setFoundationalCodeElement(codeElement);
holder.setProfileApplicationResource(applicationResource);
holder.setFoundationalIALElement(foundationalIALElement);
holder.setIALCodeElement(codeElement);
t.setIDRegistry(idRegistry);
t.setModelElement(t.getTranslatedILElement());
t.setModelElement(t.resolveTranslatedIALElement());
if (findTranslatedElements == null)
findTranslatedElements = new FindTranslatedElements();
t.setWhereToFindTranslatedElements(findTranslatedElements);
final ModelToJavaTransformation executor = new ModelToJavaTransformation(projects,
(AbstractModelCodeTransformation<?, ?>) t, new LinkedList<>());
executor.execute(monitor);
......@@ -142,36 +132,27 @@ public abstract class JavaBasedImplementationLanguageDefinition extends Implemen
}
@Override
public TransformationResult transformCodeToTM(List<IJavaProject> projects, final List<EObject> cmRoots,
final List<EObject> ilRoots, final IDRegistry idRegistry) throws CodelingException {
// Create a temporary profile application file for using the emf
// profiles facade.
public TransformationResult transformCodeToTM(List<IJavaProject> projects, List<EObject> imRoots,
List<EObject> tmRoots, IDRegistry idRegistry) throws CodelingException {
try {
final Resource applicationResource = getResource(rSet,
CodelingConfiguration.DEBUG_MODELDIR_PATH + "profile-application.pa.xmi");
idRegistry.getRegistryEntries().keySet().parallelStream().forEach(id -> {
idRegistry.getRegistryEntries().keySet().stream().forEach(id -> {
try {
final EObject cmElement = idRegistry.getComponentModelElement(id, cmRoots);
final EObject imElement = idRegistry.getImplementationModelElement(id, imRoots);
// If this element has not component model representation, ignore it.
if (cmElement == null)
if (imElement == null)
return;
final IJavaElement codeElement = resolveCodeElement(idRegistry, cmElement);
final EObject ilElement = idRegistry.getIntermediateLanguageModelElement(cmElement, ilRoots);
final EObject ialElement = idRegistry.getTranslationModelElement(imElement, tmRoots);
final List<? extends IALTransformation<?, ?>> ialTransformations = createIALTransformationInstance(
cmElement);
imElement);
if (ialTransformations != null)
ialTransformations.parallelStream().forEach(t -> {
ialTransformations.stream().forEach(t -> {
try {
IALHolder holder = t.getIALHolder();
t.setIDRegistry(idRegistry);
t.setModelElement(cmElement);
holder.setIlElement(ilElement);
holder.setFoundationalCodeElement(codeElement);
holder.setProfileApplicationResource(applicationResource);
t.setModelElement(imElement);
holder.setFoundationalIALElement(ialElement);
t.transformToModel();
} catch (final Exception ex) {
addError("Could not extract IL information from the code.", ex);
......@@ -182,8 +163,12 @@ public abstract class JavaBasedImplementationLanguageDefinition extends Implemen
}
});
mergeStereotypeApplicationsWithILModel(ilRoots, applicationResource);
return new TransformationResult(ilRoots, idRegistry);
// Create a temporary profile application file for using the emf
// profiles facade.
final Resource applicationResource = getResource(rSet,
CodelingConfiguration.DEBUG_MODELDIR_PATH + "profile-application.pa.xmi");
mergeStereotypeApplicationsWithILModel(tmRoots, applicationResource);
return new TransformationResult(tmRoots, idRegistry);
} catch (final IOException e) {
throw new CodelingException("Could not handle the temporary resource for the profile application.", e);
}
......@@ -194,7 +179,7 @@ public abstract class JavaBasedImplementationLanguageDefinition extends Implemen
throws CodelingException {
// Initialize the root transformation
final AbstractModelCodeTransformation<? extends EObject, ? extends IJavaElement> rootTransformation = createRootTransformationInstance();
final AbstractModelCodeTransformation<?, ?> rootTransformation = createRootTransformationInstance();
configureRootTransformation(rootTransformation, projects, null, idregistry, null, null);
monitor.worked(10);
......@@ -233,8 +218,7 @@ public abstract class JavaBasedImplementationLanguageDefinition extends Implemen
}
@SuppressWarnings("unchecked")
public List<? extends IALTransformation<?, ?>> createIALTransformationInstance(
EObject cmElement) {
public List<? extends IALTransformation<?, ?>> createIALTransformationInstance(EObject cmElement) {
final List<IALTransformationTuple> tuples = new LinkedList<>();
final List<IALTransformation<?, ?>> result = new LinkedList<>();
......@@ -249,8 +233,7 @@ public abstract class JavaBasedImplementationLanguageDefinition extends Implemen
}
for (final IALTransformationTuple tuple : tuples) {
for (Class<? extends IALTransformation<?, ?>> transformationClass : tuple
.getTransformationClasses()) {
for (Class<? extends IALTransformation<?, ?>> transformationClass : tuple.getTransformationClasses()) {
IALTransformation<EObject, IJavaElement> referenceTrans = null;
try {
for (Constructor<?> constructor : transformationClass.getDeclaredConstructors()) {
......@@ -266,8 +249,8 @@ public abstract class JavaBasedImplementationLanguageDefinition extends Implemen
} else if (constructor.getParameterCount() == 2
&& constructor.getParameterTypes()[0] == AbstractModelCodeTransformation.class
&& ENamedElement.class.isAssignableFrom(constructor.getParameterTypes()[1])) {
referenceTrans = (IALTransformation<EObject, IJavaElement>) constructor
.newInstance(null, tuple.getIlElement());
referenceTrans = (IALTransformation<EObject, IJavaElement>) constructor.newInstance(null,
tuple.getIlElement());
break;
}
}
......@@ -311,10 +294,10 @@ public abstract class JavaBasedImplementationLanguageDefinition extends Implemen
throw new IllegalArgumentException("idRegistry must not be null");
if (cmElement == null)
throw new IllegalArgumentException("cmElement must not be null");
if (!idRegistry.knowsComponentModelElement(cmElement))
if (!idRegistry.knowsImplementationModelElement(cmElement))
throw new IllegalArgumentException("idRegistry must know the cmElement, but does not.");
String id = idRegistry.getIDFromComponentModelElement(cmElement);
String id = idRegistry.getIDFromImplementationModelElement(cmElement);
return idRegistry.getCodeElement(id);
}
......
......@@ -57,7 +57,7 @@ public class JavaToModelTransformation extends ModelIntegrationConceptTransforma
// Register all new model elements
rootTransformation.getWhereToFindTranslatedElements().getAllTransformations().forEach(t -> {
// Register code and model element at the ID registry
if (!idRegistry.knowsComponentModelElement(t.getModelElement()))
if (!idRegistry.knowsImplementationModelElement(t.getModelElement()))
// Id does not exist yet.
idRegistry.generateID(t.getCodeElement(), t.getModelElement());
});
......
......@@ -55,7 +55,7 @@ public class ModelToJavaTransformation extends ModelIntegrationConceptTransforma
rootTransformation.getWhereToFindTranslatedElements().getAllTransformations().forEach(t -> {
// Some transformations do not have a code element (NinjaSingleton and related)
if (t.getCodeElement() != null && t.getModelElement() != null) {
String id = idRegistry.getIDFromComponentModelElement(t.getModelElement());
String id = idRegistry.getIDFromImplementationModelElement(t.getModelElement());
idRegistry.updateCodeElement(id, t.getCodeElement().getHandleIdentifier());
}
});
......
......@@ -150,9 +150,6 @@ public abstract class AbstractModelCodeTransformation<ELEMENTECLASS extends EObj
resolveCodeElement();
updateCodeFragments();
}
// Registers all class, reference, and attribute transformations for an Eclass.
EClass eClass = modelElement == null ? priorModelElement.eClass() : modelElement.eClass();
findTranslatedElements.addTransformation(eClass, this);
} catch (final Throwable e) {
final String message = String.format(
"Could not execute model-to-code transformation '%s' for element '%s'.",
......@@ -168,6 +165,10 @@ public abstract class AbstractModelCodeTransformation<ELEMENTECLASS extends EObj
childTransformations.forEach(c -> c.setOnlyCrossReferences(onlyCrossReferences));
invokeAll(childTransformations);
}
// Registers all class, reference, and attribute transformations for an Eclass.
EClass eClass = modelElement == null ? priorModelElement.eClass() : modelElement.eClass();
findTranslatedElements.addTransformation(eClass, this);
}
} else {
try {
......@@ -197,8 +198,6 @@ public abstract class AbstractModelCodeTransformation<ELEMENTECLASS extends EObj
if (modelElement == null)
throw new CodelingException("The transformation " + this.getClass().getName()
+ " resulted in 'null' as model element.");
// Registers all class, reference, and attribute transformations for an Eclass.
findTranslatedElements.addTransformation(modelElement.eClass(), this);
} catch (final Throwable e) {
final String elementName = codeElement == null ? "[codeElement is null]"
: codeElement.getHandleIdentifier();
......@@ -216,6 +215,9 @@ public abstract class AbstractModelCodeTransformation<ELEMENTECLASS extends EObj
childTransformations = createChildTransformationsToModel();
invokeAll(childTransformations);
}
// Registers all class, reference, and attribute transformations for an Eclass.
findTranslatedElements.addTransformation(modelElement.eClass(), this);
}
} else {
try {
......@@ -245,9 +247,9 @@ public abstract class AbstractModelCodeTransformation<ELEMENTECLASS extends EObj
@Override
public JAVAELEMENTCLASS resolveCodeElement() throws CodelingException {
if (priorIDRegistry != null && priorModelElement != null)
codeElement = (JAVAELEMENTCLASS) priorIDRegistry.getCodeElementFromComponentModel(priorModelElement);
codeElement = (JAVAELEMENTCLASS) priorIDRegistry.getCodeElementFromImplementationModelElement(priorModelElement);
else
codeElement = (JAVAELEMENTCLASS) idRegistry.getCodeElementFromComponentModel(modelElement);
codeElement = (JAVAELEMENTCLASS) idRegistry.getCodeElementFromImplementationModelElement(modelElement);
return codeElement;
}
......@@ -506,9 +508,9 @@ public abstract class AbstractModelCodeTransformation<ELEMENTECLASS extends EObj
// All other model elements or priorModelElements will already be set by the
// doCreate... methods.
final EObject childModelElement = childTransformation.getModelElement();
if (childModelElement != null && idRegistry.knowsComponentModelElement(childModelElement)) {
final String id = idRegistry.getIDFromComponentModelElement(childModelElement);
final EObject priorChildElement = priorIDRegistry.getComponentModelElement(id,
if (childModelElement != null && idRegistry.knowsImplementationModelElement(childModelElement)) {
final String id = idRegistry.getIDFromImplementationModelElement(childModelElement);
final EObject priorChildElement = priorIDRegistry.getImplementationModelElement(id,
EcoreUtil.getRootContainer(priorModelElement));
childTransformation.setPriorModelElement(priorChildElement);
}
......@@ -689,8 +691,8 @@ public abstract class AbstractModelCodeTransformation<ELEMENTECLASS extends EObj
}
protected EObject resolvePriorElement(EObject eObject) {
String id = idRegistry.getIDFromComponentModelElement(eObject);
return priorIDRegistry.getComponentModelElement(id, priorModelElement.eResource().getContents());
String id = idRegistry.getIDFromImplementationModelElement(eObject);
return priorIDRegistry.getImplementationModelElement(id, priorModelElement.eResource().getContents());
}
/**
......@@ -716,9 +718,9 @@ public abstract class AbstractModelCodeTransformation<ELEMENTECLASS extends EObj
*/
protected EObject findPriorModelElementFor(EObject currentElement) {
EObject priorTarget = null;
if (idRegistry.knowsComponentModelElement(currentElement)) {
String oldID = idRegistry.getIDFromComponentModelElement(currentElement);
priorTarget = priorIDRegistry.getComponentModelElement(oldID,
if (idRegistry.knowsImplementationModelElement(currentElement)) {
String oldID = idRegistry.getIDFromImplementationModelElement(currentElement);
priorTarget = priorIDRegistry.getImplementationModelElement(oldID,
EcoreUtil.getRootContainer(priorModelElement));
}
return priorTarget;
......
......@@ -2,60 +2,40 @@ package de.mkonersmann.advert.java.embed.transformation.references;
import org.codeling.utils.errorcontainers.MayHaveIssues;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.resource.Resource;
import org.eclipse.jdt.core.IJavaElement;
public class IALHolder extends MayHaveIssues {
private Resource profileApplicationResource;
// Prior Element
private EObject priorILElement;
private EObject priorFoundationalIALElement;
// Current (possibly changed) element
private EObject ilElement;
// Code Elements
private IJavaElement foundationalCodeElement;
private IJavaElement ilCodeElement;
private EObject foundationalIALElement;
public Resource getProfileApplicationResource() {
return profileApplicationResource;
}
public void setProfileApplicationResource(Resource profileApplicationResource) {
this.profileApplicationResource = profileApplicationResource;
}
public EObject getPriorILElement() {
return priorILElement;
}
public void setPriorILElement(EObject priorILElement) {
this.priorILElement = priorILElement;
}
// Code Element
private IJavaElement ialCodeElement;
public EObject getIlElement() {
return ilElement;
public EObject getPriorFoundationalIALElement() {
return priorFoundationalIALElement;
}
public void setIlElement(EObject ilElement) {
this.ilElement = ilElement;
public void setPriorFoundationalIALElement(EObject priorIALElement) {
this.priorFoundationalIALElement = priorIALElement;
}
public IJavaElement getFoundationalCodeElement() {
return foundationalCodeElement;
public EObject getFoundationalIALElement() {
return foundationalIALElement;
}
public void setFoundationalCodeElement(IJavaElement foundationalCodeElement) {
this.foundationalCodeElement = foundationalCodeElement;
public void setFoundationalIALElement(EObject ialElement) {
this.foundationalIALElement = ialElement;
}
public IJavaElement getIlCodeElement() {
return ilCodeElement;
public IJavaElement getIALCodeElement() {
return ialCodeElement;
}
public void setIlCodeElement(IJavaElement ilCodeElement) {
this.ilCodeElement = ilCodeElement;
public void setIALCodeElement(IJavaElement ialCodeElement) {
this.ialCodeElement = ialCodeElement;
}
}
......@@ -18,7 +18,7 @@ public interface IALTransformation<ELEMENTECLASS extends EObject, JAVAELEMENTCLA
* Returns the actual IAL element that is translated. E.g. a stereotype upon a
* component type that owns a reference.
*/
public StereotypeApplication getTranslatedILElement();
public StereotypeApplication resolveTranslatedIALElement();
/**
* Returns whether the code fragment for the IAL element exists.
......
......@@ -149,7 +149,8 @@ abstract class AnnotatedMemberReferenceTransformation<OWNERECLASS extends EObjec
}
override IType resolveCodeElement() {
super.resolveCodeElement();
if (codeElement === null)
super.resolveCodeElement();
if (fields.isEmpty)
for (IField field : (codeElement as IType).fields)
if (hasExpectedAnnotation(field))
......
......@@ -31,7 +31,7 @@ abstract class ContainmentOperationReferenceAnnotationParameterTransformation<OW
val List<IJavaElement> targetsToAdd = newLinkedList();
newTargets.forEach [ newTarget |
if (!idRegistry.knowsComponentModelElement(newTarget)) {
if (!idRegistry.knowsImplementationModelElement(newTarget)) {
addWarning(
MessageFormat.format(
"Could not add the code representation of [{0}] with the name [{1}] as member value, because the id registry does not know the model element.",
......@@ -39,7 +39,7 @@ abstract class ContainmentOperationReferenceAnnotationParameterTransformation<OW
return;
}
targetsToAdd.add(idRegistry.getCodeElementFromComponentModel(newTarget));
targetsToAdd.add(idRegistry.getCodeElementFromImplementationModelElement(newTarget));
];
if (!eReference.isMany && !targetsToAdd.empty) {
......@@ -69,12 +69,12 @@ abstract class ContainmentOperationReferenceAnnotationParameterTransformation<OW
val List<IJavaElement> targetsToAdd = newLinkedList();
newTargets.forEach [ newTarget |
if (!idRegistry.knowsComponentModelElement(newTarget)) {
if (!idRegistry.knowsImplementationModelElement(newTarget)) {
return;
}
val newTargetID = idRegistry.getIDFromComponentModelElement(newTarget);
val newTargetID = idRegistry.getIDFromImplementationModelElement(newTarget);
if (!oldTargets.
exists[oldTarget|priorIDRegistry.getIDFromComponentModelElement(oldTarget) == newTargetID]) {
exists[oldTarget|priorIDRegistry.getIDFromImplementationModelElement(oldTarget) == newTargetID]) {
val IJavaElement newCodeElement = idRegistry.getCodeElement(newTargetID);
targetsToAdd.add(newCodeElement);
}
......
......@@ -6,8 +6,11 @@ import org.codeling.lang.jee7.mm.JEE7.Architecture;
import org.codeling.lang.jee7.mm.JEE7.Archive;
import org.codeling.lang.jee7.mm.JEE7.JEE7Package;
import org.codeling.lang.jee7.transformation.ArchiveTransformation;
import org.codeling.lang.jee7.transformation.NamespaceTransformation;
import org.codeling.mechanisms.transformations.references.NinjaSingletonContainmentTransformation;
import org.codeling.utils.Models;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.util.EcoreUtil;
import org.eclipse.jdt.core.IJavaElement;
import org.eclipse.jdt.core.IJavaProject;
......@@ -28,11 +31,20 @@ public class ArchivesTransformation extends NinjaSingletonContainmentTransformat
@Override
protected void doCreateChildTransformationsToCode(
List<AbstractModelCodeTransformation<? extends EObject, ? extends IJavaElement>> result) {
for(Archive archive : modelElement.getArchives()) {
ArchiveTransformation t = new ArchiveTransformation(this);
t.setModelElement(archive);
for (EObject target : Models.getTargetsAsList(modelElement, eReference)) {
AbstractModelCodeTransformation<?, ?> t = new ArchiveTransformation(this);
t.setModelElement(target);
result.add(t);
}
for (EObject target : Models.getTargetsAsList(priorModelElement, eReference)) {
String priorID = priorIDRegistry.getIDFromImplementationModelElement(target);
EObject newElement = idRegistry.getImplementationModelElement(priorID, EcoreUtil.getRootContainer(modelElement));
if (newElement == null) {
AbstractModelCodeTransformation<?, ?> t = new NamespaceTransformation(this);
t.setPriorModelElement(target);
result.add(t);
}
}
}
@Override
......
......@@ -38,15 +38,15 @@ public class BeansTransformation extends NinjaSingletonContainmentTransformation
protected void doCreateChildTransformationsToCode(
List<AbstractModelCodeTransformation<? extends EObject, ? extends IJavaElement>> result) {
for (EObject target : Models.getTargetsAsList(modelElement, eReference)) {
AbstractModelCodeTransformation<?, IType> t = createSpecificTransformation(target);
AbstractModelCodeTransformation<?, ?> t = createSpecificTransformation(target);
t.setModelElement(target);
result.add(t);
}
for (EObject target : Models.getTargetsAsList(priorModelElement, eReference)) {
String priorID = priorIDRegistry.getIDFromComponentModelElement(target);
EObject newElement = idRegistry.getComponentModelElement(priorID, EcoreUtil.getRootContainer(modelElement));
String priorID = priorIDRegistry.getIDFromImplementationModelElement(target);
EObject newElement = idRegistry.getImplementationModelElement(priorID, EcoreUtil.getRootContainer(modelElement));
if (newElement == null) {
AbstractModelCodeTransformation<?, IType> t = createSpecificTransformation(target);