Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 65794 Details for
Bug 185372
Provide migration of gmfgen 1.0 models with GenAuditContainer and GenAuditRule structures
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
[patch]
Updated GMFGenMigration
org.eclipse.gmf.codegen.migration.txt (text/plain), 23.35 KB, created by
Anna Karjakina
on 2007-05-03 12:02:21 EDT
(
hide
)
Description:
Updated GMFGenMigration
Filename:
MIME Type:
Creator:
Anna Karjakina
Created:
2007-05-03 12:02:21 EDT
Size:
23.35 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.gmf.common >Index: src/org/eclipse/gmf/internal/common/migrate/MigrationConfig.java >=================================================================== >RCS file: /cvsroot/modeling/org.eclipse.gmf/plugins/org.eclipse.gmf.common/src/org/eclipse/gmf/internal/common/migrate/MigrationConfig.java,v >retrieving revision 1.7 >diff -u -r1.7 MigrationConfig.java >--- src/org/eclipse/gmf/internal/common/migrate/MigrationConfig.java 20 Oct 2006 16:22:22 -0000 1.7 >+++ src/org/eclipse/gmf/internal/common/migrate/MigrationConfig.java 3 May 2007 15:59:57 -0000 >@@ -221,6 +221,11 @@ > return false; > } > >+ protected boolean setAttribValue(MigrationHandler handler, EObject peekObject, String name, String value) { >+ // override >+ return false; >+ } >+ > /** > * Migration config registry implementaion. > */ >@@ -249,5 +254,6 @@ > } > put(descriptor.getExtension(), descriptor); > } >- } >+ } >+ > } >Index: src/org/eclipse/gmf/internal/common/migrate/MigrationResource.java >=================================================================== >RCS file: /cvsroot/modeling/org.eclipse.gmf/plugins/org.eclipse.gmf.common/src/org/eclipse/gmf/internal/common/migrate/MigrationResource.java,v >retrieving revision 1.9 >diff -u -r1.9 MigrationResource.java >--- src/org/eclipse/gmf/internal/common/migrate/MigrationResource.java 19 Mar 2007 16:49:09 -0000 1.9 >+++ src/org/eclipse/gmf/internal/common/migrate/MigrationResource.java 3 May 2007 15:59:58 -0000 >@@ -241,18 +241,24 @@ > > @Override > protected void setAttribValue(EObject object, String name, String value) { >- if ((isMigrationEnabled() || fixmePotentiallyCompatibilityIssues) && config.shouldIgnoreAttribute(object, name)) { >- Map<EObject, Map<String, String>> ignoredAttributes = resource().ignoredAttributes; >- if (ignoredAttributes != null) { >- Map<String, String> attrs = ignoredAttributes.get(object); >- if (attrs == null) { >- attrs = new HashMap<String, String>(); >- ignoredAttributes.put(object, attrs); >+ if ((isMigrationEnabled() || fixmePotentiallyCompatibilityIssues)) { >+ if (config.setAttribValue(this, object, name, value)) { >+ notifyMigrationApplied(); >+ return; >+ } >+ if (config.shouldIgnoreAttribute(object, name)) { >+ Map<EObject, Map<String, String>> ignoredAttributes = resource().ignoredAttributes; >+ if (ignoredAttributes != null) { >+ Map<String, String> attrs = ignoredAttributes.get(object); >+ if (attrs == null) { >+ attrs = new HashMap<String, String>(); >+ ignoredAttributes.put(object, attrs); >+ } >+ attrs.put(name, value); > } >- attrs.put(name, value); >+ notifyMigrationApplied(); // notify we had to migrate >+ return; // do not try to set value > } >- notifyMigrationApplied(); // notify we had to migrate >- return; // do not try to set value > } > super.setAttribValue(object, name, value); > } >@@ -292,7 +298,7 @@ > } > super.handleFeature(prefix, name); > } >- >+ > /** > * Make public for access from config. > */ >@@ -336,4 +342,5 @@ > resource().handleMigrationPatchApplied(); > } > } >+ > } >#P org.eclipse.gmf.tests >Index: src/org/eclipse/gmf/tests/migration/MigrationPatchesTest.java >=================================================================== >RCS file: /cvsroot/modeling/org.eclipse.gmf/tests/org.eclipse.gmf.tests/src/org/eclipse/gmf/tests/migration/MigrationPatchesTest.java,v >retrieving revision 1.9 >diff -u -r1.9 MigrationPatchesTest.java >--- src/org/eclipse/gmf/tests/migration/MigrationPatchesTest.java 19 Mar 2007 16:49:14 -0000 1.9 >+++ src/org/eclipse/gmf/tests/migration/MigrationPatchesTest.java 3 May 2007 15:59:59 -0000 >@@ -11,15 +11,19 @@ > package org.eclipse.gmf.tests.migration; > > import java.io.IOException; >+import java.util.Iterator; > > import junit.framework.TestCase; > > import org.eclipse.core.runtime.IStatus; > import org.eclipse.emf.common.util.EList; > import org.eclipse.emf.common.util.URI; >+import org.eclipse.emf.ecore.EObject; > import org.eclipse.emf.ecore.resource.Resource; > import org.eclipse.emf.ecore.resource.ResourceSet; > import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl; >+import org.eclipse.gmf.codegen.gmfgen.GenAuditContainer; >+import org.eclipse.gmf.codegen.gmfgen.GenAuditRule; > import org.eclipse.gmf.internal.common.ToolingResourceFactory; > import org.eclipse.gmf.internal.common.migrate.MigrationUtil; > import org.eclipse.gmf.internal.common.migrate.ModelLoadHelper; >@@ -103,4 +107,82 @@ > caughtException != null || !resource.getErrors().isEmpty() || !resource.getWarnings().isEmpty()); > return caughtException; > } >+ >+/* >+GenDiagram >+Removed attrs: >+attr String paletteProviderClassName; >+attr ProviderPriority paletteProviderPriority; >+attr String propertyProviderClassName; >+attr ProviderPriority propertyProviderPriority; >+attr String referenceConnectionEditPolicyClassName; >+attr String externalNodeLabelHostLayoutEditPolicyClassName; >+attr String diagramFileCreatorClassName; >+attr String preferenceInitializerClassName; >+ */ >+ public void testGenDiagram() throws Exception { >+ String genmodelFileName = "testGenDiagram.gmfgen"; //$NON-NLS-1$ >+ >+ Exception caughtGenException = assertOrdinaryLoadModelProblems(genmodelFileName); >+ assertTrue("expected diagnostic exception", caughtGenException != null); //$NON-NLS-1$ >+ >+ assertOnLoadModelMigrationSuccess(genmodelFileName); >+ } >+ >+ public void testGenAuditRootDefaultAndNested() throws Exception { >+ String genmodelFileName = "testGenAuditRootDefaultAndNested.gmfgen"; //$NON-NLS-1$ >+ >+ Exception caughtGenException = assertOrdinaryLoadModelProblems(genmodelFileName); >+ assertTrue("expected diagnostic exception", caughtGenException != null); //$NON-NLS-1$ >+ >+ assertOnLoadModelMigrationSuccess(genmodelFileName); >+ } >+ >+ public void testGenAuditRootNoDefaultButNested() throws Exception { >+ String genmodelFileName = "testGenAuditRootNoDefaultButNested.gmfgen"; //$NON-NLS-1$ >+ >+ Exception caughtGenException = assertOrdinaryLoadModelProblems(genmodelFileName); >+ assertTrue("expected diagnostic exception", caughtGenException != null); //$NON-NLS-1$ >+ >+ assertOnLoadModelMigrationSuccess(genmodelFileName); >+ } >+ >+ public void testGenAudits() throws Exception { >+ String genmodelFileName = "testGenAudits.gmfgen"; //$NON-NLS-1$ >+ >+ Exception caughtGenException = assertOrdinaryLoadModelProblems(genmodelFileName); >+ assertTrue("expected diagnostic exception", caughtGenException != null); //$NON-NLS-1$ >+ >+ assertOnLoadModelMigrationSuccess(genmodelFileName); >+ } >+ >+ public void testGenEditorAuditRootNoDefaultButNested() throws Exception { >+ String genmodelFileName = "testGenEditorAuditRootNoDefaultButNested.gmfgen"; //$NON-NLS-1$ >+ >+ Exception caughtGenException = assertOrdinaryLoadModelProblems(genmodelFileName); >+ assertTrue("expected diagnostic exception", caughtGenException != null); //$NON-NLS-1$ >+ >+ assertOnLoadModelMigrationSuccess(genmodelFileName); >+ } >+ >+ public void testGenAuditsCorrectCategories() throws Exception { >+ String genmodelFileName = "testGenAuditsCorrectCategories.gmfgen"; //$NON-NLS-1$ >+ >+ Exception caughtGenException = assertOrdinaryLoadModelProblems(genmodelFileName); >+ assertTrue("expected diagnostic exception", caughtGenException != null); //$NON-NLS-1$ >+ >+ assertOnLoadModelMigrationSuccess(genmodelFileName); >+ >+ URI uri = createURI(genmodelFileName); >+ ModelLoadHelper loadHelper = new ModelLoadHelper(new ResourceSetImpl(), uri); >+ Resource resource = loadHelper.getLoadedResource(); >+ for (Iterator<EObject> it = resource.getAllContents(); it.hasNext();) { >+ EObject next = it.next(); >+ if (next instanceof GenAuditRule) { >+ GenAuditRule nextRule = (GenAuditRule) next; >+ GenAuditContainer nextCategory = nextRule.getCategory(); >+ assertEquals("Audit rule expected to be placed to correct audit category after migration", "rule:"+nextCategory.getId(), nextRule.getId()); //$NON-NLS-1$ //$NON-NLS-2$ >+ } >+ } >+ } > } >Index: models/migration/testGenAuditRootDefaultAndNested.gmfgen >=================================================================== >RCS file: models/migration/testGenAuditRootDefaultAndNested.gmfgen >diff -N models/migration/testGenAuditRootDefaultAndNested.gmfgen >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ models/migration/testGenAuditRootDefaultAndNested.gmfgen 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,24 @@ >+<?xml version="1.0" encoding="UTF-8"?> >+<gmfgen:GenEditorGenerator xmi:version="2.0" >+ xmlns:xmi="http://www.omg.org/XMI" >+ xmlns:gmfgen="http://www.eclipse.org/gmf/2005/GenModel"> >+ <audits >+ id="root" >+ name="root"> >+ <audits >+ name="rule1:root" >+ id="rule1:root"/> >+ <childContainers> >+ <audits >+ name="rule1:first" >+ id="rule1:first"/> >+ <childContainers >+ id="second" >+ name="second"> >+ <audits >+ name="rule1:second" >+ id="rule1:second"/> >+ </childContainers> >+ </childContainers> >+ </audits> >+</gmfgen:GenEditorGenerator> >Index: models/migration/testGenAuditsCorrectCategories.gmfgen >=================================================================== >RCS file: models/migration/testGenAuditsCorrectCategories.gmfgen >diff -N models/migration/testGenAuditsCorrectCategories.gmfgen >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ models/migration/testGenAuditsCorrectCategories.gmfgen 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,26 @@ >+<?xml version="1.0" encoding="UTF-8"?> >+<gmfgen:GenEditorGenerator xmi:version="2.0" >+ xmlns:xmi="http://www.omg.org/XMI" >+ xmlns:gmfgen="http://www.eclipse.org/gmf/2005/GenModel"> >+ <audits >+ id="root" >+ name="root"> >+ <audits >+ name="rule:root" >+ id="rule:root"/> >+ <childContainers >+ id="first" >+ name="first"> >+ <audits >+ name="rule:first" >+ id="rule:first"/> >+ <childContainers >+ id="second" >+ name="second"> >+ <audits >+ name="rule:second" >+ id="rule:second"/> >+ </childContainers> >+ </childContainers> >+ </audits> >+</gmfgen:GenEditorGenerator> >Index: models/migration/testGenEditorAuditRootNoDefaultButNested.gmfgen >=================================================================== >RCS file: models/migration/testGenEditorAuditRootNoDefaultButNested.gmfgen >diff -N models/migration/testGenEditorAuditRootNoDefaultButNested.gmfgen >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ models/migration/testGenEditorAuditRootNoDefaultButNested.gmfgen 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,22 @@ >+<?xml version="1.0" encoding="UTF-8"?> >+<gmfgen:GenEditorGenerator xmi:version="2.0" >+ xmlns:xmi="http://www.omg.org/XMI" >+ xmlns:gmfgen="http://www.eclipse.org/gmf/2005/GenModel"> >+ <audits> >+ <audits >+ name="rule1:root" >+ id="rule1:root"/> >+ <childContainers> >+ <audits >+ name="rule1:first" >+ id="rule1:first"/> >+ <childContainers >+ id="second" >+ name="second"> >+ <audits >+ name="rule1:second" >+ id="rule1:second"/> >+ </childContainers> >+ </childContainers> >+ </audits> >+</gmfgen:GenEditorGenerator> >Index: models/migration/testGenDiagram.gmfgen >=================================================================== >RCS file: models/migration/testGenDiagram.gmfgen >diff -N models/migration/testGenDiagram.gmfgen >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ models/migration/testGenDiagram.gmfgen 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,11 @@ >+<?xml version="1.0" encoding="UTF-8"?> >+<gmfgen:GenDiagram xmi:version="2.0" >+ xmlns:xmi="http://www.omg.org/XMI" >+ xmlns:gmfgen="http://www.eclipse.org/gmf/2005/GenModel" paletteProviderClassName="RemovedPaletteProviderClassName" >+ paletteProviderPriority="Highest" >+ propertyProviderClassName="RemovedPropertyProviderClassName" >+ propertyProviderPriority="Highest" >+ referenceConnectionEditPolicyClassName="RemovedReferenceConnectionEditPolicyClassName" >+ externalNodeLabelHostLayoutEditPolicyClassName="RemovedExternalNodeLabelHostLayoutEditPolicyClassName" >+ diagramFileCreatorClassName="RemovedDiagramFileCreatorClassName" >+ preferenceInitializerClassName="RemovedPreferenceInitializerClassName"/> >Index: models/migration/testGenAudits.gmfgen >=================================================================== >RCS file: models/migration/testGenAudits.gmfgen >diff -N models/migration/testGenAudits.gmfgen >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ models/migration/testGenAudits.gmfgen 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,61 @@ >+<?xml version="1.0" encoding="UTF-8"?> >+<gmfgen:GenEditorGenerator xmi:version="2.0" >+ xmlns:xmi="http://www.omg.org/XMI" >+ xmlns:gmfgen="http://www.eclipse.org/gmf/2005/GenModel"> >+ <audits >+ id="container1-0" >+ name="container1-0"> >+ <audits >+ name="rule1:1-0" >+ id="rule1:1-0"/> >+ <audits >+ name="rule2:1-0" >+ id="rule2:1-0"/> >+ <childContainers >+ id="container1-1" >+ name="container1-1"> >+ <audits >+ name="rule1:1-1" >+ id="rule1:1-1"/> >+ <audits >+ name="rule2:1-1" >+ id="rule2:1-1"/> >+ <audits >+ name="rule3:1-1" >+ id="rule3:1-1"/> >+ <childContainers >+ id="container1-2" >+ name="container1-2"/> >+ <childContainers >+ id="container2-2" >+ name="container2-2"> >+ <audits >+ name="rule1:2-2" >+ id="rule1:2-2"/> >+ <audits >+ name="rule2:2-2" >+ id="rule2:2-2"/> >+ <childContainers >+ id="container2-3" >+ name="container2-3"> >+ <audits >+ name="rule1:2-3" >+ id="rule1:2-3"/> >+ <audits >+ name="rule2:2-3" >+ id="rule2:2-3"/> >+ </childContainers> >+ </childContainers> >+ </childContainers> >+ <childContainers >+ id="container2-1" >+ name="container2-1"> >+ <audits >+ name="rule1:2-1" >+ id="rule1:2-1"/> >+ <audits >+ name="rule2:2-1" >+ id="rule2:2-1"/> >+ </childContainers> >+ </audits> >+</gmfgen:GenEditorGenerator> >Index: models/migration/testGenAuditRootNoDefaultButNested.gmfgen >=================================================================== >RCS file: models/migration/testGenAuditRootNoDefaultButNested.gmfgen >diff -N models/migration/testGenAuditRootNoDefaultButNested.gmfgen >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ models/migration/testGenAuditRootNoDefaultButNested.gmfgen 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,20 @@ >+<?xml version="1.0" encoding="UTF-8"?> >+<gmfgen:GenAuditContainer xmi:version="2.0" >+ xmlns:xmi="http://www.omg.org/XMI" >+ xmlns:gmfgen="http://www.eclipse.org/gmf/2005/GenModel"> >+ <audits >+ name="rule1:root" >+ id="rule1:root"/> >+ <childContainers> >+ <audits >+ name="rule1:first" >+ id="rule1:first"/> >+ <childContainers >+ id="second" >+ name="second"> >+ <audits >+ name="rule1:second" >+ id="rule1:second"/> >+ </childContainers> >+ </childContainers> >+</gmfgen:GenAuditContainer> >#P org.eclipse.gmf.codegen >Index: src/org/eclipse/gmf/codegen/gmfgen/util/GMFGenMigration.java >=================================================================== >RCS file: /cvsroot/modeling/org.eclipse.gmf/plugins/org.eclipse.gmf.codegen/src/org/eclipse/gmf/codegen/gmfgen/util/GMFGenMigration.java,v >retrieving revision 1.10 >diff -u -r1.10 GMFGenMigration.java >--- src/org/eclipse/gmf/codegen/gmfgen/util/GMFGenMigration.java 11 Apr 2007 08:10:24 -0000 1.10 >+++ src/org/eclipse/gmf/codegen/gmfgen/util/GMFGenMigration.java 3 May 2007 16:00:01 -0000 >@@ -10,10 +10,21 @@ > */ > package org.eclipse.gmf.codegen.gmfgen.util; > >+import java.util.ArrayList; >+import java.util.Iterator; >+import java.util.List; >+import java.util.Map; >+ > import org.eclipse.emf.ecore.EObject; > import org.eclipse.emf.ecore.EStructuralFeature; >+import org.eclipse.emf.ecore.resource.Resource; > import org.eclipse.gmf.codegen.gmfgen.FeatureLabelModelFacet; >+import org.eclipse.gmf.codegen.gmfgen.GMFGenFactory; > import org.eclipse.gmf.codegen.gmfgen.GMFGenPackage; >+import org.eclipse.gmf.codegen.gmfgen.GenAuditContainer; >+import org.eclipse.gmf.codegen.gmfgen.GenAuditRoot; >+import org.eclipse.gmf.codegen.gmfgen.GenAuditRule; >+import org.eclipse.gmf.codegen.gmfgen.GenEditorGenerator; > import org.eclipse.gmf.internal.common.migrate.MigrationConfig; > import org.eclipse.gmf.internal.common.migrate.MigrationResource.MigrationHandler; > >@@ -29,14 +40,142 @@ > > public MigrationConfig getConfig() { > MigrationConfig config = new MigrationConfig(GMFGenPackage.eNS_URI, new String[] { eNS_URI_1_0 }) { >+ private boolean isDefaultAuditCategoryAdded = false; >+ private boolean isAuditMigrationApplied = false; >+ >+ @Override >+ protected void handleResourceLoaded(Resource resource, Map<EObject, Map<String, String>> ignoredAttributes) { >+ if (!isAuditMigrationApplied) { >+ return; >+ } >+ List<EObject> initialResourceContents = new ArrayList<EObject>(resource.getContents().size()); >+ initialResourceContents.addAll(resource.getContents()); >+ for (Iterator<EObject> it = initialResourceContents.iterator(); it.hasNext();) { >+ EObject object = it.next(); >+ if (object instanceof GenAuditContainer) { >+ GenAuditRoot root = GMFGenFactory.eINSTANCE.createGenAuditRoot(); >+ resource.getContents().add(root); >+ GenAuditContainer nextContainer = (GenAuditContainer) object; >+ root.getCategories().add(nextContainer); >+ moveNestedCategoriesToTheRoot(nextContainer, root); >+ nextContainer.getPath().clear(); >+ } >+ if (object instanceof GenEditorGenerator) { >+ GenEditorGenerator generator = (GenEditorGenerator) object; >+ GenAuditRoot root = generator.getAudits(); >+ if (root != null && !root.getCategories().isEmpty()) { >+ if (isDefaultAuditCategoryAdded) { >+ GenAuditContainer defaultCategory = getDefaultAuditContainer(root); >+ for (Iterator<GenAuditRule> toplevelRules = root.getRules().iterator(); toplevelRules.hasNext();) { >+ GenAuditRule nextFirst = toplevelRules.next(); >+ nextFirst.setCategory(defaultCategory); >+ } >+ if (root.getCategories().size() > 1) { >+ List<GenAuditContainer> containersList = new ArrayList<GenAuditContainer>(root.getCategories().size()); >+ containersList.addAll(root.getCategories()); >+ containersList.remove(defaultCategory); >+ for (Iterator<GenAuditContainer> containers = containersList.iterator(); containers.hasNext();) { >+ GenAuditContainer nextContainer = containers.next(); >+ moveNestedCategoriesToTheRoot(nextContainer, root); >+ nextContainer.getPath().clear(); >+ nextContainer.getPath().add(defaultCategory); >+ } >+ } >+ } else { >+ List<GenAuditContainer> containersList = new ArrayList<GenAuditContainer>(root.getCategories().size()); >+ containersList.addAll(root.getCategories()); >+ for (Iterator<GenAuditContainer> containers = containersList.iterator(); containers.hasNext();) { >+ GenAuditContainer nextContainer = containers.next(); >+ moveNestedCategoriesToTheRoot(nextContainer, root); >+ nextContainer.getPath().clear(); >+ } >+ } >+ } >+ } >+ } >+ isDefaultAuditCategoryAdded = false; >+ isAuditMigrationApplied = false; >+ } >+ >+ private void moveNestedCategoriesToTheRoot(GenAuditContainer nextContainer, GenAuditRoot root) { >+ moveNestedAuditsToTheRoot(nextContainer, root); >+ for (Iterator<GenAuditContainer> nestedContainers=nextContainer.getPath().iterator(); nestedContainers.hasNext();) { >+ GenAuditContainer nextNestedContainer = nestedContainers.next(); >+ moveNestedCategoriesToTheRoot(nextNestedContainer, root); >+ nestedContainers.remove(); >+ root.getCategories().add(nextNestedContainer); >+ nextNestedContainer.getPath().clear(); >+ nextNestedContainer.getPath().add(nextContainer); >+ } >+ } >+ >+ private void moveNestedAuditsToTheRoot(GenAuditContainer nextContainer, GenAuditRoot root) { >+ for (Iterator<GenAuditRule> nestedAudits = nextContainer.getAudits().iterator(); nestedAudits.hasNext();) { >+ GenAuditRule nextNestedRule = nestedAudits.next(); >+ nextNestedRule.setCategory(nextContainer); >+ root.getRules().add(nextNestedRule); >+ } >+ } >+ >+ @Override >+ public boolean setAttribValue(MigrationHandler handler, EObject peekObject, String name, String value) { >+ if (peekObject instanceof GenAuditRoot) { >+ if ("id".equals(name)) { //$NON-NLS-1$ >+ getDefaultAuditContainer((GenAuditRoot) peekObject).setId(value); >+ isAuditMigrationApplied = true; >+ return true; >+ } else if ("name".equals(name)) { //$NON-NLS-1$ >+ getDefaultAuditContainer((GenAuditRoot) peekObject).setName(value); >+ isAuditMigrationApplied = true; >+ return true; >+ } else if ("description".equals(name)) { //$NON-NLS-1$ >+ getDefaultAuditContainer((GenAuditRoot) peekObject).setDescription(value); >+ isAuditMigrationApplied = true; >+ return true; >+ } >+ } >+ return super.setAttribValue(handler, peekObject, name, value); >+ } >+ >+ private GenAuditContainer getDefaultAuditContainer(GenAuditRoot root) { >+ /* >+ * As we are mapping first audit category right into audit root, >+ * we should create some instance for that default category parameters >+ * also >+ */ >+ if (root.getCategories().isEmpty()) { >+ root.getCategories().add(0, GMFGenFactory.eINSTANCE.createGenAuditContainer()); >+ isDefaultAuditCategoryAdded = true; >+ } >+ return root.getCategories().get(0); >+ } > > @Override > protected boolean handleFeature(MigrationHandler handler, String prefix, String name) { >- if ("metaFeature".equals(name) && handler.peekEObject() instanceof FeatureLabelModelFacet) { //$NON-NLS-1$ >+ EObject object = handler.peekEObject(); >+ if ("metaFeature".equals(name) && object instanceof FeatureLabelModelFacet) { //$NON-NLS-1$ > name = "metaFeatures"; //$NON-NLS-1$ > handler.handleFeatureHook(prefix, name); > return true; > } >+ if ("audits".equals(name) && object instanceof GenAuditRoot) { //$NON-NLS-1$ >+ name = "rules"; //$NON-NLS-1$ >+ handler.handleFeatureHook(prefix, name); >+ isAuditMigrationApplied = true; >+ return true; >+ } >+ if ("childContainers".equals(name) && object instanceof GenAuditRoot) { //$NON-NLS-1$ >+ name = "categories"; //$NON-NLS-1$ >+ handler.handleFeatureHook(prefix, name); >+ isAuditMigrationApplied = true; >+ return true; >+ } >+ if ("childContainers".equals(name) && object instanceof GenAuditContainer) { //$NON-NLS-1$ >+ name = "path"; //$NON-NLS-1$ >+ handler.handleFeatureHook(prefix, name); >+ isAuditMigrationApplied = true; >+ return true; >+ } > return false; > } > >@@ -48,6 +187,7 @@ > } > return false; > } >+ > }; > initialize(config); > return config;
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Flags:
tikhomirov.artem
:
review+
Actions:
View
|
Diff
Attachments on
bug 185372
: 65794