diff options
Diffstat (limited to 'bpmn/MSOCommonBPMN/src/main/java')
10 files changed, 401 insertions, 24 deletions
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/recipe/BpmnRestClient.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/recipe/BpmnRestClient.java index bbaebb64dc..1157750312 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/recipe/BpmnRestClient.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/recipe/BpmnRestClient.java @@ -37,6 +37,7 @@ import org.onap.so.logger.MessageEnum; import org.onap.so.logger.MsoLogger; import org.onap.so.utils.CryptoUtils; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Component; /** @@ -54,11 +55,11 @@ public class BpmnRestClient { public static final String DEFAULT_BPEL_AUTH = "admin:admin"; - public static final String ENCRYPTION_KEY = "aa3871669d893c7fb8abbcda31b88b4f"; + public static final String ENCRYPTION_KEY_PROP = "org.onap.so.adapters.network.encryptionKey"; public static final String CONTENT_TYPE_JSON = "application/json"; - public static final String CAMUNDA_AUTH = "camundaAuth"; + public static final String CAMUNDA_AUTH = "mso.camundaAuth"; private static final String MSO_PROP_APIHANDLER_INFRA = "MSO_PROP_APIHANDLER_INFRA"; @Autowired @@ -108,7 +109,7 @@ public class BpmnRestClient { String encryptedCredentials; encryptedCredentials = urnPropertiesReader.getVariable(CAMUNDA_AUTH); if(encryptedCredentials != null) { - String userCredentials = getEncryptedPropValue(encryptedCredentials, DEFAULT_BPEL_AUTH, ENCRYPTION_KEY); + String userCredentials = getEncryptedPropValue(encryptedCredentials, DEFAULT_BPEL_AUTH, ENCRYPTION_KEY_PROP); if(userCredentials != null) { post.addHeader("Authorization", "Basic " + DatatypeConverter.printBase64Binary(userCredentials.getBytes())); } @@ -195,7 +196,7 @@ public class BpmnRestClient { */ protected String getEncryptedPropValue(String prop, String defaultValue, String encryptionKey) { try { - return CryptoUtils.decrypt(prop, encryptionKey); + return CryptoUtils.decrypt(prop, urnPropertiesReader.getVariable(encryptionKey)); } catch(GeneralSecurityException e) { msoLogger.debug("Security exception", e); } diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/validation/BuildingBlockValidator.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/validation/BuildingBlockValidator.java new file mode 100644 index 0000000000..d4467b8270 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/validation/BuildingBlockValidator.java @@ -0,0 +1,44 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 - 2018 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.common.validation; + +import java.util.Set; + +import org.onap.so.bpmn.common.BuildingBlockExecution; + +public interface BuildingBlockValidator { + + + /** + * Name of the building block to be validated + * @return + */ + public Set<String> forBuildingBlock(); + + /** + * Determines whether or not the building block should be executed + * + * @param execution + * @return + */ + public boolean validate(BuildingBlockExecution execution); + +} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/validation/BuildingBlockValidatorRunner.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/validation/BuildingBlockValidatorRunner.java new file mode 100644 index 0000000000..d26ae7b92b --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/validation/BuildingBlockValidatorRunner.java @@ -0,0 +1,150 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 - 2018 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.common.validation; + +import java.lang.annotation.Annotation; +import java.util.ArrayList; +import java.util.Comparator; +import java.util.HashMap; +import java.util.List; +import java.util.Optional; +import java.util.stream.Collectors; + +import javax.annotation.PostConstruct; +import javax.annotation.Priority; + +import org.camunda.bpm.engine.delegate.BpmnError; +import org.javatuples.Pair; +import org.onap.so.bpmn.common.BuildingBlockExecution; +import org.onap.so.client.exception.ExceptionBuilder; +import org.reflections.Reflections; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.context.ApplicationContext; +import org.springframework.stereotype.Component; + + +/** + * Controls running all pre and post validation for building blocks. + * + * To define a validation you must make it a spring bean and implement either {@link org.onap.so.bpmn.common.validation.PreBuildingBlockValidator} or + * {@link org.onap.so.bpmn.common.validation.PostBuildingBlockValidator} your validation will automatically be + * run by this class. + * + */ +@Component +public class BuildingBlockValidatorRunner { + + private static Logger logger = LoggerFactory.getLogger(BuildingBlockValidatorRunner.class); + @Autowired + private ApplicationContext context; + + @Autowired + private ExceptionBuilder exceptionBuilder; + + private List<PreBuildingBlockValidator> preBuildingBlockValidators; + private List<PostBuildingBlockValidator> postBuildingBlockValidators; + + + @PostConstruct + protected void init() { + + preBuildingBlockValidators = new ArrayList<>( + Optional.ofNullable(context.getBeansOfType(PreBuildingBlockValidator.class)).orElse(new HashMap<>()).values()); + postBuildingBlockValidators = new ArrayList<>( + Optional.ofNullable(context.getBeansOfType(PostBuildingBlockValidator.class)).orElse(new HashMap<>()).values()); + } + + public boolean preValidate(String bbName, BuildingBlockExecution execution) { + return validate(preBuildingBlockValidators, bbName, execution); + } + + + public boolean postValidate(String bbName, BuildingBlockExecution execution) { + return validate(postBuildingBlockValidators, bbName, execution); + } + + + protected boolean validate(List<? extends BuildingBlockValidator> validators, String bbName, BuildingBlockExecution execution) { + List<Pair<String, Boolean>> results = runValidations(validators, bbName, execution); + + if (!results.isEmpty()) { + exceptionBuilder.buildAndThrowWorkflowException(execution, 7000, + "Failed Validations:\n" + results.stream().map(item -> item.getValue0()).collect(Collectors.joining("\n"))); + } + + return true; + + } + protected List<Pair<String, Boolean>> runValidations(List<? extends BuildingBlockValidator> validators, String bbName, BuildingBlockExecution execution) { + + List<BuildingBlockValidator> filtered = filterValidators(validators, bbName); + + List<Pair<String,Boolean>> results = new ArrayList<>(); + filtered.forEach(item -> results.add(new Pair<>(item.getClass().getName(), item.validate(execution)))); + + return results.stream().filter(item -> item.getValue1().equals(false)).collect(Collectors.toList()); + } + + protected List<BuildingBlockValidator> filterValidators(List<? extends BuildingBlockValidator> validators, String bbName) { + return validators.stream() + .filter(item -> { + return item.forBuildingBlock().contains(bbName); + }) + .sorted(Comparator.comparing(item -> { + Priority p = Optional.ofNullable(item.getClass().getAnnotation(Priority.class)).orElse(new Priority() { + public int value() { + return 1000; + } + + @Override + public Class<? extends Annotation> annotationType() { + return Priority.class; + } + }); + return p.value(); + })).collect(Collectors.toList()); + } + + protected <T> List<T> buildalidatorList(Reflections reflections, Class<T> clazz) { + List<T> result = new ArrayList<>(); + try { + for (Class<? extends T> klass : reflections.getSubTypesOf(clazz)) { + result.add(klass.newInstance()); + } + } catch (InstantiationException | IllegalAccessException e) { + logger.error("failed to build validator list for " + clazz.getName(), e); + throw new RuntimeException(e); + } + + return result; + } + + protected List<PreBuildingBlockValidator> getPreBuildingBlockValidators() { + return this.preBuildingBlockValidators; + } + + protected List<PostBuildingBlockValidator> getPostBuildingBlockValidators() { + return this.postBuildingBlockValidators; + } + +} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/validation/PostBuildingBlockValidator.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/validation/PostBuildingBlockValidator.java new file mode 100644 index 0000000000..0b1ef5c6e1 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/validation/PostBuildingBlockValidator.java @@ -0,0 +1,26 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 - 2018 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.common.validation; + + +public interface PostBuildingBlockValidator extends BuildingBlockValidator { + +} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/validation/PreBuildingBlockValidator.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/validation/PreBuildingBlockValidator.java new file mode 100644 index 0000000000..489ac483d0 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/validation/PreBuildingBlockValidator.java @@ -0,0 +1,25 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 - 2018 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.common.validation; + +public interface PreBuildingBlockValidator extends BuildingBlockValidator { + +} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/workflow/context/WorkflowContextHolder.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/workflow/context/WorkflowContextHolder.java index 39c32de77d..eb7290b685 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/workflow/context/WorkflowContextHolder.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/workflow/context/WorkflowContextHolder.java @@ -81,13 +81,10 @@ public class WorkflowContextHolder { public WorkflowContext getWorkflowContext(String requestId) { // Note: DelayQueue interator is threadsafe for (WorkflowContext context : responseQueue) { - if (requestId.equals(context.getRequestId())) { - msoLogger.debug("Found context for request id: " + requestId); + if (requestId.equals(context.getRequestId())) { return context; } } - - msoLogger.debug("Unable to find context for request id: " + requestId); return null; } diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/AggregateRoute.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/AggregateRoute.java new file mode 100644 index 0000000000..cb9c681fd5 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/AggregateRoute.java @@ -0,0 +1,107 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 - 2018 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.servicedecomposition.bbobjects; + +import java.io.Serializable; + +import javax.persistence.Id; + +import org.onap.so.bpmn.servicedecomposition.ShallowCopy; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonRootName; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import org.apache.commons.lang3.builder.EqualsBuilder; + +@JsonRootName("aggregate-route") +public class AggregateRoute implements Serializable, ShallowCopy<AggregateRoute>{ + + private static final long serialVersionUID = -1059128545462701696L; + + @Id + @JsonProperty("route-id") + private String routeId; + @JsonProperty("route-name") + private String routeName; + @JsonProperty("network-start-address") + private String networkStartAddress; + @JsonProperty("cidr-mask") + private String cidrMask; + @JsonProperty("ip-version") + private String ipVersion; + + + public String getRouteId(){ + return routeId; + } + + public void setRouteId(String routeId){ + this.routeId = routeId; + } + + public String getRouteName(){ + return routeName; + } + + public void setRouteName(String routeName){ + this.routeName = routeName; + } + + public String getNetworkStartAddress(){ + return networkStartAddress; + } + + public void setNetworkStartAddress(String networkStartAddress){ + this.networkStartAddress = networkStartAddress; + } + + public String getCidrMask(){ + return cidrMask; + } + + public void setCidrMask(String cidrMask){ + this.cidrMask = cidrMask; + } + + public String getIpVersion(){ + return ipVersion; + } + + public void setIpVersion(String ipVersion){ + this.ipVersion = ipVersion; + } + + @Override + public boolean equals(final Object other){ + if(!(other instanceof AggregateRoute)){ + return false; + } + AggregateRoute castOther = (AggregateRoute) other; + return new EqualsBuilder().append(routeId, castOther.routeId).isEquals(); + } + + @Override + public int hashCode(){ + return new HashCodeBuilder().append(routeId).toHashCode(); + } + + +} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/L3Network.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/L3Network.java index 5f43ba076a..343bd95eaa 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/L3Network.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/L3Network.java @@ -7,9 +7,9 @@ * 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. @@ -41,7 +41,7 @@ import com.fasterxml.jackson.annotation.JsonRootName; public class L3Network implements Serializable, ShallowCopy<L3Network> { private static final long serialVersionUID = 4434492567957111317L; - + @Id @JsonProperty("network-id") private String networkId; @@ -99,6 +99,8 @@ public class L3Network implements Serializable, ShallowCopy<L3Network> { private List<SegmentationAssignment> segmentationAssignments = new ArrayList<>(); @JsonProperty("model-info-network") private ModelInfoNetwork modelInfoNetwork; + @JsonProperty("aggregate-routes") + private List<AggregateRoute> aggregateRoutes = new ArrayList<>(); public ModelInfoNetwork getModelInfoNetwork() { return modelInfoNetwork; @@ -254,6 +256,11 @@ public class L3Network implements Serializable, ShallowCopy<L3Network> { public void setCloudParams(Map<String, String> cloudParams) { this.cloudParams = cloudParams; } + + public List<AggregateRoute> getAggregateRoutes(){ + return aggregateRoutes; + } + @Override public boolean equals(final Object other) { if (!(other instanceof L3Network)) { diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetup.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetup.java index 8cc25a2c52..5296d5995f 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetup.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetup.java @@ -336,14 +336,16 @@ public class BBInputSetup implements JavaDelegate { protected VnfVfmoduleCvnfcConfigurationCustomization findVnfVfmoduleCvnfcConfigurationCustomization(String vfModuleCustomizationUUID, String vnfResourceCustomizationUUID, String cvnfcCustomizationUUID, ConfigurationResourceCustomization configurationResourceCustomization) { - for(VnfVfmoduleCvnfcConfigurationCustomization vnfVfmoduleCvnfcConfigurationCustomization : - configurationResourceCustomization.getConfigurationResource().getVnfVfmoduleCvnfcConfigurationCustomization()) { - if(vnfVfmoduleCvnfcConfigurationCustomization.getVfModuleCustomization().getModelCustomizationUUID().equalsIgnoreCase(vfModuleCustomizationUUID) - && vnfVfmoduleCvnfcConfigurationCustomization.getVnfResourceCustomization().getModelCustomizationUUID().equalsIgnoreCase(vnfResourceCustomizationUUID) - && vnfVfmoduleCvnfcConfigurationCustomization.getCvnfcCustomization().getModelCustomizationUUID().equalsIgnoreCase(cvnfcCustomizationUUID)) { - return vnfVfmoduleCvnfcConfigurationCustomization; + + if(configurationResourceCustomization.getConfigurationResource() != null) + for(VnfVfmoduleCvnfcConfigurationCustomization vnfVfmoduleCvnfcConfigurationCustomization : + configurationResourceCustomization.getConfigurationResource().getVnfVfmoduleCvnfcConfigurationCustomization()) { + if(vnfVfmoduleCvnfcConfigurationCustomization.getVfModuleCustomization().getModelCustomizationUUID().equalsIgnoreCase(vfModuleCustomizationUUID) + && vnfVfmoduleCvnfcConfigurationCustomization.getVnfResourceCustomization().getModelCustomizationUUID().equalsIgnoreCase(vnfResourceCustomizationUUID) + && vnfVfmoduleCvnfcConfigurationCustomization.getCvnfcCustomization().getModelCustomizationUUID().equalsIgnoreCase(cvnfcCustomizationUUID)) { + return vnfVfmoduleCvnfcConfigurationCustomization; + } } - } return null; } diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/ExecuteBuildingBlockRainyDay.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/ExecuteBuildingBlockRainyDay.java index d8f9a66568..32540eb996 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/ExecuteBuildingBlockRainyDay.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/ExecuteBuildingBlockRainyDay.java @@ -33,6 +33,7 @@ import org.onap.so.db.catalog.beans.macro.RainyDayHandlerStatus; import org.onap.so.db.catalog.client.CatalogDbClient; import org.onap.so.logger.MsoLogger; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.core.env.Environment; import org.springframework.stereotype.Component; @Component @@ -44,12 +45,17 @@ public class ExecuteBuildingBlockRainyDay { @Autowired private CatalogDbClient catalogDbClient; private static final String ASTERISK = "*"; + + @Autowired + private Environment environment; + protected String retryDurationPath = "mso.rainyDay.retryDurationMultiplier"; public void setRetryTimer(DelegateExecution execution) { try { + int retryDurationMult = Integer.parseInt(this.environment.getProperty(retryDurationPath)); int retryCount = (int) execution.getVariable("retryCount"); - int retryTimeToWait = (int) Math.pow(5, retryCount); - String RetryDuration = "PT" + retryTimeToWait + "M"; + int retryTimeToWait = (int) Math.pow(retryDurationMult, retryCount) * 10; + String RetryDuration = "PT" + retryTimeToWait + "S"; execution.setVariable("RetryDuration", RetryDuration); } catch (Exception e) { msoLogger.error(e); @@ -57,13 +63,14 @@ public class ExecuteBuildingBlockRainyDay { } } - public void queryRainyDayTable(DelegateExecution execution) { + public void queryRainyDayTable(DelegateExecution execution, boolean primaryPolicy) { try { ExecuteBuildingBlock ebb = (ExecuteBuildingBlock) execution.getVariable("buildingBlock"); String bbName = ebb.getBuildingBlock().getBpmnFlowName(); GeneralBuildingBlock gBBInput = (GeneralBuildingBlock) execution.getVariable("gBBInput"); Map<ResourceKey, String> lookupKeyMap = (Map<ResourceKey, String>) execution.getVariable("lookupKeyMap"); String serviceType = ASTERISK; + boolean aLaCarte = (boolean) execution.getVariable("aLaCarte"); try { serviceType = gBBInput.getCustomer().getServiceSubscription().getServiceInstances().get(0).getModelInfoServiceInstance().getServiceType(); } catch (Exception ex) { @@ -102,15 +109,26 @@ public class ExecuteBuildingBlockRainyDay { if(rainyDayHandlerStatus==null){ handlingCode = "Abort"; }else{ - handlingCode = rainyDayHandlerStatus.getPolicy(); + if(primaryPolicy){ + handlingCode = rainyDayHandlerStatus.getPolicy(); + }else{ + handlingCode = rainyDayHandlerStatus.getSecondaryPolicy(); + } } }else{ - handlingCode = rainyDayHandlerStatus.getPolicy(); + if(primaryPolicy){ + handlingCode = rainyDayHandlerStatus.getPolicy(); + }else{ + handlingCode = rainyDayHandlerStatus.getSecondaryPolicy(); + } + } + if(handlingCode.equals("RollbackToAssigned")&&!aLaCarte){ + handlingCode = "Rollback"; } msoLogger.debug("RainyDayHandler Status Code is: " + handlingCode); execution.setVariable(HANDLING_CODE, handlingCode); } catch (Exception e) { - msoLogger.debug("RainyDayHandler Status Code is: Abort"); + msoLogger.error("Failed to determine RainyDayHandler Status. Seting handlingCode = Abort"); execution.setVariable(HANDLING_CODE, "Abort"); } } |