From 04c1754116920f5b43b20f449a39cbfa7a681102 Mon Sep 17 00:00:00 2001 From: sheetalm Date: Wed, 14 Feb 2018 09:39:22 +0530 Subject: Onboarding foundation changes for ItemManager Resolved conflicting changes 1. Split ItemManager to ASDCItemManager and ItemManager 2. ItemManager provides basic capability of item without collaboration 3. AsdcItemManager provides all capabilities of item including collaboration which are required by onboarding 4. ItemManager can be used by other services like activity spec to create a basic item without collaboration features. Change-Id: I6c6dc34a2b1a1745c796099b70e359432e90f85e Issue-ID: SDC-1039 Signed-off-by: sheetalm --- .../sdc/versioning/ActionVersioningManager.java | 75 ++++++++++++++++++++++ .../versioning/ActionVersioningManagerFactory.java | 28 ++++++++ .../openecomp/sdc/versioning/AsdcItemManager.java | 40 ++++++++++++ .../sdc/versioning/AsdcItemManagerFactory.java | 27 ++++++++ .../org/openecomp/sdc/versioning/ItemManager.java | 28 ++++++-- .../sdc/versioning/VersioningManager.java | 52 +++------------ 6 files changed, 201 insertions(+), 49 deletions(-) create mode 100644 openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/ActionVersioningManager.java create mode 100644 openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/ActionVersioningManagerFactory.java create mode 100644 openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/AsdcItemManager.java create mode 100644 openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/AsdcItemManagerFactory.java (limited to 'openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java') diff --git a/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/ActionVersioningManager.java b/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/ActionVersioningManager.java new file mode 100644 index 0000000000..3875e59f33 --- /dev/null +++ b/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/ActionVersioningManager.java @@ -0,0 +1,75 @@ +/* + * Copyright © 2016-2018 European Support Limited + * + * 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. + */ + +package org.openecomp.sdc.versioning; + +import java.util.List; +import java.util.Map; +import org.openecomp.sdc.versioning.dao.types.Revision; +import org.openecomp.sdc.versioning.dao.types.Version; +import org.openecomp.sdc.versioning.types.VersionCreationMethod; +import org.openecomp.sdc.versioning.types.VersionInfo; +import org.openecomp.sdc.versioning.types.VersionableEntityAction; +import org.openecomp.sdc.versioning.types.VersionableEntityMetadata; + +public interface ActionVersioningManager { + + void register(String entityType, VersionableEntityMetadata entityMetadata); + + Version create(String entityType, String entityId, String user); + + void delete(String entityType, String entityId, String user); + + void undoDelete(String entityType, String entityId, String user); + + Version checkout(String entityType, String entityId, String user); + + Version undoCheckout(String entityType, String entityId, String user); + + Version checkin(String entityType, String entityId, String user, String checkinDescription); + + Version submit(String entityType, String entityId, String user, String submitDescription); + + VersionInfo getEntityVersionInfo(String entityType, String entityId, String user, + VersionableEntityAction action); + + Map listEntitiesVersionInfo(String entityType, String user, + VersionableEntityAction action); + + Map listDeletedEntitiesVersionInfo(String entityType, String user, + VersionableEntityAction action); + + + List list(String itemId); // TODO: 5/24/2017 filter (by status for example) + + Version get(String itemId, Version version); + + Version create(String itemId, Version version, + VersionCreationMethod creationMethod); + + void submit(String itemId, Version version, String submitDescription); + + void publish(String itemId, Version version, String message); + + void sync(String itemId, Version version); + + void forceSync(String itemId, Version version); + + void revert(String itemId, Version version, String revisionId); + + List listRevisions(String itemId, Version version); + +} diff --git a/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/ActionVersioningManagerFactory.java b/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/ActionVersioningManagerFactory.java new file mode 100644 index 0000000000..4ab659ac11 --- /dev/null +++ b/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/ActionVersioningManagerFactory.java @@ -0,0 +1,28 @@ +/* + * Copyright © 2016-2018 European Support Limited + * + * 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. + */ + +package org.openecomp.sdc.versioning; + +import org.openecomp.core.factory.api.AbstractComponentFactory; +import org.openecomp.core.factory.api.AbstractFactory; + +public abstract class ActionVersioningManagerFactory extends + AbstractComponentFactory { + + public static ActionVersioningManagerFactory getInstance() { + return AbstractFactory.getInstance(ActionVersioningManagerFactory.class); + } +} diff --git a/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/AsdcItemManager.java b/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/AsdcItemManager.java new file mode 100644 index 0000000000..a4ea65fa08 --- /dev/null +++ b/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/AsdcItemManager.java @@ -0,0 +1,40 @@ +/* + * Copyright © 2016-2018 European Support Limited + * + * 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. + */ + +package org.openecomp.sdc.versioning; + +import java.util.Collection; +import java.util.function.Predicate; +import org.openecomp.sdc.versioning.dao.types.VersionStatus; +import org.openecomp.sdc.versioning.types.Item; + +public interface AsdcItemManager { + + Collection list(Predicate predicate); + + Item get(String itemId); + + Item create(Item item); + + void updateVersionStatus(String itemId, VersionStatus addedVersionStatus, + VersionStatus removedVersionStatus); + + void updateOwner(String itemId, String owner); + + void updateName(String itemId, String name); + + void delete(Item item); +} diff --git a/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/AsdcItemManagerFactory.java b/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/AsdcItemManagerFactory.java new file mode 100644 index 0000000000..a2095b8663 --- /dev/null +++ b/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/AsdcItemManagerFactory.java @@ -0,0 +1,27 @@ +/* + * Copyright © 2016-2018 European Support Limited + * + * 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. + */ + +package org.openecomp.sdc.versioning; + +import org.openecomp.core.factory.api.AbstractComponentFactory; +import org.openecomp.core.factory.api.AbstractFactory; + +public abstract class AsdcItemManagerFactory extends AbstractComponentFactory { + + public static AsdcItemManagerFactory getInstance() { + return AbstractFactory.getInstance(AsdcItemManagerFactory.class); + } +} diff --git a/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/ItemManager.java b/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/ItemManager.java index 885d96a132..41a2c12058 100644 --- a/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/ItemManager.java +++ b/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/ItemManager.java @@ -1,10 +1,25 @@ -package org.openecomp.sdc.versioning; +/* + * Copyright © 2016-2018 European Support Limited + * + * 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. + */ -import org.openecomp.sdc.versioning.dao.types.VersionStatus; -import org.openecomp.sdc.versioning.types.Item; +package org.openecomp.sdc.versioning; import java.util.Collection; import java.util.function.Predicate; +import org.openecomp.sdc.versioning.dao.types.VersionStatus; +import org.openecomp.sdc.versioning.types.Item; public interface ItemManager { @@ -15,10 +30,11 @@ public interface ItemManager { Item create(Item item); void updateVersionStatus(String itemId, VersionStatus addedVersionStatus, - VersionStatus removedVersionStatus); - - void updateOwner(String itemId, String owner); + VersionStatus removedVersionStatus); void delete(Item item); + void updateName(String itemId, String name); + + void update(Item item); } diff --git a/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/VersioningManager.java b/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/VersioningManager.java index c03769462b..cbb234e3e2 100644 --- a/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/VersioningManager.java +++ b/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/VersioningManager.java @@ -1,69 +1,34 @@ -/*- - * ============LICENSE_START======================================================= - * SDC - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ +/* + * Copyright © 2016-2018 European Support Limited + * * 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 - * + * + * 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.versioning; +import java.util.List; import org.openecomp.sdc.versioning.dao.types.Revision; import org.openecomp.sdc.versioning.dao.types.Version; import org.openecomp.sdc.versioning.types.VersionCreationMethod; -import org.openecomp.sdc.versioning.types.VersionInfo; -import org.openecomp.sdc.versioning.types.VersionableEntityAction; -import org.openecomp.sdc.versioning.types.VersionableEntityMetadata; - -import java.util.List; -import java.util.Map; public interface VersioningManager { - void register(String entityType, VersionableEntityMetadata entityMetadata); - - Version create(String entityType, String entityId, String user); - - void delete(String entityType, String entityId, String user); - - void undoDelete(String entityType, String entityId, String user); - - Version checkout(String entityType, String entityId, String user); - - Version undoCheckout(String entityType, String entityId, String user); - - Version checkin(String entityType, String entityId, String user, String checkinDescription); - - Version submit(String entityType, String entityId, String user, String submitDescription); - - VersionInfo getEntityVersionInfo(String entityType, String entityId, String user, - VersionableEntityAction action); - - Map listEntitiesVersionInfo(String entityType, String user, - VersionableEntityAction action); - - Map listDeletedEntitiesVersionInfo(String entityType, String user, - VersionableEntityAction action); - - List list(String itemId); // TODO: 5/24/2017 filter (by status for example) Version get(String itemId, Version version); Version create(String itemId, Version version, - VersionCreationMethod creationMethod); + VersionCreationMethod creationMethod); void submit(String itemId, Version version, String submitDescription); @@ -77,4 +42,5 @@ public interface VersioningManager { List listRevisions(String itemId, Version version); + void updateVersion(String itemId, Version version); } -- cgit 1.2.3-korg