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 --- .../org/openecomp/conflicts/ItemMergeHandler.java | 27 +++++++++++++++ .../conflicts/ItemMergeHandlerFactory.java | 16 +++++++++ .../org/openecomp/conflicts/dao/ConflictsDao.java | 18 ++++++++++ .../conflicts/dao/ConflictsDaoFactory.java | 32 ++++++++++++++++++ .../org/openecomp/conflicts/types/Conflict.java | 30 +++++++++++++++++ .../openecomp/conflicts/types/ConflictInfo.java | 39 ++++++++++++++++++++++ .../conflicts/types/ConflictResolution.java | 32 ++++++++++++++++++ .../conflicts/types/ItemVersionConflict.java | 31 +++++++++++++++++ .../org/openecomp/conflicts/types/Resolution.java | 5 +++ 9 files changed, 230 insertions(+) create mode 100644 openecomp-be/lib/openecomp-conflict-lib/openecomp-conflict-api/src/main/java/org/openecomp/conflicts/ItemMergeHandler.java create mode 100644 openecomp-be/lib/openecomp-conflict-lib/openecomp-conflict-api/src/main/java/org/openecomp/conflicts/ItemMergeHandlerFactory.java create mode 100644 openecomp-be/lib/openecomp-conflict-lib/openecomp-conflict-api/src/main/java/org/openecomp/conflicts/dao/ConflictsDao.java create mode 100644 openecomp-be/lib/openecomp-conflict-lib/openecomp-conflict-api/src/main/java/org/openecomp/conflicts/dao/ConflictsDaoFactory.java create mode 100644 openecomp-be/lib/openecomp-conflict-lib/openecomp-conflict-api/src/main/java/org/openecomp/conflicts/types/Conflict.java create mode 100644 openecomp-be/lib/openecomp-conflict-lib/openecomp-conflict-api/src/main/java/org/openecomp/conflicts/types/ConflictInfo.java create mode 100644 openecomp-be/lib/openecomp-conflict-lib/openecomp-conflict-api/src/main/java/org/openecomp/conflicts/types/ConflictResolution.java create mode 100644 openecomp-be/lib/openecomp-conflict-lib/openecomp-conflict-api/src/main/java/org/openecomp/conflicts/types/ItemVersionConflict.java create mode 100644 openecomp-be/lib/openecomp-conflict-lib/openecomp-conflict-api/src/main/java/org/openecomp/conflicts/types/Resolution.java (limited to 'openecomp-be/lib/openecomp-conflict-lib/openecomp-conflict-api/src/main/java') 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 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 { + + public static ItemMergeHandlerFactory getInstance() { + return AbstractFactory.getInstance(ItemMergeHandlerFactory.class); + } + + public abstract Optional 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 { + + 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 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 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 getOtherResolution() { + return otherResolution; + } + + public void setOtherResolution(Map 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 versionConflict; + private Collection elementConflicts = new ArrayList<>(); + + public Conflict getVersionConflict() { + return versionConflict; + } + + public void setVersionConflict(Conflict versionConflict) { + this.versionConflict = versionConflict; + } + + public Collection getElementConflicts() { + return elementConflicts; + } + + public void setElementConflicts(Collection 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 +} -- cgit 1.2.3-korg