diff options
author | Angel Avila | 2014-04-29 02:51:21 +0000 |
---|---|---|
committer | Angel Avila | 2014-05-07 19:53:56 +0000 |
commit | 7363dab9d31a288ef07f713486a16dffdf91d59b (patch) | |
tree | 6018a2963ffb8e86e16afc43efd05f6eaee52e1a /plugins/org.eclipse.osee.disposition.rest | |
parent | 8e87cfbf77f64b46d2addfef38abd250f05b0100 (diff) | |
download | org.eclipse.osee-7363dab9d31a288ef07f713486a16dffdf91d59b.tar.gz org.eclipse.osee-7363dab9d31a288ef07f713486a16dffdf91d59b.tar.xz org.eclipse.osee-7363dab9d31a288ef07f713486a16dffdf91d59b.zip |
refactor: Add new fields to Dispo Item
Change-Id: I7442981c3597e1305a335c27d5eabfba4ca94702
Diffstat (limited to 'plugins/org.eclipse.osee.disposition.rest')
23 files changed, 1144 insertions, 813 deletions
diff --git a/plugins/org.eclipse.osee.disposition.rest/src/org/eclipse/osee/disposition/rest/DispoApi.java b/plugins/org.eclipse.osee.disposition.rest/src/org/eclipse/osee/disposition/rest/DispoApi.java index 13c9b50dfdd..bae0a312d80 100644 --- a/plugins/org.eclipse.osee.disposition.rest/src/org/eclipse/osee/disposition/rest/DispoApi.java +++ b/plugins/org.eclipse.osee.disposition.rest/src/org/eclipse/osee/disposition/rest/DispoApi.java @@ -46,8 +46,6 @@ public interface DispoApi { // Writes Identifiable<String> createDispoSet(DispoProgram program, DispoSetDescriptorData descriptor); - Identifiable<String> createDispoItem(DispoProgram program, String setId, DispoItemData dispoItem); - String createDispoAnnotation(DispoProgram program, String itemId, DispoAnnotationData annotation); boolean editDispoSet(DispoProgram program, String dispoSetId, DispoSetData newDispoSet); diff --git a/plugins/org.eclipse.osee.disposition.rest/src/org/eclipse/osee/disposition/rest/DispoConstants.java b/plugins/org.eclipse.osee.disposition.rest/src/org/eclipse/osee/disposition/rest/DispoConstants.java index 5a4e9a07d13..a3adcbb4f8e 100644 --- a/plugins/org.eclipse.osee.disposition.rest/src/org/eclipse/osee/disposition/rest/DispoConstants.java +++ b/plugins/org.eclipse.osee.disposition.rest/src/org/eclipse/osee/disposition/rest/DispoConstants.java @@ -33,6 +33,8 @@ public final class DispoConstants { public static final IAttributeType DispoDateCreated = TokenFactory.createAttributeType(0x1000000000000391L, "dispo.Date Created"); public static final IAttributeType DispoLastUpdated = TokenFactory.createAttributeType(0x1000000000000392L, "dispo.Last Updated"); public static final IAttributeType DispoItemStatus = TokenFactory.createAttributeType(0x3000000000000198L, "dispo.Item Status"); + public static final IAttributeType DispoItemTotalPoints = TokenFactory.createAttributeType(0x3000000000000203L, "dispo.Total Points"); + public static final IAttributeType DispoItemNeedsRerun = TokenFactory.createAttributeType(0x3000000000000204L, "dispo.Needs Rerun"); public static final IAttributeType DispoItemVersion = TokenFactory.createAttributeType(0x3000000000000200L, "dispo.Item Version"); public static final IAttributeType DispoItemAssignee = TokenFactory.createAttributeType(0x3000000000000201L, "dispo.Assignee"); diff --git a/plugins/org.eclipse.osee.disposition.rest/src/org/eclipse/osee/disposition/rest/internal/DispoApiImpl.java b/plugins/org.eclipse.osee.disposition.rest/src/org/eclipse/osee/disposition/rest/internal/DispoApiImpl.java index c0d2f997f16..3c634ccc8da 100644 --- a/plugins/org.eclipse.osee.disposition.rest/src/org/eclipse/osee/disposition/rest/internal/DispoApiImpl.java +++ b/plugins/org.eclipse.osee.disposition.rest/src/org/eclipse/osee/disposition/rest/internal/DispoApiImpl.java @@ -35,7 +35,9 @@ import org.eclipse.osee.executor.admin.ExecutorAdmin; import org.eclipse.osee.framework.core.data.IOseeBranch; import org.eclipse.osee.framework.jdk.core.type.Identifiable; import org.eclipse.osee.framework.jdk.core.type.OseeCoreException; +import org.eclipse.osee.framework.jdk.core.type.Pair; import org.eclipse.osee.framework.jdk.core.type.ResultSet; +import org.eclipse.osee.framework.jdk.core.util.Strings; import org.eclipse.osee.logger.Log; import org.eclipse.osee.orcs.data.ArtifactReadable; import org.json.JSONArray; @@ -107,19 +109,6 @@ public class DispoApiImpl implements DispoApi { return getWriter().createDispoSet(author, program, newSet); } - @Override - public Identifiable<String> createDispoItem(DispoProgram program, String setId, DispoItemData dispoItem) { - DispoSet parentSet = getQuery().findDispoSetsById(program, setId); - Identifiable<String> itemId = null; - if (parentSet != null) { - ArtifactReadable author = getQuery().findUser(); - ArtifactReadable unassignedUser = getQuery().findUnassignedUser(); - dataFactory.initDispoItem(dispoItem); - itemId = getWriter().createDispoItem(author, program, parentSet, dispoItem, unassignedUser); - } - return itemId; - } - private void createDispoItems(DispoProgram program, String setId, List<DispoItem> dispoItems) { DispoSet parentSet = getQuery().findDispoSetsById(program, setId); if (parentSet != null) { @@ -142,12 +131,13 @@ public class DispoApiImpl implements DispoApi { int indexOfAnnotation = annotationsList.length(); annotationToCreate.setIndex(indexOfAnnotation); - boolean isValidResolution = false; String resolution = annotationToCreate.getResolution(); + Pair<Boolean, String> resolutionValidAndType = new Pair<Boolean, String>(false, "NONE"); if (resolution != null) { - isValidResolution = validateResolution(annotationToCreate); + resolutionValidAndType = validateResolution(annotationToCreate); } - annotationToCreate.setIsResolutionValid(isValidResolution); + annotationToCreate.setIsResolutionValid(resolutionValidAndType.getFirst()); + annotationToCreate.setResolutionType(resolutionValidAndType.getSecond()); JSONObject discrepanciesList = dispoItem.getDiscrepanciesList(); @@ -245,9 +235,14 @@ public class DispoApiImpl implements DispoApi { DispoAnnotationData consolidatedAnnotation = oldAnnotation; - // Check if newAnnotation has notes, if it does then merge with old notes - String newNotes = newAnnotation.getNotes(); - consolidatedAnnotation.setNotes(newNotes); + String newDeveloperNotes = newAnnotation.getDeveloperNotes(); + if (Strings.isValid(newDeveloperNotes)) { + consolidatedAnnotation.setDeveloperNotes(newDeveloperNotes); + } + String newCustomerNotes = newAnnotation.getCustomerNotes(); + if (Strings.isValid(newCustomerNotes)) { + consolidatedAnnotation.setCustomerNotes(newCustomerNotes); + } // now if the new Annotation modified the location Reference or resolution then disconnect the annotation and try to match it to discrepancies again String newLocationRefs = newAnnotation.getLocationRefs(); @@ -255,7 +250,9 @@ public class DispoApiImpl implements DispoApi { if (newLocationRefs != null || newResolution != null) { if (newResolution != null) { consolidatedAnnotation.setResolution(newResolution); - consolidatedAnnotation.setIsResolutionValid(validateResolution(consolidatedAnnotation)); + Pair<Boolean, String> resolutionValidAndType = validateResolution(consolidatedAnnotation); + consolidatedAnnotation.setIsResolutionValid(resolutionValidAndType.getFirst()); + consolidatedAnnotation.setResolutionType(resolutionValidAndType.getSecond()); } if (newLocationRefs != null) { consolidatedAnnotation.setLocationRefs(newLocationRefs); @@ -445,7 +442,7 @@ public class DispoApiImpl implements DispoApi { return newList; } - private boolean validateResolution(DispoAnnotationData annotation) { + private Pair<Boolean, String> validateResolution(DispoAnnotationData annotation) { return resolutionValidator.validate(annotation); } diff --git a/plugins/org.eclipse.osee.disposition.rest/src/org/eclipse/osee/disposition/rest/internal/DispoDataFactory.java b/plugins/org.eclipse.osee.disposition.rest/src/org/eclipse/osee/disposition/rest/internal/DispoDataFactory.java index be8e28ba568..c9d8effbe45 100644 --- a/plugins/org.eclipse.osee.disposition.rest/src/org/eclipse/osee/disposition/rest/internal/DispoDataFactory.java +++ b/plugins/org.eclipse.osee.disposition.rest/src/org/eclipse/osee/disposition/rest/internal/DispoDataFactory.java @@ -74,7 +74,8 @@ public class DispoDataFactory { public void initAnnotation(DispoAnnotationData annotationToInit) { annotationToInit.setIdsOfCoveredDiscrepancies(new JSONArray()); - annotationToInit.setNotes("--Enter Notes--"); + annotationToInit.setCustomerNotes("--Enter Notes--"); + annotationToInit.setDeveloperNotes("--Enter Notes--"); annotationToInit.setResolution(""); } diff --git a/plugins/org.eclipse.osee.disposition.rest/src/org/eclipse/osee/disposition/rest/internal/DispoItemArtifact.java b/plugins/org.eclipse.osee.disposition.rest/src/org/eclipse/osee/disposition/rest/internal/DispoItemArtifact.java index c83c1c64124..908e967933d 100644 --- a/plugins/org.eclipse.osee.disposition.rest/src/org/eclipse/osee/disposition/rest/internal/DispoItemArtifact.java +++ b/plugins/org.eclipse.osee.disposition.rest/src/org/eclipse/osee/disposition/rest/internal/DispoItemArtifact.java @@ -81,10 +81,21 @@ public class DispoItemArtifact extends BaseIdentity<String> implements DispoItem } @Override + public Boolean getNeedsRerun() { + return artifact.getSoleAttributeValue(DispoConstants.DispoItemNeedsRerun, false); + } + + @Override + public String getTotalPoints() { + return artifact.getSoleAttributeAsString(DispoConstants.DispoItemTotalPoints, "0"); + } + + @Override public int compareTo(Named other) { if (other != null && other.getName() != null && getName() != null) { return getName().compareTo(other.getName()); } return -1; } + } diff --git a/plugins/org.eclipse.osee.disposition.rest/src/org/eclipse/osee/disposition/rest/internal/DispoResolutionValidator.java b/plugins/org.eclipse.osee.disposition.rest/src/org/eclipse/osee/disposition/rest/internal/DispoResolutionValidator.java index 0b458cb93a4..bfcb44eba53 100644 --- a/plugins/org.eclipse.osee.disposition.rest/src/org/eclipse/osee/disposition/rest/internal/DispoResolutionValidator.java +++ b/plugins/org.eclipse.osee.disposition.rest/src/org/eclipse/osee/disposition/rest/internal/DispoResolutionValidator.java @@ -11,6 +11,7 @@ package org.eclipse.osee.disposition.rest.internal; import org.eclipse.osee.disposition.model.DispoAnnotationData; +import org.eclipse.osee.framework.jdk.core.type.Pair; import org.eclipse.osee.logger.Log; /** @@ -32,8 +33,32 @@ public class DispoResolutionValidator { logger.trace("Stopping ResolutionValidator..."); } - public boolean validate(DispoAnnotationData annotation) { - String pcr = annotation.getResolution(); - return pcr.matches("^\\s*[CTR]\\d{4,5}\\s*$"); + public Pair<Boolean, String> validate(DispoAnnotationData annotation) { + String pcr = annotation.getResolution().toUpperCase().trim(); + boolean isValid = false; + String type = "NONE"; + if (pcr.matches("^\\s*[CTR]\\d{4,5}\\s*$")) { + isValid = true; + if (pcr.startsWith("C")) { + type = "CODE"; + } else if (pcr.startsWith("T")) { + type = "TEST"; + } else if (pcr.startsWith("R")) { + type = "REQ"; + } else { + type = "OTHER"; + } + } + + boolean isOpen = checkStatus(pcr); + + Pair<Boolean, String> toReturn = new Pair<Boolean, String>(isOpen && isValid, type); + return toReturn; + } + + private boolean checkStatus(String pcrNumber) { + // Default is true for now + // Will implement ATS validation later to check status of RPCR against DB + return true; } } diff --git a/plugins/org.eclipse.osee.disposition.rest/src/org/eclipse/osee/disposition/rest/internal/DispoWriter.java b/plugins/org.eclipse.osee.disposition.rest/src/org/eclipse/osee/disposition/rest/internal/DispoWriter.java index d38bda3be9e..2504ecf30d9 100644 --- a/plugins/org.eclipse.osee.disposition.rest/src/org/eclipse/osee/disposition/rest/internal/DispoWriter.java +++ b/plugins/org.eclipse.osee.disposition.rest/src/org/eclipse/osee/disposition/rest/internal/DispoWriter.java @@ -28,8 +28,6 @@ public interface DispoWriter { boolean deleteDispoSet(ArtifactReadable author, DispoProgram program, String setId); - Identifiable<String> createDispoItem(ArtifactReadable author, DispoProgram program, DispoSet parentSet, DispoItem itemToCreate, ArtifactReadable assigneeId); - void createDispoItems(ArtifactReadable author, DispoProgram program, DispoSet parentSet, List<DispoItem> data, String assignee); void updateDispoItems(ArtifactReadable author, DispoProgram program, String itemToEditId, List<DispoItem> itemsToUpdate); diff --git a/plugins/org.eclipse.osee.disposition.rest/src/org/eclipse/osee/disposition/rest/internal/OrcsStorageImpl.java b/plugins/org.eclipse.osee.disposition.rest/src/org/eclipse/osee/disposition/rest/internal/OrcsStorageImpl.java index 3a58c6be82b..210c6759f34 100644 --- a/plugins/org.eclipse.osee.disposition.rest/src/org/eclipse/osee/disposition/rest/internal/OrcsStorageImpl.java +++ b/plugins/org.eclipse.osee.disposition.rest/src/org/eclipse/osee/disposition/rest/internal/OrcsStorageImpl.java @@ -264,27 +264,6 @@ public class OrcsStorageImpl implements Storage { } @Override - public Identifiable<String> createDispoItem(ArtifactReadable author, DispoProgram program, DispoSet parentSet, DispoItem data, ArtifactReadable assignee) { - ArtifactReadable parentSetArt = findDispoArtifact(program, parentSet.getGuid(), DispoConstants.DispoSet); - TransactionBuilder tx = getTxFactory().createTransaction(program.getUuid(), author, "Create Dispoable Item"); - ArtifactId createdItem = tx.createArtifact(DispoConstants.DispoItem, data.getName()); - - tx.setSoleAttributeValue(createdItem, DispoConstants.DispoDateCreated, data.getCreationDate()); - tx.setSoleAttributeValue(createdItem, DispoConstants.DispoLastUpdated, data.getLastUpdate()); - - tx.setSoleAttributeValue(createdItem, DispoConstants.DispoItemStatus, data.getStatus()); - tx.setSoleAttributeFromString(createdItem, DispoConstants.DispoDiscrepanciesJson, - data.getDiscrepanciesList().toString()); - tx.setSoleAttributeFromString(createdItem, DispoConstants.DispoAnnotationsJson, - data.getAnnotationsList().toString()); - - tx.relate(parentSetArt, CoreRelationTypes.Default_Hierarchical__Child, createdItem); - // tx.relate(createdItem, DispoConstants.DispoAssigned_Assignee, assignee); // UNCOMMENT ONCE on production DB - tx.commit(); - return createdItem; - } - - @Override public void createDispoItems(ArtifactReadable author, DispoProgram program, DispoSet parentSet, List<DispoItem> data, String assignee) { ArtifactReadable parentSetArt = findDispoArtifact(program, parentSet.getGuid(), DispoConstants.DispoSet); TransactionBuilder tx = getTxFactory().createTransaction(program.getUuid(), author, "Create Dispoable Item"); @@ -296,6 +275,8 @@ public class OrcsStorageImpl implements Storage { tx.setSoleAttributeValue(createdItem, DispoConstants.DispoLastUpdated, item.getLastUpdate()); tx.setSoleAttributeValue(createdItem, DispoConstants.DispoItemStatus, item.getStatus()); + tx.setSoleAttributeValue(createdItem, DispoConstants.DispoItemTotalPoints, item.getTotalPoints()); + tx.setSoleAttributeValue(createdItem, DispoConstants.DispoItemNeedsRerun, item.getNeedsRerun()); tx.setSoleAttributeFromString(createdItem, DispoConstants.DispoDiscrepanciesJson, item.getDiscrepanciesList().toString()); tx.setSoleAttributeFromString(createdItem, DispoConstants.DispoAnnotationsJson, @@ -308,72 +289,55 @@ public class OrcsStorageImpl implements Storage { tx.commit(); } - @Override - public void updateDispoItem(ArtifactReadable author, DispoProgram program, String dispoItemId, DispoItem data) { - ArtifactId dispoItemArt = findDispoArtifact(program, dispoItemId, DispoConstants.DispoItem); - Date lastUpdate = data.getLastUpdate(); - String name = data.getName(); - JSONObject discrepanciesList = data.getDiscrepanciesList(); - JSONArray annotationsList = data.getAnnotationsList(); - String status = data.getStatus(); - String assignee = data.getAssignee(); - - TransactionBuilder tx = getTxFactory().createTransaction(program.getUuid(), author, "Edit Dispoable Item"); + public void updateSingleItem(ArtifactReadable author, DispoProgram program, ArtifactId currentItemArt, DispoItem newItemData, TransactionBuilder tx) { + Date lastUpdate = newItemData.getLastUpdate(); + Boolean needsRerun = newItemData.getNeedsRerun(); + String name = newItemData.getName(); + JSONObject discrepanciesList = newItemData.getDiscrepanciesList(); + JSONArray annotationsList = newItemData.getAnnotationsList(); + String status = newItemData.getStatus(); + String assignee = newItemData.getAssignee(); if (name != null) { - tx.setName(dispoItemArt, name); + tx.setName(currentItemArt, name); } if (discrepanciesList != null) { - tx.setSoleAttributeFromString(dispoItemArt, DispoConstants.DispoDiscrepanciesJson, + tx.setSoleAttributeFromString(currentItemArt, DispoConstants.DispoDiscrepanciesJson, discrepanciesList.toString()); } if (annotationsList != null) { - tx.setSoleAttributeFromString(dispoItemArt, DispoConstants.DispoAnnotationsJson, annotationsList.toString()); + tx.setSoleAttributeFromString(currentItemArt, DispoConstants.DispoAnnotationsJson, annotationsList.toString()); } if (assignee != null) { - tx.setSoleAttributeFromString(dispoItemArt, DispoConstants.DispoItemAssignee, assignee); + tx.setSoleAttributeFromString(currentItemArt, DispoConstants.DispoItemAssignee, assignee); } if (status != null) { - tx.setSoleAttributeFromString(dispoItemArt, DispoConstants.DispoItemStatus, status); + tx.setSoleAttributeFromString(currentItemArt, DispoConstants.DispoItemStatus, status); } if (lastUpdate != null) { - tx.setSoleAttributeValue(dispoItemArt, DispoConstants.DispoLastUpdated, lastUpdate); + tx.setSoleAttributeValue(currentItemArt, DispoConstants.DispoLastUpdated, lastUpdate); } + if (needsRerun != null) { + tx.setSoleAttributeValue(currentItemArt, DispoConstants.DispoItemNeedsRerun, needsRerun.booleanValue()); + } + } + + @Override + public void updateDispoItem(ArtifactReadable author, DispoProgram program, String dispoItemId, DispoItem data) { + IOseeBranch branch = TokenFactory.createBranch(program.getUuid(), ""); + TransactionBuilder tx = getTxFactory().createTransaction(branch, author, "Edit Dispo Item"); + ArtifactId dispoItemArt = findDispoArtifact(program, dispoItemId, DispoConstants.DispoItem); + updateSingleItem(author, program, dispoItemArt, data, tx); tx.commit(); } @Override public void updateDispoItems(ArtifactReadable author, DispoProgram program, String dispoItemId, List<DispoItem> data) { - TransactionBuilder tx = getTxFactory().createTransaction(program.getUuid(), author, "Edit Dispoable Item"); + TransactionBuilder tx = getTxFactory().createTransaction(program.getUuid(), author, "Edit Multiple Dispo Items"); - for (DispoItem item : data) { + for (DispoItem newItem : data) { ArtifactId dispoItemArt = findDispoArtifact(program, dispoItemId, DispoConstants.DispoItem); - String assignee = item.getAssignee(); - Date lastUpdate = item.getLastUpdate(); - String name = item.getName(); - JSONObject discrepanciesList = item.getDiscrepanciesList(); - JSONArray annotationsList = item.getAnnotationsList(); - String status = item.getStatus(); - - if (name != null) { - tx.setName(dispoItemArt, name); - } - if (discrepanciesList != null) { - tx.setSoleAttributeFromString(dispoItemArt, DispoConstants.DispoDiscrepanciesJson, - discrepanciesList.toString()); - } - if (annotationsList != null) { - tx.setSoleAttributeFromString(dispoItemArt, DispoConstants.DispoAnnotationsJson, annotationsList.toString()); - } - if (assignee != null) { - tx.setSoleAttributeFromString(dispoItemArt, DispoConstants.DispoItemAssignee, assignee); - } - if (status != null) { - tx.setSoleAttributeFromString(dispoItemArt, DispoConstants.DispoItemStatus, status); - } - if (lastUpdate != null) { - tx.setSoleAttributeValue(dispoItemArt, DispoConstants.DispoLastUpdated, lastUpdate); - } + updateSingleItem(author, program, dispoItemArt, newItem, tx); } tx.commit(); diff --git a/plugins/org.eclipse.osee.disposition.rest/src/org/eclipse/osee/disposition/rest/internal/importer/DiscrepancyParser.java b/plugins/org.eclipse.osee.disposition.rest/src/org/eclipse/osee/disposition/rest/internal/importer/DiscrepancyParser.java index f670797b4d3..0eb60b0a76e 100644 --- a/plugins/org.eclipse.osee.disposition.rest/src/org/eclipse/osee/disposition/rest/internal/importer/DiscrepancyParser.java +++ b/plugins/org.eclipse.osee.disposition.rest/src/org/eclipse/osee/disposition/rest/internal/importer/DiscrepancyParser.java @@ -20,6 +20,7 @@ import org.eclipse.osee.disposition.model.DispoItemData; import org.eclipse.osee.disposition.rest.util.DispoUtil; import org.eclipse.osee.framework.jdk.core.type.MutableBoolean; import org.eclipse.osee.framework.jdk.core.type.MutableInteger; +import org.eclipse.osee.framework.jdk.core.type.OseeCoreException; import org.eclipse.osee.framework.jdk.core.util.GUID; import org.json.JSONException; import org.json.JSONObject; @@ -64,45 +65,67 @@ public class DiscrepancyParser { } public static boolean buildItemFromFile(DispoItemData dispoItem, String resourceName, InputStream inputStream, final boolean isNewImport, final Date lastUpdate) throws Exception { - final SimpleDateFormat DATE_FORMAT = new SimpleDateFormat("MMM dd, yyyy H:mm:ss aa", Locale.US); + final SimpleDateFormat DATE_FORMAT = new SimpleDateFormat("EEE MMM dd HH:mm:ss zzz yyyy", Locale.US); final MutableBoolean isWithinTestPointElement = new MutableBoolean(false); final MutableBoolean isCheckGroup = new MutableBoolean(false); final MutableInteger idOfTestPoint = new MutableInteger(0); final StringBuilder textAppendable = new StringBuilder(); final MutableBoolean isFailure = new MutableBoolean(false); final JSONObject discrepancies = new JSONObject(); - final MutableDate lastModifiedDate = new MutableDate(); + final MutableDate scriptRunDate = new MutableDate(); + final MutableDate firstTestPointDate = new MutableDate(); final MutableBoolean stoppedParsing = new MutableBoolean(false); final MutableString version = new MutableString(); + final MutableString totalPoints = new MutableString(); XMLReader xmlReader = XMLReaderFactory.createXMLReader(); DispoSaxHandler handler = new DispoSaxHandler(); xmlReader.setContentHandler(handler); xmlReader.setProperty("http://xml.org/sax/properties/lexical-handler", handler); - handler.getHandler("ScriptVersion").addListener(new IBaseSaxElementListener() { + handler.getHandler("Time").addListener(new SaxElementAdapter() { + @Override - public void onEndElement(Object obj) { - // + public void onStartElement(Object obj) throws Exception { + if (obj != null) { + if (firstTestPointDate.getValue() == null) { + String timeString = (String) obj; + Long timeLong = Long.parseLong(timeString); + firstTestPointDate.setValue(new Date(timeLong)); + if (!isNewImport && !firstTestPointDate.getValue().after(lastUpdate)) { + throw new BreakSaxException("Stopped Parsing"); + } + } + } } + }); + + handler.getHandler("ScriptVersion").addListener(new SaxElementAdapter() { @Override public void onStartElement(Object obj) throws Exception { ScriptVersionData data = (ScriptVersionData) obj; + version.setValue(data.getRevision()); + } + }); + + handler.getHandler("TimeSummary").addListener(new SaxElementAdapter() { + @Override + public void onStartElement(Object obj) throws Exception { + TimeSummaryData data = (TimeSummaryData) obj; try { - lastModifiedDate.setValue(DATE_FORMAT.parse(data.getLastModified())); - if (!isNewImport && !lastModifiedDate.getValue().after(lastUpdate)) { + scriptRunDate.setValue(DATE_FORMAT.parse(data.getEndDate())); + if (!isNewImport && !scriptRunDate.getValue().after(lastUpdate)) { throw new BreakSaxException("Stopped Parsing"); } - version.setValue(data.getRevision()); } catch (ParseException ex) { throw ex; } } }); - handler.getHandler("TestPoint").addListener(new IBaseSaxElementListener() { + handler.getHandler("TestPoint").addListener(new SaxElementAdapter() { @Override public void onEndElement(Object obj) throws JSONException { @@ -127,7 +150,7 @@ public class DiscrepancyParser { } }); - handler.getHandler("Number").addListener(new IBaseSaxElementListener() { + handler.getHandler("Number").addListener(new SaxElementAdapter() { @Override public void onEndElement(Object obj) { if (isWithinTestPointElement.getValue()) { @@ -138,14 +161,9 @@ public class DiscrepancyParser { textAppendable.append(". "); } } - - @Override - public void onStartElement(Object obj) { - // - } }); - handler.getHandler("TestPointName").addListener(new IBaseSaxElementListener() { + handler.getHandler("TestPointName").addListener(new SaxElementAdapter() { @Override public void onEndElement(Object obj) { if (isFailure.getValue()) { @@ -154,14 +172,9 @@ public class DiscrepancyParser { textAppendable.append(". "); } } - - @Override - public void onStartElement(Object obj) { - // - } }); - handler.getHandler("Result").addListener(new IBaseSaxElementListener() { + handler.getHandler("Result").addListener(new SaxElementAdapter() { @Override public void onEndElement(Object obj) { @@ -173,19 +186,9 @@ public class DiscrepancyParser { } } } - - @Override - public void onStartElement(Object obj) { - // - } }); - handler.getHandler("CheckGroup").addListener(new IBaseSaxElementListener() { - @Override - public void onEndElement(Object obj) { - // - } - + handler.getHandler("CheckGroup").addListener(new SaxElementAdapter() { @Override public void onStartElement(Object obj) { isCheckGroup.setValue(true); @@ -195,7 +198,7 @@ public class DiscrepancyParser { } }); - handler.getHandler("Expected").addListener(new IBaseSaxElementListener() { + handler.getHandler("Expected").addListener(new SaxElementAdapter() { @Override public void onEndElement(Object obj) { if (isWithinTestPointElement.getValue() && isFailure.getValue()) { @@ -204,13 +207,8 @@ public class DiscrepancyParser { textAppendable.append(". "); } } - - @Override - public void onStartElement(Object obj) { - // - } }); - handler.getHandler("Actual").addListener(new IBaseSaxElementListener() { + handler.getHandler("Actual").addListener(new SaxElementAdapter() { @Override public void onEndElement(Object obj) { if (isWithinTestPointElement.getValue() && isFailure.getValue()) { @@ -219,11 +217,26 @@ public class DiscrepancyParser { textAppendable.append(". "); } } + }); + handler.getHandler("TestPointResults").addListener(new SaxElementAdapter() { @Override public void onStartElement(Object obj) { - // + if (obj instanceof TestPointResultsData) { + TestPointResultsData data = (TestPointResultsData) obj; + String fail = data.getFail(); + String pass = data.getPass(); + try { + int failedTestPoints = Integer.parseInt(fail); + int passedTestPoints = Integer.parseInt(pass); + int totalTestPoints = passedTestPoints + failedTestPoints; + totalPoints.setValue(String.valueOf(totalTestPoints)); + } catch (NumberFormatException ex) { + throw new OseeCoreException(ex); + } + } } + }); try { @@ -240,13 +253,16 @@ public class DiscrepancyParser { String normalizedName = resourceName.replaceAll("\\..*", ""); dispoItem.setName(normalizedName); dispoItem.setDiscrepanciesList(discrepancies); + if (version.getValue() == null) { + version.setValue("No version control"); + } dispoItem.setVersion(version.getValue()); if (isNewImport) { - dispoItem.setCreationDate(lastModifiedDate.getValue()); + dispoItem.setCreationDate(scriptRunDate.getValue()); } - dispoItem.setLastUpdate(lastModifiedDate.getValue()); + dispoItem.setTotalPoints(totalPoints.getValue()); + dispoItem.setLastUpdate(scriptRunDate.getValue()); } return stoppedParsing.getValue(); } - } diff --git a/plugins/org.eclipse.osee.disposition.rest/src/org/eclipse/osee/disposition/rest/internal/importer/DispoSaxHandler.java b/plugins/org.eclipse.osee.disposition.rest/src/org/eclipse/osee/disposition/rest/internal/importer/DispoSaxHandler.java index b74a518fe04..d5f61d0fdd1 100644 --- a/plugins/org.eclipse.osee.disposition.rest/src/org/eclipse/osee/disposition/rest/internal/importer/DispoSaxHandler.java +++ b/plugins/org.eclipse.osee.disposition.rest/src/org/eclipse/osee/disposition/rest/internal/importer/DispoSaxHandler.java @@ -36,6 +36,9 @@ public class DispoSaxHandler extends AbstractSaxHandler { addHandlers(new CheckGroup()); addHandlers(new TestPointName()); addHandlers(new ScriptVersion()); + addHandlers(new TestPointResults()); + addHandlers(new Time()); + addHandlers(new TimeSummary()); } @Override diff --git a/plugins/org.eclipse.osee.disposition.rest/src/org/eclipse/osee/disposition/rest/internal/importer/SaxElementAdapter.java b/plugins/org.eclipse.osee.disposition.rest/src/org/eclipse/osee/disposition/rest/internal/importer/SaxElementAdapter.java new file mode 100644 index 00000000000..de19a7effe4 --- /dev/null +++ b/plugins/org.eclipse.osee.disposition.rest/src/org/eclipse/osee/disposition/rest/internal/importer/SaxElementAdapter.java @@ -0,0 +1,28 @@ +/******************************************************************************* + * Copyright (c) 2013 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.rest.internal.importer; + +/** + * @author Angel Avila + */ + +public abstract class SaxElementAdapter implements IBaseSaxElementListener { + @Override + public void onStartElement(Object obj) throws Exception { + // + } + + @Override + public void onEndElement(Object obj) throws Exception { + // + } + +} diff --git a/plugins/org.eclipse.osee.disposition.rest/src/org/eclipse/osee/disposition/rest/internal/importer/TestPointResults.java b/plugins/org.eclipse.osee.disposition.rest/src/org/eclipse/osee/disposition/rest/internal/importer/TestPointResults.java new file mode 100644 index 00000000000..6875562e318 --- /dev/null +++ b/plugins/org.eclipse.osee.disposition.rest/src/org/eclipse/osee/disposition/rest/internal/importer/TestPointResults.java @@ -0,0 +1,31 @@ +/******************************************************************************* + * Copyright (c) 2004, 2007 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.rest.internal.importer; + +import org.xml.sax.Attributes; + +/** + * @author Andrew M. Finkbeiner + */ +public class TestPointResults extends ElementHandlers { + + public TestPointResults() { + super("TestPointResults"); + } + + @Override + public Object createStartElementFoundObject(String uri, String localName, String name, Attributes attributes) { + TestPointResultsData data = + new TestPointResultsData(attributes.getValue("aborted"), attributes.getValue("fail"), + attributes.getValue("pass"), attributes.getValue("total")); + return data; + } +} diff --git a/plugins/org.eclipse.osee.disposition.rest/src/org/eclipse/osee/disposition/rest/internal/importer/TestPointResultsData.java b/plugins/org.eclipse.osee.disposition.rest/src/org/eclipse/osee/disposition/rest/internal/importer/TestPointResultsData.java new file mode 100644 index 00000000000..f1ac313ba78 --- /dev/null +++ b/plugins/org.eclipse.osee.disposition.rest/src/org/eclipse/osee/disposition/rest/internal/importer/TestPointResultsData.java @@ -0,0 +1,59 @@ +/******************************************************************************* + * Copyright (c) 2004, 2007 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.rest.internal.importer; + +/** + * @author Andrew M. Finkbeiner + */ +public class TestPointResultsData { + + private final String aborted; + + /** + * @return the aborted + */ + public String getAborted() { + return aborted; + } + + /** + * @return the fail + */ + public String getFail() { + return fail; + } + + /** + * @return the pass + */ + public String getPass() { + return pass; + } + + /** + * @return the total + */ + public String getTotal() { + return total; + } + + private final String fail; + private final String pass; + private final String total; + + public TestPointResultsData(String aborted, String fail, String pass, String total) { + this.aborted = aborted; + this.fail = fail; + this.pass = pass; + this.total = total; + } + +} diff --git a/plugins/org.eclipse.osee.disposition.rest/src/org/eclipse/osee/disposition/rest/internal/importer/Time.java b/plugins/org.eclipse.osee.disposition.rest/src/org/eclipse/osee/disposition/rest/internal/importer/Time.java new file mode 100644 index 00000000000..ebd0f7569b0 --- /dev/null +++ b/plugins/org.eclipse.osee.disposition.rest/src/org/eclipse/osee/disposition/rest/internal/importer/Time.java @@ -0,0 +1,29 @@ +/******************************************************************************* + * Copyright (c) 2004, 2007 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.rest.internal.importer; + +import org.xml.sax.Attributes; + +/** + * @author Andrew M. Finkbeiner + */ +public class Time extends ElementHandlers { + + public Time() { + super("Time"); + } + + @Override + public Object createStartElementFoundObject(String uri, String localName, String name, Attributes attributes) { + return null; + } + +} diff --git a/plugins/org.eclipse.osee.disposition.rest/src/org/eclipse/osee/disposition/rest/internal/importer/TimeSummary.java b/plugins/org.eclipse.osee.disposition.rest/src/org/eclipse/osee/disposition/rest/internal/importer/TimeSummary.java new file mode 100644 index 00000000000..246929ae338 --- /dev/null +++ b/plugins/org.eclipse.osee.disposition.rest/src/org/eclipse/osee/disposition/rest/internal/importer/TimeSummary.java @@ -0,0 +1,31 @@ +/******************************************************************************* + * Copyright (c) 2004, 2007 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.rest.internal.importer; + +import org.xml.sax.Attributes; + +/** + * @author Andrew M. Finkbeiner + */ +public class TimeSummary extends ElementHandlers { + + public TimeSummary() { + super("TimeSummary"); + } + + @Override + public Object createStartElementFoundObject(String uri, String localName, String name, Attributes attributes) { + TimeSummaryData data = + new TimeSummaryData(attributes.getValue("elapsed"), attributes.getValue("endDate"), + attributes.getValue("milliseconds"), attributes.getValue("startDate")); + return data; + } +} diff --git a/plugins/org.eclipse.osee.disposition.rest/src/org/eclipse/osee/disposition/rest/internal/importer/TimeSummaryData.java b/plugins/org.eclipse.osee.disposition.rest/src/org/eclipse/osee/disposition/rest/internal/importer/TimeSummaryData.java new file mode 100644 index 00000000000..2bd5cb5b0a7 --- /dev/null +++ b/plugins/org.eclipse.osee.disposition.rest/src/org/eclipse/osee/disposition/rest/internal/importer/TimeSummaryData.java @@ -0,0 +1,58 @@ +/******************************************************************************* + * Copyright (c) 2004, 2007 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.rest.internal.importer; + +/** + * @author Andrew M. Finkbeiner + */ +public class TimeSummaryData { + + private final String elapsed; + + /** + * @return the elapsed + */ + public String getElapsed() { + return elapsed; + } + + /** + * @return the endDate + */ + public String getEndDate() { + return endDate; + } + + /** + * @return the milliseconds + */ + public String getMilliseconds() { + return milliseconds; + } + + /** + * @return the startDate + */ + public String getStartDate() { + return startDate; + } + private final String endDate; + private final String milliseconds; + private final String startDate; + + TimeSummaryData(String elapsed, String endDate, String milliseconds, String startDate) { + this.elapsed = elapsed; + this.endDate = endDate; + this.milliseconds = milliseconds; + this.startDate = startDate; + } + +} diff --git a/plugins/org.eclipse.osee.disposition.rest/src/org/eclipse/osee/disposition/rest/internal/types/OseeTypes_Dispo.osee b/plugins/org.eclipse.osee.disposition.rest/src/org/eclipse/osee/disposition/rest/internal/types/OseeTypes_Dispo.osee index 8cc15f95df6..1a7a8502254 100644 --- a/plugins/org.eclipse.osee.disposition.rest/src/org/eclipse/osee/disposition/rest/internal/types/OseeTypes_Dispo.osee +++ b/plugins/org.eclipse.osee.disposition.rest/src/org/eclipse/osee/disposition/rest/internal/types/OseeTypes_Dispo.osee @@ -18,6 +18,8 @@ artifactType "dispo.Dispositionable Item" extends "Artifact" { attribute "dispo.Discrepancies JSON" attribute "dispo.Date Created" attribute "dispo.Item Status" + attribute "dispo.Total Points" + attribute "dispo.Needs Rerun" attribute "dispo.Item Version" attribute "dispo.Last Updated" attribute "dispo.Assignee" @@ -110,6 +112,25 @@ attributeType "dispo.Item Status" extends EnumeratedAttribute { mediaType "text/plain" } +attributeType "dispo.Total Points" extends StringAttribute { + uuid 0x3000000000000203 + dataProvider DefaultAttributeDataProvider + min 0 + max 1 + taggerId DefaultAttributeTaggerProvider + defaultValue "0.0" + mediaType "text/plain" +} + +attributeType "dispo.Needs Rerun" extends BooleanAttribute { + uuid 0x3000000000000204 + dataProvider DefaultAttributeDataProvider + min 1 + max 1 + defaultValue "false" + mediaType "text/plain" +} + attributeType "dispo.Item Version" extends StringAttribute { uuid 0x3000000000000200 dataProvider DefaultAttributeDataProvider diff --git a/plugins/org.eclipse.osee.disposition.rest/src/org/eclipse/osee/disposition/rest/resources/DispoHtmlOutputStream.java b/plugins/org.eclipse.osee.disposition.rest/src/org/eclipse/osee/disposition/rest/resources/DispoHtmlOutputStream.java index ae646377849..a8aa7232a6e 100644 --- a/plugins/org.eclipse.osee.disposition.rest/src/org/eclipse/osee/disposition/rest/resources/DispoHtmlOutputStream.java +++ b/plugins/org.eclipse.osee.disposition.rest/src/org/eclipse/osee/disposition/rest/resources/DispoHtmlOutputStream.java @@ -17,10 +17,8 @@ import java.io.Writer; import java.util.ArrayList; import java.util.Iterator; import java.util.List; - import javax.ws.rs.WebApplicationException; import javax.ws.rs.core.StreamingOutput; - import org.eclipse.osee.disposition.model.Discrepancy; import org.eclipse.osee.disposition.model.DispoItem; import org.eclipse.osee.disposition.model.DispoStrings; @@ -68,11 +66,12 @@ public final class DispoHtmlOutputStream implements StreamingOutput { private void addItemData(Appendable appendable, DispoItem item) throws IOException, JSONException { addData(appendable, item.getName()); addData(appendable, item.getStatus(), true); - addData(appendable, String.valueOf(item.getDiscrepanciesList().length())); // change to total points + addData(appendable, String.valueOf(item.getTotalPoints())); addData(appendable, String.valueOf(item.getDiscrepanciesList().length())); addData(appendable, String.valueOf(getFailureLocations(item.getDiscrepanciesList()))); addData(appendable, item.getAssignee()); - addData(appendable, item.getVersion()); // Change to Version + addData(appendable, item.getVersion()); + addDataAsButton(appendable, item.getNeedsRerun()); } private void addData(Appendable appendable, String data) throws IOException { @@ -81,6 +80,16 @@ public final class DispoHtmlOutputStream implements StreamingOutput { appendable.append("</td>"); } + private void addDataAsButton(Appendable appendable, boolean data) throws IOException { + appendable.append("<td class=\"itemData\">"); + appendable.append("<input type=\"checkbox\" onclick=\"toggleRerun(this)\""); + if (data) { + appendable.append(" checked"); + } + appendable.append("></input>"); + appendable.append("</td>"); + } + private void addData(Appendable appendable, String data, boolean isStatus) throws IOException { if (data.equals(DispoStrings.Item_Complete)) { appendable.append("<td class=\"itemData\">"); diff --git a/plugins/org.eclipse.osee.disposition.rest/src/org/eclipse/osee/disposition/rest/resources/DispoItemResource.java b/plugins/org.eclipse.osee.disposition.rest/src/org/eclipse/osee/disposition/rest/resources/DispoItemResource.java index 0cf33bdeded..67598e942d9 100644 --- a/plugins/org.eclipse.osee.disposition.rest/src/org/eclipse/osee/disposition/rest/resources/DispoItemResource.java +++ b/plugins/org.eclipse.osee.disposition.rest/src/org/eclipse/osee/disposition/rest/resources/DispoItemResource.java @@ -14,7 +14,6 @@ import java.util.List; import javax.ws.rs.Consumes; import javax.ws.rs.DELETE; import javax.ws.rs.GET; -import javax.ws.rs.POST; import javax.ws.rs.PUT; import javax.ws.rs.Path; import javax.ws.rs.PathParam; @@ -22,7 +21,6 @@ import javax.ws.rs.Produces; import javax.ws.rs.core.MediaType; import javax.ws.rs.core.Response; import javax.ws.rs.core.Response.ResponseBuilder; -import javax.ws.rs.core.Response.Status; import javax.ws.rs.core.StreamingOutput; import org.eclipse.osee.disposition.model.DispoItem; import org.eclipse.osee.disposition.model.DispoItemData; @@ -30,7 +28,7 @@ import org.eclipse.osee.disposition.model.DispoMessages; import org.eclipse.osee.disposition.model.DispoProgram; import org.eclipse.osee.disposition.rest.DispoApi; import org.eclipse.osee.disposition.rest.util.DispoHtmlWriter; -import org.eclipse.osee.framework.jdk.core.type.Identifiable; +import org.eclipse.osee.disposition.rest.util.DispoUtil; /** * @author Angel Avila @@ -48,12 +46,6 @@ public class DispoItemResource { this.writer = writer; } - @POST - public Response postDispoItem(DispoItemData dispoItem) { - Identifiable<String> createDispoItem = dispoApi.createDispoItem(program, setId, dispoItem); - return Response.status(Status.OK).entity(createDispoItem.getGuid()).build(); - } - /** * Get all Dispositionable Items under the Disposition Set * @@ -88,7 +80,7 @@ public class DispoItemResource { if (result == null) { response = Response.status(Response.Status.NOT_FOUND).entity(DispoMessages.Item_NotFound).build(); } else { - response = Response.status(Response.Status.OK).entity(result).build(); + response = Response.status(Response.Status.OK).entity(DispoUtil.itemArtToItemData(result)).build(); } return response; } diff --git a/plugins/org.eclipse.osee.disposition.rest/src/org/eclipse/osee/disposition/rest/util/DispoHtmlWriter.java b/plugins/org.eclipse.osee.disposition.rest/src/org/eclipse/osee/disposition/rest/util/DispoHtmlWriter.java index dd565cb83fd..aecd2247931 100644 --- a/plugins/org.eclipse.osee.disposition.rest/src/org/eclipse/osee/disposition/rest/util/DispoHtmlWriter.java +++ b/plugins/org.eclipse.osee.disposition.rest/src/org/eclipse/osee/disposition/rest/util/DispoHtmlWriter.java @@ -41,7 +41,8 @@ public class DispoHtmlWriter { private final String subTableHeadersEnd ="\" width=\"20\"></th>"+ "<th width=\"200\">Points</th>"+ "<th width=\"100\">PCR</th>"+ - "<th width=\"600\">Notes</th>"+ + "<th width=\"500\">Developer Notes</th>"+ + "<th width=\"500\">Customer Notes</th>"+ "</tr>"; // @formatter:on @@ -160,7 +161,7 @@ public class DispoHtmlWriter { private void addItemData(Appendable appendable, DispoItem item) throws IOException, JSONException { addData(appendable, item.getName()); addData(appendable, item.getStatus(), true); - addData(appendable, String.valueOf(item.getDiscrepanciesList().length())); // change to total points + addData(appendable, String.valueOf(item.getTotalPoints())); // change to total points addData(appendable, String.valueOf(item.getDiscrepanciesList().length())); addData(appendable, String.valueOf(getFailureLocations(item.getDiscrepanciesList()))); addData(appendable, item.getAssignee()); @@ -228,7 +229,8 @@ public class DispoHtmlWriter { } addSubTableData(sb, annotation.getLocationRefs(), annotation.getIsConnected()); addSubTableData(sb, annotation.getResolution(), isResolutionValid); - addSubTableData(sb, annotation.getNotes(), true); + addSubTableData(sb, annotation.getDeveloperNotes(), true); + addSubTableData(sb, annotation.getCustomerNotes(), true); addDeleteButton(sb); sb.append("</tr>"); } @@ -237,6 +239,7 @@ public class DispoHtmlWriter { sb.append("<td class=\"annotationData\"><textarea class=\"annotationInput\" onchange=\"submitAnnotationData(this);\" ondblclick=\"annotationDblClick(this);\"></textarea></d>"); sb.append("<td class=\"annotationData\"><textarea class=\"annotationInputDisabled\" onchange=\"submitAnnotationData(this);\" ondblclick=\"annotationDblClick(this);\" readonly=\"true\"></textarea></td>"); sb.append("<td class=\"annotationData\"><textarea class=\"annotationInputDisabled\" onchange=\"submitAnnotationData(this);\" ondblclick=\"annotationDblClick(this);\" readonly=\"true\"></textarea></td>"); + sb.append("<td class=\"annotationData\"><textarea class=\"annotationInputDisabled\" onchange=\"submitAnnotationData(this);\" ondblclick=\"annotationDblClick(this);\" readonly=\"true\"></textarea></td>"); sb.append("<td><button class=\"annotationDelete\" onclick=\"deleteAnnotation(this);\" disabled=\"true\">X</button></td>"); sb.append("</tr>"); sb.append("</table>"); diff --git a/plugins/org.eclipse.osee.disposition.rest/src/org/eclipse/osee/disposition/rest/util/DispoUtil.java b/plugins/org.eclipse.osee.disposition.rest/src/org/eclipse/osee/disposition/rest/util/DispoUtil.java index 0d209b02b28..5f64b2be527 100644 --- a/plugins/org.eclipse.osee.disposition.rest/src/org/eclipse/osee/disposition/rest/util/DispoUtil.java +++ b/plugins/org.eclipse.osee.disposition.rest/src/org/eclipse/osee/disposition/rest/util/DispoUtil.java @@ -99,10 +99,6 @@ public final class DispoUtil { } public static DispoItemData itemArtToItemData(DispoItem dispoItemArt) { - return itemArtToItemData(dispoItemArt, false); - } - - public static DispoItemData itemArtToItemData(DispoItem dispoItemArt, boolean withDetails) { DispoItemData dispoItemData = new DispoItemData(); dispoItemData.setName(dispoItemArt.getName()); dispoItemData.setGuid(dispoItemArt.getGuid()); @@ -111,10 +107,10 @@ public final class DispoUtil { dispoItemData.setVersion(dispoItemArt.getVersion()); dispoItemData.setLastUpdate(dispoItemArt.getLastUpdate()); dispoItemData.setStatus(dispoItemArt.getStatus()); + dispoItemData.setTotalPoints(dispoItemArt.getTotalPoints()); + dispoItemData.setNeedsRerun(dispoItemArt.getNeedsRerun()); dispoItemData.setDiscrepanciesList(dispoItemArt.getDiscrepanciesList()); - if (withDetails) { - dispoItemData.setAnnotationsList(dispoItemArt.getAnnotationsList()); - } + dispoItemData.setAnnotationsList(dispoItemArt.getAnnotationsList()); return dispoItemData; } @@ -130,6 +126,12 @@ public final class DispoUtil { if (jsonObject.has("itemStatus")) { dispoItem.setStatus(jsonObject.getString("itemStatus")); } + if (jsonObject.has("totalPoints")) { + dispoItem.setTotalPoints(jsonObject.getString("totalPoints")); + } + if (jsonObject.has("needsRerun")) { + dispoItem.setNeedsRerun(jsonObject.getBoolean("needsRerun")); + } if (jsonObject.has("itemVersion")) { dispoItem.setVersion(jsonObject.getString("itemVersion")); } @@ -226,8 +228,11 @@ public final class DispoUtil { if (object.has("isValid")) { dispoAnnotation.setIsConnected(object.getBoolean("isValid")); } - if (object.has("notes")) { - dispoAnnotation.setNotes(object.getString("notes")); + if (object.has("developerNotes")) { + dispoAnnotation.setDeveloperNotes(object.getString("developerNotes")); + } + if (object.has("customerNotes")) { + dispoAnnotation.setCustomerNotes(object.getString("customerNotes")); } if (object.has("resolution")) { dispoAnnotation.setResolution(object.getString("resolution")); @@ -238,6 +243,9 @@ public final class DispoUtil { if (object.has("isResolutionValid")) { dispoAnnotation.setIsResolutionValid(object.getBoolean("isResolutionValid")); } + if (object.has("resolutionType")) { + dispoAnnotation.setResolutionType(object.getString("resolutionType")); + } } catch (JSONException ex) { throw new OseeCoreException(ex); } diff --git a/plugins/org.eclipse.osee.disposition.rest/src/org/eclipse/osee/disposition/rest/util/html/dispo.html b/plugins/org.eclipse.osee.disposition.rest/src/org/eclipse/osee/disposition/rest/util/html/dispo.html index 58182abfdd7..c5bc7810363 100644 --- a/plugins/org.eclipse.osee.disposition.rest/src/org/eclipse/osee/disposition/rest/util/html/dispo.html +++ b/plugins/org.eclipse.osee.disposition.rest/src/org/eclipse/osee/disposition/rest/util/html/dispo.html @@ -53,6 +53,7 @@ <th width="200" style="background-color: #969AA0">POC: <input id="pocSelect" onchange="getPocFiltered(this)"></select></th> <th width="150" style="background-color: #969AA0">Version</th> + <th width="50" style="background-color: #969AA0">Rerun?</th> </tr> <tbody id="dispoTableBody"> <tr class="itemRow"> @@ -63,6 +64,7 @@ <td class="emptyCell"></td> <td class="emptyCell"></td> <td class="emptyCell"></td> + <td class="emptyCell"></td> </tr> <tr class="itemRow"> <td class="emptyCell"></td> @@ -72,6 +74,7 @@ <td class="emptyCell"></td> <td class="emptyCell"></td> <td class="emptyCell"></td> + <td class="emptyCell"></td> </tr> <tr class="itemRow"> <td class="emptyCell"></td> @@ -81,6 +84,7 @@ <td class="emptyCell"></td> <td class="emptyCell"></td> <td class="emptyCell"></td> + <td class="emptyCell"></td> </tr> <tr class="itemRow"> <td class="emptyCell"></td> @@ -90,6 +94,7 @@ <td class="emptyCell"></td> <td class="emptyCell"></td> <td class="emptyCell"></td> + <td class="emptyCell"></td> </tr> <tr class="itemRow"> <td class="emptyCell"></td> @@ -99,6 +104,7 @@ <td class="emptyCell"></td> <td class="emptyCell"></td> <td class="emptyCell"></td> + <td class="emptyCell"></td> </tr> <tr class="itemRow"> <td class="emptyCell"></td> @@ -108,6 +114,7 @@ <td class="emptyCell"></td> <td class="emptyCell"></td> <td class="emptyCell"></td> + <td class="emptyCell"></td> </tr> <tr> <td class="emptyCell"></td> @@ -117,6 +124,7 @@ <td class="emptyCell"></td> <td class="emptyCell"></td> <td class="emptyCell"></td> + <td class="emptyCell"></td> </tr> <tr> <td class="emptyCell"></td> @@ -126,6 +134,7 @@ <td class="emptyCell"></td> <td class="emptyCell"></td> <td class="emptyCell"></td> + <td class="emptyCell"></td> </tr> </tbody> </table> @@ -137,7 +146,7 @@ var programSelect = document.getElementById("programSelect"); var setSelect = document.getElementById("setSelect"); var path = "http://<?serverPort?>/dispo/program/"; - var cellsToValueSubTable = ["locationRefs", "resolution", "notes"]; + var cellsToValueSubTable = ["locationRefs", "resolution", "developerNotes", "customerNotes"]; var cellsToValueMainTable = ["itemName", "status", "totalPoints", "failures", "discrepancyLocations", "POC", "version"]; var dispoTableBody = document.getElementById("dispoTableBody"); var dispoTable = document.getElementById("dispoTable"); @@ -145,677 +154,697 @@ var pocSelect = document.getElementById("pocSelect"); var statusSelect = document.getElementById("statusSelect"); </script> - <script> - function setUpUndoCatch() { - document.onkeydown = keyPress; - } - </script> - <script> - function getSetTable(setSelect) { - var selectedSetIndex = setSelect.selectedIndex; - var setId = setSelect.options[selectedSetIndex].value; - - var selectedProgramIndex = programSelect.selectedIndex; - var programId = programSelect.options[selectedProgramIndex].value; - - var fullPath = path.concat(programId, "/set/", setId, "/item/"); - get(fullPath, setTableStatusHandler, ""); - } - </script> - <script> - function getPrograms() { - if (programSelect.length < 2) { - get(path, getAllProgramsStatusHandler, programSelect); +<script> + function setUpUndoCatch() { + document.onkeydown = keyPress; + } +</script> +<script> + function toggleRerun(checkBoxEl) { + var selectedSetIndex = setSelect.selectedIndex; + var setId = setSelect.options[selectedSetIndex].value; + + var selectedProgramIndex = programSelect.selectedIndex; + var programId = programSelect.options[selectedProgramIndex].value; + + var selectedRow = checkBoxEl.parentNode.parentNode; + var itemId = selectedRow.id; + + var fullPath = path.concat(programId, "/set/", setId, "/item/", itemId); + + var jsonObject = {}; + jsonObject["needsRerun"] = checkBoxEl.checked; + var params = JSON.stringify(jsonObject); + + put(fullPath, params, putItemStatusHandlerRerunChange, checkBoxEl); + } +</script> +<script> + function getSetTable(setSelect) { + var selectedSetIndex = setSelect.selectedIndex; + var setId = setSelect.options[selectedSetIndex].value; + + var selectedProgramIndex = programSelect.selectedIndex; + var programId = programSelect.options[selectedProgramIndex].value; + + var fullPath = path.concat(programId, "/set/", setId, "/item/"); + get(fullPath, setTableStatusHandler, ""); + } +</script> +<script> + function getPrograms() { + if (programSelect.length < 2) { + get(path, getAllProgramsStatusHandler, programSelect); + } + } +</script> +<script> + function getProgramDetails(programSelect) { + var selectedIndex = programSelect.selectedIndex; + var programId = programSelect.options[selectedIndex].value; + + var fullPath = path.concat(programId, "/set/"); + get(fullPath, getProgramStatusHandler, programSelect); + } +</script> +<script> + function getItemsFiltered() { + var filterSelectedIndex = statusSelect.selectedIndex; + var filterValue = statusSelect.options[filterSelectedIndex].value; + + //get(fullPath, setTableStatusHandler, programSelect); + doFilter(); + } +</script> +<script> + function getPocFiltered() { + //first get all available choices + var filterValue = pocSelect.value; + + //get(fullPath, setTableStatusHandler, programSelect); + doFilter(); + } +</script> +<script> + function showAnnotations(currentRow) { + if (userName == "") { + var nameEnter = prompt("Please enter your name", "Angel Avila"); + userName = nameEnter; + } + + var pocCell = currentRow.cells[5]; + var currentAssigned = pocCell.innerHTML; + if (userName == currentAssigned) { + var currentRowIndex = currentRow.rowIndex; + var nextRow = dispoTable.rows[currentRowIndex + 1]; + + if (nextRow === undefined) { + nextRow = dispoTable.insertRow(currentRowIndex + 1); + } + if (nextRow.className == "containerRow") { + if (nextRow.style.display == "none") { + nextRow.style.display = ""; + } else { + nextRow.style.display = "none"; } - } - </script> - <script> - function getProgramDetails(programSelect) { - var selectedIndex = programSelect.selectedIndex; - var programId = programSelect.options[selectedIndex].value; - - var fullPath = path.concat(programId, "/set/"); - get(fullPath, getProgramStatusHandler, programSelect); - } - </script> - <script> - function getItemsFiltered() { - var filterSelectedIndex = statusSelect.selectedIndex; - var filterValue = statusSelect.options[filterSelectedIndex].value; - - //get(fullPath, setTableStatusHandler, programSelect); - doFilter(); - } - </script> - <script> - function getPocFiltered() { - //first get all available choices - var filterValue = pocSelect.value; - - //get(fullPath, setTableStatusHandler, programSelect); - doFilter(); - } - </script> - <script> - function showAnnotations(currentRow) { - if(userName =="") { - var nameEnter=prompt("Please enter your name","Angel Avila"); - userName = nameEnter; - } - - var pocCell = currentRow.cells[5]; - var currentAssigned = pocCell.innerHTML; - if(userName == currentAssigned) { - var currentRowIndex = currentRow.rowIndex; - var nextRow = dispoTable.rows[currentRowIndex + 1]; - - if (nextRow === undefined) { - nextRow = dispoTable.insertRow(currentRowIndex + 1); - } - if (nextRow.className == "containerRow") { - if (nextRow.style.display == "none") { - nextRow.style.display = ""; - } else { - nextRow.style.display = "none"; - } - } else { - var itemId = currentRow.id; - getSubTableHTML(currentRow, itemId); - } - } else { - changePOC(currentRow, currentAssigned); - } - } - </script> - <script> - function changePOC(currentRow, currentAssigned) { - - var confirmSteal=confirm("Are you sure you want to steal this Item from user " + currentAssigned); - - if(confirmSteal) { - var selectedProgramIndex = programSelect.selectedIndex; - var programId = programSelect.options[selectedProgramIndex].value; - - var selectedSetIndex = setSelect.selectedIndex; - var setId = setSelect.options[selectedSetIndex].value; - - var itemId = currentRow.id; - - var fullPath = path.concat(programId, "/set/", setId, "/item/", itemId); - - var jsonObject = {}; - jsonObject["assignee"] = userName; - var params = JSON.stringify(jsonObject); - - put(fullPath, params, putItemStatusHandler, currentRow); - } - } - </script> - <script> - function getSubTableHTML(currentRow, itemId) { - var selectedProgramIndex = programSelect.selectedIndex; - var programId = programSelect.options[selectedProgramIndex].value; - - var selectedSetIndex = setSelect.selectedIndex; - var setId = setSelect.options[selectedSetIndex].value; - + } else { var itemId = currentRow.id; - var currentRowIndex = currentRow.rowIndex; + getSubTableHTML(currentRow, itemId); + } + } else { + changePOC(currentRow, currentAssigned); + } + } +</script> +<script> + function changePOC(currentRow, currentAssigned) { - var fullPath = path.concat(programId, "/set/", setId, "/item/", itemId, "/annotation/"); + var confirmSteal = confirm("Are you sure you want to steal this Item from user " + currentAssigned); + + if (confirmSteal) { + var selectedProgramIndex = programSelect.selectedIndex; + var programId = programSelect.options[selectedProgramIndex].value; - get(fullPath, subTableStatusHandler, currentRowIndex); - } - </script> - <script> - function submitAnnotationData(selectedElement) { - var selectedElementCell = selectedElement.parentNode; - var annotationRow = selectedElementCell.parentNode; + var selectedSetIndex = setSelect.selectedIndex; + var setId = setSelect.options[selectedSetIndex].value; - var isValidInput = true; + var itemId = currentRow.id; + + var fullPath = path.concat(programId, "/set/", setId, "/item/", itemId); + + var jsonObject = {}; + jsonObject["assignee"] = userName; + var params = JSON.stringify(jsonObject); - if (selectedElementCell.cellIndex == 0) { - var input = selectedElement.value; - var regEx = new RegExp("^\\s*(\\d+|\\d+\\s*-\\s*\\d+)(\\s*,\\s*(\\d+|\\s*\\d+\\s*-\\s*\\d+))*\\s*$"); - isValidInput = regEx.test(input) - } + put(fullPath, params, putItemStatusHandler, currentRow); + } + } +</script> +<script> + function getSubTableHTML(currentRow, itemId) { + var selectedProgramIndex = programSelect.selectedIndex; + var programId = programSelect.options[selectedProgramIndex].value; + + var selectedSetIndex = setSelect.selectedIndex; + var setId = setSelect.options[selectedSetIndex].value; + + var itemId = currentRow.id; + var currentRowIndex = currentRow.rowIndex; + + var fullPath = path.concat(programId, "/set/", setId, "/item/", itemId, "/annotation/"); + + get(fullPath, subTableStatusHandler, currentRowIndex); + } +</script> +<script> + function submitAnnotationData(selectedElement) { + var selectedElementCell = selectedElement.parentNode; + var annotationRow = selectedElementCell.parentNode; + + var isValidInput = true; + + if (selectedElementCell.cellIndex == 0) { + var input = selectedElement.value; + var regEx = new RegExp("^\\s*(\\d+|\\d+\\s*-\\s*\\d+)(\\s*,\\s*(\\d+|\\s*\\d+\\s*-\\s*\\d+))*\\s*$"); + isValidInput = regEx.test(input) + } + + if (isValidInput) { + if (annotationRow.id == "") { + postAnnotation(selectedElement); + } else { + putAnnotation(selectedElement, annotationRow.id); + } + } + } +</script> +<script> + function postAnnotation(selectedElement) { + var locRef = selectedElement.value; + var annotationJson = { + "locationRefs": locRef + }; + + var params = JSON.stringify(annotationJson); + + var selectedProgramIndex = programSelect.selectedIndex; + var programId = programSelect.options[selectedProgramIndex].value; + + var selectedSetIndex = setSelect.selectedIndex; + var setId = setSelect.options[selectedSetIndex].value; + + var containerRow = selectedElement.parentNode.parentNode.parentNode.parentNode.parentNode.parentNode; + var itemRow = dispoTable.rows[containerRow.rowIndex - 1]; + var itemId = itemRow.id; + + var fullPath = path.concat(programId, "/set/", setId, "/item/", itemId, "/annotation/"); + + post(fullPath, params, postAnnotationStatusHandler, selectedElement); + } +</script> +<script> + function putAnnotation(selectedElement, annotationId) { + var cellIndex = selectedElement.parentNode.cellIndex; + var value = selectedElement.value; + var key = cellsToValueSubTable[cellIndex]; + + var jsonObject = {}; + jsonObject[key] = value; + + var params = JSON.stringify(jsonObject); + + var selectedProgramIndex = programSelect.selectedIndex; + var programId = programSelect.options[selectedProgramIndex].value; + + var selectedSetIndex = setSelect.selectedIndex; + var setId = setSelect.options[selectedSetIndex].value; + + var containerRow = selectedElement.parentNode.parentNode.parentNode.parentNode.parentNode.parentNode; + var itemRow = dispoTable.rows[containerRow.rowIndex - 1]; + var itemId = itemRow.id; + + var fullPath = path.concat(programId, "/set/", setId, "/item/", itemId, "/annotation/", annotationId); + + put(fullPath, params, putAnnotationStatusHandler, selectedElement); + } +</script> +<script> + function deleteAnnotation(button) { + var selectedProgramIndex = programSelect.selectedIndex; + var programId = programSelect.options[selectedProgramIndex].value; + + var selectedSetIndex = setSelect.selectedIndex; + var setId = setSelect.options[selectedSetIndex].value; + + var containerRow = button.parentNode.parentNode.parentNode.parentNode.parentNode.parentNode; + var itemRow = dispoTable.rows[containerRow.rowIndex - 1]; + var itemId = itemRow.id; + + var annotationId = button.parentNode.parentNode.id; + + var fullPath = path.concat(programId, "/set/", setId, "/item/", itemId, "/annotation/", annotationId); + doDelete(fullPath, delAnnotationStatusHandler, button); + } +</script> +<script> + function getAnnotation(annotationRow) { + var selectedProgramIndex = programSelect.selectedIndex; + var programId = programSelect.options[selectedProgramIndex].value; + + var selectedSetIndex = setSelect.selectedIndex; + var setId = setSelect.options[selectedSetIndex].value; + + var containerRow = annotationRow.parentNode.parentNode.parentNode.parentNode; + var itemRow = dispoTable.rows[containerRow.rowIndex - 1]; + var itemId = itemRow.id; + + var fullPath = path.concat(programId, "/set/", setId, "/item/", itemId, "/annotation/", annotationRow.id); + get(fullPath, getAnnotationStatuHandler, annotationRow); + } +</script> +<script> + function getItemStatus(itemRow) { + var selectedProgramIndex = programSelect.selectedIndex; + var programId = programSelect.options[selectedProgramIndex].value; + + var selectedSetIndex = setSelect.selectedIndex; + var setId = setSelect.options[selectedSetIndex].value; + + var itemId = itemRow.id; + + var fullPath = path.concat(programId, "/set/", setId, "/item/", itemId); + get(fullPath, getItemStatusHandler, itemRow); + } +</script> +<script> + function getAllProgramsStatusHandler(programSelectEl) { + return function() { + if (this.readyState == 4 && this.status == 200) { + var responseHTML = this.responseText; + programSelect.innerHTML = responseHTML; + } + }; + } +</script> +<script> + function getProgramStatusHandler(setSelectEl) { + return function() { + if (this.readyState == 4 && this.status == 200) { + var responseHTML = this.responseText; + setSelect.innerHTML = responseHTML; + } + }; + } +</script> +<script> + function putItemStatusHandler(currentRow) { + return function() { + if (this.readyState == 4 && this.status == 200) { + currentRow.cells[5].innerHTML = userName; + showAnnotations(currentRow); + } + }; + } +</script> +<script> + function putItemStatusHandlerRerunChange(checkBox) { + return function() { + if (this.readyState == 4 && this.status == 200) { + } else { + checkBox.checked = !checkBox.checked; + } + }; + } +</script> +<script> + function setTableStatusHandler(unusedParam) { + return function() { + if (this.readyState == 1) { + waitBlanket.style.display = 'block'; + } + if (this.readyState == 3) { + //var responseHTML = this.responseText; + //dispoTableBody.innerHTML = responseHTML; + } + if (this.readyState == 4 && this.status == 200) { + waitBlanket.style.display = 'none'; + var responseHTML = this.responseText; + dispoTableBody.innerHTML = responseHTML; + } else if (this.status == 404) { + dispoTableBody.innerHTML = "NO ITEMS FOUND FOR THIS SET"; + } + }; + } +</script> +<script> + function subTableStatusHandler(currentRowIndex) { + return function() { + if (this.readyState == 4 && this.status == 200) { + var responseHTML = this.responseText; + addContainerRow(currentRowIndex, responseHTML); + } + }; + } +</script> +<script> + function getItemStatusHandler(itemRow) { + return function() { + if (this.readyState == 4 && this.status == 200) { + var itemObject = eval('(' + this.responseText + ')'); + + var statusCell = itemRow.cells[1]; + if (statusCell.innerHTML != itemObject.status) { - if (isValidInput) { - if (annotationRow.id == "") { - postAnnotation(selectedElement); - } else { - putAnnotation(selectedElement, annotationRow.id); - } } - } - </script> - <script> - function postAnnotation(selectedElement) { - var locRef = selectedElement.value; - var annotationJson = { - "locationRefs": locRef - }; - - var params = JSON.stringify(annotationJson); - - var selectedProgramIndex = programSelect.selectedIndex; - var programId = programSelect.options[selectedProgramIndex].value; - var selectedSetIndex = setSelect.selectedIndex; - var setId = setSelect.options[selectedSetIndex].value; + statusCell.innerHTML = itemObject.status; - var containerRow = selectedElement.parentNode.parentNode.parentNode.parentNode.parentNode.parentNode; - var itemRow = dispoTable.rows[containerRow.rowIndex - 1]; - var itemId = itemRow.id; - - var fullPath = path.concat(programId, "/set/", setId, "/item/", itemId, "/annotation/"); - - post(fullPath, params, postAnnotationStatusHandler, selectedElement); - } - </script> - <script> - function putAnnotation(selectedElement, annotationId) { - var cellIndex = selectedElement.parentNode.cellIndex; - var value = selectedElement.value; - var key = cellsToValueSubTable[cellIndex]; - - var jsonObject = {}; - jsonObject[key] = value; - - var params = JSON.stringify(jsonObject); - - var selectedProgramIndex = programSelect.selectedIndex; - var programId = programSelect.options[selectedProgramIndex].value; - - var selectedSetIndex = setSelect.selectedIndex; - var setId = setSelect.options[selectedSetIndex].value; - - var containerRow = selectedElement.parentNode.parentNode.parentNode.parentNode.parentNode.parentNode; - var itemRow = dispoTable.rows[containerRow.rowIndex - 1]; - var itemId = itemRow.id; - - var fullPath = path.concat(programId, "/set/", setId, "/item/", itemId, "/annotation/", annotationId); - - put(fullPath, params, putAnnotationStatusHandler, selectedElement); - } - </script> - <script> - function deleteAnnotation(button) { - var selectedProgramIndex = programSelect.selectedIndex; - var programId = programSelect.options[selectedProgramIndex].value; - - var selectedSetIndex = setSelect.selectedIndex; - var setId = setSelect.options[selectedSetIndex].value; - - var containerRow = button.parentNode.parentNode.parentNode.parentNode.parentNode.parentNode; - var itemRow = dispoTable.rows[containerRow.rowIndex - 1]; - var itemId = itemRow.id; - - var annotationId = button.parentNode.parentNode.id; - - var fullPath = path.concat(programId, "/set/", setId, "/item/", itemId, "/annotation/", annotationId); - doDelete(fullPath, delAnnotationStatusHandler, button); - } - </script> - <script> - function getAnnotation(annotationRow) { - var selectedProgramIndex = programSelect.selectedIndex; - var programId = programSelect.options[selectedProgramIndex].value; - - var selectedSetIndex = setSelect.selectedIndex; - var setId = setSelect.options[selectedSetIndex].value; - - var containerRow = annotationRow.parentNode.parentNode.parentNode.parentNode; - var itemRow = dispoTable.rows[containerRow.rowIndex - 1]; - var itemId = itemRow.id; - - var fullPath = path.concat(programId, "/set/", setId, "/item/", itemId, "/annotation/", annotationRow.id); - get(fullPath, getAnnotationStatuHandler, annotationRow); - } - </script> - <script> - function getItemStatus(itemRow) { - var selectedProgramIndex = programSelect.selectedIndex; - var programId = programSelect.options[selectedProgramIndex].value; - - var selectedSetIndex = setSelect.selectedIndex; - var setId = setSelect.options[selectedSetIndex].value; - - var itemId = itemRow.id; - - var fullPath = path.concat(programId, "/set/", setId, "/item/", itemId); - get(fullPath, getItemStatusHandler, itemRow); - } - </script> - - - - <script> - function getAllProgramsStatusHandler(programSelectEl) { - return function() { - if (this.readyState == 4 && this.status == 200) { - var responseHTML = this.responseText; - programSelect.innerHTML = responseHTML; - } - }; - } - </script> - <script> - function getProgramStatusHandler(setSelectEl) { - return function() { - if (this.readyState == 4 && this.status == 200) { - var responseHTML = this.responseText; - setSelect.innerHTML = responseHTML; - } - }; - } - </script> - <script> - function putItemStatusHandler(currentRow) { - return function() { - if (this.readyState == 4 && this.status == 200) { - currentRow.cells[5].innerHTML = userName; - showAnnotations(currentRow); - } - }; - } - </script> - <script> - function setTableStatusHandler(unusedParam) { - return function() { - if(this.readyState == 1) { - waitBlanket.style.display = 'block'; - } - if(this.readyState == 3) { - //var responseHTML = this.responseText; - //dispoTableBody.innerHTML = responseHTML; - } - if (this.readyState == 4 && this.status == 200) { - waitBlanket.style.display = 'none'; - var responseHTML = this.responseText; - dispoTableBody.innerHTML = responseHTML; - } else if(this.status == 404) { - dispoTableBody.innerHTML = "NO ITEMS FOUND FOR THIS SET"; - } - }; - } - </script> - <script> - function subTableStatusHandler(currentRowIndex) { - return function() { - if (this.readyState == 4 && this.status == 200) { - var responseHTML = this.responseText; - addContainerRow(currentRowIndex, responseHTML); - } - }; - } - </script> - <script> - function getItemStatusHandler(itemRow) { - return function() { - if (this.readyState == 4 && this.status == 200) { - var itemObject = eval('(' + this.responseText + ')'); - - var statusCell = itemRow.cells[1]; - if(statusCell.innerHTML != itemObject.status) { - - } - - statusCell.innerHTML = itemObject.status; - - if (itemObject.status == "COMPLETE") { - statusCell.className = "itemData"; - } else { - statusCell.className = "itemDataFail"; - } - } - }; - } - </script> - <script> - function getAnnotationStatuHandler(annotationRow) { - return function() { - if (this.readyState == 4 && this.status == 200) { - var annotationObject = eval('(' + this.responseText + ')'); - - if (!annotationObject.isConnected) { - annotationRow.cells[0].firstChild.className = "annotationInputInvalid"; - } else { - annotationRow.cells[0].firstChild.className = "annotationInput"; - } - if (!annotationObject.isResolutionValid) { - annotationRow.cells[1].firstChild.className = "annotationInputInvalid"; - annotationRow.cells[2].firstChild.className = "annotationInputInvalid"; - } else { - annotationRow.cells[1].firstChild.className = "annotationInput"; - annotationRow.cells[2].firstChild.className = "annotationInput"; - } - } + if (itemObject.status == "COMPLETE") { + statusCell.className = "itemData"; + } else { + statusCell.className = "itemDataFail"; } } - </script> - <script> - function postAnnotationStatusHandler(annotationCell) { - return function() { - if (this.readyState == 4 && this.status == 201) { - var annotationRow = annotationCell.parentNode.parentNode; - enableRow(annotationRow); - var annotationObject = eval('(' + this.responseText + ')'); - - annotationRow.id = annotationObject.id; - - if (!annotationObject.isConnected) { - annotationCell.className = "annotationInputInvalid"; - } - addNewRow(annotationRow); - - var containerRow = annotationRow.parentNode.parentNode.parentNode.parentNode; - var containerRowIndex = containerRow.rowIndex; - var itemRow = dispoTableBody.rows[containerRowIndex - 2]; - getItemStatus(itemRow); - } - }; - } - </script> - <script> - function putAnnotationStatusHandler(annotationCell) { - return function() { - if (this.readyState == 4 && this.status == 200) { - var containerRow = annotationCell.parentNode.parentNode.parentNode.parentNode.parentNode.parentNode; - var containerRowIndex = containerRow.rowIndex; - var itemRow = dispoTableBody.rows[containerRowIndex - 2]; - - getItemStatus(itemRow); - getAnnotation(annotationCell.parentNode.parentNode); - } - }; - } - </script> - <script> - function delAnnotationStatusHandler(buttonEl) { - return function() { - if (this.readyState == 4 && this.status == 200) { - var rowToDelete = buttonEl.parentNode.parentNode; - var rowToDeleteIndex = rowToDelete.rowIndex; - var subTable = rowToDelete.parentNode.parentNode; - subTable.deleteRow(rowToDeleteIndex); - - var containerRow = subTable.parentNode.parentNode; - var containerRowIndex = containerRow.rowIndex; - var itemRow = dispoTableBody.rows[containerRowIndex - 2]; - - if (this.responseText == "COMPLETE") { - itemRow.cells[1].className = "itemData"; - } else { - itemRow.cells[1].className = "itemDataFail"; - } - itemRow.cells[1].innerHTML = this.responseText; - } - }; - } - </script> - <script> - function keyPress(e) { - var evtobj = window.event? event : e - if (evtobj.keyCode == 90 && evtobj.ctrlKey) { - alert("Ctrl+z"); - } - } - </script> - - - <script> - function addContainerRow(currentRowIndex, htmlToAdd) { - var newRow = dispoTable.insertRow(currentRowIndex + 1); - newRow.className = "containerRow"; - newRow.innerHTML = htmlToAdd; - } - </script> - <script> - function annotationDblClick(annotationInput) { - var newClass; - switch (annotationInput.className) { - case "annotationInput": - newClass = "annotationInputDetails"; - break; - case "annotationInputInvalid": - newClass = "annotationInputInvalidDetails"; - break; - case "annotationInputDetails": - newClass = "annotationInput"; - break; - case "annotationInputInvalidDetails": - newClass = "annotationInputInvalid"; - break; - default: - newClass = ""; + }; + } +</script> +<script> + function getAnnotationStatuHandler(annotationRow) { + return function() { + if (this.readyState == 4 && this.status == 200) { + var annotationObject = eval('(' + this.responseText + ')'); + + if (!annotationObject.isConnected) { + annotationRow.cells[0].firstChild.className = "annotationInputInvalid"; + } else { + annotationRow.cells[0].firstChild.className = "annotationInput"; } - - if (newClass != "") { - changeClassForRow(annotationInput.parentNode.parentNode, newClass); + if (!annotationObject.isResolutionValid) { + annotationRow.cells[1].firstChild.className = "annotationInputInvalid"; + annotationRow.cells[2].firstChild.className = "annotationInputInvalid"; + } else { + annotationRow.cells[1].firstChild.className = "annotationInput"; + annotationRow.cells[2].firstChild.className = "annotationInput"; } } - </script> - <script> - function changeClassForRow(rowEl, newClass) { - var cells = rowEl.cells; - var cellsLength = cells.length; - for (index = 0; index < cellsLength - 1; index++) { - cells[index].firstChild.className = newClass; + } + } +</script> +<script> + function postAnnotationStatusHandler(annotationCell) { + return function() { + if (this.readyState == 4 && this.status == 201) { + var annotationRow = annotationCell.parentNode.parentNode; + enableRow(annotationRow); + var annotationObject = eval('(' + this.responseText + ')'); + + annotationRow.id = annotationObject.id; + + if (!annotationObject.isConnected) { + annotationCell.className = "annotationInputInvalid"; } - } - </script> - <script> - function addDeleteButton(newRow, cellsLength) { - var deleteCell = newRow.insertCell(cellsLength - 1); - var newButton = document.createElement("button"); - deleteCell.appendChild(newButton); - newButton.className = "annotationDelete"; - newButton.disabled = true; - newButton.innerHTML = "X"; - newButton.setAttribute('onclick', 'deleteAnnotation(this)'); - } - </script> - <script> - function addAnnotationCell(rowElement, index) { - var newCell = rowElement.insertCell(index); - newCell.className = "annotationData"; - var newTextArea = document.createElement("textarea"); - newCell.appendChild(newTextArea); - if (index != 0) { - newTextArea.readOnly = true; - newTextArea.className = "annotationInputDisabled"; + addNewRow(annotationRow); + var containerRow = annotationRow.parentNode.parentNode.parentNode.parentNode; + var containerRowIndex = containerRow.rowIndex; + var itemRow = dispoTableBody.rows[containerRowIndex - 2]; + getItemStatus(itemRow); + } + }; + } +</script> +<script> + function putAnnotationStatusHandler(annotationCell) { + return function() { + if (this.readyState == 4 && this.status == 200) { + var containerRow = annotationCell.parentNode.parentNode.parentNode.parentNode.parentNode.parentNode; + var containerRowIndex = containerRow.rowIndex; + var itemRow = dispoTableBody.rows[containerRowIndex - 2]; + + getItemStatus(itemRow); + getAnnotation(annotationCell.parentNode.parentNode); + } + }; + } +</script> +<script> + function delAnnotationStatusHandler(buttonEl) { + return function() { + if (this.readyState == 4 && this.status == 200) { + var rowToDelete = buttonEl.parentNode.parentNode; + var rowToDeleteIndex = rowToDelete.rowIndex; + var subTable = rowToDelete.parentNode.parentNode; + subTable.deleteRow(rowToDeleteIndex); + + var containerRow = subTable.parentNode.parentNode; + var containerRowIndex = containerRow.rowIndex; + var itemRow = dispoTableBody.rows[containerRowIndex - 2]; + + if (this.responseText == "COMPLETE") { + itemRow.cells[1].className = "itemData"; } else { - newTextArea.className = "annotationInput"; + itemRow.cells[1].className = "itemDataFail"; } - - newTextArea.setAttribute('ondblclick', 'annotationDblClick(this);'); - newTextArea.setAttribute('onchange', 'submitAnnotationData(this);'); - } - </script> - <script> - function addNewRow(currentRow) { - var subTable = currentRow.parentNode.parentNode; - var newRow = subTable.insertRow(currentRow.rowIndex + 1); - - // increase rowSpan for spacer - var spacerCol = subTable.rows[0].cells[0]; - spacerCol.rowSpan = spacerCol.rowSpan + 1; - - var cellsLength = currentRow.cells.length; - for (index = 0; index < cellsLength - 1; index++) { - addAnnotationCell(newRow, index); + itemRow.cells[1].innerHTML = this.responseText; + } + }; + } +</script> +<script> + function keyPress(e) { + var evtobj = window.event ? event : e + if (evtobj.keyCode == 90 && evtobj.ctrlKey) { + alert("Ctrl+z"); + } + } +</script> +<script> + function addContainerRow(currentRowIndex, htmlToAdd) { + var newRow = dispoTable.insertRow(currentRowIndex + 1); + newRow.className = "containerRow"; + newRow.innerHTML = htmlToAdd; + } +</script> +<script> + function annotationDblClick(annotationInput) { + var newClass; + switch (annotationInput.className) { + case "annotationInput": + newClass = "annotationInputDetails"; + break; + case "annotationInputInvalid": + newClass = "annotationInputInvalidDetails"; + break; + case "annotationInputDetails": + newClass = "annotationInput"; + break; + case "annotationInputInvalidDetails": + newClass = "annotationInputInvalid"; + break; + default: + newClass = ""; + } + + if (newClass != "") { + changeClassForRow(annotationInput.parentNode.parentNode, newClass); + } + } +</script> +<script> + function changeClassForRow(rowEl, newClass) { + var cells = rowEl.cells; + var cellsLength = cells.length; + for (index = 0; index < cellsLength - 1; index++) { + cells[index].firstChild.className = newClass; + } + } +</script> +<script> + function addDeleteButton(newRow, cellsLength) { + var deleteCell = newRow.insertCell(cellsLength - 1); + var newButton = document.createElement("button"); + deleteCell.appendChild(newButton); + newButton.className = "annotationDelete"; + newButton.disabled = true; + newButton.innerHTML = "X"; + newButton.setAttribute('onclick', 'deleteAnnotation(this)'); + } +</script> +<script> + function addAnnotationCell(rowElement, index) { + var newCell = rowElement.insertCell(index); + newCell.className = "annotationData"; + var newTextArea = document.createElement("textarea"); + newCell.appendChild(newTextArea); + if (index != 0) { + newTextArea.readOnly = true; + newTextArea.className = "annotationInputDisabled"; + + } else { + newTextArea.className = "annotationInput"; + } + + newTextArea.setAttribute('ondblclick', 'annotationDblClick(this);'); + newTextArea.setAttribute('onchange', 'submitAnnotationData(this);'); + } +</script> +<script> + function addNewRow(currentRow) { + var subTable = currentRow.parentNode.parentNode; + var newRow = subTable.insertRow(currentRow.rowIndex + 1); + + // increase rowSpan for spacer + var spacerCol = subTable.rows[0].cells[0]; + spacerCol.rowSpan = spacerCol.rowSpan + 1; + + var cellsLength = currentRow.cells.length; + for (index = 0; index < cellsLength - 1; index++) { + addAnnotationCell(newRow, index); + } + + addDeleteButton(newRow, cellsLength); + } +</script> +<script> + function enableRow(row) { + var annotationCells = row.cells; + var cellsLength = annotationCells.length; + for (index = 0; index < cellsLength - 1; index++) { + var inputEl = annotationCells[index].firstChild; + inputEl.readOnly = false; + inputEl.className = "annotationInput"; + } + annotationCells[cellsLength - 1].firstChild.disabled = false; // enable Delete Button + } +</script> +<script> + function get(url, statusHandler, callbackParam) { + httpRequest("GET", url, statusHandler, callbackParam); + } +</script> +<script> + function post(url, params, statusHandler, callbackParam) { + httpRequestWithParams("POST", url, params, statusHandler, callbackParam); + } +</script> +<script> + function put(url, params, statusHandler, callbackParam) { + httpRequestWithParams("PUT", url, params, statusHandler, callbackParam); + } +</script> +<script> + function doDelete(url, statusHandler, callbackParam) { + httpRequest("DELETE", url, statusHandler, callbackParam); + } +</script> +<script> + function httpRequestWithParams(httpVerb, url, params, statusHandler, callbackParam) { + var httpRequest = new XMLHttpRequest() + httpRequest.prevDataLength = 0; + httpRequest.onreadystatechange = statusHandler(callbackParam); + httpRequest.open(httpVerb, url); + //Send the proper header information along with the request + httpRequest.setRequestHeader("Content-type", "application/json"); + + httpRequest.send(params); + } +</script> +<script> + function httpRequest(httpVerb, url, statusHandler, callbackParam) { + var httpRequest = new XMLHttpRequest() + httpRequest.prevDataLength = 0; + httpRequest.onreadystatechange = statusHandler(callbackParam); + httpRequest.open(httpVerb, url); + httpRequest.send(); + } +</script> +<script> + function doFilterByStatus(filterValue) { + var rows = dispoTableBody.rows; + + var rowsLength = rows.length; + var i = 0; + while (i < rowsLength) { + var row = rows[i]; + // hide row and possibly container row + if (filterValue != "ALL" && row.cells[1].innerHTML != filterValue) { + row.style.display = "none"; + + i++; + if (i < rowsLength) { + var nextRow = rows[i]; + if (nextRow.className == "containerRow") { + nextRow.style.display = "none"; + i++; + } } - - addDeleteButton(newRow, cellsLength); - } - </script> - <script> - function enableRow(row) { - var annotationCells = row.cells; - var cellsLength = annotationCells.length; - for (index = 0; index < cellsLength - 1; index++) { - var inputEl = annotationCells[index].firstChild; - inputEl.readOnly = false; - inputEl.className = "annotationInput"; + } else { + row.style.display = ""; + + i++; + if (i < rowsLength) { + var nextRow = rows[i]; + if (nextRow.className == "containerRow") { + //nextRow.style.display = ""; + i++; + } } - annotationCells[cellsLength - 1].firstChild.disabled = false; // enable Delete Button - } - </script> - - - - <script> - function get(url, statusHandler, callbackParam) { - httpRequest("GET", url, statusHandler, callbackParam); - } - </script> - <script> - function post(url, params, statusHandler, callbackParam) { - httpRequestWithParams("POST", url, params, statusHandler, callbackParam); - } - </script> - <script> - function put(url, params, statusHandler, callbackParam) { - httpRequestWithParams("PUT", url, params, statusHandler, callbackParam); - } - </script> - <script> - function doDelete(url, statusHandler, callbackParam) { - httpRequest("DELETE", url, statusHandler, callbackParam); - } - </script> - <script> - function httpRequestWithParams(httpVerb, url, params, statusHandler, callbackParam) { - var httpRequest = new XMLHttpRequest() - httpRequest.prevDataLength = 0; - httpRequest.onreadystatechange = statusHandler(callbackParam); - httpRequest.open(httpVerb, url); - //Send the proper header information along with the request - httpRequest.setRequestHeader("Content-type", "application/json"); - - httpRequest.send(params); - } - </script> - <script> - function httpRequest(httpVerb, url, statusHandler, callbackParam) { - var httpRequest = new XMLHttpRequest() - httpRequest.prevDataLength = 0; - httpRequest.onreadystatechange = statusHandler(callbackParam); - httpRequest.open(httpVerb, url); - httpRequest.send(); } - </script> - - - <script> - function doFilterByStatus(filterValue) { - var rows = dispoTableBody.rows; - - var rowsLength = rows.length; - var i = 0; - while(i < rowsLength) { - var row = rows[i]; - // hide row and possibly container row - if(filterValue != "ALL" && row.cells[1].innerHTML != filterValue) { - row.style.display = "none"; - - i++; - if(i < rowsLength) { - var nextRow = rows[i]; - if(nextRow.className == "containerRow") { - nextRow.style.display = "none"; - i++; - } - } - } else { - row.style.display = ""; - - i++; - if(i < rowsLength) { - var nextRow = rows[i]; - if(nextRow.className == "containerRow") { - //nextRow.style.display = ""; - i++; - } - } - } + } + } +</script> +<script> + function doFilterByPOC(filterValue) { + var rows = dispoTableBody.rows; + + var rowsLength = rows.length; + var i = 0; + while (i < rowsLength) { + var row = rows[i]; + // hide row and possibly container row + if (filterValue != "ALL" && row.cells[5].innerHTML != filterValue) { + row.style.display = "none"; + + i++; + if (i < rowsLength) { + var nextRow = rows[i]; + if (nextRow.className == "containerRow") { + nextRow.style.display = "none"; + i++; + } } - } - </script> - <script> - function doFilterByPOC(filterValue) { - var rows = dispoTableBody.rows; - - var rowsLength = rows.length; - var i = 0; - while(i < rowsLength) { - var row = rows[i]; - // hide row and possibly container row - if(filterValue != "ALL" && row.cells[5].innerHTML != filterValue) { - row.style.display = "none"; - - i++; - if(i < rowsLength) { - var nextRow = rows[i]; - if(nextRow.className == "containerRow") { - nextRow.style.display = "none"; - i++; - } - } - } else { - row.style.display = ""; - - i++; - if(i < rowsLength) { - var nextRow = rows[i]; - if(nextRow.className == "containerRow") { - //nextRow.style.display = ""; - i++; - } - } - } + } else { + row.style.display = ""; + + i++; + if (i < rowsLength) { + var nextRow = rows[i]; + if (nextRow.className == "containerRow") { + //nextRow.style.display = ""; + i++; + } } } - </script> - <script> - function doFilter() { - var filterSelectedIndex = statusSelect.selectedIndex; - var statusFilter = statusSelect.options[filterSelectedIndex].value; - var pocFilter = pocSelect.value; - - var rows = dispoTableBody.rows; - - var rowsLength = rows.length; - var i = 0; - while(i < rowsLength) { - var row = rows[i]; - // hide row and possibly container row - if((statusFilter == "ALL" || statusFilter == "Status" ||statusFilter == row.cells[1].innerHTML) && (pocFilter == "" || pocFilter == row.cells[5].innerHTML)) { - row.style.display = ""; - - i++; - if(i < rowsLength) { - var nextRow = rows[i]; - if(nextRow.className == "containerRow") { - //nextRow.style.display = ""; - i++; - } - } - } else { - row.style.display = "none"; - - i++; - if(i < rowsLength) { - var nextRow = rows[i]; - if(nextRow.className == "containerRow") { - nextRow.style.display = "none"; - i++; - } - } - } - } + } + } +</script> +<script> + function doFilter() { + var filterSelectedIndex = statusSelect.selectedIndex; + var statusFilter = statusSelect.options[filterSelectedIndex].value; + var pocFilter = pocSelect.value; + + var rows = dispoTableBody.rows; + + var rowsLength = rows.length; + var i = 0; + while (i < rowsLength) { + var row = rows[i]; + // hide row and possibly container row + if ((statusFilter == "ALL" || statusFilter == "Status" || statusFilter == row.cells[1].innerHTML) && (pocFilter == "" || pocFilter == row.cells[5].innerHTML)) { + row.style.display = ""; + + i++; + if (i < rowsLength) { + var nextRow = rows[i]; + if (nextRow.className == "containerRow") { + //nextRow.style.display = ""; + i++; + } + } + } else { + row.style.display = "none"; + + i++; + if (i < rowsLength) { + var nextRow = rows[i]; + if (nextRow.className == "containerRow") { + nextRow.style.display = "none"; + i++; + } + } } - </script> + } + } +</script> </body>
\ No newline at end of file diff --git a/plugins/org.eclipse.osee.disposition.rest/src/org/eclipse/osee/disposition/rest/util/html/dispoAdmin.html b/plugins/org.eclipse.osee.disposition.rest/src/org/eclipse/osee/disposition/rest/util/html/dispoAdmin.html index 6394401a7e5..c43ee8f39a3 100644 --- a/plugins/org.eclipse.osee.disposition.rest/src/org/eclipse/osee/disposition/rest/util/html/dispoAdmin.html +++ b/plugins/org.eclipse.osee.disposition.rest/src/org/eclipse/osee/disposition/rest/util/html/dispoAdmin.html @@ -35,6 +35,7 @@ <div id="setControls"> <div id="setOperationContainer"> <button disabled="true" id="setOperation" onclick="doImport()">Import</button> + <button id="setOperation" onclick="doReport()">Report</button> </div> <div id="setManageContainer"> <div id="createSetContainer"> @@ -90,6 +91,7 @@ var waitBlanket = document.getElementById("waitBlanket"); var lastFocusedSet = ""; var path = "http://<?serverPort?>/dispo/program/"; + var path2 = "http://<?serverPort?>/dispo/"; </script> <script> function setUpUndoCatch() { @@ -132,6 +134,15 @@ } </script> <script> + function doReport() { + var programSelect = document.getElementById("programSelect"); + var selectedProgramIndex = programSelect.selectedIndex; + var programId = programSelect.options[selectedProgramIndex].value; + var fullPath = path.concat(programId, "/report/"); + post(fullPath, "", postReportStatusHandler, ""); + } + </script> + <script> function getPrograms() { if (programSelect.length < 2) { get(path, getAllProgramsStatusHandler, programSelect); @@ -286,6 +297,13 @@ }; } </script> + <script> + function postReportStatusHandler(unusedParam) { + return function() { + + } + } + </script> <script> function putSetStatusHandler(rowImported) { return function() { |