diff options
Diffstat (limited to 'openecomp-be/lib/openecomp-sdc-action-lib/openecomp-sdc-action-api/src/main/java/org/openecomp/sdc/action/types')
8 files changed, 741 insertions, 0 deletions
diff --git a/openecomp-be/lib/openecomp-sdc-action-lib/openecomp-sdc-action-api/src/main/java/org/openecomp/sdc/action/types/Action.java b/openecomp-be/lib/openecomp-sdc-action-lib/openecomp-sdc-action-api/src/main/java/org/openecomp/sdc/action/types/Action.java new file mode 100644 index 0000000000..176d443a81 --- /dev/null +++ b/openecomp-be/lib/openecomp-sdc-action-lib/openecomp-sdc-action-api/src/main/java/org/openecomp/sdc/action/types/Action.java @@ -0,0 +1,255 @@ +/*- + * ============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.openecomp.sdc.action.types; + +import org.openecomp.sdc.action.ActionConstants; +import org.openecomp.sdc.action.dao.types.ActionEntity; +import org.openecomp.sdc.versioning.dao.types.Version; + +import java.util.ArrayList; +import java.util.Date; +import java.util.HashMap; +import java.util.List; + +public class Action implements Comparable { + private String actionUuId; + private String actionInvariantUuId; + private String version; + private ActionStatus status; + private String name; + private String displayName; + private String endpointUri; + private List<String> vendorList; + private List<String> categoryList; + private Date timestamp; + private String user; + private List<HashMap<String, String>> supportedModels; + private List<HashMap<String, String>> supportedComponents; + //private List<HashMap<String,String>> artifacts; + private List<ActionArtifact> artifacts; + private String data; + + public Action() { + } + + /** + * Instantiates a new Action. + * + * @param action the action + */ + public Action(Action action) { + this.actionUuId = action.getActionUuId(); + this.actionInvariantUuId = action.getActionInvariantUuId(); + this.name = action.getName(); + this.setDisplayName(action.getDisplayName()); + this.setVendorList(action.getVendorList()); + this.setCategoryList(action.getCategoryList()); + this.setTimestamp(action.getTimestamp()); + this.setUser(action.getUser()); + this.version = action.getVersion(); + this.status = action.getStatus(); + this.data = action.getData(); + this.supportedComponents = action.getSupportedComponents(); + this.supportedModels = action.getSupportedModels(); + this.artifacts = action.getArtifacts(); + } + + public String getActionUuId() { + return actionUuId; + } + + public void setActionUuId(String actionUuId) { + this.actionUuId = actionUuId; + } + + public String getActionInvariantUuId() { + return actionInvariantUuId; + } + + public void setActionInvariantUuId(String actionInvariantUuId) { + this.actionInvariantUuId = actionInvariantUuId; + } + + public String getVersion() { + return version; + } + + public void setVersion(String version) { + this.version = version; + } + + public ActionStatus getStatus() { + return status; + } + + public void setStatus(ActionStatus status) { + this.status = status; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String getDisplayName() { + return displayName; + } + + public void setDisplayName(String displayName) { + this.displayName = displayName; + } + + public String getEndpointUri() { + return endpointUri; + } + + public void setEndpointUri(String endpointUri) { + this.endpointUri = endpointUri; + } + + public List<String> getVendorList() { + return vendorList; + } + + public void setVendorList(List<String> vendorList) { + this.vendorList = vendorList; + } + + public List<String> getCategoryList() { + return categoryList; + } + + public void setCategoryList(List<String> categoryList) { + this.categoryList = categoryList; + } + + public Date getTimestamp() { + return timestamp; + } + + public void setTimestamp(Date timestamp) { + this.timestamp = timestamp; + } + + public String getUser() { + return user; + } + + public void setUser(String user) { + this.user = user; + } + + public List<HashMap<String, String>> getSupportedModels() { + return supportedModels; + } + + public void setSupportedModels(List<HashMap<String, String>> supportedModels) { + this.supportedModels = supportedModels; + } + + public List<HashMap<String, String>> getSupportedComponents() { + return supportedComponents; + } + + public void setSupportedComponents(List<HashMap<String, String>> supportedComponents) { + this.supportedComponents = supportedComponents; + } + + public List<ActionArtifact> getArtifacts() { + return artifacts; + } + + public void setArtifacts(List<ActionArtifact> artifacts) { + this.artifacts = artifacts; + } + + public String getData() { + return data; + } + + public void setData(String data) { + this.data = data; + } + + /** + * To entity action entity. + * + * @return the action entity + */ + public ActionEntity toEntity() { + ActionEntity destination = new ActionEntity(); + + destination + .setActionUuId(this.getActionUuId() != null ? this.getActionUuId().toUpperCase() : null); + destination.setActionInvariantUuId( + this.getActionInvariantUuId() != null ? this.getActionInvariantUuId().toUpperCase() : null); + destination.setName(this.getName() != null ? this.getName().toLowerCase() : null); + destination.setVendorList(this.getVendorList()); + destination.setCategoryList(this.getCategoryList()); + destination.setTimestamp(this.getTimestamp()); + destination.setUser(this.getUser()); + destination.setVersion(Version.valueOf(this.getVersion())); + if (this.getStatus() != null) { + destination.setStatus(this.getStatus().name()); + } + destination.setSupportedComponents( + getIdFromMap(this.getSupportedComponents(), ActionConstants.SUPPORTED_COMPONENTS_ID)); + destination.setSupportedModels( + getIdFromMap(this.getSupportedModels(), ActionConstants.SUPPORTED_MODELS_VERSION_ID)); + destination.setData(this.getData()); + return destination; + } + + private List<String> getIdFromMap(List<HashMap<String, String>> map, String idName) { + List<String> list = new ArrayList<>(); + if (map != null && !map.isEmpty()) { + map.forEach(entry -> { + if (entry.containsKey(idName)) { + list.add(entry.get(idName) != null ? entry.get(idName).toLowerCase() : null); + } + }); + return list; + } + return null; + } + + @Override + public int compareTo(Object object) { + Action obj = (Action) object; + Version thisVersion = Version.valueOf(this.version); + Version objVersion = Version.valueOf(obj.getVersion()); + if (obj.getName().compareTo(this.getName()) == 0) { + return compareVersions(objVersion, thisVersion); + } + return obj.getName().compareTo(this.getName()); + } + + private int compareVersions(Version objVersion, Version thisVersion) { + if (objVersion.getMajor() == thisVersion.getMajor()) { + return Integer.compare(objVersion.getMinor(), thisVersion.getMinor()); + } + return Integer.compare(objVersion.getMajor(), thisVersion.getMajor()); + } + +} diff --git a/openecomp-be/lib/openecomp-sdc-action-lib/openecomp-sdc-action-api/src/main/java/org/openecomp/sdc/action/types/ActionArtifact.java b/openecomp-be/lib/openecomp-sdc-action-lib/openecomp-sdc-action-api/src/main/java/org/openecomp/sdc/action/types/ActionArtifact.java new file mode 100644 index 0000000000..ef41673541 --- /dev/null +++ b/openecomp-be/lib/openecomp-sdc-action-lib/openecomp-sdc-action-api/src/main/java/org/openecomp/sdc/action/types/ActionArtifact.java @@ -0,0 +1,139 @@ +/*- + * ============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.openecomp.sdc.action.types; + +import com.fasterxml.jackson.annotation.JsonIgnore; +import org.openecomp.sdc.action.dao.types.ActionArtifactEntity; + +import java.nio.ByteBuffer; +import java.util.Date; + +public class ActionArtifact { + private String artifactUuId; + + @JsonIgnore + private Integer effectiveVersion; + + private String artifactName; + private String artifactLabel; + private String artifactCategory; + private String artifactDescription; + private String artifactProtection; + private Date timestamp; + private byte[] artifact; + + public String getArtifactUuId() { + return artifactUuId; + } + + public void setArtifactUuId(String artifactUuId) { + this.artifactUuId = artifactUuId; + } + + public Integer getEffectiveVersion() { + return effectiveVersion; + } + + public void setEffectiveVersion(Integer effectiveVersion) { + this.effectiveVersion = effectiveVersion; + } + + public String getArtifactName() { + return artifactName; + } + + public void setArtifactName(String artifactName) { + this.artifactName = artifactName; + } + + public String getArtifactLabel() { + return artifactLabel; + } + + public void setArtifactLabel(String artifactLabel) { + this.artifactLabel = artifactLabel; + } + + public String getArtifactCategory() { + return artifactCategory; + } + + public void setArtifactCategory(String artifactCategory) { + this.artifactCategory = artifactCategory; + } + + public String getArtifactDescription() { + return artifactDescription; + } + + public void setArtifactDescription(String artifactDescription) { + this.artifactDescription = artifactDescription; + } + + public String getArtifactProtection() { + return artifactProtection; + } + + public void setArtifactProtection(String artifactProtection) { + this.artifactProtection = artifactProtection; + } + + public Date getTimestamp() { + return timestamp; + } + + public void setTimestamp(Date timestamp) { + this.timestamp = timestamp; + } + + public byte[] getArtifact() { + return artifact; + } + + public void setArtifact(byte[] artifact) { + this.artifact = artifact; + } + + /** + * To entity action artifact entity. + * + * @return the action artifact entity + */ + public ActionArtifactEntity toEntity() { + ActionArtifactEntity destination = new ActionArtifactEntity(); + destination.setArtifactUuId(this.getArtifactUuId()); + destination.setEffectiveVersion(this.getEffectiveVersion()); + destination.setArtifact(ByteBuffer.wrap(this.getArtifact())); + + return destination; + } + + @Override + public boolean equals(Object obj) { + if (obj instanceof ActionArtifact) { + ActionArtifact temp = (ActionArtifact) obj; + if (artifactUuId.equals(temp.getArtifactUuId())) { + return true; + } + } + return false; + } +} diff --git a/openecomp-be/lib/openecomp-sdc-action-lib/openecomp-sdc-action-api/src/main/java/org/openecomp/sdc/action/types/ActionArtifactProtection.java b/openecomp-be/lib/openecomp-sdc-action-lib/openecomp-sdc-action-api/src/main/java/org/openecomp/sdc/action/types/ActionArtifactProtection.java new file mode 100644 index 0000000000..636f24d781 --- /dev/null +++ b/openecomp-be/lib/openecomp-sdc-action-lib/openecomp-sdc-action-api/src/main/java/org/openecomp/sdc/action/types/ActionArtifactProtection.java @@ -0,0 +1,26 @@ +/*- + * ============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.openecomp.sdc.action.types; + +public enum ActionArtifactProtection { + readOnly, + readWrite +} diff --git a/openecomp-be/lib/openecomp-sdc-action-lib/openecomp-sdc-action-api/src/main/java/org/openecomp/sdc/action/types/ActionLogResponseCode.java b/openecomp-be/lib/openecomp-sdc-action-lib/openecomp-sdc-action-api/src/main/java/org/openecomp/sdc/action/types/ActionLogResponseCode.java new file mode 100644 index 0000000000..c3de8aa4dc --- /dev/null +++ b/openecomp-be/lib/openecomp-sdc-action-lib/openecomp-sdc-action-api/src/main/java/org/openecomp/sdc/action/types/ActionLogResponseCode.java @@ -0,0 +1,90 @@ +/*- + * ============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.openecomp.sdc.action.types; + +import java.util.HashMap; +import java.util.Map; + +public enum ActionLogResponseCode { + + MISSING_AUTHORIZATION(100), + FORBIDDEN(101), + UPDATE_ON_LOCKED_ENTITY(102), + CHECKIN_ON_LOCKED_ENTITY_OTHER_USER(103), + CHECKOUT_ON_LOCKED_ENTITY(104), + UNDO_CHECKOUT_ON_LOCKED_ENTITY(105), + DELETE_ARTIFACT_ON_LOCKED_ENTITY(106), + DELETE_ON_LOCKED_ENTITY_OTHER_USER(107), + INTERNAL_SERVER_ERROR(201), + MISSING_MANDATORY_PARAMS(300), + MISSING_INSTANCE_ID_HEADER(301), + MISSING_REQUEST_ID_HEADER(302), + MISSING_REQUEST_BODY(303), + INVALID_SEARCH_FILTER_CRITERIA(304), + INVALID_REQUESTED_VERSION(305), + CHECKSUM_ERROR(306), + ARTIFACT_TOO_BIG(307), + ACTION_NOT_FOUND(308), + ARTIFACT_NOT_FOUND(309), + METHOD_NOT_ALLOWED(310), + INVALID_REQUEST_PARAM(311), + ARTIFACT_PROTECTION_INVALID(312), + ACTION_NAME_UPDATE_NOT_ALLOWED(501), + //METHOD_NOT_ALLOWED(502), + ACTION_NAME_ALREADY_EXISTS(503), + MULTIPLE_FILTER_CRITERIA_NOT_SUPPORTED(504), + UPDATE_ON_UNLOCKED_ENTITY(505), + UPDATE_NOT_ALLOWED(506), + //METHOD_NOT_ALLOWED(507), + CHECKIN_ON_UNLOCKED_ENTITY(508), + SUBMIT_ON_FINAL_ENTITY(509), + SUBMIT_ON_LOCKED_ENTITY_OTHER_USER(510), + UNDO_CHECKOUT_ON_UNLOCKED_ENTITY(511), + ACTION_NOT_LOCKED(512), + ARTIFACT_ALREADY_EXISTS(513), + ARTIFACT_UPDATE_READ_ONLY(514), + ARTIFACT_DELETE_READ_ONLY(515), + ARTIFACT_NAME_INVALID(516), + ARTIFACT_CREATE_UPDATE_NOT_ALLOWED(518), + QUERY_FAILURE(519); + + private static Map<Integer, ActionLogResponseCode> mapValueToEnum = new HashMap<>(); + + static { + for (ActionLogResponseCode responseCode : ActionLogResponseCode.values()) { + mapValueToEnum.put(responseCode.value, responseCode); + } + } + + private int value; + + ActionLogResponseCode(int value) { + this.value = value; + } + + public static ActionLogResponseCode parseValue(int value) { + return mapValueToEnum.get(value); + } + + public int getValue() { + return value; + } +} diff --git a/openecomp-be/lib/openecomp-sdc-action-lib/openecomp-sdc-action-api/src/main/java/org/openecomp/sdc/action/types/ActionRequest.java b/openecomp-be/lib/openecomp-sdc-action-lib/openecomp-sdc-action-api/src/main/java/org/openecomp/sdc/action/types/ActionRequest.java new file mode 100644 index 0000000000..1a20f9ecb7 --- /dev/null +++ b/openecomp-be/lib/openecomp-sdc-action-lib/openecomp-sdc-action-api/src/main/java/org/openecomp/sdc/action/types/ActionRequest.java @@ -0,0 +1,40 @@ +/*- + * ============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.openecomp.sdc.action.types; + +public enum ActionRequest { + CREATE_ACTION, + UPDATE_ACTION, + DELETE_ACTION, + GET_FILTERED_ACTIONS, + GET_ACTIONS_INVARIANT_ID, + GET_ECOMP_COMPONENTS, + ACTION_VERSIONING, + CHECKOUT_ACTION, + CHECKIN_ACTION, + SUBMIT_ACTION, + UNDO_CHECKOUT_ACTION, + UPLOAD_ARTIFACT, + DOWNLOAD_ARTIFACT, + UPDATE_ARTIFACT, + DELETE_ARTIFACT, + GET_ACTION_UUID +} diff --git a/openecomp-be/lib/openecomp-sdc-action-lib/openecomp-sdc-action-api/src/main/java/org/openecomp/sdc/action/types/ActionStatus.java b/openecomp-be/lib/openecomp-sdc-action-lib/openecomp-sdc-action-api/src/main/java/org/openecomp/sdc/action/types/ActionStatus.java new file mode 100644 index 0000000000..af3516e1eb --- /dev/null +++ b/openecomp-be/lib/openecomp-sdc-action-lib/openecomp-sdc-action-api/src/main/java/org/openecomp/sdc/action/types/ActionStatus.java @@ -0,0 +1,28 @@ +/*- + * ============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.openecomp.sdc.action.types; + +public enum ActionStatus { + Locked, + Available, + Final, + Deleted +} diff --git a/openecomp-be/lib/openecomp-sdc-action-lib/openecomp-sdc-action-api/src/main/java/org/openecomp/sdc/action/types/ActionSubOperation.java b/openecomp-be/lib/openecomp-sdc-action-lib/openecomp-sdc-action-api/src/main/java/org/openecomp/sdc/action/types/ActionSubOperation.java new file mode 100644 index 0000000000..0dd97e6646 --- /dev/null +++ b/openecomp-be/lib/openecomp-sdc-action-lib/openecomp-sdc-action-api/src/main/java/org/openecomp/sdc/action/types/ActionSubOperation.java @@ -0,0 +1,59 @@ +/*- + * ============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.openecomp.sdc.action.types; + +public enum ActionSubOperation { + //Versioning operations + CREATE_ACTION_VERSION, + CREATE_ACTION_UNIQUE_VALUE, + GET_ACTION_VERSION, + //Action DAO operations + CREATE_ACTION_ENTITY, + GET_ACTIONENTITY_BY_ACTIONINVID, + GET_ACTIONENTITY_BY_ACTIONUUID, + GET_ACTIONENTITY_BY_VENDOR, + GET_ACTIONENTITY_BY_CATEGORY, + GET_ACTIONENTITY_BY_MODEL, + GET_ACTIONENTITY_BY_COMPONENT, + GET_ACTIONENTITY_BY_VERSION, + GET_ALL_ACTIONS, + GET_ACTIONINVID_BY_NAME, + GET_ECOMP_COMPONENTS_ENTITY, + GET_VERSIONINFO_FOR_ALL_ACTIONS, + GET_NAME_BY_ACTIONINVID, + CHECKOUT_ACTION, + UNDO_CHECKOUT_ACTION, + CHECKIN_ACTION, + SUBMIT_ACTION, + UPDATE_ACTION, + UPDATE_ACTION_STATUS, + DELETE_UNIQUEVALUE, + DELETE_ACTIONVERSION, + DELETE_ARTIFACT, + DELETE_ACTION, + //Validations + VALIDATE_ACTION_UNIQUE_NAME, + //Artifacts + GET_ARTIFACT_BY_ARTIFACTUUID, + CREATE_ACTION_ARTIFACT, + UPDATE_ACTION_ARTIFACT, + DELETE_ACTION_ARTIFACT, +} diff --git a/openecomp-be/lib/openecomp-sdc-action-lib/openecomp-sdc-action-api/src/main/java/org/openecomp/sdc/action/types/EcompComponent.java b/openecomp-be/lib/openecomp-sdc-action-lib/openecomp-sdc-action-api/src/main/java/org/openecomp/sdc/action/types/EcompComponent.java new file mode 100644 index 0000000000..cbcebb13ef --- /dev/null +++ b/openecomp-be/lib/openecomp-sdc-action-lib/openecomp-sdc-action-api/src/main/java/org/openecomp/sdc/action/types/EcompComponent.java @@ -0,0 +1,104 @@ +/*- + * ============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.openecomp.sdc.action.types; + +import org.openecomp.sdc.action.dao.types.EcompComponentEntity; + +public class EcompComponent { + + private String id; + private String name; + + public EcompComponent() { + //Default constructor + } + + public EcompComponent(String name, String id) { + this.name = name; + this.id = id; + } + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + /** + * To entity ecomp component entity. + * + * @return the ecomp component entity + */ + public EcompComponentEntity toEntity() { + EcompComponentEntity destination = new EcompComponentEntity(); + destination.setId(this.getId()); + destination.setName(this.getName()); + return destination; + } + + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + ((id == null) ? 0 : id.hashCode()); + result = prime * result + ((name == null) ? 0 : name.hashCode()); + return result; + } + + @Override + public boolean equals(Object object) { + if (this == object) { + return true; + } + if (object == null) { + return false; + } + if (this.getClass() != object.getClass()) { + return false; + } + EcompComponent obj = (EcompComponent) object; + if (id == null) { + if (obj.id != null) { + return false; + } + } else if (!id.equals(obj.id)) { + return false; + } + if (name == null) { + if (obj.name != null) { + return false; + } + } else if (!name.equals(obj.name)) { + return false; + } + return true; + } +} |