Access Greenhopper Taskboard's column limits

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

1 answer

1 accepted

0 votes
Accepted answer

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();
   }

Suggest an answer

Log in or Sign up to answer
Community showcase
Posted Dec 10, 2018 in Confluence

Organizing your space just got easier - Page Tree Drag & Drop is here

Hi Community! I’m Elaine, Confluence Product Manager. You may have read my earlier post about page tree in space navigation sidebar. I'm excited to share another improvement that helps you organize ...

206 views 6 7
Join discussion

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you