diff options
author | Angel Avila | 2015-08-12 01:14:28 +0000 |
---|---|---|
committer | Angel Avila | 2015-09-12 01:03:05 +0000 |
commit | bf0053b95f0ade97a381ab41868a4404145fd107 (patch) | |
tree | 9b4b47abe7c90ed469fc3f46cc4bfc59f9eaf071 | |
parent | 37c7112b8c3e5c3621197205a5a61066977b9896 (diff) | |
download | org.eclipse.osee-bf0053b95f0ade97a381ab41868a4404145fd107.tar.gz org.eclipse.osee-bf0053b95f0ade97a381ab41868a4404145fd107.tar.xz org.eclipse.osee-bf0053b95f0ade97a381ab41868a4404145fd107.zip |
feature[ats_ATS216255]: Create Coverage Import Adapter for Dispo
Change-Id: I67f91a40f4cdcd5094056e3d8da3607dedf59927
25 files changed, 472 insertions, 46 deletions
diff --git a/plugins/org.eclipse.osee.disposition.rest.model/src/org/eclipse/osee/disposition/model/DispoAnnotationData.java b/plugins/org.eclipse.osee.disposition.rest.model/src/org/eclipse/osee/disposition/model/DispoAnnotationData.java index a8c05b2cc82..97e9970c309 100644 --- a/plugins/org.eclipse.osee.disposition.rest.model/src/org/eclipse/osee/disposition/model/DispoAnnotationData.java +++ b/plugins/org.eclipse.osee.disposition.rest.model/src/org/eclipse/osee/disposition/model/DispoAnnotationData.java @@ -138,7 +138,7 @@ public class DispoAnnotationData implements Identifiable<String> { } public boolean isValid() { - return isConnected && isResolutionValid && isResolutionTypeValid(); + return (isConnected || isDefault) && isResolutionValid && isResolutionTypeValid(); } public boolean isResolutionTypeValid() { diff --git a/plugins/org.eclipse.osee.disposition.rest.test/src/org/eclipse/osee/disposition/rest/resources/AnnotationResourceTest.java b/plugins/org.eclipse.osee.disposition.rest.test/src/org/eclipse/osee/disposition/rest/resources/AnnotationResourceTest.java index d6a42577756..80a74dc27dd 100644 --- a/plugins/org.eclipse.osee.disposition.rest.test/src/org/eclipse/osee/disposition/rest/resources/AnnotationResourceTest.java +++ b/plugins/org.eclipse.osee.disposition.rest.test/src/org/eclipse/osee/disposition/rest/resources/AnnotationResourceTest.java @@ -153,7 +153,6 @@ public class AnnotationResourceTest { when(dispoItem.getStatus()).thenReturn(DispoStrings.Item_InComplete); Response response = resource.deleteDispoAnnotation(annotationToEdit.getId(), "name"); assertEquals(Response.Status.OK.getStatusCode(), response.getStatus()); - assertEquals(DispoStrings.Item_InComplete, response.getEntity()); when(dispositionApi.deleteDispoAnnotation(program, "itemId", annotationToEdit.getId(), "name")).thenReturn(false); response = resource.deleteDispoAnnotation(annotationToEdit.getId(), "name"); diff --git a/plugins/org.eclipse.osee.disposition.rest.test/src/org/eclipse/osee/disposition/rest/resources/DispoItemResourceTest.java b/plugins/org.eclipse.osee.disposition.rest.test/src/org/eclipse/osee/disposition/rest/resources/DispoItemResourceTest.java index 33e8a3ce304..46e4324a2e8 100644 --- a/plugins/org.eclipse.osee.disposition.rest.test/src/org/eclipse/osee/disposition/rest/resources/DispoItemResourceTest.java +++ b/plugins/org.eclipse.osee.disposition.rest.test/src/org/eclipse/osee/disposition/rest/resources/DispoItemResourceTest.java @@ -62,7 +62,7 @@ public class DispoItemResourceTest { // No Items List<DispoItem> emptyResultSet = new ArrayList<DispoItem>(); when(dispositionApi.getDispoItems(program, "setId")).thenReturn(emptyResultSet); - Response noItemsResponse = resource.getAllDispoItems(); + Response noItemsResponse = resource.getAllDispoItems(false); assertEquals(Response.Status.OK.getStatusCode(), noItemsResponse.getStatus()); DispoItemData item = new DispoItemData(); @@ -72,7 +72,7 @@ public class DispoItemResourceTest { List<DispoItem> resultSet = Collections.singletonList((DispoItem) item); when(dispositionApi.getDispoItems(program, "setId")).thenReturn(resultSet); - Response response = resource.getAllDispoItems(); + Response response = resource.getAllDispoItems(false); JSONArray entity = new JSONArray((String) response.getEntity()); JSONObject itemFromResponse = entity.getJSONObject(0); assertEquals(Response.Status.OK.getStatusCode(), response.getStatus()); diff --git a/plugins/org.eclipse.osee.disposition.rest/META-INF/MANIFEST.MF b/plugins/org.eclipse.osee.disposition.rest/META-INF/MANIFEST.MF index a29c9a4d85d..08125ffdbcb 100644 --- a/plugins/org.eclipse.osee.disposition.rest/META-INF/MANIFEST.MF +++ b/plugins/org.eclipse.osee.disposition.rest/META-INF/MANIFEST.MF @@ -32,3 +32,4 @@ Import-Package: org.eclipse.osee.vcast, org.eclipse.osee.vcast.model, org.json +Export-Package: org.eclipse.osee.disposition.rest.coverage 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 754978cd10b..085cae6c37d 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 @@ -63,6 +63,8 @@ public interface DispoApi { String copyDispoSet(DispoProgram program, DispoSet destination, DispoSet source, CopySetParams params); + String copyDispoSetCoverage(long sourceBranch, String sourceCoverageGuid, DispoProgram destDispProgram, DispoSet destination, CopySetParams params); + // Deletes boolean deleteDispoSet(DispoProgram program, String dispoSetId); 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 03465965fbe..858760db061 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 @@ -36,6 +36,7 @@ import org.eclipse.osee.disposition.rest.DispoImporterApi; import org.eclipse.osee.disposition.rest.internal.importer.DispoImporterFactory; import org.eclipse.osee.disposition.rest.internal.importer.DispoImporterFactory.ImportFormat; import org.eclipse.osee.disposition.rest.internal.importer.DispoSetCopier; +import org.eclipse.osee.disposition.rest.internal.importer.coverage.CoverageAdapter; import org.eclipse.osee.disposition.rest.internal.report.OperationReport; import org.eclipse.osee.disposition.rest.util.DispoFactory; import org.eclipse.osee.disposition.rest.util.DispoUtil; @@ -491,6 +492,23 @@ public class DispoApiImpl implements DispoApi { } @Override + public String copyDispoSetCoverage(long sourceBranch, String sourceCoverageGuid, DispoProgram destDispProgram, DispoSet destination, CopySetParams params) { + Map<String, ArtifactReadable> coverageUnits = getQuery().getCoverageUnits(sourceBranch, sourceCoverageGuid); + List<DispoItem> destItems = getDispoItems(destDispProgram, destination.getGuid()); + + OperationReport report = new OperationReport(); + + CoverageAdapter coverageAdapter = new CoverageAdapter(dispoConnector); + List<DispoItem> copyData = coverageAdapter.copyData(coverageUnits, destItems, report); + + if (!copyData.isEmpty()) { + editDispoItems(destDispProgram, copyData, false); + } + + return generateReportArt(destDispProgram, getQuery().findUser(), report, "Import Coverage Package"); + } + + @Override public String copyDispoSet(DispoProgram program, DispoSet destination, DispoSet source, CopySetParams params) { List<DispoItem> sourceItems = getDispoItems(program, source.getGuid()); Map<String, DispoItemData> namesToDestItems = new HashMap<String, DispoItemData>(); diff --git a/plugins/org.eclipse.osee.disposition.rest/src/org/eclipse/osee/disposition/rest/internal/DispoConnector.java b/plugins/org.eclipse.osee.disposition.rest/src/org/eclipse/osee/disposition/rest/internal/DispoConnector.java index a1dcb220240..8abd96cb7df 100644 --- a/plugins/org.eclipse.osee.disposition.rest/src/org/eclipse/osee/disposition/rest/internal/DispoConnector.java +++ b/plugins/org.eclipse.osee.disposition.rest/src/org/eclipse/osee/disposition/rest/internal/DispoConnector.java @@ -198,7 +198,7 @@ public class DispoConnector { while (locationRefsStack.size() > 0) { LocationRange locRef = locationRefsStack.pop(); if (locRef.getEnd() < startIndex) { - // go to next + // go to next } else { if (locRef.getStart() == firstUncoveredIndex) { if (locRef.getEnd() == endIndex) { diff --git a/plugins/org.eclipse.osee.disposition.rest/src/org/eclipse/osee/disposition/rest/internal/DispoQuery.java b/plugins/org.eclipse.osee.disposition.rest/src/org/eclipse/osee/disposition/rest/internal/DispoQuery.java index 2bf87056f4a..092b70e388a 100644 --- a/plugins/org.eclipse.osee.disposition.rest/src/org/eclipse/osee/disposition/rest/internal/DispoQuery.java +++ b/plugins/org.eclipse.osee.disposition.rest/src/org/eclipse/osee/disposition/rest/internal/DispoQuery.java @@ -12,6 +12,7 @@ package org.eclipse.osee.disposition.rest.internal; import java.util.Collection; import java.util.List; +import java.util.Map; import java.util.Set; import org.eclipse.osee.disposition.model.DispoConfig; import org.eclipse.osee.disposition.model.DispoItem; @@ -25,6 +26,8 @@ import org.eclipse.osee.orcs.data.ArtifactReadable; */ public interface DispoQuery { + Map<String, ArtifactReadable> getCoverageUnits(long branchUuid, String artifactUuid); + ArtifactReadable findUser(); ArtifactReadable findUser(String userId); 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 160d4758294..188f1461d6a 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 @@ -17,14 +17,17 @@ import java.io.InputStream; import java.util.ArrayList; import java.util.Collection; import java.util.Date; +import java.util.HashMap; import java.util.HashSet; import java.util.List; +import java.util.Map; import java.util.Set; import org.eclipse.osee.disposition.model.DispoConfig; import org.eclipse.osee.disposition.model.DispoItem; import org.eclipse.osee.disposition.model.DispoProgram; import org.eclipse.osee.disposition.model.DispoSet; import org.eclipse.osee.disposition.rest.DispoConstants; +import org.eclipse.osee.disposition.rest.internal.importer.coverage.CoverageUtil; import org.eclipse.osee.disposition.rest.util.DispoUtil; import org.eclipse.osee.framework.core.data.ArtifactId; import org.eclipse.osee.framework.core.data.IArtifactType; @@ -514,4 +517,27 @@ public class OrcsStorageImpl implements Storage { return toReturn; } + + @Override + public Map<String, ArtifactReadable> getCoverageUnits(long branchUuid, String artifactUuid) { + ArtifactReadable coveragePackage = + getQuery().fromBranch(branchUuid).andGuid(artifactUuid).getResults().getOneOrNull(); + + List<ArtifactReadable> descendants = coveragePackage.getDescendants(); + return getChildrenRecurse(descendants); + } + + private Map<String, ArtifactReadable> getChildrenRecurse(List<ArtifactReadable> descendants) { + Map<String, ArtifactReadable> toReturn = new HashMap<String, ArtifactReadable>(); + + for (ArtifactReadable descendant : descendants) { + if (!descendant.getAttributeValues(CoverageUtil.Item).isEmpty()) { + ArtifactReadable parent = descendant.getParent(); + String fullName = String.format("%s.%s", parent.getName(), descendant.getName()); + toReturn.put(fullName, descendant); + } + } + + return toReturn; + } } diff --git a/plugins/org.eclipse.osee.disposition.rest/src/org/eclipse/osee/disposition/rest/internal/importer/coverage/CoverageAdapter.java b/plugins/org.eclipse.osee.disposition.rest/src/org/eclipse/osee/disposition/rest/internal/importer/coverage/CoverageAdapter.java new file mode 100644 index 00000000000..18cd11e1c09 --- /dev/null +++ b/plugins/org.eclipse.osee.disposition.rest/src/org/eclipse/osee/disposition/rest/internal/importer/coverage/CoverageAdapter.java @@ -0,0 +1,161 @@ +/******************************************************************************* + * Copyright (c) 2015 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.coverage; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.HashMap; +import java.util.Iterator; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; +import org.eclipse.osee.disposition.model.Discrepancy; +import org.eclipse.osee.disposition.model.DispoAnnotationData; +import org.eclipse.osee.disposition.model.DispoItem; +import org.eclipse.osee.disposition.model.DispoItemData; +import org.eclipse.osee.disposition.rest.internal.DispoConnector; +import org.eclipse.osee.disposition.rest.internal.report.OperationReport; +import org.eclipse.osee.disposition.rest.util.DispoUtil; +import org.eclipse.osee.framework.jdk.core.type.OseeCoreException; +import org.eclipse.osee.framework.jdk.core.type.PropertyStore; +import org.eclipse.osee.framework.jdk.core.util.GUID; +import org.eclipse.osee.orcs.data.ArtifactReadable; +import org.json.JSONException; +import org.json.JSONObject; + +/** + * @author Angel Avila + */ +public class CoverageAdapter { + + private final DispoConnector dispoConnector; + private static String PROPERTY_STORE_ID = "coverage.item"; + + public CoverageAdapter(DispoConnector dispoConnector) { + this.dispoConnector = dispoConnector; + } + + public List<DispoItem> copyData(Map<String, ArtifactReadable> nameToCoverageUnit, List<DispoItem> dispoItems, OperationReport report) { + Map<String, DispoItem> nameToDispoItem = getNameToDispoItemMap(dispoItems); + + List<DispoItem> modifiedItems = new ArrayList<DispoItem>(); + + for (Entry<String, ArtifactReadable> entry : nameToCoverageUnit.entrySet()) { + DispoItem dispoItem = nameToDispoItem.get(entry.getKey()); + + if (dispoItem != null) { + List<DispoAnnotationData> newAnnotations = copyCoverageData(entry.getValue(), dispoItem, report); + if (!newAnnotations.isEmpty()) { + DispoItemData newItem = new DispoItemData(); + newItem.setName(dispoItem.getName()); + newItem.setGuid(dispoItem.getGuid()); + newItem.setAnnotationsList(DispoUtil.listAsJsonArray(newAnnotations)); + + String newStatus; + try { + newItem.setDiscrepanciesList(dispoItem.getDiscrepanciesList()); + newStatus = dispoConnector.getItemStatus(newItem); + newItem.setStatus(newStatus); + } catch (JSONException ex) { + report.addMessageForItem(newItem.getName(), "Could not determine Status"); + } + + modifiedItems.add(newItem); + } + } + + } + return modifiedItems; + } + + private List<DispoAnnotationData> copyCoverageData(ArtifactReadable source, DispoItem dest, OperationReport report) { + boolean madeChange = false; + List<String> covearageItems = source.getAttributeValues(CoverageUtil.Item); + Map<String, Discrepancy> textToDiscrepancyMap = getTextToDiscrepancyMap(dest); + List<DispoAnnotationData> annotations = DispoUtil.asAnnotationsList(dest.getAnnotationsList()); + + PropertyStore store = new PropertyStore(); + + for (String covearageItem : covearageItems) { + try { + store.load(covearageItem); + } catch (Exception ex) { + throw new OseeCoreException(ex); + } + if (!store.getId().equals(PROPERTY_STORE_ID)) { + report.addOtherMessage("Invalid store id [%s] for CoverageItem", store.getId()); + } + + String textFromCoverage = store.get("name").trim(); + String lineNumberFromCoverage = store.get("order"); + String resolutionFromCoverage = store.get("methodType").trim(); + + Discrepancy matchedDiscrepancy = textToDiscrepancyMap.get(textFromCoverage); + if (!resolutionFromCoverage.equalsIgnoreCase("Test_Unit") && !resolutionFromCoverage.equalsIgnoreCase("Exception_Handling") && matchedDiscrepancy != null) { + madeChange = true; + // Add Annotation + DispoAnnotationData newAnnotation = new DispoAnnotationData(); + newAnnotation.setId(GUID.create()); + newAnnotation.setIsDefault(false); + newAnnotation.setResolutionType(resolutionFromCoverage); + newAnnotation.setIsResolutionValid(true); + newAnnotation.setIndex(annotations.size()); + newAnnotation.setLocationRefs(lineNumberFromCoverage); + newAnnotation.setCustomerNotes(textFromCoverage); + newAnnotation.setResolution(""); + newAnnotation.setDeveloperNotes(""); + try { + dispoConnector.connectAnnotation(newAnnotation, dest.getDiscrepanciesList()); + } catch (JSONException ex) { + throw new OseeCoreException(ex); + } + + annotations.add(newAnnotation.getIndex(), newAnnotation); + } else if (matchedDiscrepancy == null) { + report.addMessageForItem(source.getName(), "Could not find matching Discrepancy for [%s]", covearageItem); + } + } + + if (madeChange) { + return annotations; + } else { + return Collections.emptyList(); + } + } + + private Map<String, Discrepancy> getTextToDiscrepancyMap(DispoItem dest) { + Map<String, Discrepancy> toReturn = new HashMap<String, Discrepancy>(); + + JSONObject discrepanciesList = dest.getDiscrepanciesList(); + @SuppressWarnings("rawtypes") + Iterator keys = discrepanciesList.keys(); + while (keys.hasNext()) { + String key = (String) keys.next(); + Discrepancy discrepancy; + try { + discrepancy = DispoUtil.jsonObjToDiscrepancy(discrepanciesList.getJSONObject(key)); + toReturn.put(discrepancy.getText(), discrepancy); + } catch (JSONException ex) { + throw new OseeCoreException(ex); + } + } + + return toReturn; + } + + private Map<String, DispoItem> getNameToDispoItemMap(List<DispoItem> items) { + Map<String, DispoItem> toReturn = new HashMap<String, DispoItem>(); + for (DispoItem item : items) { + toReturn.put(item.getName(), item); + } + return toReturn; + } +} diff --git a/plugins/org.eclipse.osee.disposition.rest/src/org/eclipse/osee/disposition/rest/internal/importer/coverage/CoverageUtil.java b/plugins/org.eclipse.osee.disposition.rest/src/org/eclipse/osee/disposition/rest/internal/importer/coverage/CoverageUtil.java new file mode 100644 index 00000000000..f230e9c62bf --- /dev/null +++ b/plugins/org.eclipse.osee.disposition.rest/src/org/eclipse/osee/disposition/rest/internal/importer/coverage/CoverageUtil.java @@ -0,0 +1,35 @@ +/******************************************************************************* + * Copyright (c) 2015 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.coverage; + +import org.eclipse.osee.framework.core.data.IArtifactType; +import org.eclipse.osee.framework.core.data.IAttributeType; +import org.eclipse.osee.framework.core.data.TokenFactory; + +/** + * @author Angel Avila + */ +public class CoverageUtil { + + private CoverageUtil() { + + } + // @formatter:off + public static final IArtifactType CoveragePackage = TokenFactory.createArtifactType(0x000000000000004B, "Coverage Package"); + public static final IArtifactType CoverageUnit = TokenFactory.createArtifactType(0x000000000000004E, "Coverage Unit"); + public static final IArtifactType CoverageFolder = TokenFactory.createArtifactType(0x000000000000004D, "Coverage Folder"); + + // Attributes + public static final IAttributeType Item = TokenFactory.createAttributeType(0x1000000000000104L, "coverage.Coverage Item"); + + //@formatter:on + +} diff --git a/plugins/org.eclipse.osee.disposition.rest/src/org/eclipse/osee/disposition/rest/internal/importer/coverage/LisFileParser.java b/plugins/org.eclipse.osee.disposition.rest/src/org/eclipse/osee/disposition/rest/internal/importer/coverage/LisFileParser.java index 105bbfdc255..aef442118ad 100644 --- a/plugins/org.eclipse.osee.disposition.rest/src/org/eclipse/osee/disposition/rest/internal/importer/coverage/LisFileParser.java +++ b/plugins/org.eclipse.osee.disposition.rest/src/org/eclipse/osee/disposition/rest/internal/importer/coverage/LisFileParser.java @@ -199,16 +199,18 @@ public class LisFileParser implements DispoImporterApi { } for (VCastFunction function : functions) { - processFunction(lisFileName, lisFileParser, fileNum, dataStore, instrumentedFile, function, report); + processFunction(instrumentedFile, lisFileParser, fileNum, dataStore, instrumentedFile, function, report); } } } - private void processFunction(String lisFileName, VCastLisFileParser lisFileParser, int fileNum, VCastDataStore dataStore, VCastInstrumentedFile instrumentedFile, VCastFunction function, OperationReport report) { + private void processFunction(VCastInstrumentedFile lisFile, VCastLisFileParser lisFileParser, int fileNum, VCastDataStore dataStore, VCastInstrumentedFile instrumentedFile, VCastFunction function, OperationReport report) { int functionNum = function.getFindex(); DispoItemData newItem = new DispoItemData(); newItem.setAnnotationsList(new JSONArray()); - newItem.setName(lisFileName + "." + function.getName()); + VCastSourceFileJoin sourceFileJoin = dataStore.getSourceFileJoin(lisFile); + lisFile.getLISFile(); + newItem.setName(sourceFileJoin.getDisplayName() + "." + function.getName()); newItem.setFileNumber(Integer.toString(fileNum)); newItem.setMethodNumber(Integer.toString(functionNum)); @@ -228,15 +230,15 @@ public class LisFileParser implements DispoImporterApi { Map<String, JSONObject> discrepancies = new HashMap<String, JSONObject>(); for (VCastStatementCoverage statementCoverageItem : statementCoverageItems) { - processStatement(lisFileName, lisFileParser, fileNum, functionNum, function, statementCoverageItem, - discrepancies, report); + processStatement(lisFile, lisFileParser, fileNum, functionNum, function, statementCoverageItem, discrepancies, + report); } - newItem.setDiscrepanciesList(new JSONObject(discrepancies)); // add discrepancies to item + newItem.setDiscrepanciesList(new JSONObject(discrepancies)); } - private void processStatement(String lisFileName, VCastLisFileParser lisFileParser, int fileNum, int functionNum, VCastFunction function, VCastStatementCoverage statementCoverageItem, Map<String, JSONObject> discrepancies, OperationReport report) { + private void processStatement(VCastInstrumentedFile lisFile, VCastLisFileParser lisFileParser, int fileNum, int functionNum, VCastFunction function, VCastStatementCoverage statementCoverageItem, Map<String, JSONObject> discrepancies, OperationReport report) { // Create discrepancy for every line, annotate with test unit or exception handled Integer functionNumber = function.getFindex(); Integer lineNumber = statementCoverageItem.getLine(); @@ -247,7 +249,8 @@ public class LisFileParser implements DispoImporterApi { try { lineData = lisFileParser.getSourceCodeForLine(functionNumber, lineNumber); } catch (Exception ex) { - report.addOtherMessage("Error parsing LIS file: [%s], on function [%s]", lisFileName, function.getName()); + report.addOtherMessage("Error parsing LIS file: [%s], on function [%s]", lisFile.getLISFile(), + function.getName()); } if (lineData != null) { diff --git a/plugins/org.eclipse.osee.disposition.rest/src/org/eclipse/osee/disposition/rest/resources/AnnotationResource.java b/plugins/org.eclipse.osee.disposition.rest/src/org/eclipse/osee/disposition/rest/resources/AnnotationResource.java index dd2555532ee..09b0413b5af 100644 --- a/plugins/org.eclipse.osee.disposition.rest/src/org/eclipse/osee/disposition/rest/resources/AnnotationResource.java +++ b/plugins/org.eclipse.osee.disposition.rest/src/org/eclipse/osee/disposition/rest/resources/AnnotationResource.java @@ -25,7 +25,6 @@ import javax.ws.rs.core.MediaType; import javax.ws.rs.core.Response; import javax.ws.rs.core.Response.Status; import org.eclipse.osee.disposition.model.DispoAnnotationData; -import org.eclipse.osee.disposition.model.DispoItem; import org.eclipse.osee.disposition.model.DispoMessages; import org.eclipse.osee.disposition.model.DispoProgram; import org.eclipse.osee.disposition.rest.DispoApi; @@ -49,7 +48,7 @@ public class AnnotationResource { /** * Create a new Annotation given an AnnotationData object - * + * * @param annotation AnnotationData which must include location reference * @return The created Annotation if successful. Error Code otherwise * @response.representation.201.doc Created the Annotation @@ -80,7 +79,7 @@ public class AnnotationResource { /** * Get all Annotations for the DisposionableItem - * + * * @return The Annotation found for the DisposionableItem * @throws JSONException * @throws IOException @@ -103,7 +102,7 @@ public class AnnotationResource { /** * Get a specific Annotation given an Id - * + * * @param id The Id of the Annotation to search for * @return The found Annotation if successful. Error Code otherwise * @response.representation.200.doc OK, found Annotation @@ -125,7 +124,7 @@ public class AnnotationResource { /** * Edit a specific Annotation given an Id and new Annotation Data - * + * * @param id The Id of the Annotation to update * @param newAnnotation The data for the new Annotation * @return The updated Annotation if successful. Error Code otherwise @@ -149,7 +148,7 @@ public class AnnotationResource { /** * Delete a specific Annotation given an Id - * + * * @param id The Id of the Annotation to delete * @return Response Code * @response.representation.200.doc OK @@ -161,8 +160,7 @@ public class AnnotationResource { Response response; boolean wasEdited = dispoApi.deleteDispoAnnotation(program, itemId, annotationId, userName); if (wasEdited) { - DispoItem dispoItemById = dispoApi.getDispoItemById(program, itemId); - response = Response.status(Response.Status.OK).entity(dispoItemById.getStatus()).build(); + response = Response.status(Response.Status.OK).build(); } else { response = Response.status(Response.Status.NOT_MODIFIED).build(); } diff --git a/plugins/org.eclipse.osee.disposition.rest/src/org/eclipse/osee/disposition/rest/resources/DispoAdminResource.java b/plugins/org.eclipse.osee.disposition.rest/src/org/eclipse/osee/disposition/rest/resources/DispoAdminResource.java index fda99455fc9..34584033746 100644 --- a/plugins/org.eclipse.osee.disposition.rest/src/org/eclipse/osee/disposition/rest/resources/DispoAdminResource.java +++ b/plugins/org.eclipse.osee.disposition.rest/src/org/eclipse/osee/disposition/rest/resources/DispoAdminResource.java @@ -96,6 +96,27 @@ public class DispoAdminResource { return Response.ok(streamingOutput).header("Content-Disposition", contentDisposition).type("application/xml").build(); } + @Path("/copyCoverage") + @POST + @RolesAllowed(DispoRoles.ROLES_ADMINISTRATOR) + @Consumes(MediaType.APPLICATION_JSON) + @Produces(MediaType.APPLICATION_JSON) + public Response getDispoSetCopyCoverage(@QueryParam("destinationSet") String destinationSet, @QueryParam("sourceBranch") Long sourceBranch, @QueryParam("sourcePackage") String sourcePackage, CopySetParams params) { + Response.Status status; + final DispoSet destination = dispoApi.getDispoSetById(program, destinationSet); + + String reportUrl = dispoApi.copyDispoSetCoverage(sourceBranch, sourcePackage, program, destination, params); + DispoSetData responseSet = new DispoSetData(); + responseSet.setOperationStatus(reportUrl); + + if (Strings.isValid(reportUrl)) { + status = Status.OK; + } else { + status = Status.NOT_FOUND; + } + return Response.status(status).entity(responseSet).build(); + } + @Path("/copy") @POST @RolesAllowed(DispoRoles.ROLES_ADMINISTRATOR) 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 00fa5a4c43b..5f0405364f8 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 @@ -18,6 +18,7 @@ import javax.ws.rs.PUT; import javax.ws.rs.Path; import javax.ws.rs.PathParam; import javax.ws.rs.Produces; +import javax.ws.rs.QueryParam; import javax.ws.rs.core.MediaType; import javax.ws.rs.core.Response; import javax.ws.rs.core.Response.ResponseBuilder; @@ -45,11 +46,11 @@ public class DispoItemResource { @GET @Produces(MediaType.APPLICATION_JSON) - public Response getAllDispoItems() throws Exception { + public Response getAllDispoItems(@QueryParam("isDetailed") Boolean isDetailed) throws Exception { List<DispoItem> dispoItems = dispoApi.getDispoItems(program, setId); JSONArray jarray = new JSONArray(); for (DispoItem dispoItem : dispoItems) { - jarray.put(DispoUtil.dispoItemToJsonObj(dispoItem)); + jarray.put(DispoUtil.dispoItemToJsonObj(dispoItem, isDetailed)); } ResponseBuilder builder = Response.ok(jarray.toString()); @@ -58,7 +59,7 @@ public class DispoItemResource { /** * Get a specific Dispositionable Item given a itemId - * + * * @param itemId The Id of the Dispositionable Item to search for * @return The found Dispositionable Item if successful. Error Code otherwise * @response.representation.200.doc OK, Found Dispositionable Item @@ -80,7 +81,7 @@ public class DispoItemResource { /** * Edit a specific Dispositionable Item given a itemId and new Dispositionable Item Data - * + * * @param itemId The Id of the Dispositionable Item to search for * @param newDispoItem The data for the new Dispositionable Item * @return The updated Dispositionable Item if successful. Error Code otherwise @@ -103,7 +104,7 @@ public class DispoItemResource { /** * Delete a specific Dispositionable Item given a itemId - * + * * @param itemId The Id of the Dispositionable Item to search for * @return Response Code * @response.representation.200.doc OK, Found Dispositionable Item diff --git a/plugins/org.eclipse.osee.disposition.rest/src/org/eclipse/osee/disposition/rest/resources/DispoSetResource.java b/plugins/org.eclipse.osee.disposition.rest/src/org/eclipse/osee/disposition/rest/resources/DispoSetResource.java index b7a0629d965..28f6244daab 100644 --- a/plugins/org.eclipse.osee.disposition.rest/src/org/eclipse/osee/disposition/rest/resources/DispoSetResource.java +++ b/plugins/org.eclipse.osee.disposition.rest/src/org/eclipse/osee/disposition/rest/resources/DispoSetResource.java @@ -214,7 +214,7 @@ public class DispoSetResource { @Path("{setId}/search") @GET @Produces(MediaType.APPLICATION_JSON) - public Response getDispoItemsByAnnotationText(@PathParam("setId") String setId, @QueryParam("value") String value) { + public Response getDispoItemsByAnnotationText(@PathParam("setId") String setId, @QueryParam("value") String value, @QueryParam("isDetailed") boolean isDetailed) { Response response; Collection<DispoItem> foundItems = dispoApi.getDispoItemByAnnotationText(program, setId, value); if (foundItems.isEmpty()) { @@ -222,7 +222,7 @@ public class DispoSetResource { } else { JSONArray jArray = new JSONArray(); for (DispoItem item : foundItems) { - jArray.put(DispoUtil.dispoItemToJsonObj(item)); + jArray.put(DispoUtil.dispoItemToJsonObj(item, isDetailed)); } response = Response.status(Response.Status.OK).entity(jArray.toString()).build(); diff --git a/plugins/org.eclipse.osee.disposition.rest/src/org/eclipse/osee/disposition/rest/resources/DispoSourceFileResource.java b/plugins/org.eclipse.osee.disposition.rest/src/org/eclipse/osee/disposition/rest/resources/DispoSourceFileResource.java index 39d2eac1220..3b69ca25a1c 100644 --- a/plugins/org.eclipse.osee.disposition.rest/src/org/eclipse/osee/disposition/rest/resources/DispoSourceFileResource.java +++ b/plugins/org.eclipse.osee.disposition.rest/src/org/eclipse/osee/disposition/rest/resources/DispoSourceFileResource.java @@ -48,7 +48,7 @@ public class DispoSourceFileResource { /** * Get a specific Source File given a file name - * + * * @param fileName The name of the Source File to search for * @return The found Source File if successful. Error Code otherwise * @throws FileNotFoundException @@ -60,7 +60,7 @@ public class DispoSourceFileResource { @Produces(MediaType.APPLICATION_OCTET_STREAM) public Response getDispoItemsById(@PathParam("fileName") String fileName) { if (!fileName.endsWith(".LIS")) { - fileName = fileName.replaceAll(".LIS.*", ".LIS"); + fileName = fileName.replaceAll("\\.(ada|c)", ".LIS"); } DispoSet set = dispoApi.getDispoSetById(program, setId); 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 612d8ead30e..f8891520e98 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 @@ -241,10 +241,13 @@ public final class DispoUtil { return dispoSet; } - public static JSONObject dispoItemToJsonObj(DispoItem dispoItem) { + public static JSONObject dispoItemToJsonObj(DispoItem dispoItem, boolean isDeatailed) { JSONObject jsonObject = new JSONObject(); try { jsonObject.put("discrepanciesAsRanges", discrepanciesToString(dispoItem.getDiscrepanciesList())); + if (isDeatailed) { + jsonObject.put("discrepancies", dispoItem.getDiscrepanciesList()); + } jsonObject.put("failureCount", dispoItem.getDiscrepanciesList().length()); jsonObject.put("name", dispoItem.getName()); jsonObject.put("status", dispoItem.getStatus()); @@ -325,6 +328,9 @@ public final class DispoUtil { if (object.has("isConnected")) { dispoAnnotation.setIsConnected(object.getBoolean("isConnected")); } + if (object.has("isDefault")) { + dispoAnnotation.setIsDefault(object.getBoolean("isDefault")); + } if (object.has("isResolutionValid")) { dispoAnnotation.setIsResolutionValid(object.getBoolean("isResolutionValid")); } @@ -385,4 +391,30 @@ public final class DispoUtil { return configData; } + + public static List<DispoAnnotationData> asAnnotationsList(JSONArray annotations) { + List<DispoAnnotationData> toReturn = new ArrayList<DispoAnnotationData>(); + for (int i = 0; i < annotations.length(); i++) { + try { + toReturn.add(jsonObjToDispoAnnotationData(annotations.getJSONObject(i))); + } catch (JSONException ex) { + throw new OseeCoreException(ex); + } + } + + return toReturn; + } + + public static JSONArray listAsJsonArray(List<DispoAnnotationData> annotations) { + JSONArray toReturn = new JSONArray(); + for (DispoAnnotationData annotation : annotations) { + try { + toReturn.put(annotation.getIndex(), annotationToJsonObj(annotation)); + } catch (JSONException ex) { + throw new OseeCoreException(ex); + } + } + + return toReturn; + } } diff --git a/plugins/org.eclipse.osee.disposition.rest/web/legacy/js/userController.js b/plugins/org.eclipse.osee.disposition.rest/web/legacy/js/userController.js index 08aa8dfecb5..8cd817e18d9 100644 --- a/plugins/org.eclipse.osee.disposition.rest/web/legacy/js/userController.js +++ b/plugins/org.eclipse.osee.disposition.rest/web/legacy/js/userController.js @@ -18,7 +18,7 @@ app.controller('userController', [ $scope.lastFocused = null; $scope.isMulitEditRequest = false; $scope.loading = false; - $scope.isSearchView = false; + $scope.isSearchView = false; $scope.getDispoType = function() { if($rootScope.type == 'codeCoverage') { @@ -92,7 +92,8 @@ app.controller('userController', [ } else { Item.query({ programId: $scope.programSelection, - setId: $scope.setSelection + setId: $scope.setSelection, + isDetailed: $rootScope.type == 'codeCoverage' }, function(data) { loadingModal.close(); $scope.items = data; @@ -702,6 +703,7 @@ app.controller('userController', [ programId: $scope.programSelection, setId: $scope.setSelection, value: value, + isDetailed: $rootScope.type == 'codeCoverage', }, function(data) { if($scope.isSearchView) { $scope.items = data; diff --git a/plugins/org.eclipse.osee.web.ui/src/dispo/js/adminController.js b/plugins/org.eclipse.osee.web.ui/src/dispo/js/adminController.js index 5eceaf326c8..239125ec4fc 100644 --- a/plugins/org.eclipse.osee.web.ui/src/dispo/js/adminController.js +++ b/plugins/org.eclipse.osee.web.ui/src/dispo/js/adminController.js @@ -1,5 +1,5 @@ - app.controller('adminController', ['$scope', '$rootScope', '$modal', 'Program', 'Set', 'Report', 'CopySet', - function($scope, $rootScope, $modal, Program, Set, Report, CopySet) { + app.controller('adminController', ['$scope', '$rootScope', '$modal', 'Program', 'Set', 'Report', 'CopySet', 'CopySetCoverage', + function($scope, $rootScope, $modal, Program, Set, Report, CopySet, CopySetCoverage) { $scope.readOnly = true; $scope.programSelection = null; $scope.modalShown = false; @@ -277,6 +277,20 @@ return modalInstance; } + $scope.copySetCoverage = function(inputs) { + var copySetOp = new CopySetCoverage; + + copySetOp.$save({ + programId: $scope.programSelection, + destinationSet: inputs.destinationSet, + sourceBranch: inputs.sourceBranch, + sourcePackage: inputs.sourcePackage, + }, function(data) { + var reportUrl = data.operationStatus; + window.open(reportUrl); + console.log(data); + }); + } // Create Set Modal $scope.createNewSetModal = function() { @@ -356,6 +370,44 @@ $modalInstance.dismiss('cancel'); }; }; + + + // Copy Coverage Modal + $scope.openCopyCoverageModal = function() { + var modalInstance = $modal.open({ + templateUrl: 'copySetCoverage.html', + controller: CopyCoverageModalCtrl, + size: 'md', + windowClass: 'copyCoverageModal', + resolve: { + sets: function() { + return $scope.sets; + } + } + }); + + modalInstance.result.then(function(inputs) { + $scope.copySetCoverage(inputs); + }); + } + + + var CopyCoverageModalCtrl = function($scope, $modalInstance, sets) { + $scope.setsLocal = angular.copy(sets); + + $scope.ok = function() { + var inputs = {}; + inputs.destinationSet = this.destinationSet; + inputs.sourceBranch = this.sourceBranch; + inputs.sourcePackage = this.sourcePackage; + + $modalInstance.close(inputs); + }; + + $scope.cancel = function() { + $modalInstance.dismiss('cancel'); + }; + }; } ]);
\ No newline at end of file diff --git a/plugins/org.eclipse.osee.web.ui/src/dispo/js/dispoApp.js b/plugins/org.eclipse.osee.web.ui/src/dispo/js/dispoApp.js index c8a4b9cf9e3..631cc8387fe 100644 --- a/plugins/org.eclipse.osee.web.ui/src/dispo/js/dispoApp.js +++ b/plugins/org.eclipse.osee.web.ui/src/dispo/js/dispoApp.js @@ -90,6 +90,15 @@ app.provider('CopySet', function() { ]; }); +app.provider('CopySetCoverage', function() { + this.$get = ['$resource', + function($resource) { + var CopySetCoverage = $resource('/dispo/program/:programId/admin/copyCoverage', {}, {}); + return CopySetCoverage; + } + ]; +}); + app.provider('Set', function() { this.$get = ['$resource', function($resource) { diff --git a/plugins/org.eclipse.osee.web.ui/src/dispo/js/userController.js b/plugins/org.eclipse.osee.web.ui/src/dispo/js/userController.js index 9fe767fdcd6..00037c80f3f 100644 --- a/plugins/org.eclipse.osee.web.ui/src/dispo/js/userController.js +++ b/plugins/org.eclipse.osee.web.ui/src/dispo/js/userController.js @@ -10,7 +10,8 @@ app.controller('userController', [ 'SetSearch', 'SourceFile', 'ColumnFactory', - function($scope, $modal, $rootScope, $cookieStore, Program, Set, Item, Annotation, SetSearch, SourceFile, ColumnFactory) { + 'Config', + function($scope, $modal, $rootScope, $cookieStore, Program, Set, Item, Annotation, SetSearch, SourceFile, ColumnFactory, Config) { $scope.unselectingItem = false; $scope.editItems = false; $scope.selectedItems = []; @@ -19,7 +20,8 @@ app.controller('userController', [ $scope.lastFocused = null; $scope.isMulitEditRequest = false; $scope.loading = false; - $scope.isSearchView = false; + $scope.isSearchView = false; + $rootScope.cachedName = $cookieStore.get("name"); $scope.getDispoType = function() { if($rootScope.type == 'codeCoverage') { @@ -74,6 +76,14 @@ app.controller('userController', [ loadingModal.close(); alert(data.statusText); }); + + // Try to get custom config + Config.get({ + programId: $scope.programSelection, + type: $rootScope.type + }, function(data) { + $scope.coverageResolutionTypes = data.validResolutions; + }); }; $scope.updateSet = function updateSet() { @@ -85,7 +95,8 @@ app.controller('userController', [ } else { Item.query({ programId: $scope.programSelection, - setId: $scope.setSelection + setId: $scope.setSelection, + isDetailed: $rootScope.type == 'codeCoverage' }, function(data) { loadingModal.close(); $scope.items = data; @@ -305,7 +316,7 @@ app.controller('userController', [ } $scope.getResolutionTypes = function getResolutionTypes() { - if($scope.dispoType == 'codeCoverage') { + if($scope.type == 'codeCoverage') { return $scope.coverageResolutionTypes; } else { return $scope.testResolutionTypes; @@ -319,7 +330,7 @@ app.controller('userController', [ itemId: $scope.selectedItem.guid, annotationId: annotation.guid, userName: $rootScope.cachedName, - }, function() { + }, function(data) { var index = $scope.annotations.indexOf(annotation); if (index > -1) { $scope.annotations.splice(index, 1); @@ -376,7 +387,7 @@ app.controller('userController', [ $scope.getInvalidLocRefs = function getInvalidLocRefs(annotation) { if(annotation.isConnected != null) { - return !annotation.isConnected && annotation.locationRefs != null; + return !annotation.isConnected && !annotation.isDefault && annotation.locationRefs != null; } else { return false; } @@ -502,6 +513,7 @@ app.controller('userController', [ programId: $scope.programSelection, setId: $scope.setSelection, value: value, + isDetailed: $rootScope.type == 'codeCoverage', }, function(data) { if($scope.isSearchView) { $scope.items = data; @@ -528,6 +540,17 @@ app.controller('userController', [ }); } + $scope.getText = function(annotation) { + if(annotation.customerNotes == "") { + var discrepancies = $scope.selectedItem.discrepancies; + var covered = annotation.idsOfCoveredDiscrepancies[0] + + return discrepancies[covered].text; + } else { + return annotation.customerNotes; + } + } + $scope.emptyItems = [{"name": "NONE FOUND"}] diff --git a/plugins/org.eclipse.osee.web.ui/src/dispo/views/admin.html b/plugins/org.eclipse.osee.web.ui/src/dispo/views/admin.html index 4e3232f990a..47446c9fb1d 100644 --- a/plugins/org.eclipse.osee.web.ui/src/dispo/views/admin.html +++ b/plugins/org.eclipse.osee.web.ui/src/dispo/views/admin.html @@ -28,6 +28,12 @@ </div> </div> + <div ng-show="false" class="row" id=setCopyRow> + <div class="col-sm-10 col-sm-offset-2" id=setCopyCoverageContainer> + <button ng-click="openCopyCoverageModal()" ng-show="sets.length > 0" class="btn btn-primary active" id=generateReportBtn>Import From Coverage</button> + </div> + </div> + </div> <div class="col-md-6 col-md-offset-1"> <div class="row"> @@ -97,6 +103,32 @@ </div> </script> + + <script type="text/ng-template" id="copySetCoverage.html"> + <div class="modal-header"> + <h3 class="modal-title">Copy From Coverage</h3> + </div> + <div class="modal-body" overflow: auto;"> + <div class="form-group"> + Select Destination Set + <select class="form-control" ng-model="destinationSet" ng-options="obj.guid as obj.name for obj in setsLocal"> + </select> + </div> + <div class="form-group"> + Enter Source Branch + <input class="form-control" ng-model="sourceBranch" placeholder="Enter Branch Uuid"></input> + </div> + <div class="form-group"> + Enter Coverage Package id + <input class="form-control" ng-model="sourcePackage" placeholder="Enter Coverage Package Uuid"></input> + </div> + </div> + <div class="modal-footer"> + <button class="btn btn-primary" ng-click="ok()">OK</button> + <button class="btn btn-warning" ng-click="cancel()">Cancel</button> + </div> + + </script> <script type="text/ng-template" id="loadingModal.html"> <div id="loadingModal" class="alert alert-info"> diff --git a/plugins/org.eclipse.osee.web.ui/src/dispo/views/user.html b/plugins/org.eclipse.osee.web.ui/src/dispo/views/user.html index 6491fcb53f3..62dfd4dc484 100644 --- a/plugins/org.eclipse.osee.web.ui/src/dispo/views/user.html +++ b/plugins/org.eclipse.osee.web.ui/src/dispo/views/user.html @@ -46,7 +46,8 @@ <th>{{ annotationHeaders.resolutionType }}</th> <th>{{ annotationHeaders.resolution }}</th> <th>Developer Notes</th> - <th>Customer Notes</th> + <th ng-show="type != 'codeCoverage'"Customer Notes</th> + <th ng-show="type == 'codeCoverage'">Text</th> <th width="50px;">Delete</th> <tr ng-repeat="annotation in annotations"> <td> @@ -61,8 +62,11 @@ <td> <textarea ng-class="{annotationInput: true, details: annotation.showDeets}" ng-disabled="annotation.guid == null" ng-model="annotation.developerNotes" type=text ng-model-onblur ng-change="editAnnotation(annotation)" ng-dblclick="toggleDetails(annotation)"></textarea> </td> - <td> - <textarea ng-class="{annotationInput: true, details: annotation.showDeets}" ng-disabled="annotation.guid == null" ng-model="annotation.customerNotes" type=text ng-model-onblur ng-change="editAnnotation(annotation)" ng-dblclick="toggleDetails(annotation)"></textarea> + <td ng-show="type != 'codeCoverage'"> + <textarea ng-class="{annotationInput: true, details: annotation.showDeets}" ng-disabled="annotation.guid == null || type == 'codeCoverage'" ng-model="annotation.customerNotes" type=text ng-model-onblur ng-change="editAnnotation(annotation)" ng-dblclick="toggleDetails(annotation)"></textarea> + </td> + <td ng-show="type == 'codeCoverage'"> + <textarea ng-class="{annotationInput: true, details: annotation.showDeets}" ng-disabled="true" type=text ng-dblclick="getText(annotation)">{{ getText(annotation) }}</textarea> </td> <td> <button ng-class="{annotationDelete: true, details: annotation.showDeets}" ng-disabled="annotation.guid == null || isDefaultResolution(annotation);" ng-click="deleteAnnotation(annotation)">X</button> diff --git a/plugins/org.eclipse.osee.web.ui/src/libs/js/oseeAuth/oseeAuth.js b/plugins/org.eclipse.osee.web.ui/src/libs/js/oseeAuth/oseeAuth.js index 7a2dd7c0a24..11d17e4ade6 100644 --- a/plugins/org.eclipse.osee.web.ui/src/libs/js/oseeAuth/oseeAuth.js +++ b/plugins/org.eclipse.osee.web.ui/src/libs/js/oseeAuth/oseeAuth.js @@ -17,7 +17,8 @@ directives.directive('osee', [ 'Endpoint', '$localStorage', '$sessionStorage', - function($rootScope, $compile, $http, $location, $templateCache, AccessToken, Profile, Endpoint, $localStorage, $sessionStorage) { + '$cookieStore', + function($rootScope, $compile, $http, $location, $templateCache, AccessToken, Profile, Endpoint, $localStorage, $sessionStorage, $cookieStore) { var definition = { restrict : 'E', replace : true, @@ -145,6 +146,7 @@ directives.directive('osee', [ scope.$on("oauth:authorized", function(event, token) { Profile.find(scope.profileUri).success(function(response) { scope.profile = response; + $cookieStore.put("name", scope.profile.name); }); if($localStorage.continueTo) { // Change the state to the continueTo we caught when User first tried to get into page @@ -154,11 +156,13 @@ directives.directive('osee', [ }) scope.$on("oauth:logout", function() { scope.profile = scope.anonymousUser; - var fr = AccessToken.destroy(); + $cookieStore.put("name", scope.profile.name); + AccessToken.destroy(); $location.path("/"); }) scope.$on("oauth:denied", function(event, token) { scope.profile = scope.anonymousUser; + $cookieStore.put("name", scope.profile.name); AccessToken.destroy(); }); |