From 8e9c0653dd6c6862123c9609ae34e1206d86456e Mon Sep 17 00:00:00 2001 From: talig Date: Wed, 20 Dec 2017 14:30:43 +0200 Subject: Add collaboration feature Issue-ID: SDC-767 Change-Id: I14fb4c1f54086ed03a56a7ff7fab9ecd40381795 Signed-off-by: talig --- .../sdc/activityLog/ActivityLogManager.java | 31 ------------- .../sdc/activityLog/ActivityLogManagerFactory.java | 31 ------------- .../impl/ActivityLogManagerFactoryImpl.java | 33 -------------- .../activityLog/impl/ActivityLogManagerImpl.java | 53 ---------------------- .../sdc/activitylog/ActivityLogManager.java | 33 ++++++++++++++ .../sdc/activitylog/ActivityLogManagerFactory.java | 30 ++++++++++++ .../impl/ActivityLogManagerFactoryImpl.java | 34 ++++++++++++++ .../activitylog/impl/ActivityLogManagerImpl.java | 52 +++++++++++++++++++++ .../src/main/resources/factoryConfiguration.json | 2 +- 9 files changed, 150 insertions(+), 149 deletions(-) delete mode 100644 openecomp-be/backend/openecomp-sdc-activity-log-manager/src/main/java/org/openecomp/sdc/activityLog/ActivityLogManager.java delete mode 100644 openecomp-be/backend/openecomp-sdc-activity-log-manager/src/main/java/org/openecomp/sdc/activityLog/ActivityLogManagerFactory.java delete mode 100644 openecomp-be/backend/openecomp-sdc-activity-log-manager/src/main/java/org/openecomp/sdc/activityLog/impl/ActivityLogManagerFactoryImpl.java delete 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/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 (limited to 'openecomp-be/backend/openecomp-sdc-activity-log-manager/src') 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 deleted file mode 100644 index a40e1018d7..0000000000 --- a/openecomp-be/backend/openecomp-sdc-activity-log-manager/src/main/java/org/openecomp/sdc/activityLog/ActivityLogManager.java +++ /dev/null @@ -1,31 +0,0 @@ -/*- - * ============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 deleted file mode 100644 index 9816b76486..0000000000 --- a/openecomp-be/backend/openecomp-sdc-activity-log-manager/src/main/java/org/openecomp/sdc/activityLog/ActivityLogManagerFactory.java +++ /dev/null @@ -1,31 +0,0 @@ -/*- - * ============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 deleted file mode 100644 index 491192470d..0000000000 --- a/openecomp-be/backend/openecomp-sdc-activity-log-manager/src/main/java/org/openecomp/sdc/activityLog/impl/ActivityLogManagerFactoryImpl.java +++ /dev/null @@ -1,33 +0,0 @@ -/*- - * ============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 deleted file mode 100644 index 324af2095a..0000000000 --- a/openecomp-be/backend/openecomp-sdc-activity-log-manager/src/main/java/org/openecomp/sdc/activityLog/impl/ActivityLogManagerImpl.java +++ /dev/null @@ -1,53 +0,0 @@ -/*- - * ============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/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..06de3e11b6 --- /dev/null +++ b/openecomp-be/backend/openecomp-sdc-activity-log-manager/src/main/java/org/openecomp/sdc/activitylog/ActivityLogManager.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; + +import org.openecomp.sdc.activitylog.dao.type.ActivityLogEntity; +import org.openecomp.sdc.versioning.dao.types.Version; + +import java.util.Collection; + +public interface ActivityLogManager { + + void logActivity(ActivityLogEntity activityLogEntity); + + Collection listLoggedActivities(String itemId, Version versionId); +} 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..93010f6560 --- /dev/null +++ b/openecomp-be/backend/openecomp-sdc-activity-log-manager/src/main/java/org/openecomp/sdc/activitylog/ActivityLogManagerFactory.java @@ -0,0 +1,30 @@ +/*- + * ============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; + + +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..5dc7f849fc --- /dev/null +++ b/openecomp-be/backend/openecomp-sdc-activity-log-manager/src/main/java/org/openecomp/sdc/activitylog/impl/ActivityLogManagerFactoryImpl.java @@ -0,0 +1,34 @@ +/*- + * ============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..711fd68a8e --- /dev/null +++ b/openecomp-be/backend/openecomp-sdc-activity-log-manager/src/main/java/org/openecomp/sdc/activitylog/impl/ActivityLogManagerImpl.java @@ -0,0 +1,52 @@ +/*- + * ============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.activitylog.dao.type.ActivityLogEntity; +import org.openecomp.sdc.logging.context.impl.MdcDataDebugMessage; +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 logActivity(ActivityLogEntity activityLogEntity) { + mdcDataDebugMessage.debugEntryMessage("ITEM id", activityLogEntity.getItemId()); + activityLogEntity.setId(CommonMethods.nextUuId()); + activityLogDao.create(activityLogEntity); + } + + @Override + public Collection listLoggedActivities(String itemId, Version version) { + mdcDataDebugMessage.debugEntryMessage("ITEM id", itemId); + return activityLogDao.list(new ActivityLogEntity(itemId, version)); + } +} 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 index b4e151d16b..e4d3dab0f0 100644 --- 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 @@ -1,3 +1,3 @@ { - "org.openecomp.sdc.activityLog.ActivityLogManagerFactory": "org.openecomp.sdc.activityLog.impl.ActivityLogManagerFactoryImpl" + "org.openecomp.sdc.activitylog.ActivityLogManagerFactory": "org.openecomp.sdc.activitylog.impl.ActivityLogManagerFactoryImpl" } \ No newline at end of file -- cgit 1.2.3-korg