2 * ============LICENSE_START=======================================================
4 * ================================================================================
5 * Copyright (C) 2017 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
11 * http://www.apache.org/licenses/LICENSE-2.0
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=========================================================
21 package org.openecomp.sdc.be.datatypes.elements;
23 import org.openecomp.sdc.be.datatypes.enums.JsonPresentationFields;
24 import org.openecomp.sdc.be.datatypes.tosca.ToscaDataDefinition;
25 import org.openecomp.sdc.common.api.ArtifactGroupTypeEnum;
27 import java.io.Serializable;
28 import java.util.ArrayList;
29 import java.util.List;
32 //import com.google.gson.reflect.TypeToken;
34 public class ArtifactDataDefinition extends ToscaDataDefinition implements Serializable {
38 private static final long serialVersionUID = -1691343090754083941L;
42 public ArtifactDataDefinition() {
44 setArtifactVersion("0");
47 public ArtifactDataDefinition(Map<String, Object> art) {
49 setArtifactVersion("0");
54 public ArtifactDataDefinition(ArtifactDataDefinition a ) {
56 this.setUniqueId(a.getUniqueId());
57 this.setArtifactType(a.getArtifactType());
58 this.setArtifactRef( a.getArtifactRef());
59 this.setArtifactName( a.getArtifactName());
60 this.setArtifactRepository( a.getArtifactRepository());
61 this.setArtifactChecksum( a.getArtifactChecksum());
62 this.setUserIdCreator( a.getUserIdCreator());
63 this.setUserIdLastUpdater( a.getUserIdLastUpdater());
64 this.setCreatorFullName( a.getCreatorFullName());
65 this.setUpdaterFullName( a.getUpdaterFullName());
66 this.setCreationDate ( a.getCreationDate());
67 this.setLastUpdateDate ( a.getLastUpdateDate());
68 this.setDescription ( a.getDescription());
69 this.setEsId ( a.getEsId());
70 this.setArtifactLabel( a.getArtifactLabel());
71 this.setArtifactCreator( a.getArtifactCreator());
72 this.setMandatory ( a.getMandatory());
73 this.setArtifactDisplayName( a.getArtifactDisplayName());
74 this.setApiUrl( a.getApiUrl());
75 this.setServiceApi ( a.getServiceApi());
76 this.setArtifactGroupType ( a.getArtifactGroupType());
77 this.setTimeout ( a.getTimeout());
78 this.setArtifactVersion( a.getArtifactVersion());
79 this.setArtifactUUID ( a.getArtifactUUID());
80 this.setPayloadUpdateDate ( a.getPayloadUpdateDate());
81 this.setHeatParamsUpdateDate ( a.getHeatParamsUpdateDate());
82 this.setGenerated(a.getGenerated());
83 this.setDuplicated(a.getDuplicated());
84 if (a.getRequiredArtifacts() != null)
85 this.setRequiredArtifacts(new ArrayList<>(a.getRequiredArtifacts()));
86 if (a.getHeatParameters() != null)
87 this.setHeatParameters(new ArrayList<>(a.getHeatParameters()));
88 this.setGeneratedFromId( a.getGeneratedFromId());
89 this.setIsFromCsar(a.getIsFromCsar());
94 public String getArtifactName() {
95 return (String) getToscaPresentationValue(JsonPresentationFields.NAME);
99 public String getArtifactType() {
100 return (String) getToscaPresentationValue(JsonPresentationFields.ARTIFACT_TYPE);
103 public void setArtifactType(String artifactType) {
104 setToscaPresentationValue(JsonPresentationFields.ARTIFACT_TYPE, artifactType);
108 public String getArtifactRef() {
109 return (String) getToscaPresentationValue(JsonPresentationFields.ARTIFACT_REF);
113 public void setArtifactRef(String artifactRef) {
114 setToscaPresentationValue(JsonPresentationFields.ARTIFACT_REF, artifactRef);
117 public String getArtifactRepository() {
118 return (String) getToscaPresentationValue(JsonPresentationFields.ARTIFACT_REPOSITORY);
122 public void setArtifactRepository(String artifactRepository) {
123 setToscaPresentationValue(JsonPresentationFields.ARTIFACT_REPOSITORY, artifactRepository);
126 public void setArtifactName(String artifactName) {
127 setToscaPresentationValue(JsonPresentationFields.NAME, artifactName);
131 public String getArtifactChecksum() {
132 return (String) getToscaPresentationValue(JsonPresentationFields.ARTIFACT_CHECKSUM);
135 public void setArtifactChecksum(String artifactChecksum) {
136 setToscaPresentationValue(JsonPresentationFields.ARTIFACT_CHECKSUM, artifactChecksum);
139 public String getUserIdCreator() {
141 return (String) getToscaPresentationValue(JsonPresentationFields.USER_ID_CREATOR);
144 public void setUserIdCreator(String userIdCreator) {
145 setToscaPresentationValue(JsonPresentationFields.USER_ID_CREATOR, userIdCreator);
148 public String getUserIdLastUpdater() {
149 return (String) getToscaPresentationValue(JsonPresentationFields.USER_ID_LAST_UPDATER);
152 public void setUserIdLastUpdater(String userIdLastUpdater) {
153 setToscaPresentationValue(JsonPresentationFields.USER_ID_LAST_UPDATER, userIdLastUpdater);
156 public String getCreatorFullName() {
157 return (String) getToscaPresentationValue(JsonPresentationFields.CREATOR_FULL_NAME);
160 public void setCreatorFullName(String creatorFullName) {
161 setToscaPresentationValue(JsonPresentationFields.CREATOR_FULL_NAME, creatorFullName);
164 public String getUpdaterFullName() {
165 return (String) getToscaPresentationValue(JsonPresentationFields.UPDATER_FULL_NAME);
168 public void setUpdaterFullName(String updaterFullName) {
169 setToscaPresentationValue(JsonPresentationFields.UPDATER_FULL_NAME, updaterFullName);
172 public Long getCreationDate() {
173 return (Long) getToscaPresentationValue(JsonPresentationFields.CREATION_DATE);
176 public void setCreationDate(Long creationDate) {
177 setToscaPresentationValue(JsonPresentationFields.CREATION_DATE, creationDate);
180 public Long getLastUpdateDate() {
181 return (Long) getToscaPresentationValue(JsonPresentationFields.LAST_UPDATE_DATE);
184 public void setLastUpdateDate(Long lastUpdateDate) {
185 setToscaPresentationValue(JsonPresentationFields.LAST_UPDATE_DATE, lastUpdateDate);
188 public String getUniqueId() {
189 return (String) getToscaPresentationValue(JsonPresentationFields.UNIQUE_ID);
192 public void setUniqueId(String uniqueId) {
193 setToscaPresentationValue(JsonPresentationFields.UNIQUE_ID, uniqueId);
196 public String getDescription() {
197 return (String) getToscaPresentationValue(JsonPresentationFields.DESCRIPTION);
200 public void setDescription(String description) {
201 setToscaPresentationValue(JsonPresentationFields.DESCRIPTION, description);
204 public String getArtifactLabel() {
205 return (String) getToscaPresentationValue(JsonPresentationFields.ARTIFACT_LABEL);
208 public void setArtifactLabel(String artifactLabel) {
209 setToscaPresentationValue(JsonPresentationFields.ARTIFACT_LABEL, artifactLabel);
212 public String getEsId() {
213 return (String) getToscaPresentationValue(JsonPresentationFields.ES_ID);
216 public void setEsId(String esId) {
217 setToscaPresentationValue(JsonPresentationFields.ES_ID, esId);
220 public String getArtifactCreator() {
221 return (String) getToscaPresentationValue(JsonPresentationFields.ARTIFACT_CREATOR);
224 public void setArtifactCreator(String artifactCreator) {
225 setToscaPresentationValue(JsonPresentationFields.ARTIFACT_CREATOR, artifactCreator);
228 public Boolean getMandatory() {
229 Boolean isMandatory = (Boolean) getToscaPresentationValue(JsonPresentationFields.IS_ABSTRACT);
230 return isMandatory == null? Boolean.FALSE: isMandatory;
233 public void setMandatory(Boolean mandatory) {
234 setToscaPresentationValue(JsonPresentationFields.IS_ABSTRACT, mandatory);
237 public String getArtifactDisplayName() {
238 return (String) getToscaPresentationValue(JsonPresentationFields.ARTIFACT_DISPLAY_NAME);
241 public void setArtifactDisplayName(String artifactDisplayName) {
242 setToscaPresentationValue(JsonPresentationFields.ARTIFACT_DISPLAY_NAME, artifactDisplayName);
245 public String getApiUrl() {
246 return (String) getToscaPresentationValue(JsonPresentationFields.API_URL);
249 public void setApiUrl(String apiUrl) {
250 setToscaPresentationValue(JsonPresentationFields.API_URL, apiUrl);
253 public Boolean getServiceApi() {
254 Boolean serviceApi = (Boolean) getToscaPresentationValue(JsonPresentationFields.SERVICE_API);
255 return serviceApi == null? Boolean.FALSE: serviceApi;
258 public void setServiceApi(Boolean serviceApi) {
259 setToscaPresentationValue(JsonPresentationFields.SERVICE_API, serviceApi);
262 public ArtifactGroupTypeEnum getArtifactGroupType() {
263 ArtifactGroupTypeEnum artifactGroupType = null;
264 String groupType = (String) getToscaPresentationValue(JsonPresentationFields.ARTIFACT_GROUP_TYPE);
265 if (groupType != null && !groupType.isEmpty()) {
267 artifactGroupType = ArtifactGroupTypeEnum.findType(groupType);
269 return artifactGroupType;
272 public void setArtifactGroupType(ArtifactGroupTypeEnum artifactGroupType) {
273 if(artifactGroupType != null)
274 setToscaPresentationValue(JsonPresentationFields.ARTIFACT_GROUP_TYPE, artifactGroupType.getType());
277 public Integer getTimeout() {
278 return (Integer) getToscaPresentationValue(JsonPresentationFields.ARTIFACT_TIMEOUT);
281 public void setTimeout(Integer timeout) {
282 setToscaPresentationValue(JsonPresentationFields.ARTIFACT_TIMEOUT, timeout);
285 public String getArtifactVersion() {
286 return (String) getToscaPresentationValue(JsonPresentationFields.ARTIFACT_VERSION);
289 public void setArtifactVersion(String artifactVersion) {
290 setToscaPresentationValue(JsonPresentationFields.ARTIFACT_VERSION, artifactVersion);
293 public String getArtifactUUID() {
294 return (String) getToscaPresentationValue(JsonPresentationFields.ARTIFACT_UUID);
297 public void setArtifactUUID(String artifactUUID) {
298 setToscaPresentationValue(JsonPresentationFields.ARTIFACT_UUID, artifactUUID);
301 public Long getPayloadUpdateDate() {
302 return (Long) getToscaPresentationValue(JsonPresentationFields.PAYLOAD_UPDATE_DATE);
305 public void setPayloadUpdateDate(Long payloadUpdateDate) {
306 setToscaPresentationValue(JsonPresentationFields.PAYLOAD_UPDATE_DATE, payloadUpdateDate);
309 public Long getHeatParamsUpdateDate() {
310 return (Long) getToscaPresentationValue(JsonPresentationFields.HEAT_PARAMS_UPDATE_DATE);
313 public void setHeatParamsUpdateDate(Long heatParamsUpdateDate) {
314 setToscaPresentationValue(JsonPresentationFields.HEAT_PARAMS_UPDATE_DATE, heatParamsUpdateDate);
317 public List<String> getRequiredArtifacts() {
318 return (List<String>) getToscaPresentationValue(JsonPresentationFields.REQUIRED_ARTIFACTS);
321 public void setRequiredArtifacts(List<String> requiredArtifacts) {
322 setToscaPresentationValue(JsonPresentationFields.REQUIRED_ARTIFACTS, requiredArtifacts);
325 public Boolean getGenerated() {
326 Boolean generated = (Boolean) getToscaPresentationValue(JsonPresentationFields.GENERATED);
327 return generated == null ? Boolean.FALSE: generated;
330 public void setGenerated(Boolean generated) {
331 setToscaPresentationValue(JsonPresentationFields.GENERATED, generated);
334 public Boolean getDuplicated() {
335 Boolean duplicated = (Boolean) getToscaPresentationValue(JsonPresentationFields.DUPLICATED);
336 return duplicated == null ? Boolean.FALSE: duplicated;
339 public void setDuplicated(Boolean duplicated) {
340 setToscaPresentationValue(JsonPresentationFields.DUPLICATED, duplicated);
343 public List<HeatParameterDataDefinition> getHeatParameters() {
344 return (List<HeatParameterDataDefinition>) getToscaPresentationValue(JsonPresentationFields.HEAT_PARAMETERS);
347 public void setHeatParameters(List<HeatParameterDataDefinition> properties) {
348 setToscaPresentationValue(JsonPresentationFields.HEAT_PARAMETERS, properties);
351 public String getGeneratedFromId() {
352 return (String) getToscaPresentationValue(JsonPresentationFields.GENERATED_FROM_ID);
354 public boolean getIsFromCsar(){
355 Boolean isFromCsar = (Boolean) getToscaPresentationValue(JsonPresentationFields.IS_FROM_CSAR);
356 return isFromCsar == null ? Boolean.FALSE: isFromCsar;
358 public void setIsFromCsar(Boolean isFromCsar) {
359 setToscaPresentationValue(JsonPresentationFields.IS_FROM_CSAR, isFromCsar);
362 public void setGeneratedFromId(String generatedFromId) {
363 setToscaPresentationValue(JsonPresentationFields.GENERATED_FROM_ID, generatedFromId);
368 public String toString() {
369 return "ArtifactDataDefinition [uniqueId=" + getUniqueId() + ", artifactType=" + getArtifactType() + ", artifactRef=" + getArtifactRef() + ", artifactName=" + getArtifactName() + ", artifactRepository=" + getArtifactRepository() + ", artifactChecksum="
370 + getArtifactChecksum() + ", userIdCreator=" + getUserIdCreator() + ", userIdLastUpdater=" + getUserIdLastUpdater() + ", creatorFullName=" + getCreatorFullName() + ", updaterFullName=" + getUpdaterFullName() + ", creationDate=" + getCreationDate()
371 + ", lastUpdateDate=" + getLastUpdateDate() + ", esId=" + getEsId() + ", artifactLabel=" + getArtifactLabel() + ", artifactCreator=" + getArtifactCreator() + ", description=" + getDescription() + ", mandatory=" + getMandatory() + ", artifactDisplayName="
372 + getArtifactDisplayName() + ", apiUrl=" + getApiUrl() + ", serviceApi=" + getServiceApi() + ", artifactGroupType=" + getArtifactGroupType() + ", timeout=" + getTimeout() + ", artifactVersion=" + getArtifactVersion() + ", artifactUUID=" + getArtifactUUID()
373 + ", payloadUpdateDate=" + getPayloadUpdateDate() + ", heatParamsUpdateDate=" + getHeatParamsUpdateDate() + ", requiredArtifacts=" + getRequiredArtifacts() + "]";
377 public int hashCode() {
378 final int prime = 31;
381 String apiUrl = getApiUrl();
382 String artifactChecksum = getArtifactChecksum();
383 String artifactCreator = getArtifactCreator();
384 String artifactDisplayName = getArtifactDisplayName();
385 ArtifactGroupTypeEnum artifactGroupType = getArtifactGroupType();
386 String artifactLabel = getArtifactLabel();
387 String artifactName = getArtifactName();
388 String artifactRef = getArtifactRef();
389 String artifactRepository = getArtifactRepository();
390 String artifactType = getArtifactType();
392 String artifactUUID = getArtifactUUID();
393 String artifactVersion = getArtifactVersion();
394 String userIdCreator = getUserIdCreator();
395 String userIdLastUpdater = getUserIdLastUpdater();
396 Long creationDate = getCreationDate();
398 String creatorFullName = getCreatorFullName();
399 String description = getDescription();
400 String esId = getEsId();
401 Long heatParamsUpdateDate = getHeatParamsUpdateDate();
402 Long lastUpdateDate = getLastUpdateDate();
403 Boolean mandatory = getMandatory();
405 Long payloadUpdateDate = getPayloadUpdateDate();
406 List<String> requiredArtifacts = getRequiredArtifacts();
407 Boolean serviceApi = getServiceApi();
408 Integer timeout = getTimeout();
409 String uniqueId = getUniqueId();
410 String updaterFullName = getUpdaterFullName();
412 result = prime * result + ((apiUrl == null) ? 0 : apiUrl.hashCode());
413 result = prime * result + ((artifactChecksum == null) ? 0 : artifactChecksum.hashCode());
414 result = prime * result + ((artifactCreator == null) ? 0 : artifactCreator.hashCode());
415 result = prime * result + ((artifactDisplayName == null) ? 0 : artifactDisplayName.hashCode());
416 result = prime * result + ((artifactGroupType == null) ? 0 : artifactGroupType.hashCode());
417 result = prime * result + ((artifactLabel == null) ? 0 : artifactLabel.hashCode());
418 result = prime * result + ((artifactName == null) ? 0 : artifactName.hashCode());
419 result = prime * result + ((artifactRef == null) ? 0 : artifactRef.hashCode());
420 result = prime * result + ((artifactRepository == null) ? 0 : artifactRepository.hashCode());
421 result = prime * result + ((artifactType == null) ? 0 : artifactType.hashCode());
422 result = prime * result + ((artifactUUID == null) ? 0 : artifactUUID.hashCode());
423 result = prime * result + ((artifactVersion == null) ? 0 : artifactVersion.hashCode());
424 result = prime * result + ((userIdCreator == null) ? 0 : userIdCreator.hashCode());
425 result = prime * result + ((userIdLastUpdater == null) ? 0 : userIdLastUpdater.hashCode());
426 result = prime * result + ((creationDate == null) ? 0 : creationDate.hashCode());
427 result = prime * result + ((creatorFullName == null) ? 0 : creatorFullName.hashCode());
428 result = prime * result + ((description == null) ? 0 : description.hashCode());
429 result = prime * result + ((esId == null) ? 0 : esId.hashCode());
430 result = prime * result + ((heatParamsUpdateDate == null) ? 0 : heatParamsUpdateDate.hashCode());
431 result = prime * result + ((lastUpdateDate == null) ? 0 : lastUpdateDate.hashCode());
432 result = prime * result + ((mandatory == null) ? 0 : mandatory.hashCode());
433 result = prime * result + ((payloadUpdateDate == null) ? 0 : payloadUpdateDate.hashCode());
434 result = prime * result + ((requiredArtifacts == null) ? 0 : requiredArtifacts.hashCode());
435 result = prime * result + ((serviceApi == null) ? 0 : serviceApi.hashCode());
436 result = prime * result + ((timeout == null) ? 0 : timeout.hashCode());
437 result = prime * result + ((uniqueId == null) ? 0 : uniqueId.hashCode());
438 result = prime * result + ((updaterFullName == null) ? 0 : updaterFullName.hashCode());
443 public boolean equals(Object obj) {
448 if (getClass() != obj.getClass())
450 ArtifactDataDefinition other = (ArtifactDataDefinition) obj;
451 if (getApiUrl() == null) {
452 if (other.getApiUrl() != null)
454 } else if (!getApiUrl().equals(other.getApiUrl()))
456 if (getArtifactChecksum() == null) {
457 if (other.getArtifactChecksum() != null)
459 } else if (!getArtifactChecksum().equals(other.getArtifactChecksum()))
461 if (getArtifactCreator() == null) {
462 if (other.getArtifactCreator() != null)
464 } else if (!getArtifactCreator().equals(other.getArtifactCreator()))
466 if (getArtifactDisplayName() == null) {
467 if (other.getArtifactDisplayName() != null)
469 } else if (!getArtifactDisplayName().equals(other.getArtifactDisplayName()))
471 if (getArtifactGroupType() != other.getArtifactGroupType())
473 if (getArtifactLabel() == null) {
474 if (other.getArtifactLabel() != null)
476 } else if (!getArtifactLabel().equals(other.getArtifactLabel()))
478 if (getArtifactName() == null) {
479 if (other.getArtifactName() != null)
481 } else if (!getArtifactName().equals(other.getArtifactName()))
483 if (getArtifactRef() == null) {
484 if (other.getArtifactRef() != null)
486 } else if (!getArtifactRef().equals(other.getArtifactRef()))
488 if (getArtifactRepository() == null) {
489 if (other.getArtifactRepository() != null)
491 } else if (!getArtifactRepository().equals(other.getArtifactRepository()))
493 if (getArtifactType() == null) {
494 if (other.getArtifactType() != null)
496 } else if (!getArtifactType().equals(other.getArtifactType()))
498 if (getArtifactUUID() == null) {
499 if (other.getArtifactUUID() != null)
501 } else if (!getArtifactUUID().equals(other.getArtifactUUID()))
503 if (getArtifactVersion() == null) {
504 if (other.getArtifactVersion() != null)
506 } else if (!getArtifactVersion().equals(other.getArtifactVersion()))
508 if (getUserIdCreator() == null) {
509 if (other.getUserIdCreator() != null)
511 } else if (!getUserIdCreator().equals(other.getUserIdCreator()))
513 if (getUserIdLastUpdater() == null) {
514 if (other.getUserIdLastUpdater() != null)
516 } else if (!getUserIdLastUpdater().equals(other.getUserIdLastUpdater()))
518 if (getCreationDate() == null) {
519 if (other.getCreationDate() != null)
521 } else if (!getCreationDate().equals(other.getCreationDate()))
523 if (getCreatorFullName() == null) {
524 if (other.getCreatorFullName() != null)
526 } else if (!getCreatorFullName().equals(other.getCreatorFullName()))
528 if (getDescription() == null) {
529 if (other.getDescription() != null)
531 } else if (!getDescription().equals(other.getDescription()))
533 if (getEsId() == null) {
534 if (other.getEsId() != null)
536 } else if (!getEsId().equals(other.getEsId()))
538 if (getHeatParamsUpdateDate() == null) {
539 if (other.getHeatParamsUpdateDate() != null)
541 } else if (!getHeatParamsUpdateDate().equals(other.getHeatParamsUpdateDate()))
543 if (getLastUpdateDate() == null) {
544 if (other.getLastUpdateDate() != null)
546 } else if (!getLastUpdateDate().equals(other.getLastUpdateDate()))
548 if (getMandatory() == null) {
549 if (other.getMandatory() != null)
551 } else if (!getMandatory().equals(other.getMandatory()))
553 if (getPayloadUpdateDate() == null) {
554 if (other.getPayloadUpdateDate() != null)
556 } else if (!getPayloadUpdateDate().equals(other.getPayloadUpdateDate()))
558 if (getRequiredArtifacts() == null) {
559 if (other.getRequiredArtifacts() != null)
561 } else if (!getRequiredArtifacts().equals(other.getRequiredArtifacts()))
563 if (getServiceApi() == null) {
564 if (other.getServiceApi() != null)
566 } else if (!getServiceApi().equals(other.getServiceApi()))
568 if (getTimeout() == null) {
569 if (other.getTimeout() != null)
571 } else if (!getTimeout().equals(other.getTimeout()))
573 if (getUniqueId() == null) {
574 if (other.getUniqueId() != null)
576 } else if (!getUniqueId().equals(other.getUniqueId()))
578 if (getUpdaterFullName() == null) {
579 if (other.getUpdaterFullName() != null)
581 } else if (!getUpdaterFullName().equals(other.getUpdaterFullName()))