From f5f13c4f6b6fe3b4d98e349dfd7db59339803436 Mon Sep 17 00:00:00 2001 From: Michael Lando Date: Sun, 19 Feb 2017 12:35:04 +0200 Subject: push addional code Change-Id: Ia427bb3460cda3a896f8faced2de69eaf3807b74 Signed-off-by: Michael Lando --- .../core/model/dao/EnrichedServiceArtifactDao.java | 28 ++++ .../dao/EnrichedServiceArtifactDaoFactory.java | 32 +++++ .../core/model/dao/EnrichedServiceModelDao.java | 42 ++++++ .../model/dao/EnrichedServiceModelDaoFactory.java | 32 +++++ .../core/model/dao/EnrichedServiceTemplateDao.java | 26 ++++ .../dao/EnrichedServiceTemplateDaoFactory.java | 32 +++++ .../core/model/dao/ServiceArtifactDao.java | 44 ++++++ .../core/model/dao/ServiceArtifactDaoFactory.java | 32 +++++ .../core/model/dao/ServiceArtifactDaoInter.java | 44 ++++++ .../openecomp/core/model/dao/ServiceModelDao.java | 40 ++++++ .../core/model/dao/ServiceModelDaoFactory.java | 31 +++++ .../core/model/dao/ServiceTemplateDao.java | 44 ++++++ .../core/model/dao/ServiceTemplateDaoFactory.java | 32 +++++ .../core/model/dao/ServiceTemplateDaoInter.java | 46 ++++++ .../model/types/EnrichedServiceArtifactEntity.java | 136 ++++++++++++++++++ .../model/types/EnrichedServiceTemplateEntity.java | 154 +++++++++++++++++++++ .../core/model/types/ServiceArtifact.java | 29 ++++ .../core/model/types/ServiceArtifactEntity.java | 136 ++++++++++++++++++ .../openecomp/core/model/types/ServiceElement.java | 77 +++++++++++ .../core/model/types/ServiceElementEntity.java | 31 +++++ .../core/model/types/ServiceTemplate.java | 38 +++++ .../core/model/types/ServiceTemplateEntity.java | 154 +++++++++++++++++++++ 22 files changed, 1260 insertions(+) create mode 100644 openecomp-be/lib/openecomp-sdc-model-lib/openecomp-sdc-model-api/src/main/java/org/openecomp/core/model/dao/EnrichedServiceArtifactDao.java create mode 100644 openecomp-be/lib/openecomp-sdc-model-lib/openecomp-sdc-model-api/src/main/java/org/openecomp/core/model/dao/EnrichedServiceArtifactDaoFactory.java create mode 100644 openecomp-be/lib/openecomp-sdc-model-lib/openecomp-sdc-model-api/src/main/java/org/openecomp/core/model/dao/EnrichedServiceModelDao.java create mode 100644 openecomp-be/lib/openecomp-sdc-model-lib/openecomp-sdc-model-api/src/main/java/org/openecomp/core/model/dao/EnrichedServiceModelDaoFactory.java create mode 100644 openecomp-be/lib/openecomp-sdc-model-lib/openecomp-sdc-model-api/src/main/java/org/openecomp/core/model/dao/EnrichedServiceTemplateDao.java create mode 100644 openecomp-be/lib/openecomp-sdc-model-lib/openecomp-sdc-model-api/src/main/java/org/openecomp/core/model/dao/EnrichedServiceTemplateDaoFactory.java create mode 100644 openecomp-be/lib/openecomp-sdc-model-lib/openecomp-sdc-model-api/src/main/java/org/openecomp/core/model/dao/ServiceArtifactDao.java create mode 100644 openecomp-be/lib/openecomp-sdc-model-lib/openecomp-sdc-model-api/src/main/java/org/openecomp/core/model/dao/ServiceArtifactDaoFactory.java create mode 100644 openecomp-be/lib/openecomp-sdc-model-lib/openecomp-sdc-model-api/src/main/java/org/openecomp/core/model/dao/ServiceArtifactDaoInter.java create mode 100644 openecomp-be/lib/openecomp-sdc-model-lib/openecomp-sdc-model-api/src/main/java/org/openecomp/core/model/dao/ServiceModelDao.java create mode 100644 openecomp-be/lib/openecomp-sdc-model-lib/openecomp-sdc-model-api/src/main/java/org/openecomp/core/model/dao/ServiceModelDaoFactory.java create mode 100644 openecomp-be/lib/openecomp-sdc-model-lib/openecomp-sdc-model-api/src/main/java/org/openecomp/core/model/dao/ServiceTemplateDao.java create mode 100644 openecomp-be/lib/openecomp-sdc-model-lib/openecomp-sdc-model-api/src/main/java/org/openecomp/core/model/dao/ServiceTemplateDaoFactory.java create mode 100644 openecomp-be/lib/openecomp-sdc-model-lib/openecomp-sdc-model-api/src/main/java/org/openecomp/core/model/dao/ServiceTemplateDaoInter.java create mode 100644 openecomp-be/lib/openecomp-sdc-model-lib/openecomp-sdc-model-api/src/main/java/org/openecomp/core/model/types/EnrichedServiceArtifactEntity.java create mode 100644 openecomp-be/lib/openecomp-sdc-model-lib/openecomp-sdc-model-api/src/main/java/org/openecomp/core/model/types/EnrichedServiceTemplateEntity.java create mode 100644 openecomp-be/lib/openecomp-sdc-model-lib/openecomp-sdc-model-api/src/main/java/org/openecomp/core/model/types/ServiceArtifact.java create mode 100644 openecomp-be/lib/openecomp-sdc-model-lib/openecomp-sdc-model-api/src/main/java/org/openecomp/core/model/types/ServiceArtifactEntity.java create mode 100644 openecomp-be/lib/openecomp-sdc-model-lib/openecomp-sdc-model-api/src/main/java/org/openecomp/core/model/types/ServiceElement.java create mode 100644 openecomp-be/lib/openecomp-sdc-model-lib/openecomp-sdc-model-api/src/main/java/org/openecomp/core/model/types/ServiceElementEntity.java create mode 100644 openecomp-be/lib/openecomp-sdc-model-lib/openecomp-sdc-model-api/src/main/java/org/openecomp/core/model/types/ServiceTemplate.java create mode 100644 openecomp-be/lib/openecomp-sdc-model-lib/openecomp-sdc-model-api/src/main/java/org/openecomp/core/model/types/ServiceTemplateEntity.java (limited to 'openecomp-be/lib/openecomp-sdc-model-lib/openecomp-sdc-model-api/src/main/java') diff --git a/openecomp-be/lib/openecomp-sdc-model-lib/openecomp-sdc-model-api/src/main/java/org/openecomp/core/model/dao/EnrichedServiceArtifactDao.java b/openecomp-be/lib/openecomp-sdc-model-lib/openecomp-sdc-model-api/src/main/java/org/openecomp/core/model/dao/EnrichedServiceArtifactDao.java new file mode 100644 index 0000000000..e25845d319 --- /dev/null +++ b/openecomp-be/lib/openecomp-sdc-model-lib/openecomp-sdc-model-api/src/main/java/org/openecomp/core/model/dao/EnrichedServiceArtifactDao.java @@ -0,0 +1,28 @@ +/*- + * ============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.core.model.dao; + +import org.openecomp.core.model.types.ServiceArtifact; +import org.openecomp.sdc.versioning.dao.types.Version; + +public interface EnrichedServiceArtifactDao extends ServiceArtifactDaoInter { + ServiceArtifact getArtifactInfo(String vspId, Version version, String name); +} diff --git a/openecomp-be/lib/openecomp-sdc-model-lib/openecomp-sdc-model-api/src/main/java/org/openecomp/core/model/dao/EnrichedServiceArtifactDaoFactory.java b/openecomp-be/lib/openecomp-sdc-model-lib/openecomp-sdc-model-api/src/main/java/org/openecomp/core/model/dao/EnrichedServiceArtifactDaoFactory.java new file mode 100644 index 0000000000..3852e983e5 --- /dev/null +++ b/openecomp-be/lib/openecomp-sdc-model-lib/openecomp-sdc-model-api/src/main/java/org/openecomp/core/model/dao/EnrichedServiceArtifactDaoFactory.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.core.model.dao; + +import org.openecomp.core.factory.api.AbstractComponentFactory; +import org.openecomp.core.factory.api.AbstractFactory; + +public abstract class EnrichedServiceArtifactDaoFactory + extends AbstractComponentFactory { + + public static EnrichedServiceArtifactDaoFactory getInstance() { + return AbstractFactory.getInstance(EnrichedServiceArtifactDaoFactory.class); + } +} diff --git a/openecomp-be/lib/openecomp-sdc-model-lib/openecomp-sdc-model-api/src/main/java/org/openecomp/core/model/dao/EnrichedServiceModelDao.java b/openecomp-be/lib/openecomp-sdc-model-lib/openecomp-sdc-model-api/src/main/java/org/openecomp/core/model/dao/EnrichedServiceModelDao.java new file mode 100644 index 0000000000..d547316ebf --- /dev/null +++ b/openecomp-be/lib/openecomp-sdc-model-lib/openecomp-sdc-model-api/src/main/java/org/openecomp/core/model/dao/EnrichedServiceModelDao.java @@ -0,0 +1,42 @@ +/*- + * ============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.core.model.dao; + +import org.openecomp.core.model.types.ServiceArtifact; +import org.openecomp.sdc.versioning.dao.VersionableDao; +import org.openecomp.sdc.versioning.dao.types.Version; + +import java.util.List; + +public interface EnrichedServiceModelDao extends VersionableDao { + + M getServiceModel(String vspId, Version version); + + void storeServiceModel(String vspId, Version version, M serviceModel); + + void storeExternalArtifact(ServiceArtifact serviceArtifact); + + List getExternalArtifacts(String vspId, Version version); + + E getServiceModelInfo(String vspId, Version version, String name); + + List getServiceModelContentNames(); +} diff --git a/openecomp-be/lib/openecomp-sdc-model-lib/openecomp-sdc-model-api/src/main/java/org/openecomp/core/model/dao/EnrichedServiceModelDaoFactory.java b/openecomp-be/lib/openecomp-sdc-model-lib/openecomp-sdc-model-api/src/main/java/org/openecomp/core/model/dao/EnrichedServiceModelDaoFactory.java new file mode 100644 index 0000000000..9d18d6c9cf --- /dev/null +++ b/openecomp-be/lib/openecomp-sdc-model-lib/openecomp-sdc-model-api/src/main/java/org/openecomp/core/model/dao/EnrichedServiceModelDaoFactory.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.core.model.dao; + +import org.openecomp.core.factory.api.AbstractComponentFactory; +import org.openecomp.core.factory.api.AbstractFactory; + +public abstract class EnrichedServiceModelDaoFactory + extends AbstractComponentFactory { + + public static EnrichedServiceModelDaoFactory getInstance() { + return AbstractFactory.getInstance(EnrichedServiceModelDaoFactory.class); + } +} diff --git a/openecomp-be/lib/openecomp-sdc-model-lib/openecomp-sdc-model-api/src/main/java/org/openecomp/core/model/dao/EnrichedServiceTemplateDao.java b/openecomp-be/lib/openecomp-sdc-model-lib/openecomp-sdc-model-api/src/main/java/org/openecomp/core/model/dao/EnrichedServiceTemplateDao.java new file mode 100644 index 0000000000..5ea2de7fd9 --- /dev/null +++ b/openecomp-be/lib/openecomp-sdc-model-lib/openecomp-sdc-model-api/src/main/java/org/openecomp/core/model/dao/EnrichedServiceTemplateDao.java @@ -0,0 +1,26 @@ +/*- + * ============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.core.model.dao; + + +public interface EnrichedServiceTemplateDao extends ServiceTemplateDaoInter { + +} diff --git a/openecomp-be/lib/openecomp-sdc-model-lib/openecomp-sdc-model-api/src/main/java/org/openecomp/core/model/dao/EnrichedServiceTemplateDaoFactory.java b/openecomp-be/lib/openecomp-sdc-model-lib/openecomp-sdc-model-api/src/main/java/org/openecomp/core/model/dao/EnrichedServiceTemplateDaoFactory.java new file mode 100644 index 0000000000..cab3ca6247 --- /dev/null +++ b/openecomp-be/lib/openecomp-sdc-model-lib/openecomp-sdc-model-api/src/main/java/org/openecomp/core/model/dao/EnrichedServiceTemplateDaoFactory.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.core.model.dao; + +import org.openecomp.core.factory.api.AbstractComponentFactory; +import org.openecomp.core.factory.api.AbstractFactory; + +public abstract class EnrichedServiceTemplateDaoFactory + extends AbstractComponentFactory { + + public static EnrichedServiceTemplateDaoFactory getInstance() { + return AbstractFactory.getInstance(EnrichedServiceTemplateDaoFactory.class); + } +} diff --git a/openecomp-be/lib/openecomp-sdc-model-lib/openecomp-sdc-model-api/src/main/java/org/openecomp/core/model/dao/ServiceArtifactDao.java b/openecomp-be/lib/openecomp-sdc-model-lib/openecomp-sdc-model-api/src/main/java/org/openecomp/core/model/dao/ServiceArtifactDao.java new file mode 100644 index 0000000000..48f59d06ae --- /dev/null +++ b/openecomp-be/lib/openecomp-sdc-model-lib/openecomp-sdc-model-api/src/main/java/org/openecomp/core/model/dao/ServiceArtifactDao.java @@ -0,0 +1,44 @@ +/*- + * ============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.core.model.dao; + +import org.openecomp.core.model.types.ServiceArtifact; +import org.openecomp.sdc.versioning.dao.types.Version; + +import java.util.Collection; + +public interface ServiceArtifactDao extends ServiceArtifactDaoInter { + + Collection list(String vspId, Version version); + + void create(ServiceArtifact entity); + + void update(ServiceArtifact entity); + + ServiceArtifact get(String vspId, Version version); + + void delete(String vspId, Version version); + + Object[] getKeys(String vspId, Version version); + + ServiceArtifact getArtifactInfo(String vspId, Version version, String name); + +} diff --git a/openecomp-be/lib/openecomp-sdc-model-lib/openecomp-sdc-model-api/src/main/java/org/openecomp/core/model/dao/ServiceArtifactDaoFactory.java b/openecomp-be/lib/openecomp-sdc-model-lib/openecomp-sdc-model-api/src/main/java/org/openecomp/core/model/dao/ServiceArtifactDaoFactory.java new file mode 100644 index 0000000000..07c2191a7c --- /dev/null +++ b/openecomp-be/lib/openecomp-sdc-model-lib/openecomp-sdc-model-api/src/main/java/org/openecomp/core/model/dao/ServiceArtifactDaoFactory.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.core.model.dao; + +import org.openecomp.core.factory.api.AbstractComponentFactory; +import org.openecomp.core.factory.api.AbstractFactory; + +public abstract class ServiceArtifactDaoFactory + extends AbstractComponentFactory { + + public static ServiceArtifactDaoFactory getInstance() { + return AbstractFactory.getInstance(ServiceArtifactDaoFactory.class); + } +} diff --git a/openecomp-be/lib/openecomp-sdc-model-lib/openecomp-sdc-model-api/src/main/java/org/openecomp/core/model/dao/ServiceArtifactDaoInter.java b/openecomp-be/lib/openecomp-sdc-model-lib/openecomp-sdc-model-api/src/main/java/org/openecomp/core/model/dao/ServiceArtifactDaoInter.java new file mode 100644 index 0000000000..20d0c56c1b --- /dev/null +++ b/openecomp-be/lib/openecomp-sdc-model-lib/openecomp-sdc-model-api/src/main/java/org/openecomp/core/model/dao/ServiceArtifactDaoInter.java @@ -0,0 +1,44 @@ +/*- + * ============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.core.model.dao; + +import org.openecomp.core.model.types.ServiceArtifact; +import org.openecomp.sdc.versioning.dao.VersionableDao; +import org.openecomp.sdc.versioning.dao.types.Version; + +import java.util.Collection; + +public interface ServiceArtifactDaoInter extends VersionableDao { + + Collection list(String vspId, Version version); + + void create(ServiceArtifact entity); + + void update(ServiceArtifact entity); + + ServiceArtifact get(String vspId, Version version); + + void delete(String vspId, Version version); + + Object[] getKeys(String vspId, Version version); + + ServiceArtifact getArtifactInfo(String vspId, Version version, String name); +} diff --git a/openecomp-be/lib/openecomp-sdc-model-lib/openecomp-sdc-model-api/src/main/java/org/openecomp/core/model/dao/ServiceModelDao.java b/openecomp-be/lib/openecomp-sdc-model-lib/openecomp-sdc-model-api/src/main/java/org/openecomp/core/model/dao/ServiceModelDao.java new file mode 100644 index 0000000000..30bb79c100 --- /dev/null +++ b/openecomp-be/lib/openecomp-sdc-model-lib/openecomp-sdc-model-api/src/main/java/org/openecomp/core/model/dao/ServiceModelDao.java @@ -0,0 +1,40 @@ +/*- + * ============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.core.model.dao; + +import org.openecomp.core.model.types.ServiceArtifact; +import org.openecomp.sdc.versioning.dao.VersionableDao; +import org.openecomp.sdc.versioning.dao.types.Version; + +import java.util.List; + +public interface ServiceModelDao extends VersionableDao { + + M getServiceModel(String vspId, Version version); + + void storeServiceModel(String vspId, Version version, M serviceModel); + + E getServiceModelInfo(String vspId, Version version, String name); + + void storeExternalArtifact(ServiceArtifact serviceArtifact); + + List getServiceModelContentNames(); +} diff --git a/openecomp-be/lib/openecomp-sdc-model-lib/openecomp-sdc-model-api/src/main/java/org/openecomp/core/model/dao/ServiceModelDaoFactory.java b/openecomp-be/lib/openecomp-sdc-model-lib/openecomp-sdc-model-api/src/main/java/org/openecomp/core/model/dao/ServiceModelDaoFactory.java new file mode 100644 index 0000000000..19f6cb5c8c --- /dev/null +++ b/openecomp-be/lib/openecomp-sdc-model-lib/openecomp-sdc-model-api/src/main/java/org/openecomp/core/model/dao/ServiceModelDaoFactory.java @@ -0,0 +1,31 @@ +/*- + * ============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.core.model.dao; + +import org.openecomp.core.factory.api.AbstractComponentFactory; +import org.openecomp.core.factory.api.AbstractFactory; + +public abstract class ServiceModelDaoFactory extends AbstractComponentFactory { + + public static ServiceModelDaoFactory getInstance() { + return AbstractFactory.getInstance(ServiceModelDaoFactory.class); + } +} diff --git a/openecomp-be/lib/openecomp-sdc-model-lib/openecomp-sdc-model-api/src/main/java/org/openecomp/core/model/dao/ServiceTemplateDao.java b/openecomp-be/lib/openecomp-sdc-model-lib/openecomp-sdc-model-api/src/main/java/org/openecomp/core/model/dao/ServiceTemplateDao.java new file mode 100644 index 0000000000..c0c919b8a0 --- /dev/null +++ b/openecomp-be/lib/openecomp-sdc-model-lib/openecomp-sdc-model-api/src/main/java/org/openecomp/core/model/dao/ServiceTemplateDao.java @@ -0,0 +1,44 @@ +/*- + * ============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.core.model.dao; + +import org.openecomp.core.model.types.ServiceTemplate; +import org.openecomp.sdc.versioning.dao.types.Version; + +import java.util.Collection; + +public interface ServiceTemplateDao extends ServiceTemplateDaoInter { + void create(ServiceTemplate entity); + + void update(ServiceTemplate entity); + + ServiceTemplate get(String vspId, Version version); + + void delete(String vspId, Version version); + + Object[] getKeys(String vspId, Version version); + + ServiceTemplate getTemplateInfo(String vspId, Version version, String name); + + Collection list(String vspId, Version version); + + String getBase(String vspId, Version version); +} diff --git a/openecomp-be/lib/openecomp-sdc-model-lib/openecomp-sdc-model-api/src/main/java/org/openecomp/core/model/dao/ServiceTemplateDaoFactory.java b/openecomp-be/lib/openecomp-sdc-model-lib/openecomp-sdc-model-api/src/main/java/org/openecomp/core/model/dao/ServiceTemplateDaoFactory.java new file mode 100644 index 0000000000..65aad1bb97 --- /dev/null +++ b/openecomp-be/lib/openecomp-sdc-model-lib/openecomp-sdc-model-api/src/main/java/org/openecomp/core/model/dao/ServiceTemplateDaoFactory.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.core.model.dao; + +import org.openecomp.core.factory.api.AbstractComponentFactory; +import org.openecomp.core.factory.api.AbstractFactory; + +public abstract class ServiceTemplateDaoFactory + extends AbstractComponentFactory { + + public static ServiceTemplateDaoFactory getInstance() { + return AbstractFactory.getInstance(ServiceTemplateDaoFactory.class); + } +} diff --git a/openecomp-be/lib/openecomp-sdc-model-lib/openecomp-sdc-model-api/src/main/java/org/openecomp/core/model/dao/ServiceTemplateDaoInter.java b/openecomp-be/lib/openecomp-sdc-model-lib/openecomp-sdc-model-api/src/main/java/org/openecomp/core/model/dao/ServiceTemplateDaoInter.java new file mode 100644 index 0000000000..c4c4cb19b7 --- /dev/null +++ b/openecomp-be/lib/openecomp-sdc-model-lib/openecomp-sdc-model-api/src/main/java/org/openecomp/core/model/dao/ServiceTemplateDaoInter.java @@ -0,0 +1,46 @@ +/*- + * ============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.core.model.dao; + +import org.openecomp.core.model.types.ServiceTemplate; +import org.openecomp.sdc.versioning.dao.VersionableDao; +import org.openecomp.sdc.versioning.dao.types.Version; + +import java.util.Collection; + +public interface ServiceTemplateDaoInter extends VersionableDao { + void create(ServiceTemplate entity); + + void update(ServiceTemplate entity); + + ServiceTemplate get(String vspId, Version version); + + void delete(String vspId, Version version); + + Object[] getKeys(String vspId, Version version); + + ServiceTemplate getTemplateInfo(String vspId, Version version, String name); + + Collection list(String vspId, Version version); + + String getBase(String vspId, Version version); + +} diff --git a/openecomp-be/lib/openecomp-sdc-model-lib/openecomp-sdc-model-api/src/main/java/org/openecomp/core/model/types/EnrichedServiceArtifactEntity.java b/openecomp-be/lib/openecomp-sdc-model-lib/openecomp-sdc-model-api/src/main/java/org/openecomp/core/model/types/EnrichedServiceArtifactEntity.java new file mode 100644 index 0000000000..87e25613fc --- /dev/null +++ b/openecomp-be/lib/openecomp-sdc-model-lib/openecomp-sdc-model-api/src/main/java/org/openecomp/core/model/types/EnrichedServiceArtifactEntity.java @@ -0,0 +1,136 @@ +/*- + * ============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.core.model.types; + +import com.google.common.io.ByteStreams; + +import com.datastax.driver.mapping.annotations.ClusteringColumn; +import com.datastax.driver.mapping.annotations.Column; +import com.datastax.driver.mapping.annotations.Frozen; +import com.datastax.driver.mapping.annotations.PartitionKey; +import com.datastax.driver.mapping.annotations.Table; +import org.openecomp.sdc.versioning.dao.types.Version; + +import java.io.IOException; +import java.nio.ByteBuffer; + +@Table(keyspace = "dox", name = "vsp_enriched_service_artifact") +public class EnrichedServiceArtifactEntity implements ServiceElementEntity { + private static final String ENTITY_TYPE; + + static { + ENTITY_TYPE = "Vendor Software Product Service artifact"; + } + + @PartitionKey + @Column(name = "vsp_id") + public String id; + + @PartitionKey(value = 1) + @Frozen + public Version version; + + @ClusteringColumn + @Column(name = "name") + public String name; + + @Column(name = "content_data") + public ByteBuffer contentData; + + public EnrichedServiceArtifactEntity() { + } + + /** + * Instantiates a new Enriched service artifact entity. + * + * @param entity the entity + */ + public EnrichedServiceArtifactEntity(ServiceArtifact entity) { + this.id = entity.getVspId(); + this.version = entity.getVersion(); + this.name = entity.getName(); + + try { + this.contentData = ByteBuffer.wrap(ByteStreams.toByteArray(entity.getContent())); + } catch (IOException ioException) { + throw new RuntimeException(ioException); + } + + } + + @Override + public String getEntityType() { + return ENTITY_TYPE; + } + + @Override + public String getFirstClassCitizenId() { + return getId(); + } + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + @Override + public Version getVersion() { + return version; + } + + @Override + public void setVersion(Version version) { + this.version = version; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public ByteBuffer getContentData() { + return contentData; + } + + public void setContentData(ByteBuffer contentData) { + this.contentData = contentData; + } + + /** + * Gets service artifact. + * + * @return the service artifact + */ + public ServiceArtifact getServiceArtifact() { + ServiceArtifact serviceArtifact = new ServiceArtifact(); + serviceArtifact.setName(this.getName()); + serviceArtifact.setVersion(this.getVersion()); + serviceArtifact.setContentData(this.getContentData().array()); + serviceArtifact.setVspId(this.getId()); + return serviceArtifact; + } +} diff --git a/openecomp-be/lib/openecomp-sdc-model-lib/openecomp-sdc-model-api/src/main/java/org/openecomp/core/model/types/EnrichedServiceTemplateEntity.java b/openecomp-be/lib/openecomp-sdc-model-lib/openecomp-sdc-model-api/src/main/java/org/openecomp/core/model/types/EnrichedServiceTemplateEntity.java new file mode 100644 index 0000000000..526a901e47 --- /dev/null +++ b/openecomp-be/lib/openecomp-sdc-model-lib/openecomp-sdc-model-api/src/main/java/org/openecomp/core/model/types/EnrichedServiceTemplateEntity.java @@ -0,0 +1,154 @@ +/*- + * ============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.core.model.types; + +import com.google.common.io.ByteStreams; + +import com.datastax.driver.mapping.annotations.ClusteringColumn; +import com.datastax.driver.mapping.annotations.Column; +import com.datastax.driver.mapping.annotations.Frozen; +import com.datastax.driver.mapping.annotations.PartitionKey; +import com.datastax.driver.mapping.annotations.Table; +import org.openecomp.sdc.versioning.dao.types.Version; + +import java.io.IOException; +import java.nio.ByteBuffer; + +@Table(keyspace = "dox", name = "vsp_enriched_service_template") +public class EnrichedServiceTemplateEntity implements ServiceElementEntity { + + private static final String ENTITY_TYPE; + + static { + ENTITY_TYPE = "Vendor Software Product Service model"; + } + + @PartitionKey + @Column(name = "vsp_id") + public String id; + + @PartitionKey(value = 1) + @Frozen + public Version version; + + @ClusteringColumn + @Column(name = "name") + public String name; + + @Column(name = "content_data") + public ByteBuffer contentData; + + + @Column(name = "base_name") + private String baseName; + + public EnrichedServiceTemplateEntity() { + } + + /** + * Instantiates a new Enriched service template entity. + * + * @param entity the entity + */ + public EnrichedServiceTemplateEntity(ServiceTemplate entity) { + this.id = entity.getVspId(); + this.version = entity.getVersion(); + this.name = entity.getName(); + this.setBaseName(entity.getBaseName()); + try { + this.contentData = ByteBuffer.wrap(ByteStreams.toByteArray(entity.getContent())); + } catch (IOException ioException) { + throw new RuntimeException(ioException); + } + + } + + + public String getBaseName() { + return baseName; + } + + public void setBaseName(String baseName) { + this.baseName = baseName; + } + + + @Override + public String getEntityType() { + return ENTITY_TYPE; + } + + @Override + public String getFirstClassCitizenId() { + return getId(); + } + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + @Override + public Version getVersion() { + return version; + } + + @Override + public void setVersion(Version version) { + this.version = version; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public ByteBuffer getContentData() { + return contentData; + } + + public void setContentData(ByteBuffer contentData) { + this.contentData = contentData; + } + + + /** + * Gets service template. + * + * @return the service template + */ + public ServiceTemplate getServiceTemplate() { + ServiceTemplate serviceTemplate = new ServiceTemplate(); + serviceTemplate.setName(this.getName()); + serviceTemplate.setVersion(this.getVersion()); + serviceTemplate.setContentData(this.getContentData().array()); + serviceTemplate.setVspId(this.getId()); + serviceTemplate.setBaseName(this.getBaseName()); + return serviceTemplate; + + } +} diff --git a/openecomp-be/lib/openecomp-sdc-model-lib/openecomp-sdc-model-api/src/main/java/org/openecomp/core/model/types/ServiceArtifact.java b/openecomp-be/lib/openecomp-sdc-model-lib/openecomp-sdc-model-api/src/main/java/org/openecomp/core/model/types/ServiceArtifact.java new file mode 100644 index 0000000000..fad3e604d6 --- /dev/null +++ b/openecomp-be/lib/openecomp-sdc-model-lib/openecomp-sdc-model-api/src/main/java/org/openecomp/core/model/types/ServiceArtifact.java @@ -0,0 +1,29 @@ +/*- + * ============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.core.model.types; + +public class ServiceArtifact extends ServiceElement { + + + public ServiceArtifact() { + super(); + } +} diff --git a/openecomp-be/lib/openecomp-sdc-model-lib/openecomp-sdc-model-api/src/main/java/org/openecomp/core/model/types/ServiceArtifactEntity.java b/openecomp-be/lib/openecomp-sdc-model-lib/openecomp-sdc-model-api/src/main/java/org/openecomp/core/model/types/ServiceArtifactEntity.java new file mode 100644 index 0000000000..c5dfeced8a --- /dev/null +++ b/openecomp-be/lib/openecomp-sdc-model-lib/openecomp-sdc-model-api/src/main/java/org/openecomp/core/model/types/ServiceArtifactEntity.java @@ -0,0 +1,136 @@ +/*- + * ============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.core.model.types; + +import com.google.common.io.ByteStreams; + +import com.datastax.driver.mapping.annotations.ClusteringColumn; +import com.datastax.driver.mapping.annotations.Column; +import com.datastax.driver.mapping.annotations.Frozen; +import com.datastax.driver.mapping.annotations.PartitionKey; +import com.datastax.driver.mapping.annotations.Table; +import org.openecomp.sdc.versioning.dao.types.Version; + +import java.io.IOException; +import java.nio.ByteBuffer; + +@Table(keyspace = "dox", name = "vsp_service_artifact") +public class ServiceArtifactEntity implements ServiceElementEntity { + private static final String ENTITY_TYPE; + + static { + ENTITY_TYPE = "Vendor Software Product Service artifact"; + } + + @PartitionKey + @Column(name = "vsp_id") + public String id; + + @PartitionKey(value = 1) + @Frozen + public Version version; + + @ClusteringColumn + @Column(name = "name") + public String name; + + @Column(name = "content_data") + public ByteBuffer contentData; + + public ServiceArtifactEntity() { + } + + /** + * Instantiates a new Service artifact entity. + * + * @param entity the entity + */ + public ServiceArtifactEntity(ServiceArtifact entity) { + this.id = entity.getVspId(); + this.version = entity.getVersion(); + this.name = entity.getName(); + + try { + this.contentData = ByteBuffer.wrap(ByteStreams.toByteArray(entity.getContent())); + } catch (IOException ioException) { + throw new RuntimeException(ioException); + } + + } + + @Override + public String getEntityType() { + return ENTITY_TYPE; + } + + @Override + public String getFirstClassCitizenId() { + return getId(); + } + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + @Override + public Version getVersion() { + return version; + } + + @Override + public void setVersion(Version version) { + this.version = version; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public ByteBuffer getContentData() { + return contentData; + } + + public void setContentData(ByteBuffer contentData) { + this.contentData = contentData; + } + + /** + * Gets service artifact. + * + * @return the service artifact + */ + public ServiceArtifact getServiceArtifact() { + ServiceArtifact serviceArtifact = new ServiceArtifact(); + serviceArtifact.setName(this.getName()); + serviceArtifact.setVersion(this.getVersion()); + serviceArtifact.setContentData(this.getContentData().array()); + serviceArtifact.setVspId(this.getId()); + return serviceArtifact; + } +} diff --git a/openecomp-be/lib/openecomp-sdc-model-lib/openecomp-sdc-model-api/src/main/java/org/openecomp/core/model/types/ServiceElement.java b/openecomp-be/lib/openecomp-sdc-model-lib/openecomp-sdc-model-api/src/main/java/org/openecomp/core/model/types/ServiceElement.java new file mode 100644 index 0000000000..114cf03a39 --- /dev/null +++ b/openecomp-be/lib/openecomp-sdc-model-lib/openecomp-sdc-model-api/src/main/java/org/openecomp/core/model/types/ServiceElement.java @@ -0,0 +1,77 @@ +/*- + * ============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.core.model.types; + +import org.openecomp.sdc.versioning.dao.types.Version; + +import java.io.ByteArrayInputStream; +import java.io.InputStream; + +public class ServiceElement { + + private String vspId; + private Version version; + private String name; + private byte[] contentData; + + public ServiceElement() { + } + + public String getVspId() { + return vspId; + } + + public void setVspId(String vspId) { + this.vspId = vspId; + } + + public Version getVersion() { + return version; + } + + public void setVersion(Version version) { + this.version = version; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + /** + * Gets content. + * + * @return the content + */ + public InputStream getContent() { + if (this.contentData == null) { + return null; + } + return new ByteArrayInputStream(contentData); + } + + public void setContentData(byte[] contentData) { + this.contentData = contentData; + } +} diff --git a/openecomp-be/lib/openecomp-sdc-model-lib/openecomp-sdc-model-api/src/main/java/org/openecomp/core/model/types/ServiceElementEntity.java b/openecomp-be/lib/openecomp-sdc-model-lib/openecomp-sdc-model-api/src/main/java/org/openecomp/core/model/types/ServiceElementEntity.java new file mode 100644 index 0000000000..02249039f8 --- /dev/null +++ b/openecomp-be/lib/openecomp-sdc-model-lib/openecomp-sdc-model-api/src/main/java/org/openecomp/core/model/types/ServiceElementEntity.java @@ -0,0 +1,31 @@ +/*- + * ============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.core.model.types; + +import org.openecomp.sdc.versioning.dao.types.VersionableEntity; + +import java.nio.ByteBuffer; + +public interface ServiceElementEntity extends VersionableEntity { + String getName(); + + ByteBuffer getContentData(); +} diff --git a/openecomp-be/lib/openecomp-sdc-model-lib/openecomp-sdc-model-api/src/main/java/org/openecomp/core/model/types/ServiceTemplate.java b/openecomp-be/lib/openecomp-sdc-model-lib/openecomp-sdc-model-api/src/main/java/org/openecomp/core/model/types/ServiceTemplate.java new file mode 100644 index 0000000000..aa0285d6a9 --- /dev/null +++ b/openecomp-be/lib/openecomp-sdc-model-lib/openecomp-sdc-model-api/src/main/java/org/openecomp/core/model/types/ServiceTemplate.java @@ -0,0 +1,38 @@ +/*- + * ============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.core.model.types; + +public class ServiceTemplate extends ServiceElement { + private String baseName; + + public ServiceTemplate() { + } + + + public String getBaseName() { + return baseName; + } + + + public void setBaseName(String baseName) { + this.baseName = baseName; + } +} diff --git a/openecomp-be/lib/openecomp-sdc-model-lib/openecomp-sdc-model-api/src/main/java/org/openecomp/core/model/types/ServiceTemplateEntity.java b/openecomp-be/lib/openecomp-sdc-model-lib/openecomp-sdc-model-api/src/main/java/org/openecomp/core/model/types/ServiceTemplateEntity.java new file mode 100644 index 0000000000..f29334678f --- /dev/null +++ b/openecomp-be/lib/openecomp-sdc-model-lib/openecomp-sdc-model-api/src/main/java/org/openecomp/core/model/types/ServiceTemplateEntity.java @@ -0,0 +1,154 @@ +/*- + * ============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.core.model.types; + +import com.google.common.io.ByteStreams; + +import com.datastax.driver.mapping.annotations.ClusteringColumn; +import com.datastax.driver.mapping.annotations.Column; +import com.datastax.driver.mapping.annotations.Frozen; +import com.datastax.driver.mapping.annotations.PartitionKey; +import com.datastax.driver.mapping.annotations.Table; +import org.openecomp.sdc.versioning.dao.types.Version; + +import java.io.IOException; +import java.nio.ByteBuffer; + +@Table(keyspace = "dox", name = "vsp_service_template") +public class ServiceTemplateEntity implements ServiceElementEntity { + + private static final String ENTITY_TYPE; + + static { + ENTITY_TYPE = "Vendor Software Product Service model"; + } + + @PartitionKey + @Column(name = "vsp_id") + public String id; + + @PartitionKey(value = 1) + @Frozen + public Version version; + + @ClusteringColumn + @Column(name = "name") + public String name; + + @Column(name = "content_data") + public ByteBuffer contentData; + + + @Column(name = "base_name") + private String baseName; + + public ServiceTemplateEntity() { + } + + /** + * Instantiates a new Service template entity. + * + * @param entity the entity + */ + public ServiceTemplateEntity(ServiceTemplate entity) { + this.id = entity.getVspId(); + this.version = entity.getVersion(); + this.name = entity.getName(); + this.setBaseName(entity.getBaseName()); + try { + this.contentData = ByteBuffer.wrap(ByteStreams.toByteArray(entity.getContent())); + } catch (IOException ioException) { + throw new RuntimeException(ioException); + } + + } + + + public String getBaseName() { + return baseName; + } + + public void setBaseName(String baseName) { + this.baseName = baseName; + } + + + @Override + public String getEntityType() { + return ENTITY_TYPE; + } + + @Override + public String getFirstClassCitizenId() { + return getId(); + } + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + @Override + public Version getVersion() { + return version; + } + + @Override + public void setVersion(Version version) { + this.version = version; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public ByteBuffer getContentData() { + return contentData; + } + + public void setContentData(ByteBuffer contentData) { + this.contentData = contentData; + } + + + /** + * Gets service template. + * + * @return the service template + */ + public ServiceTemplate getServiceTemplate() { + ServiceTemplate serviceTemplate = new ServiceTemplate(); + serviceTemplate.setName(this.getName()); + serviceTemplate.setVersion(this.getVersion()); + serviceTemplate.setContentData(this.getContentData().array()); + serviceTemplate.setVspId(this.getId()); + serviceTemplate.setBaseName(this.getBaseName()); + return serviceTemplate; + + } +} -- cgit 1.2.3-korg