| 1 |  |   | 
  | 2 |  |   | 
  | 3 |  |   | 
  | 4 |  |   | 
  | 5 |  |   | 
  | 6 |  |   | 
  | 7 |  |   | 
  | 8 |  |   | 
  | 9 |  |   | 
  | 10 |  |   | 
  | 11 |  |   | 
  | 12 |  |   | 
  | 13 |  |   | 
  | 14 |  |   | 
  | 15 |  |   | 
  | 16 |  |  package org.kuali.rice.kns.web.struts.action; | 
  | 17 |  |   | 
  | 18 |  |  import javax.servlet.http.HttpServletRequest; | 
  | 19 |  |  import javax.servlet.http.HttpServletResponse; | 
  | 20 |  |   | 
  | 21 |  |  import org.apache.commons.lang.StringUtils; | 
  | 22 |  |  import org.apache.struts.action.ActionForm; | 
  | 23 |  |  import org.apache.struts.action.ActionForward; | 
  | 24 |  |  import org.apache.struts.action.ActionMapping; | 
  | 25 |  |  import org.kuali.rice.core.config.ConfigContext; | 
  | 26 |  |  import org.kuali.rice.core.util.RiceConstants; | 
  | 27 |  |  import org.kuali.rice.kew.docsearch.DocSearchCriteriaDTO; | 
  | 28 |  |  import org.kuali.rice.kew.dto.DocumentTypeDTO; | 
  | 29 |  |  import org.kuali.rice.kew.service.KEWServiceLocator; | 
  | 30 |  |  import org.kuali.rice.kns.datadictionary.AttributeDefinition; | 
  | 31 |  |  import org.kuali.rice.kns.datadictionary.BusinessObjectEntry; | 
  | 32 |  |  import org.kuali.rice.kns.datadictionary.DataDictionary; | 
  | 33 |  |  import org.kuali.rice.kns.datadictionary.DataDictionaryEntry; | 
  | 34 |  |  import org.kuali.rice.kns.datadictionary.DocumentEntry; | 
  | 35 |  |  import org.kuali.rice.kns.datadictionary.HeaderNavigation; | 
  | 36 |  |  import org.kuali.rice.kns.datadictionary.HelpDefinition; | 
  | 37 |  |  import org.kuali.rice.kns.datadictionary.LookupDefinition; | 
  | 38 |  |  import org.kuali.rice.kns.datadictionary.MaintainableFieldDefinition; | 
  | 39 |  |  import org.kuali.rice.kns.service.DataDictionaryService; | 
  | 40 |  |  import org.kuali.rice.kns.service.KNSServiceLocator; | 
  | 41 |  |  import org.kuali.rice.kns.service.KualiConfigurationService; | 
  | 42 |  |  import org.kuali.rice.kns.service.MaintenanceDocumentDictionaryService; | 
  | 43 |  |  import org.kuali.rice.kns.service.ParameterService; | 
  | 44 |  |  import org.kuali.rice.kns.util.KNSConstants; | 
  | 45 |  |  import org.kuali.rice.kns.util.RiceKeyConstants; | 
  | 46 |  |  import org.kuali.rice.kns.web.struts.form.KualiHelpForm; | 
  | 47 |  |   | 
  | 48 |  |   | 
  | 49 |  |   | 
  | 50 |  |   | 
  | 51 |  |   | 
  | 52 |  |   | 
  | 53 | 0 |  public class KualiHelpAction extends KualiAction { | 
  | 54 | 0 |      private static final org.apache.log4j.Logger LOG = org.apache.log4j.Logger.getLogger(KualiHelpAction.class); | 
  | 55 |  |   | 
  | 56 |  |      private static final String VALIDATION_PATTERN_STRING = "ValidationPattern"; | 
  | 57 |  |      private static final String NO = "No"; | 
  | 58 |  |      private static final String YES = "Yes"; | 
  | 59 |  |      static final String DEFAULT_LOOKUP_HELP_TEXT_RESOURCE_KEY = "lookupHelpText"; | 
  | 60 |  |       | 
  | 61 |  |      private static DataDictionaryService dataDictionaryService; | 
  | 62 |  |      private static KualiConfigurationService kualiConfigurationService; | 
  | 63 |  |      private static ParameterService parameterService; | 
  | 64 |  |      private static MaintenanceDocumentDictionaryService maintenanceDocumentDictionaryService; | 
  | 65 |  |   | 
  | 66 |  |      private DataDictionaryService getDataDictionaryService() { | 
  | 67 | 0 |          if ( dataDictionaryService == null ) { | 
  | 68 | 0 |              dataDictionaryService = KNSServiceLocator.getDataDictionaryService(); | 
  | 69 |  |          } | 
  | 70 | 0 |          return dataDictionaryService; | 
  | 71 |  |      } | 
  | 72 |  |      private KualiConfigurationService getConfigurationService() { | 
  | 73 | 0 |          if ( kualiConfigurationService == null ) { | 
  | 74 | 0 |              kualiConfigurationService = KNSServiceLocator.getKualiConfigurationService(); | 
  | 75 |  |          } | 
  | 76 | 0 |          return kualiConfigurationService; | 
  | 77 |  |      } | 
  | 78 |  |      private ParameterService getParameterService() { | 
  | 79 | 0 |          if ( parameterService == null ) { | 
  | 80 | 0 |              parameterService = KNSServiceLocator.getParameterService(); | 
  | 81 |  |          } | 
  | 82 | 0 |          return parameterService; | 
  | 83 |  |      } | 
  | 84 |  |   | 
  | 85 |  |      private MaintenanceDocumentDictionaryService getMaintenanceDocumentDictionaryService() { | 
  | 86 | 0 |          if ( maintenanceDocumentDictionaryService == null ) { | 
  | 87 | 0 |              maintenanceDocumentDictionaryService = KNSServiceLocator.getMaintenanceDocumentDictionaryService(); | 
  | 88 |  |          } | 
  | 89 | 0 |          return maintenanceDocumentDictionaryService; | 
  | 90 |  |      } | 
  | 91 |  |       | 
  | 92 |  |       | 
  | 93 |  |   | 
  | 94 |  |   | 
  | 95 |  |   | 
  | 96 |  |   | 
  | 97 |  |   | 
  | 98 |  |      private DataDictionaryEntry getDataDictionaryEntry(String businessObjectClassName) { | 
  | 99 | 0 |          return getDataDictionaryService().getDataDictionary().getDictionaryObjectEntry(businessObjectClassName); | 
  | 100 |  |      } | 
  | 101 |  |   | 
  | 102 |  |       | 
  | 103 |  |   | 
  | 104 |  |   | 
  | 105 |  |   | 
  | 106 |  |   | 
  | 107 |  |   | 
  | 108 |  |   | 
  | 109 |  |   | 
  | 110 |  |      private AttributeDefinition getAttributeDefinition(String businessObjectClassName, String attributeName) throws ClassNotFoundException { | 
  | 111 | 0 |          AttributeDefinition retval = null; | 
  | 112 |  |   | 
  | 113 | 0 |          if (getDataDictionaryEntry(businessObjectClassName) != null) { | 
  | 114 | 0 |              retval = getDataDictionaryEntry(businessObjectClassName).getAttributeDefinition(attributeName); | 
  | 115 |  |          } | 
  | 116 | 0 |          return retval; | 
  | 117 |  |      } | 
  | 118 |  |   | 
  | 119 |  |       | 
  | 120 |  |   | 
  | 121 |  |   | 
  | 122 |  |   | 
  | 123 |  |      private String getAttributeMaxLength(AttributeDefinition attribute) throws Exception { | 
  | 124 | 0 |          return attribute.getMaxLength().toString(); | 
  | 125 |  |      } | 
  | 126 |  |   | 
  | 127 |  |       | 
  | 128 |  |   | 
  | 129 |  |   | 
  | 130 |  |   | 
  | 131 |  |      private String getAttributeValidationPatternName(AttributeDefinition attribute) throws Exception { | 
  | 132 | 0 |          String retval = new String(); | 
  | 133 | 0 |          if (attribute.getValidationPattern() != null) { | 
  | 134 | 0 |              retval = attribute.getValidationPattern().getClass().getName(); | 
  | 135 |  |          } | 
  | 136 |  |   | 
  | 137 | 0 |          if (retval.indexOf(".") > 0) { | 
  | 138 | 0 |              retval = retval.substring(retval.lastIndexOf(".") + 1); | 
  | 139 |  |          } | 
  | 140 | 0 |          if (retval.endsWith(VALIDATION_PATTERN_STRING)) { | 
  | 141 | 0 |              retval = retval.substring(0, retval.lastIndexOf(VALIDATION_PATTERN_STRING)); | 
  | 142 |  |          } | 
  | 143 |  |   | 
  | 144 | 0 |          return retval; | 
  | 145 |  |      } | 
  | 146 |  |   | 
  | 147 |  |       | 
  | 148 |  |   | 
  | 149 |  |   | 
  | 150 |  |   | 
  | 151 |  |   | 
  | 152 |  |      public ActionForward getAttributeHelpText(ActionMapping mapping, KualiHelpForm helpForm, HttpServletRequest request, HttpServletResponse response) throws Exception { | 
  | 153 |  |   | 
  | 154 |  |          AttributeDefinition attribute; | 
  | 155 |  |   | 
  | 156 | 0 |          if (StringUtils.isBlank(helpForm.getBusinessObjectClassName()) || StringUtils.isBlank(helpForm.getAttributeName())) { | 
  | 157 | 0 |              throw new RuntimeException("Business object and attribute name not specified."); | 
  | 158 |  |          } | 
  | 159 | 0 |          attribute = getAttributeDefinition(helpForm.getBusinessObjectClassName(), helpForm.getAttributeName()); | 
  | 160 |  |   | 
  | 161 | 0 |          if ( LOG.isDebugEnabled() ) { | 
  | 162 | 0 |              LOG.debug( "Request for help on: " + helpForm.getBusinessObjectClassName() + " -- " + helpForm.getAttributeName() ); | 
  | 163 | 0 |              LOG.debug( "  attribute: " + attribute ); | 
  | 164 |  |          } | 
  | 165 |  |                   | 
  | 166 | 0 |          if (attribute == null || StringUtils.isBlank(attribute.getSummary())) { | 
  | 167 | 0 |              helpForm.setResourceKey(RiceKeyConstants.MESSAGE_NO_HELP_TEXT); | 
  | 168 | 0 |              return getResourceHelpText(mapping, helpForm, request, response); | 
  | 169 |  |          } | 
  | 170 |  |   | 
  | 171 | 0 |          boolean required = attribute.isRequired().booleanValue(); | 
  | 172 |  |           | 
  | 173 |  |          try { | 
  | 174 | 0 |              Class boClass = Class.forName( helpForm.getBusinessObjectClassName() ); | 
  | 175 | 0 |              String docTypeName = getMaintenanceDocumentDictionaryService().getDocumentTypeName( boClass ); | 
  | 176 | 0 |              if (StringUtils.isNotBlank(docTypeName)) { | 
  | 177 |  |                   | 
  | 178 | 0 |                  MaintainableFieldDefinition field = getMaintenanceDocumentDictionaryService().getMaintainableField( docTypeName, helpForm.getAttributeName() ); | 
  | 179 | 0 |                  if ( field != null ) { | 
  | 180 | 0 |                      required = field.isRequired(); | 
  | 181 |  |                  } | 
  | 182 | 0 |              } | 
  | 183 |  |              else { | 
  | 184 | 0 |                  if (log.isInfoEnabled()) { | 
  | 185 | 0 |                      log.info("BO class " + boClass.getName() + " does not have a maint doc definition.  Defaulting to using DD for definition"); | 
  | 186 |  |                  } | 
  | 187 |  |              } | 
  | 188 | 0 |          } catch ( ClassNotFoundException ex ) { | 
  | 189 |  |               | 
  | 190 | 0 |              LOG.warn( "Unable to obtain maintainable field for BO property.", ex ); | 
  | 191 | 0 |          } | 
  | 192 |  |           | 
  | 193 | 0 |          helpForm.setHelpLabel(attribute.getLabel()); | 
  | 194 | 0 |          helpForm.setHelpSummary(attribute.getSummary()); | 
  | 195 | 0 |          helpForm.setHelpDescription(attribute.getDescription()); | 
  | 196 | 0 |          helpForm.setHelpRequired(required?YES:NO); | 
  | 197 | 0 |          helpForm.setHelpMaxLength(getAttributeMaxLength(attribute)); | 
  | 198 | 0 |          helpForm.setValidationPatternName(getAttributeValidationPatternName(attribute)); | 
  | 199 |  |   | 
  | 200 | 0 |          return mapping.findForward(RiceConstants.MAPPING_BASIC); | 
  | 201 |  |      } | 
  | 202 |  |   | 
  | 203 |  |       | 
  | 204 |  |   | 
  | 205 |  |   | 
  | 206 |  |   | 
  | 207 |  |   | 
  | 208 |  |      public ActionForward getAttributeHelpText(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception { | 
  | 209 | 0 |          return getAttributeHelpText(mapping, (KualiHelpForm) form, request, response); | 
  | 210 |  |      } | 
  | 211 |  |   | 
  | 212 |  |       | 
  | 213 |  |   | 
  | 214 |  |   | 
  | 215 |  |      public ActionForward getDocumentHelpText(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception { | 
  | 216 | 0 |          KualiHelpForm helpForm = (KualiHelpForm) form; | 
  | 217 |  |   | 
  | 218 | 0 |          String documentTypeName = helpForm.getDocumentTypeName(); | 
  | 219 |  |   | 
  | 220 | 0 |          if (StringUtils.isBlank(documentTypeName)) { | 
  | 221 | 0 |              throw new RuntimeException("Document type name not specified."); | 
  | 222 |  |          } | 
  | 223 |  |   | 
  | 224 | 0 |          DataDictionary dataDictionary = getDataDictionaryService().getDataDictionary(); | 
  | 225 | 0 |          DocumentEntry entry = dataDictionary.getDocumentEntry(documentTypeName); | 
  | 226 |  |   | 
  | 227 | 0 |          String label = ""; | 
  | 228 | 0 |          String summary = ""; | 
  | 229 | 0 |          String description = ""; | 
  | 230 | 0 |          HelpDefinition helpDefinition = null; | 
  | 231 | 0 |          String apcHelpUrl = null; | 
  | 232 | 0 |          if (entry != null) { | 
  | 233 | 0 |              DocumentTypeDTO docType = KNSServiceLocator.getWorkflowInfoService().getDocType(entry.getDocumentTypeName()); | 
  | 234 | 0 |              label = docType.getDocTypeLabel(); | 
  | 235 | 0 |              description = docType.getDocTypeDescription(); | 
  | 236 | 0 |              if (StringUtils.isNotBlank(docType.getHelpDefinitionUrl())) { | 
  | 237 | 0 |                      apcHelpUrl = ConfigContext.getCurrentContextConfig().getProperty("externalizable.help.url") + docType.getHelpDefinitionUrl(); | 
  | 238 |  |              } | 
  | 239 |  |          } | 
  | 240 |  |   | 
  | 241 | 0 |          if ( StringUtils.isNotBlank(apcHelpUrl) ) { | 
  | 242 | 0 |              response.sendRedirect(apcHelpUrl); | 
  | 243 | 0 |              return null; | 
  | 244 |  |          } | 
  | 245 |  |   | 
  | 246 | 0 |          helpForm.setHelpLabel(label); | 
  | 247 | 0 |          helpForm.setHelpSummary(summary); | 
  | 248 | 0 |          helpForm.setHelpDescription(description); | 
  | 249 | 0 |          helpForm.setHelpDefinition(helpDefinition); | 
  | 250 |  |   | 
  | 251 | 0 |          return mapping.findForward(RiceConstants.MAPPING_BASIC); | 
  | 252 |  |      } | 
  | 253 |  |   | 
  | 254 |  |       | 
  | 255 |  |   | 
  | 256 |  |   | 
  | 257 |  |      public ActionForward getBusinessObjectHelpText(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception { | 
  | 258 | 0 |          KualiHelpForm helpForm = (KualiHelpForm) form; | 
  | 259 |  |   | 
  | 260 | 0 |          String objectClassName = helpForm.getBusinessObjectClassName(); | 
  | 261 |  |   | 
  | 262 | 0 |          if (StringUtils.isBlank(objectClassName)) { | 
  | 263 | 0 |              throw new RuntimeException("Document type name not specified."); | 
  | 264 |  |          } | 
  | 265 |  |   | 
  | 266 | 0 |          DataDictionary dataDictionary = getDataDictionaryService().getDataDictionary(); | 
  | 267 | 0 |          BusinessObjectEntry entry = dataDictionary.getBusinessObjectEntry(objectClassName); | 
  | 268 |  |   | 
  | 269 | 0 |          HelpDefinition helpDefinition = null; | 
  | 270 | 0 |          String apcHelpUrl = null; | 
  | 271 | 0 |          String label = ""; | 
  | 272 | 0 |          String objectDescription = ""; | 
  | 273 | 0 |          if (entry != null) { | 
  | 274 | 0 |              helpDefinition = entry.getHelpDefinition(); | 
  | 275 | 0 |              label = entry.getObjectLabel(); | 
  | 276 | 0 |              objectDescription = entry.getObjectDescription(); | 
  | 277 | 0 |              if (null != helpDefinition && null != helpDefinition.getParameterNamespace() && null != helpDefinition.getParameterDetailType() && null != helpDefinition.getParameterName()) { | 
  | 278 | 0 |                  apcHelpUrl = getHelpUrl(helpDefinition.getParameterNamespace(), helpDefinition.getParameterDetailType(), helpDefinition.getParameterName()); | 
  | 279 |  |                  } | 
  | 280 |  |                  } | 
  | 281 |  |   | 
  | 282 | 0 |          if ( !StringUtils.isBlank(apcHelpUrl) ) { | 
  | 283 | 0 |              response.sendRedirect(apcHelpUrl); | 
  | 284 | 0 |              return null; | 
  | 285 |  |          } | 
  | 286 | 0 |          helpForm.setHelpLabel(label); | 
  | 287 | 0 |          helpForm.setHelpDescription(objectDescription); | 
  | 288 |  |   | 
  | 289 | 0 |          return mapping.findForward(RiceConstants.MAPPING_BASIC); | 
  | 290 |  |      } | 
  | 291 |  |       | 
  | 292 |  |       | 
  | 293 |  |   | 
  | 294 |  |   | 
  | 295 |  |      public ActionForward getPageHelpText(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception { | 
  | 296 | 0 |          KualiHelpForm helpForm = (KualiHelpForm) form; | 
  | 297 |  |   | 
  | 298 | 0 |          String documentTypeName = helpForm.getDocumentTypeName(); | 
  | 299 | 0 |          String pageName = helpForm.getPageName(); | 
  | 300 |  |   | 
  | 301 | 0 |          if (StringUtils.isBlank(documentTypeName)) { | 
  | 302 | 0 |              throw new RuntimeException("Document type name not specified."); | 
  | 303 |  |          } | 
  | 304 |  |           | 
  | 305 | 0 |          if (StringUtils.isBlank(pageName)) { | 
  | 306 | 0 |              throw new RuntimeException("Page name not specified."); | 
  | 307 |  |          } | 
  | 308 |  |   | 
  | 309 | 0 |          DataDictionary dataDictionary = getDataDictionaryService().getDataDictionary(); | 
  | 310 | 0 |          DocumentEntry entry = dataDictionary.getDocumentEntry(documentTypeName); | 
  | 311 |  |   | 
  | 312 | 0 |          String apcHelpUrl = null; | 
  | 313 | 0 |          String label = ""; | 
  | 314 | 0 |          String objectDescription = ""; | 
  | 315 | 0 |          if (entry != null) { | 
  | 316 | 0 |              for ( HeaderNavigation headerNavigation : entry.getHeaderNavigationList() ) { | 
  | 317 | 0 |                  if (headerNavigation.getHeaderTabDisplayName().equals(pageName)) { | 
  | 318 | 0 |                      HelpDefinition helpDefinition = headerNavigation.getHelpDefinition(); | 
  | 319 | 0 |                      if (null != helpDefinition && null != helpDefinition.getParameterNamespace() && null != helpDefinition.getParameterDetailType() && null != helpDefinition.getParameterName()) { | 
  | 320 | 0 |                          apcHelpUrl = getHelpUrl(helpDefinition.getParameterNamespace(), helpDefinition.getParameterDetailType(), helpDefinition.getParameterName()); | 
  | 321 |  |                      } | 
  | 322 | 0 |                  } | 
  | 323 |  |              } | 
  | 324 |  |          } | 
  | 325 |  |   | 
  | 326 | 0 |          if ( !StringUtils.isBlank(apcHelpUrl) ) { | 
  | 327 | 0 |              response.sendRedirect(apcHelpUrl); | 
  | 328 | 0 |              return null; | 
  | 329 |  |          } | 
  | 330 | 0 |          helpForm.setHelpLabel(pageName); | 
  | 331 | 0 |          helpForm.setHelpDescription("No help content available."); | 
  | 332 |  |   | 
  | 333 | 0 |          return mapping.findForward(RiceConstants.MAPPING_BASIC); | 
  | 334 |  |      } | 
  | 335 |  |       | 
  | 336 |  |       | 
  | 337 |  |   | 
  | 338 |  |   | 
  | 339 |  |      public ActionForward getStoredHelpUrl(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception { | 
  | 340 | 0 |          KualiHelpForm helpForm = (KualiHelpForm) form; | 
  | 341 |  |           | 
  | 342 | 0 |          String helpParameterNamespace = helpForm.getHelpParameterNamespace(); | 
  | 343 | 0 |          String helpParameterDetailType = helpForm.getHelpParameterDetailType(); | 
  | 344 | 0 |          String helpParameterName = helpForm.getHelpParameterName(); | 
  | 345 |  |           | 
  | 346 | 0 |          if (StringUtils.isBlank(helpParameterNamespace)) { | 
  | 347 | 0 |              throw new RuntimeException("Parameter Namespace not specified."); | 
  | 348 |  |          } | 
  | 349 |  |           | 
  | 350 | 0 |          if (StringUtils.isBlank(helpParameterDetailType)) { | 
  | 351 | 0 |              throw new RuntimeException("Detail Type not specified."); | 
  | 352 |  |          } | 
  | 353 |  |   | 
  | 354 | 0 |          if (StringUtils.isBlank(helpParameterName)) { | 
  | 355 | 0 |              throw new RuntimeException("Parameter Name not specified."); | 
  | 356 |  |          } | 
  | 357 |  |           | 
  | 358 | 0 |          String apcHelpUrl = getHelpUrl(helpParameterNamespace, helpParameterDetailType, helpParameterName); | 
  | 359 |  |           | 
  | 360 | 0 |          if ( !StringUtils.isBlank(apcHelpUrl) ) { | 
  | 361 | 0 |              response.sendRedirect(apcHelpUrl); | 
  | 362 | 0 |              return null; | 
  | 363 |  |          } | 
  | 364 |  |           | 
  | 365 | 0 |          helpForm.setHelpDescription("No help content available."); | 
  | 366 | 0 |          return mapping.findForward(RiceConstants.MAPPING_BASIC); | 
  | 367 |  |      } | 
  | 368 |  |   | 
  | 369 |  |       | 
  | 370 |  |   | 
  | 371 |  |   | 
  | 372 |  |      public ActionForward getResourceHelpText(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception { | 
  | 373 | 0 |          KualiHelpForm helpForm = (KualiHelpForm) form; | 
  | 374 |  |   | 
  | 375 | 0 |          String resourceKey = helpForm.getResourceKey(); | 
  | 376 | 0 |          populateHelpFormForResourceText(helpForm, resourceKey); | 
  | 377 |  |   | 
  | 378 | 0 |          return mapping.findForward(RiceConstants.MAPPING_BASIC); | 
  | 379 |  |      } | 
  | 380 |  |       | 
  | 381 |  |       | 
  | 382 |  |   | 
  | 383 |  |   | 
  | 384 |  |   | 
  | 385 |  |   | 
  | 386 |  |      protected void populateHelpFormForResourceText(KualiHelpForm helpForm, String resourceKey) { | 
  | 387 | 0 |              if (StringUtils.isBlank(resourceKey)) { | 
  | 388 | 0 |              throw new RuntimeException("Help resource key not specified."); | 
  | 389 |  |          } | 
  | 390 |  |   | 
  | 391 | 0 |          helpForm.setHelpLabel(""); | 
  | 392 | 0 |          helpForm.setHelpSummary(""); | 
  | 393 | 0 |          helpForm.setHelpDescription(getConfigurationService().getPropertyString(resourceKey)); | 
  | 394 | 0 |      } | 
  | 395 |  |       | 
  | 396 |  |       | 
  | 397 |  |   | 
  | 398 |  |   | 
  | 399 |  |      public ActionForward getLookupHelpText(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception { | 
  | 400 | 0 |              KualiHelpForm helpForm = (KualiHelpForm) form; | 
  | 401 |  |               | 
  | 402 | 0 |              final String lookupBusinessObjectClassName = helpForm.getLookupBusinessObjectClassName(); | 
  | 403 | 0 |              if (!StringUtils.isBlank(lookupBusinessObjectClassName) &&  | 
  | 404 |  |                       | 
  | 405 |  |                      !DocSearchCriteriaDTO.class.getName().equals(lookupBusinessObjectClassName)) { | 
  | 406 | 0 |                      final DataDictionary dataDictionary = getDataDictionaryService().getDataDictionary(); | 
  | 407 | 0 |                      final BusinessObjectEntry entry = dataDictionary.getBusinessObjectEntry(lookupBusinessObjectClassName); | 
  | 408 | 0 |                      final LookupDefinition lookupDefinition = entry.getLookupDefinition(); | 
  | 409 |  |                       | 
  | 410 | 0 |                      if (lookupDefinition != null) { | 
  | 411 | 0 |                              if (lookupDefinition.getHelpDefinition() != null && !StringUtils.isBlank(lookupDefinition.getHelpDefinition().getParameterNamespace()) && !StringUtils.isBlank(lookupDefinition.getHelpDefinition().getParameterDetailType()) && !StringUtils.isBlank(lookupDefinition.getHelpDefinition().getParameterName())) { | 
  | 412 | 0 |                                      final String apcHelpUrl = getHelpUrl(lookupDefinition.getHelpDefinition().getParameterNamespace(), lookupDefinition.getHelpDefinition().getParameterDetailType(), lookupDefinition.getHelpDefinition().getParameterName()); | 
  | 413 |  |                               | 
  | 414 | 0 |                              if ( !StringUtils.isBlank(apcHelpUrl) ) { | 
  | 415 | 0 |                                  response.sendRedirect(apcHelpUrl); | 
  | 416 | 0 |                                  return null; | 
  | 417 |  |                              } | 
  | 418 | 0 |                              } else if (!StringUtils.isBlank(lookupDefinition.getHelpUrl())) { | 
  | 419 | 0 |                                      final String apcHelpUrl = ConfigContext.getCurrentContextConfig().getProperty("externalizable.help.url")+lookupDefinition.getHelpUrl(); | 
  | 420 | 0 |                                      response.sendRedirect(apcHelpUrl); | 
  | 421 | 0 |                                      return null; | 
  | 422 |  |                              } | 
  | 423 |  |                      } | 
  | 424 |  |              } | 
  | 425 |  |               | 
  | 426 | 0 |              if (!StringUtils.isEmpty(helpForm.getSearchDocumentTypeName())) { | 
  | 427 | 0 |                  DocumentTypeDTO docType = KNSServiceLocator.getWorkflowInfoService().getDocType(helpForm.getSearchDocumentTypeName()); | 
  | 428 | 0 |                  if (!StringUtils.isEmpty(docType.getDocSearchHelpUrl())) { | 
  | 429 | 0 |                      String docSearchHelpUrl = ConfigContext.getCurrentContextConfig().getProperty("externalizable.help.url") + docType.getDocSearchHelpUrl(); | 
  | 430 |  |   | 
  | 431 | 0 |                      if ( StringUtils.isNotBlank(docSearchHelpUrl) ) { | 
  | 432 | 0 |                          response.sendRedirect(docSearchHelpUrl); | 
  | 433 | 0 |                          return null; | 
  | 434 |  |                      } | 
  | 435 |  |                  } | 
  | 436 |  |              } | 
  | 437 |  |               | 
  | 438 |  |               | 
  | 439 | 0 |              populateHelpFormForResourceText(helpForm, getDefaultLookupHelpResourceKey()); | 
  | 440 | 0 |          return mapping.findForward(RiceConstants.MAPPING_BASIC); | 
  | 441 |  |      } | 
  | 442 |  |       | 
  | 443 |  |       | 
  | 444 |  |   | 
  | 445 |  |   | 
  | 446 |  |      protected String getDefaultLookupHelpResourceKey() { | 
  | 447 | 0 |              return KualiHelpAction.DEFAULT_LOOKUP_HELP_TEXT_RESOURCE_KEY; | 
  | 448 |  |      } | 
  | 449 |  |   | 
  | 450 |  |      private String getHelpUrl(String parameterNamespace, String parameterDetailTypeCode, String parameterName) { | 
  | 451 | 0 |          return getConfigurationService().getPropertyString(KNSConstants.EXTERNALIZABLE_HELP_URL_KEY) + getParameterService().getParameterValue(parameterNamespace, parameterDetailTypeCode, parameterName); | 
  | 452 |  |      }     | 
  | 453 |  |       | 
  | 454 |  |       | 
  | 455 |  |   | 
  | 456 |  |   | 
  | 457 |  |      public ActionForward getHelpUrlByNamespace(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception { | 
  | 458 | 0 |          KualiHelpForm helpForm = (KualiHelpForm) form; | 
  | 459 | 0 |         return getStoredHelpUrl(mapping, form, request, response);  | 
  | 460 |  |      } | 
  | 461 |  |  } |