X-Git-Url: https://gerrit.onap.org/r/gitweb?p=dmaap%2Fdatarouter.git;a=blobdiff_plain;f=datarouter-prov%2Fsrc%2Fmain%2Fjava%2Forg%2Fonap%2Fdmaap%2Fdatarouter%2Fprovisioning%2Fbeans%2FExpiryRecord.java;h=d812036ab2e631f568b46f9a8cb09aaffe9be4b8;hp=9e6987a522d1069dce756b3a611d1ce7dbc144ee;hb=bc1df610cddfb558cf6bde90c269b4af59768648;hpb=f926474924870c9ed4d5c4c8ccba55a1942d8e37 diff --git a/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/beans/ExpiryRecord.java b/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/beans/ExpiryRecord.java index 9e6987a5..d812036a 100644 --- a/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/beans/ExpiryRecord.java +++ b/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/beans/ExpiryRecord.java @@ -46,19 +46,31 @@ public class ExpiryRecord extends BaseLogRecord { private int attempts; private String reason; + /** + * ExpiryRecord constructor. + * @param pp string array of ExpiryRecord attributes + * @throws ParseException in case of parse error + */ public ExpiryRecord(String[] pp) throws ParseException { super(pp); String fileid = pp[5]; - if (fileid.lastIndexOf('/') >= 0) + if (fileid.lastIndexOf('/') >= 0) { fileid = fileid.substring(fileid.lastIndexOf('/') + 1); + } this.subid = Integer.parseInt(pp[4]); this.fileid = fileid; this.attempts = Integer.parseInt(pp[10]); this.reason = pp[9]; - if (!reason.equals("notRetryable") && !reason.equals("retriesExhausted") && !reason.equals("diskFull")) + if (!reason.equals("notRetryable") && !reason.equals("retriesExhausted") && !reason.equals("diskFull")) { this.reason = "other"; + } } + /** + * ExpiryRecord constructor from ResultSet. + * @param rs ResultSet of ExpiryREcord attributes + * @throws SQLException in case of error with SQL statement + */ public ExpiryRecord(ResultSet rs) throws SQLException { super(rs); this.subid = rs.getInt("DELIVERY_SUBID"); @@ -99,8 +111,13 @@ public class ExpiryRecord extends BaseLogRecord { this.reason = reason; } + /** + * Method to reorder LOGJSONObject. + * @param jo LOGJSONObject + * @return LOGJSONObject + */ public LOGJSONObject reOrderObject(LOGJSONObject jo) { - LinkedHashMap logrecordObj = new LinkedHashMap(); + LinkedHashMap logrecordObj = new LinkedHashMap<>(); logrecordObj.put("expiryReason", jo.get("expiryReason")); logrecordObj.put("publishId", jo.get("publishId")); @@ -112,8 +129,7 @@ public class ExpiryRecord extends BaseLogRecord { logrecordObj.put("date", jo.get("date")); logrecordObj.put("contentLength", jo.get("contentLength")); - LOGJSONObject newjo = new LOGJSONObject(logrecordObj); - return newjo; + return new LOGJSONObject(logrecordObj); } @Override @@ -123,8 +139,7 @@ public class ExpiryRecord extends BaseLogRecord { jo.put("expiryReason", reason); jo.put("attempts", attempts); - LOGJSONObject newjo = this.reOrderObject(jo); - return newjo; + return reOrderObject(jo); } @Override