summaryrefslogtreecommitdiffstats
path: root/model/model-api/src/main
diff options
context:
space:
mode:
authorliamfallon <liam.fallon@est.tech>2019-02-26 14:39:32 +0000
committerliamfallon <liam.fallon@est.tech>2019-02-28 14:01:02 +0000
commitac3d4682fcc15004b8ff0d8a3631766e1cde6e05 (patch)
tree593c874039bd422b0313b52a4adaf6670d027005 /model/model-api/src/main
parent3bbf5d0d753fa4ac55c9e5a31ae450a5bcfc6a28 (diff)
Fix checkstyle problems on sonar fix
A sonar fix brought in some minor checkstyle issues. This review fixes those. Issue-ID: POLICY-1535 Change-Id: I4f9d66ffc0a4fcc8901d7e18bfb21a1d1cf135b7 Signed-off-by: liamfallon <liam.fallon@est.tech>
Diffstat (limited to 'model/model-api/src/main')
-rw-r--r--model/model-api/src/main/java/org/onap/policy/apex/model/modelapi/impl/ApexModelImpl.java66
-rw-r--r--model/model-api/src/main/java/org/onap/policy/apex/model/modelapi/impl/CreatePolicyStateTaskRefBuilder.java160
-rw-r--r--model/model-api/src/main/java/org/onap/policy/apex/model/modelapi/impl/PolicyFacade.java173
3 files changed, 199 insertions, 200 deletions
diff --git a/model/model-api/src/main/java/org/onap/policy/apex/model/modelapi/impl/ApexModelImpl.java b/model/model-api/src/main/java/org/onap/policy/apex/model/modelapi/impl/ApexModelImpl.java
index fae1d5951..12b415ad9 100644
--- a/model/model-api/src/main/java/org/onap/policy/apex/model/modelapi/impl/ApexModelImpl.java
+++ b/model/model-api/src/main/java/org/onap/policy/apex/model/modelapi/impl/ApexModelImpl.java
@@ -5,15 +5,15 @@
* 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.
- *
+ *
* SPDX-License-Identifier: Apache-2.0
* ============LICENSE_END=========================================================
*/
@@ -931,36 +931,36 @@ public final class ApexModelImpl implements ApexModel {
return policyFacade.deletePolicyStateFinalizerLogic(name, version, stateName, finalizerLogicName);
}
- /*
- * (non-Javadoc)
- *
- * @see
- * org.onap.policy.apex.core.modelapi.ApexEditorAPI#createPolicyStateTaskRef(java.lang.String,
- * java.lang.String, java.lang.String, java.lang.String, java.lang.String, java.lang.String,
- * java.lang.String, java.lang.String)
- */
- @Override
- // CHECKSTYLE:OFF: checkstyle:parameterNumber
- public ApexApiResult createPolicyStateTaskRef(
- final String name,
- final String version,
- final String stateName,
- final String taskLocalName,
- final String taskName,
- final String taskVersion,
- final String outputType,
- final String outputName) {
- return policyFacade.createPolicyStateTaskRef(
- new CreatePolicyStateTaskRefBuilder()
- .setName(name)
- .setVersion(version)
- .setStateName(stateName)
- .setTaskLocalName(taskLocalName)
- .setTaskName(taskName)
- .setTaskVersion(taskVersion)
- .setOutputType(outputType)
- .setOutputName(outputName));
- }
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.onap.policy.apex.core.modelapi.ApexEditorAPI#createPolicyStateTaskRef(java.lang.String,
+ * java.lang.String, java.lang.String, java.lang.String, java.lang.String, java.lang.String,
+ * java.lang.String, java.lang.String)
+ */
+ @Override
+ // CHECKSTYLE:OFF: checkstyle:parameterNumber
+ public ApexApiResult createPolicyStateTaskRef(
+ final String name,
+ final String version,
+ final String stateName,
+ final String taskLocalName,
+ final String taskName,
+ final String taskVersion,
+ final String outputType,
+ final String outputName) {
+ return policyFacade.createPolicyStateTaskRef(
+ new CreatePolicyStateTaskRefBuilder()
+ .setName(name)
+ .setVersion(version)
+ .setStateName(stateName)
+ .setTaskLocalName(taskLocalName)
+ .setTaskName(taskName)
+ .setTaskVersion(taskVersion)
+ .setOutputType(outputType)
+ .setOutputName(outputName));
+ }
// CHECKSTYLE:ON: checkstyle:parameterNumber
/*
diff --git a/model/model-api/src/main/java/org/onap/policy/apex/model/modelapi/impl/CreatePolicyStateTaskRefBuilder.java b/model/model-api/src/main/java/org/onap/policy/apex/model/modelapi/impl/CreatePolicyStateTaskRefBuilder.java
index d313c9d24..f56c24f38 100644
--- a/model/model-api/src/main/java/org/onap/policy/apex/model/modelapi/impl/CreatePolicyStateTaskRefBuilder.java
+++ b/model/model-api/src/main/java/org/onap/policy/apex/model/modelapi/impl/CreatePolicyStateTaskRefBuilder.java
@@ -21,84 +21,84 @@
package org.onap.policy.apex.model.modelapi.impl;
public class CreatePolicyStateTaskRefBuilder {
- private String name;
- private String version;
- private String stateName;
- private String taskLocalName;
- private String taskName;
- private String taskVersion;
- private String outputType;
- private String outputName;
-
- public String getName() {
- return name;
- }
-
- public String getVersion() {
- return version;
- }
-
- public String getStateName() {
- return stateName;
- }
-
- public String getTaskLocalName() {
- return taskLocalName;
- }
-
- public String getTaskName() {
- return taskName;
- }
-
- public String getTaskVersion() {
- return taskVersion;
- }
-
- public String getOutputType() {
- return outputType;
- }
-
- public String getOutputName() {
- return outputName;
- }
-
- public CreatePolicyStateTaskRefBuilder setName(String name) {
- this.name = name;
- return this;
- }
-
- public CreatePolicyStateTaskRefBuilder setVersion(String version) {
- this.version = version;
- return this;
- }
-
- public CreatePolicyStateTaskRefBuilder setStateName(String stateName) {
- this.stateName = stateName;
- return this;
- }
-
- public CreatePolicyStateTaskRefBuilder setTaskLocalName(String taskLocalName) {
- this.taskLocalName = taskLocalName;
- return this;
- }
-
- public CreatePolicyStateTaskRefBuilder setTaskName(String taskName) {
- this.taskName = taskName;
- return this;
- }
-
- public CreatePolicyStateTaskRefBuilder setTaskVersion(String taskVersion) {
- this.taskVersion = taskVersion;
- return this;
- }
-
- public CreatePolicyStateTaskRefBuilder setOutputType(String outputType) {
- this.outputType = outputType;
- return this;
- }
-
- public CreatePolicyStateTaskRefBuilder setOutputName(String outputName) {
- this.outputName = outputName;
- return this;
- }
+ private String name;
+ private String version;
+ private String stateName;
+ private String taskLocalName;
+ private String taskName;
+ private String taskVersion;
+ private String outputType;
+ private String outputName;
+
+ public String getName() {
+ return name;
+ }
+
+ public String getVersion() {
+ return version;
+ }
+
+ public String getStateName() {
+ return stateName;
+ }
+
+ public String getTaskLocalName() {
+ return taskLocalName;
+ }
+
+ public String getTaskName() {
+ return taskName;
+ }
+
+ public String getTaskVersion() {
+ return taskVersion;
+ }
+
+ public String getOutputType() {
+ return outputType;
+ }
+
+ public String getOutputName() {
+ return outputName;
+ }
+
+ public CreatePolicyStateTaskRefBuilder setName(String name) {
+ this.name = name;
+ return this;
+ }
+
+ public CreatePolicyStateTaskRefBuilder setVersion(String version) {
+ this.version = version;
+ return this;
+ }
+
+ public CreatePolicyStateTaskRefBuilder setStateName(String stateName) {
+ this.stateName = stateName;
+ return this;
+ }
+
+ public CreatePolicyStateTaskRefBuilder setTaskLocalName(String taskLocalName) {
+ this.taskLocalName = taskLocalName;
+ return this;
+ }
+
+ public CreatePolicyStateTaskRefBuilder setTaskName(String taskName) {
+ this.taskName = taskName;
+ return this;
+ }
+
+ public CreatePolicyStateTaskRefBuilder setTaskVersion(String taskVersion) {
+ this.taskVersion = taskVersion;
+ return this;
+ }
+
+ public CreatePolicyStateTaskRefBuilder setOutputType(String outputType) {
+ this.outputType = outputType;
+ return this;
+ }
+
+ public CreatePolicyStateTaskRefBuilder setOutputName(String outputName) {
+ this.outputName = outputName;
+ return this;
+ }
}
diff --git a/model/model-api/src/main/java/org/onap/policy/apex/model/modelapi/impl/PolicyFacade.java b/model/model-api/src/main/java/org/onap/policy/apex/model/modelapi/impl/PolicyFacade.java
index d43ef3bd0..8ab4d02d7 100644
--- a/model/model-api/src/main/java/org/onap/policy/apex/model/modelapi/impl/PolicyFacade.java
+++ b/model/model-api/src/main/java/org/onap/policy/apex/model/modelapi/impl/PolicyFacade.java
@@ -5,15 +5,15 @@
* 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.
- *
+ *
* SPDX-License-Identifier: Apache-2.0
* ============LICENSE_END=========================================================
*/
@@ -1010,90 +1010,89 @@ public class PolicyFacade {
}
}
- /**
- * Create a policy state task reference.
- *
- * @param CreatePolicyStateTaskRefBuilder
-
- * @return result of the operation
- */
- public ApexApiResult createPolicyStateTaskRef(CreatePolicyStateTaskRefBuilder builder) {
- try {
- Assertions.argumentNotNull(builder.getStateName(), STATE_NAME_MAY_NOT_BE_NULL);
- Assertions.argumentNotNull(builder.getOutputName(), "outputName may not be null");
-
- final AxPolicy policy =
- apexModel.getPolicyModel().getPolicies().get(builder.getName(), builder.getVersion());
- if (policy == null) {
- return new ApexApiResult(
- ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST,
- CONCEPT + builder.getName() + ':' + builder.getVersion() + DOES_NOT_EXIST);
- }
-
- final AxState state = policy.getStateMap().get(builder.getStateName());
- if (state == null) {
- return new ApexApiResult(
- ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST,
- CONCEPT + policy.getKey().getId() + ':' + builder.getStateName() + DOES_NOT_EXIST);
- }
-
- final AxTask task =
- apexModel
- .getPolicyModel()
- .getTasks()
- .get(builder.getTaskName(), builder.getTaskVersion());
- if (task == null) {
- return new ApexApiResult(
- ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST,
- CONCEPT + builder.getTaskName() + ':' + builder.getTaskVersion() + DOES_NOT_EXIST);
- }
-
- if (state.getTaskReferences().containsKey(task.getKey())) {
- return new ApexApiResult(
- ApexApiResult.Result.CONCEPT_EXISTS,
- "task "
- + task.getKey().getId()
- + " already has reference with output "
- + state.getTaskReferences().get(task.getKey()));
- }
-
- AxReferenceKey refKey;
- if (builder.getTaskLocalName() == null) {
- refKey = new AxReferenceKey(state.getKey(), state.getKey().getParentKeyName());
- } else {
- refKey = new AxReferenceKey(state.getKey(), builder.getTaskLocalName());
- }
-
- // The reference to the output we're using here
- final AxReferenceKey outputRefKey =
- new AxReferenceKey(state.getKey(), builder.getOutputName());
-
- final AxStateTaskOutputType stateTaskOutputType =
- AxStateTaskOutputType.valueOf(builder.getOutputType());
- if (stateTaskOutputType.equals(AxStateTaskOutputType.DIRECT)) {
- if (!state.getStateOutputs().containsKey(outputRefKey.getLocalName())) {
- return new ApexApiResult(
- ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST,
- "state output concept " + outputRefKey.getId() + DOES_NOT_EXIST);
- }
- } else if (stateTaskOutputType.equals(AxStateTaskOutputType.LOGIC)) {
- if (!state.getStateFinalizerLogicMap().containsKey(outputRefKey.getLocalName())) {
- return new ApexApiResult(
- ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST,
- "state finalizer logic concept " + outputRefKey.getId() + DOES_NOT_EXIST);
+ /**
+ * Create a policy state task reference.
+ *
+ * @param builder builder for the state task reference
+ * @return result of the operation
+ */
+ public ApexApiResult createPolicyStateTaskRef(CreatePolicyStateTaskRefBuilder builder) {
+ try {
+ Assertions.argumentNotNull(builder.getStateName(), STATE_NAME_MAY_NOT_BE_NULL);
+ Assertions.argumentNotNull(builder.getOutputName(), "outputName may not be null");
+
+ final AxPolicy policy =
+ apexModel.getPolicyModel().getPolicies().get(builder.getName(), builder.getVersion());
+ if (policy == null) {
+ return new ApexApiResult(
+ ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST,
+ CONCEPT + builder.getName() + ':' + builder.getVersion() + DOES_NOT_EXIST);
+ }
+
+ final AxState state = policy.getStateMap().get(builder.getStateName());
+ if (state == null) {
+ return new ApexApiResult(
+ ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST,
+ CONCEPT + policy.getKey().getId() + ':' + builder.getStateName() + DOES_NOT_EXIST);
+ }
+
+ final AxTask task =
+ apexModel
+ .getPolicyModel()
+ .getTasks()
+ .get(builder.getTaskName(), builder.getTaskVersion());
+ if (task == null) {
+ return new ApexApiResult(
+ ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST,
+ CONCEPT + builder.getTaskName() + ':' + builder.getTaskVersion() + DOES_NOT_EXIST);
+ }
+
+ if (state.getTaskReferences().containsKey(task.getKey())) {
+ return new ApexApiResult(
+ ApexApiResult.Result.CONCEPT_EXISTS,
+ "task "
+ + task.getKey().getId()
+ + " already has reference with output "
+ + state.getTaskReferences().get(task.getKey()));
+ }
+
+ AxReferenceKey refKey;
+ if (builder.getTaskLocalName() == null) {
+ refKey = new AxReferenceKey(state.getKey(), state.getKey().getParentKeyName());
+ } else {
+ refKey = new AxReferenceKey(state.getKey(), builder.getTaskLocalName());
+ }
+
+ // The reference to the output we're using here
+ final AxReferenceKey outputRefKey =
+ new AxReferenceKey(state.getKey(), builder.getOutputName());
+
+ final AxStateTaskOutputType stateTaskOutputType =
+ AxStateTaskOutputType.valueOf(builder.getOutputType());
+ if (stateTaskOutputType.equals(AxStateTaskOutputType.DIRECT)) {
+ if (!state.getStateOutputs().containsKey(outputRefKey.getLocalName())) {
+ return new ApexApiResult(
+ ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST,
+ "state output concept " + outputRefKey.getId() + DOES_NOT_EXIST);
+ }
+ } else if (stateTaskOutputType.equals(AxStateTaskOutputType.LOGIC)) {
+ if (!state.getStateFinalizerLogicMap().containsKey(outputRefKey.getLocalName())) {
+ return new ApexApiResult(
+ ApexApiResult.Result.CONCEPT_DOES_NOT_EXIST,
+ "state finalizer logic concept " + outputRefKey.getId() + DOES_NOT_EXIST);
+ }
+ } else {
+ return new ApexApiResult(
+ ApexApiResult.Result.FAILED, "output type " + builder.getOutputType() + " invalid");
+ }
+
+ state
+ .getTaskReferences()
+ .put(task.getKey(), new AxStateTaskReference(refKey, stateTaskOutputType, outputRefKey));
+ return new ApexApiResult();
+ } catch (final Exception e) {
+ return new ApexApiResult(ApexApiResult.Result.FAILED, e);
}
- } else {
- return new ApexApiResult(
- ApexApiResult.Result.FAILED, "output type " + builder.getOutputType() + " invalid");
- }
-
- state
- .getTaskReferences()
- .put(task.getKey(), new AxStateTaskReference(refKey, stateTaskOutputType, outputRefKey));
- return new ApexApiResult();
- } catch (final Exception e) {
- return new ApexApiResult(ApexApiResult.Result.FAILED, e);
- }
}
/**
@@ -1333,7 +1332,7 @@ public class PolicyFacade {
final Set<AxArtifactKey> deleteSet = new TreeSet<>();
for (final AxArtifactKey albumKey : state.getContextAlbumReferences()) {
-
+
if ((contextAlbumName != null && !albumKey.getName().equals(contextAlbumName))
|| (contextAlbumVersion != null && !albumKey.getVersion().equals(contextAlbumVersion))) {