Unit/SONAR/Checkstyle in ONAP-REST
[policy/engine.git] / ONAP-REST / src / main / java / org / onap / policy / rest / jpa / PipConfiguration.java
@@ -3,13 +3,14 @@
  * ONAP-REST
  * ================================================================================
  * Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved.
  * ONAP-REST
  * ================================================================================
  * Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved.
+ * Modifications Copyright (C) 2019 Nordix Foundation.
  * ================================================================================
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
  * You may obtain a copy of the License at
  * ================================================================================
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
  * You may obtain a copy of the License at
- * 
+ *
  *      http://www.apache.org/licenses/LICENSE-2.0
  *      http://www.apache.org/licenses/LICENSE-2.0
- * 
+ *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 
 package org.onap.policy.rest.jpa;
 
 
 package org.onap.policy.rest.jpa;
 
+import com.att.research.xacml.api.pip.PIPException;
+import com.att.research.xacml.std.pip.engines.StdConfigurableEngine;
+import com.att.research.xacml.util.XACMLProperties;
+import com.google.common.base.Joiner;
+import com.google.common.base.Splitter;
+
 import java.io.Serializable;
 import java.util.ArrayList;
 import java.util.Collection;
 import java.io.Serializable;
 import java.util.ArrayList;
 import java.util.Collection;
@@ -49,85 +56,89 @@ import javax.persistence.Temporal;
 import javax.persistence.TemporalType;
 import javax.persistence.Transient;
 
 import javax.persistence.TemporalType;
 import javax.persistence.Transient;
 
+import lombok.Getter;
+import lombok.NoArgsConstructor;
+import lombok.Setter;
+import lombok.ToString;
+
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.onap.policy.common.logging.eelf.MessageCodes;
 import org.onap.policy.common.logging.eelf.PolicyLogger;
 import org.onap.policy.xacml.api.XACMLErrorConstants;
 
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.onap.policy.common.logging.eelf.MessageCodes;
 import org.onap.policy.common.logging.eelf.PolicyLogger;
 import org.onap.policy.xacml.api.XACMLErrorConstants;
 
-import com.att.research.xacml.api.pip.PIPException;
-import com.att.research.xacml.std.pip.engines.StdConfigurableEngine;
-import com.att.research.xacml.util.XACMLProperties;
-import com.google.common.base.Joiner;
-import com.google.common.base.Splitter;
-
-
 /**
 /**
- * The persistent class for the PIPConfiguration database table.
- * 
+ * The persistent class for the PipConfiguration database table.
+ *
  */
 @Entity
  */
 @Entity
-@Table(name="PIPConfiguration")
-@NamedQuery(name="PIPConfiguration.findAll", query="SELECT p FROM PIPConfiguration p")
-public class PIPConfiguration implements Serializable {
+@Table(name = "PipConfiguration")
+@NamedQuery(name = "PipConfiguration.findAll", query = "SELECT p FROM PipConfiguration p")
+@Getter
+@Setter
+@NoArgsConstructor
+@ToString
+public class PipConfiguration implements Serializable {
     private static final long serialVersionUID = 1L;
     private static final long serialVersionUID = 1L;
-    private static final Log logger    = LogFactory.getLog(PIPConfiguration.class);
+    private static final Log logger = LogFactory.getLog(PipConfiguration.class);
 
     @Id
 
     @Id
-    @GeneratedValue(strategy=GenerationType.AUTO)
-    @Column(name="id")
+    @GeneratedValue(strategy = GenerationType.AUTO)
+    @Column(name = "id")
     private int id;
 
     private int id;
 
-    @Column(name="DESCRIPTION", nullable=true, length=2048)
+    @Column(name = "DESCRIPTION", nullable = true, length = 2048)
     private String description;
 
     private String description;
 
-    @Column(name="NAME", nullable=false, length=255)
+    @Column(name = "NAME", nullable = false, length = 255)
     private String name;
 
     private String name;
 
-    @Column(name="CLASSNAME", nullable=false, length=2048)
+    @Column(name = "CLASSNAME", nullable = false, length = 2048)
     private String classname;
 
     private String classname;
 
-    @Column(name="ISSUER", nullable=true, length=1024)
+    @Column(name = "ISSUER", nullable = true, length = 1024)
     private String issuer;
 
     private String issuer;
 
-    @Column(name="READ_ONLY", nullable=false)
+    @Column(name = "READ_ONLY", nullable = false)
     private char readOnly = '0';
 
     private char readOnly = '0';
 
-    @Column(name="REQUIRES_RESOLVER", nullable=false)
+    @Column(name = "REQUIRES_RESOLVER", nullable = false)
     private char requiresResolvers;
 
     private char requiresResolvers;
 
-    @Column(name="CREATED_BY", nullable=false, length=255)
+    @Column(name = "CREATED_BY", nullable = false, length = 255)
     private String createdBy = "guest";
 
     @Temporal(TemporalType.TIMESTAMP)
     private String createdBy = "guest";
 
     @Temporal(TemporalType.TIMESTAMP)
-    @Column(name="CREATED_DATE", nullable=false, updatable=false)
+    @Column(name = "CREATED_DATE", nullable = false, updatable = false)
     private Date createdDate;
 
     private Date createdDate;
 
-    @Column(name="MODIFIED_BY", nullable=false, length=255)
+    @Column(name = "MODIFIED_BY", nullable = false, length = 255)
     private String modifiedBy = "guest";
 
     @Temporal(TemporalType.TIMESTAMP)
     private String modifiedBy = "guest";
 
     @Temporal(TemporalType.TIMESTAMP)
-    @Column(name="MODIFIED_DATE", nullable=false)
+    @Column(name = "MODIFIED_DATE", nullable = false)
     private Date modifiedDate;
 
     private Date modifiedDate;
 
-    //bi-directional many-to-one association to PIPConfigParam
-    @OneToMany(mappedBy="pipconfiguration", orphanRemoval=true, cascade=CascadeType.REMOVE)
-    private Set<PIPConfigParam> pipconfigParams = new HashSet<>();
+    // bi-directional many-to-one association to PipConfigParam
+    @OneToMany(mappedBy = "pipconfiguration", orphanRemoval = true, cascade = CascadeType.REMOVE)
+    private Set<PipConfigParam> pipconfigParams = new HashSet<>();
 
 
-    //bi-directional many-to-one association to PIPType
+    // bi-directional many-to-one association to PipType
     @ManyToOne
     @ManyToOne
-    @JoinColumn(name="TYPE")
-    private PIPType piptype;
-
-    //bi-directional many-to-one association to PIPResolver
-    @OneToMany(mappedBy="pipconfiguration", orphanRemoval=true, cascade=CascadeType.REMOVE)
-    private Set<PIPResolver> pipresolvers = new HashSet<>();
-
-    public PIPConfiguration() {
-        //An empty constructor
-    }
-
-    public PIPConfiguration(PIPConfiguration config, String user) {
+    @JoinColumn(name = "TYPE")
+    private PipType piptype;
+
+    // bi-directional many-to-one association to PipResolver
+    @OneToMany(mappedBy = "pipconfiguration", orphanRemoval = true, cascade = CascadeType.REMOVE)
+    private Set<PipResolver> pipresolvers = new HashSet<>();
+
+    /**
+     * Instantiates a new PIP configuration.
+     *
+     * @param config the config
+     * @param user the user
+     */
+    public PipConfiguration(PipConfiguration config, String user) {
         this.description = config.description;
         this.name = config.name;
         this.classname = config.classname;
         this.description = config.description;
         this.name = config.name;
         this.classname = config.classname;
@@ -135,108 +146,77 @@ public class PIPConfiguration implements Serializable {
         this.requiresResolvers = config.requiresResolvers;
         this.readOnly = config.readOnly;
         this.piptype = config.piptype;
         this.requiresResolvers = config.requiresResolvers;
         this.readOnly = config.readOnly;
         this.piptype = config.piptype;
-        for (PIPConfigParam param : config.pipconfigParams) {
-            this.addPipconfigParam(new PIPConfigParam(param));
+        for (PipConfigParam param : config.pipconfigParams) {
+            this.addPipconfigParam(new PipConfigParam(param));
         }
         }
-        for (PIPResolver resolver : config.pipresolvers) {
-            this.addPipresolver(new PIPResolver(resolver));
+        for (PipResolver resolver : config.pipresolvers) {
+            this.addPipresolver(new PipResolver(resolver));
         }
     }
 
         }
     }
 
-    public PIPConfiguration(String id, Properties properties) throws PIPException {
+    /**
+     * Instantiates a new PIP configuration.
+     *
+     * @param id the id
+     * @param properties the properties
+     * @throws PIPException the PIP exception
+     */
+    public PipConfiguration(String id, Properties properties) throws PIPException {
         this.readProperties(id, properties);
     }
 
         this.readProperties(id, properties);
     }
 
-    public PIPConfiguration(String id, Properties properties, String user) throws PIPException {
+    /**
+     * Instantiates a new PIP configuration.
+     *
+     * @param id the id
+     * @param properties the properties
+     * @param user the user
+     * @throws PIPException the PIP exception
+     */
+    public PipConfiguration(String id, Properties properties, String user) throws PIPException {
         this.createdBy = user;
         this.modifiedBy = user;
         this.readProperties(id, properties);
     }
 
         this.createdBy = user;
         this.modifiedBy = user;
         this.readProperties(id, properties);
     }
 
+    /**
+     * Pre persist.
+     */
     @PrePersist
     @PrePersist
-    public void        prePersist() {
+    public void prePersist() {
         Date date = new Date();
         this.createdDate = date;
         this.modifiedDate = date;
     }
 
         Date date = new Date();
         this.createdDate = date;
         this.modifiedDate = date;
     }
 
+    /**
+     * Pre update.
+     */
     @PreUpdate
     public void preUpdate() {
         this.modifiedDate = new Date();
     }
 
     @PreUpdate
     public void preUpdate() {
         this.modifiedDate = new Date();
     }
 
-    public int getId() {
-        return this.id;
-    }
-
-    public void setId(int id) {
-        this.id = id;
-    }
-
-    public String getDescription() {
-        return this.description;
-    }
-
-    public void setDescription(String description) {
-        this.description = description;
-    }
-
-    public String getName() {
-        return this.name;
-    }
-
-    public void setName(String name) {
-        this.name = name;
-    }
-
-    public String getClassname() {
-        return classname;
-    }
-
-    public void setClassname(String classname) {
-        this.classname = classname;
-    }
-
-    public String getIssuer() {
-        return issuer;
-    }
-
-    public void setIssuer(String issuer) {
-        this.issuer = issuer;
-    }
-
-    public char getReadOnly() {
-        return readOnly;
-    }
-
-    public void setReadOnly(char readOnly) {
-        this.readOnly = readOnly;
-    }
-
-    public char getRequiresResolvers() {
-        return requiresResolvers;
-    }
-
-    public void setRequiresResolvers(char requireResolvers) {
-        this.requiresResolvers = requireResolvers;
-    }
-
-    public Set<PIPConfigParam> getPipconfigParams() {
-        return this.pipconfigParams;
-    }
-
-    public void setPipconfigParams(Set<PIPConfigParam> pipconfigParams) {
-        this.pipconfigParams = pipconfigParams;
-    }
-
-    public PIPConfigParam addPipconfigParam(PIPConfigParam pipconfigParam) {
+    /**
+     * Adds the pipconfig param.
+     *
+     * @param pipconfigParam the pipconfig param
+     * @return the PIP config param
+     */
+    public PipConfigParam addPipconfigParam(PipConfigParam pipconfigParam) {
         getPipconfigParams().add(pipconfigParam);
         pipconfigParam.setPipconfiguration(this);
 
         return pipconfigParam;
     }
 
         getPipconfigParams().add(pipconfigParam);
         pipconfigParam.setPipconfiguration(this);
 
         return pipconfigParam;
     }
 
-    public PIPConfigParam removePipconfigParam(PIPConfigParam pipconfigParam) {
+    /**
+     * Removes the pipconfig param.
+     *
+     * @param pipconfigParam the pipconfig param
+     * @return the PIP config param
+     */
+    public PipConfigParam removePipconfigParam(PipConfigParam pipconfigParam) {
         if (pipconfigParam == null) {
             return pipconfigParam;
         }
         if (pipconfigParam == null) {
             return pipconfigParam;
         }
@@ -246,6 +226,9 @@ public class PIPConfiguration implements Serializable {
         return pipconfigParam;
     }
 
         return pipconfigParam;
     }
 
+    /**
+     * Clear config params.
+     */
     @Transient
     public void clearConfigParams() {
         while (!this.pipconfigParams.isEmpty()) {
     @Transient
     public void clearConfigParams() {
         while (!this.pipconfigParams.isEmpty()) {
@@ -253,75 +236,49 @@ public class PIPConfiguration implements Serializable {
         }
     }
 
         }
     }
 
-    public PIPType getPiptype() {
-        return this.piptype;
-    }
-
-    public void setPiptype(PIPType piptype) {
-        this.piptype = piptype;
-    }
-
-    public Set<PIPResolver> getPipresolvers() {
-        return this.pipresolvers;
-    }
-
-    public void setPipresolvers(Set<PIPResolver> pipresolvers) {
-        this.pipresolvers = pipresolvers;
-    }
-
-    public PIPResolver addPipresolver(PIPResolver pipresolver) {
+    /**
+     * Adds the pipresolver.
+     *
+     * @param pipresolver the pipresolver
+     * @return the PIP resolver
+     */
+    public PipResolver addPipresolver(PipResolver pipresolver) {
         getPipresolvers().add(pipresolver);
         pipresolver.setPipconfiguration(this);
 
         return pipresolver;
     }
 
         getPipresolvers().add(pipresolver);
         pipresolver.setPipconfiguration(this);
 
         return pipresolver;
     }
 
-    public PIPResolver removePipresolver(PIPResolver pipresolver) {
+    /**
+     * Removes the pipresolver.
+     *
+     * @param pipresolver the pipresolver
+     * @return the PIP resolver
+     */
+    public PipResolver removePipresolver(PipResolver pipresolver) {
         getPipresolvers().remove(pipresolver);
         pipresolver.setPipconfiguration(null);
 
         return pipresolver;
     }
 
         getPipresolvers().remove(pipresolver);
         pipresolver.setPipconfiguration(null);
 
         return pipresolver;
     }
 
-    public String getCreatedBy() {
-        return createdBy;
-    }
-
-    public void setCreatedBy(String createdBy) {
-        this.createdBy = createdBy;
-    }
-
-    public Date getCreatedDate() {
-        return createdDate;
-    }
-
-    public void setCreatedDate(Date createdDate) {
-        this.createdDate = createdDate;
-    }
-
-    public String getModifiedBy() {
-        return modifiedBy;
-    }
-
-    public void setModifiedBy(String modifiedBy) {
-        this.modifiedBy = modifiedBy;
-    }
-
-    public Date getModifiedDate() {
-        return modifiedDate;
-    }
-
-    public void setModifiedDate(Date modifiedDate) {
-        this.modifiedDate = modifiedDate;
-    }
-
+    /**
+     * Checks if is read only.
+     *
+     * @return true, if is read only
+     */
     @Transient
     public boolean isReadOnly() {
         return this.readOnly == '1';
     }
 
     @Transient
     public boolean isReadOnly() {
         return this.readOnly == '1';
     }
 
+    /**
+     * Sets the read only flag.
+     *
+     * @param readOnly the new read only flag
+     */
     @Transient
     @Transient
-    public void setReadOnly(boolean readOnly) {
+    public void setReadOnlyFlag(boolean readOnly) {
         if (readOnly) {
             this.readOnly = '1';
         } else {
         if (readOnly) {
             this.readOnly = '1';
         } else {
@@ -329,13 +286,23 @@ public class PIPConfiguration implements Serializable {
         }
     }
 
         }
     }
 
+    /**
+     * Requires resolvers.
+     *
+     * @return true, if successful
+     */
     @Transient
     public boolean requiresResolvers() {
         return this.requiresResolvers == '1';
     }
 
     @Transient
     public boolean requiresResolvers() {
         return this.requiresResolvers == '1';
     }
 
+    /**
+     * Sets the requires resolvers flag.
+     *
+     * @param requires the new requires resolvers flag
+     */
     @Transient
     @Transient
-    public void        setRequiresResolvers(boolean requires) {
+    public void setRequiresResolversFlag(boolean requires) {
         if (requires) {
             this.requiresResolvers = '1';
         } else {
         if (requires) {
             this.requiresResolvers = '1';
         } else {
@@ -343,32 +310,45 @@ public class PIPConfiguration implements Serializable {
         }
     }
 
         }
     }
 
+    /**
+     * Import PIP configurations.
+     *
+     * @param properties the properties
+     * @return the collection
+     */
     @Transient
     @Transient
-    public static Collection<PIPConfiguration>         importPIPConfigurations(Properties properties) {
-        Collection<PIPConfiguration> configurations = new ArrayList<>();
+    public static Collection<PipConfiguration> importPipConfigurations(Properties properties) {
+        Collection<PipConfiguration> configurations = new ArrayList<>();
         String engines = properties.getProperty(XACMLProperties.PROP_PIP_ENGINES);
         if (engines == null || engines.isEmpty()) {
             return configurations;
         }
         for (String id : Splitter.on(',').trimResults().omitEmptyStrings().split(engines)) {
         String engines = properties.getProperty(XACMLProperties.PROP_PIP_ENGINES);
         if (engines == null || engines.isEmpty()) {
             return configurations;
         }
         for (String id : Splitter.on(',').trimResults().omitEmptyStrings().split(engines)) {
-            PIPConfiguration configuration;
+            PipConfiguration configuration;
             try {
                 String user = "super-admin";
             try {
                 String user = "super-admin";
-                configuration = new PIPConfiguration(id, properties, user);
+                configuration = new PipConfiguration(id, properties, user);
                 configuration.setCreatedBy(user);
                 configuration.setModifiedBy(user);
                 configurations.add(configuration);
             } catch (PIPException e) {
                 logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Import failed: " + e.getLocalizedMessage());
                 configuration.setCreatedBy(user);
                 configuration.setModifiedBy(user);
                 configurations.add(configuration);
             } catch (PIPException e) {
                 logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Import failed: " + e.getLocalizedMessage());
-                PolicyLogger.error(MessageCodes.EXCEPTION_ERROR, e, "PIPConfiguration", "Import failed");
+                PolicyLogger.error(MessageCodes.EXCEPTION_ERROR, e, "PipConfiguration", "Import failed");
             }
         }
 
         return configurations;
     }
 
             }
         }
 
         return configurations;
     }
 
+    /**
+     * Read properties.
+     *
+     * @param id the id
+     * @param properties the properties
+     * @throws PIPException the PIP exception
+     */
     @Transient
     @Transient
-    protected  void            readProperties(String id, Properties properties) throws PIPException {
+    protected void readProperties(String id, Properties properties) throws PIPException {
         //
         // Save the id if we don't have one already
         //
         //
         // Save the id if we don't have one already
         //
@@ -378,7 +358,7 @@ public class PIPConfiguration implements Serializable {
                 this.id = Integer.parseInt(id);
             } catch (NumberFormatException e) {
                 logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Convert id to integer failed: " + id);
                 this.id = Integer.parseInt(id);
             } catch (NumberFormatException e) {
                 logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Convert id to integer failed: " + id);
-                PolicyLogger.error(MessageCodes.EXCEPTION_ERROR, e, "PIPConfiguration", "Convert id to integer failed");
+                PolicyLogger.error(MessageCodes.EXCEPTION_ERROR, e, "PipConfiguration", "Convert id to integer failed");
             }
         }
         //
             }
         }
         //
@@ -391,47 +371,8 @@ public class PIPConfiguration implements Serializable {
         //
         // Go through each property
         //
         //
         // Go through each property
         //
-        for (Object nme : properties.keySet()) {
-            if (!nme.toString().startsWith(id)) {
-                continue;
-            }
-            if (nme.equals(id + ".classname")) {
-                //
-                // We already saved this
-                //
-            } else if (nme.equals(id + "." + StdConfigurableEngine.PROP_NAME)) {
-                this.name = properties.getProperty(nme.toString());
-            } else if (nme.equals(id + "." + StdConfigurableEngine.PROP_DESCRIPTION)) {
-                this.description = properties.getProperty(nme.toString());
-            } else if (nme.equals(id + "." + StdConfigurableEngine.PROP_ISSUER)) {
-                this.issuer = properties.getProperty(nme.toString());
-            } else if (nme.equals(id + ".resolvers")) {
-                //
-                // It has resolvers, make sure this is set to true if
-                // it has been already.
-                //
-                this.setRequiresResolvers(true);
-                //
-                // Parse the resolvers
-                //
-                Collection<PIPResolver> resolvers = PIPResolver.importResolvers(id + ".resolver",
-                                                                        properties.getProperty(nme.toString()),
-                                                                        properties,"super-admin"
-                                                                        );
-                for (PIPResolver resolver : resolvers) {
-                    this.addPipresolver(resolver);
-                }
-            } else if (nme.toString().startsWith(id + ".resolver")) {
-                //
-                // Ignore, the PIPResolver will parse these values
-                //
-            } else {
-                //
-                // Config Parameter
-                //
-                this.addPipconfigParam(new PIPConfigParam(nme.toString().substring(id.length() + 1),
-                                                    properties.getProperty(nme.toString())));
-            }
+        for (Object propertyKey : properties.keySet()) {
+            readProperty(id, properties, propertyKey);
         }
         //
         // Make sure we have a name at least
         }
         //
         // Make sure we have a name at least
@@ -441,7 +382,61 @@ public class PIPConfiguration implements Serializable {
         }
     }
 
         }
     }
 
+    /**
+     * Read a property into the PIP configuration.
+     *
+     * @param id the ID of the property
+     * @param properties the properties object to read from
+     * @param key the key of the property being checked
+     * @throws PIPException on exceptions thrown on reading the property
+     */
+    private void readProperty(String id, Properties properties, Object key) throws PIPException {
+        if (!key.toString().startsWith(id)) {
+            return;
+        }
+        if (key.equals(id + ".classname")) {
+            //
+            // We already saved this
+            //
+        } else if (key.equals(id + "." + StdConfigurableEngine.PROP_NAME)) {
+            this.name = properties.getProperty(key.toString());
+        } else if (key.equals(id + "." + StdConfigurableEngine.PROP_DESCRIPTION)) {
+            this.description = properties.getProperty(key.toString());
+        } else if (key.equals(id + "." + StdConfigurableEngine.PROP_ISSUER)) {
+            this.issuer = properties.getProperty(key.toString());
+        } else if (key.equals(id + ".resolvers")) {
+            //
+            // It has resolvers, make sure this is set to true if
+            // it has been already.
+            //
+            this.setRequiresResolversFlag(true);
+            //
+            // Parse the resolvers
+            //
+            Collection<PipResolver> resolvers = PipResolver.importResolvers(id + ".resolver",
+                            properties.getProperty(key.toString()), properties, "super-admin");
+            for (PipResolver resolver : resolvers) {
+                this.addPipresolver(resolver);
+            }
+        } else if (key.toString().startsWith(id + ".resolver")) {
+            //
+            // Ignore, the PipResolver will parse these values
+            //
+        } else {
+            //
+            // Config Parameter
+            //
+            this.addPipconfigParam(new PipConfigParam(key.toString().substring(id.length() + 1),
+                            properties.getProperty(key.toString())));
+        }
+    }
 
 
+    /**
+     * Gets the configuration.
+     *
+     * @param name the name
+     * @return the configuration
+     */
     @Transient
     public Map<String, String> getConfiguration(String name) {
         String prefix;
     @Transient
     public Map<String, String> getConfiguration(String name) {
         String prefix;
@@ -463,14 +458,14 @@ public class PIPConfiguration implements Serializable {
             map.put(prefix + "issuer", this.issuer);
         }
 
             map.put(prefix + "issuer", this.issuer);
         }
 
-        for (PIPConfigParam param : this.pipconfigParams) {
+        for (PipConfigParam param : this.pipconfigParams) {
             map.put(prefix + param.getParamName(), param.getParamValue());
         }
 
         List<String> ids = new ArrayList<>();
             map.put(prefix + param.getParamName(), param.getParamValue());
         }
 
         List<String> ids = new ArrayList<>();
-        Iterator<PIPResolver> iter = this.pipresolvers.iterator();
+        Iterator<PipResolver> iter = this.pipresolvers.iterator();
         while (iter.hasNext()) {
         while (iter.hasNext()) {
-            PIPResolver resolver = iter.next();
+            PipResolver resolver = iter.next();
             String idd = Integer.toString(resolver.getId());
             Map<String, String> resolverMap = resolver.getConfiguration(prefix + "resolver." + idd);
             map.putAll(resolverMap);
             String idd = Integer.toString(resolver.getId());
             Map<String, String> resolverMap = resolver.getConfiguration(prefix + "resolver." + idd);
             map.putAll(resolverMap);
@@ -482,8 +477,14 @@ public class PIPConfiguration implements Serializable {
         return map;
     }
 
         return map;
     }
 
+    /**
+     * Generate properties.
+     *
+     * @param name the name
+     * @return the properties
+     */
     @Transient
     @Transient
-    public Properties  generateProperties(String name) {
+    public Properties generateProperties(String name) {
         String prefix;
         if (name == null) {
             prefix = Integer.toString(this.id);
         String prefix;
         if (name == null) {
             prefix = Integer.toString(this.id);
@@ -492,10 +493,14 @@ public class PIPConfiguration implements Serializable {
                 prefix = name;
             } else {
                 prefix = name + ".";
                 prefix = name;
             } else {
                 prefix = name + ".";
+                /**
+                 * Instantiates a new PIP configuration.
+                 */
+
             }
         }
         Properties props = new Properties();
             }
         }
         Properties props = new Properties();
-        props.setProperty("xacml.pip.engines", name);
+        props.setProperty("xacml.pip.engines", prefix);
         props.setProperty(prefix + "classname", this.classname);
         props.setProperty(prefix + "name", this.name);
         if (this.description != null) {
         props.setProperty(prefix + "classname", this.classname);
         props.setProperty(prefix + "name", this.name);
         if (this.description != null) {
@@ -505,14 +510,14 @@ public class PIPConfiguration implements Serializable {
             props.setProperty(prefix + "issuer", this.issuer);
         }
 
             props.setProperty(prefix + "issuer", this.issuer);
         }
 
-        for (PIPConfigParam param : this.pipconfigParams) {
+        for (PipConfigParam param : this.pipconfigParams) {
             props.setProperty(prefix + param.getParamName(), param.getParamValue());
         }
 
         List<String> ids = new ArrayList<>();
             props.setProperty(prefix + param.getParamName(), param.getParamValue());
         }
 
         List<String> ids = new ArrayList<>();
-        Iterator<PIPResolver> iter = this.pipresolvers.iterator();
+        Iterator<PipResolver> iter = this.pipresolvers.iterator();
         while (iter.hasNext()) {
         while (iter.hasNext()) {
-            PIPResolver resolver = iter.next();
+            PipResolver resolver = iter.next();
             String idd = Integer.toString(resolver.getId());
             resolver.generateProperties(props, prefix + "resolver." + idd);
             ids.add(idd);
             String idd = Integer.toString(resolver.getId());
             resolver.generateProperties(props, prefix + "resolver." + idd);
             ids.add(idd);
@@ -522,17 +527,4 @@ public class PIPConfiguration implements Serializable {
         }
         return props;
     }
         }
         return props;
     }
-
-    @Transient
-    @Override
-    public String toString() {
-        return "PIPConfiguration [id=" + id + ", piptype=" + piptype
-                + ", classname=" + classname + ", name=" + name
-                + ", description=" + description + ", issuer=" + issuer
-                + ", readOnly=" + readOnly + ", requiresResolvers="
-                + requiresResolvers + ", createdBy=" + createdBy
-                + ", createdDate=" + createdDate + ", modifiedBy=" + modifiedBy
-                + ", modifiedDate=" + modifiedDate + ", pipconfigParams="
-                + pipconfigParams + ", pipresolvers=" + pipresolvers + "]";
-    }
 }
 }