aboutsummaryrefslogtreecommitdiffstats
path: root/openecomp-be/backend/openecomp-sdc-activity-log-manager
diff options
context:
space:
mode:
Diffstat (limited to 'openecomp-be/backend/openecomp-sdc-activity-log-manager')
-rw-r--r--openecomp-be/backend/openecomp-sdc-activity-log-manager/pom.xml57
-rw-r--r--openecomp-be/backend/openecomp-sdc-activity-log-manager/src/main/java/org/openecomp/sdc/activityLog/ActivityLogManager.java31
-rw-r--r--openecomp-be/backend/openecomp-sdc-activity-log-manager/src/main/java/org/openecomp/sdc/activityLog/ActivityLogManagerFactory.java31
-rw-r--r--openecomp-be/backend/openecomp-sdc-activity-log-manager/src/main/java/org/openecomp/sdc/activityLog/impl/ActivityLogManagerFactoryImpl.java33
-rw-r--r--openecomp-be/backend/openecomp-sdc-activity-log-manager/src/main/java/org/openecomp/sdc/activityLog/impl/ActivityLogManagerImpl.java53
-rw-r--r--openecomp-be/backend/openecomp-sdc-activity-log-manager/src/main/resources/factoryConfiguration.json3
6 files changed, 208 insertions, 0 deletions
diff --git a/openecomp-be/backend/openecomp-sdc-activity-log-manager/pom.xml b/openecomp-be/backend/openecomp-sdc-activity-log-manager/pom.xml
new file mode 100644
index 0000000000..c408c2cd24
--- /dev/null
+++ b/openecomp-be/backend/openecomp-sdc-activity-log-manager/pom.xml
@@ -0,0 +1,57 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+
+ <artifactId>openecomp-sdc-activity-log-manager</artifactId>
+
+ <parent>
+ <groupId>org.openecomp.sdc</groupId>
+ <artifactId>backend</artifactId>
+ <version>1.1.0-SNAPSHOT</version>
+ <relativePath>..</relativePath>
+ </parent>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.openecomp.core</groupId>
+ <artifactId>openecomp-utilities-lib</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.openecomp.sdc</groupId>
+ <artifactId>openecomp-sdc-logging-api</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.openecomp.sdc</groupId>
+ <artifactId>openecomp-sdc-logging-core</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.openecomp.core</groupId>
+ <artifactId>openecomp-facade-core</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.openecomp.sdc</groupId>
+ <artifactId>openecomp-sdc-activity-log-api</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.openecomp.sdc</groupId>
+ <artifactId>openecomp-sdc-activity-log-core</artifactId>
+ <version>${project.version}</version>
+ <scope>runtime</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.openecomp.sdc</groupId>
+ <artifactId>activity-log-rest-types</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ </dependencies>
+
+
+</project>
diff --git a/openecomp-be/backend/openecomp-sdc-activity-log-manager/src/main/java/org/openecomp/sdc/activityLog/ActivityLogManager.java b/openecomp-be/backend/openecomp-sdc-activity-log-manager/src/main/java/org/openecomp/sdc/activityLog/ActivityLogManager.java
new file mode 100644
index 0000000000..a40e1018d7
--- /dev/null
+++ b/openecomp-be/backend/openecomp-sdc-activity-log-manager/src/main/java/org/openecomp/sdc/activityLog/ActivityLogManager.java
@@ -0,0 +1,31 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.sdc.activityLog;
+
+import org.openecomp.sdc.activitylog.dao.type.ActivityLogEntity;
+import org.openecomp.sdc.versioning.dao.types.Version;
+
+import java.util.Collection;
+
+public interface ActivityLogManager {
+ void addActionLog(ActivityLogEntity activityLogEntity, String user);
+ Collection<ActivityLogEntity> listActivityLogs(String itemId, Version versionId, String user);
+}
diff --git a/openecomp-be/backend/openecomp-sdc-activity-log-manager/src/main/java/org/openecomp/sdc/activityLog/ActivityLogManagerFactory.java b/openecomp-be/backend/openecomp-sdc-activity-log-manager/src/main/java/org/openecomp/sdc/activityLog/ActivityLogManagerFactory.java
new file mode 100644
index 0000000000..9816b76486
--- /dev/null
+++ b/openecomp-be/backend/openecomp-sdc-activity-log-manager/src/main/java/org/openecomp/sdc/activityLog/ActivityLogManagerFactory.java
@@ -0,0 +1,31 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.
+ * ============LICENSE_END=========================================================
+ */
+package org.openecomp.sdc.activityLog;
+
+import org.openecomp.core.factory.api.AbstractComponentFactory;
+import org.openecomp.core.factory.api.AbstractFactory;
+import org.openecomp.sdc.activityLog.ActivityLogManager;
+
+
+public abstract class ActivityLogManagerFactory extends AbstractComponentFactory<ActivityLogManager> {
+ public static ActivityLogManagerFactory getInstance() {
+ return AbstractFactory.getInstance(ActivityLogManagerFactory.class);
+ }
+}
diff --git a/openecomp-be/backend/openecomp-sdc-activity-log-manager/src/main/java/org/openecomp/sdc/activityLog/impl/ActivityLogManagerFactoryImpl.java b/openecomp-be/backend/openecomp-sdc-activity-log-manager/src/main/java/org/openecomp/sdc/activityLog/impl/ActivityLogManagerFactoryImpl.java
new file mode 100644
index 0000000000..491192470d
--- /dev/null
+++ b/openecomp-be/backend/openecomp-sdc-activity-log-manager/src/main/java/org/openecomp/sdc/activityLog/impl/ActivityLogManagerFactoryImpl.java
@@ -0,0 +1,33 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.
+ * ============LICENSE_END=========================================================
+ */
+package org.openecomp.sdc.activityLog.impl;
+
+import org.openecomp.sdc.activityLog.ActivityLogManager;
+import org.openecomp.sdc.activityLog.ActivityLogManagerFactory;
+import org.openecomp.sdc.activitylog.dao.ActivityLogDaoFactory;
+
+public class ActivityLogManagerFactoryImpl extends ActivityLogManagerFactory {
+ private static final ActivityLogManager INSTANCE = new ActivityLogManagerImpl(
+ ActivityLogDaoFactory.getInstance().createInterface()
+ );
+
+ @Override
+ public ActivityLogManager createInterface() {return INSTANCE;}
+}
diff --git a/openecomp-be/backend/openecomp-sdc-activity-log-manager/src/main/java/org/openecomp/sdc/activityLog/impl/ActivityLogManagerImpl.java b/openecomp-be/backend/openecomp-sdc-activity-log-manager/src/main/java/org/openecomp/sdc/activityLog/impl/ActivityLogManagerImpl.java
new file mode 100644
index 0000000000..324af2095a
--- /dev/null
+++ b/openecomp-be/backend/openecomp-sdc-activity-log-manager/src/main/java/org/openecomp/sdc/activityLog/impl/ActivityLogManagerImpl.java
@@ -0,0 +1,53 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.sdc.activityLog.impl;
+
+import org.openecomp.core.utilities.CommonMethods;
+import org.openecomp.sdc.activityLog.ActivityLogManager;
+import org.openecomp.sdc.activitylog.dao.ActivityLogDao;
+import org.openecomp.sdc.logging.context.impl.MdcDataDebugMessage;
+import org.openecomp.sdc.activitylog.dao.type.ActivityLogEntity;
+import org.openecomp.sdc.versioning.dao.types.Version;
+
+import java.util.Collection;
+
+public class ActivityLogManagerImpl implements ActivityLogManager {
+ private static MdcDataDebugMessage mdcDataDebugMessage = new MdcDataDebugMessage();
+ private ActivityLogDao activityLogDao;
+
+ public ActivityLogManagerImpl(ActivityLogDao activityLogDao) {
+ this.activityLogDao = activityLogDao;
+ }
+
+ @Override
+ public void addActionLog(ActivityLogEntity activityLogEntity, String user) {
+ mdcDataDebugMessage.debugEntryMessage("ITEM id", activityLogEntity.getItemId());
+ activityLogEntity.setId(CommonMethods.nextUuId());
+ activityLogDao.create(activityLogEntity);
+ }
+
+ @Override
+ public Collection<ActivityLogEntity> listActivityLogs(String itemId, Version version, String user) {
+ mdcDataDebugMessage.debugEntryMessage("ITEM id", itemId);
+ String versionId = version.getMinor() == 0 ? String.valueOf(version.getMajor()) : String.valueOf(version.getMajor()+1);
+ return activityLogDao.getActivityLogListForItem(itemId, versionId);
+ }
+}
diff --git a/openecomp-be/backend/openecomp-sdc-activity-log-manager/src/main/resources/factoryConfiguration.json b/openecomp-be/backend/openecomp-sdc-activity-log-manager/src/main/resources/factoryConfiguration.json
new file mode 100644
index 0000000000..b4e151d16b
--- /dev/null
+++ b/openecomp-be/backend/openecomp-sdc-activity-log-manager/src/main/resources/factoryConfiguration.json
@@ -0,0 +1,3 @@
+{
+ "org.openecomp.sdc.activityLog.ActivityLogManagerFactory": "org.openecomp.sdc.activityLog.impl.ActivityLogManagerFactoryImpl"
+} \ No newline at end of file