summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPamela Dragosh <pdragosh@research.att.com>2017-09-22 13:30:49 +0000
committerGerrit Code Review <gerrit@onap.org>2017-09-22 13:30:49 +0000
commit240201929cdf1df02512fdad12b37347f3f0b73c (patch)
treec95e659149ad7602ed0c68fd54f7bc08c703ce01
parent085dd9b5c211edaf70533105de1a460bcfae0a14 (diff)
parent5a8fe222ebc4485fae7e78be8e9926d6e51ac93a (diff)
Merge "Added @Override method"
-rw-r--r--feature-session-persistence/src/main/java/org/onap/policy/drools/persistence/DroolsSessionEntity.java9
-rw-r--r--feature-session-persistence/src/main/java/org/onap/policy/drools/persistence/PersistenceFeature.java26
-rw-r--r--policy-management/src/main/java/org/onap/policy/drools/protocol/coders/EventProtocolCoder.java30
-rw-r--r--policy-management/src/main/java/org/onap/policy/drools/protocol/coders/JsonProtocolFilter.java4
-rw-r--r--policy-management/src/main/java/org/onap/policy/drools/protocol/coders/ProtocolCoderToolset.java5
5 files changed, 38 insertions, 36 deletions
diff --git a/feature-session-persistence/src/main/java/org/onap/policy/drools/persistence/DroolsSessionEntity.java b/feature-session-persistence/src/main/java/org/onap/policy/drools/persistence/DroolsSessionEntity.java
index 71f5ec9a..e9c5b33b 100644
--- a/feature-session-persistence/src/main/java/org/onap/policy/drools/persistence/DroolsSessionEntity.java
+++ b/feature-session-persistence/src/main/java/org/onap/policy/drools/persistence/DroolsSessionEntity.java
@@ -91,22 +91,23 @@ public class DroolsSessionEntity implements Serializable, DroolsSession {
public void setSessionId(long sessionId) {
this.sessionId = sessionId;
}
-
+
+ @Override
public Date getCreatedDate() {
return createdDate;
}
-
+ @Override
public void setCreatedDate(Date createdDate) {
this.createdDate = createdDate;
}
-
+ @Override
public Date getUpdatedDate() {
return updatedDate;
}
-
+ @Override
public void setUpdatedDate(Date updatedDate) {
this.updatedDate = updatedDate;
}
diff --git a/feature-session-persistence/src/main/java/org/onap/policy/drools/persistence/PersistenceFeature.java b/feature-session-persistence/src/main/java/org/onap/policy/drools/persistence/PersistenceFeature.java
index b48690b0..db33d05a 100644
--- a/feature-session-persistence/src/main/java/org/onap/policy/drools/persistence/PersistenceFeature.java
+++ b/feature-session-persistence/src/main/java/org/onap/policy/drools/persistence/PersistenceFeature.java
@@ -143,7 +143,7 @@ public class PersistenceFeature implements PolicySessionFeatureAPI, PolicyEngine
policyContainer.setAdjunct(this, rval);
}
- return ((ContainerAdjunct) rval);
+ return (ContainerAdjunct) rval;
}
/**
@@ -151,7 +151,7 @@ public class PersistenceFeature implements PolicySessionFeatureAPI, PolicyEngine
*/
@Override
public int getSequenceNumber() {
- return (1);
+ return 1;
}
/**
@@ -201,9 +201,9 @@ public class PersistenceFeature implements PolicySessionFeatureAPI, PolicyEngine
public PolicySession.ThreadModel selectThreadModel(PolicySession session) {
PolicyContainer policyContainer = session.getPolicyContainer();
if (isPersistenceEnabled(policyContainer, session.getName())) {
- return (new PersistentThreadModel(session, getProperties(policyContainer)));
+ return new PersistentThreadModel(session, getProperties(policyContainer));
}
- return (null);
+ return null;
}
/**
@@ -372,8 +372,8 @@ public class PersistenceFeature implements PolicySessionFeatureAPI, PolicyEngine
KieSessionConfiguration kConf = kieSvcFact.newKieSessionConfiguration();
- KieSession kieSession = (desiredSessionId >= 0 ? loadKieSession(kieBaseName, desiredSessionId, env, kConf)
- : null);
+ KieSession kieSession = desiredSessionId >= 0 ? loadKieSession(kieBaseName, desiredSessionId, env, kConf)
+ : null;
if (kieSession == null) {
// loadKieSession() returned null or desiredSessionId < 0
@@ -609,7 +609,7 @@ public class PersistenceFeature implements PolicySessionFeatureAPI, PolicyEngine
*/
private long getSessionId(DroolsSessionConnector conn, String sessnm) {
DroolsSession sess = conn.get(sessnm);
- return (sess != null ? sess.getSessionId() : -1);
+ return sess != null ? sess.getSessionId() : -1;
}
/**
@@ -650,10 +650,10 @@ public class PersistenceFeature implements PolicySessionFeatureAPI, PolicyEngine
if (properties != null) {
// fetch the 'type' property
String type = getProperty(properties, sessionName, "type");
- rval = ("auto".equals(type) || "native".equals(type));
+ rval = "auto".equals(type) || "native".equals(type);
}
- return (rval);
+ return rval;
}
/**
@@ -665,10 +665,10 @@ public class PersistenceFeature implements PolicySessionFeatureAPI, PolicyEngine
*/
private Properties getProperties(PolicyContainer container) {
try {
- return (fact.getPolicyContainer(container).getProperties());
+ return fact.getPolicyContainer(container).getProperties();
} catch (IllegalArgumentException e) {
logger.error("getProperties exception: ", e);
- return (null);
+ return null;
}
}
@@ -694,7 +694,7 @@ public class PersistenceFeature implements PolicySessionFeatureAPI, PolicyEngine
value = properties.getProperty("persistence." + property);
}
- return (value);
+ return value;
}
/* ============================================================ */
@@ -790,7 +790,7 @@ public class PersistenceFeature implements PolicySessionFeatureAPI, PolicyEngine
* @return the String to use as the thread name
*/
private String getThreadName() {
- return ("Session " + session.getFullName() + " (persistent)");
+ return "Session " + session.getFullName() + " (persistent)";
}
/***************************/
diff --git a/policy-management/src/main/java/org/onap/policy/drools/protocol/coders/EventProtocolCoder.java b/policy-management/src/main/java/org/onap/policy/drools/protocol/coders/EventProtocolCoder.java
index 762f4476..6f14076f 100644
--- a/policy-management/src/main/java/org/onap/policy/drools/protocol/coders/EventProtocolCoder.java
+++ b/policy-management/src/main/java/org/onap/policy/drools/protocol/coders/EventProtocolCoder.java
@@ -670,13 +670,13 @@ abstract class GenericEventProtocolCoder {
* and consequently the second value will be the less likely.
*/
protected final HashMap<String, Pair<ProtocolCoderToolset,ProtocolCoderToolset>> coders =
- new HashMap<String, Pair<ProtocolCoderToolset,ProtocolCoderToolset>>();
+ new HashMap<>();
/**
* Mapping topic + classname -> Protocol Set
*/
protected final HashMap<String, List<Pair<ProtocolCoderToolset,ProtocolCoderToolset>>> reverseCoders =
- new HashMap<String, List<Pair<ProtocolCoderToolset,ProtocolCoderToolset>>>();
+ new HashMap<>();
protected boolean multipleToolsetRetries = false;
@@ -735,7 +735,7 @@ abstract class GenericEventProtocolCoder {
this, reverseKey, key, toolsets.first());
List<Pair<ProtocolCoderToolset,ProtocolCoderToolset>> reverseMappings =
- new ArrayList<Pair<ProtocolCoderToolset,ProtocolCoderToolset>>();
+ new ArrayList<>();
reverseMappings.add(toolsets);
reverseCoders.put(reverseKey, reverseMappings);
}
@@ -767,7 +767,7 @@ abstract class GenericEventProtocolCoder {
// are detected in the gson encoding
Pair<ProtocolCoderToolset,ProtocolCoderToolset> coderTools =
- new Pair<ProtocolCoderToolset,ProtocolCoderToolset>(gsonCoderTools,
+ new Pair<>(gsonCoderTools,
jacksonCoderTools);
logger.info("{}: adding coders for new {}: {}", this, key, coderTools.first());
@@ -800,7 +800,7 @@ abstract class GenericEventProtocolCoder {
}
} else {
List<Pair<ProtocolCoderToolset,ProtocolCoderToolset>> toolsets =
- new ArrayList<Pair<ProtocolCoderToolset,ProtocolCoderToolset>>();
+ new ArrayList<>();
toolsets.add(coderTools);
logger.info("{}: adding toolset for reverse key {}: {}", this, reverseKey, toolsets);
@@ -909,7 +909,7 @@ abstract class GenericEventProtocolCoder {
String key = this.codersKey(groupId, artifactId, topic);
synchronized(this) {
- return (coders.containsKey(key));
+ return coders.containsKey(key);
}
}
@@ -1102,7 +1102,7 @@ abstract class GenericEventProtocolCoder {
protected List<DroolsController> droolsCreators(String topic, Object encodedClass)
throws IllegalStateException, IllegalArgumentException {
- List<DroolsController> droolsControllers = new ArrayList<DroolsController>();
+ List<DroolsController> droolsControllers = new ArrayList<>();
String reverseKey = this.reverseCodersKey(topic, encodedClass.getClass().getCanonicalName());
if (!this.reverseCoders.containsKey(reverseKey)) {
@@ -1127,8 +1127,8 @@ abstract class GenericEventProtocolCoder {
// figure out the right toolset
String groupId = encoderSet.first().getGroupId();
String artifactId = encoderSet.first().getArtifactId();
- List<CoderFilters> coders = encoderSet.first().getCoders();
- for (CoderFilters coder : coders) {
+ List<CoderFilters> coderFilters = encoderSet.first().getCoders();
+ for (CoderFilters coder : coderFilters) {
if (coder.getCodedClass().equals(encodedClass.getClass().getCanonicalName())) {
DroolsController droolsController =
DroolsController.factory.get(groupId, artifactId, "");
@@ -1206,7 +1206,7 @@ abstract class GenericEventProtocolCoder {
String key = this.codersKey(groupId, artifactId, "");
- List<CoderFilters> codersFilters = new ArrayList<CoderFilters>();
+ List<CoderFilters> codersFilters = new ArrayList<>();
for (Map.Entry<String, Pair<ProtocolCoderToolset,ProtocolCoderToolset>> entry : coders.entrySet()) {
if (entry.getKey().startsWith(key)) {
codersFilters.addAll(entry.getValue().first().getCoders());
@@ -1235,7 +1235,7 @@ abstract class GenericEventProtocolCoder {
String key = this.codersKey(groupId, artifactId, "");
- List<Pair<ProtocolCoderToolset,ProtocolCoderToolset>> coderToolset = new ArrayList<Pair<ProtocolCoderToolset,ProtocolCoderToolset>>();
+ List<Pair<ProtocolCoderToolset,ProtocolCoderToolset>> coderToolset = new ArrayList<>();
for (Map.Entry<String, Pair<ProtocolCoderToolset,ProtocolCoderToolset>> entry : coders.entrySet()) {
if (entry.getKey().startsWith(key)) {
coderToolset.add(entry.getValue());
@@ -1293,12 +1293,12 @@ abstract class GenericEventProtocolCoder {
throw new IllegalArgumentException("No Coder found for " + key);
- List<CoderFilters> coders = new ArrayList<CoderFilters>();
+ List<CoderFilters> coderFilters = new ArrayList<>();
for (Pair<ProtocolCoderToolset,ProtocolCoderToolset> toolset: toolsets) {
- coders.addAll(toolset.first().getCoders());
+ coderFilters.addAll(toolset.first().getCoders());
}
- return coders;
+ return coderFilters;
}
/**
@@ -1390,4 +1390,4 @@ class EventProtocolEncoder extends GenericEventProtocolCoder {
builder.append("EventProtocolEncoder [toString()=").append(super.toString()).append("]");
return builder.toString();
}
-} \ No newline at end of file
+}
diff --git a/policy-management/src/main/java/org/onap/policy/drools/protocol/coders/JsonProtocolFilter.java b/policy-management/src/main/java/org/onap/policy/drools/protocol/coders/JsonProtocolFilter.java
index 6afeb26a..0a52d254 100644
--- a/policy-management/src/main/java/org/onap/policy/drools/protocol/coders/JsonProtocolFilter.java
+++ b/policy-management/src/main/java/org/onap/policy/drools/protocol/coders/JsonProtocolFilter.java
@@ -119,7 +119,7 @@ public class JsonProtocolFilter {
/**
* all the filters to be applied
*/
- protected List<FilterRule> rules = new ArrayList<FilterRule>();
+ protected List<FilterRule> rules = new ArrayList<>();
/**
*
@@ -134,7 +134,7 @@ public class JsonProtocolFilter {
throw new IllegalArgumentException("No raw filters provided");
}
- List<FilterRule> filters = new ArrayList<FilterRule>();
+ List<FilterRule> filters = new ArrayList<>();
for (Pair<String, String> filterPair: rawFilters) {
if (filterPair.first() == null || filterPair.first().isEmpty()) {
continue;
diff --git a/policy-management/src/main/java/org/onap/policy/drools/protocol/coders/ProtocolCoderToolset.java b/policy-management/src/main/java/org/onap/policy/drools/protocol/coders/ProtocolCoderToolset.java
index 1c8dafea..df51473d 100644
--- a/policy-management/src/main/java/org/onap/policy/drools/protocol/coders/ProtocolCoderToolset.java
+++ b/policy-management/src/main/java/org/onap/policy/drools/protocol/coders/ProtocolCoderToolset.java
@@ -87,7 +87,7 @@ public abstract class ProtocolCoderToolset {
/**
* Protocols and associated Filters
*/
- protected final List<CoderFilters> coders = new ArrayList<CoderFilters>();
+ protected final List<CoderFilters> coders = new ArrayList<>();
/**
* Tree model (instead of class model) generic parsing to be able to inspect elements
@@ -488,7 +488,7 @@ class GsonProtocolCoderToolset extends ProtocolCoderToolset {
* Adapter for ZonedDateTime
*/
public static class GsonUTCAdapter implements JsonSerializer<ZonedDateTime>, JsonDeserializer<ZonedDateTime> {
-
+ @Override
public ZonedDateTime deserialize(JsonElement element, Type type, JsonDeserializationContext context)
throws JsonParseException {
try {
@@ -500,6 +500,7 @@ class GsonProtocolCoderToolset extends ProtocolCoderToolset {
return null;
}
+ @Override
public JsonElement serialize(ZonedDateTime datetime, Type type, JsonSerializationContext context) {
return new JsonPrimitive(datetime.format(format));
}