org.openforis.collect.datacleansing.DataCleansingMetadata Maven / Gradle / Ivy
package org.openforis.collect.datacleansing;
import java.util.ArrayList;
import java.util.List;
import org.openforis.collect.model.CollectSurvey;
import org.openforis.commons.collection.CollectionUtils;
import org.openforis.commons.lang.DeepComparable;
/**
*
* @author S. Ricci
*
*/
public class DataCleansingMetadata implements DeepComparable {
private CollectSurvey survey;
private List dataQueryTypes;
private List dataQueries;
private List dataQueryGroups;
private List cleansingSteps;
private List cleansingChains;
public DataCleansingMetadata(CollectSurvey survey) {
super();
this.survey = survey;
this.dataQueries = new ArrayList();
this.dataQueryTypes = new ArrayList();
this.dataQueryGroups = new ArrayList();
this.cleansingSteps = new ArrayList();
this.cleansingChains = new ArrayList();
}
public DataCleansingMetadata(
CollectSurvey survey,
List dataQueryTypes,
List dataQueries,
List dataQueryGroups,
List cleansingSteps,
List cleansingChains) {
super();
this.survey = survey;
this.dataQueries = dataQueries;
this.dataQueryTypes = dataQueryTypes;
this.dataQueryGroups = dataQueryGroups;
this.cleansingSteps = cleansingSteps;
this.cleansingChains = cleansingChains;
}
public boolean isEmpty() {
return org.apache.commons.collections.CollectionUtils.isEmpty(dataQueries) &&
org.apache.commons.collections.CollectionUtils.isEmpty(dataQueryTypes) &&
org.apache.commons.collections.CollectionUtils.isEmpty(dataQueryGroups) &&
org.apache.commons.collections.CollectionUtils.isEmpty(cleansingSteps) &&
org.apache.commons.collections.CollectionUtils.isEmpty(cleansingChains);
}
@Override
public boolean deepEquals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
DataCleansingMetadata other = (DataCleansingMetadata) obj;
if (! CollectionUtils.deepEquals(dataQueryTypes, other.dataQueryTypes, true))
return false;
if (! CollectionUtils.deepEquals(dataQueries, other.dataQueries, true))
return false;
if (! CollectionUtils.deepEquals(dataQueryGroups, other.dataQueryGroups, true))
return false;
if (! CollectionUtils.deepEquals(cleansingSteps, other.cleansingSteps, true))
return false;
if (! CollectionUtils.deepEquals(cleansingChains, other.cleansingChains, true))
return false;
//do not deep compare surveys
if (survey == null) {
if (other.survey != null)
return false;
} else if (!survey.equals(other.survey))
return false;
return true;
}
public CollectSurvey getSurvey() {
return survey;
}
public List getDataQueries() {
return dataQueries;
}
public List getDataQueryTypes() {
return dataQueryTypes;
}
public List getDataQueryGroups() {
return dataQueryGroups;
}
public List getCleansingSteps() {
return cleansingSteps;
}
public List getCleansingChains() {
return cleansingChains;
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy