From 280f8015d06af1f41a3ef12e8300801c7a5e0d54 Mon Sep 17 00:00:00 2001 From: AviZi Date: Fri, 9 Jun 2017 02:39:56 +0300 Subject: [SDC-29] Amdocs OnBoard 1707 initial commit. Change-Id: Ie4d12a3f574008b792899b368a0902a8b46b5370 Signed-off-by: AviZi --- .../openecomp-sdc-activity-log-manager/pom.xml | 57 ++++++++++++++++++++++ .../sdc/activityLog/ActivityLogManager.java | 31 ++++++++++++ .../sdc/activityLog/ActivityLogManagerFactory.java | 31 ++++++++++++ .../impl/ActivityLogManagerFactoryImpl.java | 33 +++++++++++++ .../activityLog/impl/ActivityLogManagerImpl.java | 53 ++++++++++++++++++++ .../src/main/resources/factoryConfiguration.json | 3 ++ 6 files changed, 208 insertions(+) create mode 100644 openecomp-be/backend/openecomp-sdc-activity-log-manager/pom.xml create mode 100644 openecomp-be/backend/openecomp-sdc-activity-log-manager/src/main/java/org/openecomp/sdc/activityLog/ActivityLogManager.java create mode 100644 openecomp-be/backend/openecomp-sdc-activity-log-manager/src/main/java/org/openecomp/sdc/activityLog/ActivityLogManagerFactory.java create mode 100644 openecomp-be/backend/openecomp-sdc-activity-log-manager/src/main/java/org/openecomp/sdc/activityLog/impl/ActivityLogManagerFactoryImpl.java create mode 100644 openecomp-be/backend/openecomp-sdc-activity-log-manager/src/main/java/org/openecomp/sdc/activityLog/impl/ActivityLogManagerImpl.java create mode 100644 openecomp-be/backend/openecomp-sdc-activity-log-manager/src/main/resources/factoryConfiguration.json (limited to 'openecomp-be/backend/openecomp-sdc-activity-log-manager') 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 @@ + + + 4.0.0 + + openecomp-sdc-activity-log-manager + + + org.openecomp.sdc + backend + 1.1.0-SNAPSHOT + .. + + + + + org.openecomp.core + openecomp-utilities-lib + ${project.version} + + + + org.openecomp.sdc + openecomp-sdc-logging-api + ${project.version} + + + org.openecomp.sdc + openecomp-sdc-logging-core + ${project.version} + + + org.openecomp.core + openecomp-facade-core + ${project.version} + + + org.openecomp.sdc + openecomp-sdc-activity-log-api + ${project.version} + + + org.openecomp.sdc + openecomp-sdc-activity-log-core + ${project.version} + runtime + + + org.openecomp.sdc + activity-log-rest-types + ${project.version} + + + + + 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 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 { + 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 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 -- cgit 1.2.3-korg