Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDominic Guss2017-09-06 13:25:46 -0400
committerDominic Guss2017-09-07 12:33:07 -0400
commit13c2dc87c6ee9c0ea4db0b9ffe5a6686a22226e5 (patch)
tree89335f6cc882aa1aa0e8cb836091f5df61646394
parent594eabee5c090bcef2f55924c012e47fc52b7825 (diff)
downloadorg.eclipse.osee-13c2dc87c6ee9c0ea4db0b9ffe5a6686a22226e5.tar.gz
org.eclipse.osee-13c2dc87c6ee9c0ea4db0b9ffe5a6686a22226e5.tar.xz
org.eclipse.osee-13c2dc87c6ee9c0ea4db0b9ffe5a6686a22226e5.zip
bug[ats_ATS422110]: Fix issue with some LIS files not opening
Change-Id: I743b06f71b1f17322d3a59f6f185f598fead5d32 Signed-off-by: Dominic Guss <Dominic.Guss@boeing.com>
-rw-r--r--plugins/org.eclipse.osee.disposition.rest.test/src/org/eclipse/osee/disposition/rest/internal/DispoApiTest.java4
-rw-r--r--plugins/org.eclipse.osee.disposition.rest/src/org/eclipse/osee/disposition/rest/DispoApi.java1
-rw-r--r--plugins/org.eclipse.osee.disposition.rest/src/org/eclipse/osee/disposition/rest/DispoApiConfiguration.java80
-rw-r--r--plugins/org.eclipse.osee.disposition.rest/src/org/eclipse/osee/disposition/rest/DispoConstants.java8
-rw-r--r--plugins/org.eclipse.osee.disposition.rest/src/org/eclipse/osee/disposition/rest/internal/DispoApiImpl.java19
-rw-r--r--plugins/org.eclipse.osee.disposition.rest/src/org/eclipse/osee/disposition/rest/resources/DispoSourceFileResource.java3
6 files changed, 111 insertions, 4 deletions
diff --git a/plugins/org.eclipse.osee.disposition.rest.test/src/org/eclipse/osee/disposition/rest/internal/DispoApiTest.java b/plugins/org.eclipse.osee.disposition.rest.test/src/org/eclipse/osee/disposition/rest/internal/DispoApiTest.java
index 7127d2be56..2a09bea4cf 100644
--- a/plugins/org.eclipse.osee.disposition.rest.test/src/org/eclipse/osee/disposition/rest/internal/DispoApiTest.java
+++ b/plugins/org.eclipse.osee.disposition.rest.test/src/org/eclipse/osee/disposition/rest/internal/DispoApiTest.java
@@ -91,6 +91,8 @@ public class DispoApiTest {
@Mock
private Map<String, Discrepancy> mockDiscrepancies;
@Mock
+ private Map<String, Object> mockConfigProperties;
+ @Mock
private Discrepancy mockDiscrepancy;
@Mock
private List<DispoAnnotationData> mockAnnotations;
@@ -132,7 +134,7 @@ public class DispoApiTest {
dispoApi.setResolutionValidator(validator);
dispoApi.setLogger(logger);
- dispoApi.start();
+ dispoApi.start(mockConfigProperties);
}
private <T> Answer<T> newAnswer(final T object) {
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 dd381c150e..9698ee227b 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
@@ -83,4 +83,5 @@ public interface DispoApi {
Collection<DispoItem> getDispoItemByAnnotationText(BranchId branch, String setId, String keyword, boolean isDetailed);
+ DispoApiConfiguration getConfig();
}
diff --git a/plugins/org.eclipse.osee.disposition.rest/src/org/eclipse/osee/disposition/rest/DispoApiConfiguration.java b/plugins/org.eclipse.osee.disposition.rest/src/org/eclipse/osee/disposition/rest/DispoApiConfiguration.java
new file mode 100644
index 0000000000..f7f980fee1
--- /dev/null
+++ b/plugins/org.eclipse.osee.disposition.rest/src/org/eclipse/osee/disposition/rest/DispoApiConfiguration.java
@@ -0,0 +1,80 @@
+/*******************************************************************************
+ * Copyright (c) 2017 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;
+
+import java.util.Map;
+
+/**
+ * @author Dominic Guss
+ */
+public class DispoApiConfiguration {
+
+ private String fileExtRegex;
+
+ private DispoApiConfiguration() {
+ //Builder Class
+ }
+
+ public String getFileExtRegex() {
+ return fileExtRegex;
+ }
+
+ public void setFileExtRegex(String fileExtRegex) {
+ this.fileExtRegex = fileExtRegex;
+ }
+
+ public DispoApiConfiguration copy() {
+ DispoApiConfiguration data = new DispoApiConfiguration();
+ data.fileExtRegex = this.fileExtRegex;
+ return data;
+ }
+
+ public static DispoApiConfigurationBuilder newBuilder() {
+ return new DispoApiConfigurationBuilder();
+ }
+
+ public static DispoApiConfigurationBuilder fromProperties(Map<String, Object> props) {
+ return newBuilder().properties(props);
+ }
+
+ public static DispoApiConfiguration newConfig(Map<String, Object> props) {
+ return fromProperties(props).build();
+ }
+
+ public static final class DispoApiConfigurationBuilder {
+ private final DispoApiConfiguration config = new DispoApiConfiguration();
+
+ public DispoApiConfiguration build() {
+ return config.copy();
+ }
+
+ public DispoApiConfigurationBuilder properties(Map<String, Object> props) {
+ fileExtRegex(get(props, DispoConstants.FILE_EXT_REGEX, ""));
+ return this;
+ }
+
+ public DispoApiConfigurationBuilder fileExtRegex(String fileExtRegex) {
+ config.setFileExtRegex(fileExtRegex);
+ return this;
+ }
+
+ private static String get(Map<String, Object> props, String key, String defaultValue) {
+ String toReturn = defaultValue;
+ Object object = props != null ? props.get(key) : null;
+ if (object != null) {
+ toReturn = String.valueOf(object);
+ }
+ return toReturn;
+ }
+
+ }
+
+}
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 a8d086dd00..ec0ae5bce8 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
@@ -54,6 +54,14 @@ public final class DispoConstants {
public static final ArtifactToken DISPO_ARTIFACT = ArtifactToken.valueOf(4757831, "DispositionTypes", COMMON, CoreArtifactTypes.OseeTypeDefinition);
+ // For dispo config
+ public static final String NAMESPACE = "dispo.api";
+ private static String qualify(String value) {
+ return String.format("%s.%s", NAMESPACE, value);
+ }
+
+ public static final String FILE_EXT_REGEX = qualify("file.ext.regex");
+
// @formatter:on
private DispoConstants() {
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 84f8bb0703..58f1dd610e 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,6 +35,7 @@ import org.eclipse.osee.disposition.model.DispoSummarySeverity;
import org.eclipse.osee.disposition.model.Note;
import org.eclipse.osee.disposition.model.OperationReport;
import org.eclipse.osee.disposition.rest.DispoApi;
+import org.eclipse.osee.disposition.rest.DispoApiConfiguration;
import org.eclipse.osee.disposition.rest.DispoImporterApi;
import org.eclipse.osee.disposition.rest.external.DispoUpdateBroadcaster;
import org.eclipse.osee.disposition.rest.internal.importer.DispoImporterFactory;
@@ -64,6 +65,16 @@ public class DispoApiImpl implements DispoApi {
private DispoResolutionValidator resolutionValidator;
private DispoImporterFactory importerFactory;
private DispoUpdateBroadcaster updateBroadcaster;
+ private volatile DispoApiConfiguration config;
+
+ @Override
+ public DispoApiConfiguration getConfig() {
+ return config;
+ }
+
+ public void setConfig(DispoApiConfiguration config) {
+ this.config = config;
+ }
public void setExecutor(ExecutorAdmin executor) {
this.executor = executor;
@@ -93,9 +104,15 @@ public class DispoApiImpl implements DispoApi {
this.updateBroadcaster = updateBroadcater;
}
- public void start() {
+ public void start(Map<String, Object> props) {
logger.trace("Starting DispoApiImpl...");
importerFactory = new DispoImporterFactory(dataFactory, executor, logger);
+ update(props);
+ }
+
+ public void update(Map<String, Object> props) {
+ logger.trace("Configuring [%s]...", getClass().getSimpleName());
+ setConfig(DispoApiConfiguration.newConfig(props));
}
public void stop() {
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 e5c5d9c100..cfcd1ab34d 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
@@ -59,9 +59,8 @@ public class DispoSourceFileResource {
@GET
@Produces(MediaType.APPLICATION_OCTET_STREAM)
public Response getDispoItemsById(@PathParam("fileName") String fileName) {
- String origFileName = fileName;
if (!fileName.endsWith(".LIS")) {
- fileName = fileName.replaceAll("\\.(ada($|\\.)|c($|\\.)).*", ".LIS");
+ fileName = fileName.replaceAll(dispoApi.getConfig().getFileExtRegex(), ".LIS");
}
DispoSet set = dispoApi.getDispoSetById(branch, setId);

Back to the top