summaryrefslogtreecommitdiffstats
path: root/model/event-model/src/main/java
diff options
context:
space:
mode:
Diffstat (limited to 'model/event-model/src/main/java')
-rw-r--r--model/event-model/src/main/java/org/onap/policy/apex/model/eventmodel/concepts/AxEvent.java59
-rw-r--r--model/event-model/src/main/java/org/onap/policy/apex/model/eventmodel/concepts/AxEventModel.java6
-rw-r--r--model/event-model/src/main/java/org/onap/policy/apex/model/eventmodel/concepts/AxEvents.java39
-rw-r--r--model/event-model/src/main/java/org/onap/policy/apex/model/eventmodel/concepts/AxField.java20
4 files changed, 64 insertions, 60 deletions
diff --git a/model/event-model/src/main/java/org/onap/policy/apex/model/eventmodel/concepts/AxEvent.java b/model/event-model/src/main/java/org/onap/policy/apex/model/eventmodel/concepts/AxEvent.java
index 4944f1b8a..099ee2260 100644
--- a/model/event-model/src/main/java/org/onap/policy/apex/model/eventmodel/concepts/AxEvent.java
+++ b/model/event-model/src/main/java/org/onap/policy/apex/model/eventmodel/concepts/AxEvent.java
@@ -53,20 +53,20 @@ import org.onap.policy.apex.model.utilities.Assertions;
* This class defines an Apex event. An {@link AxEvent} is used to kick off execution of policies in Apex and is emitted
* by policies when they completer execution. In addition, Apex uses {@link AxEvent} instances internally to pass
* control from one Apex state to the next during execution.
- * <p>
- * The {@link AxArtifactKey} of an event uniquely identifies it in an Apex system and the name field in the key is the
- * name of the event.
- * <p>
- * Each {@link AxEvent} has a name space, which is usually set to identify the domain of application of an event. For
+ *
+ * <p>The {@link AxArtifactKey} of an event uniquely identifies it in an Apex system and the name field in the key is
+ * the name of the event.
+ *
+ * <p>Each {@link AxEvent} has a name space, which is usually set to identify the domain of application of an event. For
* example a 4G cell power event might have the name space {@code org.onap.radio.4g} and the name {@code PowerEvent}.
* The source and target of the event are reserved to hold an identifier that defines the sender and receiver of an
* event respectively. The definition and structure of these fields is reserved for future use and their use by
* applications is currently not recommended.
- * <p>
- * The parameters that an event has are defined as a map of {@link AxField} instances.
- * <p>
- * Validation checks that the event key is valid. If name space is a blank string, a warning is issued. Blank source or
- * target fields result in observations being issued. An event may not have any parameters. If it has parameters, the
+ *
+ * <p>The parameters that an event has are defined as a map of {@link AxField} instances.
+ *
+ * <p>Validation checks that the event key is valid. If name space is a blank string, a warning is issued. Blank source
+ * or target fields result in observations being issued. An event may not have any parameters. If it has parameters, the
* name and value of each parameter entry is checked to ensure they are not null. Then the local name of each parameter
* is checked to ensure it matches the event parameter key on the event. Finally, the parent key of each parameter is
* checked to ensure it matches the event key.
@@ -76,8 +76,8 @@ import org.onap.policy.apex.model.utilities.Assertions;
@XmlAccessorType(XmlAccessType.FIELD)
@XmlRootElement(name = "apexEvent", namespace = "http://www.onap.org/policy/apex-pdp")
-@XmlType(name = "AxEvent", namespace = "http://www.onap.org/policy/apex-pdp",
- propOrder = { "key", "nameSpace", "source", "target", "parameterMap" })
+@XmlType(name = "AxEvent", namespace = "http://www.onap.org/policy/apex-pdp", propOrder =
+ { "key", "nameSpace", "source", "target", "parameterMap" })
public class AxEvent extends AxConcept {
private static final long serialVersionUID = -1460388382582984269L;
@@ -116,7 +116,7 @@ public class AxEvent extends AxConcept {
}
/**
- * Copy constructor
+ * Copy constructor.
*
* @param copyConcept the concept to copy from
*/
@@ -168,7 +168,7 @@ public class AxEvent extends AxConcept {
* @param parameterMap the map of parameters that the event has
*/
public AxEvent(final AxArtifactKey key, final String nameSpace, final String source, final String target,
- final SortedMap<String, AxField> parameterMap) {
+ final SortedMap<String, AxField> parameterMap) {
super();
Assertions.argumentNotNull(key, "key may not be null");
Assertions.argumentNotNull(nameSpace, "nameSpace may not be null");
@@ -198,10 +198,10 @@ public class AxEvent extends AxConcept {
* parameter map are not set. This method is called by JAXB after unmarshaling and is used to set the parent key of
* the {@link AxField} instances in the parameter map to be the key of the event that contains them.
*
- * @param u the unmarshaler that is unmarshaling the model
+ * @param unmarshaler the unmarshaler that is unmarshaling the model
* @param parent the parent object of this object in the unmarshaler
*/
- public void afterUnmarshal(final Unmarshaller u, final Object parent) {
+ public void afterUnmarshal(final Unmarshaller unmarshaler, final Object parent) {
for (final AxField parameter : parameterMap.values()) {
parameter.getKey().setParentArtifactKey(key);
}
@@ -343,34 +343,34 @@ public class AxEvent extends AxConcept {
AxValidationResult result = resultIn;
if (key.equals(AxArtifactKey.getNullKey())) {
- result.addValidationMessage(
- new AxValidationMessage(key, this.getClass(), ValidationResult.INVALID, "key is a null key"));
+ result.addValidationMessage(new AxValidationMessage(key, this.getClass(), ValidationResult.INVALID,
+ "key is a null key"));
}
result = key.validate(result);
if (nameSpace.replaceAll(WHITESPACE_REGEXP, "").length() == 0) {
result.addValidationMessage(new AxValidationMessage(key, this.getClass(), ValidationResult.WARNING,
- "nameSpace on event is blank"));
+ "nameSpace on event is blank"));
}
if (source.replaceAll(WHITESPACE_REGEXP, "").length() == 0) {
result.addValidationMessage(new AxValidationMessage(key, this.getClass(), ValidationResult.OBSERVATION,
- "source on event is blank"));
+ "source on event is blank"));
}
if (target.replaceAll(WHITESPACE_REGEXP, "").length() == 0) {
result.addValidationMessage(new AxValidationMessage(key, this.getClass(), ValidationResult.OBSERVATION,
- "target on event is blank"));
+ "target on event is blank"));
}
for (final Entry<String, AxField> eventParameterEntry : parameterMap.entrySet()) {
if (eventParameterEntry.getKey() == null || eventParameterEntry.getKey().equals(AxKey.NULL_KEY_NAME)) {
result.addValidationMessage(new AxValidationMessage(key, this.getClass(), ValidationResult.INVALID,
- "key on parameter " + eventParameterEntry.getKey() + " may not be the null key"));
+ "key on parameter " + eventParameterEntry.getKey() + " may not be the null key"));
} else if (eventParameterEntry.getValue() == null) {
result.addValidationMessage(new AxValidationMessage(key, this.getClass(), ValidationResult.INVALID,
- "value on parameter " + eventParameterEntry.getKey() + " may not be null"));
+ "value on parameter " + eventParameterEntry.getKey() + " may not be null"));
} else {
result = vaidateEventParameters(eventParameterEntry, result);
}
@@ -380,24 +380,25 @@ public class AxEvent extends AxConcept {
}
/**
- * Validate an event parameter entry
+ * Validate an event parameter entry.
*
* @param eventParameterEntry the event parameter entry
* @param result the validation result to append to
* @return The validation result
*/
private AxValidationResult vaidateEventParameters(final Entry<String, AxField> eventParameterEntry,
- final AxValidationResult result) {
+ final AxValidationResult result) {
if (!eventParameterEntry.getKey().equals(eventParameterEntry.getValue().getKey().getLocalName())) {
result.addValidationMessage(new AxValidationMessage(key, this.getClass(), ValidationResult.INVALID,
- "key on parameter " + eventParameterEntry.getKey() + " does not equal parameter field local name "
- + eventParameterEntry.getValue().getKey().getLocalName()));
+ "key on parameter " + eventParameterEntry.getKey()
+ + " does not equal parameter field local name "
+ + eventParameterEntry.getValue().getKey().getLocalName()));
}
if (!eventParameterEntry.getValue().getKey().getParentArtifactKey().equals(key)) {
result.addValidationMessage(new AxValidationMessage(key, this.getClass(), ValidationResult.INVALID,
- "parent key on parameter field " + eventParameterEntry.getValue().getKey()
- + " does not equal event key"));
+ "parent key on parameter field " + eventParameterEntry.getValue().getKey()
+ + " does not equal event key"));
}
return eventParameterEntry.getValue().validate(result);
diff --git a/model/event-model/src/main/java/org/onap/policy/apex/model/eventmodel/concepts/AxEventModel.java b/model/event-model/src/main/java/org/onap/policy/apex/model/eventmodel/concepts/AxEventModel.java
index 3447ff8f9..cab46cd39 100644
--- a/model/event-model/src/main/java/org/onap/policy/apex/model/eventmodel/concepts/AxEventModel.java
+++ b/model/event-model/src/main/java/org/onap/policy/apex/model/eventmodel/concepts/AxEventModel.java
@@ -48,8 +48,8 @@ import org.onap.policy.apex.model.utilities.Assertions;
* A container class for an Apex event model. This class is a container class that allows an Apex model to be
* constructed that contains events and context and the key information for those events and context. The model contains
* schema definitions and the definitions of events that use those schemas.
- * <p>
- * Validation runs {@link AxModel} validation on the model. In addition, the {@link AxContextSchemas} and
+ *
+ * <p>Validation runs {@link AxModel} validation on the model. In addition, the {@link AxContextSchemas} and
* {@link AxEvents} validation is run on the context schemas and events in the model.
*/
@@ -86,7 +86,7 @@ public class AxEventModel extends AxModel {
}
/**
- * Copy constructor
+ * Copy constructor.
*
* @param copyConcept the concept to copy from
*/
diff --git a/model/event-model/src/main/java/org/onap/policy/apex/model/eventmodel/concepts/AxEvents.java b/model/event-model/src/main/java/org/onap/policy/apex/model/eventmodel/concepts/AxEvents.java
index df398c2c9..e973f2ead 100644
--- a/model/event-model/src/main/java/org/onap/policy/apex/model/eventmodel/concepts/AxEvents.java
+++ b/model/event-model/src/main/java/org/onap/policy/apex/model/eventmodel/concepts/AxEvents.java
@@ -55,16 +55,17 @@ import org.onap.policy.apex.model.utilities.Assertions;
* events must have an {@link AxEvents} field. The {@link AxEvents} class implements the helper methods of the
* {@link AxConceptGetter} interface to allow {@link AxEvents} instances to be retrieved by calling methods directly on
* this class without referencing the contained map.
- * <p>
- * Validation checks that the container key is not null. An error is issued if no events are defined in the container.
- * Each event entry is checked to ensure that its key and value are not null and that the key matches the key in the map
- * value. Each event entry is then validated individually.
+ *
+ * <p>Validation checks that the container key is not null. An error is issued if no events are defined in the
+ * container. Each event entry is checked to ensure that its key and value are not null and that the key matches the key
+ * in the map value. Each event entry is then validated individually.
*/
@Entity
@Table(name = "AxEvents")
@XmlAccessorType(XmlAccessType.FIELD)
-@XmlType(name = "AxEvents", namespace = "http://www.onap.org/policy/apex-pdp", propOrder = { "key", "eventMap" })
+@XmlType(name = "AxEvents", namespace = "http://www.onap.org/policy/apex-pdp", propOrder =
+ { "key", "eventMap" })
public class AxEvents extends AxConcept implements AxConceptGetter<AxEvent> {
private static final long serialVersionUID = 4290442590545820316L;
@@ -93,7 +94,7 @@ public class AxEvents extends AxConcept implements AxConceptGetter<AxEvent> {
}
/**
- * Copy constructor
+ * Copy constructor.
*
* @param copyConcept the concept to copy from
*/
@@ -131,10 +132,10 @@ public class AxEvents extends AxConcept implements AxConceptGetter<AxEvent> {
* method is called by JAXB after unmarshaling and is used to convert the hash map to a {@link NavigableMap} so that
* it will work with the {@link AxConceptGetter} interface.
*
- * @param u the unmarshaler that is unmarshaling the model
+ * @param unmarshaler the unmarshaler that is unmarshaling the model
* @param parent the parent object of this object in the unmarshaler
*/
- public void afterUnmarshal(final Unmarshaller u, final Object parent) {
+ public void afterUnmarshal(final Unmarshaller unmarshaler, final Object parent) {
// The map must be navigable to allow name and version searching, unmarshaling returns a hash map
final NavigableMap<AxArtifactKey, AxEvent> navigableEventMap = new TreeMap<>();
navigableEventMap.putAll(eventMap);
@@ -209,28 +210,30 @@ public class AxEvents extends AxConcept implements AxConceptGetter<AxEvent> {
AxValidationResult result = resultIn;
if (key.equals(AxArtifactKey.getNullKey())) {
- result.addValidationMessage(
- new AxValidationMessage(key, this.getClass(), ValidationResult.INVALID, "key is a null key"));
+ result.addValidationMessage(new AxValidationMessage(key, this.getClass(), ValidationResult.INVALID,
+ "key is a null key"));
}
result = key.validate(result);
if (eventMap.size() == 0) {
result.addValidationMessage(new AxValidationMessage(key, this.getClass(), ValidationResult.INVALID,
- "eventMap may not be empty"));
+ "eventMap may not be empty"));
} else {
for (final Entry<AxArtifactKey, AxEvent> eventEntry : eventMap.entrySet()) {
if (eventEntry.getKey().equals(AxArtifactKey.getNullKey())) {
result.addValidationMessage(new AxValidationMessage(key, this.getClass(), ValidationResult.INVALID,
- "key on event entry " + eventEntry.getKey() + " may not be the null key"));
+ "key on event entry " + eventEntry.getKey() + " may not be the null key"));
} else if (eventEntry.getValue() == null) {
result.addValidationMessage(new AxValidationMessage(key, this.getClass(), ValidationResult.INVALID,
- "value on event entry " + eventEntry.getKey() + " may not be null"));
+ "value on event entry " + eventEntry.getKey() + " may not be null"));
} else {
if (!eventEntry.getKey().equals(eventEntry.getValue().getKey())) {
- result.addValidationMessage(new AxValidationMessage(key, this.getClass(),
- ValidationResult.INVALID, "key on event entry key " + eventEntry.getKey()
- + " does not equal event value key " + eventEntry.getValue().getKey()));
+ result.addValidationMessage(
+ new AxValidationMessage(key, this.getClass(), ValidationResult.INVALID,
+ "key on event entry key " + eventEntry.getKey()
+ + " does not equal event value key "
+ + eventEntry.getValue().getKey()));
}
result = eventEntry.getValue().validate(result);
@@ -394,7 +397,7 @@ public class AxEvents extends AxConcept implements AxConceptGetter<AxEvent> {
@Override
public AxEvent get(final String conceptKeyName, final String conceptKeyVersion) {
return new AxConceptGetterImpl<>((NavigableMap<AxArtifactKey, AxEvent>) eventMap).get(conceptKeyName,
- conceptKeyVersion);
+ conceptKeyVersion);
}
/*
@@ -415,6 +418,6 @@ public class AxEvents extends AxConcept implements AxConceptGetter<AxEvent> {
@Override
public Set<AxEvent> getAll(final String conceptKeyName, final String conceptKeyVersion) {
return new AxConceptGetterImpl<>((NavigableMap<AxArtifactKey, AxEvent>) eventMap).getAll(conceptKeyName,
- conceptKeyVersion);
+ conceptKeyVersion);
}
}
diff --git a/model/event-model/src/main/java/org/onap/policy/apex/model/eventmodel/concepts/AxField.java b/model/event-model/src/main/java/org/onap/policy/apex/model/eventmodel/concepts/AxField.java
index 4aee0ebca..6b38ca7a8 100644
--- a/model/event-model/src/main/java/org/onap/policy/apex/model/eventmodel/concepts/AxField.java
+++ b/model/event-model/src/main/java/org/onap/policy/apex/model/eventmodel/concepts/AxField.java
@@ -52,12 +52,12 @@ import org.onap.policy.apex.model.utilities.Assertions;
/**
* In Apex, a field is an input or output parameter to or from a concept. For example, the parameters of an event are
* fields and the input and output of a task is defined as a collection of fields.
- * <p>
- * A field has an {@link AxReferenceKey} key that defines its name and parent, and a {@link AxArtifactKey} key to a
+ *
+ * <p>A field has an {@link AxReferenceKey} key that defines its name and parent, and a {@link AxArtifactKey} key to a
* context schema that defines the structure of the data atom that holds the value of the field. Fields can be specified
* as being optional but are mandatory by default.
- * <p>
- * Validation checks that the field key and the field schema reference key are not null.
+ *
+ * <p>Validation checks that the field key and the field schema reference key are not null.
*/
@Entity
@Table(name = "AxField")
@@ -65,8 +65,8 @@ import org.onap.policy.apex.model.utilities.Assertions;
@XmlAccessorType(XmlAccessType.FIELD)
@XmlRootElement(name = "apexField", namespace = "http://www.onap.org/policy/apex-pdp")
-@XmlType(name = "AxField", namespace = "http://www.onap.org/policy/apex-pdp",
- propOrder = { "key", "fieldSchemaKey", "optional" })
+@XmlType(name = "AxField", namespace = "http://www.onap.org/policy/apex-pdp", propOrder =
+ { "key", "fieldSchemaKey", "optional" })
public class AxField extends AxConcept {
private static final String KEY_MAY_NOT_BE_NULL = "key may not be null";
@@ -113,7 +113,7 @@ public class AxField extends AxConcept {
}
/**
- * Copy constructor
+ * Copy constructor.
*
* @param copyConcept the concept to copy from
*/
@@ -269,15 +269,15 @@ public class AxField extends AxConcept {
AxValidationResult result = resultIn;
if (key.equals(AxReferenceKey.getNullKey())) {
- result.addValidationMessage(
- new AxValidationMessage(key, this.getClass(), ValidationResult.INVALID, "key is a null key"));
+ result.addValidationMessage(new AxValidationMessage(key, this.getClass(), ValidationResult.INVALID,
+ "key is a null key"));
}
result = key.validate(result);
if (fieldSchemaKey.equals(AxArtifactKey.getNullKey())) {
result.addValidationMessage(new AxValidationMessage(key, this.getClass(), ValidationResult.INVALID,
- "fieldSchemaKey is a null key: " + fieldSchemaKey));
+ "fieldSchemaKey is a null key: " + fieldSchemaKey));
}
return fieldSchemaKey.validate(result);
}