public class MultiConcat extends DfService implements ISetValueAdaptor,IServiceAdaptor,
IDfService {
public Object execute(IAdaptorParameter[] params) throwsAdaptorException {
StringBuilder buf = new StringBuilder();
try {
for (IAdaptorParameter param : params) {
if(param.getParameterInfo().getName().equals(INPUT_PARAM_VALUE)) {
String[] values = param.getValues();
int i = 0;
for (; i < values.length - 1; i++) {
buf.append(values[i]).append(separator);
}
buf.append(values[i]);
return buf.toString();
}
}
throw new RuntimeException("Missing parameter value");
} catch (final Exception e) {
throw new AdaptorException(ERR_FAILURE, e);
}
}
public void destroy() throws AdaptorException {
}
public void init(IAdaptorConfigurationconfig) throws AdaptorException {
final Properties params = config.getInitParams();
separator = params.getProperty(INIT_PARAM_SEPARATOR, separator);
}
public void setDocbaseName(String arg0) {
}
private static final String INIT_PARAM_SEPARATOR = "delimiter";
private static final String INPUT_PARAM_VALUE = "multivalue_field";
private static final String ERR_FAILURE = "The Adaptor failed to create the values.";
private String separator = ";";
}