Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAngel Avila2015-06-05 17:19:22 -0400
committerAngel Avila2015-06-11 03:30:54 -0400
commit8a19cb83f4e980603102bc92bea5c551c8c41c73 (patch)
tree7b9a91c0896d15cac2c7688055f56619e04083b2
parent15cf01a5a48184e782452a1acd828ce15cc262bd (diff)
downloadorg.eclipse.osee-uicount.tar.gz
org.eclipse.osee-uicount.tar.xz
org.eclipse.osee-uicount.zip
-rw-r--r--plugins/org.eclipse.osee.ats.api/src/org/eclipse/osee/ats/api/program/IAtsProgramService.java3
-rw-r--r--plugins/org.eclipse.osee.ats.api/src/org/eclipse/osee/ats/api/workflow/IAtsBranchService.java4
-rw-r--r--plugins/org.eclipse.osee.ats.core.client/src/org/eclipse/osee/ats/core/client/branch/internal/AtsBranchServiceImpl.java5
-rw-r--r--plugins/org.eclipse.osee.ats.core/META-INF/MANIFEST.MF1
-rw-r--r--plugins/org.eclipse.osee.ats.core/src/org/eclipse/osee/ats/core/util/AbstractAtsBranchService.java6
-rw-r--r--plugins/org.eclipse.osee.ats.impl/src/org/eclipse/osee/ats/impl/internal/util/AtsBranchServiceImpl.java6
-rw-r--r--plugins/org.eclipse.osee.ats.rest/META-INF/MANIFEST.MF3
-rw-r--r--plugins/org.eclipse.osee.ats.rest/OSGI-INF/ats.rest.application.xml1
-rw-r--r--plugins/org.eclipse.osee.ats.rest/src/org/eclipse/osee/ats/rest/internal/AtsApplication.java11
-rw-r--r--plugins/org.eclipse.osee.ats.rest/src/org/eclipse/osee/ats/rest/internal/config/ReportResource.java182
-rw-r--r--plugins/org.eclipse.osee.ats.rest/src/org/eclipse/osee/ats/rest/internal/config/UICountWriter.java117
-rw-r--r--plugins/org.eclipse.osee.disposition.rest/src/org/eclipse/osee/disposition/rest/resources/DispoProgramResource.java2
-rw-r--r--plugins/org.eclipse.osee.orcs.core/META-INF/MANIFEST.MF1
-rw-r--r--plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/OrcsApiImpl.java3
-rw-r--r--plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/change/LoadDeltasBetweenBranches.java4
-rw-r--r--plugins/org.eclipse.osee.orcs.rest/OSGI-INF/transaction.service.xml8
-rw-r--r--plugins/org.eclipse.osee.orcs.rest/src/org/eclipse/osee/orcs/rest/internal/OrcsApplication.java2
-rw-r--r--plugins/org.eclipse.osee.orcs.rest/src/org/eclipse/osee/orcs/rest/internal/TransactionEndpointImpl.java30
-rw-r--r--plugins/org.eclipse.osee.orcs/META-INF/MANIFEST.MF1
19 files changed, 376 insertions, 14 deletions
diff --git a/plugins/org.eclipse.osee.ats.api/src/org/eclipse/osee/ats/api/program/IAtsProgramService.java b/plugins/org.eclipse.osee.ats.api/src/org/eclipse/osee/ats/api/program/IAtsProgramService.java
index 53c95a7052..68281b76ef 100644
--- a/plugins/org.eclipse.osee.ats.api/src/org/eclipse/osee/ats/api/program/IAtsProgramService.java
+++ b/plugins/org.eclipse.osee.ats.api/src/org/eclipse/osee/ats/api/program/IAtsProgramService.java
@@ -10,6 +10,7 @@
*******************************************************************************/
package org.eclipse.osee.ats.api.program;
+import java.util.List;
import org.eclipse.osee.ats.api.IAtsWorkItem;
import org.eclipse.osee.ats.api.team.IAtsTeamDefinition;
@@ -23,4 +24,6 @@ public interface IAtsProgramService {
IAtsProgram getProgram(IAtsWorkItem workItem);
IAtsProgram getProgramByGuid(String guid);
+
+ List<IAtsProgram> getAllPrograms();
}
diff --git a/plugins/org.eclipse.osee.ats.api/src/org/eclipse/osee/ats/api/workflow/IAtsBranchService.java b/plugins/org.eclipse.osee.ats.api/src/org/eclipse/osee/ats/api/workflow/IAtsBranchService.java
index 67364f730a..6345bc8c4d 100644
--- a/plugins/org.eclipse.osee.ats.api/src/org/eclipse/osee/ats/api/workflow/IAtsBranchService.java
+++ b/plugins/org.eclipse.osee.ats.api/src/org/eclipse/osee/ats/api/workflow/IAtsBranchService.java
@@ -128,6 +128,10 @@ public interface IAtsBranchService {
ITransaction getBaseTransaction(IOseeBranch branch);
+ ITransaction getSourceTransaction(IOseeBranch branch);
+
String getBranchName(IAtsTeamWorkflow teamWf);
+ // TransactionRecord getHeadTransaction(IOseeBranch branch);
+
}
diff --git a/plugins/org.eclipse.osee.ats.core.client/src/org/eclipse/osee/ats/core/client/branch/internal/AtsBranchServiceImpl.java b/plugins/org.eclipse.osee.ats.core.client/src/org/eclipse/osee/ats/core/client/branch/internal/AtsBranchServiceImpl.java
index 8f3989a30d..96433324c0 100644
--- a/plugins/org.eclipse.osee.ats.core.client/src/org/eclipse/osee/ats/core/client/branch/internal/AtsBranchServiceImpl.java
+++ b/plugins/org.eclipse.osee.ats.core.client/src/org/eclipse/osee/ats/core/client/branch/internal/AtsBranchServiceImpl.java
@@ -162,4 +162,9 @@ public class AtsBranchServiceImpl extends AbstractAtsBranchService {
return BranchManager.getBranch(destinationBranch).getBaseTransaction();
}
+ @Override
+ public ITransaction getSourceTransaction(IOseeBranch branch) {
+ return BranchManager.getBranch(branch).getSourceTransaction();
+ }
+
}
diff --git a/plugins/org.eclipse.osee.ats.core/META-INF/MANIFEST.MF b/plugins/org.eclipse.osee.ats.core/META-INF/MANIFEST.MF
index a189f05fe8..d66ca70f43 100644
--- a/plugins/org.eclipse.osee.ats.core/META-INF/MANIFEST.MF
+++ b/plugins/org.eclipse.osee.ats.core/META-INF/MANIFEST.MF
@@ -8,6 +8,7 @@ Bundle-RequiredExecutionEnvironment: JavaSE-1.8
Import-Package: org.eclipse.osee.framework.core.data,
org.eclipse.osee.framework.core.enums,
org.eclipse.osee.framework.core.exception,
+ org.eclipse.osee.framework.core.model,
org.eclipse.osee.framework.core.util,
org.eclipse.osee.framework.jdk.core.type,
org.eclipse.osee.framework.jdk.core.util,
diff --git a/plugins/org.eclipse.osee.ats.core/src/org/eclipse/osee/ats/core/util/AbstractAtsBranchService.java b/plugins/org.eclipse.osee.ats.core/src/org/eclipse/osee/ats/core/util/AbstractAtsBranchService.java
index 26ce356eec..c0b15c5265 100644
--- a/plugins/org.eclipse.osee.ats.core/src/org/eclipse/osee/ats/core/util/AbstractAtsBranchService.java
+++ b/plugins/org.eclipse.osee.ats.core/src/org/eclipse/osee/ats/core/util/AbstractAtsBranchService.java
@@ -84,7 +84,7 @@ public abstract class AbstractAtsBranchService implements IAtsBranchService {
/**
* Return working branch associated with SMA whether it is committed or not; This data is cached across all workflows
* with the cache being updated by local and remote events.
- *
+ *
* @param force == true does not used cached value
*/
@Override
@@ -632,4 +632,8 @@ public abstract class AbstractAtsBranchService implements IAtsBranchService {
}
}
+ // @Override
+ // public TransactionRecord getHeadTransaction(IOseeBranch branch) {
+ // return null;
+ // }
}
diff --git a/plugins/org.eclipse.osee.ats.impl/src/org/eclipse/osee/ats/impl/internal/util/AtsBranchServiceImpl.java b/plugins/org.eclipse.osee.ats.impl/src/org/eclipse/osee/ats/impl/internal/util/AtsBranchServiceImpl.java
index 97c94722f3..938c8f5ecc 100644
--- a/plugins/org.eclipse.osee.ats.impl/src/org/eclipse/osee/ats/impl/internal/util/AtsBranchServiceImpl.java
+++ b/plugins/org.eclipse.osee.ats.impl/src/org/eclipse/osee/ats/impl/internal/util/AtsBranchServiceImpl.java
@@ -164,4 +164,10 @@ public class AtsBranchServiceImpl extends AbstractAtsBranchService {
TransactionQuery txQuery = orcsApi.getQueryFactory().transactionQuery();
return txQuery.andBranch(branch).andIs(TransactionDetailsType.Baselined).getResults().getExactlyOne();
}
+
+ @Override
+ public ITransaction getSourceTransaction(IOseeBranch branch) {
+ TransactionQuery txQuery = orcsApi.getQueryFactory().transactionQuery();
+ return txQuery.andBranch(branch).andIs(TransactionDetailsType.Baselined).getResults().getExactlyOne();
+ }
}
diff --git a/plugins/org.eclipse.osee.ats.rest/META-INF/MANIFEST.MF b/plugins/org.eclipse.osee.ats.rest/META-INF/MANIFEST.MF
index 867984f6ce..e36e23d6a6 100644
--- a/plugins/org.eclipse.osee.ats.rest/META-INF/MANIFEST.MF
+++ b/plugins/org.eclipse.osee.ats.rest/META-INF/MANIFEST.MF
@@ -29,9 +29,11 @@ Import-Package: com.google.gson;version="2.1.0",
org.eclipse.osee.framework.core.data,
org.eclipse.osee.framework.core.enums,
org.eclipse.osee.framework.core.exception,
+ org.eclipse.osee.framework.core.model.change,
org.eclipse.osee.framework.core.util,
org.eclipse.osee.framework.jdk.core.type,
org.eclipse.osee.framework.jdk.core.util,
+ org.eclipse.osee.framework.jdk.core.util.io.xml,
org.eclipse.osee.http.jetty,
org.eclipse.osee.jaxrs,
org.eclipse.osee.jaxrs.mvc,
@@ -39,6 +41,7 @@ Import-Package: com.google.gson;version="2.1.0",
org.eclipse.osee.logger,
org.eclipse.osee.orcs,
org.eclipse.osee.orcs.data,
+ org.eclipse.osee.orcs.rest.model,
org.eclipse.osee.orcs.search,
org.eclipse.osee.orcs.transaction,
org.eclipse.osee.orcs.utility,
diff --git a/plugins/org.eclipse.osee.ats.rest/OSGI-INF/ats.rest.application.xml b/plugins/org.eclipse.osee.ats.rest/OSGI-INF/ats.rest.application.xml
index 762f940d45..ed507b75bd 100644
--- a/plugins/org.eclipse.osee.ats.rest/OSGI-INF/ats.rest.application.xml
+++ b/plugins/org.eclipse.osee.ats.rest/OSGI-INF/ats.rest.application.xml
@@ -8,4 +8,5 @@
<reference bind="setLogger" cardinality="1..1" interface="org.eclipse.osee.logger.Log" name="Log" policy="static"/>
<reference bind="setAtsServer" cardinality="1..1" interface="org.eclipse.osee.ats.impl.IAtsServer" name="IAtsServer" policy="static"/>
<reference bind="setCpaServiceRegistry" cardinality="1..1" interface="org.eclipse.osee.ats.rest.internal.cpa.CpaServiceRegistry" name="CpaServiceRegistry" policy="static"/>
+ <reference bind="setTransactionEndpoint" cardinality="1..1" interface="org.eclipse.osee.orcs.rest.model.TransactionEndpoint" name="TransactionEndpoint" policy="static"/>
</scr:component>
diff --git a/plugins/org.eclipse.osee.ats.rest/src/org/eclipse/osee/ats/rest/internal/AtsApplication.java b/plugins/org.eclipse.osee.ats.rest/src/org/eclipse/osee/ats/rest/internal/AtsApplication.java
index b998fda368..aca58278e1 100644
--- a/plugins/org.eclipse.osee.ats.rest/src/org/eclipse/osee/ats/rest/internal/AtsApplication.java
+++ b/plugins/org.eclipse.osee.ats.rest/src/org/eclipse/osee/ats/rest/internal/AtsApplication.java
@@ -20,6 +20,7 @@ import org.eclipse.osee.ats.rest.internal.config.ActionableItemResource;
import org.eclipse.osee.ats.rest.internal.config.ConvertCreateUpdateAtsConfig;
import org.eclipse.osee.ats.rest.internal.config.ConvertResource;
import org.eclipse.osee.ats.rest.internal.config.ProgramResource;
+import org.eclipse.osee.ats.rest.internal.config.ReportResource;
import org.eclipse.osee.ats.rest.internal.config.TeamResource;
import org.eclipse.osee.ats.rest.internal.config.UserResource;
import org.eclipse.osee.ats.rest.internal.config.VersionResource;
@@ -32,6 +33,7 @@ import org.eclipse.osee.framework.jdk.core.type.IResourceRegistry;
import org.eclipse.osee.framework.jdk.core.type.ResourceRegistry;
import org.eclipse.osee.logger.Log;
import org.eclipse.osee.orcs.OrcsApi;
+import org.eclipse.osee.orcs.rest.model.TransactionEndpoint;
import org.eclipse.osee.template.engine.OseeTemplateTokens;
/**
@@ -46,6 +48,7 @@ public class AtsApplication extends Application {
private OrcsApi orcsApi;
private IAtsServer atsServer;
private CpaServiceRegistry cpaRegistry;
+ private TransactionEndpoint transactionEndpoint;
public void setOrcsApi(OrcsApi orcsApi) {
this.orcsApi = orcsApi;
@@ -63,7 +66,13 @@ public class AtsApplication extends Application {
this.cpaRegistry = cpaRegistry;
}
+ public void setTransactionEndpoint(TransactionEndpoint transactionEndpoint) {
+ System.out.println("Satisfied");
+ this.transactionEndpoint = transactionEndpoint;
+ }
+
public void start() {
+ System.out.println("Strating ATS");
IResourceRegistry registry = new ResourceRegistry();
OseeTemplateTokens.register(registry);
@@ -89,6 +98,8 @@ public class AtsApplication extends Application {
singletons.add(new AtsEndpointImpl(atsServer, logger, registry, cpaRegistry));
singletons.add(new ActionUiResource(atsServer, logger));
+
+ singletons.add(new ReportResource(orcsApi, transactionEndpoint, atsServer));
}
public void stop() {
diff --git a/plugins/org.eclipse.osee.ats.rest/src/org/eclipse/osee/ats/rest/internal/config/ReportResource.java b/plugins/org.eclipse.osee.ats.rest/src/org/eclipse/osee/ats/rest/internal/config/ReportResource.java
new file mode 100644
index 0000000000..d48b40ede3
--- /dev/null
+++ b/plugins/org.eclipse.osee.ats.rest/src/org/eclipse/osee/ats/rest/internal/config/ReportResource.java
@@ -0,0 +1,182 @@
+/*
+ * Created on Jun 3, 2015
+ *
+ * PLACE_YOUR_DISTRIBUTION_STATEMENT_RIGHT_HERE
+ */
+package org.eclipse.osee.ats.rest.internal.config;
+
+import static org.eclipse.osee.framework.core.enums.CoreAttributeTypes.WordTemplateContent;
+import java.io.IOException;
+import java.io.OutputStream;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import javax.ws.rs.GET;
+import javax.ws.rs.Path;
+import javax.ws.rs.Produces;
+import javax.ws.rs.WebApplicationException;
+import javax.ws.rs.core.MediaType;
+import javax.ws.rs.core.Response;
+import javax.ws.rs.core.StreamingOutput;
+import org.eclipse.osee.ats.impl.IAtsServer;
+import org.eclipse.osee.framework.core.data.IArtifactType;
+import org.eclipse.osee.framework.core.data.IAttributeType;
+import org.eclipse.osee.framework.core.data.IOseeBranch;
+import org.eclipse.osee.framework.core.enums.ModificationType;
+import org.eclipse.osee.framework.core.model.change.ChangeItem;
+import org.eclipse.osee.framework.core.model.change.ChangeType;
+import org.eclipse.osee.framework.jdk.core.type.OseeCoreException;
+import org.eclipse.osee.framework.jdk.core.type.Pair;
+import org.eclipse.osee.orcs.OrcsApi;
+import org.eclipse.osee.orcs.data.ArtifactTypes;
+import org.eclipse.osee.orcs.data.AttributeTypes;
+import org.eclipse.osee.orcs.data.TransactionReadable;
+import org.eclipse.osee.orcs.rest.model.CompareResults;
+import org.eclipse.osee.orcs.rest.model.TransactionEndpoint;
+import org.eclipse.osee.orcs.search.TransactionQuery;
+
+/**
+ * @author Angel Avila
+ */
+@Path("uicount")
+public class ReportResource {
+
+ private final OrcsApi orcsApi;
+ private final TransactionEndpoint transactionService;
+ private final IAtsServer atsServer;
+
+ public ReportResource(OrcsApi orcsApi, TransactionEndpoint transactionService, IAtsServer atsServer) {
+ this.orcsApi = orcsApi;
+ this.transactionService = transactionService;
+ this.atsServer = atsServer;
+ }
+
+ @GET
+ @Produces(MediaType.APPLICATION_OCTET_STREAM)
+ public Response getUiCount() throws OseeCoreException {
+ long branchUuid = 14866;
+ List<ChangeItem> changes = getChanges(branchUuid);
+ Set<Long> newArts = new HashSet<Long>();
+ Set<Long> modArts = new HashSet<Long>();
+ Set<Long> deletedArts = new HashSet<Long>();
+
+ Set<Long> types = new HashSet<Long>();
+ for (ChangeItem c : changes) {
+ types.add(c.getItemTypeId());
+ }
+
+ Map<Integer, Pair<ChangeItem, Set<ChangeItem>>> artToChanges =
+ new HashMap<Integer, Pair<ChangeItem, Set<ChangeItem>>>();
+
+ buildArtIdToChangeMap(changes, artToChanges);
+ buildLists(artToChanges, newArts, modArts, deletedArts);
+
+ final UICountWriter writer = new UICountWriter(orcsApi);
+ final String fileName = String.format("STRS_Report_%s", System.currentTimeMillis());
+
+ StreamingOutput streamingOutput = new StreamingOutput() {
+
+ @Override
+ public void write(OutputStream outputStream) throws WebApplicationException, IOException {
+ writer.write(branchUuid, newArts, modArts, deletedArts, outputStream);
+ outputStream.flush();
+ }
+ };
+ String contentDisposition =
+ String.format("attachment; filename=\"%s.xml\"; creation-date=\"%s\"", fileName, new Date());
+ return Response.ok(streamingOutput).header("Content-Disposition", contentDisposition).type("application/xml").build();
+ }
+
+ private void buildArtIdToChangeMap(List<ChangeItem> changes, Map<Integer, Pair<ChangeItem, Set<ChangeItem>>> artToChanges) {
+ for (ChangeItem change : changes) {
+ int artId = change.getArtId();
+ ChangeType changeType = change.getChangeType();
+ if (changeType.isArtifactChange()) {
+ if (!artToChanges.containsKey(artId)) {
+ artToChanges.put(artId, new Pair<>(change, new HashSet<ChangeItem>()));
+ } else {
+ // This entry was added by an attribute change for this art so the changeType hasn't been set
+ Pair<ChangeItem, Set<ChangeItem>> pair = artToChanges.get(artId);
+ pair.setFirst(change);
+ // artToChanges.put(artId, pair);// maybe don't need this line
+ }
+ } else if (changeType.isAttributeChange()) {
+ if (!artToChanges.containsKey(artId)) {
+ Set<ChangeItem> changeSet = new HashSet<ChangeItem>();
+ changeSet.add(change);
+ artToChanges.put(artId, new Pair<>(null, changeSet));
+ } else {
+ Pair<ChangeItem, Set<ChangeItem>> pair = artToChanges.get(artId);
+ Set<ChangeItem> changeSet = pair.getSecond();
+ changeSet.add(change);
+ // artToChanges.put(artId, pair);// maybe don't need this line
+ }
+ }
+
+ }
+ }
+
+ private void buildLists(Map<Integer, Pair<ChangeItem, Set<ChangeItem>>> artToChanges, Set<Long> newArts, Set<Long> modArts, Set<Long> deletedArts) {
+ AttributeTypes attributeTypes = orcsApi.getOrcsTypes().getAttributeTypes();
+ ArtifactTypes artifactTypes = orcsApi.getOrcsTypes().getArtifactTypes();
+
+ for (Integer artId : artToChanges.keySet()) {
+ Pair<ChangeItem, Set<ChangeItem>> pair = artToChanges.get(artId);
+ ChangeItem artChange = pair.getFirst();
+ ModificationType modType = artChange.getNetChange().getModType();
+
+ if (modType.equals(ModificationType.NEW)) {
+ newArts.add((long) artId);
+ } else if (modType.equals(ModificationType.DELETED)) {
+ deletedArts.add((long) artId);
+ } else if (modType.equals(ModificationType.MODIFIED) && weCare(artChange, pair.getSecond(), attributeTypes,
+ artifactTypes)) {
+ modArts.add((long) artId);
+ }
+ }
+
+ }
+
+ private boolean weCare(ChangeItem artChange, Set<ChangeItem> attrChanges, AttributeTypes attributeTypes, ArtifactTypes artTypes) {
+ boolean toReturn = false;
+
+ // Was a synthetic artifact change added by AddArtifactChangeDataCallable
+ IArtifactType artType = artTypes.getByUuid(artChange.getItemTypeId());
+ // if ((artType != null && artType.matches(AbstractSoftwareRequirement)) || artChange.getItemTypeId() == -1) {
+ for (ChangeItem change : attrChanges) {
+ IAttributeType attrType = attributeTypes.getByUuid(change.getItemTypeId());
+ if (attrType.matches(WordTemplateContent)) {
+ toReturn = true;
+ break;
+ }
+ }
+ // } else {
+ // System.out.println(artType);
+ // }
+
+ return toReturn;
+ }
+
+ private List<ChangeItem> getChanges(long branchUuid) {
+ TransactionQuery transactionQuery2 = orcsApi.getQueryFactory().transactionQuery();
+ TransactionQuery transactionQuery3 = orcsApi.getQueryFactory().transactionQuery();
+ IOseeBranch branchReadable =
+ orcsApi.getQueryFactory().branchQuery().andUuids(branchUuid).getResults().getExactlyOne();
+
+ IOseeBranch parentBranch = atsServer.getBranchService().getParentBranch(branchReadable);
+
+ TransactionReadable startTx = transactionQuery2.andIsHead(branchReadable).getResults().getExactlyOne();
+ Integer start = startTx.getLocalId();
+
+ TransactionReadable endTx = transactionQuery3.andIsHead(parentBranch).getResults().getExactlyOne();
+ Integer end = endTx.getLocalId();
+
+ CompareResults results = transactionService.compareTxs(start, end);
+
+ return results.getChanges();
+ }
+
+}
diff --git a/plugins/org.eclipse.osee.ats.rest/src/org/eclipse/osee/ats/rest/internal/config/UICountWriter.java b/plugins/org.eclipse.osee.ats.rest/src/org/eclipse/osee/ats/rest/internal/config/UICountWriter.java
new file mode 100644
index 0000000000..b5eccc4a83
--- /dev/null
+++ b/plugins/org.eclipse.osee.ats.rest/src/org/eclipse/osee/ats/rest/internal/config/UICountWriter.java
@@ -0,0 +1,117 @@
+/*
+ * Created on Jun 5, 2015
+ *
+ * PLACE_YOUR_DISTRIBUTION_STATEMENT_RIGHT_HERE
+ */
+package org.eclipse.osee.ats.rest.internal.config;
+
+import java.io.OutputStream;
+import java.io.OutputStreamWriter;
+import java.io.Writer;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Set;
+import org.eclipse.osee.framework.core.data.IArtifactType;
+import org.eclipse.osee.framework.core.enums.CoreArtifactTypes;
+import org.eclipse.osee.framework.core.enums.CoreAttributeTypes;
+import org.eclipse.osee.framework.jdk.core.type.OseeCoreException;
+import org.eclipse.osee.framework.jdk.core.type.ResultSet;
+import org.eclipse.osee.framework.jdk.core.util.io.xml.ExcelXmlWriter;
+import org.eclipse.osee.orcs.OrcsApi;
+import org.eclipse.osee.orcs.data.ArtifactReadable;
+
+public class UICountWriter {
+
+ private final OrcsApi orcsApi;
+
+ public UICountWriter(OrcsApi orcsApi) {
+ this.orcsApi = orcsApi;
+ }
+
+ public void write(long branchUuid, Set<Long> newArts, Set<Long> modifiedArts, Set<Long> deletedArts, OutputStream outputStream) {
+ try {
+ Writer writer = new OutputStreamWriter(outputStream, "UTF-8");
+ ExcelXmlWriter sheetWriter = new ExcelXmlWriter(writer);
+
+ String[] headers = getHeaders();
+ int columns = headers.length;
+ sheetWriter.startSheet("STRS Report", headers.length);
+ sheetWriter.writeRow((Object[]) headers);
+
+ List<IArtifactType> types = getTypes();
+
+ if (!newArts.isEmpty()) {
+ ResultSet<ArtifactReadable> newArtifacts =
+ orcsApi.getQueryFactory().fromBranch(branchUuid).andTypeEquals(types).andUuids(newArts).getResults();
+ for (ArtifactReadable art : newArtifacts) {
+ String[] row = new String[columns];
+ int index = 0;
+
+ row[index++] = art.getName();
+ row[index++] = "NEW";
+ row[index++] = art.getAttributeValues(CoreAttributeTypes.Partition).toString();
+ row[index++] = art.getArtifactType().toString();
+ sheetWriter.writeRow((Object[]) row);
+ }
+ }
+
+ if (!modifiedArts.isEmpty()) {
+ ResultSet<ArtifactReadable> modifiedArtifacts =
+ orcsApi.getQueryFactory().fromBranch(branchUuid).andTypeEquals(types).andUuids(modifiedArts).getResults();
+ for (ArtifactReadable art : modifiedArtifacts) {
+ String[] row = new String[columns];
+ int index = 0;
+
+ row[index++] = art.getName();
+ row[index++] = "MODIFIED";
+ row[index++] = art.getAttributeValues(CoreAttributeTypes.Partition).toString();
+ row[index++] = art.getArtifactType().toString();
+ sheetWriter.writeRow((Object[]) row);
+ }
+ }
+
+ if (!deletedArts.isEmpty()) {
+ ResultSet<ArtifactReadable> deletedArtifacts =
+ orcsApi.getQueryFactory().fromBranch(branchUuid).andTypeEquals(types).andUuids(deletedArts).getResults();
+ for (ArtifactReadable art : deletedArtifacts) {
+ String[] row = new String[columns];
+ int index = 0;
+
+ row[index++] = art.getName();
+ row[index++] = "DELETED";
+ row[index++] = art.getAttributeValues(CoreAttributeTypes.Partition).toString();
+ row[index++] = art.getArtifactType().toString();
+ sheetWriter.writeRow((Object[]) row);
+ }
+ }
+
+ sheetWriter.endSheet();
+ sheetWriter.endWorkbook();
+ } catch (Exception ex) {
+ throw new OseeCoreException(ex);
+ }
+ }
+
+ private List<IArtifactType> getTypes() {
+ List<IArtifactType> types = new ArrayList<IArtifactType>();
+
+ types.add(CoreArtifactTypes.SoftwareRequirement);
+ types.add(CoreArtifactTypes.SoftwareRequirementDataDefinition);
+ types.add(CoreArtifactTypes.SoftwareRequirementDrawing);
+ types.add(CoreArtifactTypes.SoftwareRequirementFunction);
+ types.add(CoreArtifactTypes.SoftwareRequirementPlainText);
+ types.add(CoreArtifactTypes.SoftwareRequirementProcedure);
+ types.add(CoreArtifactTypes.Design);
+ types.add(CoreArtifactTypes.SoftwareDesign);
+ types.add(CoreArtifactTypes.SystemDesign);
+ types.add(CoreArtifactTypes.SubsystemDesign);
+
+ return types;
+ }
+
+ private static String[] getHeaders() {
+ String[] toReturn = {"Name", "Mod Type", "Partition", "Type"};
+ return toReturn;
+ }
+
+}
diff --git a/plugins/org.eclipse.osee.disposition.rest/src/org/eclipse/osee/disposition/rest/resources/DispoProgramResource.java b/plugins/org.eclipse.osee.disposition.rest/src/org/eclipse/osee/disposition/rest/resources/DispoProgramResource.java
index a8aafb7abb..7f0ec30af1 100644
--- a/plugins/org.eclipse.osee.disposition.rest/src/org/eclipse/osee/disposition/rest/resources/DispoProgramResource.java
+++ b/plugins/org.eclipse.osee.disposition.rest/src/org/eclipse/osee/disposition/rest/resources/DispoProgramResource.java
@@ -41,7 +41,7 @@ public class DispoProgramResource {
/**
* Get all Disposition Programs as JSON
- *
+ *
* @return The Disposition Programs found
* @throws JSONException
* @response.representation.200.doc OK, Found Disposition Program
diff --git a/plugins/org.eclipse.osee.orcs.core/META-INF/MANIFEST.MF b/plugins/org.eclipse.osee.orcs.core/META-INF/MANIFEST.MF
index c066ee3a59..24c7d65810 100644
--- a/plugins/org.eclipse.osee.orcs.core/META-INF/MANIFEST.MF
+++ b/plugins/org.eclipse.osee.orcs.core/META-INF/MANIFEST.MF
@@ -37,6 +37,7 @@ Import-Package: com.google.common.base;version="15.0.0",
org.eclipse.osee.logger,
org.eclipse.osee.orcs,
org.eclipse.osee.orcs.data,
+ org.eclipse.osee.orcs.rest.model,
org.eclipse.osee.orcs.script.dsl,
org.eclipse.osee.orcs.script.dsl.orcsScriptDsl,
org.eclipse.osee.orcs.script.dsl.orcsScriptDsl.util,
diff --git a/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/OrcsApiImpl.java b/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/OrcsApiImpl.java
index f6652927b4..95afe53476 100644
--- a/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/OrcsApiImpl.java
+++ b/plugins/org.eclipse.osee.orcs.core/src/org/eclipse/osee/orcs/core/internal/OrcsApiImpl.java
@@ -267,8 +267,7 @@ public class OrcsApiImpl implements OrcsApi {
}
};
QueryFactory queryFactory = getQueryFactory();
- return new OrcsBranchImpl(logger, session, module.getBranchDataStore(), queryFactory, systemUser,
- getOrcsTypes());
+ return new OrcsBranchImpl(logger, session, module.getBranchDataStore(), queryFactory, systemUser, getOrcsTypes());
}
@Override
diff --git a/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/change/LoadDeltasBetweenBranches.java b/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/change/LoadDeltasBetweenBranches.java
index 95fcc3ed3c..d28f848919 100644
--- a/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/change/LoadDeltasBetweenBranches.java
+++ b/plugins/org.eclipse.osee.orcs.db/src/org/eclipse/osee/orcs/db/internal/change/LoadDeltasBetweenBranches.java
@@ -182,8 +182,8 @@ public class LoadDeltasBetweenBranches extends AbstractDatastoreCallable<List<Ch
String valueColumnName = columnValueName != null ? "item." + columnValueName + "," : "";
query =
"select " + valueColumnName + "item." + idColumnName + ", txs.gamma_id, txs.mod_type, txs.transaction_id from osee_join_id idj, " //
- + tableName + " item, osee_txs txs where idj.query_id = ? and idj.id = item." + idColumnName + //
- " and item.gamma_id = txs.gamma_id and txs.tx_current = ? and txs.branch_id = ? order by idj.id, txs.transaction_id asc";
+ + tableName + " item, osee_txs txs where idj.query_id = ? and idj.id = item." + idColumnName + //
+ " and item.gamma_id = txs.gamma_id and txs.tx_current = ? and txs.branch_id = ? order by idj.id, txs.transaction_id asc";
chStmt.runPreparedQuery(JdbcConstants.JDBC__MAX_FETCH_SIZE, query, idJoin.getQueryId(),
TxChange.NOT_CURRENT.getValue(), sourceBranchId);
diff --git a/plugins/org.eclipse.osee.orcs.rest/OSGI-INF/transaction.service.xml b/plugins/org.eclipse.osee.orcs.rest/OSGI-INF/transaction.service.xml
new file mode 100644
index 0000000000..7cefac828b
--- /dev/null
+++ b/plugins/org.eclipse.osee.orcs.rest/OSGI-INF/transaction.service.xml
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.1.0" activate="start" deactivate="stop">
+ <implementation class="org.eclipse.osee.orcs.rest.internal.TransactionEndpointImpl"/>
+ <service>
+ <provide interface="org.eclipse.osee.orcs.rest.model.TransactionEndpoint"/>
+ </service>
+ <reference bind="setOrcsApi" cardinality="1..1" interface="org.eclipse.osee.orcs.OrcsApi" name="OrcsApi" policy="static"/>
+</scr:component>
diff --git a/plugins/org.eclipse.osee.orcs.rest/src/org/eclipse/osee/orcs/rest/internal/OrcsApplication.java b/plugins/org.eclipse.osee.orcs.rest/src/org/eclipse/osee/orcs/rest/internal/OrcsApplication.java
index 382b6a337f..ab7e2961f7 100644
--- a/plugins/org.eclipse.osee.orcs.rest/src/org/eclipse/osee/orcs/rest/internal/OrcsApplication.java
+++ b/plugins/org.eclipse.osee.orcs.rest/src/org/eclipse/osee/orcs/rest/internal/OrcsApplication.java
@@ -21,7 +21,7 @@ import org.eclipse.osee.orcs.OrcsApi;
/**
* Get application.wadl at this context to get rest documentation
- *
+ *
* @author Roberto E. Escobar
*/
@ApplicationPath("orcs")
diff --git a/plugins/org.eclipse.osee.orcs.rest/src/org/eclipse/osee/orcs/rest/internal/TransactionEndpointImpl.java b/plugins/org.eclipse.osee.orcs.rest/src/org/eclipse/osee/orcs/rest/internal/TransactionEndpointImpl.java
index 7230ef6415..7d0b157ec3 100644
--- a/plugins/org.eclipse.osee.orcs.rest/src/org/eclipse/osee/orcs/rest/internal/TransactionEndpointImpl.java
+++ b/plugins/org.eclipse.osee.orcs.rest/src/org/eclipse/osee/orcs/rest/internal/TransactionEndpointImpl.java
@@ -19,10 +19,8 @@ import java.util.HashSet;
import java.util.List;
import java.util.Set;
import java.util.concurrent.Callable;
-import javax.ws.rs.core.Context;
import javax.ws.rs.core.Response;
import javax.ws.rs.core.Response.Status;
-import javax.ws.rs.core.UriInfo;
import org.eclipse.osee.framework.core.enums.CoreBranches;
import org.eclipse.osee.framework.core.model.change.ChangeItem;
import org.eclipse.osee.framework.jdk.core.type.ResultSet;
@@ -48,19 +46,37 @@ import com.google.common.collect.Sets.SetView;
*/
public class TransactionEndpointImpl implements TransactionEndpoint {
- private final OrcsApi orcsApi;
+ private OrcsApi orcsApi;
- @Context
- private UriInfo uriInfo;
+ // @Context
+ // private UriInfo uriInfo;
+ public TransactionEndpointImpl() {
+
+ }
+
+ // Might need to remove this
public TransactionEndpointImpl(OrcsApi orcsApi) {
this.orcsApi = orcsApi;
}
- protected void setUriInfo(UriInfo uriInfo) {
- this.uriInfo = uriInfo;
+ public void setOrcsApi(OrcsApi orcsApi) {
+ this.orcsApi = orcsApi;
}
+ public void start() {
+ System.out.println("Starting");
+ //
+ }
+
+ public void stop() {
+ //
+ }
+
+ // protected void setUriInfo(UriInfo uriInfo) {
+ // this.uriInfo = uriInfo;
+ // }
+
private TransactionQuery newTxQuery() {
return orcsApi.getQueryFactory().transactionQuery();
}
diff --git a/plugins/org.eclipse.osee.orcs/META-INF/MANIFEST.MF b/plugins/org.eclipse.osee.orcs/META-INF/MANIFEST.MF
index 76fff453c2..e10dd47176 100644
--- a/plugins/org.eclipse.osee.orcs/META-INF/MANIFEST.MF
+++ b/plugins/org.eclipse.osee.orcs/META-INF/MANIFEST.MF
@@ -16,6 +16,7 @@ Import-Package: com.google.gson;version="2.1.0",
org.eclipse.osee.framework.jdk.core.type,
org.eclipse.osee.framework.jdk.core.util,
org.eclipse.osee.framework.resource.management,
+ org.eclipse.osee.orcs.rest.model,
org.json
Export-Package: org.eclipse.osee.orcs,
org.eclipse.osee.orcs.data,

Back to the top