Continue addressing technical debt for ONAP-XACML
[policy/engine.git] / ONAP-XACML / src / main / java / org / onap / policy / xacml / std / pip / engines / OperationHistoryEngine.java
index d393d7e..355a6f6 100644 (file)
@@ -2,7 +2,7 @@
  * ============LICENSE_START=======================================================
  * ONAP-XACML
  * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2017-2018 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.
@@ -80,6 +80,10 @@ public class OperationHistoryEngine extends StdConfigurableEngine{
                        XACML3.ID_ATTRIBUTE_CATEGORY_RESOURCE, 
                        new IdentifierImpl("target"), 
                        XACML.ID_DATATYPE_STRING);
+       
+       public OperationHistoryEngine() {
+               super();
+       }
 
        private void addIntegerAttribute(StdMutablePIPResponse stdPIPResponse, Identifier category, Identifier attributeId, int value, PIPRequest pipRequest) {
                AttributeValue<BigInteger> attributeValue       = null;
@@ -93,10 +97,6 @@ public class OperationHistoryEngine extends StdConfigurableEngine{
                }
        }
 
-       public OperationHistoryEngine() {
-               super();
-       }
-
        @Override
        public Collection<PIPRequest> attributesRequired() {
                return new ArrayList<>();
@@ -290,8 +290,8 @@ public class OperationHistoryEngine extends StdConfigurableEngine{
        
        // Validating Time Units to prevent SQL Injection. 
        private static boolean validTimeUnits(String timeUnits) {
-               return (timeUnits.equalsIgnoreCase("minute") || timeUnits.equalsIgnoreCase("hour") || timeUnits.equalsIgnoreCase("day"
-                       || timeUnits.equalsIgnoreCase("week") || timeUnits.equalsIgnoreCase("month")||timeUnits.equalsIgnoreCase("year"))?
+               return ("minute".equalsIgnoreCase(timeUnits) || "hour".equalsIgnoreCase(timeUnits) || "day".equalsIgnoreCase(timeUnits
+                       || "week".equalsIgnoreCase(timeUnits) || "month".equalsIgnoreCase(timeUnits)|| "year".equalsIgnoreCase(timeUnits))?
                                true: false;
        }
 }