I need to access Greenhopper Taskboard's column limits of particular columns for a plugin I am developing.
I looked into the database and I have found where Greenhopper stores the limits, the column-steps mapping, project-column mappings but I cannot find how the column limits are associated with the column names.
Can any one please tell me how to get this data??
Regards,
Monish
I solved my problem in the following way, if there is a better way please let me know.
private static String columnValuesTableName = "OSPropertyDecimal";
private static String columnNamesTableName = "OSPropertyEntry";
private static String columnMappingTableName = "OSPropertyText";
private static String COLUMN_MAX= "CAPACITY";
private static String id ="id";
private static String entityId = "entityId";
private static String propertyKey = "propertyKey";
private static String entityName = "entityName";
private static String value = "value";
private static String greenHopper = "GreenHopper";
private static String configuration = "CONFIGURATION";
private static String prioritisedColumnName="TaskBoard_type_0";
private static String scopedColumnName="TaskBoard_type_1";
//table names
public static String PRIORITISED = "Prioritised";
public static String SCOPED = "Scoped";
private static int getConstraintFromDB(long projectId, String tableColumnName, String constraintType){
Long tableId = null;
Double limitdb = null;
//getting the project <-> column mappings
List<GenericValue> columnNameList = delegator.findByAnd(columnNamesTableName,EasyMap.build(entityId,projectId));
//from all the mappings we need to get the required
//checking column <-> column constraints' id mappings
for(GenericValue columnName: columnNameList){
if(columnName.containsKey(propertyKey) && columnName.containsKey(entityName)){
//checking for the correct constraint as there is a max and min for each column
if(columnName.get(propertyKey).toString().compareTo(tableColumnName)==0 &&
columnName.get(entityName).toString().compareTo(constraintType)==0){
//reading the constraints' table id
tableId = Double.valueOf(columnName.get(id).toString()).longValue();
//safety check
if(tableId!=null){
//making a db query for column limit
List<GenericValue> dataList = delegator.findByAnd(columnValuesTableName,EasyMap.build(id,tableId));
if(dataList.size()>0){
limitdb = dataList.get(0).getDouble(value);
}
}
//we got what we needed so no need to check
break;
}
}
}
//safety check
if(tableId == null || limitdb==null){
return defaultLimit;
}
return limitdb.intValue();
}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.