{
fieldOptionMap.put(commonField.getId(), new TreeSet<CommonOption>());
for(Option option : field.getOptions())
{
CommonOption commonOption = new CommonOption();
commonOption.setId(option.getId().toString());
commonOption.setName(option.getName());
fieldOptionMap.get(commonField.getId()).add(commonOption);
}
}
}
else if(field.getType().equals(Field.Type.t_reference))
{
Data[] referenceArray = das.queryTemplateFieldReferences(templateId, field.getId());
if(referenceArray != null && referenceArray.length > 0)
{
fieldOptionMap.put(commonField.getId(), new TreeSet<CommonOption>());
for(Data reference : referenceArray)
{
CommonOption commonOption = new CommonOption();
commonOption.setId(reference.getId().toString());
commonOption.setName(reference.getTitle());
fieldOptionMap.get(commonField.getId()).add(commonOption);
}
}
}
else if(field.getType().equals(Field.Type.t_attachment))
{
Attachment[] attachmentArray = das.queryTemplateFieldAttachments(templateId, field.getId());
if(attachmentArray != null && attachmentArray.length > 0)
{
fieldOptionMap.put(commonField.getId(), new TreeSet<CommonOption>());
for(Attachment attachment : attachmentArray)
{
CommonOption commonOption = new CommonOption();
commonOption.setId(attachment.getId().toString());
commonOption.setName(attachment.getName());
fieldOptionMap.get(commonField.getId()).add(commonOption);
}
}
}