8701aa4a7d7951b9bb92c2cbb4db8078d5ed7b16
[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  * Modifications Copyright (C) 2018 IBM.
8  * ================================================================================
9  * Licensed under the Apache License, Version 2.0 (the "License");
10  * you may not use this file except in compliance with the License.
11  * You may obtain a copy of the License at
12  *
13  *      http://www.apache.org/licenses/LICENSE-2.0
14  *
15  * Unless required by applicable law or agreed to in writing, software
16  * distributed under the License is distributed on an "AS IS" BASIS,
17  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18  * See the License for the specific language governing permissions and
19  * limitations under the License.
20  * ============LICENSE_END=========================================================
21  */
22
23 package org.onap.so.adapters.vdu;
24
25 import org.apache.commons.lang3.builder.HashCodeBuilder;
26 import org.apache.commons.lang3.builder.EqualsBuilder;
27
28 public class VduArtifact {
29         
30         // Enumerate the types of artifacts permitted.  This may need to be a variable string
31         // value if arbitrary (cloud-specific) artifacts may be attached to VDUs in ASDC.
32         public enum ArtifactType {
33                 MAIN_TEMPLATE, NESTED_TEMPLATE, CONFIG_FILE, SCRIPT_FILE, TEXT_FILE, ENVIRONMENT
34         }
35         
36         private String name;
37         private byte[] content;
38         private ArtifactType type;
39         
40         @Override
41         public boolean equals(final Object other) {
42                 if (!(other instanceof VduArtifact)) {
43                         return false;
44                 }
45                 VduArtifact castOther = (VduArtifact) other;
46                 return new EqualsBuilder().append(name, castOther.name).append(content, castOther.content)
47                                 .append(type, castOther.type).isEquals();
48         }
49
50         @Override
51         public int hashCode() {
52                 return new HashCodeBuilder().append(name).append(content).append(type).toHashCode();
53         }
54
55         // Default constructor
56         public VduArtifact() {}
57         
58         // Fully specified constructor
59         public VduArtifact (String name, byte[] content, ArtifactType type) {
60                 this.name = name;
61                 this.content = content;
62                 this.type = type;
63         }
64         
65         public String getName() {
66                 return name;
67         }
68         public void setName (String name) {
69                 this.name = name;
70         }
71         public byte[] getContent() {
72                 return content;
73         }
74         public void setContent(byte[] content) {
75                 this.content = content;
76         }
77         public ArtifactType getType() {
78                 return type;
79         }
80         public void setType(ArtifactType type) {
81                 this.type = type;
82         }
83
84         
85 }