summaryrefslogtreecommitdiffstats
path: root/model/model-api
diff options
context:
space:
mode:
Diffstat (limited to 'model/model-api')
-rw-r--r--model/model-api/src/main/java/org/onap/policy/apex/model/modelapi/ApexApiResult.java20
-rw-r--r--model/model-api/src/main/java/org/onap/policy/apex/model/modelapi/impl/ApexModelImpl.java48
-rw-r--r--model/model-api/src/main/java/org/onap/policy/apex/model/modelapi/impl/ContextAlbum.java39
-rw-r--r--model/model-api/src/main/java/org/onap/policy/apex/model/modelapi/impl/ContextAlbumBuilder.java105
-rw-r--r--model/model-api/src/main/java/org/onap/policy/apex/model/modelapi/impl/ContextAlbumFacade.java5
-rw-r--r--model/model-api/src/main/java/org/onap/policy/apex/model/modelapi/impl/CreatePolicyStateTaskRef.java38
-rw-r--r--model/model-api/src/main/java/org/onap/policy/apex/model/modelapi/impl/CreatePolicyStateTaskRefBuilder.java104
-rw-r--r--model/model-api/src/main/java/org/onap/policy/apex/model/modelapi/impl/KeyInformationFacade.java23
-rw-r--r--model/model-api/src/main/java/org/onap/policy/apex/model/modelapi/impl/PolicyFacade.java3
9 files changed, 106 insertions, 279 deletions
diff --git a/model/model-api/src/main/java/org/onap/policy/apex/model/modelapi/ApexApiResult.java b/model/model-api/src/main/java/org/onap/policy/apex/model/modelapi/ApexApiResult.java
index 9fdb471dc..d05d410f8 100644
--- a/model/model-api/src/main/java/org/onap/policy/apex/model/modelapi/ApexApiResult.java
+++ b/model/model-api/src/main/java/org/onap/policy/apex/model/modelapi/ApexApiResult.java
@@ -32,11 +32,13 @@ import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlElementWrapper;
import javax.xml.bind.annotation.XmlEnum;
import javax.xml.bind.annotation.XmlRootElement;
+import lombok.Setter;
/**
* The Class ApexEditorAPIResult return the result of and messages from all model API method calls on the
* {@link ApexModel} API.
*/
+@Setter
@XmlRootElement
@XmlAccessorType(XmlAccessType.NONE)
public class ApexApiResult {
@@ -178,15 +180,6 @@ public class ApexApiResult {
}
/**
- * Sets the result status of an API operation.
- *
- * @param result the result status
- */
- public void setResult(final Result result) {
- this.result = result;
- }
-
- /**
* Gets the list of messages returned by an API operation.
*
* @return the list of messages returned by an API operation
@@ -198,15 +191,6 @@ public class ApexApiResult {
}
/**
- * Sets the list of messages to return as a result of an API operation.
- *
- * @param messages the list of messages to return as a result of an API operation
- */
- public void setMessages(final List<String> messages) {
- this.messages = messages;
- }
-
- /**
* Gets all the messages returned by an API operation as a single string.
*
* @return the messages returned by an API operation as a single string
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 67083bfe8..05976c6ed 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
@@ -24,6 +24,10 @@
package org.onap.policy.apex.model.modelapi.impl;
import java.util.Properties;
+import lombok.AccessLevel;
+import lombok.Getter;
+import lombok.NoArgsConstructor;
+import lombok.Setter;
import org.onap.policy.apex.model.basicmodel.dao.DaoParameters;
import org.onap.policy.apex.model.modelapi.ApexApiResult;
import org.onap.policy.apex.model.modelapi.ApexApiResult.Result;
@@ -37,6 +41,7 @@ import org.slf4j.LoggerFactory;
*
* @author Liam Fallon (liam.fallon@ericsson.com)
*/
+@NoArgsConstructor(access = AccessLevel.PRIVATE)
public final class ApexModelImpl implements ApexModel {
public static final String FIELDS_DEPRECATED_WARN_MSG =
@@ -46,6 +51,8 @@ public final class ApexModelImpl implements ApexModel {
private static final Logger LOGGER = LoggerFactory.getLogger(ApexModelImpl.class);
// The policy model being acted upon
+ @Getter
+ @Setter
private AxPolicyModel policyModel = new AxPolicyModel();
// The file name for the loaded file
@@ -88,13 +95,6 @@ public final class ApexModelImpl implements ApexModel {
}
/**
- * Constructor, prevents this class being sub-classed.
- */
- private ApexModelImpl() {
- // Private constructor to block subclassing
- }
-
- /**
* {@inheritDoc}.
*/
@Override
@@ -321,9 +321,9 @@ public final class ApexModelImpl implements ApexModel {
public ApexApiResult createContextAlbum(final String name, final String version, final String scope,
final String writable, final String contextSchemaName, final String contextSchemaVersion, final String uuid,
final String description) {
- return contextAlbumFacade.createContextAlbum(new ContextAlbumBuilder().setName(name).setVersion(version)
- .setScope(scope).setWritable(writable).setContextSchemaName(contextSchemaName)
- .setContextSchemaVersion(contextSchemaVersion).setUuid(uuid).setDescription(description));
+ return contextAlbumFacade.createContextAlbum(ContextAlbum.builder().name(name).version(version)
+ .scope(scope).writable(writable).contextSchemaName(contextSchemaName)
+ .contextSchemaVersion(contextSchemaVersion).uuid(uuid).description(description).build());
}
// CHECKSTYLE:ON: checkstyle:parameterNumber
@@ -335,9 +335,9 @@ public final class ApexModelImpl implements ApexModel {
public ApexApiResult updateContextAlbum(final String name, final String version, final String scope,
final String writable, final String contextSchemaName, final String contextSchemaVersion, final String uuid,
final String description) {
- return contextAlbumFacade.updateContextAlbum(new ContextAlbumBuilder().setName(name).setVersion(version)
- .setScope(scope).setWritable(writable).setContextSchemaName(contextSchemaName)
- .setContextSchemaVersion(contextSchemaVersion).setUuid(uuid).setDescription(description));
+ return contextAlbumFacade.updateContextAlbum(ContextAlbum.builder().name(name).version(version)
+ .scope(scope).writable(writable).contextSchemaName(contextSchemaName)
+ .contextSchemaVersion(contextSchemaVersion).uuid(uuid).description(description).build());
}
// CHECKSTYLE:ON: checkstyle:parameterNumber
@@ -702,9 +702,9 @@ public final class ApexModelImpl implements ApexModel {
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));
+ return policyFacade.createPolicyStateTaskRef(CreatePolicyStateTaskRef.builder().name(name)
+ .version(version).stateName(stateName).taskLocalName(taskLocalName).taskName(taskName)
+ .taskVersion(taskVersion).outputType(outputType).outputName(outputName).build());
}
// CHECKSTYLE:ON: checkstyle:parameterNumber
@@ -888,22 +888,6 @@ public final class ApexModelImpl implements ApexModel {
* {@inheritDoc}.
*/
@Override
- public AxPolicyModel getPolicyModel() {
- return policyModel;
- }
-
- /**
- * {@inheritDoc}.
- */
- @Override
- public void setPolicyModel(final AxPolicyModel policyModel) {
- this.policyModel = policyModel;
- }
-
- /**
- * {@inheritDoc}.
- */
- @Override
public AxPolicyModel build() {
return policyModel;
}
diff --git a/model/model-api/src/main/java/org/onap/policy/apex/model/modelapi/impl/ContextAlbum.java b/model/model-api/src/main/java/org/onap/policy/apex/model/modelapi/impl/ContextAlbum.java
new file mode 100644
index 000000000..5a42ed14e
--- /dev/null
+++ b/model/model-api/src/main/java/org/onap/policy/apex/model/modelapi/impl/ContextAlbum.java
@@ -0,0 +1,39 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * Copyright (C) 2019 Samsung Electronics Co., Ltd. All rights reserved.
+ * Modifications Copyright (C) 2019 Nordix Foundation.
+ * Modifications Copyright (C) 2021 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.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.policy.apex.model.modelapi.impl;
+
+import lombok.Builder;
+import lombok.Getter;
+
+@Getter
+@Builder
+public class ContextAlbum {
+ private String name;
+ private String version;
+ private String scope;
+ private String writable;
+ private String contextSchemaName;
+ private String contextSchemaVersion;
+ private String uuid;
+ private String description;
+}
diff --git a/model/model-api/src/main/java/org/onap/policy/apex/model/modelapi/impl/ContextAlbumBuilder.java b/model/model-api/src/main/java/org/onap/policy/apex/model/modelapi/impl/ContextAlbumBuilder.java
deleted file mode 100644
index 937a16e37..000000000
--- a/model/model-api/src/main/java/org/onap/policy/apex/model/modelapi/impl/ContextAlbumBuilder.java
+++ /dev/null
@@ -1,105 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * Copyright (C) 2019 Samsung Electronics Co., Ltd. All rights reserved.
- * Modifications Copyright (C) 2019 Nordix Foundation.
- * ================================================================================
- * 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=========================================================
- */
-
-package org.onap.policy.apex.model.modelapi.impl;
-
-public class ContextAlbumBuilder {
- private String name;
- private String version;
- private String scope;
- private String writable;
- private String contextSchemaName;
- private String contextSchemaVersion;
- private String uuid;
- private String description;
-
- public String getName() {
- return name;
- }
-
- public ContextAlbumBuilder setName(String name) {
- this.name = name;
- return this;
- }
-
- public String getVersion() {
- return version;
- }
-
- public ContextAlbumBuilder setVersion(String version) {
- this.version = version;
- return this;
- }
-
- public String getScope() {
- return scope;
- }
-
- public ContextAlbumBuilder setScope(String scope) {
- this.scope = scope;
- return this;
- }
-
- public String getWritable() {
- return writable;
- }
-
- public ContextAlbumBuilder setWritable(String writable) {
- this.writable = writable;
- return this;
- }
-
- public String getContextSchemaName() {
- return contextSchemaName;
- }
-
- public ContextAlbumBuilder setContextSchemaName(String contextSchemaName) {
- this.contextSchemaName = contextSchemaName;
- return this;
- }
-
- public String getContextSchemaVersion() {
- return contextSchemaVersion;
- }
-
- public ContextAlbumBuilder setContextSchemaVersion(String contextSchemaVersion) {
- this.contextSchemaVersion = contextSchemaVersion;
- return this;
- }
-
- public String getUuid() {
- return uuid;
- }
-
- public ContextAlbumBuilder setUuid(String uuid) {
- this.uuid = uuid;
- return this;
- }
-
- public String getDescription() {
- return description;
- }
-
- public ContextAlbumBuilder setDescription(String description) {
- this.description = description;
- return this;
- }
-}
diff --git a/model/model-api/src/main/java/org/onap/policy/apex/model/modelapi/impl/ContextAlbumFacade.java b/model/model-api/src/main/java/org/onap/policy/apex/model/modelapi/impl/ContextAlbumFacade.java
index 826fb9250..a78444da6 100644
--- a/model/model-api/src/main/java/org/onap/policy/apex/model/modelapi/impl/ContextAlbumFacade.java
+++ b/model/model-api/src/main/java/org/onap/policy/apex/model/modelapi/impl/ContextAlbumFacade.java
@@ -3,6 +3,7 @@
* Copyright (C) 2016-2018 Ericsson. All rights reserved.
* Modifications Copyright (C) 2019 Samsung Electronics Co., Ltd.
* Modifications Copyright (C) 2019 Nordix Foundation.
+ * Modifications Copyright (C) 2021 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.
@@ -79,7 +80,7 @@ public class ContextAlbumFacade {
* @return result of the operation
*/
// CHECKSTYLE:OFF: checkstyle:parameterNumber
- public ApexApiResult createContextAlbum(ContextAlbumBuilder builder) {
+ public ApexApiResult createContextAlbum(ContextAlbum builder) {
try {
final AxArtifactKey key = new AxArtifactKey();
key.setName(builder.getName());
@@ -131,7 +132,7 @@ public class ContextAlbumFacade {
* @return result of the operation
*/
// CHECKSTYLE:OFF: checkstyle:parameterNumber
- public ApexApiResult updateContextAlbum(ContextAlbumBuilder builder) {
+ public ApexApiResult updateContextAlbum(ContextAlbum builder) {
try {
final AxContextAlbum contextAlbum =
apexModel.getPolicyModel().getAlbums().get(builder.getName(), builder.getVersion());
diff --git a/model/model-api/src/main/java/org/onap/policy/apex/model/modelapi/impl/CreatePolicyStateTaskRef.java b/model/model-api/src/main/java/org/onap/policy/apex/model/modelapi/impl/CreatePolicyStateTaskRef.java
new file mode 100644
index 000000000..a6e4c334e
--- /dev/null
+++ b/model/model-api/src/main/java/org/onap/policy/apex/model/modelapi/impl/CreatePolicyStateTaskRef.java
@@ -0,0 +1,38 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * Copyright (C) 2019 Samsung Electronics Co., Ltd. All rights reserved.
+ * Modifications Copyright (C) 2021 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.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.policy.apex.model.modelapi.impl;
+
+import lombok.Builder;
+import lombok.Getter;
+
+@Getter
+@Builder
+public class CreatePolicyStateTaskRef {
+ private String name;
+ private String version;
+ private String stateName;
+ private String taskLocalName;
+ private String taskName;
+ private String taskVersion;
+ private String outputType;
+ private String outputName;
+}
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
deleted file mode 100644
index f56c24f38..000000000
--- a/model/model-api/src/main/java/org/onap/policy/apex/model/modelapi/impl/CreatePolicyStateTaskRefBuilder.java
+++ /dev/null
@@ -1,104 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * Copyright (C) 2019 Samsung Electronics Co., Ltd. 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.
- *
- * SPDX-License-Identifier: Apache-2.0
- * ============LICENSE_END=========================================================
- */
-
-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;
- }
-}
diff --git a/model/model-api/src/main/java/org/onap/policy/apex/model/modelapi/impl/KeyInformationFacade.java b/model/model-api/src/main/java/org/onap/policy/apex/model/modelapi/impl/KeyInformationFacade.java
index 82fc86a77..b76bfdc06 100644
--- a/model/model-api/src/main/java/org/onap/policy/apex/model/modelapi/impl/KeyInformationFacade.java
+++ b/model/model-api/src/main/java/org/onap/policy/apex/model/modelapi/impl/KeyInformationFacade.java
@@ -1,19 +1,20 @@
/*-
* ============LICENSE_START=======================================================
* Copyright (C) 2016-2018 Ericsson. All rights reserved.
+ * Modifications Copyright (C) 2021 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.
- *
+ *
* SPDX-License-Identifier: Apache-2.0
* ============LICENSE_END=========================================================
*/
@@ -23,6 +24,7 @@ package org.onap.policy.apex.model.modelapi.impl;
import java.util.Properties;
import java.util.Set;
import java.util.UUID;
+import lombok.AllArgsConstructor;
import org.onap.policy.apex.model.basicmodel.concepts.AxArtifactKey;
import org.onap.policy.apex.model.basicmodel.concepts.AxKeyInfo;
import org.onap.policy.apex.model.basicmodel.concepts.AxValidationResult;
@@ -35,6 +37,7 @@ import org.onap.policy.apex.model.modelapi.ApexModel;
*
* @author Liam Fallon (liam.fallon@ericsson.com)
*/
+@AllArgsConstructor
public class KeyInformationFacade {
private static final String CONCEPT = "concept ";
private static final String CONCEPT_S = "concept(s) ";
@@ -52,20 +55,6 @@ public class KeyInformationFacade {
private final boolean jsonMode;
/**
- * Constructor to create a key information facade for the Model API.
- *
- * @param apexModel the apex model
- * @param apexProperties Properties for the model
- * @param jsonMode set to true to return JSON strings in list and delete operations, otherwise
- * set to false
- */
- public KeyInformationFacade(final ApexModel apexModel, final Properties apexProperties, final boolean jsonMode) {
- this.apexModel = apexModel;
- this.apexProperties = apexProperties;
- this.jsonMode = jsonMode;
- }
-
- /**
* Create key information.
*
* @param name name of the concept for the key information
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 c36e7e8a5..4d0999ab1 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
@@ -3,6 +3,7 @@
* Copyright (C) 2016-2018 Ericsson. All rights reserved.
* Modifications Copyright (C) 2019 Nordix Foundation.
* Modifications Copyright (C) 2021 Bell Canada. All rights reserved.
+ * Modifications Copyright (C) 2021 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.
@@ -1042,7 +1043,7 @@ public class PolicyFacade {
* @param builder builder for the state task reference
* @return result of the operation
*/
- public ApexApiResult createPolicyStateTaskRef(CreatePolicyStateTaskRefBuilder builder) {
+ public ApexApiResult createPolicyStateTaskRef(CreatePolicyStateTaskRef builder) {
try {
Assertions.argumentNotNull(builder.getStateName(), STATE_NAME_MAY_NOT_BE_NULL);
Assertions.argumentNotNull(builder.getOutputName(), "outputName may not be null");