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

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
How to earn badges on the Atlassian Community

How to earn badges on the Atlassian Community

Badges are a great way to show off community activity, whether you’re a newbie or a Champion.

Learn more
Community showcase
Published May 21, 2018 in Jira Software

How large do you think Jira Software can grow?

Hi Atlassian Community! My name is Shana, and I’m on the Jira Software team. One of the many reasons this Community exists is to connect you to others on similar product journeys or with comparabl...

1,033 views 7 18
Read article

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