2  * ============LICENSE_START=======================================================
 
   3  *  Copyright (C) 2018 Ericsson. All rights reserved.
 
   4  *  Modifications Copyright (C) 2019 AT&T Intellectual Property.
 
   5  * ================================================================================
 
   6  * Licensed under the Apache License, Version 2.0 (the "License");
 
   7  * you may not use this file except in compliance with the License.
 
   8  * You may obtain a copy of the License at
 
  10  *      http://www.apache.org/licenses/LICENSE-2.0
 
  12  * Unless required by applicable law or agreed to in writing, software
 
  13  * distributed under the License is distributed on an "AS IS" BASIS,
 
  14  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 
  15  * See the License for the specific language governing permissions and
 
  16  * limitations under the License.
 
  18  * SPDX-License-Identifier: Apache-2.0
 
  19  * ============LICENSE_END=========================================================
 
  22 package org.onap.policy.distribution.forwarding.apex.pdp;
 
  24 import org.onap.policy.common.parameters.GroupValidationResult;
 
  25 import org.onap.policy.common.parameters.ValidationStatus;
 
  26 import org.onap.policy.common.utils.validation.ParameterValidationUtils;
 
  27 import org.onap.policy.distribution.main.parameters.PolicyForwarderConfigurationParameterGroup;
 
  30  * Holds the parameters for the{@link ApexPdpPolicyForwarder}.
 
  32 public class ApexPdpPolicyForwarderParameterGroup extends PolicyForwarderConfigurationParameterGroup {
 
  33     public static final String POLICY_FORWARDER_PLUGIN_CLASS = ApexPdpPolicyForwarder.class.getName();
 
  35     private String hostname;
 
  37     private boolean ignoreConflicts;
 
  38     private boolean forceUpdate;
 
  41      * Constructor for instantiating {@link ApexPdpPolicyForwarderParameterGroup} class.
 
  43      * @param builder the apex forwarder parameter builder
 
  45     public ApexPdpPolicyForwarderParameterGroup(final ApexPdpPolicyForwarderParameterBuilder builder) {
 
  46         this.hostname = builder.getHostname();
 
  47         this.port = builder.getPort();
 
  48         this.ignoreConflicts = builder.isIgnoreConflicts();
 
  49         this.forceUpdate = builder.isForceUpdate();
 
  52     public String getHostname() {
 
  56     public int getPort() {
 
  60     public boolean isIgnoreConflicts() {
 
  61         return ignoreConflicts;
 
  64     public boolean isForceUpdate() {
 
  69     public GroupValidationResult validate() {
 
  70         final GroupValidationResult validationResult = new GroupValidationResult(this);
 
  71         if (!ParameterValidationUtils.validateStringParameter(hostname)) {
 
  72             validationResult.setResult("hostname", ValidationStatus.INVALID,
 
  73                     "must be a non-blank string containing hostname/ipaddress");
 
  75         if (!ParameterValidationUtils.validateIntParameter(port)) {
 
  76             validationResult.setResult("port", ValidationStatus.INVALID, "must be a positive integer containing port");
 
  78         return validationResult;