Java Code Examples for org.apache.commons.collections4.map.CaseInsensitiveMap#values()

The following examples show how to use org.apache.commons.collections4.map.CaseInsensitiveMap#values() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ComProfileFieldDaoImpl.java    From openemm with GNU Affero General Public License v3.0 6 votes vote down vote up
@Override
public List<ProfileField> getProfileFields(@VelocityCheck int companyID) throws Exception {
	if (companyID <= 0) {
		return null;
	} else {
		CaseInsensitiveMap<String, ComProfileField> comProfileFieldMap = getComProfileFieldsMap(companyID, false);
		List<ComProfileField> comProfileFieldList = new ArrayList<>(comProfileFieldMap.values());
		
		// Sort by SortingIndex or shortname
		sortComProfileList(comProfileFieldList);

		// Convert from List<ComProfileField> to List<ProfileField>
		List<ProfileField> returnList = new ArrayList<>();
		returnList.addAll(comProfileFieldList);
		
		return returnList;
	}
}
 
Example 2
Source File: ComProfileFieldDaoImpl.java    From openemm with GNU Affero General Public License v3.0 6 votes vote down vote up
public List<ComProfileField> getComProfileFields(@VelocityCheck int companyID, int adminID, boolean customSorting, final boolean noNotNullConstraintCheck) throws Exception {
	if (companyID <= 0) {
		return null;
	} else {
		CaseInsensitiveMap<String, ComProfileField> comProfileFieldMap = getComProfileFieldsMap(companyID, adminID, noNotNullConstraintCheck);
		List<ComProfileField> comProfileFieldList = new ArrayList<>(comProfileFieldMap.values());

		// Sort by SortingIndex or shortname
           if (customSorting) {
		    sortCustomComProfileList(comProfileFieldList);
           }
           // Sort by shortname (or by column if shortname is empty)
           else {
               sortComProfileList(comProfileFieldList);
           }

		return comProfileFieldList;
	}
}
 
Example 3
Source File: ComProfileFieldDaoImpl.java    From openemm with GNU Affero General Public License v3.0 6 votes vote down vote up
public CaseInsensitiveMap<String, ComProfileField> getComProfileFieldsMap(@VelocityCheck int companyID, int adminID, final boolean noNotNullConstraintCheck) throws Exception {
     if (companyID <= 0) {
         return null;
     } else {
CaseInsensitiveMap<String, ComProfileField> comProfileFieldMap = getComProfileFieldsMap(companyID, noNotNullConstraintCheck);
CaseInsensitiveMap<String, ComProfileField> returnMap = new CaseInsensitiveMap<>();
for (ComProfileField comProfileField : comProfileFieldMap.values()) {
	List<ComProfileFieldPermission> profileFieldPermissionList = select(logger, SELECT_PROFILEFIELDPERMISSION, new ComProfileFieldPermission_RowMapper(), companyID, comProfileField.getColumn(), adminID);
         	if (profileFieldPermissionList != null && profileFieldPermissionList.size() > 1) {
 				throw new RuntimeException("Invalid number of permission entries found in getProfileFields: " + profileFieldPermissionList.size());
 			} else if (profileFieldPermissionList != null && profileFieldPermissionList.size() == 1) {
 				comProfileField.setAdminID(adminID);
 				comProfileField.setModeEdit(profileFieldPermissionList.get(0).getModeEdit());
 				returnMap.put(comProfileField.getColumn(), comProfileField);
 			} else {
 				returnMap.put(comProfileField.getColumn(), comProfileField);
 			}
}
return returnMap;
     }
 }
 
Example 4
Source File: EmmProfileFieldResolverImpl.java    From openemm with GNU Affero General Public License v3.0 6 votes vote down vote up
/**
 * Reads data of all profile fields of given company and extracts essential
 * data.
 * 
 * @param companyId company ID
 * @param dao       DAO accessing profile field data
 * 
 * @return map of profile field short names to essential data
 * 
 * @throws Exception on errors reading or extracting profile field data
 */
private static Map<String, ColumnNameAndType> readProfileFields(int companyId, ComProfileFieldDao dao)
		throws Exception {
	Map<String, ColumnNameAndType> map = new HashMap<>();

	CaseInsensitiveMap<String, ComProfileField> rawMap = dao.getComProfileFieldsMap(companyId, false);
	SimpleDataType simpleType;
	ColumnNameAndType cnat;
	for (ComProfileField field : rawMap.values()) {
		simpleType = DbColumnType.getSimpleDataType(field.getDataType());
		cnat = new ColumnNameAndType(field.getColumn(), DbTypeMapper.mapDbType(simpleType));

		map.put(field.getShortname().toLowerCase(), cnat);
	}

	return map;
}
 
Example 5
Source File: ComProfileFieldDaoImpl.java    From openemm with GNU Affero General Public License v3.0 5 votes vote down vote up
@Override
public List<ComProfileField> getComProfileFields(int companyID) throws Exception {
	if (companyID <= 0) {
		return null;
	} else {
		CaseInsensitiveMap<String, ComProfileField> comProfileFieldMap = getComProfileFieldsMap(companyID);
		List<ComProfileField> comProfileFieldList = new ArrayList<>(comProfileFieldMap.values());
		
		// Sort by SortingIndex or shortname
		sortComProfileList(comProfileFieldList);
		
		return comProfileFieldList;
	}
}
 
Example 6
Source File: ComColumnInfoServiceImpl.java    From openemm with GNU Affero General Public License v3.0 5 votes vote down vote up
@Override
public CaseInsensitiveMap<String, ProfileField> getColumnInfoMap(@VelocityCheck int companyID) throws Exception {
	CaseInsensitiveMap<String, ComProfileField> comProfileFieldMap = profileFieldDao.getComProfileFieldsMap(companyID);
	CaseInsensitiveMap<String, ProfileField> profileFieldMap = new CaseInsensitiveMap<>();
	for (ComProfileField comProfileField : comProfileFieldMap.values()) {
		profileFieldMap.put(comProfileField.getColumn(), comProfileField);
	}
	return profileFieldMap;
}
 
Example 7
Source File: ComColumnInfoServiceImpl.java    From openemm with GNU Affero General Public License v3.0 5 votes vote down vote up
@Override
public CaseInsensitiveMap<String, ProfileField> getColumnInfoMap(@VelocityCheck int companyID, int adminID) throws Exception {
	CaseInsensitiveMap<String, ComProfileField> comProfileFieldMap = profileFieldDao.getComProfileFieldsMap(companyID, adminID);
	CaseInsensitiveMap<String, ProfileField> profileFieldMap = new CaseInsensitiveMap<>();
	for (ComProfileField comProfileField : comProfileFieldMap.values()) {
		profileFieldMap.put(comProfileField.getColumn(), comProfileField);
	}
	return profileFieldMap;
}
 
Example 8
Source File: ComProfileFieldDaoImpl.java    From openemm with GNU Affero General Public License v3.0 4 votes vote down vote up
private List<ComProfileField> sortComProfileList(CaseInsensitiveMap<String, ComProfileField> map) {
	List<ComProfileField> fields = new ArrayList<>(map.values());
	sortComProfileList(fields);
	return fields;
}