1 package org.tigris.scarab.tools; 2 3 48 49 import java.util.Collections ; 50 import java.util.List ; 51 52 import org.tigris.scarab.om.Activity; 53 import org.tigris.scarab.om.ActivitySet; 54 import org.tigris.scarab.om.ActivitySetTypePeer; 55 import org.tigris.scarab.om.Attachment; 56 import org.tigris.scarab.om.IssueType; 57 import org.tigris.scarab.om.MITList; 58 import org.tigris.scarab.om.Module; 59 import org.tigris.scarab.om.ScarabUser; 60 import org.tigris.scarab.tools.localization.L10NKeySet; 61 import org.tigris.scarab.util.Log; 62 63 71 public class ScarabToolManager { 72 private ScarabLocalizationTool l10n; 73 74 public ScarabToolManager(ScarabLocalizationTool l10n) { 75 this.l10n = l10n; 76 } 77 78 81 public String getActivityReason(ActivitySet activitySet, Activity activity) 82 throws Exception { 83 String reason = null; 84 Attachment attachment = activitySet.getAttachment(); 85 if (attachment != null) { 86 String data = attachment.getData(); 87 if (data != null && data.length() > 0) { 89 reason = data; 90 } else { 91 reason = l10n.get(L10NKeySet.NotProvided); 92 } 93 } 94 else if (activitySet.getTypeId().equals( 96 ActivitySetTypePeer.CREATE_ISSUE__PK)) { 97 reason = l10n.get(L10NKeySet.InitialEntry); 98 } else { 99 reason = l10n.get(L10NKeySet.NotProvided); 100 } 101 return reason; 102 } 103 104 109 public List getRModuleUserAttributes(ScarabUser user, Module module, IssueType issueType) { 110 List issueListColumns = null; 111 try { 112 MITList currentList = user.getCurrentMITList(); 118 if (currentList != null) { 119 issueListColumns = currentList.getCommonRModuleUserAttributes(); 124 125 if (issueListColumns.isEmpty() 133 && currentList.isSingleModuleIssueType()) { 134 issueListColumns = currentList.getModule() 135 .getDefaultRModuleUserAttributes( 136 currentList.getIssueType()); 137 } 138 } 139 140 if (issueListColumns == null) { 141 issueListColumns = user.getRModuleUserAttributes(module, 142 issueType); 143 if (issueListColumns.isEmpty()) { 144 issueListColumns = module 145 .getDefaultRModuleUserAttributes(issueType); 146 } 147 } 148 if (issueListColumns == null) 149 { 150 issueListColumns = Collections.EMPTY_LIST; 151 } 152 153 } catch (Exception e) { 154 Log.get().error("Could not get list attributes", e); 155 } 156 157 return issueListColumns; 158 } 159 160 } 161 162 | Popular Tags |