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