diff options
Diffstat (limited to 'bpmn/so-bpmn-tasks/src/main')
3 files changed, 101 insertions, 18 deletions
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/buildingblock/SniroHomingV2.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/buildingblock/SniroHomingV2.java index e83c27c400..92b4e211d5 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/buildingblock/SniroHomingV2.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/buildingblock/SniroHomingV2.java @@ -404,9 +404,9 @@ public class SniroHomingV2 { for(Candidate c:required){ org.onap.so.client.sniro.beans.Candidate can = new org.onap.so.client.sniro.beans.Candidate(); org.onap.so.client.sniro.beans.CandidateType type = new org.onap.so.client.sniro.beans.CandidateType(); - type.setName(c.getCandidateType().getName()); - can.setCandidateType(type); - can.setCandidates(c.getCandidates()); + type.setName(c.getIdentifierType().getName()); + can.setIdentifierType(type); + can.setIdentifiers(c.getIdentifiers()); can.setCloudOwner(c.getCloudOwner()); cans.add(can); } @@ -417,9 +417,9 @@ public class SniroHomingV2 { for(Candidate c:excluded){ org.onap.so.client.sniro.beans.Candidate can = new org.onap.so.client.sniro.beans.Candidate(); org.onap.so.client.sniro.beans.CandidateType type = new org.onap.so.client.sniro.beans.CandidateType(); - type.setName(c.getCandidateType().getName()); - can.setCandidateType(type); - can.setCandidates(c.getCandidates()); + type.setName(c.getIdentifierType().getName()); + can.setIdentifierType(type); + can.setIdentifiers(c.getIdentifiers()); can.setCloudOwner(c.getCloudOwner()); cans.add(can); } diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/audit/AuditTasks.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/audit/AuditTasks.java new file mode 100644 index 0000000000..aaa9e51d15 --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/audit/AuditTasks.java @@ -0,0 +1,83 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * 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.onap.so.bpmn.infrastructure.audit; + + +import org.onap.so.audit.beans.AuditInventory; +import org.onap.so.bpmn.common.BuildingBlockExecution; +import org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion; +import org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule; +import org.onap.so.bpmn.servicedecomposition.entities.GeneralBuildingBlock; +import org.onap.so.bpmn.servicedecomposition.entities.ResourceKey; +import org.onap.so.bpmn.servicedecomposition.tasks.ExtractPojosForBB; +import org.onap.so.client.exception.BBObjectNotFoundException; +import org.onap.so.client.exception.ExceptionBuilder; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.core.env.Environment; +import org.springframework.stereotype.Component; + +@Component +public class AuditTasks { + + private static final Logger logger = LoggerFactory.getLogger(AuditTasks.class); + + @Autowired + private ExceptionBuilder exceptionUtil; + + @Autowired + private ExtractPojosForBB extractPojosForBB; + + @Autowired + private Environment env; + + public void isAuditNeeded(BuildingBlockExecution execution) { + try { + logger.debug("auditInventoryNeeded Value: {}", env.getProperty("mso.infra.auditInventory")); + execution.setVariable("auditInventoryNeeded",env.getProperty("mso.infra.auditInventory")); + } catch (Exception ex) { + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex); + } + } + + public void setupAuditVariable(BuildingBlockExecution execution) { + try { + execution.setVariable("auditInventory",createAuditInventory(execution)); + } catch (Exception ex) { + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex); + } + } + + private AuditInventory createAuditInventory(BuildingBlockExecution execution) throws BBObjectNotFoundException { + AuditInventory auditInventory = new AuditInventory(); + + GeneralBuildingBlock gBBInput = execution.getGeneralBuildingBlock(); + VfModule vfModule = extractPojosForBB.extractByKey(execution, ResourceKey.VF_MODULE_ID, execution.getLookupMap().get(ResourceKey.VF_MODULE_ID)); + CloudRegion cloudRegion = gBBInput.getCloudRegion(); + + auditInventory.setCloudOwner(cloudRegion.getCloudOwner()); + auditInventory.setCloudRegion(cloudRegion.getLcpCloudRegionId()); + auditInventory.setTenantId(cloudRegion.getTenantId()); + auditInventory.setHeatStackName(vfModule.getVfModuleName()); + return auditInventory; + } +} diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/beans/Candidate.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/beans/Candidate.java index b42636b078..1f8c56e727 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/beans/Candidate.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/beans/Candidate.java @@ -29,28 +29,28 @@ public class Candidate implements Serializable{ private static final long serialVersionUID = -5474502255533410907L; - @JsonProperty("candidateType") - private CandidateType candidateType; - @JsonProperty("candidates") - private List<String> candidates; + @JsonProperty("identifierType") + private CandidateType identifierType; + @JsonProperty("identifiers") + private List<String> identifiers; @JsonProperty("cloudOwner") private String cloudOwner; - public CandidateType getCandidateType(){ - return candidateType; + public CandidateType getIdentifierType(){ + return identifierType; } - public void setCandidateType(CandidateType candidateType){ - this.candidateType = candidateType; + public void setIdentifierType(CandidateType identifierType){ + this.identifierType = identifierType; } - public List<String> getCandidates(){ - return candidates; + public List<String> getIdentifiers(){ + return identifiers; } - public void setCandidates(List<String> candidates){ - this.candidates = candidates; + public void setIdentifiers(List<String> identifiers){ + this.identifiers = identifiers; } public String getCloudOwner(){ |