X-Git-Url: https://gerrit.onap.org/r/gitweb?a=blobdiff_plain;f=POLICY-SDK-APP%2Fsrc%2Fmain%2Fjava%2Forg%2Fonap%2Fpolicy%2Fcontroller%2FCreateClosedLoopFaultController.java;h=7a8212c7e60d7e35b9ba25295738ad35d3241d1f;hb=b3828de54af94f66e3a6e22bcaeb3372d14eab34;hp=a7ce45ec4384b8fe42cbb5d973d64a1641b16740;hpb=073cc188efe9abb4c010cf674e34e2cf46ef1c52;p=policy%2Fengine.git diff --git a/POLICY-SDK-APP/src/main/java/org/onap/policy/controller/CreateClosedLoopFaultController.java b/POLICY-SDK-APP/src/main/java/org/onap/policy/controller/CreateClosedLoopFaultController.java index a7ce45ec4..7a8212c7e 100644 --- a/POLICY-SDK-APP/src/main/java/org/onap/policy/controller/CreateClosedLoopFaultController.java +++ b/POLICY-SDK-APP/src/main/java/org/onap/policy/controller/CreateClosedLoopFaultController.java @@ -120,7 +120,7 @@ public class CreateClosedLoopFaultController extends RestrictedBaseController{ } jsonBody.setTriggerSignaturesUsedForUI(uiTriggerSignatures); jsonBody.setTriggerTimeWindowUsedForUI(Integer.parseInt(policyData.getClearTimeOut())); - jsonBody.setTrapMaxAgeUsedForUI(Integer.parseInt(policyData.getTrapMaxAge())); + jsonBody.setTrapMaxAge(Integer.parseInt(policyData.getTrapMaxAge())); } jsonBody.setTriggerSignatures(triggerSignatures); @@ -150,7 +150,7 @@ public class CreateClosedLoopFaultController extends RestrictedBaseController{ } jsonBody.setVerificationSignaturesUsedForUI(uifaultSignatures); - jsonBody.setVerfificationTimeWindowUsedForUI(Integer.parseInt(policyData.getVerificationclearTimeOut())); + jsonBody.setVerificationTimeWindowUsedForUI(Integer.parseInt(policyData.getVerificationclearTimeOut())); } jsonBody.setVerificationSignatures(faultSignatures); ObjectWriter om = new ObjectMapper().writer(); @@ -279,6 +279,7 @@ public class CreateClosedLoopFaultController extends RestrictedBaseController{ } } } catch(Exception e){ + policyLogger.warn("Error during callTrap" , e); return "(" + trap + ")"; } }else{ @@ -316,7 +317,7 @@ public class CreateClosedLoopFaultController extends RestrictedBaseController{ attrib = getVarbindOID(attrib); attributes = attributes + "("+ URLEncoder.encode(attrib, "UTF-8")+ ")"; } catch (UnsupportedEncodingException e1) { - //logger.error("Caused Exception while Encoding Varbind Dictionary Values"+e1); + policyLogger.error("Caused Exception while Encoding Varbind Dictionary Values",e1); } } }else{ @@ -324,7 +325,7 @@ public class CreateClosedLoopFaultController extends RestrictedBaseController{ attrib = getVarbindOID(attrib); attributes = attributes + "("+ URLEncoder.encode(attrib, "UTF-8")+ ")"; } catch (UnsupportedEncodingException e) { - //logger.error("Caused Exception while Encoding Varbind Dictionary Values"+e); + policyLogger.error("Caused Exception while Encoding Varbind Dictionary Values",e); } } }else{ @@ -348,7 +349,7 @@ public class CreateClosedLoopFaultController extends RestrictedBaseController{ attrib = getVarbindOID(attrib); attributes = attributes + "("+ URLEncoder.encode(attrib, "UTF-8") + ")"; } catch (UnsupportedEncodingException e1) { - //logger.error("Caused Exception while Encoding Varbind Dictionary Values"+e1); + policyLogger.error("Caused Exception while Encoding Varbind Dictionary Values",e1); } } }else{ @@ -356,7 +357,7 @@ public class CreateClosedLoopFaultController extends RestrictedBaseController{ attrib = getVarbindOID(attrib); attributes = attributes + "("+ URLEncoder.encode(attrib, "UTF-8") + ")"; } catch (UnsupportedEncodingException e) { - //logger.error("Caused Exception while Encoding Varbind Dictionary Values"+e); + policyLogger.error("Caused Exception while Encoding Varbind Dictionary Values",e); } } } @@ -369,6 +370,7 @@ public class CreateClosedLoopFaultController extends RestrictedBaseController{ varbindId = (VarbindDictionary) commonclassdao.getEntityItem(VarbindDictionary.class, "varbindName", attrib); return varbindId.getVarbindOID(); }catch(Exception e){ + policyLogger.error("Error during retrieving varbindName " + attrib, e); return attrib; } } @@ -511,6 +513,7 @@ public class CreateClosedLoopFaultController extends RestrictedBaseController{ try{ description = policy.getDescription().substring(0, policy.getDescription().indexOf("@CreatedBy:")); }catch(Exception e){ + policyLogger.error("Error during collecting the description tag info for createClosedLoopFault " + policyNameValue , e); description = policy.getDescription(); } policyAdapter.setPolicyDescription(description); @@ -561,7 +564,8 @@ public class CreateClosedLoopFaultController extends RestrictedBaseController{ policyAdapter.setGuard(value); } if (attributeId.equals("TTLDate") && !value.contains("NA")){ - String newDate = convertDate(value, true); + PolicyController controller = new PolicyController(); + String newDate = controller.convertDate(value); policyAdapter.setTtlDate(newDate); } } @@ -576,22 +580,6 @@ public class CreateClosedLoopFaultController extends RestrictedBaseController{ } - private String convertDate(String dateTTL, boolean portalType) { - String formateDate = null; - String[] date; - String[] parts; - - if (portalType){ - parts = dateTTL.split("-"); - formateDate = parts[2] + "-" + parts[1] + "-" + parts[0] + "T05:00:00.000Z"; - } else { - date = dateTTL.split("T"); - parts = date[0].split("-"); - formateDate = parts[2] + "-" + parts[1] + "-" + parts[0]; - } - return formateDate; - } - private String readClosedLoopJSONFile(PolicyRestAdapter policyAdapter, PolicyEntity entity) { ObjectMapper mapper = new ObjectMapper(); try { @@ -602,14 +590,14 @@ public class CreateClosedLoopFaultController extends RestrictedBaseController{ closedLoopBody.setClosedLoopPolicyStatus("InActive"); } policyAdapter.setJsonBodyData(closedLoopBody); - if(closedLoopBody.getTrapMaxAgeUsedForUI() != null){ - policyAdapter.setTrapMaxAge(closedLoopBody.getTrapMaxAgeUsedForUI().toString()); + if(closedLoopBody.getTrapMaxAge() != null){ + policyAdapter.setTrapMaxAge(closedLoopBody.getTrapMaxAge().toString()); } if(closedLoopBody.getTriggerTimeWindowUsedForUI() != null){ policyAdapter.setClearTimeOut(closedLoopBody.getTriggerTimeWindowUsedForUI().toString()); } - if(closedLoopBody.getVerfificationTimeWindowUsedForUI() != null){ - policyAdapter.setVerificationclearTimeOut(closedLoopBody.getVerfificationTimeWindowUsedForUI().toString()); + if(closedLoopBody.getVerificationTimeWindowUsedForUI() != null){ + policyAdapter.setVerificationclearTimeOut(closedLoopBody.getVerificationTimeWindowUsedForUI().toString()); } } catch (Exception e) {