// Path: api/objectpipeline/src/main/java/esride/opendatabridge/pipeline/IPipeline.java
// public interface IPipeline {
// 
//     public void examineAndChangeObject(HashMap<String, String> elements) throws InvalidObjectException;
// }
// 
// Path: api/objectpipeline/src/main/java/esride/opendatabridge/pipeline/InvalidObjectException.java
// public class InvalidObjectException extends Exception {
//     public InvalidObjectException() {
//         super();
//     }
// 
//     public InvalidObjectException(String message) {
//         super(message);
//     }
// 
//     public InvalidObjectException(String message, Throwable cause) {
//         super(message, cause);
//     }
// 
//     public InvalidObjectException(Throwable cause) {
//         super(cause);
//     }
// }


import esride.opendatabridge.pipeline.IPipeline;
import esride.opendatabridge.pipeline.InvalidObjectException;
import org.apache.log4j.Logger;
import java.util.HashMap;
import java.util.List;

    public void setPublicLicenseList(List<String> publicLicenseList) {
        this.publicLicenseList = publicLicenseList;
    }

    public String getLicenseInfoName() {
        return licenseInfoName;
    }

    public void setLicenseInfoName(String licenseInfoName) {
        this.licenseInfoName = licenseInfoName;
    }

    public void examineAndChangeObject(HashMap<String, String> elements) throws InvalidObjectException {
        String licenseInfoValue = elements.get(licenseInfoName);
        if(sLogger.isDebugEnabled()){
            sLogger.debug("PublicLicense-Validator (licenseInfo): " + licenseInfoValue);
        }

        if(licenseInfoValue != null && licenseInfoValue.trim().length() > 0){
            boolean hasPublicLisence = false;
            for(int i=0; i<publicLicenseList.size(); i++){
                String publicId = publicLicenseList.get(i);
                if(licenseInfoValue.contains(publicId)){
                    hasPublicLisence = true;
                    break;
                }
            }
            if(!hasPublicLisence){
                sLogger.info("PublicLicense-Validator: No valid license available");
// Path: api/objectpipeline/src/main/java/esride/opendatabridge/pipeline/IPipeline.java
// public interface IPipeline {
// 
//     public void examineAndChangeObject(HashMap<String, String> elements) throws InvalidObjectException;
// }
// 
// Path: api/objectpipeline/src/main/java/esride/opendatabridge/pipeline/InvalidObjectException.java
// public class InvalidObjectException extends Exception {
//     public InvalidObjectException() {
//         super();
//     }
// 
//     public InvalidObjectException(String message) {
//         super(message);
//     }
// 
//     public InvalidObjectException(String message, Throwable cause) {
//         super(message, cause);
//     }
// 
//     public InvalidObjectException(Throwable cause) {
//         super(cause);
//     }
// }


// Path: api/objectpipeline/src/main/java/esride/opendatabridge/pipeline/validator/PublicLicenseValidator.java
import esride.opendatabridge.pipeline.IPipeline;
import esride.opendatabridge.pipeline.InvalidObjectException;
import org.apache.log4j.Logger;
import java.util.HashMap;
import java.util.List;


    public void setPublicLicenseList(List<String> publicLicenseList) {
        this.publicLicenseList = publicLicenseList;
    }

    public String getLicenseInfoName() {
        return licenseInfoName;
    }

    public void setLicenseInfoName(String licenseInfoName) {
        this.licenseInfoName = licenseInfoName;
    }

    public void examineAndChangeObject(HashMap<String, String> elements) throws InvalidObjectException {
        String licenseInfoValue = elements.get(licenseInfoName);
        if(sLogger.isDebugEnabled()){
            sLogger.debug("PublicLicense-Validator (licenseInfo): " + licenseInfoValue);
        }

        if(licenseInfoValue != null && licenseInfoValue.trim().length() > 0){
            boolean hasPublicLisence = false;
            for(int i=0; i<publicLicenseList.size(); i++){
                String publicId = publicLicenseList.get(i);
                if(licenseInfoValue.contains(publicId)){
                    hasPublicLisence = true;
                    break;
                }
            }
            if(!hasPublicLisence){
                sLogger.info("PublicLicense-Validator: No valid license available");
                throw new InvalidObjectException("PublicLicense-Validator: No public license found. Public license are: " + publicLicenseList);