11-12-2014 12:13 PM
import java.util.HashMap;
import java.util.Map;
import org.activiti.engine.ActivitiIllegalArgumentException;
import org.activiti.engine.impl.form.EnumFormType;
public class C4MCompaniesFormType extends EnumFormType {
static Map<String, String> getCompagnies(){
Map<String, String> companies;
companies = new HashMap<String, String>();
companies.put("companyId1", "Company name 1");
companies.put("companyId2", "Company Name 2");
return companies;
}
public C4MCompaniesFormType() {
super(getCompagnies());
}
public C4MCompaniesFormType(Map<String, String> companies) {
super(companies);
}
public String getName() {
return "companies";
}
@Override
public Object getInformation(String key) {
System.out.println( "getInformation : " + key );
if (key.equals("values")) {
return getCompagnies();
}
return null;
}
@Override
public Object convertFormValueToModelValue(String propertyValue) {
System.out.println( "convertFormValueToModelValue : " + propertyValue );
validateValue(propertyValue);
return propertyValue;
}
@Override
public String convertModelValueToFormValue(Object modelValue) {
System.out.println( "convertModelValueToFormValue : " + modelValue );
if(modelValue != null) {
if(!(modelValue instanceof String)) {
throw new ActivitiIllegalArgumentException("Model value should be a String");
}
validateValue((String) modelValue);
}
return (String) modelValue;
}
protected void validateValue(String company) {
Map<String, String> companies = getCompagnies();
if(company != null) {
if(companies != null && !companies.containsKey(company)) {
throw new ActivitiIllegalArgumentException("Invalid value for companies form property: " + company);
}
}
}
}
11-19-2014 05:34 PM
11-27-2014 07:57 AM
12-05-2014 10:01 AM
12-08-2014 06:01 AM
12-08-2014 10:31 AM
12-11-2014 07:46 AM
12-16-2014 06:19 AM
12-16-2014 07:25 AM
Tags
Find what you came for
We want to make your experience in Hyland Connect as valuable as possible, so we put together some helpful links.