com.okworx.ilcd.validation.events.AbstractValidationEvent Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of ilcd-validation Show documentation
Show all versions of ilcd-validation Show documentation
A Java library for performing technical validation of data in ILCD data format.
package com.okworx.ilcd.validation.events;
import org.apache.commons.lang3.StringUtils;
import com.okworx.ilcd.validation.reference.IDatasetReference;
/**
* Abstract AbstractValidationEvent class.
*
* @author oli
* @version $Id: $Id
*/
public abstract class AbstractValidationEvent implements IValidationEvent {
protected String aspect;
protected String aspectDescription;
protected String message;
protected String altMessage;
public String getAltMessage() {
return altMessage;
}
public void setAltMessage(String altMessage) {
this.altMessage = altMessage;
}
protected IDatasetReference reference = null;
protected IDatasetReference messageReference = null;
protected Type type = Type.GENERIC;
protected Severity severity;
/**
* Constructor for AbstractValidationEvent.
*
* @param aspect a {@link java.lang.String} object.
* @param severity a {@link com.okworx.ilcd.validation.events.Severity} object.
* @param type a {@link com.okworx.ilcd.validation.events.Type} object.
* @param reference a {@link com.okworx.ilcd.validation.reference.IDatasetReference} object.
* @param message a {@link java.lang.String} object.
*/
public AbstractValidationEvent(String aspect, String aspectDescription, Severity severity, Type type, IDatasetReference reference, String message) {
this.aspect = aspect;
this.aspectDescription = aspectDescription;
this.severity = severity;
this.type = type;
this.reference = reference;
this.message = message;
}
/**
* Constructor for AbstractValidationEvent.
*
* @param aspect a {@link java.lang.String} object.
* @param severity a {@link com.okworx.ilcd.validation.events.Severity} object.
* @param type a {@link com.okworx.ilcd.validation.events.Type} object.
* @param reference a {@link com.okworx.ilcd.validation.reference.IDatasetReference} object.
* @param message a {@link java.lang.String} object.
*/
public AbstractValidationEvent(String aspect, Severity severity, Type type, IDatasetReference reference, String message) {
this.aspect = aspect;
this.severity = severity;
this.type = type;
this.reference = reference;
this.message = message;
}
/**
* Constructor for AbstractValidationEvent.
*
* @param aspect a {@link java.lang.String} object.
* @param severity a {@link com.okworx.ilcd.validation.events.Severity} object.
* @param reference a {@link com.okworx.ilcd.validation.reference.IDatasetReference} object.
* @param message a {@link java.lang.String} object.
*/
public AbstractValidationEvent(String aspect, Severity severity, IDatasetReference reference, String message) {
this(aspect, null, severity, reference, message);
}
/**
* Constructor for AbstractValidationEvent.
*
* @param aspect a {@link java.lang.String} object.
* @param aspectDescription a {@link java.lang.String} object.
* @param severity a {@link com.okworx.ilcd.validation.events.Severity} object.
* @param reference a {@link com.okworx.ilcd.validation.reference.IDatasetReference} object.
* @param message a {@link java.lang.String} object.
*/
public AbstractValidationEvent(String aspect, String aspectDescription, Severity severity, IDatasetReference reference, String message) {
this.aspect = aspect;
this.aspectDescription = aspectDescription;
this.severity = severity;
this.type = Type.GENERIC;
this.reference = reference;
this.message = message;
}
/**
* Constructor for AbstractValidationEvent.
*
* @param aspect a {@link java.lang.String} object.
*/
public AbstractValidationEvent(String aspect) {
this.aspect = aspect;
}
/**
* Constructor for AbstractValidationEvent.
*/
public AbstractValidationEvent() {
}
/**
* Getter for the field message
.
*
* @return a {@link java.lang.String} object.
*/
public String getMessage() {
return message;
}
/**
* Getter for the field reference
.
*
* @return a {@link com.okworx.ilcd.validation.reference.IDatasetReference} object.
*/
public IDatasetReference getReference() {
return reference;
}
/**
* Getter for the field type
.
*
* @return a {@link com.okworx.ilcd.validation.events.Type} object.
*/
public Type getType() {
return type;
}
/**
* Getter for the field severity
.
*
* @return a {@link com.okworx.ilcd.validation.events.Severity} object.
*/
public Severity getSeverity() {
return severity;
}
/** {@inheritDoc} */
public void setMessage(String message) {
this.message = message;
}
/** {@inheritDoc} */
public void setReference(IDatasetReference reference) {
this.reference = reference;
}
/** {@inheritDoc} */
public void setType(Type type) {
this.type = type;
}
/** {@inheritDoc} */
public void setSeverity(Severity severity) {
this.severity = severity;
}
/**
* Getter for the field aspect
.
*
* @return a {@link java.lang.String} object.
*/
public String getAspect() {
return aspect;
}
/**
* Setter for the field aspect
.
*
* @param aspect a {@link java.lang.String} object.
*/
public void setAspect(String aspect) {
this.aspect = aspect;
}
/**
* toString.
*
* @return a {@link java.lang.String} object.
*/
public String toString() {
StringBuilder buf = new StringBuilder(this.getAspect());
buf.append(" ");
buf.append(StringUtils.isNotBlank(this.getAspectDescription()) ? this.getAspectDescription() : "");
buf.append(" ");
buf.append(this.severity.getValue());
buf.append(" ");
buf.append(this.type.getValue());
buf.append(" ");
buf.append(StringUtils.isNotBlank(this.getReference().getUuid()) ? this.getReference().getUuid() + " ": "");
buf.append(StringUtils.isNotBlank(this.getReference().getName()) ? this.getReference().getName() + " ": "");
buf.append(this.getReference().getShortFileName());
buf.append(" ");
buf.append(this.getReference().getDatasetType()!=null ? this.getReference().getDatasetType() : "");
buf.append(" ");
buf.append(this.message);
return buf.toString();
}
public IDatasetReference getMessageReference() {
return messageReference;
}
public void setMessageReference(IDatasetReference messageReference) {
this.messageReference = messageReference;
}
public String getAspectDescription() {
return aspectDescription;
}
public void setAspectDescription(String aspectDescription) {
this.aspectDescription = aspectDescription;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy