You can access on Polarion wiki pages, live reports, workflow functions, etc... the IChecklistService function.


Classes


Note: See bottom of this page to learn how to gain access this API.


IChecklistService

package com.nextedy.polarion.checklist;

public interface IChecklistService {
  
  Checklist parse(IWorkItem workItem, String field);
  Checklist parse(WorkItem workItem, String field);
  Checklist parse(IModule module, String field);

  
  void store(Checklist checklist, WorkItem workItem, String field);
  void store(Checklist checklist, IWorkItem workItem, String field);
  void store(Checklist checklist, IModule module, String field);
  void store(String data, IModule module, String field);
  void store(String data, IWorkItem workItem, String field);


  void reset( IWorkItem workItem, String field);
  void reset( WorkItem workItem, String field);
  void reset( IModule module, String field);

  void applyTempate( IWorkItem workItem, String field);
  void applyTempate( WorkItem workItem, String field);
  void applyTempate( IModule module, String field);

  
  ChecklistConf getChecklistConf(WorkItem workItem, String field);
  ChecklistConf getChecklistConf(IWorkItem workItem, String field);
  ChecklistConf getChecklistConf(IModule module, String field);

  String[] getChecklistsIdsForSummary(IWorkItem workItem);
  String[] getChecklistsIdsForSummary(IModule module);
  
  DocumentChecklistView getDocumentChecklistView();
}

Checklist

package com.nextedy.polarion.checklist;

public class Checklist {
  public Checklist(String summaryMessageFormat)

  public Collection<ChecklistItem> getItems()
  public ChecklistItem mergeItemIn(ChecklistItem item) 
  public boolean isMandatoryChecked() 
  public boolean isAllChecked() 
  public int getCheckedCount() 
  public int getRejectedCount()
  public int getNACount() 
  public int getUncheckedCount()
  public int getUncheckedMandatoryCount()
  public int getMandatoryCount() 
  public int getCheckedMandatoryCount()
  public int getAllCount()   
  public String getSummaryText()
  public Text toText()
  public void uncheckAll()
}



ChecklistItem

package com.nextedy.polarion.checklist;

public class ChecklistItem {
  public ChecklistItem()
  public ChecklistItem( String label)

  public CheckItemResult getResult()
  public void setResult(CheckItemResult result)
  public boolean isChecked()
  public void setChecked(boolean checked)
  public boolean isMandatory()
  public void setMandatory(boolean mandatory)
  public boolean isFromTemplate() 
  public void setFromTemplate(boolean fromTemplate)
  public String getLabel() 
  public void setLabel(String label)
  public String getId()
  public void setId(String id)
  public String getNote()
  public void setNote(String note) 
  public String getDescription()
  public void setDescription(String description) 
}


CheckItemResult

package com.nextedy.polarion.checklist;

public enum CheckItemResult{
  
  NONE ("_", "None"),
  CHECKED ("X", "Checked"),
  REJECTED ("O", "Rejected");

  private CheckItemResult(String ch, String label) 
  
  public String getCharacter()
  public String getLabel()
  public boolean equalsToString(String v)
  public boolean isChecked() 
  
  public static CheckItemResult parse(String str)   
}



Access Checklist API from Java for use in Workflow Functions and Conditions

See

PlatformContext.getPlatform().lookupService(IChecklistService.class);


as used by ChecklistUncheckAll workflow function:


private static IChecklistService checklistService =    
    PlatformContext.getPlatform().lookupService(IChecklistService.class);

public void execute(ICallContext context, IArguments arguments) {
        String chlField = arguments.getAsString("checklist");
        if(chlField==null) {
            throw new RuntimeException("checklist attribute missing for wf function: ChecklistUncheckAll ");        
        }        
        String[] fields = chlField.split(",");
        for (int i = 0; i < fields.length; i++) {
            IWorkItem wi = context.getWorkItem();
            Checklist chl = checklistService.parse(wi,fields[i]);
            chl.uncheckAll();
            checklistService.store(chl, wi, fields[i]);    
        }
            
    }



Access Checklist API from Velocity for use on Live Report / Wiki Pages

See

$checklistService


#set( $wi = $trackerService.queryWorkItems("project.id:chldemo AND id:EL-191", "id").iterator().next() )
#set( $cList = $checklistService.parse( $wi, "dor"))
#foreach($i in $cList.getItems())
  <ul>
  [#if($i.checked)X#end]. $i.label
  <br>
  <i>$!i.note</i>
  </ul>
#end