Containerization feature of SO
[so.git] / adapters / mso-adapters-rest-interface / src / main / java / org / onap / so / adapters / vdu / VduArtifact.java
1 /*-
2  * ============LICENSE_START=======================================================
3  * ONAP - SO
4  * ================================================================================
5  * Copyright (C) 2018 AT&T Intellectual Property. All rights reserved.
6  * ================================================================================
7  * Licensed under the Apache License, Version 2.0 (the "License");
8  * you may not use this file except in compliance with the License.
9  * You may obtain a copy of the License at
10  *
11  *      http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing, software
14  * distributed under the License is distributed on an "AS IS" BASIS,
15  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16  * See the License for the specific language governing permissions and
17  * limitations under the License.
18  * ============LICENSE_END=========================================================
19  */
20
21 package org.onap.so.adapters.vdu;
22
23 import java.util.Arrays;
24 import java.util.Objects;
25
26 public class VduArtifact {
27         
28         // Enumerate the types of artifacts permitted.  This may need to be a variable string
29         // value if arbitrary (cloud-specific) artifacts may be attached to VDUs in ASDC.
30         public enum ArtifactType {
31                 MAIN_TEMPLATE, NESTED_TEMPLATE, CONFIG_FILE, SCRIPT_FILE, TEXT_FILE, ENVIRONMENT
32         }
33         
34         private String name;
35         private byte[] content;
36         private ArtifactType type;
37         
38         // Default constructor
39         public VduArtifact() {}
40         
41         // Fully specified constructor
42         public VduArtifact (String name, byte[] content, ArtifactType type) {
43                 this.name = name;
44                 this.content = content;
45                 this.type = type;
46         }
47         
48         public String getName() {
49                 return name;
50         }
51         public void setName (String name) {
52                 this.name = name;
53         }
54         public byte[] getContent() {
55                 return content;
56         }
57         public void setContent(byte[] content) {
58                 this.content = content;
59         }
60         public ArtifactType getType() {
61                 return type;
62         }
63         public void setType(ArtifactType type) {
64                 this.type = type;
65         }
66
67         @Override
68         public boolean equals(Object o) {
69                 if (this == o) {
70                         return true;
71                 }
72                 if (o == null || getClass() != o.getClass()) {
73                         return false;
74                 }
75                 VduArtifact that = (VduArtifact) o;
76                 return Objects.equals(name, that.name) &&
77                                 Arrays.equals(content, that.content) &&
78                                 type == that.type;
79         }
80 }