All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.wadpam.open.io.ValidationHandler Maven / Gradle / Ivy

package com.wadpam.open.io;

import java.util.Collection;
import java.util.Map;
import java.util.regex.Pattern;
import net.sf.mardao.core.domain.AbstractCreatedUpdatedEntity;

/**
 *
 * @author sosandstrom
 */
public interface ValidationHandler {
    
    Collection getValidColumns();
    Map getRequiredColumns();
    Map getRegexps();
    Map getFileToDomainMap();
    
    /**
     * To build internal maps from the header line.
     * @param line 
     */
    public void parseHeader(String[] line) throws Exception;
    
    /**
     * Invoked after all update() invocations.
     * @param merge
     * @param rows 
     */
    void postUpdates(boolean merge, int rows);    
    
    /**
     * Implement your business logic validation here.
     * @param body
     * @param row
     * @param properties
     * @return null if PASS
     */
    JValidationFeedback validate(JUploadFeedback body, int row, Map properties);
    
    /**
     * Static and regexp validation implemented in Adapter.
     * @param body
     * @param row
     * @param properties
     * @return null if PASS
     */
    JValidationFeedback validateStatic(JUploadFeedback body, int row, String[] line, Map properties);
    
    AbstractCreatedUpdatedEntity update(int row, Map properties, boolean mergeIfExist);
    
    public static final String LOC_REGEXP_NUMBER = "\\A[\\d]+\\z";

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy