summaryrefslogtreecommitdiffstats
path: root/openecomp-be/lib/openecomp-conflict-lib/openecomp-conflict-api/src/main
diff options
context:
space:
mode:
authortalig <talig@amdocs.com>2017-12-20 14:30:43 +0200
committerVitaly Emporopulo <Vitaliy.Emporopulo@amdocs.com>2017-12-21 11:12:33 +0000
commit8e9c0653dd6c6862123c9609ae34e1206d86456e (patch)
tree5eeef00ec0677133baa439ca8d7ffd7aca4804b6 /openecomp-be/lib/openecomp-conflict-lib/openecomp-conflict-api/src/main
parent785ebcc95de3e064e843bec04ba7a209d854fc7c (diff)
Add collaboration feature
Issue-ID: SDC-767 Change-Id: I14fb4c1f54086ed03a56a7ff7fab9ecd40381795 Signed-off-by: talig <talig@amdocs.com>
Diffstat (limited to 'openecomp-be/lib/openecomp-conflict-lib/openecomp-conflict-api/src/main')
-rw-r--r--openecomp-be/lib/openecomp-conflict-lib/openecomp-conflict-api/src/main/java/org/openecomp/conflicts/ItemMergeHandler.java27
-rw-r--r--openecomp-be/lib/openecomp-conflict-lib/openecomp-conflict-api/src/main/java/org/openecomp/conflicts/ItemMergeHandlerFactory.java16
-rw-r--r--openecomp-be/lib/openecomp-conflict-lib/openecomp-conflict-api/src/main/java/org/openecomp/conflicts/dao/ConflictsDao.java18
-rw-r--r--openecomp-be/lib/openecomp-conflict-lib/openecomp-conflict-api/src/main/java/org/openecomp/conflicts/dao/ConflictsDaoFactory.java32
-rw-r--r--openecomp-be/lib/openecomp-conflict-lib/openecomp-conflict-api/src/main/java/org/openecomp/conflicts/types/Conflict.java30
-rw-r--r--openecomp-be/lib/openecomp-conflict-lib/openecomp-conflict-api/src/main/java/org/openecomp/conflicts/types/ConflictInfo.java39
-rw-r--r--openecomp-be/lib/openecomp-conflict-lib/openecomp-conflict-api/src/main/java/org/openecomp/conflicts/types/ConflictResolution.java32
-rw-r--r--openecomp-be/lib/openecomp-conflict-lib/openecomp-conflict-api/src/main/java/org/openecomp/conflicts/types/ItemVersionConflict.java31
-rw-r--r--openecomp-be/lib/openecomp-conflict-lib/openecomp-conflict-api/src/main/java/org/openecomp/conflicts/types/Resolution.java5
9 files changed, 230 insertions, 0 deletions
diff --git a/openecomp-be/lib/openecomp-conflict-lib/openecomp-conflict-api/src/main/java/org/openecomp/conflicts/ItemMergeHandler.java b/openecomp-be/lib/openecomp-conflict-lib/openecomp-conflict-api/src/main/java/org/openecomp/conflicts/ItemMergeHandler.java
new file mode 100644
index 0000000000..189e4cedd9
--- /dev/null
+++ b/openecomp-be/lib/openecomp-conflict-lib/openecomp-conflict-api/src/main/java/org/openecomp/conflicts/ItemMergeHandler.java
@@ -0,0 +1,27 @@
+package org.openecomp.conflicts;
+
+import org.openecomp.conflicts.types.Conflict;
+import org.openecomp.conflicts.types.ConflictResolution;
+import org.openecomp.conflicts.types.ItemVersionConflict;
+import org.openecomp.sdc.versioning.dao.types.Version;
+
+import java.util.Optional;
+
+public interface ItemMergeHandler {
+
+ boolean isConflicted(String itemId, Version version);
+
+ void finalizeMerge(String itemId, Version version);
+
+ void postListConflicts(String itemId, Version version, ItemVersionConflict conflicts);
+
+ Optional<Conflict> getConflict(String itemId, Version version, String conflictId);
+
+ void postGetConflict(String itemId, Version version, Conflict conflict);
+
+ void preResolveConflict(String itemId, Version version, String conflictId,
+ ConflictResolution resolution);
+
+ boolean resolveConflict(String itemId, Version version, String conflictId,
+ ConflictResolution resolution);
+}
diff --git a/openecomp-be/lib/openecomp-conflict-lib/openecomp-conflict-api/src/main/java/org/openecomp/conflicts/ItemMergeHandlerFactory.java b/openecomp-be/lib/openecomp-conflict-lib/openecomp-conflict-api/src/main/java/org/openecomp/conflicts/ItemMergeHandlerFactory.java
new file mode 100644
index 0000000000..8fb0a48870
--- /dev/null
+++ b/openecomp-be/lib/openecomp-conflict-lib/openecomp-conflict-api/src/main/java/org/openecomp/conflicts/ItemMergeHandlerFactory.java
@@ -0,0 +1,16 @@
+package org.openecomp.conflicts;
+
+import org.openecomp.core.factory.api.AbstractComponentFactory;
+import org.openecomp.core.factory.api.AbstractFactory;
+
+import java.util.Optional;
+
+public abstract class ItemMergeHandlerFactory
+ extends AbstractComponentFactory<ItemMergeHandler> {
+
+ public static ItemMergeHandlerFactory getInstance() {
+ return AbstractFactory.getInstance(ItemMergeHandlerFactory.class);
+ }
+
+ public abstract Optional<ItemMergeHandler> createInterface(String itemId);
+} \ No newline at end of file
diff --git a/openecomp-be/lib/openecomp-conflict-lib/openecomp-conflict-api/src/main/java/org/openecomp/conflicts/dao/ConflictsDao.java b/openecomp-be/lib/openecomp-conflict-lib/openecomp-conflict-api/src/main/java/org/openecomp/conflicts/dao/ConflictsDao.java
new file mode 100644
index 0000000000..273233a12c
--- /dev/null
+++ b/openecomp-be/lib/openecomp-conflict-lib/openecomp-conflict-api/src/main/java/org/openecomp/conflicts/dao/ConflictsDao.java
@@ -0,0 +1,18 @@
+package org.openecomp.conflicts.dao;
+
+import org.openecomp.conflicts.types.Conflict;
+import org.openecomp.conflicts.types.ConflictResolution;
+import org.openecomp.conflicts.types.ItemVersionConflict;
+import org.openecomp.sdc.versioning.dao.types.Version;
+
+public interface ConflictsDao {
+
+ boolean isConflicted(String itemId, Version version);
+
+ ItemVersionConflict getConflict(String itemId, Version version);
+
+ Conflict getConflict(String itemId, Version version, String conflictId);
+
+ void resolveConflict(String itemId, Version version, String conflictId,
+ ConflictResolution conflictResolution);
+}
diff --git a/openecomp-be/lib/openecomp-conflict-lib/openecomp-conflict-api/src/main/java/org/openecomp/conflicts/dao/ConflictsDaoFactory.java b/openecomp-be/lib/openecomp-conflict-lib/openecomp-conflict-api/src/main/java/org/openecomp/conflicts/dao/ConflictsDaoFactory.java
new file mode 100644
index 0000000000..e4c88d6279
--- /dev/null
+++ b/openecomp-be/lib/openecomp-conflict-lib/openecomp-conflict-api/src/main/java/org/openecomp/conflicts/dao/ConflictsDaoFactory.java
@@ -0,0 +1,32 @@
+/*-
+ * ============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.conflicts.dao;
+
+import org.openecomp.core.factory.api.AbstractComponentFactory;
+import org.openecomp.core.factory.api.AbstractFactory;
+
+public abstract class ConflictsDaoFactory
+ extends AbstractComponentFactory<ConflictsDao> {
+
+ public static ConflictsDaoFactory getInstance() {
+ return AbstractFactory.getInstance(ConflictsDaoFactory.class);
+ }
+}
diff --git a/openecomp-be/lib/openecomp-conflict-lib/openecomp-conflict-api/src/main/java/org/openecomp/conflicts/types/Conflict.java b/openecomp-be/lib/openecomp-conflict-lib/openecomp-conflict-api/src/main/java/org/openecomp/conflicts/types/Conflict.java
new file mode 100644
index 0000000000..bc324af1dd
--- /dev/null
+++ b/openecomp-be/lib/openecomp-conflict-lib/openecomp-conflict-api/src/main/java/org/openecomp/conflicts/types/Conflict.java
@@ -0,0 +1,30 @@
+package org.openecomp.conflicts.types;
+
+import org.openecomp.sdc.datatypes.model.ElementType;
+
+public class Conflict<T> extends ConflictInfo {
+ private T yours;
+ private T theirs;
+
+ public Conflict(String id, ElementType type, String name) {
+ super(id, type, name);
+ }
+
+ public T getYours() {
+ return yours;
+ }
+
+ public void setYours(T yours) {
+ this.yours = yours;
+ }
+
+ public T getTheirs() {
+ return theirs;
+ }
+
+ public void setTheirs(T theirs) {
+ this.theirs = theirs;
+ }
+
+
+}
diff --git a/openecomp-be/lib/openecomp-conflict-lib/openecomp-conflict-api/src/main/java/org/openecomp/conflicts/types/ConflictInfo.java b/openecomp-be/lib/openecomp-conflict-lib/openecomp-conflict-api/src/main/java/org/openecomp/conflicts/types/ConflictInfo.java
new file mode 100644
index 0000000000..ff58f00121
--- /dev/null
+++ b/openecomp-be/lib/openecomp-conflict-lib/openecomp-conflict-api/src/main/java/org/openecomp/conflicts/types/ConflictInfo.java
@@ -0,0 +1,39 @@
+package org.openecomp.conflicts.types;
+
+import org.openecomp.sdc.datatypes.model.ElementType;
+
+public class ConflictInfo {
+ private String id;
+ private ElementType type;
+ private String name;
+
+ public ConflictInfo(String id, ElementType type, String name) {
+ this.id = id;
+ this.type = type;
+ this.name = name;
+ }
+
+ public String getId() {
+ return id;
+ }
+
+ public void setId(String id) {
+ this.id = id;
+ }
+
+ public ElementType getType() {
+ return type;
+ }
+
+ public void setType(ElementType type) {
+ this.type = type;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+}
diff --git a/openecomp-be/lib/openecomp-conflict-lib/openecomp-conflict-api/src/main/java/org/openecomp/conflicts/types/ConflictResolution.java b/openecomp-be/lib/openecomp-conflict-lib/openecomp-conflict-api/src/main/java/org/openecomp/conflicts/types/ConflictResolution.java
new file mode 100644
index 0000000000..961f9080d9
--- /dev/null
+++ b/openecomp-be/lib/openecomp-conflict-lib/openecomp-conflict-api/src/main/java/org/openecomp/conflicts/types/ConflictResolution.java
@@ -0,0 +1,32 @@
+package org.openecomp.conflicts.types;
+
+import java.util.Map;
+
+public class ConflictResolution {
+ private Resolution resolution;
+ // sits in lower level...
+ private Map<String, Object> otherResolution;
+
+ public ConflictResolution() {
+ }
+
+ public ConflictResolution(Resolution resolution) {
+ this.resolution = resolution;
+ }
+
+ public Resolution getResolution() {
+ return resolution;
+ }
+
+ public void setResolution(Resolution resolution) {
+ this.resolution = resolution;
+ }
+
+ public Map<String, Object> getOtherResolution() {
+ return otherResolution;
+ }
+
+ public void setOtherResolution(Map<String, Object> otherResolution) {
+ this.otherResolution = otherResolution;
+ }
+}
diff --git a/openecomp-be/lib/openecomp-conflict-lib/openecomp-conflict-api/src/main/java/org/openecomp/conflicts/types/ItemVersionConflict.java b/openecomp-be/lib/openecomp-conflict-lib/openecomp-conflict-api/src/main/java/org/openecomp/conflicts/types/ItemVersionConflict.java
new file mode 100644
index 0000000000..a4749f3990
--- /dev/null
+++ b/openecomp-be/lib/openecomp-conflict-lib/openecomp-conflict-api/src/main/java/org/openecomp/conflicts/types/ItemVersionConflict.java
@@ -0,0 +1,31 @@
+package org.openecomp.conflicts.types;
+
+import org.openecomp.sdc.versioning.dao.types.Version;
+
+import java.util.ArrayList;
+import java.util.Collection;
+
+public class ItemVersionConflict {
+ private Conflict<Version> versionConflict;
+ private Collection<ConflictInfo> elementConflicts = new ArrayList<>();
+
+ public Conflict<Version> getVersionConflict() {
+ return versionConflict;
+ }
+
+ public void setVersionConflict(Conflict<Version> versionConflict) {
+ this.versionConflict = versionConflict;
+ }
+
+ public Collection<ConflictInfo> getElementConflicts() {
+ return elementConflicts;
+ }
+
+ public void setElementConflicts(Collection<ConflictInfo> elementConflicts) {
+ this.elementConflicts = elementConflicts;
+ }
+
+ public void addElementConflictInfo(ConflictInfo conflictInfo) {
+ elementConflicts.add(conflictInfo);
+ }
+}
diff --git a/openecomp-be/lib/openecomp-conflict-lib/openecomp-conflict-api/src/main/java/org/openecomp/conflicts/types/Resolution.java b/openecomp-be/lib/openecomp-conflict-lib/openecomp-conflict-api/src/main/java/org/openecomp/conflicts/types/Resolution.java
new file mode 100644
index 0000000000..2222f81c70
--- /dev/null
+++ b/openecomp-be/lib/openecomp-conflict-lib/openecomp-conflict-api/src/main/java/org/openecomp/conflicts/types/Resolution.java
@@ -0,0 +1,5 @@
+package org.openecomp.conflicts.types;
+
+public enum Resolution {
+ THEIRS,YOURS,OTHER
+}