ArrayList validFields = new ArrayList();
try
{
InitialContext ic = CVUtility.getInitialContext();
CustomFieldLocalHome home = (CustomFieldLocalHome)ic.lookup("local/CustomField");
CustomFieldLocal remote = home.create();
remote.setDataSource(this.dataSource);
if (fieldType.equals("Both") || fieldType.equals("Individual"))
{
// Collections of hashmaps
Collection individualCustomFields = remote.getCustomFieldImportData("individual");
if (individualCustomFields != null && individualCustomFields.size() > 0)
{
Iterator indivIter = individualCustomFields.iterator();
while (indivIter.hasNext())
{
HashMap field = (HashMap)indivIter.next();
// hashmap to be added to the arraylist returned from this method
HashMap fieldMap = new HashMap();
String fieldName = (String)field.get("name");
Number fieldID = (Number)field.get("customfieldid");
fieldMap.put("fieldID", fieldID);
fieldMap.put("name", fieldName);
// strip all non-alphanumeric chars from fieldName
fieldName = fieldName.replaceAll("[^\\w]", "");
// prepend fieldname with "cf_" so we know this is a custom field
fieldMap.put("fieldName", "cf_" + fieldName);
validFields.add(fieldMap);
}
}
}
if (fieldType.equals("Both") || fieldType.equals("Entity"))
{
Collection entityCustomFields = remote.getCustomFieldImportData("entity");
if (entityCustomFields != null && entityCustomFields.size() > 0)
{
Iterator entityIter = entityCustomFields.iterator();
while (entityIter.hasNext())
{