diff options
Diffstat (limited to 'plugins')
24 files changed, 817 insertions, 3 deletions
diff --git a/plugins/org.eclipse.osee.ats.api/META-INF/MANIFEST.MF b/plugins/org.eclipse.osee.ats.api/META-INF/MANIFEST.MF index d3c305ebdde..3204635613b 100644 --- a/plugins/org.eclipse.osee.ats.api/META-INF/MANIFEST.MF +++ b/plugins/org.eclipse.osee.ats.api/META-INF/MANIFEST.MF @@ -9,9 +9,11 @@ Export-Package: org.eclipse.osee.ats.api, org.eclipse.osee.ats.api.ai, org.eclipse.osee.ats.api.commit, org.eclipse.osee.ats.api.config, + org.eclipse.osee.ats.api.cpa, org.eclipse.osee.ats.api.data, org.eclipse.osee.ats.api.ev, org.eclipse.osee.ats.api.notify, + org.eclipse.osee.ats.api.program, org.eclipse.osee.ats.api.query, org.eclipse.osee.ats.api.review, org.eclipse.osee.ats.api.rule, diff --git a/plugins/org.eclipse.osee.ats.api/src/org/eclipse/osee/ats/api/cpa/IAtsCpaDecision.java b/plugins/org.eclipse.osee.ats.api/src/org/eclipse/osee/ats/api/cpa/IAtsCpaDecision.java new file mode 100644 index 00000000000..a5658f33856 --- /dev/null +++ b/plugins/org.eclipse.osee.ats.api/src/org/eclipse/osee/ats/api/cpa/IAtsCpaDecision.java @@ -0,0 +1,31 @@ +/******************************************************************************* + * Copyright (c) 2014 Boeing. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Boeing - initial API and implementation + *******************************************************************************/ +package org.eclipse.osee.ats.api.cpa; + +public interface IAtsCpaDecision { + + public String getName(); + + public String getUuid(); + + public String getApplicability(); + + public String getRationale(); + + public String getAssignees(); + + public boolean isComplete(); + + public String completedBy(); + + public String completedDate(); + +} diff --git a/plugins/org.eclipse.osee.ats.api/src/org/eclipse/osee/ats/api/cpa/IAtsCpaProgram.java b/plugins/org.eclipse.osee.ats.api/src/org/eclipse/osee/ats/api/cpa/IAtsCpaProgram.java new file mode 100644 index 00000000000..34b2af961e9 --- /dev/null +++ b/plugins/org.eclipse.osee.ats.api/src/org/eclipse/osee/ats/api/cpa/IAtsCpaProgram.java @@ -0,0 +1,22 @@ +/******************************************************************************* + * Copyright (c) 2014 Boeing. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Boeing - initial API and implementation + *******************************************************************************/ +package org.eclipse.osee.ats.api.cpa; + +/** + * @author Donald G. Dunne + */ +public interface IAtsCpaProgram { + + public String getName(); + + public Long getUuid(); + +} diff --git a/plugins/org.eclipse.osee.ats.api/src/org/eclipse/osee/ats/api/cpa/IAtsCpaService.java b/plugins/org.eclipse.osee.ats.api/src/org/eclipse/osee/ats/api/cpa/IAtsCpaService.java new file mode 100644 index 00000000000..82822beb05d --- /dev/null +++ b/plugins/org.eclipse.osee.ats.api/src/org/eclipse/osee/ats/api/cpa/IAtsCpaService.java @@ -0,0 +1,30 @@ +/******************************************************************************* + * Copyright (c) 2014 Boeing. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Boeing - initial API and implementation + *******************************************************************************/ +package org.eclipse.osee.ats.api.cpa; + +import java.net.URI; +import java.util.List; + +/** + * @author Donald G. Dunne + */ +public interface IAtsCpaService { + + String getId(); + + List<IAtsCpaProgram> getPrograms(); + + String getConfigJson() throws Exception; + + URI getLocation(URI uri, String uuid); + + String getProgramName(String pcrId); +} diff --git a/plugins/org.eclipse.osee.ats.api/src/org/eclipse/osee/ats/api/cpa/IAtsCpaServiceProvider.java b/plugins/org.eclipse.osee.ats.api/src/org/eclipse/osee/ats/api/cpa/IAtsCpaServiceProvider.java new file mode 100644 index 00000000000..b89fc16b2d8 --- /dev/null +++ b/plugins/org.eclipse.osee.ats.api/src/org/eclipse/osee/ats/api/cpa/IAtsCpaServiceProvider.java @@ -0,0 +1,18 @@ +/******************************************************************************* + * Copyright (c) 2014 Boeing. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Boeing - initial API and implementation + *******************************************************************************/ +package org.eclipse.osee.ats.api.cpa; + +import java.util.List; + +public interface IAtsCpaServiceProvider { + + public List<IAtsCpaService> getCpaServices(); +} diff --git a/plugins/org.eclipse.osee.ats.api/src/org/eclipse/osee/ats/api/program/AtsProgram.java b/plugins/org.eclipse.osee.ats.api/src/org/eclipse/osee/ats/api/program/AtsProgram.java new file mode 100644 index 00000000000..5407eccd233 --- /dev/null +++ b/plugins/org.eclipse.osee.ats.api/src/org/eclipse/osee/ats/api/program/AtsProgram.java @@ -0,0 +1,35 @@ +/******************************************************************************* + * Copyright (c) 2014 Boeing. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Boeing - initial API and implementation + *******************************************************************************/ +package org.eclipse.osee.ats.api.program; + +import javax.xml.bind.annotation.XmlRootElement; +import org.eclipse.osee.framework.jdk.core.type.OseeCoreException; +import org.eclipse.osee.framework.jdk.core.type.UuidNamedIdentity; + +/** + * @author Donald G. Dunne + */ +@XmlRootElement +public class AtsProgram extends UuidNamedIdentity<Long> implements IAtsProgram { + + private final boolean active; + + public AtsProgram(String name, Long uuid, boolean active) { + super(uuid, name); + this.active = active; + } + + @Override + public boolean isActive() throws OseeCoreException { + return active; + } + +} diff --git a/plugins/org.eclipse.osee.ats.api/src/org/eclipse/osee/ats/api/program/IAtsProgram.java b/plugins/org.eclipse.osee.ats.api/src/org/eclipse/osee/ats/api/program/IAtsProgram.java new file mode 100644 index 00000000000..abae4c4b39e --- /dev/null +++ b/plugins/org.eclipse.osee.ats.api/src/org/eclipse/osee/ats/api/program/IAtsProgram.java @@ -0,0 +1,26 @@ +/******************************************************************************* + * Copyright (c) 2014 Boeing. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Boeing - initial API and implementation + *******************************************************************************/ +package org.eclipse.osee.ats.api.program; + +import org.eclipse.osee.framework.jdk.core.type.OseeCoreException; + +/** + * @author Donald G. Dunne + */ +public interface IAtsProgram { + + public String getName(); + + public boolean isActive() throws OseeCoreException; + + public Long getUuid(); + +} diff --git a/plugins/org.eclipse.osee.ats.core.client/META-INF/MANIFEST.MF b/plugins/org.eclipse.osee.ats.core.client/META-INF/MANIFEST.MF index 0482789fb3a..bd1022b8360 100644 --- a/plugins/org.eclipse.osee.ats.core.client/META-INF/MANIFEST.MF +++ b/plugins/org.eclipse.osee.ats.core.client/META-INF/MANIFEST.MF @@ -21,6 +21,7 @@ Import-Package: com.google.inject, org.eclipse.osee.ats.api.data, org.eclipse.osee.ats.api.ev, org.eclipse.osee.ats.api.notify, + org.eclipse.osee.ats.api.program, org.eclipse.osee.ats.api.query, org.eclipse.osee.ats.api.review, org.eclipse.osee.ats.api.rule, @@ -108,6 +109,7 @@ Export-Package: org.eclipse.osee.ats.core.client, org.eclipse.osee.ats.core.client.workflow.note, org.eclipse.osee.ats.core.client.workflow.stateitem, org.eclipse.osee.ats.core.client.workflow.transition -Require-Bundle: org.eclipse.osee.framework.skynet.core +Require-Bundle: org.eclipse.osee.framework.skynet.core, + org.eclipse.osee.ats.api Bundle-Vendor: Eclipse Open System Engineering Environment Service-Component: OSGI-INF/*.xml diff --git a/plugins/org.eclipse.osee.ats.core.client/src/org/eclipse/osee/ats/core/client/config/IAtsProgram.java b/plugins/org.eclipse.osee.ats.core.client/src/org/eclipse/osee/ats/core/client/config/IAtsProgram.java index ddf594b189f..05a7bf05664 100644 --- a/plugins/org.eclipse.osee.ats.core.client/src/org/eclipse/osee/ats/core/client/config/IAtsProgram.java +++ b/plugins/org.eclipse.osee.ats.core.client/src/org/eclipse/osee/ats/core/client/config/IAtsProgram.java @@ -17,10 +17,12 @@ import org.eclipse.osee.framework.skynet.core.artifact.Artifact; /** * @author Donald G. Dunne */ -public interface IAtsProgram { +public interface IAtsProgram extends org.eclipse.osee.ats.api.program.IAtsProgram { + @Override public String getName(); + @Override public boolean isActive() throws OseeCoreException; public Artifact getArtifact() throws OseeCoreException; 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 af97834ea0f..5c6e91d32a1 100644 --- a/plugins/org.eclipse.osee.ats.core/META-INF/MANIFEST.MF +++ b/plugins/org.eclipse.osee.ats.core/META-INF/MANIFEST.MF @@ -15,9 +15,11 @@ Import-Package: com.google.inject, org.eclipse.osee.ats.api, org.eclipse.osee.ats.api.ai, org.eclipse.osee.ats.api.commit, + org.eclipse.osee.ats.api.cpa, org.eclipse.osee.ats.api.data, org.eclipse.osee.ats.api.ev, org.eclipse.osee.ats.api.notify, + org.eclipse.osee.ats.api.program, org.eclipse.osee.ats.api.review, org.eclipse.osee.ats.api.rule, org.eclipse.osee.ats.api.team, @@ -52,6 +54,7 @@ Export-Package: org.eclipse.osee.ats.core, org.eclipse.osee.ats.core.ai, org.eclipse.osee.ats.core.column, org.eclipse.osee.ats.core.config, + org.eclipse.osee.ats.core.cpa, org.eclipse.osee.ats.core.internal.state, org.eclipse.osee.ats.core.model, org.eclipse.osee.ats.core.model.impl, diff --git a/plugins/org.eclipse.osee.ats.core/src/org/eclipse/osee/ats/core/cpa/CpaDecision.java b/plugins/org.eclipse.osee.ats.core/src/org/eclipse/osee/ats/core/cpa/CpaDecision.java new file mode 100644 index 00000000000..6bdd975cb1c --- /dev/null +++ b/plugins/org.eclipse.osee.ats.core/src/org/eclipse/osee/ats/core/cpa/CpaDecision.java @@ -0,0 +1,132 @@ +/******************************************************************************* + * Copyright (c) 2014 Boeing. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Boeing - initial API and implementation + *******************************************************************************/ +package org.eclipse.osee.ats.core.cpa; + +import javax.xml.bind.annotation.XmlRootElement; +import org.eclipse.osee.ats.api.cpa.IAtsCpaDecision; +import org.eclipse.osee.framework.jdk.core.type.UuidNamedIdentity; + +/** + * @author Donald G. Dunne + */ +@XmlRootElement +public class CpaDecision extends UuidNamedIdentity<String> implements IAtsCpaDecision { + + String applicability, rationale, assignees, pcrSystem, origPcrLocation, decisionLocation, duplicatedPcrLocation, + originatingProgram, completedBy, completedDate; + boolean complete = false; + + public CpaDecision(String id, String name) { + super(id, name); + } + + @Override + public String getRationale() { + return rationale; + } + + public void setRationale(String rationale) { + this.rationale = rationale; + } + + @Override + public boolean isComplete() { + return complete; + } + + public void setComplete(Boolean complete) { + this.complete = complete; + } + + public String getPcrSystem() { + return pcrSystem; + } + + public void setPcrSystem(String pcrSystem) { + this.pcrSystem = pcrSystem; + } + + @Override + public String getAssignees() { + return assignees; + } + + public void setAssignees(String assignees) { + this.assignees = assignees; + } + + public String getOrigPcrLocation() { + return origPcrLocation; + } + + public void setOrigPcrLocation(String origPcrLocation) { + this.origPcrLocation = origPcrLocation; + } + + public String getDecisionLocation() { + return decisionLocation; + } + + public void setDecisionLocation(String decisionLocation) { + this.decisionLocation = decisionLocation; + } + + public String getDuplicatedPcrLocation() { + return duplicatedPcrLocation; + } + + public void setDuplicatedPcrLocation(String duplicatedPcrLocation) { + this.duplicatedPcrLocation = duplicatedPcrLocation; + } + + public String getOriginatingProgram() { + return originatingProgram; + } + + public void setOriginatingProgram(String originatingProgram) { + this.originatingProgram = originatingProgram; + } + + @Override + public String completedBy() { + return null; + } + + @Override + public String completedDate() { + return null; + } + + public String getCompletedBy() { + return completedBy; + } + + public void setCompletedBy(String completedBy) { + this.completedBy = completedBy; + } + + public String getCompletedDate() { + return completedDate; + } + + public void setCompletedDate(String completedDate) { + this.completedDate = completedDate; + } + + public String getApplicability() { + return applicability; + } + + public void setApplicability(String applicability) { + this.applicability = applicability; + } + +} diff --git a/plugins/org.eclipse.osee.ats.core/src/org/eclipse/osee/ats/core/cpa/CpaFactory.java b/plugins/org.eclipse.osee.ats.core/src/org/eclipse/osee/ats/core/cpa/CpaFactory.java new file mode 100644 index 00000000000..15b88b643a1 --- /dev/null +++ b/plugins/org.eclipse.osee.ats.core/src/org/eclipse/osee/ats/core/cpa/CpaFactory.java @@ -0,0 +1,61 @@ +/******************************************************************************* + * Copyright (c) 2014 Boeing. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Boeing - initial API and implementation + *******************************************************************************/ +package org.eclipse.osee.ats.core.cpa; + +import java.util.HashMap; +import java.util.Map; +import org.eclipse.osee.ats.api.cpa.IAtsCpaDecision; +import org.eclipse.osee.ats.api.program.IAtsProgram; +import org.eclipse.osee.ats.api.workflow.IAtsTeamWorkflow; + +/** + * @author Donald G. Dunne + */ +public class CpaFactory { + + private static final Map<String, Object> idToStoreObject = new HashMap<String, Object>(500); + public static final String CPA_BASEPATH_KEY = "ats.cpa.basepath"; + + public static CpaProgram get(IAtsProgram program) { + return getProgram(program, null); + } + + public static CpaProgram getProgram(IAtsProgram program, Object storeObject) { + CpaProgram prog = new CpaProgram(program.getUuid(), program.getName()); + setStoreObject(String.valueOf(program.getUuid()), storeObject); + return prog; + } + + private static void setStoreObject(String key, Object object) { + idToStoreObject.put(key, object); + } + + public static Object getStoreObject(Object obj) { + Object result = null; + if (obj instanceof IAtsProgram) { + result = idToStoreObject.get(((IAtsProgram) obj).getUuid()); + } else if (obj instanceof IAtsCpaDecision) { + result = idToStoreObject.get(((IAtsCpaDecision) obj).getUuid()); + } + return result; + } + + public static CpaDecision getDecision(IAtsTeamWorkflow teamWf) { + return getDecision(teamWf, null); + } + + public static CpaDecision getDecision(IAtsTeamWorkflow teamWf, Object storeObject) { + CpaDecision decision = new CpaDecision(teamWf.getAtsId(), teamWf.getName()); + setStoreObject(teamWf.getAtsId(), storeObject); + return decision; + } + +} diff --git a/plugins/org.eclipse.osee.ats.core/src/org/eclipse/osee/ats/core/cpa/CpaProgram.java b/plugins/org.eclipse.osee.ats.core/src/org/eclipse/osee/ats/core/cpa/CpaProgram.java new file mode 100644 index 00000000000..ec404b1ed26 --- /dev/null +++ b/plugins/org.eclipse.osee.ats.core/src/org/eclipse/osee/ats/core/cpa/CpaProgram.java @@ -0,0 +1,24 @@ +/******************************************************************************* + * Copyright (c) 2014 Boeing. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Boeing - initial API and implementation + *******************************************************************************/ +package org.eclipse.osee.ats.core.cpa; + +import org.eclipse.osee.ats.api.cpa.IAtsCpaProgram; +import org.eclipse.osee.framework.jdk.core.type.UuidNamedIdentity; + +/** + * @author Donald G. Dunne + */ +public class CpaProgram extends UuidNamedIdentity<Long> implements IAtsCpaProgram { + + public CpaProgram(Long uuid, String name) { + super(uuid, name); + } +} diff --git a/plugins/org.eclipse.osee.ats.impl/META-INF/MANIFEST.MF b/plugins/org.eclipse.osee.ats.impl/META-INF/MANIFEST.MF index d23e8093993..f64da0f617a 100644 --- a/plugins/org.eclipse.osee.ats.impl/META-INF/MANIFEST.MF +++ b/plugins/org.eclipse.osee.ats.impl/META-INF/MANIFEST.MF @@ -65,4 +65,5 @@ Bundle-ActivationPolicy: lazy Require-Bundle: org.eclipse.core.runtime Export-Package: org.eclipse.osee.ats.impl, org.eclipse.osee.ats.impl.action, - org.eclipse.osee.ats.impl.resource + org.eclipse.osee.ats.impl.resource, + org.eclipse.osee.ats.impl.util diff --git a/plugins/org.eclipse.osee.ats.impl/src/org/eclipse/osee/ats/impl/util/AtsUtilServer.java b/plugins/org.eclipse.osee.ats.impl/src/org/eclipse/osee/ats/impl/util/AtsUtilServer.java new file mode 100644 index 00000000000..3ff3305906c --- /dev/null +++ b/plugins/org.eclipse.osee.ats.impl/src/org/eclipse/osee/ats/impl/util/AtsUtilServer.java @@ -0,0 +1,26 @@ +/******************************************************************************* + * Copyright (c) 2014 Boeing. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Boeing - initial API and implementation + *******************************************************************************/ +package org.eclipse.osee.ats.impl.util; + +import org.eclipse.osee.ats.core.util.AtsUtilCore; +import org.eclipse.osee.orcs.OrcsApi; +import org.eclipse.osee.orcs.search.QueryBuilder; + +/** + * @author Donald G. Dunne + */ +public class AtsUtilServer { + + public static QueryBuilder getQuery(OrcsApi orcsApi) { + return orcsApi.getQueryFactory(null).fromBranch(AtsUtilCore.getAtsBranch()); + } + +} 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 56decf83636..0abb3d9a60b 100644 --- a/plugins/org.eclipse.osee.ats.rest/META-INF/MANIFEST.MF +++ b/plugins/org.eclipse.osee.ats.rest/META-INF/MANIFEST.MF @@ -18,8 +18,10 @@ Import-Package: com.google.gson;version="2.1.0", org.eclipse.osee.ats.api.ai, org.eclipse.osee.ats.api.commit, org.eclipse.osee.ats.api.config, + org.eclipse.osee.ats.api.cpa, org.eclipse.osee.ats.api.data, org.eclipse.osee.ats.api.notify, + org.eclipse.osee.ats.api.program, org.eclipse.osee.ats.api.review, org.eclipse.osee.ats.api.team, org.eclipse.osee.ats.api.user, @@ -31,7 +33,9 @@ Import-Package: com.google.gson;version="2.1.0", org.eclipse.osee.ats.api.workflow.state, org.eclipse.osee.ats.api.workflow.transition, org.eclipse.osee.ats.core, + org.eclipse.osee.ats.core.column, org.eclipse.osee.ats.core.config, + org.eclipse.osee.ats.core.cpa, org.eclipse.osee.ats.core.model.impl, org.eclipse.osee.ats.core.util, org.eclipse.osee.ats.core.workdef, @@ -41,6 +45,7 @@ Import-Package: com.google.gson;version="2.1.0", org.eclipse.osee.ats.impl, org.eclipse.osee.ats.impl.action, org.eclipse.osee.ats.impl.resource, + org.eclipse.osee.ats.impl.util, org.eclipse.osee.framework.core.data, org.eclipse.osee.framework.core.enums, org.eclipse.osee.framework.core.exception, @@ -48,6 +53,8 @@ Import-Package: com.google.gson;version="2.1.0", org.eclipse.osee.framework.core.model.cache, org.eclipse.osee.framework.core.server, org.eclipse.osee.framework.core.util, + org.eclipse.osee.framework.database, + org.eclipse.osee.framework.database.core, org.eclipse.osee.framework.jdk.core.type, org.eclipse.osee.framework.jdk.core.util, org.eclipse.osee.framework.logging, diff --git a/plugins/org.eclipse.osee.ats.rest/OSGI-INF/ats.cpa.service.ref.xml b/plugins/org.eclipse.osee.ats.rest/OSGI-INF/ats.cpa.service.ref.xml new file mode 100644 index 00000000000..3de53aee57f --- /dev/null +++ b/plugins/org.eclipse.osee.ats.rest/OSGI-INF/ats.cpa.service.ref.xml @@ -0,0 +1,5 @@ +<?xml version="1.0" encoding="UTF-8"?> +<scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.1.0"> + <implementation class="org.eclipse.osee.ats.rest.internal.cpa.AtsCpaServices"/> + <reference bind="addCpaServiceProvider" cardinality="0..n" interface="org.eclipse.osee.ats.api.cpa.IAtsCpaServiceProvider" name="IAtsCpaServiceProvider" policy="dynamic"/> +</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 1b4c968f595..8623fdd9c1c 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 @@ -17,6 +17,7 @@ import javax.ws.rs.core.Application; import org.eclipse.osee.ats.impl.IAtsServer; import org.eclipse.osee.ats.impl.resource.AtsResourceTokens; import org.eclipse.osee.ats.rest.internal.build.report.resources.BuildTraceReportResource; +import org.eclipse.osee.ats.rest.internal.cpa.CpaResource; import org.eclipse.osee.ats.rest.internal.resources.ActionResource; import org.eclipse.osee.ats.rest.internal.resources.AtsUiResource; import org.eclipse.osee.ats.rest.internal.resources.ConfigResource; @@ -75,6 +76,7 @@ public class AtsApplication extends Application { singletons.add(new TeamResource(orcsApi)); singletons.add(new VersionResource(orcsApi)); singletons.add(new ConfigResource(atsServer, orcsApi, logger, registry)); + singletons.add(new CpaResource(orcsApi, atsServer, appServerMgr)); singletons.add(new AtsUiResource(registry, orcsApi)); System.out.println("ATS - Application started - " + appServerMgr.getServerUri()); diff --git a/plugins/org.eclipse.osee.ats.rest/src/org/eclipse/osee/ats/rest/internal/cpa/AtsCpaServices.java b/plugins/org.eclipse.osee.ats.rest/src/org/eclipse/osee/ats/rest/internal/cpa/AtsCpaServices.java new file mode 100644 index 00000000000..5f42de92d1d --- /dev/null +++ b/plugins/org.eclipse.osee.ats.rest/src/org/eclipse/osee/ats/rest/internal/cpa/AtsCpaServices.java @@ -0,0 +1,56 @@ +/******************************************************************************* + * Copyright (c) 2014 Boeing. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Boeing - initial API and implementation + *******************************************************************************/ +package org.eclipse.osee.ats.rest.internal.cpa; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import org.eclipse.osee.ats.api.cpa.IAtsCpaService; +import org.eclipse.osee.ats.api.cpa.IAtsCpaServiceProvider; + +/** + * @author Donald G Dunne + */ +public class AtsCpaServices { + + static List<IAtsCpaServiceProvider> serviceProviders = new ArrayList<IAtsCpaServiceProvider>(); + static Map<String, IAtsCpaService> nameToService = new HashMap<String, IAtsCpaService>(5); + + public void addCpaServiceProvider(IAtsCpaServiceProvider serviceProvider) { + serviceProviders.add(serviceProvider); + } + + public static List<IAtsCpaService> getServices() { + List<IAtsCpaService> services = new ArrayList<IAtsCpaService>(); + for (IAtsCpaServiceProvider provider : serviceProviders) { + for (IAtsCpaService service : provider.getCpaServices()) { + services.add(service); + } + } + return services; + } + + public static IAtsCpaService getService(String pcrSystem) { + IAtsCpaService service = nameToService.get(pcrSystem); + if (service == null) { + for (IAtsCpaService ser : getServices()) { + if (ser.getId().equals(pcrSystem)) { + service = ser; + nameToService.put(pcrSystem, service); + break; + } + } + } + return service; + } + +} diff --git a/plugins/org.eclipse.osee.ats.rest/src/org/eclipse/osee/ats/rest/internal/cpa/CpaResource.java b/plugins/org.eclipse.osee.ats.rest/src/org/eclipse/osee/ats/rest/internal/cpa/CpaResource.java new file mode 100644 index 00000000000..99b4572f1ea --- /dev/null +++ b/plugins/org.eclipse.osee.ats.rest/src/org/eclipse/osee/ats/rest/internal/cpa/CpaResource.java @@ -0,0 +1,181 @@ +/******************************************************************************* + * Copyright (c) 2014 Boeing. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Boeing - initial API and implementation + *******************************************************************************/ +package org.eclipse.osee.ats.rest.internal.cpa; + +import java.net.URI; +import java.util.ArrayList; +import java.util.List; +import javax.ws.rs.GET; +import javax.ws.rs.Path; +import javax.ws.rs.PathParam; +import javax.ws.rs.Produces; +import javax.ws.rs.QueryParam; +import javax.ws.rs.core.MediaType; +import javax.ws.rs.core.Response; +import javax.ws.rs.core.UriBuilder; +import org.eclipse.osee.ats.api.cpa.IAtsCpaDecision; +import org.eclipse.osee.ats.api.cpa.IAtsCpaProgram; +import org.eclipse.osee.ats.api.cpa.IAtsCpaService; +import org.eclipse.osee.ats.api.data.AtsArtifactTypes; +import org.eclipse.osee.ats.api.data.AtsAttributeTypes; +import org.eclipse.osee.ats.api.workdef.StateType; +import org.eclipse.osee.ats.api.workflow.IAtsTeamWorkflow; +import org.eclipse.osee.ats.core.cpa.CpaDecision; +import org.eclipse.osee.ats.core.cpa.CpaFactory; +import org.eclipse.osee.ats.impl.IAtsServer; +import org.eclipse.osee.ats.impl.util.AtsUtilServer; +import org.eclipse.osee.framework.core.enums.Operator; +import org.eclipse.osee.framework.core.server.IApplicationServerManager; +import org.eclipse.osee.framework.database.core.OseeInfo; +import org.eclipse.osee.framework.jdk.core.type.OseeArgumentException; +import org.eclipse.osee.framework.jdk.core.util.AHTML; +import org.eclipse.osee.framework.jdk.core.util.DateUtil; +import org.eclipse.osee.orcs.OrcsApi; +import org.eclipse.osee.orcs.data.ArtifactReadable; +import org.eclipse.osee.orcs.search.QueryBuilder; +import org.eclipse.osee.orcs.utility.RestUtil; +import org.json.JSONArray; +import org.json.JSONObject; + +/** + * Services provided for ATS Cross Program Applicability + * + * @author Donald G. Dunne + */ +@Path("cpa") +public final class CpaResource { + + private final OrcsApi orcsApi; + private final IAtsServer atsServer; + private final IApplicationServerManager appServerMgr; + + public CpaResource(OrcsApi orcsApi, IAtsServer atsServer, IApplicationServerManager appServerMgr) { + this.orcsApi = orcsApi; + this.atsServer = atsServer; + this.appServerMgr = appServerMgr; + } + + @GET + @Produces(MediaType.TEXT_HTML) + public String get() throws Exception { + return AHTML.simplePage("ATS CPA Resource"); + } + + @GET + @Path("program") + @Produces(MediaType.APPLICATION_JSON) + public List<IAtsCpaProgram> getPrograms() throws Exception { + List<IAtsCpaProgram> programs = new ArrayList<IAtsCpaProgram>(); + for (IAtsCpaService service : AtsCpaServices.getServices()) { + programs.addAll(service.getPrograms()); + } + return programs; + } + + @GET + @Path("program/{uuid}") + @Produces(MediaType.APPLICATION_JSON) + public List<IAtsCpaDecision> getDecisionByProgram(@PathParam("uuid") String uuid, @QueryParam("open") Boolean open) throws Exception { + List<IAtsCpaDecision> decisions = new ArrayList<IAtsCpaDecision>(); + QueryBuilder queryBuilder = + AtsUtilServer.getQuery(orcsApi).andTypeEquals(AtsArtifactTypes.TeamWorkflow).and( + AtsAttributeTypes.ProgramUuid, Operator.EQUAL, uuid); + if (open != null) { + queryBuilder.and(AtsAttributeTypes.CurrentStateType, Operator.EQUAL, + (open ? StateType.Working.name() : StateType.Completed.name())); + } + for (ArtifactReadable art : queryBuilder.getResults()) { + IAtsTeamWorkflow teamWf = atsServer.getWorkItemFactory().getTeamWf(art); + CpaDecision decision = CpaFactory.getDecision(teamWf, null); + decision.setApplicability(art.getSoleAttributeValue(AtsAttributeTypes.ApplicableToProgram, "")); + decision.setRationale(art.getSoleAttributeValue(AtsAttributeTypes.Decision, "")); + decision.setPcrSystem(art.getSoleAttributeValue(AtsAttributeTypes.PcrToolId, "")); + boolean completed = + art.getSoleAttributeValue(AtsAttributeTypes.CurrentStateType, "").equals(StateType.Completed.name()); + decision.setComplete(completed); + decision.setAssignees(teamWf.getStateMgr().getAssigneesStr()); + if (completed) { + decision.setCompletedBy(teamWf.getCompletedBy().getName()); + decision.setCompletedDate(DateUtil.getMMDDYY(teamWf.getCompletedDate())); + } + + // set location of decision workflow + decision.setDecisionLocation(getCpaPath().path(teamWf.getAtsId()).build().toString()); + + // set location of originating pcr + String origPcrId = art.getSoleAttributeValue(AtsAttributeTypes.OriginatingPcrId); + decision.setOrigPcrLocation(getCpaPath().path(origPcrId).queryParam("pcrSystem", decision.getPcrSystem()).build().toString()); + + // set location of duplicated pcr (if any) + String duplicatedLocation = ""; + if (art.getSoleAttributeValue(AtsAttributeTypes.DuplicatedPcrId, null) != null) { + String duplicatedPcrId = (String) art.getSoleAttributeValue(AtsAttributeTypes.DuplicatedPcrId); + duplicatedLocation = + getCpaPath().path(duplicatedPcrId).queryParam("pcrSystem", decision.getPcrSystem()).build().toString(); + } + decision.setDuplicatedPcrLocation(duplicatedLocation); + + IAtsCpaService service = AtsCpaServices.getService(decision.getPcrSystem()); + decision.setOriginatingProgram(service.getProgramName(origPcrId)); + + decisions.add(decision); + } + return decisions; + } + + public UriBuilder getCpaPath() { + return UriBuilder.fromPath(getCpaBasePath()).path("ats").path("cpa").path("decision"); + } + + public String getCpaBasePath() { + return OseeInfo.getCachedValue(CpaFactory.CPA_BASEPATH_KEY); + } + + @GET + @Path("decision/{uuid}") + @Produces(MediaType.APPLICATION_JSON) + public Response getDecision(@PathParam("uuid") String uuid, @QueryParam("pcrSystem") String pcrSystem) throws Exception { + URI uri = null; + if (pcrSystem == null) { + uri = + UriBuilder.fromUri(appServerMgr.getServerUri()).path("ats").path("action").path(uuid).path("state").build(); + } else { + IAtsCpaService service = AtsCpaServices.getService(pcrSystem); + uri = service.getLocation(appServerMgr.getServerUri(), uuid); + } + return Response.seeOther(uri).build(); + } + + @GET + @Path("config") + @Produces(MediaType.APPLICATION_JSON) + public String getConfigs() throws Exception { + JSONArray jsonArray = new JSONArray(); + for (IAtsCpaService service : AtsCpaServices.getServices()) { + JSONObject tool = new JSONObject(); + tool.put("id", service.getId()); + jsonArray.put(tool); + } + return RestUtil.jsonToPretty(jsonArray, false); + } + + @GET + @Path("config/{id}") + @Produces(MediaType.APPLICATION_JSON) + public String getConfig(@PathParam("id") String id) throws Exception { + for (IAtsCpaService service : AtsCpaServices.getServices()) { + if (service.getId().equals(id)) { + return service.getConfigJson(); + } + } + throw new OseeArgumentException("Unknown CPA configuration [%s]", id); + } +} diff --git a/plugins/org.eclipse.osee.framework.jdk.core/src/org/eclipse/osee/framework/jdk/core/type/UuidBaseIdentity.java b/plugins/org.eclipse.osee.framework.jdk.core/src/org/eclipse/osee/framework/jdk/core/type/UuidBaseIdentity.java new file mode 100644 index 00000000000..7628a1b3411 --- /dev/null +++ b/plugins/org.eclipse.osee.framework.jdk.core/src/org/eclipse/osee/framework/jdk/core/type/UuidBaseIdentity.java @@ -0,0 +1,62 @@ +/******************************************************************************* + * Copyright (c) 2014 Boeing. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Boeing - initial API and implementation + *******************************************************************************/ +package org.eclipse.osee.framework.jdk.core.type; + +/** + * @author Donald G. Dunne + */ +public class UuidBaseIdentity<T> implements UuidIdentity<T> { + private final T uuid; + + public UuidBaseIdentity(T id) { + this.uuid = id; + } + + @Override + public T getUuid() { + return uuid; + } + + @Override + public int hashCode() { + return getUuid().hashCode(); + } + + @SuppressWarnings("unchecked") + @Override + public boolean equals(Object obj) { + boolean equal = false; + if (obj instanceof UuidIdentity) { + UuidIdentity<T> identity = (UuidIdentity<T>) obj; + if (getUuid() == identity.getUuid()) { + equal = true; + } else if (getUuid() != null) { + equal = getUuid().equals(identity.getUuid()); + } + } + return equal; + } + + @Override + public String toString() { + return String.valueOf(getUuid()); + } + + @Override + public boolean matches(UuidIdentity<?>... identities) { + for (UuidIdentity<?> identity : identities) { + if (equals(identity)) { + return true; + } + } + return false; + } +}
\ No newline at end of file diff --git a/plugins/org.eclipse.osee.framework.jdk.core/src/org/eclipse/osee/framework/jdk/core/type/UuidIdentifiable.java b/plugins/org.eclipse.osee.framework.jdk.core/src/org/eclipse/osee/framework/jdk/core/type/UuidIdentifiable.java new file mode 100644 index 00000000000..7e02c0ef37f --- /dev/null +++ b/plugins/org.eclipse.osee.framework.jdk.core/src/org/eclipse/osee/framework/jdk/core/type/UuidIdentifiable.java @@ -0,0 +1,18 @@ +/******************************************************************************* + * Copyright (c) 2014 Boeing. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Boeing - initial API and implementation + *******************************************************************************/ +package org.eclipse.osee.framework.jdk.core.type; + +/** + * @author Donald G. dunne + */ +public interface UuidIdentifiable<T> extends UuidIdentity<T>, Named { + // +} diff --git a/plugins/org.eclipse.osee.framework.jdk.core/src/org/eclipse/osee/framework/jdk/core/type/UuidIdentity.java b/plugins/org.eclipse.osee.framework.jdk.core/src/org/eclipse/osee/framework/jdk/core/type/UuidIdentity.java new file mode 100644 index 00000000000..d2a1b79c39a --- /dev/null +++ b/plugins/org.eclipse.osee.framework.jdk.core/src/org/eclipse/osee/framework/jdk/core/type/UuidIdentity.java @@ -0,0 +1,23 @@ +/******************************************************************************* + * Copyright (c) 2014 Boeing. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Boeing - initial API and implementation + *******************************************************************************/ + +package org.eclipse.osee.framework.jdk.core.type; + +/** + * @author Donald G. Dunne + */ +public interface UuidIdentity<T> { + + T getUuid(); + + boolean matches(UuidIdentity<?>... identities); + +} diff --git a/plugins/org.eclipse.osee.framework.jdk.core/src/org/eclipse/osee/framework/jdk/core/type/UuidNamedIdentity.java b/plugins/org.eclipse.osee.framework.jdk.core/src/org/eclipse/osee/framework/jdk/core/type/UuidNamedIdentity.java new file mode 100644 index 00000000000..e6b8912bc35 --- /dev/null +++ b/plugins/org.eclipse.osee.framework.jdk.core/src/org/eclipse/osee/framework/jdk/core/type/UuidNamedIdentity.java @@ -0,0 +1,45 @@ +/******************************************************************************* + * Copyright (c) 2014 Boeing. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Boeing - initial API and implementation + *******************************************************************************/ +package org.eclipse.osee.framework.jdk.core.type; + +/** + * @author Donald G. Dunne + */ +public class UuidNamedIdentity<T> extends UuidBaseIdentity<T> implements UuidIdentifiable<T>, Comparable<Named> { + private String name; + + public UuidNamedIdentity(T uid, String name) { + super(uid); + this.name = name; + } + + @Override + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + @Override + public int compareTo(Named other) { + if (other != null && other.getName() != null && getName() != null) { + return getName().compareTo(other.getName()); + } + return -1; + } + + @Override + public String toString() { + return getName(); + } +}
\ No newline at end of file |