diff options
Diffstat (limited to 'catalog-model/src/main/java')
4 files changed, 138 insertions, 4 deletions
diff --git a/catalog-model/src/main/java/org/openecomp/sdc/be/model/NodeTypeMetadata.java b/catalog-model/src/main/java/org/openecomp/sdc/be/model/NodeTypeMetadata.java new file mode 100644 index 0000000000..da83b8f41b --- /dev/null +++ b/catalog-model/src/main/java/org/openecomp/sdc/be/model/NodeTypeMetadata.java @@ -0,0 +1,49 @@ +/* + * - + * ============LICENSE_START======================================================= + * Copyright (C) 2021 Nordix Foundation. + * ================================================================================ + * 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. + * + * SPDX-License-Identifier: Apache-2.0 + * ============LICENSE_END========================================================= + */ + +package org.openecomp.sdc.be.model; + +import java.util.List; +import lombok.Data; +import org.openecomp.sdc.be.datatypes.enums.ResourceTypeEnum; +import org.openecomp.sdc.be.model.category.CategoryDefinition; + +/** + * Holds metadata information about a TOSCA node_type. + */ +@Data +public class NodeTypeMetadata { + + private String name; + private String toscaName; + private String description; + private String contactId; + private String resourceIconPath; + private String model; + private String icon; + private String vendorName; + private String vendorRelease; + private String resourceVendorModelNumber; + private String resourceType = ResourceTypeEnum.VFC.getValue(); + private List<String> tags; + private List<CategoryDefinition> categories; + +} diff --git a/catalog-model/src/main/java/org/openecomp/sdc/be/model/NodeTypesMetadataList.java b/catalog-model/src/main/java/org/openecomp/sdc/be/model/NodeTypesMetadataList.java new file mode 100644 index 0000000000..25b9616521 --- /dev/null +++ b/catalog-model/src/main/java/org/openecomp/sdc/be/model/NodeTypesMetadataList.java @@ -0,0 +1,35 @@ +/* + * - + * ============LICENSE_START======================================================= + * Copyright (C) 2021 Nordix Foundation. + * ================================================================================ + * 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. + * + * SPDX-License-Identifier: Apache-2.0 + * ============LICENSE_END========================================================= + */ + +package org.openecomp.sdc.be.model; + +import java.util.List; +import lombok.Data; + +/** + * Dto to hold a list of TOSCA node type metadata. + */ +@Data +public class NodeTypesMetadataList { + + private List<NodeTypeMetadata> nodeMetadataList; + +} diff --git a/catalog-model/src/main/java/org/openecomp/sdc/be/model/UploadResourceInfo.java b/catalog-model/src/main/java/org/openecomp/sdc/be/model/UploadResourceInfo.java index 752fad2278..dcb01169c6 100644 --- a/catalog-model/src/main/java/org/openecomp/sdc/be/model/UploadResourceInfo.java +++ b/catalog-model/src/main/java/org/openecomp/sdc/be/model/UploadResourceInfo.java @@ -21,10 +21,12 @@ package org.openecomp.sdc.be.model; import java.util.ArrayList; import java.util.List; +import lombok.NoArgsConstructor; import org.openecomp.sdc.be.model.category.CategoryDefinition; import org.openecomp.sdc.be.model.category.SubCategoryDefinition; import org.openecomp.sdc.common.api.UploadArtifactInfo; +@NoArgsConstructor public class UploadResourceInfo { private String payloadData; @@ -39,7 +41,6 @@ public class UploadResourceInfo { public UploadResourceInfo(String payload, String payloadName, String description, String category, List<String> tags, List<UploadArtifactInfo> artifactsList, String modelName) { - super(); this.payloadData = payload; this.payloadName = payloadName; this.description = description; @@ -60,9 +61,6 @@ public class UploadResourceInfo { } } - public UploadResourceInfo() { - } - public String getPayloadData() { return payloadData; } diff --git a/catalog-model/src/main/java/org/openecomp/sdc/be/model/mapper/NodeTypeMetadataMapper.java b/catalog-model/src/main/java/org/openecomp/sdc/be/model/mapper/NodeTypeMetadataMapper.java new file mode 100644 index 0000000000..feef044b7f --- /dev/null +++ b/catalog-model/src/main/java/org/openecomp/sdc/be/model/mapper/NodeTypeMetadataMapper.java @@ -0,0 +1,52 @@ +/* + * - + * ============LICENSE_START======================================================= + * Copyright (C) 2021 Nordix Foundation. + * ================================================================================ + * 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. + * + * SPDX-License-Identifier: Apache-2.0 + * ============LICENSE_END========================================================= + */ + +package org.openecomp.sdc.be.model.mapper; + +import lombok.AccessLevel; +import lombok.NoArgsConstructor; +import org.openecomp.sdc.be.model.NodeTypeMetadata; +import org.openecomp.sdc.be.model.UploadResourceInfo; + +/** + * Responsible to map the {@code NodeTypeMetadata} to and from other classes. + */ +@NoArgsConstructor(access = AccessLevel.PRIVATE) +public class NodeTypeMetadataMapper { + + public static UploadResourceInfo mapTo(final NodeTypeMetadata nodeTypeMetadata) { + var uploadResourceInfo = new UploadResourceInfo(); + uploadResourceInfo.setName(nodeTypeMetadata.getName()); + uploadResourceInfo.setDescription(nodeTypeMetadata.getDescription()); + uploadResourceInfo.setContactId(nodeTypeMetadata.getContactId()); + uploadResourceInfo.setIcon(nodeTypeMetadata.getIcon()); + uploadResourceInfo.setResourceIconPath(nodeTypeMetadata.getResourceIconPath()); + uploadResourceInfo.setVendorName(nodeTypeMetadata.getVendorName()); + uploadResourceInfo.setModel(nodeTypeMetadata.getModel()); + uploadResourceInfo.setVendorRelease(nodeTypeMetadata.getVendorRelease()); + uploadResourceInfo.setResourceVendorModelNumber(nodeTypeMetadata.getResourceVendorModelNumber()); + uploadResourceInfo.setResourceType(nodeTypeMetadata.getResourceType()); + uploadResourceInfo.setTags(nodeTypeMetadata.getTags()); + uploadResourceInfo.setCategories(nodeTypeMetadata.getCategories()); + return uploadResourceInfo; + } + +} |