diff options
author | sebdet <sebastien.determe@intl.att.com> | 2019-08-06 15:31:50 +0200 |
---|---|---|
committer | sebdet <sebastien.determe@intl.att.com> | 2019-08-06 15:32:38 +0200 |
commit | 0cbc4e3d137c05ae694cccdb7adfe9e4e4fcdc50 (patch) | |
tree | d6451179eadc183d43901d483ff23dba260495b6 /src/main | |
parent | 12687d3e4f4f785074615cdc95b707f1192853f0 (diff) |
Remove checkstyle issues
Remove checkstyle issues added during previous merge
Issue-ID: CLAMP-465
Change-Id: Iec78a64c01de6cc1405fccd7406ef38b06e61545
Signed-off-by: sebdet <sebastien.determe@intl.att.com>
Diffstat (limited to 'src/main')
10 files changed, 1427 insertions, 1427 deletions
diff --git a/src/main/java/org/onap/clamp/clds/model/CldsDictionary.java b/src/main/java/org/onap/clamp/clds/model/CldsDictionary.java index a696494e5..27a430c7c 100644 --- a/src/main/java/org/onap/clamp/clds/model/CldsDictionary.java +++ b/src/main/java/org/onap/clamp/clds/model/CldsDictionary.java @@ -36,153 +36,153 @@ import com.google.gson.annotations.Expose; public class CldsDictionary { - @Expose - private String dictionaryId; - @Expose - private String dictionaryName; - - @Expose - private String createdBy; - @Expose - private String updatedBy; - @Expose - private String lastUpdatedDate; - @Expose - private List<CldsDictionaryItem> cldsDictionaryItems = new ArrayList<>(); - - /** - * Creates or updates dictionary item for a dictionary in DB. - * - * @param dictionaryName The dictionary name - * @param cldsDao The CldsDao - * @param userId The user ID - */ - public void save(String dictionaryName, CldsDao cldsDao, String userId) { - List<CldsDictionary> list = cldsDao.getDictionary(this.getDictionaryId(), dictionaryName); - if (list != null && !list.isEmpty()) { - CldsDictionary cldsDictionary = list.stream().findFirst().get(); - if (!cldsDictionary.getDictionaryName().equalsIgnoreCase(this.getDictionaryName())) { - cldsDao.updateDictionary(cldsDictionary.getDictionaryId(), this, userId); - this.setCreatedBy(cldsDictionary.getCreatedBy()); - } else { - this.setDictionaryId(cldsDictionary.getDictionaryId()); - this.setCreatedBy(cldsDictionary.getCreatedBy()); - this.setUpdatedBy(cldsDictionary.getUpdatedBy()); - this.setLastUpdatedDate(cldsDictionary.getLastUpdatedDate()); - } - } else { - this.setCreatedBy(userId); - this.setUpdatedBy(userId); - cldsDao.insDictionary(this); - } - } - - /** - * Get the dictionary ID. - * - * @return the dictionaryId - */ - public String getDictionaryId() { - return dictionaryId; - } - - /** - * Set the dictionary Id. - * - * @param dictionaryId the dictionaryId to set - */ - public void setDictionaryId(String dictionaryId) { - this.dictionaryId = dictionaryId; - } - - /** - * Get the dictionary name. - * - * @return the dictionaryName - */ - public String getDictionaryName() { - return dictionaryName; - } - - /** - * Set the dictionary name. - * - * @param dictionaryName the dictionaryName to set - */ - public void setDictionaryName(String dictionaryName) { - this.dictionaryName = dictionaryName; - } - - /** - * Get the createdBy info. - * - * @return the createdBy - */ - public String getCreatedBy() { - return createdBy; - } - - /** - * Set the createdBy info. - * - * @param createdBy the createdBy to set - */ - public void setCreatedBy(String createdBy) { - this.createdBy = createdBy; - } - - /** - * Get the updatedBy info. - * - * @return the updatedBy - */ - public String getUpdatedBy() { - return updatedBy; - } - - /** - * Set the updatedBy info. - * - * @param updatedby the updatedBy to set - */ - public void setUpdatedBy(String updatedby) { - updatedBy = updatedby; - } - - /** - * Get the last updated date. - * - * @return the lastUpdatedDate - */ - public String getLastUpdatedDate() { - return lastUpdatedDate; - } - - /** - * Set the last updated date. - * - * @param lastUpdatedDate the lastUpdatedDate to set - */ - public void setLastUpdatedDate(String lastUpdatedDate) { - this.lastUpdatedDate = lastUpdatedDate; - } - - /** - * Get all the dictionary items. - * - * @return the cldsDictionaryItems - */ - public List<CldsDictionaryItem> getCldsDictionaryItems() { - return cldsDictionaryItems; - } - - /** - * Set the whole dictionary items. - * - * @param cldsDictionaryItems the cldsDictionaryItems to set - */ - public void setCldsDictionaryItems(List<CldsDictionaryItem> cldsDictionaryItems) { - this.cldsDictionaryItems = cldsDictionaryItems; - } + @Expose + private String dictionaryId; + @Expose + private String dictionaryName; + + @Expose + private String createdBy; + @Expose + private String updatedBy; + @Expose + private String lastUpdatedDate; + @Expose + private List<CldsDictionaryItem> cldsDictionaryItems = new ArrayList<>(); + + /** + * Creates or updates dictionary item for a dictionary in DB. + * + * @param dictionaryName The dictionary name + * @param cldsDao The CldsDao + * @param userId The user ID + */ + public void save(String dictionaryName, CldsDao cldsDao, String userId) { + List<CldsDictionary> list = cldsDao.getDictionary(this.getDictionaryId(), dictionaryName); + if (list != null && !list.isEmpty()) { + CldsDictionary cldsDictionary = list.stream().findFirst().get(); + if (!cldsDictionary.getDictionaryName().equalsIgnoreCase(this.getDictionaryName())) { + cldsDao.updateDictionary(cldsDictionary.getDictionaryId(), this, userId); + this.setCreatedBy(cldsDictionary.getCreatedBy()); + } else { + this.setDictionaryId(cldsDictionary.getDictionaryId()); + this.setCreatedBy(cldsDictionary.getCreatedBy()); + this.setUpdatedBy(cldsDictionary.getUpdatedBy()); + this.setLastUpdatedDate(cldsDictionary.getLastUpdatedDate()); + } + } else { + this.setCreatedBy(userId); + this.setUpdatedBy(userId); + cldsDao.insDictionary(this); + } + } + + /** + * Get the dictionary ID. + * + * @return the dictionaryId + */ + public String getDictionaryId() { + return dictionaryId; + } + + /** + * Set the dictionary Id. + * + * @param dictionaryId the dictionaryId to set + */ + public void setDictionaryId(String dictionaryId) { + this.dictionaryId = dictionaryId; + } + + /** + * Get the dictionary name. + * + * @return the dictionaryName + */ + public String getDictionaryName() { + return dictionaryName; + } + + /** + * Set the dictionary name. + * + * @param dictionaryName the dictionaryName to set + */ + public void setDictionaryName(String dictionaryName) { + this.dictionaryName = dictionaryName; + } + + /** + * Get the createdBy info. + * + * @return the createdBy + */ + public String getCreatedBy() { + return createdBy; + } + + /** + * Set the createdBy info. + * + * @param createdBy the createdBy to set + */ + public void setCreatedBy(String createdBy) { + this.createdBy = createdBy; + } + + /** + * Get the updatedBy info. + * + * @return the updatedBy + */ + public String getUpdatedBy() { + return updatedBy; + } + + /** + * Set the updatedBy info. + * + * @param updatedby the updatedBy to set + */ + public void setUpdatedBy(String updatedby) { + updatedBy = updatedby; + } + + /** + * Get the last updated date. + * + * @return the lastUpdatedDate + */ + public String getLastUpdatedDate() { + return lastUpdatedDate; + } + + /** + * Set the last updated date. + * + * @param lastUpdatedDate the lastUpdatedDate to set + */ + public void setLastUpdatedDate(String lastUpdatedDate) { + this.lastUpdatedDate = lastUpdatedDate; + } + + /** + * Get all the dictionary items. + * + * @return the cldsDictionaryItems + */ + public List<CldsDictionaryItem> getCldsDictionaryItems() { + return cldsDictionaryItems; + } + + /** + * Set the whole dictionary items. + * + * @param cldsDictionaryItems the cldsDictionaryItems to set + */ + public void setCldsDictionaryItems(List<CldsDictionaryItem> cldsDictionaryItems) { + this.cldsDictionaryItems = cldsDictionaryItems; + } } diff --git a/src/main/java/org/onap/clamp/clds/model/CldsDictionaryItem.java b/src/main/java/org/onap/clamp/clds/model/CldsDictionaryItem.java index 605ede321..14a68502e 100644 --- a/src/main/java/org/onap/clamp/clds/model/CldsDictionaryItem.java +++ b/src/main/java/org/onap/clamp/clds/model/CldsDictionaryItem.java @@ -23,224 +23,224 @@ package org.onap.clamp.clds.model; +import com.google.gson.annotations.Expose; + import java.util.List; import org.onap.clamp.clds.dao.CldsDao; -import com.google.gson.annotations.Expose; - /** * Represents a CLDS Dictionary Item. */ public class CldsDictionaryItem { - @Expose - private String dictElementId; - @Expose - private String dictionaryId; - @Expose - private String dictElementName; - @Expose - private String dictElementShortName; - @Expose - private String dictElementDesc; - @Expose - private String dictElementType; - @Expose - private String createdBy; - @Expose - private String updatedBy; - @Expose - private String lastUpdatedDate; - - /** - * Save the dictionary item. - * - * @param dictionaryName The name of the dictionary - * @param cldsDao The cldsDao - * @param userId The user id - */ - public void save(String dictionaryName, CldsDao cldsDao, String userId) { - // Check if dictionary exists. - List<CldsDictionary> list = cldsDao.getDictionary(this.getDictionaryId(), dictionaryName); - if (list != null && !list.isEmpty()) { - // Dictionary found. We can add or update the dictionary element - CldsDictionary cldsDictionary = list.stream().findFirst().get(); - List<CldsDictionaryItem> dictionaryItems = cldsDao.getDictionaryElements(dictionaryName, - cldsDictionary.getDictionaryId(), this.getDictElementShortName()); - if (dictionaryItems != null && !dictionaryItems.isEmpty()) { - CldsDictionaryItem item = dictionaryItems.stream().findFirst().get(); - cldsDao.updateDictionaryElements(item.getDictElementId(), this, userId); - this.setCreatedBy(item.getCreatedBy()); - - } else { - this.setCreatedBy(userId); - this.setUpdatedBy(userId); - cldsDao.insDictionarElements(this, userId); - } - } - } - - /** - * Get the dictionary element id. - * - * @return the dictElementId - */ - public String getDictElementId() { - return dictElementId; - } - - /** - * Set the dictionary element id. - * - * @param dictElementId the dictElementId to set - */ - public void setDictElementId(String dictElementId) { - this.dictElementId = dictElementId; - } - - /** - * Get the dictionary id. - * - * @return the dictionaryId - */ - public String getDictionaryId() { - return dictionaryId; - } - - /** - * Set the dictionary id. - * - * @param dictionaryId the dictionaryId to set - */ - public void setDictionaryId(String dictionaryId) { - this.dictionaryId = dictionaryId; - } - - /** - * Get the dictionary name. - * - * @return the dictElementName - */ - public String getDictElementName() { - return dictElementName; - } - - /** - * Set the dictionary name. - * - * @param dictElementName the dictElementName to set - */ - public void setDictElementName(String dictElementName) { - this.dictElementName = dictElementName; - } - - /** - * Get the dictionary element short name. - * - * @return the dictElementShortName - */ - public String getDictElementShortName() { - return dictElementShortName; - } - - /** - * Set the dictionary element short name. - * - * @param dictElementShortName the dictElementShortName to set - */ - public void setDictElementShortName(String dictElementShortName) { - this.dictElementShortName = dictElementShortName; - } - - /** - * Get the dictionary element description. - * - * @return the dictElementDesc - */ - public String getDictElementDesc() { - return dictElementDesc; - } - - /** - * Set the dictionary element description. - * - * @param dictElementDesc the dictElementDesc to set - */ - public void setDictElementDesc(String dictElementDesc) { - this.dictElementDesc = dictElementDesc; - } - - /** - * Get the dictionary element type. - * - * @return the dictElementType - */ - public String getDictElementType() { - return dictElementType; - } - - /** - * Set the dictionary element type. - * - * @param dictElementType the dictElementType to set - */ - public void setDictElementType(String dictElementType) { - this.dictElementType = dictElementType; - } - - /** - * Get the createdBy info. - * - * @return the createdBy - */ - public String getCreatedBy() { - return createdBy; - } - - /** - * Set the createdBy info. - * - * @param createdBy the createdBy to set - */ - public void setCreatedBy(String createdBy) { - this.createdBy = createdBy; - } - - /** - * Get the updatedBy info. - * - * @return the updatedBy - */ - public String getUpdatedBy() { - return updatedBy; - } - - /** - * Set the updatedBy info. - * - * @param updatedby the updatedBy to set - */ - public void setUpdatedBy(String updatedby) { - updatedBy = updatedby; - } - - /** - * Get the last updated date. - * - * @return the lastUpdatedDate - */ - public String getLastUpdatedDate() { - return lastUpdatedDate; - } - - /** - * Set the last updated date. - * - * @param lastUpdatedDate the lastUpdatedDate to set - */ - public void setLastUpdatedDate(String lastUpdatedDate) { - this.lastUpdatedDate = lastUpdatedDate; - } + @Expose + private String dictElementId; + @Expose + private String dictionaryId; + @Expose + private String dictElementName; + @Expose + private String dictElementShortName; + @Expose + private String dictElementDesc; + @Expose + private String dictElementType; + @Expose + private String createdBy; + @Expose + private String updatedBy; + @Expose + private String lastUpdatedDate; + + /** + * Save the dictionary item. + * + * @param dictionaryName The name of the dictionary + * @param cldsDao The cldsDao + * @param userId The user id + */ + public void save(String dictionaryName, CldsDao cldsDao, String userId) { + // Check if dictionary exists. + List<CldsDictionary> list = cldsDao.getDictionary(this.getDictionaryId(), dictionaryName); + if (list != null && !list.isEmpty()) { + // Dictionary found. We can add or update the dictionary element + CldsDictionary cldsDictionary = list.stream().findFirst().get(); + List<CldsDictionaryItem> dictionaryItems = cldsDao.getDictionaryElements(dictionaryName, + cldsDictionary.getDictionaryId(), this.getDictElementShortName()); + if (dictionaryItems != null && !dictionaryItems.isEmpty()) { + CldsDictionaryItem item = dictionaryItems.stream().findFirst().get(); + cldsDao.updateDictionaryElements(item.getDictElementId(), this, userId); + this.setCreatedBy(item.getCreatedBy()); + + } else { + this.setCreatedBy(userId); + this.setUpdatedBy(userId); + cldsDao.insDictionarElements(this, userId); + } + } + } + + /** + * Get the dictionary element id. + * + * @return the dictElementId + */ + public String getDictElementId() { + return dictElementId; + } + + /** + * Set the dictionary element id. + * + * @param dictElementId the dictElementId to set + */ + public void setDictElementId(String dictElementId) { + this.dictElementId = dictElementId; + } + + /** + * Get the dictionary id. + * + * @return the dictionaryId + */ + public String getDictionaryId() { + return dictionaryId; + } + + /** + * Set the dictionary id. + * + * @param dictionaryId the dictionaryId to set + */ + public void setDictionaryId(String dictionaryId) { + this.dictionaryId = dictionaryId; + } + + /** + * Get the dictionary name. + * + * @return the dictElementName + */ + public String getDictElementName() { + return dictElementName; + } + + /** + * Set the dictionary name. + * + * @param dictElementName the dictElementName to set + */ + public void setDictElementName(String dictElementName) { + this.dictElementName = dictElementName; + } + + /** + * Get the dictionary element short name. + * + * @return the dictElementShortName + */ + public String getDictElementShortName() { + return dictElementShortName; + } + + /** + * Set the dictionary element short name. + * + * @param dictElementShortName the dictElementShortName to set + */ + public void setDictElementShortName(String dictElementShortName) { + this.dictElementShortName = dictElementShortName; + } + + /** + * Get the dictionary element description. + * + * @return the dictElementDesc + */ + public String getDictElementDesc() { + return dictElementDesc; + } + + /** + * Set the dictionary element description. + * + * @param dictElementDesc the dictElementDesc to set + */ + public void setDictElementDesc(String dictElementDesc) { + this.dictElementDesc = dictElementDesc; + } + + /** + * Get the dictionary element type. + * + * @return the dictElementType + */ + public String getDictElementType() { + return dictElementType; + } + + /** + * Set the dictionary element type. + * + * @param dictElementType the dictElementType to set + */ + public void setDictElementType(String dictElementType) { + this.dictElementType = dictElementType; + } + + /** + * Get the createdBy info. + * + * @return the createdBy + */ + public String getCreatedBy() { + return createdBy; + } + + /** + * Set the createdBy info. + * + * @param createdBy the createdBy to set + */ + public void setCreatedBy(String createdBy) { + this.createdBy = createdBy; + } + + /** + * Get the updatedBy info. + * + * @return the updatedBy + */ + public String getUpdatedBy() { + return updatedBy; + } + + /** + * Set the updatedBy info. + * + * @param updatedby the updatedBy to set + */ + public void setUpdatedBy(String updatedby) { + updatedBy = updatedby; + } + + /** + * Get the last updated date. + * + * @return the lastUpdatedDate + */ + public String getLastUpdatedDate() { + return lastUpdatedDate; + } + + /** + * Set the last updated date. + * + * @param lastUpdatedDate the lastUpdatedDate to set + */ + public void setLastUpdatedDate(String lastUpdatedDate) { + this.lastUpdatedDate = lastUpdatedDate; + } } diff --git a/src/main/java/org/onap/clamp/clds/model/CldsInfo.java b/src/main/java/org/onap/clamp/clds/model/CldsInfo.java index cf4be7fe1..f3cf6ed19 100644 --- a/src/main/java/org/onap/clamp/clds/model/CldsInfo.java +++ b/src/main/java/org/onap/clamp/clds/model/CldsInfo.java @@ -5,20 +5,20 @@ * 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. + * 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 + * + * 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.onap.clamp.clds.model; @@ -26,85 +26,85 @@ package org.onap.clamp.clds.model; import com.google.gson.annotations.Expose; public class CldsInfo { - @Expose - private String userName; - @Expose - private String cldsVersion; - @Expose - private boolean permissionReadCl; - @Expose - private boolean permissionUpdateCl; - @Expose - private boolean permissionReadTemplate; - @Expose - private boolean permissionUpdateTemplate; - @Expose - private boolean permissionReadTosca; - @Expose - private boolean permissionUpdateTosca; - - public String getUserName() { - return userName; - } - - public void setUserName(String userName) { - this.userName = userName; - } - - public String getCldsVersion() { - return cldsVersion; - } - - public void setCldsVersion(String cldsVersion) { - this.cldsVersion = cldsVersion; - } - - public boolean isPermissionReadCl() { - return permissionReadCl; - } - - public void setPermissionReadCl(boolean permissionReadCl) { - this.permissionReadCl = permissionReadCl; - } - - public boolean isPermissionUpdateCl() { - return permissionUpdateCl; - } - - public void setPermissionUpdateCl(boolean permissionUpdateCl) { - this.permissionUpdateCl = permissionUpdateCl; - } - - public boolean isPermissionReadTemplate() { - return permissionReadTemplate; - } - - public void setPermissionReadTemplate(boolean permissionReadTemplate) { - this.permissionReadTemplate = permissionReadTemplate; - } - - public boolean isPermissionUpdateTemplate() { - return permissionUpdateTemplate; - } - - public void setPermissionUpdateTemplate(boolean permissionUpdateTemplate) { - this.permissionUpdateTemplate = permissionUpdateTemplate; - } - - public boolean isPermissionReadTosca() { - return permissionReadTosca; - } - - public void setPermissionReadTosca(boolean permissionReadTosca) { - this.permissionReadTosca = permissionReadTosca; - } - - public boolean isPermissionUpdateTosca() { - return permissionUpdateTosca; - } - - public void setPermissionUpdateTosca(boolean permissionUpdateTosca) { - this.permissionUpdateTosca = permissionUpdateTosca; - } + @Expose + private String userName; + @Expose + private String cldsVersion; + @Expose + private boolean permissionReadCl; + @Expose + private boolean permissionUpdateCl; + @Expose + private boolean permissionReadTemplate; + @Expose + private boolean permissionUpdateTemplate; + @Expose + private boolean permissionReadTosca; + @Expose + private boolean permissionUpdateTosca; + + public String getUserName() { + return userName; + } + + public void setUserName(String userName) { + this.userName = userName; + } + + public String getCldsVersion() { + return cldsVersion; + } + + public void setCldsVersion(String cldsVersion) { + this.cldsVersion = cldsVersion; + } + + public boolean isPermissionReadCl() { + return permissionReadCl; + } + + public void setPermissionReadCl(boolean permissionReadCl) { + this.permissionReadCl = permissionReadCl; + } + + public boolean isPermissionUpdateCl() { + return permissionUpdateCl; + } + + public void setPermissionUpdateCl(boolean permissionUpdateCl) { + this.permissionUpdateCl = permissionUpdateCl; + } + + public boolean isPermissionReadTemplate() { + return permissionReadTemplate; + } + + public void setPermissionReadTemplate(boolean permissionReadTemplate) { + this.permissionReadTemplate = permissionReadTemplate; + } + + public boolean isPermissionUpdateTemplate() { + return permissionUpdateTemplate; + } + + public void setPermissionUpdateTemplate(boolean permissionUpdateTemplate) { + this.permissionUpdateTemplate = permissionUpdateTemplate; + } + + public boolean isPermissionReadTosca() { + return permissionReadTosca; + } + + public void setPermissionReadTosca(boolean permissionReadTosca) { + this.permissionReadTosca = permissionReadTosca; + } + + public boolean isPermissionUpdateTosca() { + return permissionUpdateTosca; + } + + public void setPermissionUpdateTosca(boolean permissionUpdateTosca) { + this.permissionUpdateTosca = permissionUpdateTosca; + } } diff --git a/src/main/java/org/onap/clamp/clds/model/CldsModel.java b/src/main/java/org/onap/clamp/clds/model/CldsModel.java index 0b414807c..4d2ca89a4 100644 --- a/src/main/java/org/onap/clamp/clds/model/CldsModel.java +++ b/src/main/java/org/onap/clamp/clds/model/CldsModel.java @@ -23,8 +23,7 @@ package org.onap.clamp.clds.model; -import com.att.eelf.configuration.EELFLogger; -import com.att.eelf.configuration.EELFManager; +import com.google.gson.annotations.Expose; import java.util.ArrayList; import java.util.List; @@ -37,594 +36,592 @@ import org.onap.clamp.clds.model.actions.ActionsHandler; import org.onap.clamp.clds.model.actions.ActionsHandlerImpl; import org.onap.clamp.clds.model.status.StatusHandler; import org.onap.clamp.clds.model.status.StatusHandlerImpl; -import com.google.gson.annotations.Expose; /** * Represent a CLDS Model. */ public class CldsModel { - private static final EELFLogger logger = EELFManager.getInstance().getLogger(CldsModel.class); - private static final int UUID_LENGTH = 36; - /** - * The constant STATUS_DESIGN. - */ - public static final String STATUS_DESIGN = "DESIGN"; - /** - * The constant STATUS_DISTRIBUTED. - */ - public static final String STATUS_DISTRIBUTED = "DISTRIBUTED"; - /** - * The constant STATUS_ACTIVE. - */ - public static final String STATUS_ACTIVE = "ACTIVE"; - /** - * The constant STATUS_STOPPED. - */ - public static final String STATUS_STOPPED = "STOPPED"; - /** - * The constant STATUS_DELETING. - */ - public static final String STATUS_DELETING = "DELETING"; - /** - * The constant STATUS_ERROR. - */ - public static final String STATUS_ERROR = "ERROR"; - /** - * The constant STATUS_UNKNOWN. - */ - public static final String STATUS_UNKNOWN = "UNKNOWN"; - - @Expose - private String id; - @Expose - private String templateId; - @Expose - private String templateName; - @Expose - private String name; - @Expose - private String controlNamePrefix; - @Expose - private String controlNameUuid; - @Expose - private String bpmnText; - @Expose - private String propText; - @Expose - private String imageText; - @Expose - private String docText; - @Expose - private String blueprintText; - @Expose - private CldsEvent event; - @Expose - private String status; - @Expose - private List<String> permittedActionCd; - @Expose - private List<CldsModelInstance> cldsModelInstanceList; - // This is a transient value used to return the failure message to UI - @Expose - private String errorMessageForUi; - /** - * The service type Id received from DCAE by querying it. - */ - @Expose - private String typeId; - @Expose - private String typeName; - @Expose - private String deploymentId; - @Expose - private String deploymentStatusUrl; - - // Set default handlers but this can be changed if needed. - private static StatusHandler statusHandler = new StatusHandlerImpl(); - private static ActionsHandler actionsHandler = new ActionsHandlerImpl(); - - /** - * Sets status handler. - * - * @param statHandler the stat handler - */ - public static synchronized void setStatusHandler(StatusHandler statHandler) { - statusHandler = statHandler; - } - - /** - * Sets actions handler. - * - * @param cdHandler the cd handler - */ - public static synchronized void setActionsHandler(ActionsHandler cdHandler) { - actionsHandler = cdHandler; - } - - /** - * Construct empty model. - */ - public CldsModel() { - event = new CldsEvent(); - } - - /** - * Retrieve from DB. - * - * @param cldsDao the clds dao - * @param name the name - * @param okIfNotFound the ok if not found - * @return the clds model - */ - public static CldsModel retrieve(CldsDao cldsDao, String name, boolean okIfNotFound) { - // get from db - CldsModel model = cldsDao.getModelTemplate(name); - if (model.getId() == null && !okIfNotFound) { - throw new NotFoundException(); - } - model.determineStatus(); - model.determinePermittedActionCd(); - return model; - } - - /** - * Can dcae inventory call boolean. - * - * @return the boolean - */ - public boolean canDcaeInventoryCall() { - boolean canCall = false; - /* Below checks the clds event is submit/resubmit/distribute */ - if (event.isActionCd(CldsEvent.ACTION_SUBMIT) || event.isActionCd(CldsEvent.ACTION_RESUBMIT) - || event.isActionCd(CldsEvent.ACTION_DISTRIBUTE) || event.isActionCd(CldsEvent.ACTION_SUBMITDCAE)) { - canCall = true; - } - return canCall; - } - - /** - * Save model to DB. - * - * @param cldsDao the clds dao - * @param userid the userid - * @return the clds model - */ - public CldsModel save(CldsDao cldsDao, String userid) { - CldsModel cldsModel = cldsDao.setModel(this, userid); - determineStatus(); - determinePermittedActionCd(); - return cldsModel; - } - - /** - * set the status in the model. - */ - public void determineStatus() { - status = statusHandler.determineStatusOnLastEvent(event); - } - - /** - * Determine permittedActionCd list using the actionCd from the current event. - * It's a states graph, given the next action that can be executed from the one - * that has been executed (described in the event object). ACTION_CREATE being - * the first one. - */ - public void determinePermittedActionCd() { - permittedActionCd = actionsHandler.determinePermittedActionsOnLastEvent(event, propText); - } - - /** - * Validate requestedActionCd - determine permittedActionCd and then check if - * contained in permittedActionCd Throw IllegalArgumentException if requested - * actionCd is not permitted. - * - * @param requestedActionCd the requested action cd - */ - public void validateAction(String requestedActionCd) { - determinePermittedActionCd(); - if (!permittedActionCd.contains(requestedActionCd)) { - throw new IllegalArgumentException("Invalid requestedActionCd: " + requestedActionCd - + ". Given current actionCd: " + actionsHandler.getCurrentActionCd(event) - + ", the permittedActionCd: " + permittedActionCd); - } - } - - /** - * Extract the UUID portion of a given full control name (controlNamePrefix + - * controlNameUuid). No fields are populated other than controlNamePrefix and - * controlNameUuid. Throws BadRequestException if length of given control name - * is less than UUID_LENGTH. - * - * @param fullControlName the full control name - * @return the clds model - */ - public static CldsModel createUsingControlName(String fullControlName) { - if (fullControlName == null || fullControlName.length() < UUID_LENGTH) { - throw new BadRequestException( - "closed loop id / control name length, " + (fullControlName != null ? fullControlName.length() : 0) - + ", less than the minimum of: " + UUID_LENGTH); - } - CldsModel model = new CldsModel(); - model.setControlNamePrefix(fullControlName.substring(0, fullControlName.length() - UUID_LENGTH)); - model.setControlNameUuid(fullControlName.substring(fullControlName.length() - UUID_LENGTH)); - return model; - } - - /** - * Gets control name. - * - * @return the controlName (controlNamePrefix + controlNameUuid) - */ - public String getControlName() { - return controlNamePrefix + controlNameUuid; - } - - /** - * To insert modelInstance to the database. - * - * @param cldsDao the clds dao - * @param dcaeEvent the dcae event - * @param userid the userid - * @return the clds model - */ - public static CldsModel insertModelInstance(CldsDao cldsDao, DcaeEvent dcaeEvent, String userid) { - String controlName = dcaeEvent.getControlName(); - CldsModel cldsModel = createUsingControlName(controlName); - cldsModel = cldsDao.getModelByUuid(cldsModel.getControlNameUuid()); - cldsModel.determineStatus(); - if (dcaeEvent.getCldsActionCd().equals(CldsEvent.ACTION_UNDEPLOY) || (dcaeEvent.getCldsActionCd() - .equals(CldsEvent.ACTION_DEPLOY) - && (cldsModel.getStatus().equals(STATUS_DISTRIBUTED) || cldsModel.getStatus().equals(STATUS_DESIGN)))) { - CldsEvent.insEvent(cldsDao, dcaeEvent.getControlName(), userid, dcaeEvent.getCldsActionCd(), - CldsEvent.ACTION_STATE_RECEIVED, null); - } - cldsDao.insModelInstance(cldsModel, dcaeEvent.getInstances()); - return cldsModel; - } - - /** - * Gets name. - * - * @return the name - */ - public String getName() { - return name; - } - - /** - * Sets name. - * - * @param name the name to set - */ - public void setName(String name) { - this.name = name; - } - - /** - * Gets type name. - * - * @return the typeName - */ - public String getTypeName() { - return typeName; - } - - /** - * Sets type name. - * - * @param typeName the type name - */ - public void setTypeName(String typeName) { - this.typeName = typeName; - } - - /** - * Gets template id. - * - * @return the template id - */ - public String getTemplateId() { - return templateId; - } - - /** - * Sets template id. - * - * @param templateId the template id - */ - public void setTemplateId(String templateId) { - this.templateId = templateId; - } - - /** - * Gets control name prefix. - * - * @return the controlNamePrefix - */ - public String getControlNamePrefix() { - return controlNamePrefix; - } - - /** - * Sets control name prefix. - * - * @param controlNamePrefix the controlNamePrefix to set - */ - public void setControlNamePrefix(String controlNamePrefix) { - this.controlNamePrefix = controlNamePrefix; - } - - /** - * Gets control name uuid. - * - * @return the controlNameUuid - */ - public String getControlNameUuid() { - return controlNameUuid; - } - - /** - * Sets control name uuid. - * - * @param controlNameUuid the controlNameUuid to set - */ - public void setControlNameUuid(String controlNameUuid) { - this.controlNameUuid = controlNameUuid; - } - - /** - * Gets prop text. - * - * @return the propText - */ - public String getPropText() { - return propText; - } - - /** - * Sets prop text. - * - * @param propText the propText to set - */ - public void setPropText(String propText) { - this.propText = propText; - } - - /** - * Gets event. - * - * @return the event - */ - public CldsEvent getEvent() { - return event; - } - - /** - * Gets id. - * - * @return the id - */ - public String getId() { - return id; - } - - /** - * Sets id. - * - * @param id the id - */ - public void setId(String id) { - this.id = id; - } - - /** - * Gets template name. - * - * @return the template name - */ - public String getTemplateName() { - return templateName; - } - - /** - * Sets template name. - * - * @param templateName the template name - */ - public void setTemplateName(String templateName) { - this.templateName = templateName; - } - - /** - * Sets event. - * - * @param event the event to set - */ - public void setEvent(CldsEvent event) { - this.event = event; - } - - /** - * Gets status. - * - * @return the status - */ - public String getStatus() { - return status; - } - - /** - * Sets status. - * - * @param status the status to set - */ - public void setStatus(String status) { - this.status = status; - } - - /** - * Gets blueprint text. - * - * @return the blueprint text - */ - public String getBlueprintText() { - return blueprintText; - } - - /** - * Sets blueprint text. - * - * @param blueprintText the blueprint text - */ - public void setBlueprintText(String blueprintText) { - this.blueprintText = blueprintText; - } - - /** - * Gets bpmn text. - * - * @return the bpmn text - */ - public String getBpmnText() { - return bpmnText; - } - - /** - * Sets bpmn text. - * - * @param bpmnText the bpmn text - */ - public void setBpmnText(String bpmnText) { - this.bpmnText = bpmnText; - } - - /** - * Gets image text. - * - * @return the image text - */ - public String getImageText() { - return imageText; - } - - /** - * Sets image text. - * - * @param imageText the image text - */ - public void setImageText(String imageText) { - this.imageText = imageText; - } - - /** - * Gets doc text. - * - * @return the doc text - */ - public String getDocText() { - return docText; - } - - /** - * Sets doc text. - * - * @param docText the doc text - */ - public void setDocText(String docText) { - this.docText = docText; - } - - /** - * Gets type id. - * - * @return the type id - */ - public String getTypeId() { - return typeId; - } - - /** - * Sets type id. - * - * @param typeId the type id - */ - public void setTypeId(String typeId) { - this.typeId = typeId; - } - - /** - * Gets clds model instance list. - * - * @return the clds model instance list - */ - public List<CldsModelInstance> getCldsModelInstanceList() { - if (cldsModelInstanceList == null) { - cldsModelInstanceList = new ArrayList<>(); - } - return cldsModelInstanceList; - } - - /** - * Gets deployment id. - * - * @return the deployment id - */ - public String getDeploymentId() { - return deploymentId; - } - - /** - * Sets deployment id. - * - * @param deploymentId the deployment id - */ - public void setDeploymentId(String deploymentId) { - this.deploymentId = deploymentId; - } - - /** - * Gets permitted action cd. - * - * @return the permitted action cd - */ - public List<String> getPermittedActionCd() { - return permittedActionCd; - } - - /** - * Gets error message for ui. - * - * @return the error message for ui - */ - public String getErrorMessageForUi() { - return errorMessageForUi; - } - - /** - * Sets error message for ui. - * - * @param errorMessageForUi the error message for ui - */ - public void setErrorMessageForUi(String errorMessageForUi) { - this.errorMessageForUi = errorMessageForUi; - } - - /** - * Gets deployment status url. - * - * @return the deployment status url - */ - public String getDeploymentStatusUrl() { - return deploymentStatusUrl; - } - - /** - * Sets deployment status url. - * - * @param deploymentStatusUrl the deployment status url - */ - public void setDeploymentStatusUrl(String deploymentStatusUrl) { - this.deploymentStatusUrl = deploymentStatusUrl; - } + private static final int UUID_LENGTH = 36; + /** + * The constant STATUS_DESIGN. + */ + public static final String STATUS_DESIGN = "DESIGN"; + /** + * The constant STATUS_DISTRIBUTED. + */ + public static final String STATUS_DISTRIBUTED = "DISTRIBUTED"; + /** + * The constant STATUS_ACTIVE. + */ + public static final String STATUS_ACTIVE = "ACTIVE"; + /** + * The constant STATUS_STOPPED. + */ + public static final String STATUS_STOPPED = "STOPPED"; + /** + * The constant STATUS_DELETING. + */ + public static final String STATUS_DELETING = "DELETING"; + /** + * The constant STATUS_ERROR. + */ + public static final String STATUS_ERROR = "ERROR"; + /** + * The constant STATUS_UNKNOWN. + */ + public static final String STATUS_UNKNOWN = "UNKNOWN"; + + @Expose + private String id; + @Expose + private String templateId; + @Expose + private String templateName; + @Expose + private String name; + @Expose + private String controlNamePrefix; + @Expose + private String controlNameUuid; + @Expose + private String bpmnText; + @Expose + private String propText; + @Expose + private String imageText; + @Expose + private String docText; + @Expose + private String blueprintText; + @Expose + private CldsEvent event; + @Expose + private String status; + @Expose + private List<String> permittedActionCd; + @Expose + private List<CldsModelInstance> cldsModelInstanceList; + // This is a transient value used to return the failure message to UI + @Expose + private String errorMessageForUi; + /** + * The service type Id received from DCAE by querying it. + */ + @Expose + private String typeId; + @Expose + private String typeName; + @Expose + private String deploymentId; + @Expose + private String deploymentStatusUrl; + + // Set default handlers but this can be changed if needed. + private static StatusHandler statusHandler = new StatusHandlerImpl(); + private static ActionsHandler actionsHandler = new ActionsHandlerImpl(); + + /** + * Sets status handler. + * + * @param statHandler the stat handler + */ + public static synchronized void setStatusHandler(StatusHandler statHandler) { + statusHandler = statHandler; + } + + /** + * Sets actions handler. + * + * @param cdHandler the cd handler + */ + public static synchronized void setActionsHandler(ActionsHandler cdHandler) { + actionsHandler = cdHandler; + } + + /** + * Construct empty model. + */ + public CldsModel() { + event = new CldsEvent(); + } + + /** + * Retrieve from DB. + * + * @param cldsDao the clds dao + * @param name the name + * @param okIfNotFound the ok if not found + * @return the clds model + */ + public static CldsModel retrieve(CldsDao cldsDao, String name, boolean okIfNotFound) { + // get from db + CldsModel model = cldsDao.getModelTemplate(name); + if (model.getId() == null && !okIfNotFound) { + throw new NotFoundException(); + } + model.determineStatus(); + model.determinePermittedActionCd(); + return model; + } + + /** + * Can dcae inventory call boolean. + * + * @return the boolean + */ + public boolean canDcaeInventoryCall() { + boolean canCall = false; + /* Below checks the clds event is submit/resubmit/distribute */ + if (event.isActionCd(CldsEvent.ACTION_SUBMIT) || event.isActionCd(CldsEvent.ACTION_RESUBMIT) + || event.isActionCd(CldsEvent.ACTION_DISTRIBUTE) || event.isActionCd(CldsEvent.ACTION_SUBMITDCAE)) { + canCall = true; + } + return canCall; + } + + /** + * Save model to DB. + * + * @param cldsDao the clds dao + * @param userid the userid + * @return the clds model + */ + public CldsModel save(CldsDao cldsDao, String userid) { + CldsModel cldsModel = cldsDao.setModel(this, userid); + determineStatus(); + determinePermittedActionCd(); + return cldsModel; + } + + /** + * set the status in the model. + */ + public void determineStatus() { + status = statusHandler.determineStatusOnLastEvent(event); + } + + /** + * Determine permittedActionCd list using the actionCd from the current event. + * It's a states graph, given the next action that can be executed from the one + * that has been executed (described in the event object). ACTION_CREATE being + * the first one. + */ + public void determinePermittedActionCd() { + permittedActionCd = actionsHandler.determinePermittedActionsOnLastEvent(event, propText); + } + + /** + * Validate requestedActionCd - determine permittedActionCd and then check if + * contained in permittedActionCd Throw IllegalArgumentException if requested + * actionCd is not permitted. + * + * @param requestedActionCd the requested action cd + */ + public void validateAction(String requestedActionCd) { + determinePermittedActionCd(); + if (!permittedActionCd.contains(requestedActionCd)) { + throw new IllegalArgumentException("Invalid requestedActionCd: " + requestedActionCd + + ". Given current actionCd: " + actionsHandler.getCurrentActionCd(event) + + ", the permittedActionCd: " + permittedActionCd); + } + } + + /** + * Extract the UUID portion of a given full control name (controlNamePrefix + + * controlNameUuid). No fields are populated other than controlNamePrefix and + * controlNameUuid. Throws BadRequestException if length of given control name + * is less than UUID_LENGTH. + * + * @param fullControlName the full control name + * @return the clds model + */ + public static CldsModel createUsingControlName(String fullControlName) { + if (fullControlName == null || fullControlName.length() < UUID_LENGTH) { + throw new BadRequestException( + "closed loop id / control name length, " + (fullControlName != null ? fullControlName.length() : 0) + + ", less than the minimum of: " + UUID_LENGTH); + } + CldsModel model = new CldsModel(); + model.setControlNamePrefix(fullControlName.substring(0, fullControlName.length() - UUID_LENGTH)); + model.setControlNameUuid(fullControlName.substring(fullControlName.length() - UUID_LENGTH)); + return model; + } + + /** + * Gets control name. + * + * @return the controlName (controlNamePrefix + controlNameUuid) + */ + public String getControlName() { + return controlNamePrefix + controlNameUuid; + } + + /** + * To insert modelInstance to the database. + * + * @param cldsDao the clds dao + * @param dcaeEvent the dcae event + * @param userid the userid + * @return the clds model + */ + public static CldsModel insertModelInstance(CldsDao cldsDao, DcaeEvent dcaeEvent, String userid) { + String controlName = dcaeEvent.getControlName(); + CldsModel cldsModel = createUsingControlName(controlName); + cldsModel = cldsDao.getModelByUuid(cldsModel.getControlNameUuid()); + cldsModel.determineStatus(); + if (dcaeEvent.getCldsActionCd().equals(CldsEvent.ACTION_UNDEPLOY) || (dcaeEvent.getCldsActionCd() + .equals(CldsEvent.ACTION_DEPLOY) + && (cldsModel.getStatus().equals(STATUS_DISTRIBUTED) || cldsModel.getStatus().equals(STATUS_DESIGN)))) { + CldsEvent.insEvent(cldsDao, dcaeEvent.getControlName(), userid, dcaeEvent.getCldsActionCd(), + CldsEvent.ACTION_STATE_RECEIVED, null); + } + cldsDao.insModelInstance(cldsModel, dcaeEvent.getInstances()); + return cldsModel; + } + + /** + * Gets name. + * + * @return the name + */ + public String getName() { + return name; + } + + /** + * Sets name. + * + * @param name the name to set + */ + public void setName(String name) { + this.name = name; + } + + /** + * Gets type name. + * + * @return the typeName + */ + public String getTypeName() { + return typeName; + } + + /** + * Sets type name. + * + * @param typeName the type name + */ + public void setTypeName(String typeName) { + this.typeName = typeName; + } + + /** + * Gets template id. + * + * @return the template id + */ + public String getTemplateId() { + return templateId; + } + + /** + * Sets template id. + * + * @param templateId the template id + */ + public void setTemplateId(String templateId) { + this.templateId = templateId; + } + + /** + * Gets control name prefix. + * + * @return the controlNamePrefix + */ + public String getControlNamePrefix() { + return controlNamePrefix; + } + + /** + * Sets control name prefix. + * + * @param controlNamePrefix the controlNamePrefix to set + */ + public void setControlNamePrefix(String controlNamePrefix) { + this.controlNamePrefix = controlNamePrefix; + } + + /** + * Gets control name uuid. + * + * @return the controlNameUuid + */ + public String getControlNameUuid() { + return controlNameUuid; + } + + /** + * Sets control name uuid. + * + * @param controlNameUuid the controlNameUuid to set + */ + public void setControlNameUuid(String controlNameUuid) { + this.controlNameUuid = controlNameUuid; + } + + /** + * Gets prop text. + * + * @return the propText + */ + public String getPropText() { + return propText; + } + + /** + * Sets prop text. + * + * @param propText the propText to set + */ + public void setPropText(String propText) { + this.propText = propText; + } + + /** + * Gets event. + * + * @return the event + */ + public CldsEvent getEvent() { + return event; + } + + /** + * Gets id. + * + * @return the id + */ + public String getId() { + return id; + } + + /** + * Sets id. + * + * @param id the id + */ + public void setId(String id) { + this.id = id; + } + + /** + * Gets template name. + * + * @return the template name + */ + public String getTemplateName() { + return templateName; + } + + /** + * Sets template name. + * + * @param templateName the template name + */ + public void setTemplateName(String templateName) { + this.templateName = templateName; + } + + /** + * Sets event. + * + * @param event the event to set + */ + public void setEvent(CldsEvent event) { + this.event = event; + } + + /** + * Gets status. + * + * @return the status + */ + public String getStatus() { + return status; + } + + /** + * Sets status. + * + * @param status the status to set + */ + public void setStatus(String status) { + this.status = status; + } + + /** + * Gets blueprint text. + * + * @return the blueprint text + */ + public String getBlueprintText() { + return blueprintText; + } + + /** + * Sets blueprint text. + * + * @param blueprintText the blueprint text + */ + public void setBlueprintText(String blueprintText) { + this.blueprintText = blueprintText; + } + + /** + * Gets bpmn text. + * + * @return the bpmn text + */ + public String getBpmnText() { + return bpmnText; + } + + /** + * Sets bpmn text. + * + * @param bpmnText the bpmn text + */ + public void setBpmnText(String bpmnText) { + this.bpmnText = bpmnText; + } + + /** + * Gets image text. + * + * @return the image text + */ + public String getImageText() { + return imageText; + } + + /** + * Sets image text. + * + * @param imageText the image text + */ + public void setImageText(String imageText) { + this.imageText = imageText; + } + + /** + * Gets doc text. + * + * @return the doc text + */ + public String getDocText() { + return docText; + } + + /** + * Sets doc text. + * + * @param docText the doc text + */ + public void setDocText(String docText) { + this.docText = docText; + } + + /** + * Gets type id. + * + * @return the type id + */ + public String getTypeId() { + return typeId; + } + + /** + * Sets type id. + * + * @param typeId the type id + */ + public void setTypeId(String typeId) { + this.typeId = typeId; + } + + /** + * Gets clds model instance list. + * + * @return the clds model instance list + */ + public List<CldsModelInstance> getCldsModelInstanceList() { + if (cldsModelInstanceList == null) { + cldsModelInstanceList = new ArrayList<>(); + } + return cldsModelInstanceList; + } + + /** + * Gets deployment id. + * + * @return the deployment id + */ + public String getDeploymentId() { + return deploymentId; + } + + /** + * Sets deployment id. + * + * @param deploymentId the deployment id + */ + public void setDeploymentId(String deploymentId) { + this.deploymentId = deploymentId; + } + + /** + * Gets permitted action cd. + * + * @return the permitted action cd + */ + public List<String> getPermittedActionCd() { + return permittedActionCd; + } + + /** + * Gets error message for ui. + * + * @return the error message for ui + */ + public String getErrorMessageForUi() { + return errorMessageForUi; + } + + /** + * Sets error message for ui. + * + * @param errorMessageForUi the error message for ui + */ + public void setErrorMessageForUi(String errorMessageForUi) { + this.errorMessageForUi = errorMessageForUi; + } + + /** + * Gets deployment status url. + * + * @return the deployment status url + */ + public String getDeploymentStatusUrl() { + return deploymentStatusUrl; + } + + /** + * Sets deployment status url. + * + * @param deploymentStatusUrl the deployment status url + */ + public void setDeploymentStatusUrl(String deploymentStatusUrl) { + this.deploymentStatusUrl = deploymentStatusUrl; + } } diff --git a/src/main/java/org/onap/clamp/clds/model/CldsServiceData.java b/src/main/java/org/onap/clamp/clds/model/CldsServiceData.java index 45194deca..8777ab5c9 100644 --- a/src/main/java/org/onap/clamp/clds/model/CldsServiceData.java +++ b/src/main/java/org/onap/clamp/clds/model/CldsServiceData.java @@ -18,7 +18,7 @@ * limitations under the License. * ============LICENSE_END============================================ * =================================================================== - * + * */ package org.onap.clamp.clds.model; @@ -77,8 +77,8 @@ public class CldsServiceData implements Serializable { } /** - * Filter out any VFs that the user is not authorized for. Use the - * CldsService to determine if the user is authorized for a VF. + * Filter out any VFs that the user is not authorized for. Use the CldsService + * to determine if the user is authorized for a VF. * * @param svc The clds service */ diff --git a/src/main/java/org/onap/clamp/clds/model/CldsTemplate.java b/src/main/java/org/onap/clamp/clds/model/CldsTemplate.java index 7a827282e..b1247801b 100644 --- a/src/main/java/org/onap/clamp/clds/model/CldsTemplate.java +++ b/src/main/java/org/onap/clamp/clds/model/CldsTemplate.java @@ -18,196 +18,196 @@ * limitations under the License. * ============LICENSE_END============================================ * =================================================================== - * + * */ package org.onap.clamp.clds.model; +import com.google.gson.annotations.Expose; + import javax.ws.rs.NotFoundException; import org.onap.clamp.clds.dao.CldsDao; -import com.google.gson.annotations.Expose; - /** * Represent a CLDS Model. */ public class CldsTemplate { - public static final String STATUS_DESIGN = "DESIGN"; - public static final String STATUS_ACTIVE = "ACTIVE"; - public static final String STATUS_STOPPED = "STOPPED"; - public static final String STATUS_DELETING = "DELETING"; - // manual intervention required - public static final String STATUS_ERROR = "ERROR"; - public static final String STATUS_UNKNOWN = "UNKNOWN"; - - @Expose - private String id; - @Expose - private String name; - @Expose - private String controlNamePrefix; - @Expose - private String controlNameUuid; - @Expose - private String bpmnId; - @Expose - private String bpmnUserid; - @Expose - private String bpmnText; - @Expose - private String imageId; - @Expose - private String imageUserid; - @Expose - private String imageText; - @Expose - private String propId; - @Expose - private String propUserid; - @Expose - private String propText; - @Expose - private boolean userAuthorizedToUpdate; - - /** - * Save template to DB. - * - * @param cldsDao The cldsDao - * @param userid The user Id - */ - public void save(CldsDao cldsDao, String userid) { - cldsDao.setTemplate(this, userid); - } - - /** - * Retrieve from DB. - * - * @param cldsDao The cldsDao - * @param name The template name to retrieve - * @param okIfNotFound The flag indicating whether exception will be returned in - * case nothing is found - * @return Clds template from DB - */ - public static CldsTemplate retrieve(CldsDao cldsDao, String name, boolean okIfNotFound) { - // get from db - CldsTemplate template = cldsDao.getTemplate(name); - if (template.getId() == null && !okIfNotFound) { - throw new NotFoundException(); - } - return template; - } - - public String getBpmnUserid() { - return bpmnUserid; - } - - public void setBpmnUserid(String bpmnUserid) { - this.bpmnUserid = bpmnUserid; - } - - public String getBpmnText() { - return bpmnText; - } - - public void setBpmnText(String bpmnText) { - this.bpmnText = bpmnText; - } - - public String getImageUserid() { - return imageUserid; - } - - public void setImageUserid(String imageUserid) { - this.imageUserid = imageUserid; - } - - public String getImageText() { - return imageText; - } - - public void setImageText(String imageText) { - this.imageText = imageText; - } - - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } - - public String getControlNamePrefix() { - return controlNamePrefix; - } - - public void setControlNamePrefix(String controlNamePrefix) { - this.controlNamePrefix = controlNamePrefix; - } - - public String getControlNameUuid() { - return controlNameUuid; - } - - public void setControlNameUuid(String controlNameUuid) { - this.controlNameUuid = controlNameUuid; - } - - public String getPropId() { - return propId; - } - - public void setPropId(String propId) { - this.propId = propId; - } - - public String getPropUserid() { - return propUserid; - } - - public void setPropUserid(String propUserid) { - this.propUserid = propUserid; - } - - public String getPropText() { - return propText; - } - - public void setPropText(String propText) { - this.propText = propText; - } - - public String getId() { - return id; - } - - public void setId(String id) { - this.id = id; - } - - public String getBpmnId() { - return bpmnId; - } - - public void setBpmnId(String bpmnId) { - this.bpmnId = bpmnId; - } - - public String getImageId() { - return imageId; - } + public static final String STATUS_DESIGN = "DESIGN"; + public static final String STATUS_ACTIVE = "ACTIVE"; + public static final String STATUS_STOPPED = "STOPPED"; + public static final String STATUS_DELETING = "DELETING"; + // manual intervention required + public static final String STATUS_ERROR = "ERROR"; + public static final String STATUS_UNKNOWN = "UNKNOWN"; + + @Expose + private String id; + @Expose + private String name; + @Expose + private String controlNamePrefix; + @Expose + private String controlNameUuid; + @Expose + private String bpmnId; + @Expose + private String bpmnUserid; + @Expose + private String bpmnText; + @Expose + private String imageId; + @Expose + private String imageUserid; + @Expose + private String imageText; + @Expose + private String propId; + @Expose + private String propUserid; + @Expose + private String propText; + @Expose + private boolean userAuthorizedToUpdate; + + /** + * Save template to DB. + * + * @param cldsDao The cldsDao + * @param userid The user Id + */ + public void save(CldsDao cldsDao, String userid) { + cldsDao.setTemplate(this, userid); + } + + /** + * Retrieve from DB. + * + * @param cldsDao The cldsDao + * @param name The template name to retrieve + * @param okIfNotFound The flag indicating whether exception will be returned in + * case nothing is found + * @return Clds template from DB + */ + public static CldsTemplate retrieve(CldsDao cldsDao, String name, boolean okIfNotFound) { + // get from db + CldsTemplate template = cldsDao.getTemplate(name); + if (template.getId() == null && !okIfNotFound) { + throw new NotFoundException(); + } + return template; + } + + public String getBpmnUserid() { + return bpmnUserid; + } + + public void setBpmnUserid(String bpmnUserid) { + this.bpmnUserid = bpmnUserid; + } + + public String getBpmnText() { + return bpmnText; + } + + public void setBpmnText(String bpmnText) { + this.bpmnText = bpmnText; + } + + public String getImageUserid() { + return imageUserid; + } + + public void setImageUserid(String imageUserid) { + this.imageUserid = imageUserid; + } + + public String getImageText() { + return imageText; + } + + public void setImageText(String imageText) { + this.imageText = imageText; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String getControlNamePrefix() { + return controlNamePrefix; + } + + public void setControlNamePrefix(String controlNamePrefix) { + this.controlNamePrefix = controlNamePrefix; + } + + public String getControlNameUuid() { + return controlNameUuid; + } + + public void setControlNameUuid(String controlNameUuid) { + this.controlNameUuid = controlNameUuid; + } + + public String getPropId() { + return propId; + } + + public void setPropId(String propId) { + this.propId = propId; + } + + public String getPropUserid() { + return propUserid; + } + + public void setPropUserid(String propUserid) { + this.propUserid = propUserid; + } + + public String getPropText() { + return propText; + } + + public void setPropText(String propText) { + this.propText = propText; + } + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public String getBpmnId() { + return bpmnId; + } + + public void setBpmnId(String bpmnId) { + this.bpmnId = bpmnId; + } + + public String getImageId() { + return imageId; + } - public void setImageId(String imageId) { - this.imageId = imageId; - } + public void setImageId(String imageId) { + this.imageId = imageId; + } - public boolean isUserAuthorizedToUpdate() { - return userAuthorizedToUpdate; - } + public boolean isUserAuthorizedToUpdate() { + return userAuthorizedToUpdate; + } - public void setUserAuthorizedToUpdate(boolean userAuthorizedToUpdate) { - this.userAuthorizedToUpdate = userAuthorizedToUpdate; - } + public void setUserAuthorizedToUpdate(boolean userAuthorizedToUpdate) { + this.userAuthorizedToUpdate = userAuthorizedToUpdate; + } } diff --git a/src/main/java/org/onap/clamp/clds/model/CldsToscaModel.java b/src/main/java/org/onap/clamp/clds/model/CldsToscaModel.java index 0123f8049..5ae13d20a 100644 --- a/src/main/java/org/onap/clamp/clds/model/CldsToscaModel.java +++ b/src/main/java/org/onap/clamp/clds/model/CldsToscaModel.java @@ -23,6 +23,8 @@ package org.onap.clamp.clds.model; +import com.google.gson.annotations.Expose; + import java.util.List; import org.apache.commons.lang3.StringUtils; @@ -31,16 +33,14 @@ import org.onap.clamp.clds.config.ClampProperties; import org.onap.clamp.clds.dao.CldsDao; import org.onap.clamp.clds.tosca.ToscaYamlToJsonConvertor; -import com.google.gson.annotations.Expose; - public class CldsToscaModel extends CldsToscaModelRevision { - @Expose + @Expose private String id; - @Expose - private String policyType; - @Expose - private String toscaModelName; + @Expose + private String policyType; + @Expose + private String toscaModelName; /** * Construct. @@ -52,7 +52,7 @@ public class CldsToscaModel extends CldsToscaModelRevision { * Creates or updates Tosca Model to DB. * * @param cldsDao The cldsDao - * @param userId The user Id + * @param userId The user Id */ public CldsToscaModel save(CldsDao cldsDao, ClampProperties refProp, PolicyClient policyClient, String userId) { CldsToscaModel cldsToscaModel = null; @@ -90,6 +90,7 @@ public class CldsToscaModel extends CldsToscaModelRevision { /** * Get the Id. + * * @return the id */ public String getId() { @@ -98,8 +99,8 @@ public class CldsToscaModel extends CldsToscaModelRevision { /** * Set the id. - * @param id - * the id to set + * + * @param id the id to set */ public void setId(String id) { this.id = id; @@ -107,6 +108,7 @@ public class CldsToscaModel extends CldsToscaModelRevision { /** * Get the policy type. + * * @return the policyType */ public String getPolicyType() { @@ -115,8 +117,8 @@ public class CldsToscaModel extends CldsToscaModelRevision { /** * Set the policy type. - * @param policyType - * the policyType to set + * + * @param policyType the policyType to set */ public void setPolicyType(String policyType) { this.policyType = policyType; @@ -124,6 +126,7 @@ public class CldsToscaModel extends CldsToscaModelRevision { /** * Get the tosca model name. + * * @return the toscaModelName */ public String getToscaModelName() { @@ -132,8 +135,8 @@ public class CldsToscaModel extends CldsToscaModelRevision { /** * Set the tosca model name. - * @param toscaModelName - * the toscaModelName to set + * + * @param toscaModelName the toscaModelName to set */ public void setToscaModelName(String toscaModelName) { this.toscaModelName = toscaModelName; diff --git a/src/main/java/org/onap/clamp/clds/model/CldsVfcData.java b/src/main/java/org/onap/clamp/clds/model/CldsVfcData.java index 9448cefcd..034fc28ce 100644 --- a/src/main/java/org/onap/clamp/clds/model/CldsVfcData.java +++ b/src/main/java/org/onap/clamp/clds/model/CldsVfcData.java @@ -5,20 +5,20 @@ * 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. + * 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 + * + * 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.onap.clamp.clds.model; @@ -28,9 +28,9 @@ import java.util.List; public class CldsVfcData implements Serializable { - private static final long serialVersionUID = 406993878174183557L; - private String vfcName; - private String vfcInvariantResourceUuid; + private static final long serialVersionUID = 406993878174183557L; + private String vfcName; + private String vfcInvariantResourceUuid; private List<CldsAlarmCondition> cldsAlarmConditions; public String getVfcName() { diff --git a/src/main/java/org/onap/clamp/clds/model/DcaeEvent.java b/src/main/java/org/onap/clamp/clds/model/DcaeEvent.java index cac84528c..9126f9abf 100644 --- a/src/main/java/org/onap/clamp/clds/model/DcaeEvent.java +++ b/src/main/java/org/onap/clamp/clds/model/DcaeEvent.java @@ -23,164 +23,164 @@ package org.onap.clamp.clds.model; +import com.google.gson.annotations.Expose; + import java.util.List; import javax.ws.rs.BadRequestException; -import com.google.gson.annotations.Expose; - /** * Represent a DCAE Event. */ public class DcaeEvent { - // this is an event we (clds) sends to dcae - public static final String EVENT_CREATED = "created"; - public static final String EVENT_DISTRIBUTION = "distribute"; - public static final String EVENT_DEPLOYMENT = "deployment"; - public static final String EVENT_UNDEPLOYMENT = "undeployment"; - public static final String ARTIFACT_NAME_SUFFIX = ".yml"; - - @Expose - private String event; - @Expose - private String serviceUuid; - @Expose - private String resourceUuid; - @Expose - private String artifactName; // controlName.yml - @Expose - private List<CldsModelInstance> instances; - - /** - * Transform a DCAE Event Action to a CldsEvent.actionCd. - * - * @return The clds action. - */ - public String getCldsActionCd() { - if (event == null || event.length() == 0) { - throw new BadRequestException("action null or empty"); - } else if (event.equalsIgnoreCase(EVENT_CREATED)) { - return CldsEvent.ACTION_CREATE; - } else if (event.equalsIgnoreCase(EVENT_DISTRIBUTION)) { - return CldsEvent.ACTION_DISTRIBUTE; - } else if (event.equalsIgnoreCase(EVENT_DEPLOYMENT) && (instances == null || instances.isEmpty())) { - return CldsEvent.ACTION_DEPLOY; - } else if (event.equalsIgnoreCase(EVENT_DEPLOYMENT)) { - return CldsEvent.ACTION_DEPLOY; - // EVENT_UNDEPLOYMENT is defunct - DCAE Proxy will not undeploy - // individual instances. It will send an empty list of - // deployed instances to indicate all have been removed. Or it will - // send an updated list to indicate those that - // are still deployed with any not on the list considered - // undeployed. - } else if (event.equals(EVENT_UNDEPLOYMENT)) { - return CldsEvent.ACTION_UNDEPLOY; - } - - throw new BadRequestException("event value not valid: " + event); - } - - /** - * Derive the controlName from the artifactName. - * - * @return the controlName - */ - public String getControlName() { - if (artifactName != null && artifactName.endsWith(ARTIFACT_NAME_SUFFIX)) { - return artifactName.substring(0, artifactName.length() - ARTIFACT_NAME_SUFFIX.length()); - } else { - throw new BadRequestException("artifactName value not valid (expecting it to end with " - + ARTIFACT_NAME_SUFFIX + "): " + artifactName); - } - } - - /** - * Get the event. - * - * @return the event - */ - public String getEvent() { - return event; - } - - /** - * Set the event. - * - * @param event the event to set - */ - public void setEvent(String event) { - this.event = event; - } - - /** - * Get the serviceUUID. - * - * @return the serviceUUID - */ - public String getServiceUUID() { - return serviceUuid; - } - - /** - * Set the serviceUUID. - * - * @param serviceUUID the serviceUUID to set - */ - public void setServiceUUID(String serviceUuid) { - this.serviceUuid = serviceUuid; - } - - /** - * Get the resourceUUID. - * - * @return the resourceUUID - */ - public String getResourceUUID() { - return resourceUuid; - } - - /** - * Set the resourceUUID. - * - * @param resourceUUID the resourceUUID to set - */ - public void setResourceUUID(String resourceUuid) { - this.resourceUuid = resourceUuid; - } - - /** - * Get the artifact name. - * - * @return the artifactName - */ - public String getArtifactName() { - return artifactName; - } - - /** - * Set the artifact name. - * - * @param artifactName the artifactName to set - */ - public void setArtifactName(String artifactName) { - this.artifactName = artifactName; - } - - /** - * Get the list of instances. - * - * @return The list of model instances - */ - public List<CldsModelInstance> getInstances() { - return instances; - } - - /** - * Set the list of model instances. - * - * @param instances The list of model instances to set - */ - public void setInstances(List<CldsModelInstance> instances) { - this.instances = instances; - } + // this is an event we (clds) sends to dcae + public static final String EVENT_CREATED = "created"; + public static final String EVENT_DISTRIBUTION = "distribute"; + public static final String EVENT_DEPLOYMENT = "deployment"; + public static final String EVENT_UNDEPLOYMENT = "undeployment"; + public static final String ARTIFACT_NAME_SUFFIX = ".yml"; + + @Expose + private String event; + @Expose + private String serviceUuid; + @Expose + private String resourceUuid; + @Expose + private String artifactName; // controlName.yml + @Expose + private List<CldsModelInstance> instances; + + /** + * Transform a DCAE Event Action to a CldsEvent.actionCd. + * + * @return The clds action. + */ + public String getCldsActionCd() { + if (event == null || event.length() == 0) { + throw new BadRequestException("action null or empty"); + } else if (event.equalsIgnoreCase(EVENT_CREATED)) { + return CldsEvent.ACTION_CREATE; + } else if (event.equalsIgnoreCase(EVENT_DISTRIBUTION)) { + return CldsEvent.ACTION_DISTRIBUTE; + } else if (event.equalsIgnoreCase(EVENT_DEPLOYMENT) && (instances == null || instances.isEmpty())) { + return CldsEvent.ACTION_DEPLOY; + } else if (event.equalsIgnoreCase(EVENT_DEPLOYMENT)) { + return CldsEvent.ACTION_DEPLOY; + // EVENT_UNDEPLOYMENT is defunct - DCAE Proxy will not undeploy + // individual instances. It will send an empty list of + // deployed instances to indicate all have been removed. Or it will + // send an updated list to indicate those that + // are still deployed with any not on the list considered + // undeployed. + } else if (event.equals(EVENT_UNDEPLOYMENT)) { + return CldsEvent.ACTION_UNDEPLOY; + } + + throw new BadRequestException("event value not valid: " + event); + } + + /** + * Derive the controlName from the artifactName. + * + * @return the controlName + */ + public String getControlName() { + if (artifactName != null && artifactName.endsWith(ARTIFACT_NAME_SUFFIX)) { + return artifactName.substring(0, artifactName.length() - ARTIFACT_NAME_SUFFIX.length()); + } else { + throw new BadRequestException("artifactName value not valid (expecting it to end with " + + ARTIFACT_NAME_SUFFIX + "): " + artifactName); + } + } + + /** + * Get the event. + * + * @return the event + */ + public String getEvent() { + return event; + } + + /** + * Set the event. + * + * @param event the event to set + */ + public void setEvent(String event) { + this.event = event; + } + + /** + * Get the serviceUUID. + * + * @return the serviceUUID + */ + public String getServiceUUID() { + return serviceUuid; + } + + /** + * Set the serviceUUID. + * + * @param serviceUUID the serviceUUID to set + */ + public void setServiceUUID(String serviceUuid) { + this.serviceUuid = serviceUuid; + } + + /** + * Get the resourceUUID. + * + * @return the resourceUUID + */ + public String getResourceUUID() { + return resourceUuid; + } + + /** + * Set the resourceUUID. + * + * @param resourceUUID the resourceUUID to set + */ + public void setResourceUUID(String resourceUuid) { + this.resourceUuid = resourceUuid; + } + + /** + * Get the artifact name. + * + * @return the artifactName + */ + public String getArtifactName() { + return artifactName; + } + + /** + * Set the artifact name. + * + * @param artifactName the artifactName to set + */ + public void setArtifactName(String artifactName) { + this.artifactName = artifactName; + } + + /** + * Get the list of instances. + * + * @return The list of model instances + */ + public List<CldsModelInstance> getInstances() { + return instances; + } + + /** + * Set the list of model instances. + * + * @param instances The list of model instances to set + */ + public void setInstances(List<CldsModelInstance> instances) { + this.instances = instances; + } } diff --git a/src/main/java/org/onap/clamp/clds/model/ValueItem.java b/src/main/java/org/onap/clamp/clds/model/ValueItem.java index 4efef6ea6..42323908c 100644 --- a/src/main/java/org/onap/clamp/clds/model/ValueItem.java +++ b/src/main/java/org/onap/clamp/clds/model/ValueItem.java @@ -5,20 +5,20 @@ * 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. + * 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 + * + * 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.onap.clamp.clds.model; @@ -29,37 +29,37 @@ import com.google.gson.annotations.Expose; * ValueItem used for value lists. */ public class ValueItem { - @Expose - private String value; + @Expose + private String value; - /** - * Instantiate using value. - * - * @param value The value - */ - public ValueItem(String value) { - this.value = value; - } + /** + * Instantiate using value. + * + * @param value The value + */ + public ValueItem(String value) { + this.value = value; + } - public ValueItem() { - } + public ValueItem() { + } - /** - * Get the value. - * - * @return the value - */ - public String getValue() { - return value; - } + /** + * Get the value. + * + * @return the value + */ + public String getValue() { + return value; + } - /** - * Set the value. - * - * @param value the value to set - */ - public void setValue(String value) { - this.value = value; - } + /** + * Set the value. + * + * @param value the value to set + */ + public void setValue(String value) { + this.value = value; + } } |