use of eu.esdihumboldt.hale.io.oml.internal.model.align.ext.IParameter in project hale by halestudio.
the class OmlRdfReader method getParameters.
private List<IParameter> getParameters(List<ParamType> param) {
List<IParameter> params = new ArrayList<IParameter>(param.size());
Iterator<ParamType> iterator = param.iterator();
ParamType paramType;
IParameter parameter;
while (iterator.hasNext()) {
paramType = iterator.next();
List<String> values = paramType.getValue();
String value;
if (values != null && !values.isEmpty()) {
value = values.get(0);
} else {
// TODO what should be the default empty value?
value = null;
// null or empty string?
}
parameter = new Parameter(paramType.getName(), value);
params.add(parameter);
}
return params;
}
use of eu.esdihumboldt.hale.io.oml.internal.model.align.ext.IParameter in project hale by halestudio.
the class OmlReader method setParameters.
private void setParameters(CellBean cellBean, IEntity entity, IOReporter reporter, ICell cell) {
String transId = entity.getTransformation().getService().getLocation();
// get the list of parameters
List<IParameter> list = entity.getTransformation().getParameters();
// create a list of ParameterValue (because
// setTransformationParameters needs a list)
List<ParameterValueBean> params = new ArrayList<ParameterValueBean>();
for (int i = 0; i < list.size(); i++) {
String name = list.get(i).getName();
String value = list.get(i).getValue();
// create the ParameterValue for the CellBean
ParameterValueBean paramVal = new ParameterValueBean(name, value);
// add the ParameterValue
params.add(paramVal);
}
// set the new transformation parameters
if (map.containsKey(transId)) {
cellBean.setTransformationParameters(map.get(transId).getNewParameters(params, cellBean, reporter, cell));
} else {
cellBean.setTransformationParameters(params);
}
}
use of eu.esdihumboldt.hale.io.oml.internal.model.align.ext.IParameter in project hale by halestudio.
the class GeographicalNameTranslator method getNewParameters.
/**
* @see eu.esdihumboldt.hale.io.oml.helper.FunctionTranslator#getNewParameters(java.util.List,
* eu.esdihumboldt.hale.common.align.io.impl.internal.CellBean,
* eu.esdihumboldt.hale.common.core.io.report.IOReporter,
* eu.esdihumboldt.hale.io.oml.internal.model.align.ICell)
*/
@Override
public List<ParameterValueBean> getNewParameters(List<ParameterValueBean> params, CellBean cellBean, IOReporter reporter, ICell cell) {
// create the new parameter list
List<ParameterValueBean> newParams = new ArrayList<ParameterValueBean>();
IEntity source = cell.getEntity1();
if (source instanceof ComposedProperty) {
ComposedProperty cp = (ComposedProperty) source;
// usually the composed property should only have one element in the
// collection
Property coll = cp.getCollection().get(0);
// that should be a composed property too
if (coll instanceof ComposedProperty) {
ComposedProperty comProp = (ComposedProperty) coll;
// parameters defined by the parameter page
List<IParameter> pageParams = comProp.getTransformation().getParameters();
// add each parameter defined by the parameter page
for (IParameter p : pageParams) {
newParams.add(new ParameterValueBean(p.getName(), p.getValue()));
}
// the collection of the collection contains the parameters
// defined for the spellings
List<Property> props = comProp.getCollection();
for (Property prop : props) {
// each property has a list of 3 parameters (text, script,
// transliterationScheme)
List<IParameter> spellingParams = prop.getTransformation().getParameters();
for (IParameter p : spellingParams) {
newParams.add(new ParameterValueBean(p.getName(), p.getValue()));
}
}
}
}
return newParams;
}
use of eu.esdihumboldt.hale.io.oml.internal.model.align.ext.IParameter in project hale by halestudio.
the class OmlRdfGenerator method getParameters.
/**
* Converts from List of OML IParameter to the collecion of the JAXB
* ParameterType
*
* @param parameters
* @return
*/
private Collection<? extends ParamType> getParameters(List<IParameter> parameters) {
if (parameters != null) {
ArrayList<ParamType> pTypes = new ArrayList<ParamType>(parameters.size());
ParamType pType;
IParameter param;
Iterator<?> iterator = parameters.iterator();
while (iterator.hasNext()) {
param = (IParameter) iterator.next();
pType = getParameterType(param);
pTypes.add(pType);
}
return pTypes;
}
return new ArrayList<ParamType>();
}
use of eu.esdihumboldt.hale.io.oml.internal.model.align.ext.IParameter in project hale by halestudio.
the class FeatureClass method deepCopy.
@Override
public IEntity deepCopy() {
FeatureClass result = new FeatureClass(new About(this.getAbout().getAbout()));
Transformation t = new Transformation(this.getTransformation().getService());
List<IParameter> parameters = new ArrayList<IParameter>();
for (IParameter p : this.getTransformation().getParameters()) {
parameters.add(new Parameter(p.getName(), p.getValue()));
}
t.setParameters(parameters);
result.setTransformation(t);
List<String> newLabels = new ArrayList<String>();
for (String label : this.getLabel()) {
newLabels.add(label);
}
result.setLabel(newLabels);
return result;
}
Aggregations