diff options
author | Angel Avila | 2016-02-22 23:07:06 +0000 |
---|---|---|
committer | Ryan D. Brooks | 2016-02-22 23:07:06 +0000 |
commit | 1b3547f2c6b93bcc981723bfa642feccbc6bf3f1 (patch) | |
tree | a50e596c8e77d3d0f6e6fb3924e390c5797cf59e /plugins/org.eclipse.osee.disposition.rest.model/src/org/eclipse | |
parent | a2d41db0488eef201f4a295f937e90afd67bbcfc (diff) | |
download | org.eclipse.osee-1b3547f2c6b93bcc981723bfa642feccbc6bf3f1.tar.gz org.eclipse.osee-1b3547f2c6b93bcc981723bfa642feccbc6bf3f1.tar.xz org.eclipse.osee-1b3547f2c6b93bcc981723bfa642feccbc6bf3f1.zip |
feature[ATS253909]: Update Dispo Operation Report for better feedback
Change-Id: Ied80d8f1ff6e387ebb692114aa327392841abe31
Diffstat (limited to 'plugins/org.eclipse.osee.disposition.rest.model/src/org/eclipse')
6 files changed, 218 insertions, 7 deletions
diff --git a/plugins/org.eclipse.osee.disposition.rest.model/src/org/eclipse/osee/disposition/model/DispoSet.java b/plugins/org.eclipse.osee.disposition.rest.model/src/org/eclipse/osee/disposition/model/DispoSet.java index 9e2182a12c0..6cbd0e65687 100644 --- a/plugins/org.eclipse.osee.disposition.rest.model/src/org/eclipse/osee/disposition/model/DispoSet.java +++ b/plugins/org.eclipse.osee.disposition.rest.model/src/org/eclipse/osee/disposition/model/DispoSet.java @@ -13,6 +13,7 @@ package org.eclipse.osee.disposition.model; import org.eclipse.osee.framework.jdk.core.type.Identifiable; import org.json.JSONArray; +import org.json.JSONObject; /** * @author Angel Avila @@ -27,4 +28,6 @@ public interface DispoSet extends Identifiable<String> { String getImportState(); String getDispoType(); + + JSONObject getOperationSummary(); } diff --git a/plugins/org.eclipse.osee.disposition.rest.model/src/org/eclipse/osee/disposition/model/DispoSetData.java b/plugins/org.eclipse.osee.disposition.rest.model/src/org/eclipse/osee/disposition/model/DispoSetData.java index ea4d2866662..da04b6cfa10 100644 --- a/plugins/org.eclipse.osee.disposition.rest.model/src/org/eclipse/osee/disposition/model/DispoSetData.java +++ b/plugins/org.eclipse.osee.disposition.rest.model/src/org/eclipse/osee/disposition/model/DispoSetData.java @@ -13,6 +13,7 @@ package org.eclipse.osee.disposition.model; import javax.xml.bind.annotation.XmlRootElement; import org.json.JSONArray; +import org.json.JSONObject; /** * @author Angel Avila @@ -25,7 +26,7 @@ public class DispoSetData extends DispoSetDescriptorData implements DispoSet { private String operation; private JSONArray notesList; private String importState; - private String operationStatus; + private JSONObject operationSummary; public DispoSetData() { @@ -44,10 +45,6 @@ public class DispoSetData extends DispoSetDescriptorData implements DispoSet { return operation; } - public String getOperationStatus() { - return operationStatus; - } - public void setOperation(String operation) { this.operation = operation; } @@ -56,8 +53,8 @@ public class DispoSetData extends DispoSetDescriptorData implements DispoSet { this.notesList = notesList; } - public void setOperationStatus(String operationStatus) { - this.operationStatus = operationStatus; + public void setOperationSummary(JSONObject operationSummary) { + this.operationSummary = operationSummary; } @Override @@ -74,4 +71,9 @@ public class DispoSetData extends DispoSetDescriptorData implements DispoSet { this.importState = importState; } + @Override + public JSONObject getOperationSummary() { + return operationSummary; + } + } diff --git a/plugins/org.eclipse.osee.disposition.rest.model/src/org/eclipse/osee/disposition/model/DispoSetStatus.java b/plugins/org.eclipse.osee.disposition.rest.model/src/org/eclipse/osee/disposition/model/DispoSetStatus.java new file mode 100644 index 00000000000..68fd1877748 --- /dev/null +++ b/plugins/org.eclipse.osee.disposition.rest.model/src/org/eclipse/osee/disposition/model/DispoSetStatus.java @@ -0,0 +1,56 @@ +/******************************************************************************* + * Copyright (c) 2016 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 + * + * Contributostmt: + * Boeing - initial API and implementation + *******************************************************************************/ +package org.eclipse.osee.disposition.model; + +import org.codehaus.jackson.annotate.JsonValue; + +/** + * @author Angel Avila + */ +public enum DispoSetStatus { + NO_CHANGE(0, "No Change"), + OK(1, "OK"), + WARNINGS(2, "Warnings"), + FAILED(3, "Failed"); + + private Integer value; + private String name; + + DispoSetStatus() { + + } + + DispoSetStatus(int value, String name) { + this.value = value; + this.name = name; + } + + public int getValue() { + return value; + } + + @JsonValue + public String getName() { + return name; + } + + public void setValue(Integer value) { + this.value = value; + } + + public void setName(String name) { + this.name = name; + } + + public boolean isFailed() { + return value == FAILED.value; + } +} diff --git a/plugins/org.eclipse.osee.disposition.rest.model/src/org/eclipse/osee/disposition/model/DispoSummarySeverity.java b/plugins/org.eclipse.osee.disposition.rest.model/src/org/eclipse/osee/disposition/model/DispoSummarySeverity.java new file mode 100644 index 00000000000..df02d5f38e7 --- /dev/null +++ b/plugins/org.eclipse.osee.disposition.rest.model/src/org/eclipse/osee/disposition/model/DispoSummarySeverity.java @@ -0,0 +1,42 @@ +/******************************************************************************* + * Copyright (c) 2016 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 + * + * Contributostmt: + * Boeing - initial API and implementation + *******************************************************************************/ +package org.eclipse.osee.disposition.model; + +/** + * @author Angel Avila + */ +public enum DispoSummarySeverity { + IGNORE("Ignore"), + WARNING("Warning"), + ERROR("Error"), + UPDATE("Update"), + NEW("New"); + + private String name; + + DispoSummarySeverity() { + + } + + DispoSummarySeverity(String name) { + this.name = name; + } + + public void setName(String name) { + this.name = name; + } + + // @JsonValue + public String getName() { + return name; + } + +}
\ No newline at end of file diff --git a/plugins/org.eclipse.osee.disposition.rest.model/src/org/eclipse/osee/disposition/model/OperationReport.java b/plugins/org.eclipse.osee.disposition.rest.model/src/org/eclipse/osee/disposition/model/OperationReport.java new file mode 100644 index 00000000000..b314f460d5a --- /dev/null +++ b/plugins/org.eclipse.osee.disposition.rest.model/src/org/eclipse/osee/disposition/model/OperationReport.java @@ -0,0 +1,58 @@ +/******************************************************************************* + * Copyright (c) 2016 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.disposition.model; + +import static org.eclipse.osee.disposition.model.DispoSetStatus.FAILED; +import static org.eclipse.osee.disposition.model.DispoSetStatus.OK; +import static org.eclipse.osee.disposition.model.DispoSetStatus.WARNINGS; +import java.util.ArrayList; +import java.util.List; + +/** + * @author Angel Avila + */ + +public class OperationReport { + + private DispoSetStatus status = DispoSetStatus.NO_CHANGE; + + private final List<OperationSummaryEntry> entries = new ArrayList<>(); + + public OperationReport() { + } + + public List<OperationSummaryEntry> getEntries() { + return entries; + } + + public void addEntry(String name, String message, DispoSummarySeverity serverity) { + if (serverity == DispoSummarySeverity.ERROR) { + status = FAILED; + } else if (serverity == DispoSummarySeverity.WARNING && status != FAILED) { + status = WARNINGS; + } else if (status == DispoSetStatus.NO_CHANGE) { + if (serverity == DispoSummarySeverity.NEW || serverity == DispoSummarySeverity.UPDATE) { + status = OK; + } + } + + OperationSummaryEntry entry = new OperationSummaryEntry(); + entry.setName(name); + entry.setMessage(message); + entry.setSeverity(serverity); + + entries.add(entry); + } + + public DispoSetStatus getStatus() { + return status; + } +} diff --git a/plugins/org.eclipse.osee.disposition.rest.model/src/org/eclipse/osee/disposition/model/OperationSummaryEntry.java b/plugins/org.eclipse.osee.disposition.rest.model/src/org/eclipse/osee/disposition/model/OperationSummaryEntry.java new file mode 100644 index 00000000000..0689f2dad43 --- /dev/null +++ b/plugins/org.eclipse.osee.disposition.rest.model/src/org/eclipse/osee/disposition/model/OperationSummaryEntry.java @@ -0,0 +1,50 @@ +/******************************************************************************* + * Copyright (c) 2016 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 + * + * Contributostmt: + * Boeing - initial API and implementation + *******************************************************************************/ +package org.eclipse.osee.disposition.model; + +/** + * @author Angel Avila + */ +public class OperationSummaryEntry { + + private String name; + private String message; + private DispoSummarySeverity severity; + + public OperationSummaryEntry() { + + } + + public String getName() { + return name; + } + + public String getMessage() { + return message; + } + + public DispoSummarySeverity getSeverity() { + return severity; + } + + public void setName(String name) { + this.name = name; + } + + public void setMessage(String message) { + this.message = message; + } + + public void setSeverity(DispoSummarySeverity severity) { + this.severity = severity; + } + +} |