Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRoberto E. Escobar2012-05-31 21:40:43 +0000
committerRoberto E. Escobar2012-07-20 21:25:40 +0000
commit54822ae18cfed9510c1f5bd0487713c5770c5ecc (patch)
tree65ab1fd1f5799e1c95bfb66f88c7fc8822e0ec48 /plugins/org.eclipse.osee.orcs.rest
parent26876fb15394be6843d0dfe3b9a037b668cd92f1 (diff)
downloadorg.eclipse.osee-54822ae18cfed9510c1f5bd0487713c5770c5ecc.tar.gz
org.eclipse.osee-54822ae18cfed9510c1f5bd0487713c5770c5ecc.tar.xz
org.eclipse.osee-54822ae18cfed9510c1f5bd0487713c5770c5ecc.zip
feature[ats_M5LLE]: Writeable interfaces
Add commit transaction database callable Add OrcsObject
Diffstat (limited to 'plugins/org.eclipse.osee.orcs.rest')
-rw-r--r--plugins/org.eclipse.osee.orcs.rest/src/org/eclipse/osee/orcs/rest/internal/ArtifactResource.java8
-rw-r--r--plugins/org.eclipse.osee.orcs.rest/src/org/eclipse/osee/orcs/rest/internal/ArtifactsResource.java16
-rw-r--r--plugins/org.eclipse.osee.orcs.rest/src/org/eclipse/osee/orcs/rest/internal/HtmlWriter.java24
3 files changed, 19 insertions, 29 deletions
diff --git a/plugins/org.eclipse.osee.orcs.rest/src/org/eclipse/osee/orcs/rest/internal/ArtifactResource.java b/plugins/org.eclipse.osee.orcs.rest/src/org/eclipse/osee/orcs/rest/internal/ArtifactResource.java
index e1aa714050..c05da7c245 100644
--- a/plugins/org.eclipse.osee.orcs.rest/src/org/eclipse/osee/orcs/rest/internal/ArtifactResource.java
+++ b/plugins/org.eclipse.osee.orcs.rest/src/org/eclipse/osee/orcs/rest/internal/ArtifactResource.java
@@ -21,8 +21,7 @@ import javax.ws.rs.core.UriInfo;
import org.eclipse.osee.framework.core.data.IOseeBranch;
import org.eclipse.osee.framework.core.data.TokenFactory;
import org.eclipse.osee.framework.core.exception.OseeCoreException;
-import org.eclipse.osee.orcs.RelationGraph;
-import org.eclipse.osee.orcs.data.ReadableArtifact;
+import org.eclipse.osee.orcs.data.ArtifactReadable;
import org.eclipse.osee.orcs.search.QueryFactory;
/**
@@ -55,9 +54,8 @@ public class ArtifactResource {
public String getAsHtml() throws OseeCoreException {
IOseeBranch branch = TokenFactory.createBranch(branchUuid, "");
QueryFactory factory = OrcsApplication.getOrcsApi().getQueryFactory(null);
- RelationGraph graph = OrcsApplication.getOrcsApi().getGraph(null);
- List<ReadableArtifact> arts = factory.fromBranch(branch).andGuidsOrHrids(artifactUuid).getResults().getList();
- HtmlWriter writer = new HtmlWriter(uriInfo, graph);
+ List<ArtifactReadable> arts = factory.fromBranch(branch).andGuidsOrHrids(artifactUuid).getResults().getList();
+ HtmlWriter writer = new HtmlWriter(uriInfo);
return writer.toHtml(arts);
}
}
diff --git a/plugins/org.eclipse.osee.orcs.rest/src/org/eclipse/osee/orcs/rest/internal/ArtifactsResource.java b/plugins/org.eclipse.osee.orcs.rest/src/org/eclipse/osee/orcs/rest/internal/ArtifactsResource.java
index 229b1d18dc..7e22adb692 100644
--- a/plugins/org.eclipse.osee.orcs.rest/src/org/eclipse/osee/orcs/rest/internal/ArtifactsResource.java
+++ b/plugins/org.eclipse.osee.orcs.rest/src/org/eclipse/osee/orcs/rest/internal/ArtifactsResource.java
@@ -22,10 +22,9 @@ import javax.ws.rs.core.UriInfo;
import org.eclipse.osee.framework.core.data.IOseeBranch;
import org.eclipse.osee.framework.core.data.ResultSet;
import org.eclipse.osee.framework.core.data.TokenFactory;
-import org.eclipse.osee.framework.core.enums.CoreRelationTypes;
import org.eclipse.osee.framework.core.exception.OseeCoreException;
-import org.eclipse.osee.orcs.RelationGraph;
-import org.eclipse.osee.orcs.data.ReadableArtifact;
+import org.eclipse.osee.orcs.data.ArtifactReadable;
+import org.eclipse.osee.orcs.data.GraphReadable;
import org.eclipse.osee.orcs.search.QueryFactory;
/**
@@ -63,14 +62,13 @@ public class ArtifactsResource {
public String getAsHtml() throws OseeCoreException {
IOseeBranch branch = TokenFactory.createBranch(branchUuid, "");
QueryFactory factory = OrcsApplication.getOrcsApi().getQueryFactory(null);
- ResultSet<ReadableArtifact> results =
+ ResultSet<ArtifactReadable> results =
factory.fromBranch(branch).andNameEquals(DEFAULT_HIERARCHY_ROOT_NAME).getResults();
- ReadableArtifact rootArtifact = results.getExactlyOne();
+ ArtifactReadable rootArtifact = results.getExactlyOne();
- RelationGraph graph = OrcsApplication.getOrcsApi().getGraph(null);
- List<ReadableArtifact> arts =
- graph.getRelatedArtifacts(rootArtifact, CoreRelationTypes.Default_Hierarchical__Child);
- HtmlWriter writer = new HtmlWriter(uriInfo, graph);
+ GraphReadable graph = OrcsApplication.getOrcsApi().getGraph(null);
+ List<ArtifactReadable> arts = graph.getChildren(rootArtifact).getList();
+ HtmlWriter writer = new HtmlWriter(uriInfo);
return writer.toHtml(arts);
}
private static final String DEFAULT_HIERARCHY_ROOT_NAME = "Default Hierarchy Root";
diff --git a/plugins/org.eclipse.osee.orcs.rest/src/org/eclipse/osee/orcs/rest/internal/HtmlWriter.java b/plugins/org.eclipse.osee.orcs.rest/src/org/eclipse/osee/orcs/rest/internal/HtmlWriter.java
index ef95f2df28..881e8b222a 100644
--- a/plugins/org.eclipse.osee.orcs.rest/src/org/eclipse/osee/orcs/rest/internal/HtmlWriter.java
+++ b/plugins/org.eclipse.osee.orcs.rest/src/org/eclipse/osee/orcs/rest/internal/HtmlWriter.java
@@ -20,9 +20,9 @@ import org.eclipse.osee.framework.core.data.IAttributeType;
import org.eclipse.osee.framework.core.data.IOseeBranch;
import org.eclipse.osee.framework.core.exception.OseeCoreException;
import org.eclipse.osee.framework.core.model.Branch;
-import org.eclipse.osee.orcs.RelationGraph;
-import org.eclipse.osee.orcs.data.ReadableArtifact;
-import org.eclipse.osee.orcs.data.ReadableAttribute;
+import org.eclipse.osee.orcs.data.ArtifactReadable;
+import org.eclipse.osee.orcs.data.AttributeReadable;
+import org.eclipse.osee.orcs.data.GraphReadable;
/**
* @author Roberto E. Escobar
@@ -30,15 +30,9 @@ import org.eclipse.osee.orcs.data.ReadableAttribute;
public class HtmlWriter {
private final UriInfo uriInfo;
- private final RelationGraph graph;
public HtmlWriter(UriInfo uriInfo) {
- this(uriInfo, null);
- }
-
- public HtmlWriter(UriInfo uriInfo, RelationGraph graph) {
this.uriInfo = uriInfo;
- this.graph = graph;
}
public String toHtml(Collection<? extends Object> objects) throws OseeCoreException {
@@ -48,8 +42,8 @@ public class HtmlWriter {
if (object instanceof Branch) {
Branch branch = (Branch) object;
addTable(builder, toData(branch));
- } else if (object instanceof ReadableArtifact) {
- ReadableArtifact artifact = (ReadableArtifact) object;
+ } else if (object instanceof ArtifactReadable) {
+ ArtifactReadable artifact = (ArtifactReadable) object;
addTable(builder, toData(artifact));
} else {
Map<String, Object> unhandled = new LinkedHashMap<String, Object>();
@@ -63,11 +57,10 @@ public class HtmlWriter {
return builder.toString();
}
- private Map<String, Object> toData(ReadableArtifact artifact) throws OseeCoreException {
+ private Map<String, Object> toData(ArtifactReadable artifact) throws OseeCoreException {
Map<String, Object> data = new LinkedHashMap<String, Object>();
data.put("Name", artifact.getName());
data.put("Uuid", artifact.getGuid());
- data.put("Local Id", artifact.getId());
data.put("Tx Id", artifact.getTransactionId());
IOseeBranch branch = artifact.getBranch();
@@ -81,14 +74,15 @@ public class HtmlWriter {
Collection<IAttributeType> types = artifact.getAttributeTypes();
for (IAttributeType type : types) {
- for (ReadableAttribute<?> attr : artifact.getAttributes(type)) {
+ for (AttributeReadable<?> attr : artifact.getAttributes(type)) {
String value = attr.getDisplayableString();
data.put(type.getName(), value == null ? "<NULL>" : value);
}
}
int count = 0;
- for (ReadableArtifact art : graph.getChildren(artifact)) {
+ GraphReadable graph = OrcsApplication.getOrcsApi().getGraph(null);
+ for (ArtifactReadable art : graph.getChildren(artifact)) {
URI uri1;
if (isAtEndOfPath(uriInfo.getPath(), "artifact")) {
uri1 = uriInfo.getAbsolutePathBuilder().path("{uuid}").build(art.getGuid());

Back to the top