Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--plugins/org.eclipse.osee.client.integration.tests/src/org/eclipse/osee/client/integration/tests/integration/skynet/core/ArtifactQueryTest.java8
-rw-r--r--plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/search/ArtifactMatch.java8
-rw-r--r--plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/search/ArtifactQuery.java4
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/search/RemoteArtifactSearch.java42
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/search/page/AttributeLineElement.java6
5 files changed, 33 insertions, 35 deletions
diff --git a/plugins/org.eclipse.osee.client.integration.tests/src/org/eclipse/osee/client/integration/tests/integration/skynet/core/ArtifactQueryTest.java b/plugins/org.eclipse.osee.client.integration.tests/src/org/eclipse/osee/client/integration/tests/integration/skynet/core/ArtifactQueryTest.java
index 2dedd2f61f9..80b40d35a6a 100644
--- a/plugins/org.eclipse.osee.client.integration.tests/src/org/eclipse/osee/client/integration/tests/integration/skynet/core/ArtifactQueryTest.java
+++ b/plugins/org.eclipse.osee.client.integration.tests/src/org/eclipse/osee/client/integration/tests/integration/skynet/core/ArtifactQueryTest.java
@@ -38,7 +38,6 @@ import org.eclipse.osee.framework.jdk.core.util.GUID;
import org.eclipse.osee.framework.skynet.core.artifact.Artifact;
import org.eclipse.osee.framework.skynet.core.artifact.ArtifactCache;
import org.eclipse.osee.framework.skynet.core.artifact.ArtifactTypeManager;
-import org.eclipse.osee.framework.skynet.core.artifact.Attribute;
import org.eclipse.osee.framework.skynet.core.artifact.BranchManager;
import org.eclipse.osee.framework.skynet.core.artifact.search.ArtifactMatch;
import org.eclipse.osee.framework.skynet.core.artifact.search.ArtifactQuery;
@@ -248,9 +247,10 @@ public class ArtifactQueryTest {
boolean found = false;
for (ArtifactMatch match : matches) {
if (match.getArtifact().getName().equals("Read-Write Minimum Rate")) {
- HashCollection<Attribute<?>, MatchLocation> matchData = match.getMatchData();
- for (Attribute<?> attr : matchData.keySet()) {
- if (attr.isOfType(CoreAttributeTypes.WordTemplateContent)) {
+ HashCollection<Integer, MatchLocation> matchData = match.getMatchData();
+ for (int attr : matchData.keySet()) {
+
+ if (match.getArtifact().getAttributeById(attr, false).isOfType(CoreAttributeTypes.WordTemplateContent)) {
found = true;
Assert.assertEquals(2, matchData.getValues(attr).size());
break;
diff --git a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/search/ArtifactMatch.java b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/search/ArtifactMatch.java
index 80fbbaedb2d..5969c38f010 100644
--- a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/search/ArtifactMatch.java
+++ b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/search/ArtifactMatch.java
@@ -15,15 +15,13 @@ import org.eclipse.osee.framework.jdk.core.type.HashCollection;
import org.eclipse.osee.framework.jdk.core.type.MatchLocation;
import org.eclipse.osee.framework.jdk.core.type.OseeCoreException;
import org.eclipse.osee.framework.skynet.core.artifact.Artifact;
-import org.eclipse.osee.framework.skynet.core.artifact.Attribute;
/**
* @author Roberto E. Escobar
*/
public class ArtifactMatch {
private final Artifact artifact;
- private final HashCollection<Attribute<?>, MatchLocation> matchData =
- new HashCollection<Attribute<?>, MatchLocation>();
+ private final HashCollection<Integer, MatchLocation> matchData = new HashCollection<Integer, MatchLocation>();
public ArtifactMatch(Artifact artifact) {
this.artifact = artifact;
@@ -37,11 +35,11 @@ public class ArtifactMatch {
return artifact;
}
- public HashCollection<Attribute<?>, MatchLocation> getMatchData() throws OseeCoreException {
+ public HashCollection<Integer, MatchLocation> getMatchData() throws OseeCoreException {
return matchData;
}
- public void addMatchData(Attribute<?> attr, Collection<MatchLocation> locations) {
+ public void addMatchData(Integer attr, Collection<MatchLocation> locations) {
matchData.put(attr, locations);
}
}
diff --git a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/search/ArtifactQuery.java b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/search/ArtifactQuery.java
index edc7175055b..a19107cffee 100644
--- a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/search/ArtifactQuery.java
+++ b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/search/ArtifactQuery.java
@@ -57,7 +57,6 @@ import org.eclipse.osee.framework.skynet.core.artifact.Artifact;
import org.eclipse.osee.framework.skynet.core.artifact.ArtifactCache;
import org.eclipse.osee.framework.skynet.core.artifact.ArtifactLoader;
import org.eclipse.osee.framework.skynet.core.artifact.ArtifactTypeManager;
-import org.eclipse.osee.framework.skynet.core.artifact.Attribute;
import org.eclipse.osee.framework.skynet.core.artifact.BranchManager;
import org.eclipse.osee.framework.skynet.core.event.OseeEventManager;
import org.eclipse.osee.framework.skynet.core.event.model.EventBasicGuidArtifact;
@@ -715,8 +714,7 @@ public class ArtifactQuery {
toAddTo = new ArtifactMatch(art);
matches.put(art, toAddTo);
}
- Attribute<?> attribute = art.getAttributeById(attrId, searchParameters.isIncludeDeleted());
- toAddTo.addMatchData(attribute, match.getLocations());
+ toAddTo.addMatchData(attrId, match.getLocations());
}
}
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/search/RemoteArtifactSearch.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/search/RemoteArtifactSearch.java
index 8bf546b18c0..4505a3b6d53 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/search/RemoteArtifactSearch.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/search/RemoteArtifactSearch.java
@@ -11,7 +11,9 @@
package org.eclipse.osee.framework.ui.skynet.search;
import java.util.ArrayList;
+import java.util.HashMap;
import java.util.List;
+import java.util.Map;
import java.util.logging.Level;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
@@ -20,7 +22,6 @@ import org.eclipse.osee.framework.jdk.core.type.HashCollection;
import org.eclipse.osee.framework.jdk.core.type.MatchLocation;
import org.eclipse.osee.framework.jdk.core.type.OseeCoreException;
import org.eclipse.osee.framework.jdk.core.util.Lib;
-import org.eclipse.osee.framework.jdk.core.util.Strings;
import org.eclipse.osee.framework.jdk.core.util.io.xml.XmlTextInputStream;
import org.eclipse.osee.framework.logging.OseeLevel;
import org.eclipse.osee.framework.logging.OseeLog;
@@ -95,9 +96,9 @@ public final class RemoteArtifactSearch extends AbstractArtifactSearchQuery {
if (artifactMatch.hasMatchData()) {
try {
Artifact artifact = artifactMatch.getArtifact();
- HashCollection<Attribute<?>, MatchLocation> matchData = artifactMatch.getMatchData();
+ HashCollection<Integer, MatchLocation> matchData = artifactMatch.getMatchData();
if (!matchData.isEmpty()) {
- for (Attribute<?> attribute : matchData.keySet()) {
+ for (Integer attribute : matchData.keySet()) {
for (MatchLocation matchLocation : matchData.getValues(attribute)) {
resultCollector.acceptMatchData(artifact, attribute, matchLocation);
lineMatches++;
@@ -132,6 +133,7 @@ public final class RemoteArtifactSearch extends AbstractArtifactSearchQuery {
private final AbstractTextSearchResult fResult;
private ArrayList<Match> fCachedMatches;
+ private final Map<Integer, String> attrContent = new HashMap<Integer, String>();
private ResultCollector(AbstractTextSearchResult result) {
fResult = result;
@@ -143,7 +145,7 @@ public final class RemoteArtifactSearch extends AbstractArtifactSearchQuery {
return true;
}
- public boolean acceptMatchData(Artifact artifact, Attribute<?> attribute, MatchLocation matchLocation) {
+ public boolean acceptMatchData(Artifact artifact, int attribute, MatchLocation matchLocation) {
int matchOffset = matchLocation.getStartPosition() - 1;
if (matchOffset < 0) {
matchOffset = 0;
@@ -159,24 +161,32 @@ public final class RemoteArtifactSearch extends AbstractArtifactSearchQuery {
return true;
}
- private AttributeLineElement getLineElement(int offset, int matchEnd, Artifact artifact, Attribute<?> attribute) {
+ private AttributeLineElement getLineElement(int offset, int matchEnd, Artifact artifact, int attrId) {
int lineNumber = 1;
int lineStart = 0;
+ String content = null;
+ if (attrContent.containsKey(attrId)) {
+ content = attrContent.get(attrId);
+ } else {
+ content = getContentFromAttribute(artifact.getAttributeById(attrId, false));
+ attrContent.put(attrId, content);
+ }
if (!fCachedMatches.isEmpty()) {
AttributeMatch last = (AttributeMatch) fCachedMatches.get(fCachedMatches.size() - 1);
AttributeLineElement lineElement = last.getLineElement();
- if (lineElement.contains(offset) && lineElement.getAttribute().equals(attribute)) {
+ if (lineElement.contains(offset) && lineElement.getAttribute() == attrId) {
return lineElement;
}
- lineStart = lineElement.getOffset() + lineElement.getLength();
- lineNumber = lineElement.getLine() + 1;
+ if (lineElement.getAttribute() == attrId) {
+ lineStart = lineElement.getOffset() + lineElement.getLength();
+ lineNumber = lineElement.getLine();
+ }
}
if (offset < lineStart) {
return null; // offset before the last line
}
int i = lineStart;
- String content = getContentFromAttribute(attribute);
int contentLength = content.length();
int charCount = 0;
while (i < contentLength) {
@@ -192,27 +202,19 @@ public final class RemoteArtifactSearch extends AbstractArtifactSearchQuery {
}
if (offset < i) {
String lineContent = getContents(content, lineStart, i); // include line delimiter
- return new AttributeLineElement(artifact, attribute, lineNumber, lineStart, lineContent);
+ return new AttributeLineElement(artifact, attrId, lineNumber, lineStart, lineContent);
}
lineNumber++;
lineStart = i;
}
}
if (offset < i) {
- String lineContent = getContents(attribute, lineStart, i);
- return new AttributeLineElement(artifact, attribute, lineNumber, lineStart, lineContent);
+ String lineContent = getContents(content, lineStart, i);
+ return new AttributeLineElement(artifact, attrId, lineNumber, lineStart, lineContent);
}
return null; // offset outside of range
}
- public String getContents(Attribute<?> attribute, int start, int end) {
- String contents = getContentFromAttribute(attribute);
- if (Strings.isValid(contents)) {
- contents = getContents(contents, start, end);
- }
- return contents;
- }
-
private String getContentFromAttribute(Attribute<?> attribute) {
try {
Object value = attribute.getValue();
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/search/page/AttributeLineElement.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/search/page/AttributeLineElement.java
index 427ce4c71d3..636af96aa4e 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/search/page/AttributeLineElement.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/search/page/AttributeLineElement.java
@@ -22,13 +22,13 @@ import org.eclipse.search.ui.text.Match;
*/
public class AttributeLineElement implements IAdaptable {
- private final Attribute<?> attribute;
+ private final int attribute;
private final Artifact parent;
private final int lineNumber;
private final int lineStartOffset;
private final String lineContents;
- public AttributeLineElement(Artifact parent, Attribute<?> attribute, int lineNumber, int lineStartOffset, String contents) {
+ public AttributeLineElement(Artifact parent, int attribute, int lineNumber, int lineStartOffset, String contents) {
this.parent = parent;
this.attribute = attribute;
this.lineContents = contents;
@@ -84,7 +84,7 @@ public class AttributeLineElement implements IAdaptable {
return count;
}
- public Attribute<?> getAttribute() {
+ public int getAttribute() {
return attribute;
}

Back to the top