diff options
Diffstat (limited to 'common/onap-sdc-artifact-generator-lib/onap-sdc-artifact-generator-api/src/main/java/org/onap/sdc/generator')
54 files changed, 0 insertions, 2847 deletions
diff --git a/common/onap-sdc-artifact-generator-lib/onap-sdc-artifact-generator-api/src/main/java/org/onap/sdc/generator/aai/AaiModelGenerator.java b/common/onap-sdc-artifact-generator-lib/onap-sdc-artifact-generator-api/src/main/java/org/onap/sdc/generator/aai/AaiModelGenerator.java deleted file mode 100644 index ac39bb4b60..0000000000 --- a/common/onap-sdc-artifact-generator-lib/onap-sdc-artifact-generator-api/src/main/java/org/onap/sdc/generator/aai/AaiModelGenerator.java +++ /dev/null @@ -1,62 +0,0 @@ -/*- - * ============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.onap.sdc.generator.aai; - -import org.onap.sdc.generator.aai.model.Resource; -import org.onap.sdc.generator.aai.model.Service; -import org.onap.sdc.generator.data.GeneratorConstants; -import org.onap.sdc.generator.logging.CategoryLogLevel; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.slf4j.MDC; - -import java.io.StringWriter; - -public interface AaiModelGenerator { - - /** - * Gets instance. - * - * @return the instance - */ - public static AaiModelGenerator getInstance() { - Logger log = LoggerFactory.getLogger(AaiModelGenerator.class.getName()); - try { - return AaiModelGenerator.class.cast( - Class.forName("org.onap.sdc.generator.aai.AaiModelGeneratorImpl").newInstance()); - } catch (Exception exception) { - MDC.put(GeneratorConstants.PARTNER_NAME, GeneratorConstants.GENERATOR_PARTNER_NAME); - MDC.put(GeneratorConstants.ERROR_CATEGORY, CategoryLogLevel.ERROR.name()); - MDC.put(GeneratorConstants.ERROR_CODE, GeneratorConstants.GENERATOR_ERROR_CODE); - MDC.put( - GeneratorConstants.ERROR_DESCRIPTION, GeneratorConstants.GENERATOR_ERROR_SERVICE_INSTANTIATION_FAILED); - StringWriter sw = new StringWriter(); - log.error(sw.toString(), exception); - } - return null; - } - - public String generateModelFor(Service service); - - public String generateModelFor(Resource resource); - - -} diff --git a/common/onap-sdc-artifact-generator-lib/onap-sdc-artifact-generator-api/src/main/java/org/onap/sdc/generator/aai/model/AllotedResource.java b/common/onap-sdc-artifact-generator-lib/onap-sdc-artifact-generator-api/src/main/java/org/onap/sdc/generator/aai/model/AllotedResource.java deleted file mode 100644 index c6389392f6..0000000000 --- a/common/onap-sdc-artifact-generator-lib/onap-sdc-artifact-generator-api/src/main/java/org/onap/sdc/generator/aai/model/AllotedResource.java +++ /dev/null @@ -1,29 +0,0 @@ -/*- - * ============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.onap.sdc.generator.aai.model; - -import org.onap.sdc.generator.aai.types.Cardinality; -import org.onap.sdc.generator.aai.types.Model; - -@Model(widget = Widget.Type.ALLOTTED_RESOURCE, cardinality = Cardinality.UNBOUNDED, - dataDeleteFlag = true) -public class AllotedResource extends Resource { -} diff --git a/common/onap-sdc-artifact-generator-lib/onap-sdc-artifact-generator-api/src/main/java/org/onap/sdc/generator/aai/model/AllotedResourceWidget.java b/common/onap-sdc-artifact-generator-lib/onap-sdc-artifact-generator-api/src/main/java/org/onap/sdc/generator/aai/model/AllotedResourceWidget.java deleted file mode 100644 index 88cdaa6af1..0000000000 --- a/common/onap-sdc-artifact-generator-lib/onap-sdc-artifact-generator-api/src/main/java/org/onap/sdc/generator/aai/model/AllotedResourceWidget.java +++ /dev/null @@ -1,33 +0,0 @@ -/*- - * ============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.onap.sdc.generator.aai.model; - -import org.onap.sdc.generator.aai.types.Cardinality; -import org.onap.sdc.generator.aai.types.Model; -import org.onap.sdc.generator.aai.types.ModelType; -import org.onap.sdc.generator.aai.types.ModelWidget; - - -@Model(widget = Widget.Type.ALLOTTED_RESOURCE, cardinality - = Cardinality.UNBOUNDED, dataDeleteFlag = true) -@ModelWidget(type = ModelType.WIDGET, name = "allotted-resource") -public class AllotedResourceWidget extends ResourceWidget { -} diff --git a/common/onap-sdc-artifact-generator-lib/onap-sdc-artifact-generator-api/src/main/java/org/onap/sdc/generator/aai/model/FlavorWidget.java b/common/onap-sdc-artifact-generator-lib/onap-sdc-artifact-generator-api/src/main/java/org/onap/sdc/generator/aai/model/FlavorWidget.java deleted file mode 100644 index b08a3d4e27..0000000000 --- a/common/onap-sdc-artifact-generator-lib/onap-sdc-artifact-generator-api/src/main/java/org/onap/sdc/generator/aai/model/FlavorWidget.java +++ /dev/null @@ -1,32 +0,0 @@ -/*- - * ============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.onap.sdc.generator.aai.model; - -import org.onap.sdc.generator.aai.types.Cardinality; -import org.onap.sdc.generator.aai.types.Model; -import org.onap.sdc.generator.aai.types.ModelType; -import org.onap.sdc.generator.aai.types.ModelWidget; - -@Model(widget = Widget.Type.FLAVOR, cardinality = Cardinality.UNBOUNDED, dataDeleteFlag = false) -@ModelWidget(type = ModelType.WIDGET, name = "flavor") -public class FlavorWidget extends ResourceWidget { - -} diff --git a/common/onap-sdc-artifact-generator-lib/onap-sdc-artifact-generator-api/src/main/java/org/onap/sdc/generator/aai/model/ImageWidget.java b/common/onap-sdc-artifact-generator-lib/onap-sdc-artifact-generator-api/src/main/java/org/onap/sdc/generator/aai/model/ImageWidget.java deleted file mode 100644 index aef01d8a5b..0000000000 --- a/common/onap-sdc-artifact-generator-lib/onap-sdc-artifact-generator-api/src/main/java/org/onap/sdc/generator/aai/model/ImageWidget.java +++ /dev/null @@ -1,33 +0,0 @@ -/*- - * ============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.onap.sdc.generator.aai.model; - -import org.onap.sdc.generator.aai.types.Cardinality; -import org.onap.sdc.generator.aai.types.Model; -import org.onap.sdc.generator.aai.types.ModelType; -import org.onap.sdc.generator.aai.types.ModelWidget; - -@Model(widget = Widget.Type.IMAGE, cardinality = Cardinality.UNBOUNDED, dataDeleteFlag = false) -@ModelWidget(type = ModelType.WIDGET, name = "image") -public class ImageWidget extends ResourceWidget { - -} - diff --git a/common/onap-sdc-artifact-generator-lib/onap-sdc-artifact-generator-api/src/main/java/org/onap/sdc/generator/aai/model/L3Network.java b/common/onap-sdc-artifact-generator-lib/onap-sdc-artifact-generator-api/src/main/java/org/onap/sdc/generator/aai/model/L3Network.java deleted file mode 100644 index 98713c086b..0000000000 --- a/common/onap-sdc-artifact-generator-lib/onap-sdc-artifact-generator-api/src/main/java/org/onap/sdc/generator/aai/model/L3Network.java +++ /dev/null @@ -1,29 +0,0 @@ -/*- - * ============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.onap.sdc.generator.aai.model; - -import org.onap.sdc.generator.aai.types.Cardinality; -import org.onap.sdc.generator.aai.types.Model; - -@Model(widget = Widget.Type.L3_NET, cardinality = Cardinality - .UNBOUNDED, dataDeleteFlag = false) -public class L3Network extends Resource{ -} diff --git a/common/onap-sdc-artifact-generator-lib/onap-sdc-artifact-generator-api/src/main/java/org/onap/sdc/generator/aai/model/L3NetworkWidget.java b/common/onap-sdc-artifact-generator-lib/onap-sdc-artifact-generator-api/src/main/java/org/onap/sdc/generator/aai/model/L3NetworkWidget.java deleted file mode 100644 index 4b59e99bc9..0000000000 --- a/common/onap-sdc-artifact-generator-lib/onap-sdc-artifact-generator-api/src/main/java/org/onap/sdc/generator/aai/model/L3NetworkWidget.java +++ /dev/null @@ -1,34 +0,0 @@ -/*- - * ============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.onap.sdc.generator.aai.model; - -import org.onap.sdc.generator.aai.types.Cardinality; -import org.onap.sdc.generator.aai.types.Model; -import org.onap.sdc.generator.aai.types.ModelType; -import org.onap.sdc.generator.aai.types.ModelWidget; - -@Model(widget = Widget.Type.L3_NET, - cardinality = Cardinality.UNBOUNDED, dataDeleteFlag = true) -@ModelWidget(type = ModelType.WIDGET, name = "l3-network") -public class L3NetworkWidget extends Widget { - -} - diff --git a/common/onap-sdc-artifact-generator-lib/onap-sdc-artifact-generator-api/src/main/java/org/onap/sdc/generator/aai/model/LIntfWidget.java b/common/onap-sdc-artifact-generator-lib/onap-sdc-artifact-generator-api/src/main/java/org/onap/sdc/generator/aai/model/LIntfWidget.java deleted file mode 100644 index d5f00ff50c..0000000000 --- a/common/onap-sdc-artifact-generator-lib/onap-sdc-artifact-generator-api/src/main/java/org/onap/sdc/generator/aai/model/LIntfWidget.java +++ /dev/null @@ -1,32 +0,0 @@ -/*- - * ============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.onap.sdc.generator.aai.model; - -import org.onap.sdc.generator.aai.types.Cardinality; -import org.onap.sdc.generator.aai.types.Model; -import org.onap.sdc.generator.aai.types.ModelType; -import org.onap.sdc.generator.aai.types.ModelWidget; - -@Model(widget = Widget.Type.LINT, cardinality = Cardinality.UNBOUNDED, dataDeleteFlag = true) -@ModelWidget(type = ModelType.WIDGET, name = "l-interface") -public class LIntfWidget extends ResourceWidget { - -} diff --git a/common/onap-sdc-artifact-generator-lib/onap-sdc-artifact-generator-api/src/main/java/org/onap/sdc/generator/aai/model/Model.java b/common/onap-sdc-artifact-generator-lib/onap-sdc-artifact-generator-api/src/main/java/org/onap/sdc/generator/aai/model/Model.java deleted file mode 100644 index 83ded46bd1..0000000000 --- a/common/onap-sdc-artifact-generator-lib/onap-sdc-artifact-generator-api/src/main/java/org/onap/sdc/generator/aai/model/Model.java +++ /dev/null @@ -1,255 +0,0 @@ -/*- - * ============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.onap.sdc.generator.aai.model; - -import org.onap.sdc.generator.aai.types.Cardinality; -import org.onap.sdc.generator.aai.types.ModelType; -import org.onap.sdc.generator.data.GeneratorConstants; -import org.onap.sdc.generator.error.IllegalAccessException; - -import java.util.HashSet; -import java.util.Map; -import java.util.Set; - -public abstract class Model { - - protected Set<Resource> resources = new HashSet<>(); - protected Set<Widget> widgets = new HashSet<>(); - private String modelId; - private String modelName; - private String modelVersion; - private String modelNameVersionId; - private String modelDescription; - - /** - * Gets model for. - * - * @param toscaType the tosca type - * @return the model for - */ - public static Model getModelFor(String toscaType) { - - Model modelToBeReturned = null; - while (isModelNotSet(toscaType, modelToBeReturned)) { - - switch (toscaType) { - - case "org.openecomp.resource.vf.allottedResource": - modelToBeReturned = new AllotedResource(); - break; - case "org.openecomp.resource.vfc.AllottedResource": - modelToBeReturned = new ProvidingService(); - break; - case "org.openecomp.resource.vfc": - modelToBeReturned = new VServerWidget(); - break; - case "org.openecomp.resource.cp": - case "org.openecomp.cp": - modelToBeReturned = new LIntfWidget(); - break; - case "org.openecomp.resource.vl": - modelToBeReturned = new L3Network(); - break; - case "org.openecomp.resource.vf": - modelToBeReturned = new VirtualFunction(); - break; - case "org.openecomp.groups.vfmodule": - case "org.openecomp.groups.VfModule": - modelToBeReturned = new VfModule(); - break; - case "org.openecomp.resource.vfc.nodes.heat.cinder": - modelToBeReturned = new VolumeWidget(); - break; - default: - modelToBeReturned = null; - break; - } - - toscaType = toscaType.substring(0, toscaType.lastIndexOf(".")); - } - - return modelToBeReturned; - } - - - public abstract boolean addResource(Resource resource); - - public abstract boolean addWidget(Widget resource); - - /** - * Gets widget version id. - * - * @return the widget version id - */ - public String getWidgetId() { - org.onap.sdc.generator.aai.types.Model model = - this.getClass().getAnnotation(org.onap.sdc.generator.aai.types.Model.class); - return Widget.getWidget(model.widget()).getId(); - } - - /** - * Gets invariant id. - * - * @return the invariant id - */ - public String getWidgetInvariantId() { - org.onap.sdc.generator.aai.types.Model model = - this.getClass().getAnnotation(org.onap.sdc.generator.aai.types.Model.class); - return Widget.getWidget(model.widget()).getWidgetId(); - } - - /** - * Gets delete flag. - * - * @return the delete flag - */ - public boolean getDeleteFlag() { - org.onap.sdc.generator.aai.types.Model model = - this.getClass().getAnnotation(org.onap.sdc.generator.aai.types.Model.class); - return model.dataDeleteFlag(); - } - - /** - * Gets cardinality. - * - * @return the cardinality - */ - public Cardinality getCardinality() { - org.onap.sdc.generator.aai.types.Model model = - this.getClass().getAnnotation(org.onap.sdc.generator.aai.types.Model.class); - return model.cardinality(); - } - - public abstract Widget.Type getWidgetType(); - - public String getModelId() { - checkSupported(); - return modelId; - } - - /** - * Gets model type. - * - * @return the model type - */ - public ModelType getModelType() { - if (this instanceof Service) { - return ModelType.SERVICE; - } else if (this instanceof Resource) { - return ModelType.RESOURCE; - } else if (this instanceof Widget) { - return ModelType.WIDGET; - } else { - return null; - } - } - - public String getModelName() { - return modelName; - } - - public String getModelVersion() { - return modelVersion; - } - - public String getModelNameVersionId() { - checkSupported(); - return modelNameVersionId; - } - - public String getModelDescription() { - return modelDescription; - } - - /** - * Populate model identification information. - * - * @param modelIdentInfo the model ident info - */ - public void populateModelIdentificationInformation(Map<String, String> modelIdentInfo) { - for (Map.Entry<String,String> entry : modelIdentInfo.entrySet()) { - String property=entry.getKey(); - switch (property) { - - case "vfModuleModelInvariantUUID": - case "serviceInvariantUUID": - case "resourceInvariantUUID": - case "invariantUUID": - case "providing_service_invariant_uuid": - modelId = entry.getValue(); - break; - case "vfModuleModelUUID": - case "resourceUUID": - case "serviceUUID": - case "UUID": - case "providing_service_uuid": - modelNameVersionId = entry.getValue(); - break; - case "vfModuleModelVersion": - case "serviceVersion": - case "resourceversion": - case "version": - modelVersion = entry.getValue(); - break; - case "vfModuleModelName": - case "serviceName": - case "resourceName": - case "name": - modelName = entry.getValue(); - break; - case "serviceDescription": - case "resourceDescription": - case "vf_module_description": - case "description": - modelDescription = entry.getValue(); - break; - case "providing_service_name": - modelName = entry.getValue(); - modelDescription = entry.getValue(); - break; - default: - break; - } - } - - - - } - - public Set<Resource> getResources() { - return resources; - } - - public Set<Widget> getWidgets() { - return widgets; - } - - private void checkSupported() { - if (this instanceof Widget) { - throw new IllegalAccessException(GeneratorConstants - .GENERATOR_AAI_ERROR_UNSUPPORTED_WIDGET_OPERATION); - } - } - - private static boolean isModelNotSet(String toscaType, Model modelToBeReturned) { - return toscaType != null && toscaType.lastIndexOf(".") != -1 && modelToBeReturned == null; - } -} diff --git a/common/onap-sdc-artifact-generator-lib/onap-sdc-artifact-generator-api/src/main/java/org/onap/sdc/generator/aai/model/OamNetwork.java b/common/onap-sdc-artifact-generator-lib/onap-sdc-artifact-generator-api/src/main/java/org/onap/sdc/generator/aai/model/OamNetwork.java deleted file mode 100644 index 72686b5bc2..0000000000 --- a/common/onap-sdc-artifact-generator-lib/onap-sdc-artifact-generator-api/src/main/java/org/onap/sdc/generator/aai/model/OamNetwork.java +++ /dev/null @@ -1,32 +0,0 @@ -/*- - * ============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.onap.sdc.generator.aai.model; - -import org.onap.sdc.generator.aai.types.Cardinality; -import org.onap.sdc.generator.aai.types.Model; -import org.onap.sdc.generator.aai.types.ModelType; -import org.onap.sdc.generator.aai.types.ModelWidget; - -@Model(widget = Widget.Type.L3_NET, cardinality = Cardinality.UNBOUNDED, dataDeleteFlag = true) -@ModelWidget(type = ModelType.WIDGET, name = "oam-network") -public class OamNetwork extends Widget { -} - diff --git a/common/onap-sdc-artifact-generator-lib/onap-sdc-artifact-generator-api/src/main/java/org/onap/sdc/generator/aai/model/ProvidingService.java b/common/onap-sdc-artifact-generator-lib/onap-sdc-artifact-generator-api/src/main/java/org/onap/sdc/generator/aai/model/ProvidingService.java deleted file mode 100644 index 3f44fe9b54..0000000000 --- a/common/onap-sdc-artifact-generator-lib/onap-sdc-artifact-generator-api/src/main/java/org/onap/sdc/generator/aai/model/ProvidingService.java +++ /dev/null @@ -1,30 +0,0 @@ -/*- - * ============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.onap.sdc.generator.aai.model; - -import org.onap.sdc.generator.aai.types.Cardinality; -import org.onap.sdc.generator.aai.types.Model; - -@Model(widget = Widget.Type.ALLOTTED_RESOURCE, cardinality = Cardinality - .UNBOUNDED, - dataDeleteFlag = false) -public class ProvidingService extends Resource { -} diff --git a/common/onap-sdc-artifact-generator-lib/onap-sdc-artifact-generator-api/src/main/java/org/onap/sdc/generator/aai/model/Resource.java b/common/onap-sdc-artifact-generator-lib/onap-sdc-artifact-generator-api/src/main/java/org/onap/sdc/generator/aai/model/Resource.java deleted file mode 100644 index 6c7cbc7548..0000000000 --- a/common/onap-sdc-artifact-generator-lib/onap-sdc-artifact-generator-api/src/main/java/org/onap/sdc/generator/aai/model/Resource.java +++ /dev/null @@ -1,52 +0,0 @@ -/*- - * ============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.onap.sdc.generator.aai.model; - -public class Resource extends Model { - - @Override - public int hashCode() { - return getModelNameVersionId().hashCode(); - } - - @Override - public boolean equals(Object obj) { - if (obj instanceof Resource) { - return getModelNameVersionId().equals(((Resource) obj).getModelNameVersionId()); - } - return false; - } - - public boolean addResource(Resource resource) { - return resources.add(resource); - } - - public boolean addWidget(Widget widget) { - return widgets.add(widget); - } - - @Override - public Widget.Type getWidgetType() { - org.onap.sdc.generator.aai.types.Model model = - this.getClass().getAnnotation(org.onap.sdc.generator.aai.types.Model.class); - return model.widget(); - } -} diff --git a/common/onap-sdc-artifact-generator-lib/onap-sdc-artifact-generator-api/src/main/java/org/onap/sdc/generator/aai/model/ResourceWidget.java b/common/onap-sdc-artifact-generator-lib/onap-sdc-artifact-generator-api/src/main/java/org/onap/sdc/generator/aai/model/ResourceWidget.java deleted file mode 100644 index 24975a2a9f..0000000000 --- a/common/onap-sdc-artifact-generator-lib/onap-sdc-artifact-generator-api/src/main/java/org/onap/sdc/generator/aai/model/ResourceWidget.java +++ /dev/null @@ -1,26 +0,0 @@ -/*- - * ============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.onap.sdc.generator.aai.model; - -public class ResourceWidget extends Widget { - -} - diff --git a/common/onap-sdc-artifact-generator-lib/onap-sdc-artifact-generator-api/src/main/java/org/onap/sdc/generator/aai/model/Service.java b/common/onap-sdc-artifact-generator-lib/onap-sdc-artifact-generator-api/src/main/java/org/onap/sdc/generator/aai/model/Service.java deleted file mode 100644 index f71ff91f3e..0000000000 --- a/common/onap-sdc-artifact-generator-lib/onap-sdc-artifact-generator-api/src/main/java/org/onap/sdc/generator/aai/model/Service.java +++ /dev/null @@ -1,43 +0,0 @@ -/*- - * ============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.onap.sdc.generator.aai.model; - -import org.onap.sdc.generator.aai.types.Cardinality; - -@org.onap.sdc.generator.aai.types.Model(widget = Widget.Type.SERVICE, - cardinality = Cardinality.UNBOUNDED, dataDeleteFlag = true) -public class Service extends Model { - - public boolean addResource(Resource resource) { - return resources.add(resource); - } - - public boolean addWidget(Widget widget) { - return widgets.add(widget); - } - - @Override - public Widget.Type getWidgetType() { - return null; - } - -} - diff --git a/common/onap-sdc-artifact-generator-lib/onap-sdc-artifact-generator-api/src/main/java/org/onap/sdc/generator/aai/model/ServiceWidget.java b/common/onap-sdc-artifact-generator-lib/onap-sdc-artifact-generator-api/src/main/java/org/onap/sdc/generator/aai/model/ServiceWidget.java deleted file mode 100644 index f6eb5fab53..0000000000 --- a/common/onap-sdc-artifact-generator-lib/onap-sdc-artifact-generator-api/src/main/java/org/onap/sdc/generator/aai/model/ServiceWidget.java +++ /dev/null @@ -1,30 +0,0 @@ -/*- - * ============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.onap.sdc.generator.aai.model; - -import org.onap.sdc.generator.aai.types.ModelType; -import org.onap.sdc.generator.aai.types.ModelWidget; - -@ModelWidget(type = ModelType.WIDGET, name = "service-instance") -public class ServiceWidget extends Widget { - -} - diff --git a/common/onap-sdc-artifact-generator-lib/onap-sdc-artifact-generator-api/src/main/java/org/onap/sdc/generator/aai/model/TenantWidget.java b/common/onap-sdc-artifact-generator-lib/onap-sdc-artifact-generator-api/src/main/java/org/onap/sdc/generator/aai/model/TenantWidget.java deleted file mode 100644 index 93ca9c5178..0000000000 --- a/common/onap-sdc-artifact-generator-lib/onap-sdc-artifact-generator-api/src/main/java/org/onap/sdc/generator/aai/model/TenantWidget.java +++ /dev/null @@ -1,33 +0,0 @@ -/*- - * ============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.onap.sdc.generator.aai.model; - -import org.onap.sdc.generator.aai.types.Cardinality; -import org.onap.sdc.generator.aai.types.Model; -import org.onap.sdc.generator.aai.types.ModelType; -import org.onap.sdc.generator.aai.types.ModelWidget; - -@Model(widget = Widget.Type.TENANT, cardinality = Cardinality.UNBOUNDED, dataDeleteFlag = false) -@ModelWidget(type = ModelType.WIDGET, name = "tenant") -public class TenantWidget extends Widget { - -} - diff --git a/common/onap-sdc-artifact-generator-lib/onap-sdc-artifact-generator-api/src/main/java/org/onap/sdc/generator/aai/model/TunnelXconnectWidget.java b/common/onap-sdc-artifact-generator-lib/onap-sdc-artifact-generator-api/src/main/java/org/onap/sdc/generator/aai/model/TunnelXconnectWidget.java deleted file mode 100644 index 1a8a9fea27..0000000000 --- a/common/onap-sdc-artifact-generator-lib/onap-sdc-artifact-generator-api/src/main/java/org/onap/sdc/generator/aai/model/TunnelXconnectWidget.java +++ /dev/null @@ -1,32 +0,0 @@ -/*- - * ============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.onap.sdc.generator.aai.model; - -import org.onap.sdc.generator.aai.types.Cardinality; -import org.onap.sdc.generator.aai.types.Model; -import org.onap.sdc.generator.aai.types.ModelType; -import org.onap.sdc.generator.aai.types.ModelWidget; - -@Model(widget = Widget.Type.TUNNEL_XCONNECT, - cardinality = Cardinality.UNBOUNDED, dataDeleteFlag = true) -@ModelWidget(type = ModelType.WIDGET, name = "tunnel-xconnect") -public class TunnelXconnectWidget extends Widget { -} diff --git a/common/onap-sdc-artifact-generator-lib/onap-sdc-artifact-generator-api/src/main/java/org/onap/sdc/generator/aai/model/VServerWidget.java b/common/onap-sdc-artifact-generator-lib/onap-sdc-artifact-generator-api/src/main/java/org/onap/sdc/generator/aai/model/VServerWidget.java deleted file mode 100644 index c633f5b338..0000000000 --- a/common/onap-sdc-artifact-generator-lib/onap-sdc-artifact-generator-api/src/main/java/org/onap/sdc/generator/aai/model/VServerWidget.java +++ /dev/null @@ -1,46 +0,0 @@ -/*- - * ============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.onap.sdc.generator.aai.model; - -import org.onap.sdc.generator.aai.types.Cardinality; -import org.onap.sdc.generator.aai.types.Model; -import org.onap.sdc.generator.aai.types.ModelType; -import org.onap.sdc.generator.aai.types.ModelWidget; - -@Model(widget = Widget.Type.VSERVER, cardinality = Cardinality.UNBOUNDED, dataDeleteFlag = true) -@ModelWidget(type = ModelType.WIDGET, name = "vserver") -public class VServerWidget extends Widget { - - /** - * Instantiates a new V server widget. - */ - public VServerWidget() { - addWidget(new FlavorWidget()); - addWidget(new ImageWidget()); - addWidget(new TenantWidget()); - addWidget(new VfcWidget()); - } - - public boolean addWidget(Widget widget) { - return widgets.add(widget); - } - -} diff --git a/common/onap-sdc-artifact-generator-lib/onap-sdc-artifact-generator-api/src/main/java/org/onap/sdc/generator/aai/model/VfModule.java b/common/onap-sdc-artifact-generator-lib/onap-sdc-artifact-generator-api/src/main/java/org/onap/sdc/generator/aai/model/VfModule.java deleted file mode 100644 index 1b715630e4..0000000000 --- a/common/onap-sdc-artifact-generator-lib/onap-sdc-artifact-generator-api/src/main/java/org/onap/sdc/generator/aai/model/VfModule.java +++ /dev/null @@ -1,81 +0,0 @@ -/*- - * ============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.onap.sdc.generator.aai.model; - -import org.onap.sdc.generator.aai.types.Cardinality; -import org.onap.sdc.generator.aai.types.Model; - -import java.util.List; - -@Model(widget = Widget.Type.VFMODULE, cardinality = Cardinality.UNBOUNDED, dataDeleteFlag = true) -public class VfModule extends Resource { - - Widget vserver = null; - boolean addlintf = false; - boolean addvolume = false; - - List<String> members; - - public void setMembers(List<String> members) { - this.members = members; - } - - /** - * Adds Widget. - * - * @param widget the widget - * @return the boolean - */ - public boolean addWidget(Widget widget) { - if (widget.memberOf(members)) { - if (vserver == null && widget.getId().equals(new VServerWidget().getId())) { - vserver = widget; - if (addlintf) { - vserver.addWidget(new LIntfWidget()); - } - if (addvolume) { - vserver.addWidget(new VolumeWidget()); - } - } else if (widget.getId().equals(new LIntfWidget().getId())) { - if (vserver != null) { - vserver.addWidget(widget); - return true; - } else { - addlintf = true; - } - return false; - } else if (widget.getId().equals(new VolumeWidget().getId())) { - if (vserver != null) { - vserver.addWidget(widget); - } else { - addvolume = true; - } - return true; - } - if (widget.getId().equals(new OamNetwork().getId())) { - return false; - } - return widgets.add(widget); - } - return false; - } - -} diff --git a/common/onap-sdc-artifact-generator-lib/onap-sdc-artifact-generator-api/src/main/java/org/onap/sdc/generator/aai/model/VfModuleWidget.java b/common/onap-sdc-artifact-generator-lib/onap-sdc-artifact-generator-api/src/main/java/org/onap/sdc/generator/aai/model/VfModuleWidget.java deleted file mode 100644 index b191538e50..0000000000 --- a/common/onap-sdc-artifact-generator-lib/onap-sdc-artifact-generator-api/src/main/java/org/onap/sdc/generator/aai/model/VfModuleWidget.java +++ /dev/null @@ -1,34 +0,0 @@ -/*- - * ============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.onap.sdc.generator.aai.model; - -import org.onap.sdc.generator.aai.types.Cardinality; -import org.onap.sdc.generator.aai.types.Model; -import org.onap.sdc.generator.aai.types.ModelType; -import org.onap.sdc.generator.aai.types.ModelWidget; - -@Model(widget = Widget.Type.VFMODULE, - cardinality = Cardinality.UNBOUNDED, dataDeleteFlag = true) -@ModelWidget(type = ModelType.WIDGET, name = "vf-module") -public class VfModuleWidget extends Widget { - -} - diff --git a/common/onap-sdc-artifact-generator-lib/onap-sdc-artifact-generator-api/src/main/java/org/onap/sdc/generator/aai/model/VfWidget.java b/common/onap-sdc-artifact-generator-lib/onap-sdc-artifact-generator-api/src/main/java/org/onap/sdc/generator/aai/model/VfWidget.java deleted file mode 100644 index 20ea9973aa..0000000000 --- a/common/onap-sdc-artifact-generator-lib/onap-sdc-artifact-generator-api/src/main/java/org/onap/sdc/generator/aai/model/VfWidget.java +++ /dev/null @@ -1,34 +0,0 @@ -/*- - * ============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.onap.sdc.generator.aai.model; - -import org.onap.sdc.generator.aai.types.Cardinality; -import org.onap.sdc.generator.aai.types.Model; -import org.onap.sdc.generator.aai.types.ModelType; -import org.onap.sdc.generator.aai.types.ModelWidget; - -@Model(widget = Widget.Type.VF, - cardinality = Cardinality.UNBOUNDED, dataDeleteFlag = true) -@ModelWidget(type = ModelType.WIDGET, name = "generic-vnf") -public class VfWidget extends ResourceWidget { - -} - diff --git a/common/onap-sdc-artifact-generator-lib/onap-sdc-artifact-generator-api/src/main/java/org/onap/sdc/generator/aai/model/VfcWidget.java b/common/onap-sdc-artifact-generator-lib/onap-sdc-artifact-generator-api/src/main/java/org/onap/sdc/generator/aai/model/VfcWidget.java deleted file mode 100644 index 2d08ef8b7d..0000000000 --- a/common/onap-sdc-artifact-generator-lib/onap-sdc-artifact-generator-api/src/main/java/org/onap/sdc/generator/aai/model/VfcWidget.java +++ /dev/null @@ -1,34 +0,0 @@ -/*- - * ============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.onap.sdc.generator.aai.model; - -import org.onap.sdc.generator.aai.types.Cardinality; -import org.onap.sdc.generator.aai.types.Model; -import org.onap.sdc.generator.aai.types.ModelType; -import org.onap.sdc.generator.aai.types.ModelWidget; - -@Model(widget = Widget.Type.VFC, - cardinality = Cardinality.UNBOUNDED, dataDeleteFlag = true) -@ModelWidget(type = ModelType.WIDGET, name = "vnfc") -public class VfcWidget extends ResourceWidget { - -} - diff --git a/common/onap-sdc-artifact-generator-lib/onap-sdc-artifact-generator-api/src/main/java/org/onap/sdc/generator/aai/model/VirtualFunction.java b/common/onap-sdc-artifact-generator-lib/onap-sdc-artifact-generator-api/src/main/java/org/onap/sdc/generator/aai/model/VirtualFunction.java deleted file mode 100644 index 3736ebacc3..0000000000 --- a/common/onap-sdc-artifact-generator-lib/onap-sdc-artifact-generator-api/src/main/java/org/onap/sdc/generator/aai/model/VirtualFunction.java +++ /dev/null @@ -1,30 +0,0 @@ -/*- - * ============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.onap.sdc.generator.aai.model; - -import org.onap.sdc.generator.aai.types.Cardinality; -import org.onap.sdc.generator.aai.types.Model; - -@Model(widget = Widget.Type.VF, cardinality = Cardinality.UNBOUNDED, dataDeleteFlag = true) -public class VirtualFunction extends Resource { - -} - diff --git a/common/onap-sdc-artifact-generator-lib/onap-sdc-artifact-generator-api/src/main/java/org/onap/sdc/generator/aai/model/VolumeGroupWidget.java b/common/onap-sdc-artifact-generator-lib/onap-sdc-artifact-generator-api/src/main/java/org/onap/sdc/generator/aai/model/VolumeGroupWidget.java deleted file mode 100644 index 918cfa897c..0000000000 --- a/common/onap-sdc-artifact-generator-lib/onap-sdc-artifact-generator-api/src/main/java/org/onap/sdc/generator/aai/model/VolumeGroupWidget.java +++ /dev/null @@ -1,34 +0,0 @@ -/*- - * ============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.onap.sdc.generator.aai.model; - -import org.onap.sdc.generator.aai.types.Cardinality; -import org.onap.sdc.generator.aai.types.Model; -import org.onap.sdc.generator.aai.types.ModelType; -import org.onap.sdc.generator.aai.types.ModelWidget; - -@Model(widget = Widget.Type.VOLUME_GROUP, - cardinality = Cardinality.UNBOUNDED, dataDeleteFlag = true) -@ModelWidget(type = ModelType.WIDGET, name = "volume-group") -public class VolumeGroupWidget extends Widget { - -} - diff --git a/common/onap-sdc-artifact-generator-lib/onap-sdc-artifact-generator-api/src/main/java/org/onap/sdc/generator/aai/model/VolumeWidget.java b/common/onap-sdc-artifact-generator-lib/onap-sdc-artifact-generator-api/src/main/java/org/onap/sdc/generator/aai/model/VolumeWidget.java deleted file mode 100644 index e0cdac437a..0000000000 --- a/common/onap-sdc-artifact-generator-lib/onap-sdc-artifact-generator-api/src/main/java/org/onap/sdc/generator/aai/model/VolumeWidget.java +++ /dev/null @@ -1,33 +0,0 @@ -/*- - * ============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.onap.sdc.generator.aai.model; - -import org.onap.sdc.generator.aai.types.Cardinality; -import org.onap.sdc.generator.aai.types.Model; -import org.onap.sdc.generator.aai.types.ModelType; -import org.onap.sdc.generator.aai.types.ModelWidget; - -@Model(widget = Widget.Type.VOLUME, cardinality = Cardinality.UNBOUNDED, dataDeleteFlag = true) -@ModelWidget(type = ModelType.WIDGET, name = "volume") -public class VolumeWidget extends ResourceWidget { - -} - diff --git a/common/onap-sdc-artifact-generator-lib/onap-sdc-artifact-generator-api/src/main/java/org/onap/sdc/generator/aai/model/Widget.java b/common/onap-sdc-artifact-generator-lib/onap-sdc-artifact-generator-api/src/main/java/org/onap/sdc/generator/aai/model/Widget.java deleted file mode 100644 index dfb17cc660..0000000000 --- a/common/onap-sdc-artifact-generator-lib/onap-sdc-artifact-generator-api/src/main/java/org/onap/sdc/generator/aai/model/Widget.java +++ /dev/null @@ -1,196 +0,0 @@ -/*- - * ============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.onap.sdc.generator.aai.model; - -import java.util.Collections; -import java.util.HashSet; -import java.util.List; -import java.util.Properties; -import java.util.Set; - -import org.onap.sdc.generator.aai.types.ModelType; -import org.onap.sdc.generator.aai.types.ModelWidget; -import org.onap.sdc.generator.data.ArtifactType; -import org.onap.sdc.generator.data.GeneratorConstants; -import org.onap.sdc.generator.data.WidgetConfigurationUtil; -import org.onap.sdc.generator.error.IllegalAccessException; - -public abstract class Widget extends Model { - - private Set<String> keys = new HashSet<>(); - - /** - * Gets widget. - * - * @param type the type - * @return the widget - */ - public static Widget getWidget(Type type) { - - switch (type) { - case SERVICE: - return new ServiceWidget(); - case VF: - return new VfWidget(); - case VFC: - return new VfcWidget(); - case VSERVER: - return new VServerWidget(); - case VOLUME: - return new VolumeWidget(); - case FLAVOR: - return new FlavorWidget(); - case TENANT: - return new TenantWidget(); - case VOLUME_GROUP: - return new VolumeGroupWidget(); - case LINT: - return new LIntfWidget(); - case L3_NET: - return new L3NetworkWidget(); - case VFMODULE: - return new VfModuleWidget(); - case IMAGE: - return new ImageWidget(); - case OAM_NETWORK: - return new OamNetwork(); - case ALLOTTED_RESOURCE: - return new AllotedResourceWidget(); - case TUNNEL_XCONNECT: - return new TunnelXconnectWidget(); - default: - return null; - } - - } - - /** - * Gets id. - * - * @return the id - */ - public String getId() { - Properties properties = WidgetConfigurationUtil.getConfig(); - String id = properties.getProperty(ArtifactType.AAI.name() + ".model-version-id." + getName()); - if (id == null) { - throw new IllegalArgumentException(String.format( - GeneratorConstants.GENERATOR_AAI_CONFIGLPROP_NOT_FOUND, - ArtifactType.AAI.name() + ".model-version-id." + getName())); - } - return id; - } - - public ModelType getType() { - ModelWidget widgetModel = this.getClass().getAnnotation(ModelWidget.class); - return widgetModel.type(); - } - - public String getName() { - ModelWidget widgetModel = this.getClass().getAnnotation(ModelWidget.class); - return widgetModel.name(); - } - - /** - * Get Widget Id from properties file. - * @return - Widget Id - */ - public String getWidgetId() { - Properties properties = WidgetConfigurationUtil.getConfig(); - String id = properties.getProperty(ArtifactType.AAI.name() + ".model-invariant-id." - + getName()); - if (id == null) { - throw new IllegalArgumentException(String.format( - GeneratorConstants.GENERATOR_AAI_CONFIGLPROP_NOT_FOUND, - ArtifactType.AAI.name() + ".model-invariant-id." + getName())); - } - return id; - } - - public int hashCode() { - return getId().hashCode(); - } - - @Override - public Type getWidgetType() { - return null; - } - - /** - * Equals. - * - * @param obj Object - * @return the boolean - */ - public boolean equals(Object obj) { - if (obj instanceof Widget) { - if (getId().equals(((Widget) obj).getId())) { - ((Widget) obj).keys.addAll(this.keys); - return true; - } - return false; - } else { - return false; - } - } - - public void addKey(String key) { - this.keys.add(key); - } - - /** - * Member of boolean. - * - * @param keys the keys - * @return the boolean - */ - public boolean memberOf(List<String> keys) { - if (keys == null) { - return false; - } - return !Collections.disjoint(this.keys, keys); - } - - /** - * All instances used boolean. - * - * @param collection the collection - * @return the boolean - */ - public boolean allInstancesUsed(Set<String> collection) { - Set<String> keyCopy = new HashSet<>(keys); - keyCopy.removeAll(collection); - return keyCopy.isEmpty(); - } - - public boolean addResource(Resource resource) { - throw new IllegalAccessException(GeneratorConstants - .GENERATOR_AAI_ERROR_UNSUPPORTED_WIDGET_OPERATION); - } - - public boolean addWidget(Widget widget) { - return true; - } - - public enum Type { - SERVICE, VF, VFC, VSERVER, VOLUME, FLAVOR, TENANT, VOLUME_GROUP, LINT, L3_NET, VFMODULE, IMAGE, - OAM_NETWORK,ALLOTTED_RESOURCE,TUNNEL_XCONNECT - } -} diff --git a/common/onap-sdc-artifact-generator-lib/onap-sdc-artifact-generator-api/src/main/java/org/onap/sdc/generator/aai/tosca/CapabilityAssignment.java b/common/onap-sdc-artifact-generator-lib/onap-sdc-artifact-generator-api/src/main/java/org/onap/sdc/generator/aai/tosca/CapabilityAssignment.java deleted file mode 100644 index 99f9771654..0000000000 --- a/common/onap-sdc-artifact-generator-lib/onap-sdc-artifact-generator-api/src/main/java/org/onap/sdc/generator/aai/tosca/CapabilityAssignment.java +++ /dev/null @@ -1,45 +0,0 @@ -/*- - * ============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.onap.sdc.generator.aai.tosca; - -import java.util.Map; - -public class CapabilityAssignment { - - private Map<String, Object> properties; - private Map<String, Object> attributes; - - public Map<String, Object> getProperties() { - return properties; - } - - public void setProperties(Map<String, Object> properties) { - this.properties = properties; - } - - public Map<String, Object> getAttributes() { - return attributes; - } - - public void setAttributes(Map<String, Object> attributes) { - this.attributes = attributes; - } -} diff --git a/common/onap-sdc-artifact-generator-lib/onap-sdc-artifact-generator-api/src/main/java/org/onap/sdc/generator/aai/tosca/GroupDefinition.java b/common/onap-sdc-artifact-generator-lib/onap-sdc-artifact-generator-api/src/main/java/org/onap/sdc/generator/aai/tosca/GroupDefinition.java deleted file mode 100644 index 8892eebd7e..0000000000 --- a/common/onap-sdc-artifact-generator-lib/onap-sdc-artifact-generator-api/src/main/java/org/onap/sdc/generator/aai/tosca/GroupDefinition.java +++ /dev/null @@ -1,73 +0,0 @@ -/*- - * ============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.onap.sdc.generator.aai.tosca; - -import java.util.List; -import java.util.Map; - -public class GroupDefinition { - - private String type; - private String description; - private Map<String, Object> properties; - private List<String> members; - private Map<String, String> metadata; - - public String getType() { - return type; - } - - public void setType(String type) { - this.type = type; - } - - public String getDescription() { - return description; - } - - public void setDescription(String description) { - this.description = description; - } - - public Map<String, Object> getProperties() { - return properties; - } - - public void setProperties(Map<String, Object> properties) { - this.properties = properties; - } - - public List<String> getMembers() { - return members; - } - - public void setMembers(List<String> members) { - this.members = members; - } - - public Map<String, String> getMetadata() { - return metadata; - } - - public void setMetadata(Map<String, String> metadata) { - this.metadata = metadata; - } -} diff --git a/common/onap-sdc-artifact-generator-lib/onap-sdc-artifact-generator-api/src/main/java/org/onap/sdc/generator/aai/tosca/NodeTemplate.java b/common/onap-sdc-artifact-generator-lib/onap-sdc-artifact-generator-api/src/main/java/org/onap/sdc/generator/aai/tosca/NodeTemplate.java deleted file mode 100644 index d58d9e005d..0000000000 --- a/common/onap-sdc-artifact-generator-lib/onap-sdc-artifact-generator-api/src/main/java/org/onap/sdc/generator/aai/tosca/NodeTemplate.java +++ /dev/null @@ -1,82 +0,0 @@ -/*- - * ============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.onap.sdc.generator.aai.tosca; - -import java.util.List; -import java.util.Map; - -public class NodeTemplate { - - private String type; - private String description; - private Map<String, String> metadata; - private Map<String, Object> properties; - private List<Map<String, RequirementAssignment>> requirements; - private Map<String, CapabilityAssignment> capabilities; - - public String getType() { - return type; - } - - public void setType(String type) { - this.type = type; - } - - public String getDescription() { - return description; - } - - public void setDescription(String description) { - this.description = description; - } - - public Map<String, Object> getProperties() { - return properties; - } - - public void setProperties(Map<String, Object> properties) { - this.properties = properties; - } - - public List<Map<String, RequirementAssignment>> getRequirements() { - return requirements; - } - - public void setRequirements(List<Map<String, RequirementAssignment>> requirements) { - this.requirements = requirements; - } - - public Map<String, CapabilityAssignment> getCapabilities() { - return capabilities; - } - - public void setCapabilities(Map<String, CapabilityAssignment> capabilities) { - this.capabilities = capabilities; - } - - public Map<String, String> getMetadata() { - return metadata; - } - - public void setMetadata(Map<String, String> metadata) { - this.metadata = metadata; - } -} diff --git a/common/onap-sdc-artifact-generator-lib/onap-sdc-artifact-generator-api/src/main/java/org/onap/sdc/generator/aai/tosca/RequirementAssignment.java b/common/onap-sdc-artifact-generator-lib/onap-sdc-artifact-generator-api/src/main/java/org/onap/sdc/generator/aai/tosca/RequirementAssignment.java deleted file mode 100644 index 20d36a4ea0..0000000000 --- a/common/onap-sdc-artifact-generator-lib/onap-sdc-artifact-generator-api/src/main/java/org/onap/sdc/generator/aai/tosca/RequirementAssignment.java +++ /dev/null @@ -1,53 +0,0 @@ -/*- - * ============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.onap.sdc.generator.aai.tosca; - -public class RequirementAssignment { - - private String capability; - private String node; - private String relationship; - - public String getCapability() { - return capability; - } - - public void setCapability(String capability) { - this.capability = capability; - } - - public String getNode() { - return node; - } - - public void setNode(String node) { - this.node = node; - } - - public String getRelationship() { - return relationship; - } - - public void setRelationship(String relationship) { - this.relationship = relationship; - } - -} diff --git a/common/onap-sdc-artifact-generator-lib/onap-sdc-artifact-generator-api/src/main/java/org/onap/sdc/generator/aai/tosca/TopologyTemplate.java b/common/onap-sdc-artifact-generator-lib/onap-sdc-artifact-generator-api/src/main/java/org/onap/sdc/generator/aai/tosca/TopologyTemplate.java deleted file mode 100644 index 124c55cc77..0000000000 --- a/common/onap-sdc-artifact-generator-lib/onap-sdc-artifact-generator-api/src/main/java/org/onap/sdc/generator/aai/tosca/TopologyTemplate.java +++ /dev/null @@ -1,71 +0,0 @@ -/*- - * ============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.onap.sdc.generator.aai.tosca; - -import java.util.HashMap; -import java.util.Map; -import java.util.Objects; - -public class TopologyTemplate { - - private String description; - private Map<String, NodeTemplate> node_templates; - private Map<String, GroupDefinition> groups; - - - public String getDescription() { - return description; - } - - public void setDescription(String description) { - this.description = description; - } - - public Map<String, GroupDefinition> getGroups() { - return groups; - } - - public void setGroups(Map<String, GroupDefinition> groups) { - this.groups = groups; - } - - public Map<String, NodeTemplate> getNode_templates() { - return node_templates; - } - - public void setNode_templates(Map<String, NodeTemplate> node_templates) { - this.node_templates = node_templates; - } - - /** - * Add group. - * - * @param groupKey the group key - * @param groupDefinition the group definition - */ - public void addGroup(String groupKey, GroupDefinition groupDefinition) { - if (Objects.isNull(this.groups)) { - this.groups = new HashMap<>(); - } - this.groups.put(groupKey, groupDefinition); - } - -} diff --git a/common/onap-sdc-artifact-generator-lib/onap-sdc-artifact-generator-api/src/main/java/org/onap/sdc/generator/aai/tosca/ToscaTemplate.java b/common/onap-sdc-artifact-generator-lib/onap-sdc-artifact-generator-api/src/main/java/org/onap/sdc/generator/aai/tosca/ToscaTemplate.java deleted file mode 100644 index d92b826071..0000000000 --- a/common/onap-sdc-artifact-generator-lib/onap-sdc-artifact-generator-api/src/main/java/org/onap/sdc/generator/aai/tosca/ToscaTemplate.java +++ /dev/null @@ -1,82 +0,0 @@ -/*- - * ============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.onap.sdc.generator.aai.tosca; - -import java.util.Map; - -public class ToscaTemplate { - private String toscaDefinitionsVersion; - private Map<String, String> metadata; - private String description; - private TopologyTemplate topology_template; - - public String getToscaDefinitionsVersion() { - return toscaDefinitionsVersion; - } - - public void setToscaDefinitionsVersion(String toscaDefinitionsVersion) { - this.toscaDefinitionsVersion = toscaDefinitionsVersion; - } - - public Map<String, String> getMetadata() { - return metadata; - } - - public void setMetadata(Map<String, String> metadata) { - this.metadata = metadata; - } - - public String getDescription() { - return description; - } - - public void setDescription(String description) { - this.description = description; - } - - public TopologyTemplate getTopology_template() { - return topology_template; - } - - public void setTopology_template(TopologyTemplate topology_template) { - this.topology_template = topology_template; - } - - /** - * Is Service. - * - * @return the boolean - */ - public boolean isService() { - return metadata.containsKey("serviceUUID") - || ("Service".equalsIgnoreCase(metadata.get("Type")) - || ("Service".equalsIgnoreCase(metadata.get("type")))); - } - - public String getModelId() { - return metadata.get("invariantUUID"); - } - - public String getModelVersionId() { - return metadata.get("UUID"); - } - -} diff --git a/common/onap-sdc-artifact-generator-lib/onap-sdc-artifact-generator-api/src/main/java/org/onap/sdc/generator/aai/types/Cardinality.java b/common/onap-sdc-artifact-generator-lib/onap-sdc-artifact-generator-api/src/main/java/org/onap/sdc/generator/aai/types/Cardinality.java deleted file mode 100644 index be7c945af9..0000000000 --- a/common/onap-sdc-artifact-generator-lib/onap-sdc-artifact-generator-api/src/main/java/org/onap/sdc/generator/aai/types/Cardinality.java +++ /dev/null @@ -1,26 +0,0 @@ -/*- - * ============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.onap.sdc.generator.aai.types; - -public enum Cardinality { - - UNBOUNDED -} diff --git a/common/onap-sdc-artifact-generator-lib/onap-sdc-artifact-generator-api/src/main/java/org/onap/sdc/generator/aai/types/Model.java b/common/onap-sdc-artifact-generator-lib/onap-sdc-artifact-generator-api/src/main/java/org/onap/sdc/generator/aai/types/Model.java deleted file mode 100644 index 73407a5516..0000000000 --- a/common/onap-sdc-artifact-generator-lib/onap-sdc-artifact-generator-api/src/main/java/org/onap/sdc/generator/aai/types/Model.java +++ /dev/null @@ -1,55 +0,0 @@ -/*- - * ============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.onap.sdc.generator.aai.types; - -import org.onap.sdc.generator.aai.model.Widget.Type; - -import java.lang.annotation.ElementType; -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; -import java.lang.annotation.Target; - -@Target(ElementType.TYPE) -@Retention(RetentionPolicy.RUNTIME) -public @interface Model { - - /** - * Widget widget . type. - * - * @return the widget . type - */ - public Type widget(); - - /** - * Data delete flag boolean. - * - * @return the boolean - */ - public boolean dataDeleteFlag(); - - /** - * Cardinality cardinality. - * - * @return the cardinality - */ - public Cardinality cardinality(); - -} diff --git a/common/onap-sdc-artifact-generator-lib/onap-sdc-artifact-generator-api/src/main/java/org/onap/sdc/generator/aai/types/ModelType.java b/common/onap-sdc-artifact-generator-lib/onap-sdc-artifact-generator-api/src/main/java/org/onap/sdc/generator/aai/types/ModelType.java deleted file mode 100644 index 90da359316..0000000000 --- a/common/onap-sdc-artifact-generator-lib/onap-sdc-artifact-generator-api/src/main/java/org/onap/sdc/generator/aai/types/ModelType.java +++ /dev/null @@ -1,47 +0,0 @@ -/*- - * ============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.onap.sdc.generator.aai.types; - -public enum ModelType { - SERVICE, RESOURCE, WIDGET; - - /** - * Gets model type. - * - * @param modelType the model type - * @return the model type - */ - public static ModelType getModelType(String modelType) { - if (modelType != null) { - switch (modelType.toLowerCase()) { - case "service": - return SERVICE; - case "resource": - return RESOURCE; - case "widget": - return WIDGET; - default: - return null; - } - } - return null; - } -} diff --git a/common/onap-sdc-artifact-generator-lib/onap-sdc-artifact-generator-api/src/main/java/org/onap/sdc/generator/aai/types/ModelWidget.java b/common/onap-sdc-artifact-generator-lib/onap-sdc-artifact-generator-api/src/main/java/org/onap/sdc/generator/aai/types/ModelWidget.java deleted file mode 100644 index 6ce16459ba..0000000000 --- a/common/onap-sdc-artifact-generator-lib/onap-sdc-artifact-generator-api/src/main/java/org/onap/sdc/generator/aai/types/ModelWidget.java +++ /dev/null @@ -1,46 +0,0 @@ -/*- - * ============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.onap.sdc.generator.aai.types; - -import java.lang.annotation.ElementType; -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; -import java.lang.annotation.Target; - -@Target(ElementType.TYPE) -@Retention(RetentionPolicy.RUNTIME) -public @interface ModelWidget { - - /** - * Type model type. - * - * @return the model type - */ - public ModelType type(); - - /** - * Name string. - * - * @return the string - */ - public String name(); - -} diff --git a/common/onap-sdc-artifact-generator-lib/onap-sdc-artifact-generator-api/src/main/java/org/onap/sdc/generator/data/AdditionalParams.java b/common/onap-sdc-artifact-generator-lib/onap-sdc-artifact-generator-api/src/main/java/org/onap/sdc/generator/data/AdditionalParams.java deleted file mode 100644 index d9cfadec9a..0000000000 --- a/common/onap-sdc-artifact-generator-lib/onap-sdc-artifact-generator-api/src/main/java/org/onap/sdc/generator/data/AdditionalParams.java +++ /dev/null @@ -1,39 +0,0 @@ -/*- - * ============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.onap.sdc.generator.data; - - -public enum AdditionalParams { - ServiceVersion("serviceVersion"); - - private String name; - - AdditionalParams(String name) { - this.name = name; - } - - public String getName() { - return name; - } -} - - - diff --git a/common/onap-sdc-artifact-generator-lib/onap-sdc-artifact-generator-api/src/main/java/org/onap/sdc/generator/data/Artifact.java b/common/onap-sdc-artifact-generator-lib/onap-sdc-artifact-generator-api/src/main/java/org/onap/sdc/generator/data/Artifact.java deleted file mode 100644 index d59fbc3bb7..0000000000 --- a/common/onap-sdc-artifact-generator-lib/onap-sdc-artifact-generator-api/src/main/java/org/onap/sdc/generator/data/Artifact.java +++ /dev/null @@ -1,96 +0,0 @@ -/*- - * ============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.onap.sdc.generator.data; - -public class Artifact { - - String name; - String type; - String groupType; - String description; - String label; - String version; - String checksum; - byte[] payload; - - /** - * Instantiates a new Artifact. - * - * @param type the type - * @param groupType the group type - * @param checksum the checksum - * @param payload the payload - */ - public Artifact(String type, String groupType, String checksum, byte[] payload) { - this.type = type; - this.groupType = groupType; - this.checksum = checksum; - this.payload = payload; - } - - public byte[] getPayload() { - return payload; - } - - public String getChecksum() { - return checksum; - } - - public String getType() { - return type; - } - - public String getGroupType() { - return groupType; - } - - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } - - public String getLabel() { - return label; - } - - public void setLabel(String label) { - this.label = label; - } - - public String getDescription() { - return description; - } - - public void setDescription(String description) { - this.description = description; - } - - public String getVersion() { - return version; - } - - public void setVersion(String version) { - this.version = version; - } -} diff --git a/common/onap-sdc-artifact-generator-lib/onap-sdc-artifact-generator-api/src/main/java/org/onap/sdc/generator/data/ArtifactType.java b/common/onap-sdc-artifact-generator-lib/onap-sdc-artifact-generator-api/src/main/java/org/onap/sdc/generator/data/ArtifactType.java deleted file mode 100644 index e844f945ab..0000000000 --- a/common/onap-sdc-artifact-generator-lib/onap-sdc-artifact-generator-api/src/main/java/org/onap/sdc/generator/data/ArtifactType.java +++ /dev/null @@ -1,27 +0,0 @@ -/*- - * ============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.onap.sdc.generator.data; - -public enum ArtifactType { - OTHER, - AAI, - MODEL_INVENTORY_PROFILE -} diff --git a/common/onap-sdc-artifact-generator-lib/onap-sdc-artifact-generator-api/src/main/java/org/onap/sdc/generator/data/GenerationData.java b/common/onap-sdc-artifact-generator-lib/onap-sdc-artifact-generator-api/src/main/java/org/onap/sdc/generator/data/GenerationData.java deleted file mode 100644 index 83a8452797..0000000000 --- a/common/onap-sdc-artifact-generator-lib/onap-sdc-artifact-generator-api/src/main/java/org/onap/sdc/generator/data/GenerationData.java +++ /dev/null @@ -1,70 +0,0 @@ -/*- - * ============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.onap.sdc.generator.data; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -public class GenerationData { - - List<Artifact> resultData = new ArrayList<>(); - Map<String, List<String>> errorData = new HashMap<>(); - - public void add(List<Artifact> resultData, Map<String, List<String>> errorData) { - this.resultData.addAll(resultData); - this.errorData.putAll(errorData); - } - - - public void add(Artifact generatedArtifact) { - resultData.add(generatedArtifact); - } - - /** - * Add. - * - * @param generatorId the generator id - * @param errorCode the error code - */ - public void add(String generatorId, String errorCode) { - List<String> errorIds; - if ((errorIds = errorData.get(generatorId)) == null) { - errorIds = new ArrayList<>(); - errorData.put(generatorId, errorIds); - } - errorIds.add(errorCode); - } - - public void add(GenerationData generationData) { - this.resultData.addAll(generationData.resultData); - this.errorData.putAll(generationData.errorData); - } - - public List<Artifact> getResultData() { - return resultData; - } - - public Map<String, List<String>> getErrorData() { - return errorData; - } -} diff --git a/common/onap-sdc-artifact-generator-lib/onap-sdc-artifact-generator-api/src/main/java/org/onap/sdc/generator/data/GeneratorConfiguration.java b/common/onap-sdc-artifact-generator-lib/onap-sdc-artifact-generator-api/src/main/java/org/onap/sdc/generator/data/GeneratorConfiguration.java deleted file mode 100644 index af26b2b531..0000000000 --- a/common/onap-sdc-artifact-generator-lib/onap-sdc-artifact-generator-api/src/main/java/org/onap/sdc/generator/data/GeneratorConfiguration.java +++ /dev/null @@ -1,36 +0,0 @@ -/*- - * ============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.onap.sdc.generator.data; - -import java.util.List; - -public class GeneratorConfiguration { - - private List<ArtifactType> artifactTypes = null; - - public List<ArtifactType> getArtifactTypes() { - return artifactTypes; - } - - public void setArtifactTypes(List<ArtifactType> artifactTypes) { - this.artifactTypes = artifactTypes; - } -} diff --git a/common/onap-sdc-artifact-generator-lib/onap-sdc-artifact-generator-api/src/main/java/org/onap/sdc/generator/data/GeneratorConstants.java b/common/onap-sdc-artifact-generator-lib/onap-sdc-artifact-generator-api/src/main/java/org/onap/sdc/generator/data/GeneratorConstants.java deleted file mode 100644 index 8f79aa1503..0000000000 --- a/common/onap-sdc-artifact-generator-lib/onap-sdc-artifact-generator-api/src/main/java/org/onap/sdc/generator/data/GeneratorConstants.java +++ /dev/null @@ -1,129 +0,0 @@ -/*- - * ============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.onap.sdc.generator.data; - -public class GeneratorConstants { - - public static final String GENERATOR_AAI_GENERATED_ARTIFACT_EXTENSION = "xml"; - - //Error codes - public static final String GENERATOR_INVOCATION_ERROR_CODE = - "ARTIFACT_GENERATOR_INVOCATION_ERROR"; - - - //Error Constants - public static final String GENERATOR_ERROR_INVALID_CLIENT_CONFIGURATION = - "Invalid Client Configuration"; - public static final String GENERATOR_ERROR_ARTIFACT_GENERATION_FAILED = - "Unable to generate artifacts for the provided input"; - public static final String GENERATOR_ERROR_SERVICE_INSTANTIATION_FAILED = - "Artifact Generation Service Instantiation failed"; - - //AAI Generator Error Messages - public static final String GENERATOR_AAI_ERROR_CHECKSUM_MISMATCH = - "Checksum Mismatch for file : %s"; - public static final String GENERATOR_AAI_ERROR_INVALID_TOSCA = - "Invalid format for Tosca YML : %s"; - public static final String GENERATOR_AAI_ERROR_MANDATORY_METADATA_DEFINITION = - "Invalid Service/Resource definition mandatory attribute <%s> missing in Artifact: <%s>"; - public static final String GENERATOR_AAI_ERROR_INVALID_ID = - "Invalid value for mandatory attribute <%s> in Artifact: <%s>"; - public static final String GENERATOR_AAI_ERROR_UNSUPPORTED_WIDGET_OPERATION = - "Operation Not Supported for Widgets"; - public static final String GENERATOR_AAI_ERROR_MISSING_SERVICE_TOSCA = - "Service tosca missing from list of input artifacts"; - public static final String GENERATOR_AAI_ERROR_NULL_RESOURCE_VERSION_IN_SERVICE_TOSCA = - "Invalid Service definition mandatory attribute version missing for resource with UUID: <%s>"; - - public static final String GENERATOR_AAI_ERROR_INVALID_RESOURCE_VERSION_IN_SERVICE_TOSCA = - "Cannot generate artifacts. Invalid Resource version in Service tosca for resource with " - + "UUID: " - + "<%s>"; - public static final String GENERATOR_AAI_ERROR_MISSING_RESOURCE_TOSCA = - "Cannot generate artifacts. Resource Tosca missing for resource with UUID: <%s>"; - - public static final String GENERATOR_AAI_ERROR_MISSING_SERVICE_VERSION = - "Cannot generate artifacts. Service version is not specified"; - - public static final String GENERATOR_AAI_INVALID_SERVICE_VERSION = - "Cannot generate artifacts. Service version is incorrect"; - - //Logging constants - public static final String REQUEST_ID = "uuid"; - public static final String SERVICE_INSTANCE_ID = "serviceInstanceID"; - public static final String PARTNER_NAME = "userId"; - public static final String SERVICE_NAME = "ServiceName"; - public static final String INSTANCE_UUID = "InstanceUUID"; - public static final String REMOTE_HOST = "RemoteHost"; - public static final String CLIENT_IP = "ClientIP"; - public static final String CATEGORY_LOG_LEVEL = "level"; - public static final String STATUS_CODE = "StatusCode"; - public static final String RESPONSE_CODE = "ResponseCode"; - public static final String RESPONSE_DESCRIPTION = "ResponseDescription"; - public static final String ELAPSED_TIME = "ElapsedTime"; - public static final String BEGIN_TIMESTAMP = "BeginTimestamp"; - public static final String TARGET_SERVICE_NAME = "TargetServiceName"; - public static final String TARGET_ENTITY = "TargetEntity"; - public static final String END_TIMESTAMP = "EndTimestamp"; - public static final String ERROR_CATEGORY = "ErrorCategory"; - public static final String ERROR_CODE = "ErrorCode"; - public static final String ERROR_DESCRIPTION = "ErrorDescription"; - public static final String MDC_SDC_INSTANCE_UUID = "SDC_INSTANCE_UUID"; - public static final String SERVICE_METRIC_BEGIN_TIMESTAMP = "SERVICE-METRIC-BEGIN-TIMESTAMP"; - public static final String LOCAL_ADDR = "localAddr"; //map ServerIPAddress from loggingfilter - public static final String BE_FQDN = "beFqdn"; //map ServerFQDN from logging filter - public static final String ARTIFACT_MODEL_INFO = "ARTIFACT_MODEL_INFO"; - - public static final String GENERATOR_ERROR_CODE = "300F"; - public static final String GENERATOR_PARTNER_NAME = "SDC Catalog"; - public static final String GENERATOR_METRICS_TARGET_ENTITY = "SDC Catalog"; - public static final String GENERATOR_METRICS_FAILURE_RESPONSE_CODE = "300E"; - public static final String GENERATOR_METRICS_FAILURE_RESPONSE_DESC = "Artifact generation " - + "failed for artifact type %s"; - public static final String GENERATOR_METRICS_SUCCESS_RESPONSE_CODE = "010"; - public static final String GENERATOR_METRICS_SUCCESS_RESPONSE_DESC = "Artifacts for type %s " - + "were generated successfully"; - public static final String GENERATOR_AUDIT_NO_ARTIFACT_TYPE_RESPONSE_DESC = "No Artifact Type " - + "found" ; - - //AAI Generator Error Messages for Logging - public static final String GENERATOR_AAI_ERROR_INVALID_TOSCA_MSG = - "Invalid format for Tosca YML"; - public static final String GENERATOR_AAI_ERROR_MANDATORY_METADATA_DEFINITION_MSG = - "Invalid Service/Resource definition mandatory attribute"; - public static final String GENERATOR_AAI_ERROR_MISSING_SERVICE_TOSCA_MSG = - "Service tosca missing from list of input artifacts"; - public static final String GENERATOR_ERROR_INVALID_CLIENT_CONFIGURATION_MSG = - "Invalid Client Configuration"; - public static final String GENERATOR_ERROR_ARTIFACT_GENERATION_FAILED_MSG = - "Unable to generate artifacts for the provided input"; - public static final String GENERATOR_AAI_CONFIGFILE_NOT_FOUND = - "Cannot generate artifacts. Artifact Generator Configuration file not found at %s"; - public static final String GENERATOR_AAI_CONFIGLOCATION_NOT_FOUND = - "Cannot generate artifacts. artifactgenerator.config system property not configured"; - public static final String GENERATOR_AAI_CONFIGLPROP_NOT_FOUND = - "Cannot generate artifacts. Widget configuration not found for %s"; - public static final String GENERATOR_AAI_PROVIDING_SERVICE_MISSING = - "Cannot generate artifacts. Providing Service is missing for allotted resource %s"; - public static final String GENERATOR_AAI_PROVIDING_SERVICE_METADATA_MISSING = - "Cannot generate artifacts. Providing Service Metadata is missing for allotted resource %s"; - public static final int ID_LENGTH = 36; -} diff --git a/common/onap-sdc-artifact-generator-lib/onap-sdc-artifact-generator-api/src/main/java/org/onap/sdc/generator/data/GeneratorUtil.java b/common/onap-sdc-artifact-generator-lib/onap-sdc-artifact-generator-api/src/main/java/org/onap/sdc/generator/data/GeneratorUtil.java deleted file mode 100644 index 918fa1e0a8..0000000000 --- a/common/onap-sdc-artifact-generator-lib/onap-sdc-artifact-generator-api/src/main/java/org/onap/sdc/generator/data/GeneratorUtil.java +++ /dev/null @@ -1,104 +0,0 @@ -/*- - * ============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.onap.sdc.generator.data; - -import com.fasterxml.jackson.databind.DeserializationFeature; -import com.fasterxml.jackson.databind.ObjectMapper; -import com.fasterxml.jackson.dataformat.yaml.YAMLFactory; -import org.apache.commons.codec.digest.DigestUtils; - -import java.io.IOException; -import java.util.Base64; - -/** - * Utility method class for artifact generation. - */ -public class GeneratorUtil { - /** - * Translate tosca yaml into the provided model class. - * - * @param tosca Tosca file content - * @param classOfT Model class for the translated object - * @param <T> Template parameter for the return object - * @return Object model for the provided tosca yaml file - */ - public static <T> T translateTosca(String tosca, Class<T> classOfT) throws IOException { - T tos; - //changing file - ObjectMapper mapper = new ObjectMapper(new YAMLFactory()); // jackson data-bind - mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); - tos = mapper.readValue(tosca, classOfT); - return tos; - } - - /** - * Decodes Base64 encode byte array input. - * - * @param input Base64 encoded byte array - * @return Decoded byte array - */ - public static byte[] decoder(byte[] input) { - if (input != null) { - byte[] output = Base64.getDecoder().decode(input); - return output; - } - return null; - } - - /** - * Encode a byte array input using Base64 encoding. - * - * @param input Input byte array to be encoded - * @return Base64 encoded byte array - */ - public static byte[] encode(byte[] input) { - if (input != null) { - byte[] output = Base64.getEncoder().encode(input); - return output; - } - return null; - } - - /** - * Calculate the checksum for a given input. - * - * @param input Byte array for which the checksum has to be calculated - * @return Calculated checksum of the input byte array - */ - public static String checkSum(byte[] input) { - String checksum = null; - if (input != null) { - checksum = (DigestUtils.md5Hex(input)).toUpperCase(); - } - return checksum; - } - - /** - * Check if string is empty or null. - * - * @param input Input String - * @return true if string is empty/null and false otherwise - */ - public static boolean isEmpty(String input) { - return input == null || input.length() == 0; - } - -} diff --git a/common/onap-sdc-artifact-generator-lib/onap-sdc-artifact-generator-api/src/main/java/org/onap/sdc/generator/data/GroupType.java b/common/onap-sdc-artifact-generator-lib/onap-sdc-artifact-generator-api/src/main/java/org/onap/sdc/generator/data/GroupType.java deleted file mode 100644 index 69a8484885..0000000000 --- a/common/onap-sdc-artifact-generator-lib/onap-sdc-artifact-generator-api/src/main/java/org/onap/sdc/generator/data/GroupType.java +++ /dev/null @@ -1,26 +0,0 @@ -/*- - * ============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.onap.sdc.generator.data; - -public enum GroupType { - DEPLOYMENT, - OTHER -} diff --git a/common/onap-sdc-artifact-generator-lib/onap-sdc-artifact-generator-api/src/main/java/org/onap/sdc/generator/data/WidgetConfigurationUtil.java b/common/onap-sdc-artifact-generator-lib/onap-sdc-artifact-generator-api/src/main/java/org/onap/sdc/generator/data/WidgetConfigurationUtil.java deleted file mode 100644 index ab2da6caca..0000000000 --- a/common/onap-sdc-artifact-generator-lib/onap-sdc-artifact-generator-api/src/main/java/org/onap/sdc/generator/data/WidgetConfigurationUtil.java +++ /dev/null @@ -1,36 +0,0 @@ -/*- - * ============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.onap.sdc.generator.data; - -import java.util.Properties; - -public class WidgetConfigurationUtil { - - private static Properties config ; - - public static Properties getConfig() { - return config; - } - - public static void setConfig(Properties config) { - WidgetConfigurationUtil.config = config; - } -} diff --git a/common/onap-sdc-artifact-generator-lib/onap-sdc-artifact-generator-api/src/main/java/org/onap/sdc/generator/error/IllegalAccessException.java b/common/onap-sdc-artifact-generator-lib/onap-sdc-artifact-generator-api/src/main/java/org/onap/sdc/generator/error/IllegalAccessException.java deleted file mode 100644 index 823af87fcc..0000000000 --- a/common/onap-sdc-artifact-generator-lib/onap-sdc-artifact-generator-api/src/main/java/org/onap/sdc/generator/error/IllegalAccessException.java +++ /dev/null @@ -1,29 +0,0 @@ -/*- - * ============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.onap.sdc.generator.error; - -public class IllegalAccessException extends RuntimeException { - - public IllegalAccessException(String message) { - super(message); - } - -} diff --git a/common/onap-sdc-artifact-generator-lib/onap-sdc-artifact-generator-api/src/main/java/org/onap/sdc/generator/intf/ArtifactGenerator.java b/common/onap-sdc-artifact-generator-lib/onap-sdc-artifact-generator-api/src/main/java/org/onap/sdc/generator/intf/ArtifactGenerator.java deleted file mode 100644 index 7e198df4bb..0000000000 --- a/common/onap-sdc-artifact-generator-lib/onap-sdc-artifact-generator-api/src/main/java/org/onap/sdc/generator/intf/ArtifactGenerator.java +++ /dev/null @@ -1,35 +0,0 @@ -/*- - * ============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.onap.sdc.generator.intf; - -import org.onap.sdc.generator.data.Artifact; -import org.onap.sdc.generator.data.GenerationData; - -import java.util.List; -import java.util.Map; - - -public interface ArtifactGenerator { - - public GenerationData generateArtifact(List<Artifact> input, - Map<String, String> additionalParams); - -} diff --git a/common/onap-sdc-artifact-generator-lib/onap-sdc-artifact-generator-api/src/main/java/org/onap/sdc/generator/intf/Generator.java b/common/onap-sdc-artifact-generator-lib/onap-sdc-artifact-generator-api/src/main/java/org/onap/sdc/generator/intf/Generator.java deleted file mode 100644 index 069316a577..0000000000 --- a/common/onap-sdc-artifact-generator-lib/onap-sdc-artifact-generator-api/src/main/java/org/onap/sdc/generator/intf/Generator.java +++ /dev/null @@ -1,40 +0,0 @@ -/*- - * ============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.onap.sdc.generator.intf; - -import org.onap.sdc.generator.data.ArtifactType; - -import java.lang.annotation.ElementType; -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; -import java.lang.annotation.Target; - -@Target(ElementType.TYPE) -@Retention(RetentionPolicy.RUNTIME) -public @interface Generator { - - /** - * Artifact type artifact type. - * - * @return the artifact type - */ - public ArtifactType artifactType(); -} diff --git a/common/onap-sdc-artifact-generator-lib/onap-sdc-artifact-generator-api/src/main/java/org/onap/sdc/generator/logging/ArtifactGeneratorLogResponseCode.java b/common/onap-sdc-artifact-generator-lib/onap-sdc-artifact-generator-api/src/main/java/org/onap/sdc/generator/logging/ArtifactGeneratorLogResponseCode.java deleted file mode 100644 index 17507f1474..0000000000 --- a/common/onap-sdc-artifact-generator-lib/onap-sdc-artifact-generator-api/src/main/java/org/onap/sdc/generator/logging/ArtifactGeneratorLogResponseCode.java +++ /dev/null @@ -1,68 +0,0 @@ -/*- - * ============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.onap.sdc.generator.logging; - -import java.util.HashMap; -import java.util.Map; - -public enum ArtifactGeneratorLogResponseCode { - INTERNAL_SERVER_ERROR(201), - MISSING_CONFIG_PROPERTIES_FILE(202), - MISSING_SYSTME_PROPERY_CONFIGURATION(203), - MANDATORY_ATTRIBUTE_MISSING(313), - SERVICE_TOSCA_MISSING(314), - INVALID_TOSCA_YAML(315), - INVALID_CLIENT_CONFIGURATION(316), - UNABLE_TO_GENERATE_ARTIFACT(317), - MISSING_WIDGET_CONFIGURATION(318), - INVALID_ID_VALUE(319), - MISSING_SERVICE_VERSION(320), - INVALID_SERVICE_VERSION(321), - MISSING_RESOURCE_VERSION(322), - INVALID_RESOURCE_VERSION(323), - MISSING_PRO_SERVICE(324), - MISSING_PRO_SERVICE_METADATA(325), - RESOURCE_TOSCA_MISSING(326); - - - private static Map<Integer, ArtifactGeneratorLogResponseCode> mapValueToEnum = new HashMap<>(); - - static { - for (ArtifactGeneratorLogResponseCode responseCode : - ArtifactGeneratorLogResponseCode.values()) { - mapValueToEnum.put(responseCode.value, responseCode); - } - } - - private int value; - - ArtifactGeneratorLogResponseCode(int value) { - this.value = value; - } - - public static ArtifactGeneratorLogResponseCode parseValue(int value) { - return mapValueToEnum.get(value); - } - - public int getValue() { - return value; - } -} diff --git a/common/onap-sdc-artifact-generator-lib/onap-sdc-artifact-generator-api/src/main/java/org/onap/sdc/generator/logging/CategoryLogLevel.java b/common/onap-sdc-artifact-generator-lib/onap-sdc-artifact-generator-api/src/main/java/org/onap/sdc/generator/logging/CategoryLogLevel.java deleted file mode 100644 index 930b5c78d0..0000000000 --- a/common/onap-sdc-artifact-generator-lib/onap-sdc-artifact-generator-api/src/main/java/org/onap/sdc/generator/logging/CategoryLogLevel.java +++ /dev/null @@ -1,29 +0,0 @@ -/*- - * ============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.onap.sdc.generator.logging; - -public enum CategoryLogLevel { - INFO, - WARN, - DEBUG, - ERROR, - FATAL -} diff --git a/common/onap-sdc-artifact-generator-lib/onap-sdc-artifact-generator-api/src/main/java/org/onap/sdc/generator/logging/StatusCode.java b/common/onap-sdc-artifact-generator-lib/onap-sdc-artifact-generator-api/src/main/java/org/onap/sdc/generator/logging/StatusCode.java deleted file mode 100644 index 0eb3b6d3b6..0000000000 --- a/common/onap-sdc-artifact-generator-lib/onap-sdc-artifact-generator-api/src/main/java/org/onap/sdc/generator/logging/StatusCode.java +++ /dev/null @@ -1,26 +0,0 @@ -/*- - * ============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.onap.sdc.generator.logging; - -public enum StatusCode { - COMPLETE, - ERROR -} diff --git a/common/onap-sdc-artifact-generator-lib/onap-sdc-artifact-generator-api/src/main/java/org/onap/sdc/generator/logging/annotations/Audit.java b/common/onap-sdc-artifact-generator-lib/onap-sdc-artifact-generator-api/src/main/java/org/onap/sdc/generator/logging/annotations/Audit.java deleted file mode 100644 index c56bd4a5f1..0000000000 --- a/common/onap-sdc-artifact-generator-lib/onap-sdc-artifact-generator-api/src/main/java/org/onap/sdc/generator/logging/annotations/Audit.java +++ /dev/null @@ -1,34 +0,0 @@ -/*- - * ============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.onap.sdc.generator.logging.annotations; - -import java.lang.annotation.ElementType; -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; -import java.lang.annotation.Target; - -/** - * Indicates a method for auditing during artifact generation. - */ -@Target(ElementType.METHOD) -@Retention(RetentionPolicy.RUNTIME) -public @interface Audit { -} diff --git a/common/onap-sdc-artifact-generator-lib/onap-sdc-artifact-generator-api/src/main/java/org/onap/sdc/generator/logging/annotations/Metrics.java b/common/onap-sdc-artifact-generator-lib/onap-sdc-artifact-generator-api/src/main/java/org/onap/sdc/generator/logging/annotations/Metrics.java deleted file mode 100644 index 468ab6412b..0000000000 --- a/common/onap-sdc-artifact-generator-lib/onap-sdc-artifact-generator-api/src/main/java/org/onap/sdc/generator/logging/annotations/Metrics.java +++ /dev/null @@ -1,35 +0,0 @@ -/*- - * ============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.onap.sdc.generator.logging.annotations; - -import java.lang.annotation.ElementType; -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; -import java.lang.annotation.Target; - -/** - * Indicates a method for metrics recording during artifact generation. - * - */ -@Target(ElementType.METHOD) -@Retention(RetentionPolicy.RUNTIME) -public @interface Metrics { -} diff --git a/common/onap-sdc-artifact-generator-lib/onap-sdc-artifact-generator-api/src/main/java/org/onap/sdc/generator/service/ArtifactGenerationService.java b/common/onap-sdc-artifact-generator-lib/onap-sdc-artifact-generator-api/src/main/java/org/onap/sdc/generator/service/ArtifactGenerationService.java deleted file mode 100644 index 60a90e9a9e..0000000000 --- a/common/onap-sdc-artifact-generator-lib/onap-sdc-artifact-generator-api/src/main/java/org/onap/sdc/generator/service/ArtifactGenerationService.java +++ /dev/null @@ -1,69 +0,0 @@ -/*- - * ============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.onap.sdc.generator.service; - -import org.onap.sdc.generator.data.Artifact; -import org.onap.sdc.generator.data.GenerationData; -import org.onap.sdc.generator.data.GeneratorConstants; -import org.onap.sdc.generator.logging.CategoryLogLevel; -import org.openecomp.sdc.logging.api.Logger; -import org.openecomp.sdc.logging.api.LoggerFactory; -import org.slf4j.MDC; - -import java.util.List; -import java.util.Map; - - -/** - * Artifact Generation Service interface. - */ -public interface ArtifactGenerationService { - - - /** - * Method to get artifact generation service implementation. - * - * @return Artifact generation implementation instance - */ - public static ArtifactGenerationService lookup() { - - Logger log = LoggerFactory.getLogger(ArtifactGenerationService.class.getName()); - log.debug("Instantiating Artifact Generation Service"); - try { - return ArtifactGenerationService.class.cast( - Class.forName("org.openecomp.sdc.generator.impl.ArtifactGenerationServiceImpl") - .newInstance()); - } catch (Exception exception) { - MDC.put(GeneratorConstants.PARTNER_NAME, GeneratorConstants.GENERATOR_PARTNER_NAME); - MDC.put(GeneratorConstants.ERROR_CATEGORY, CategoryLogLevel.ERROR.name()); - MDC.put(GeneratorConstants.ERROR_CODE, GeneratorConstants.GENERATOR_ERROR_CODE); - MDC.put( - GeneratorConstants.ERROR_DESCRIPTION, GeneratorConstants.GENERATOR_ERROR_SERVICE_INSTANTIATION_FAILED); - log.error(GeneratorConstants.GENERATOR_ERROR_SERVICE_INSTANTIATION_FAILED, exception); - } - log.debug(GeneratorConstants.GENERATOR_ERROR_SERVICE_INSTANTIATION_FAILED); - return null; - } - - public GenerationData generateArtifact(List<Artifact> input, String overridingConfiguration, - Map<String, String> additionalParams); - -} |