summaryrefslogtreecommitdiffstats
path: root/services/activity-spec/activity-spec-web/activity-spec-service/src/main/java/org/openecomp/activityspec/be/dao
diff options
context:
space:
mode:
authorsheetalm <sheetal.mudholkar@amdocs.com>2018-04-12 13:20:36 +0530
committerVitaly Emporopulo <Vitaliy.Emporopulo@amdocs.com>2018-04-12 16:21:28 +0000
commit894285bfa9ccacde35b1e94e07856b53971e2559 (patch)
treed7174842de984017163eeec5834d34bc46db7cd3 /services/activity-spec/activity-spec-web/activity-spec-service/src/main/java/org/openecomp/activityspec/be/dao
parentd60b2a40c15c5952f8a31e2d2aa4be2cf4837fc8 (diff)
Activity Spec - change in package and group names
1 Package structure will now be org.onap.sdc.activityspec instead of org.openecomp.activityspec 2 Same applies for group names 3 This is done to fix issue with pushing docker images to nexus repository 4 In ONAP in order for you to push to nexus you need to match the package and artifact name to the repository Change-Id: I1266c66fa0d0a85acd9ca1164647b996433eb960 Issue-ID: SDC-1048 Signed-off-by: sheetalm <sheetal.mudholkar@amdocs.com>
Diffstat (limited to 'services/activity-spec/activity-spec-web/activity-spec-service/src/main/java/org/openecomp/activityspec/be/dao')
-rw-r--r--services/activity-spec/activity-spec-web/activity-spec-service/src/main/java/org/openecomp/activityspec/be/dao/ActivitySpecDao.java27
-rw-r--r--services/activity-spec/activity-spec-web/activity-spec-service/src/main/java/org/openecomp/activityspec/be/dao/impl/ActivitySpecDaoZusammenImpl.java155
-rw-r--r--services/activity-spec/activity-spec-web/activity-spec-service/src/main/java/org/openecomp/activityspec/be/dao/types/ActivitySpecEntity.java39
3 files changed, 0 insertions, 221 deletions
diff --git a/services/activity-spec/activity-spec-web/activity-spec-service/src/main/java/org/openecomp/activityspec/be/dao/ActivitySpecDao.java b/services/activity-spec/activity-spec-web/activity-spec-service/src/main/java/org/openecomp/activityspec/be/dao/ActivitySpecDao.java
deleted file mode 100644
index 375adac876..0000000000
--- a/services/activity-spec/activity-spec-web/activity-spec-service/src/main/java/org/openecomp/activityspec/be/dao/ActivitySpecDao.java
+++ /dev/null
@@ -1,27 +0,0 @@
-/*
- * Copyright © 2016-2017 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.activityspec.be.dao;
-
-import org.openecomp.activityspec.be.dao.types.ActivitySpecEntity;
-
-public interface ActivitySpecDao {
- void create(ActivitySpecEntity activitySpecEntity);
-
- ActivitySpecEntity get(ActivitySpecEntity activitySpec);
-
- void update(ActivitySpecEntity activitySpec);
-}
diff --git a/services/activity-spec/activity-spec-web/activity-spec-service/src/main/java/org/openecomp/activityspec/be/dao/impl/ActivitySpecDaoZusammenImpl.java b/services/activity-spec/activity-spec-web/activity-spec-service/src/main/java/org/openecomp/activityspec/be/dao/impl/ActivitySpecDaoZusammenImpl.java
deleted file mode 100644
index 0dabcca984..0000000000
--- a/services/activity-spec/activity-spec-web/activity-spec-service/src/main/java/org/openecomp/activityspec/be/dao/impl/ActivitySpecDaoZusammenImpl.java
+++ /dev/null
@@ -1,155 +0,0 @@
-/*
- * Copyright © 2016-2017 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.activityspec.be.dao.impl;
-
-import com.amdocs.zusammen.adaptor.inbound.api.types.item.Element;
-import com.amdocs.zusammen.adaptor.inbound.api.types.item.ZusammenElement;
-import com.amdocs.zusammen.datatypes.SessionContext;
-import com.amdocs.zusammen.datatypes.item.Action;
-import com.amdocs.zusammen.datatypes.item.ElementContext;
-import com.amdocs.zusammen.datatypes.item.Info;
-
-import org.openecomp.activityspec.be.dao.ActivitySpecDao;
-import org.openecomp.activityspec.be.dao.types.ActivitySpecEntity;
-import org.openecomp.activityspec.utils.ActivitySpecConstant;
-import org.openecomp.activityspec.be.datatypes.ActivitySpecData;
-import org.openecomp.activityspec.be.datatypes.ElementType;
-import org.openecomp.core.utilities.json.JsonUtil;
-import org.openecomp.core.zusammen.api.ZusammenAdaptor;
-
-import java.io.ByteArrayInputStream;
-import java.io.InputStream;
-import java.util.Objects;
-import java.util.Optional;
-
-import static org.openecomp.core.zusammen.api.ZusammenUtil.buildStructuralElement;
-import static org.openecomp.core.zusammen.api.ZusammenUtil.createSessionContext;
-
-public class ActivitySpecDaoZusammenImpl implements ActivitySpecDao {
-
- private final ZusammenAdaptor zusammenAdaptor;
-
- public ActivitySpecDaoZusammenImpl(ZusammenAdaptor zusammenAdaptor) {
- this.zusammenAdaptor = zusammenAdaptor;
- }
-
- @Override
- public void create(ActivitySpecEntity entity) {
- SessionContext context = createSessionContext();
- ZusammenElement generalElement = mapActivityDetailsToZusammenElement(entity, Action.CREATE);
-
- ElementContext elementContext =
- new ElementContext(entity.getId(), entity.getVersion().getId());
- zusammenAdaptor.saveElement(context, elementContext, generalElement,
- "Create Activity Spec General Info Element");
- }
-
- @Override
- public ActivitySpecEntity get(ActivitySpecEntity entity) {
- SessionContext context = createSessionContext();
-
- ElementContext elementContext = new ElementContext(entity.getId(), entity.getVersion().getId());
- Optional<Element> element = zusammenAdaptor.getElementByName(context, elementContext,
- null, ElementType.ACTIVITYSPEC.name());
- if (element.isPresent()) {
- return mapZusammenElementToActivityDetails(element.get());
- } else {
- return null;
- }
- }
-
- @Override
- public void update(ActivitySpecEntity entity) {
- SessionContext context = createSessionContext();
- ZusammenElement generalElement = mapActivityDetailsToZusammenElement(entity, Action.UPDATE);
-
- ElementContext elementContext =
- new ElementContext(entity.getId(), entity.getVersion().getId());
- zusammenAdaptor.saveElement(context, elementContext, generalElement,
- "Update Activity Spec General Info Element");
- }
-
-
- private ActivitySpecEntity mapZusammenElementToActivityDetails(Element element) {
- ActivitySpecEntity entity = new ActivitySpecEntity();
- entity.setId(element.getElementId().getValue());
- enrichEntityFromElementData(entity, element.getData());
- enrichEntityFromElementInfo(entity, element.getInfo());
- return entity;
- }
-
- private ZusammenElement mapActivityDetailsToZusammenElement(ActivitySpecEntity entity,
- Action action) {
- ZusammenElement generalElement =
- buildStructuralElement(ElementType.ACTIVITYSPEC.name(), action);
-
- enrichElementInfoFromEntity(generalElement, entity);
- enrichElementDataFromEntity(generalElement, entity);
- return generalElement;
- }
-
-
- private void enrichEntityFromElementInfo(ActivitySpecEntity entity, Info info) {
- entity.setName(info.getProperty(InfoPropertyName.NAME.getValue()));
- entity.setDescription(info.getProperty(InfoPropertyName.DESCRIPTION.getValue()));
- entity.setCategoryList(info.getProperty(InfoPropertyName.CATEGORY.getValue()));
- }
-
- private void enrichEntityFromElementData(ActivitySpecEntity entity, InputStream data) {
- ActivitySpecData activitySpecData = JsonUtil.json2Object(data, ActivitySpecData.class);
- if (Objects.nonNull(activitySpecData)) {
- entity.setInputs(activitySpecData.getInputs());
- entity.setOutputs(activitySpecData.getOutputs());
- entity.setType(activitySpecData.getType());
- entity.setContent(activitySpecData.getContent());
- }
- }
-
- private void enrichElementInfoFromEntity(ZusammenElement element, ActivitySpecEntity entity) {
- element.getInfo().addProperty(InfoPropertyName.DESCRIPTION.getValue(), entity.getDescription());
- element.getInfo().addProperty(InfoPropertyName.NAME.getValue(), entity.getName());
- element.getInfo().addProperty(InfoPropertyName.CATEGORY.getValue(),
- entity.getCategoryList());
- }
-
-
- private void enrichElementDataFromEntity(ZusammenElement element, ActivitySpecEntity entity) {
- ActivitySpecData activitySpecData = new ActivitySpecData();
- activitySpecData.setInputs(entity.getInputs());
- activitySpecData.setOutputs(entity.getOutputs());
- activitySpecData.setType(entity.getType());
- activitySpecData.setContent(entity.getContent());
- element.setData(new ByteArrayInputStream(JsonUtil.object2Json(activitySpecData).getBytes()));
- }
-
- public enum InfoPropertyName {
- DESCRIPTION("description"),
- NAME("name"),
- CATEGORY(ActivitySpecConstant.CATEGORY_ATTRIBUTE_NAME);
-
- private final String value;
-
- InfoPropertyName(String value) {
- this.value = value;
- }
-
- public String getValue() {
- return value;
- }
- }
-
-}
diff --git a/services/activity-spec/activity-spec-web/activity-spec-service/src/main/java/org/openecomp/activityspec/be/dao/types/ActivitySpecEntity.java b/services/activity-spec/activity-spec-web/activity-spec-service/src/main/java/org/openecomp/activityspec/be/dao/types/ActivitySpecEntity.java
deleted file mode 100644
index 2f261f8fa9..0000000000
--- a/services/activity-spec/activity-spec-web/activity-spec-service/src/main/java/org/openecomp/activityspec/be/dao/types/ActivitySpecEntity.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * Copyright © 2016-2017 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.activityspec.be.dao.types;
-
-import org.openecomp.activityspec.be.datatypes.ActivitySpecParameter;
-import org.openecomp.sdc.versioning.dao.types.Version;
-
-import java.util.List;
-
-@lombok.Data
-public class ActivitySpecEntity {
- private String id;
- private Version version;
- private String name;
- private String description;
-
- private List<String> categoryList;
- private List<ActivitySpecParameter> inputs;
- private List<ActivitySpecParameter> outputs;
- private String type;
- private String content;
-
- //Not to be maintained in activityspec element
- private String status;
-}