Add audit logging for WF 01/60901/7
authorsiddharth0905 <siddharth.singh4@amdocs.com>
Thu, 16 Aug 2018 08:08:21 +0000 (11:08 +0300)
committerVitaly Emporopulo <Vitaliy.Emporopulo@amdocs.com>
Mon, 20 Aug 2018 11:15:31 +0000 (11:15 +0000)
Also formatting fixes.

Change-Id: Ia57e7b3c7208df962fcc7305822a055984aafe0b
Issue-ID: SDC-1530
Signed-off-by: siddharth0905 <siddharth.singh4@amdocs.com>
Signed-off-by: vempo <vitaliy.emporopulo@amdocs.com>
19 files changed:
workflow-designer-be/pom.xml
workflow-designer-be/src/main/java/org/onap/sdc/workflow/api/types/CollectionResponse.java
workflow-designer-be/src/main/java/org/onap/sdc/workflow/api/types/ErrorResponse.java
workflow-designer-be/src/main/java/org/onap/sdc/workflow/api/types/Paging.java
workflow-designer-be/src/main/java/org/onap/sdc/workflow/api/types/Sorting.java
workflow-designer-be/src/main/java/org/onap/sdc/workflow/api/types/UnexpectedErrorResponse.java
workflow-designer-be/src/main/java/org/onap/sdc/workflow/api/types/VersionStatesFormatter.java
workflow-designer-be/src/main/java/org/onap/sdc/workflow/api/types/dto/ArtifactDeliveriesRequestDto.java
workflow-designer-be/src/main/java/org/onap/sdc/workflow/api/validation/NoDuplicates.java
workflow-designer-be/src/main/java/org/onap/sdc/workflow/api/validation/NoDuplicatesValidator.java
workflow-designer-be/src/main/java/org/onap/sdc/workflow/server/config/ApplicationConfigurer.java [new file with mode: 0644]
workflow-designer-be/src/main/java/org/onap/sdc/workflow/server/config/LoggingInterceptorConfig.java [new file with mode: 0644]
workflow-designer-be/src/main/java/org/onap/sdc/workflow/server/config/SwaggerConfig.java
workflow-designer-be/src/main/java/org/onap/sdc/workflow/server/config/ZusammenConfig.java
workflow-designer-be/src/main/java/org/onap/sdc/workflow/server/filters/SessionContextFilter.java
workflow-designer-be/src/main/java/org/onap/sdc/workflow/services/exceptions/VersionStatusModificationException.java
workflow-designer-be/src/main/java/org/onap/sdc/workflow/services/exceptions/VersionValidationException.java
workflow-designer-be/src/main/resources/application-dev.properties
workflow-designer-be/src/main/resources/application.properties

index 7b2197e..a141658 100644 (file)
             <groupId>org.openecomp.sdc</groupId>
             <artifactId>openecomp-sdc-logging-api</artifactId>
             <version>${onap.version}</version>
-            <scope>compile</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.openecomp.sdc</groupId>
+            <artifactId>openecomp-sdc-logging-spring</artifactId>
+            <version>${onap.version}</version>
         </dependency>
         <dependency>
             <groupId>org.openecomp.sdc</groupId>
index 831ccc3..1734dd6 100644 (file)
@@ -1,3 +1,19 @@
+/*
+ * Copyright © 2018 European Support Limited
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
 package org.onap.sdc.workflow.api.types;
 
 import java.util.Collection;
index 1b8fb3c..45f5434 100644 (file)
@@ -1,3 +1,19 @@
+/*
+ * Copyright © 2018 European Support Limited
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
 package org.onap.sdc.workflow.api.types;
 
 import lombok.AllArgsConstructor;
index 0a27e1e..7e47f6d 100644 (file)
@@ -1,3 +1,19 @@
+/*
+ * Copyright © 2018 European Support Limited
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
 package org.onap.sdc.workflow.api.types;
 
 import static org.onap.sdc.workflow.services.types.PagingConstants.MAX_LIMIT;
index f02a05f..1a0c1a1 100644 (file)
@@ -1,3 +1,19 @@
+/*
+ * Copyright © 2018 European Support Limited
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
 package org.onap.sdc.workflow.api.types;
 
 import java.util.Arrays;
index fbc5ab3..8cf513a 100644 (file)
@@ -1,3 +1,19 @@
+/*
+ * Copyright © 2018 European Support Limited
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
 package org.onap.sdc.workflow.api.types;
 
 import lombok.Getter;
index 18ed50c..51e75ed 100644 (file)
@@ -1,3 +1,19 @@
+/*
+ * Copyright © 2018 European Support Limited
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
 package org.onap.sdc.workflow.api.types;
 
 import java.util.Arrays;
index e3dc212..2ec272f 100644 (file)
@@ -13,6 +13,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
+
 package org.onap.sdc.workflow.api.types.dto;
 
 import lombok.Data;
@@ -37,7 +38,7 @@ public class ArtifactDeliveriesRequestDto {
     public ArtifactDeliveriesRequestDto(){
     }
 
-    public ArtifactDeliveriesRequestDto(String method, String endpoint){
+    public ArtifactDeliveriesRequestDto(String method, String endpoint) {
         this.method = method;
         this.endpoint = endpoint;
     }
index ca4932a..296e438 100644 (file)
@@ -1,3 +1,19 @@
+/*
+ * Copyright © 2018 European Support Limited
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
 package org.onap.sdc.workflow.api.validation;
 
 import java.lang.annotation.Documented;
@@ -13,6 +29,7 @@ import javax.validation.Payload;
 @Documented
 @Constraint(validatedBy = {NoDuplicatesValidator.class})
 public @interface NoDuplicates {
+
     String message();
 
     Class<?>[] groups() default {};
index 13bbf0e..2020bb8 100644 (file)
@@ -1,3 +1,19 @@
+/*
+ * Copyright © 2018 European Support Limited
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
 package org.onap.sdc.workflow.api.validation;
 
 import java.util.Collection;
diff --git a/workflow-designer-be/src/main/java/org/onap/sdc/workflow/server/config/ApplicationConfigurer.java b/workflow-designer-be/src/main/java/org/onap/sdc/workflow/server/config/ApplicationConfigurer.java
new file mode 100644 (file)
index 0000000..e631a12
--- /dev/null
@@ -0,0 +1,35 @@
+/*
+ * Copyright © 2018 European Support Limited
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onap.sdc.workflow.server.config;
+
+import org.openecomp.sdc.logging.servlet.spring.LoggingInterceptor;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
+import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
+
+@Configuration
+public class ApplicationConfigurer implements WebMvcConfigurer {
+
+    @Autowired
+    LoggingInterceptor loggingInterceptor;
+
+    @Override
+    public void addInterceptors(InterceptorRegistry registry) {
+        registry.addInterceptor(loggingInterceptor);
+    }
+}
diff --git a/workflow-designer-be/src/main/java/org/onap/sdc/workflow/server/config/LoggingInterceptorConfig.java b/workflow-designer-be/src/main/java/org/onap/sdc/workflow/server/config/LoggingInterceptorConfig.java
new file mode 100644 (file)
index 0000000..53dbda5
--- /dev/null
@@ -0,0 +1,39 @@
+/*
+ * Copyright © 2018 European Support Limited
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onap.sdc.workflow.server.config;
+
+import org.openecomp.sdc.logging.servlet.HttpHeader;
+import org.openecomp.sdc.logging.servlet.spring.LoggingInterceptor;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+
+@Configuration
+public class LoggingInterceptorConfig {
+
+    @Value("${onap.logging.requestIdHeader}")
+    private String[] loggingRequestIdHeaders;
+
+    @Value("${onap.logging.partnerNameHeader}")
+    private String[] loggingPartnerNameHeader;
+
+    @Bean
+    public LoggingInterceptor createLoggingInterceptor() {
+        return new LoggingInterceptor(new HttpHeader(loggingRequestIdHeaders),
+                new HttpHeader(loggingPartnerNameHeader));
+    }
+}
index f17cea1..a2eca63 100644 (file)
@@ -1,3 +1,19 @@
+/*
+ * Copyright © 2018 European Support Limited
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
 package org.onap.sdc.workflow.server.config;
 
 import static springfox.documentation.builders.PathSelectors.regex;
index 092c346..23e8643 100644 (file)
@@ -1,3 +1,19 @@
+/*
+ * Copyright © 2018 European Support Limited
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
 package org.onap.sdc.workflow.server.config;
 
 import javax.annotation.PostConstruct;
@@ -19,7 +35,7 @@ public class ZusammenConfig {
     private String cassandraAuth;
 
     @PostConstruct
-    public void init(){
+    public void init() {
         System.setProperty("cassandra.nodes", cassandraAddress);
         System.setProperty("cassandra.user", cassandraUser);
         System.setProperty("cassandra.password", cassandraPassword);
index 2883832..e9742fc 100644 (file)
@@ -1,3 +1,19 @@
+/*
+ * Copyright © 2018 European Support Limited
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
 package org.onap.sdc.workflow.server.filters;
 
 import java.io.IOException;
index 7264682..4eb8af4 100644 (file)
@@ -1,3 +1,19 @@
+/*
+ * Copyright © 2018 European Support Limited
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
 package org.onap.sdc.workflow.services.exceptions;
 
 import org.openecomp.sdc.versioning.dao.types.VersionStatus;
index bd7d61f..815bc0b 100644 (file)
@@ -1,6 +1,22 @@
+/*
+ * Copyright © 2018 European Support Limited
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
 package org.onap.sdc.workflow.services.exceptions;
 
-public class VersionValidationException extends RuntimeException{
+public class VersionValidationException extends RuntimeException {
 
     private static final String MSG = "Error creating or modifying version for workflow with id %s: %s";
 
index 897b042..12a9902 100644 (file)
@@ -25,4 +25,8 @@ spring.data.cassandra.password=${CS_PASSWORD:}
 zusammen.cassandra.isAuthenticate=${CS_AUTHENTICATE:false}
 
 #Actuators
-management.endpoint.health.show-details=always
\ No newline at end of file
+management.endpoint.health.show-details=always
+
+#Headers are comma separated list
+onap.logging.requestIdHeader=X-ECOMP-RequestID,X-ONAP-RequestID
+onap.logging.partnerNameHeader=USER_ID
\ No newline at end of file
index 64b58fd..5fa56d8 100644 (file)
@@ -29,4 +29,8 @@ spring.data.cassandra.password=${CS_PASSWORD:}
 zusammen.cassandra.isAuthenticate=${CS_AUTHENTICATE:true}
 
 #Actuators
-management.endpoint.health.show-details=always
\ No newline at end of file
+management.endpoint.health.show-details=always
+
+#Headers are comma separated list
+onap.logging.requestIdHeader=X-ECOMP-RequestID,X-ONAP-RequestID
+onap.logging.partnerNameHeader=USER_ID
\ No newline at end of file