- public Boolean getValidation() {
- if(policyParameters.getConfigBody()==null || policyParameters.getConfigBody().trim().isEmpty()){
- message = XACMLErrorConstants.ERROR_DATA_ISSUE+ "No Config Body given.";
- return false;
- }
- if(policyParameters.getConfigBodyType()==null){
- message = XACMLErrorConstants.ERROR_DATA_ISSUE+ "No Config Body Type given.";
- return false;
- }
- boolean levelCheck = false;
- levelCheck = PolicyApiUtils.isNumeric(policyParameters.getRiskLevel());
- if (!levelCheck){
- message = XACMLErrorConstants.ERROR_DATA_ISSUE + "Incorrect Risk Level given.";
- return false;
- }
- onapName = policyParameters.getOnapName();
- configName = policyParameters.getConfigName();
- if(onapName==null || onapName.trim().isEmpty()){
- message = XACMLErrorConstants.ERROR_DATA_ISSUE + "No ONAP Name given.";
- return false;
- }
- if(configName==null || configName.trim().isEmpty()){
- message = XACMLErrorConstants.ERROR_DATA_ISSUE + "No Config Name given.";
- return false;
- }
- message = PolicyUtils.policySpecialCharValidator(onapName);
- if(!message.contains("success")){
- message = XACMLErrorConstants.ERROR_DATA_ISSUE+ message;
+ private PolicyParameters policyParameters = null;
+ private String message = null;
+ private String policyName = null;
+ private String policyScope = null;
+ private String date = null;
+ private String onapName = null;
+ private String configName = null;
+
+ public ConfigPolicyService(String policyName, String policyScope,
+ PolicyParameters policyParameters, String date) {
+ this.policyParameters = policyParameters;
+ this.policyName = policyName;
+ this.policyScope = policyScope;
+ this.date = date;
+ papServices = new PAPServices();
+ }
+
+ public Boolean getValidation() {
+ if (policyParameters.getConfigBody() == null || policyParameters.getConfigBody().trim().isEmpty()) {
+ message = XACMLErrorConstants.ERROR_DATA_ISSUE + "No Config Body given.";
+ return false;
+ }
+ if (policyParameters.getConfigBodyType() == null) {
+ message = XACMLErrorConstants.ERROR_DATA_ISSUE + "No Config Body Type given.";
+ return false;
+ }
+ boolean levelCheck = false;
+ levelCheck = PolicyApiUtils.isNumeric(policyParameters.getRiskLevel());
+ if (!levelCheck) {
+ message = XACMLErrorConstants.ERROR_DATA_ISSUE + "Incorrect Risk Level given.";
+ return false;
+ }
+ onapName = policyParameters.getOnapName();
+ configName = policyParameters.getConfigName();
+ if (onapName == null || onapName.trim().isEmpty()) {
+ message = XACMLErrorConstants.ERROR_DATA_ISSUE + "No ONAP Name given.";
+ return false;
+ }
+ if (configName == null || configName.trim().isEmpty()) {
+ message = XACMLErrorConstants.ERROR_DATA_ISSUE + "No Config Name given.";
+ return false;
+ }
+ message = PolicyUtils.policySpecialCharValidator(onapName);
+ if (!message.contains("success")) {
+ message = XACMLErrorConstants.ERROR_DATA_ISSUE + message;