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 73216 Details for
Bug 189030
DBSimpleSearchCommand is hard coded to only support CBE model
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read
this important communication.
[patch]
Patch with partial fix, the container is not set yet
patch-189030-pre-container-set.txt (text/plain), 10.48 KB, created by
Marius Slavescu
on 2007-07-06 16:28:23 EDT
(
hide
)
Description:
Patch with partial fix, the container is not set yet
Filename:
MIME Type:
Creator:
Marius Slavescu
Created:
2007-07-06 16:28:23 EDT
Size:
10.48 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.hyades.resources.database >Index: src/org/eclipse/hyades/resources/database/internal/impl/DBHyadesResourceExtension.java >=================================================================== >RCS file: /cvsroot/tptp/platform/org.eclipse.hyades.resources.database/src/org/eclipse/hyades/resources/database/internal/impl/DBHyadesResourceExtension.java,v >retrieving revision 1.14 >diff -u -r1.14 DBHyadesResourceExtension.java >--- src/org/eclipse/hyades/resources/database/internal/impl/DBHyadesResourceExtension.java 4 Mar 2007 08:42:35 -0000 1.14 >+++ src/org/eclipse/hyades/resources/database/internal/impl/DBHyadesResourceExtension.java 6 Jul 2007 20:03:05 -0000 >@@ -47,6 +47,7 @@ > import org.eclipse.hyades.models.hierarchy.extensions.Query; > import org.eclipse.hyades.models.hierarchy.extensions.QueryResult; > import org.eclipse.hyades.models.hierarchy.extensions.ResultEntry; >+import org.eclipse.hyades.models.hierarchy.extensions.SimpleOperand; > import org.eclipse.hyades.models.hierarchy.extensions.SimpleSearchQuery; > import org.eclipse.hyades.models.hierarchy.util.IHyadesExtendedResource; > import org.eclipse.hyades.models.hierarchy.util.IHyadesResourceExtension; >@@ -529,6 +530,16 @@ > statement.append("))"); > } > } >+ >+ public static EObject getOperandType(SimpleOperand oe) >+ { >+ if (oe.getFeature() != null) { >+ return oe.getFeature(); >+ } else if (oe.getType() != null) { >+ return oe.getType(); >+ } >+ return null; >+ } > public Object executeQuery(String queryString,String targetResourceURI, int mode,Properties p) { > try { > Database database = getDatabase(LoadersUtils.getPostfix(targetResourceURI), p); >Index: src/org/eclipse/hyades/resources/database/internal/impl/DBSimpleSearchCommand.java >=================================================================== >RCS file: /cvsroot/tptp/platform/org.eclipse.hyades.resources.database/src/org/eclipse/hyades/resources/database/internal/impl/DBSimpleSearchCommand.java,v >retrieving revision 1.8 >diff -u -r1.8 DBSimpleSearchCommand.java >--- src/org/eclipse/hyades/resources/database/internal/impl/DBSimpleSearchCommand.java 8 Mar 2007 16:12:50 -0000 1.8 >+++ src/org/eclipse/hyades/resources/database/internal/impl/DBSimpleSearchCommand.java 6 Jul 2007 20:03:05 -0000 >@@ -20,6 +20,7 @@ > > import org.eclipse.emf.common.util.BasicEList; > import org.eclipse.emf.common.util.EList; >+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.util.EcoreUtil; >@@ -43,6 +44,7 @@ > > /** > * @author apnan, Created on Jun 10, 2005 >+ * @author slavescu > * > */ > public class DBSimpleSearchCommand extends DBCommand { >@@ -67,7 +69,13 @@ > * @see org.eclipse.hyades.resources.database.internal.impl.DBCommand#execute() > */ > public Object execute() throws Exception { >- SQLStatement ssqs = createSimpleSearchQueryStatement(helper, dbMap, query); >+ SQLStatement ssqs; >+ boolean cbeRelated = isCBERelated(query); >+ if(cbeRelated) >+ ssqs = createSimpleSearchQueryStatementForCBE(helper, dbMap, query); >+ else >+ ssqs = new SimpleSearchQueryStatement(helper,dbMap,query); >+ > String s = ssqs.getStatement(); > QueryResult queryResult = ExtensionsFactory.eINSTANCE.createQueryResult(); > queryResult.setQuery(query); >@@ -75,8 +83,10 @@ > PerfUtil p = PerfUtil.createInstance("SimpleSearchCommand.execute() 1 statement="+s,true); > try { > if(!query.isCount()){ >- updateParams(); >- helper.commitTransaction(); >+ if(cbeRelated){ >+ updateParams(); >+ helper.commitTransaction(); >+ } > } > helper.executeQuery(st, s); > } catch (Exception e) { >@@ -108,13 +118,27 @@ > return queryResult; > } > >+ protected boolean isCBERelated(SimpleSearchQuery query2) { >+ for (Iterator iterator = query.getOutputElements().iterator(); iterator.hasNext();) { >+ SimpleOperand name = (SimpleOperand) iterator.next(); >+ EObject eo = DBHyadesResourceExtension.getOperandType(name); >+ while(eo!=null) >+ { >+ if(eo.eContainer()==CBEPackage.eINSTANCE) >+ return true; >+ eo = eo.eContainer(); >+ } >+ } >+ return false; >+ } >+ > /** > * @param helper > * @param dbMap > * @param query2 > * @return > */ >- protected SQLStatement createSimpleSearchQueryStatement(JDBCHelper helper1, DBMap dbMap1, SimpleSearchQuery query2) { >+ protected SQLStatement createSimpleSearchQueryStatementForCBE(JDBCHelper helper1, DBMap dbMap1, SimpleSearchQuery query2) { > return new SimpleSearchQueryStatement(helper1,dbMap1,query2){ > /* (non-Javadoc) > * @see org.eclipse.hyades.resources.database.internal.impl.SimpleSearchQueryStatement#processOutputElementsInSelectFrom() >Index: src/org/eclipse/hyades/resources/database/internal/impl/IndirectedList.java >=================================================================== >RCS file: /cvsroot/tptp/platform/org.eclipse.hyades.resources.database/src/org/eclipse/hyades/resources/database/internal/impl/IndirectedList.java,v >retrieving revision 1.16 >diff -u -r1.16 IndirectedList.java >--- src/org/eclipse/hyades/resources/database/internal/impl/IndirectedList.java 30 May 2007 23:33:38 -0000 1.16 >+++ src/org/eclipse/hyades/resources/database/internal/impl/IndirectedList.java 6 Jul 2007 20:03:05 -0000 >@@ -122,7 +122,7 @@ > if(currentPage==null || currentPage.size()==0 || !(eStructuralFeature instanceof EReference)) > return; > IdsTypes idsTypes = new IdsTypes(); >- for (int i = 0,length = currentPage.size(); i < length; i++) { >+ loop1: for (int i = 0,length = currentPage.size(); i < length; i++) { > Object o = currentPage.get(i); > if(o!=null && o instanceof EObject) > { >@@ -133,25 +133,31 @@ > if(id!=null) > { > String p_p = cache.getP_P(id); >- int preSlashIndex = p_p.lastIndexOf('/',p_p.length()-2); >- >- String sContainerId = p_p.substring(preSlashIndex>0?preSlashIndex:0,p_p.length()-1); >- int cId = Integer.parseInt(sContainerId); >- if(idsTypes.getIds().indexOf(cId, 0)!=-1) >+ String[] containersIds = p_p.split("\\/"); >+ if(containersIds.length==0) > continue; >+ for (int j = containersIds.length-1; j >=0; j--) { >+ String sContainerId = containersIds[containersIds.length-1]; >+ >+ int cId = Integer.parseInt(sContainerId); >+ if(idsTypes.getIds().indexOf(cId, 0)!=-1) >+ continue loop1; > >- Integer containerId = new Integer(cId); >- InternalEObject container = (InternalEObject)cache.getObject(containerId); >- if(container!=null) >- { >+ Integer containerId = new Integer(cId); >+ InternalEObject container = (InternalEObject)cache.getObject(containerId); >+ if(container!=null) >+ { >+ >+ eObject.eBasicSetContainer(container,0, (NotificationChain)null); >+ continue loop1; >+ } > >- eObject.eBasicSetContainer(container,0, (NotificationChain)null); >- continue; >+ int type = findContainerType((EObject)o); >+ if(type==-1) >+ continue loop1; >+ >+ idsTypes.add(Integer.parseInt(sContainerId), (short)type); > } >- >- int type = findContainerType((EObject)o); >- >- idsTypes.add(Integer.parseInt(sContainerId), (short)type); > } > } > } >Index: src/org/eclipse/hyades/resources/database/internal/impl/SimpleSearchQueryStatement.java >=================================================================== >RCS file: /cvsroot/tptp/platform/org.eclipse.hyades.resources.database/src/org/eclipse/hyades/resources/database/internal/impl/SimpleSearchQueryStatement.java,v >retrieving revision 1.10 >diff -u -r1.10 SimpleSearchQueryStatement.java >--- src/org/eclipse/hyades/resources/database/internal/impl/SimpleSearchQueryStatement.java 7 May 2007 04:52:22 -0000 1.10 >+++ src/org/eclipse/hyades/resources/database/internal/impl/SimpleSearchQueryStatement.java 6 Jul 2007 20:03:05 -0000 >@@ -16,8 +16,10 @@ > import java.util.Map; > import java.util.Set; > >+import org.eclipse.emf.common.util.Enumerator; > import org.eclipse.emf.ecore.EAttribute; > import org.eclipse.emf.ecore.EClass; >+import org.eclipse.emf.ecore.EEnum; > import org.eclipse.emf.ecore.EModelElement; > import org.eclipse.emf.ecore.EObject; > import org.eclipse.emf.ecore.EStructuralFeature; >@@ -198,7 +200,11 @@ > getInternalBuffer().append("'"); > getInternalBuffer().append(((Boolean) v).booleanValue() ? '1' : '0'); > getInternalBuffer().append("'"); >- } else >+ } else if(v instanceof Enumerator) { >+ getInternalBuffer().append("'"); >+ getInternalBuffer().append(v); >+ getInternalBuffer().append("'"); >+ }else > getInternalBuffer().append(v); > } > } >@@ -574,12 +580,7 @@ > } > > protected EObject getOperandType(SimpleOperand oe) { >- if (oe.getFeature() != null) { >- return oe.getFeature(); >- } else if (oe.getType() != null) { >- return oe.getType(); >- } >- return null; >+ return DBHyadesResourceExtension.getOperandType(oe); > } > > /* >#P org.eclipse.hyades.test.ui >Index: src/org/eclipse/hyades/test/ui/UiPlugin.java >=================================================================== >RCS file: /cvsroot/tptp/test/org.eclipse.hyades.test.ui/src/org/eclipse/hyades/test/ui/UiPlugin.java,v >retrieving revision 1.40 >diff -u -r1.40 UiPlugin.java >--- src/org/eclipse/hyades/test/ui/UiPlugin.java 1 Jun 2007 14:52:02 -0000 1.40 >+++ src/org/eclipse/hyades/test/ui/UiPlugin.java 6 Jul 2007 20:03:07 -0000 >@@ -32,6 +32,8 @@ > import org.eclipse.hyades.models.common.common.CMNNamedElement; > import org.eclipse.hyades.models.common.testprofile.TPFExecutionEvent; > import org.eclipse.hyades.models.common.util.ICommonConstants; >+import org.eclipse.hyades.models.hierarchy.util.HyadesExtendedResourceFactory; >+import org.eclipse.hyades.models.util.ModelDebugger; > import org.eclipse.hyades.test.core.TestCorePlugin; > import org.eclipse.hyades.test.core.TestCorePreferences; > import org.eclipse.hyades.test.core.testgen.TestGeneratorFactory; >@@ -269,6 +271,13 @@ > > Platform.getAdapterManager().registerAdapters(TestAdapterFactory.INSTANCE, IExtendedProxyNode.class); > >+ if(ModelDebugger.INSTANCE.debugDatabaseResourcePostfix!=null && ModelDebugger.INSTANCE.debugDatabaseResourcePostfix.length()>0) >+ { >+ //add support for RDB backed execution resources >+ Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap().put("executiondb", new HyadesExtendedResourceFactory());//$NON-NLS-1$ >+ } >+ >+ > super.start(context); > > Runnable operation = new Runnable() {
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
Actions:
View
|
Diff
Attachments on
bug 189030
: 73216