| 1 | |
|
| 2 | |
|
| 3 | |
|
| 4 | |
|
| 5 | |
|
| 6 | |
|
| 7 | |
|
| 8 | |
|
| 9 | |
|
| 10 | |
|
| 11 | |
|
| 12 | |
|
| 13 | |
|
| 14 | |
|
| 15 | |
|
| 16 | |
package org.kuali.rice.kns.inquiry; |
| 17 | |
|
| 18 | |
import org.apache.commons.collections.BidiMap; |
| 19 | |
import org.apache.commons.collections.bidimap.DualHashBidiMap; |
| 20 | |
import org.apache.commons.lang.StringUtils; |
| 21 | |
import org.kuali.rice.core.api.CoreApiServiceLocator; |
| 22 | |
import org.kuali.rice.core.api.config.property.ConfigurationService; |
| 23 | |
import org.kuali.rice.core.api.encryption.EncryptionService; |
| 24 | |
import org.kuali.rice.core.web.format.Formatter; |
| 25 | |
import org.kuali.rice.kns.datadictionary.InquirySectionDefinition; |
| 26 | |
import org.kuali.rice.kns.lookup.HtmlData; |
| 27 | |
import org.kuali.rice.kns.lookup.HtmlData.AnchorHtmlData; |
| 28 | |
import org.kuali.rice.kns.lookup.LookupUtils; |
| 29 | |
import org.kuali.rice.kns.service.BusinessObjectAuthorizationService; |
| 30 | |
import org.kuali.rice.kns.service.BusinessObjectMetaDataService; |
| 31 | |
import org.kuali.rice.kns.service.KNSServiceLocator; |
| 32 | |
import org.kuali.rice.kns.util.InactiveRecordsHidingUtils; |
| 33 | |
import org.kuali.rice.kns.web.ui.Section; |
| 34 | |
import org.kuali.rice.kns.web.ui.SectionBridge; |
| 35 | |
import org.kuali.rice.krad.bo.BusinessObject; |
| 36 | |
import org.kuali.rice.krad.bo.BusinessObjectRelationship; |
| 37 | |
import org.kuali.rice.krad.bo.DocumentHeader; |
| 38 | |
import org.kuali.rice.krad.bo.ExternalizableBusinessObject; |
| 39 | |
import org.kuali.rice.krad.datadictionary.AttributeSecurity; |
| 40 | |
import org.kuali.rice.krad.inquiry.InquirableImpl; |
| 41 | |
import org.kuali.rice.krad.lookup.CollectionIncomplete; |
| 42 | |
import org.kuali.rice.krad.service.BusinessObjectDictionaryService; |
| 43 | |
import org.kuali.rice.krad.service.BusinessObjectService; |
| 44 | |
import org.kuali.rice.krad.service.KRADServiceLocator; |
| 45 | |
import org.kuali.rice.krad.service.KRADServiceLocatorWeb; |
| 46 | |
import org.kuali.rice.krad.service.LookupService; |
| 47 | |
import org.kuali.rice.krad.service.ModuleService; |
| 48 | |
import org.kuali.rice.krad.service.PersistenceStructureService; |
| 49 | |
import org.kuali.rice.krad.util.ExternalizableBusinessObjectUtils; |
| 50 | |
import org.kuali.rice.krad.util.GlobalVariables; |
| 51 | |
import org.kuali.rice.krad.util.KRADConstants; |
| 52 | |
import org.kuali.rice.krad.util.ObjectUtils; |
| 53 | |
import org.kuali.rice.krad.util.UrlFactory; |
| 54 | |
|
| 55 | |
import java.security.GeneralSecurityException; |
| 56 | |
import java.util.ArrayList; |
| 57 | |
import java.util.Collection; |
| 58 | |
import java.util.Collections; |
| 59 | |
import java.util.HashMap; |
| 60 | |
import java.util.Iterator; |
| 61 | |
import java.util.List; |
| 62 | |
import java.util.Map; |
| 63 | |
import java.util.Properties; |
| 64 | |
|
| 65 | |
|
| 66 | |
|
| 67 | |
|
| 68 | |
|
| 69 | |
|
| 70 | |
|
| 71 | |
|
| 72 | |
|
| 73 | |
|
| 74 | |
|
| 75 | |
public class KualiInquirableImpl extends InquirableImpl implements Inquirable { |
| 76 | 0 | private static final org.apache.log4j.Logger LOG = org.apache.log4j.Logger.getLogger(KualiInquirableImpl.class); |
| 77 | |
|
| 78 | |
protected LookupService lookupService; |
| 79 | |
protected BusinessObjectAuthorizationService businessObjectAuthorizationService; |
| 80 | |
protected BusinessObjectDictionaryService businessObjectDictionaryService; |
| 81 | |
protected BusinessObjectMetaDataService businessObjectMetaDataService; |
| 82 | |
protected PersistenceStructureService persistenceStructureService; |
| 83 | |
protected EncryptionService encryptionService; |
| 84 | |
protected static BusinessObjectService businessObjectService; |
| 85 | |
|
| 86 | |
protected Map<String, Boolean> inactiveRecordDisplay; |
| 87 | |
|
| 88 | |
public static final String INQUIRY_TITLE_PREFIX = "title.inquiry.url.value.prependtext"; |
| 89 | |
|
| 90 | |
|
| 91 | |
|
| 92 | |
|
| 93 | 0 | public KualiInquirableImpl() { |
| 94 | 0 | inactiveRecordDisplay = new HashMap<String, Boolean>(); |
| 95 | 0 | } |
| 96 | |
|
| 97 | |
|
| 98 | |
|
| 99 | |
|
| 100 | |
|
| 101 | |
|
| 102 | |
|
| 103 | |
@SuppressWarnings("rawtypes") |
| 104 | |
@Override |
| 105 | |
public Object retrieveDataObject(Map fieldValues) { |
| 106 | 0 | if (getDataObjectClass() == null) { |
| 107 | 0 | LOG.error("Data object class not set in inquirable."); |
| 108 | 0 | throw new RuntimeException( |
| 109 | |
"Data object class not set in inquirable."); |
| 110 | |
} |
| 111 | |
|
| 112 | 0 | CollectionIncomplete<Object> searchResults = null; |
| 113 | 0 | ModuleService moduleService = KRADServiceLocatorWeb |
| 114 | |
.getKualiModuleService().getResponsibleModuleService( |
| 115 | |
getDataObjectClass()); |
| 116 | 0 | if (moduleService != null |
| 117 | |
&& moduleService.isExternalizable(getDataObjectClass())) { |
| 118 | 0 | BusinessObject bo = moduleService.getExternalizableBusinessObject( |
| 119 | |
getBusinessObjectClass(), fieldValues); |
| 120 | 0 | if (bo != null) { |
| 121 | 0 | ArrayList<Object> list = new ArrayList<Object>(1); |
| 122 | 0 | list.add(bo); |
| 123 | 0 | searchResults = new CollectionIncomplete<Object>(list, 1L); |
| 124 | |
} |
| 125 | 0 | } else { |
| 126 | |
|
| 127 | |
|
| 128 | 0 | searchResults = (CollectionIncomplete<Object>) getLookupService() |
| 129 | |
.findCollectionBySearch(getBusinessObjectClass(), |
| 130 | |
fieldValues); |
| 131 | |
} |
| 132 | |
|
| 133 | 0 | BusinessObject foundObject = null; |
| 134 | 0 | if (searchResults != null && searchResults.size() > 0) { |
| 135 | 0 | foundObject = (BusinessObject) searchResults.get(0); |
| 136 | |
} |
| 137 | |
|
| 138 | 0 | return foundObject; |
| 139 | |
} |
| 140 | |
|
| 141 | |
|
| 142 | |
|
| 143 | |
|
| 144 | |
|
| 145 | |
|
| 146 | |
@Deprecated |
| 147 | |
public BusinessObject getBusinessObject(Map fieldValues) { |
| 148 | 0 | return (BusinessObject) retrieveDataObject(fieldValues); |
| 149 | |
} |
| 150 | |
|
| 151 | |
|
| 152 | |
|
| 153 | |
|
| 154 | |
|
| 155 | |
@Deprecated |
| 156 | |
public List<Section> getSections(BusinessObject bo) { |
| 157 | |
|
| 158 | 0 | List<Section> sections = new ArrayList<Section>(); |
| 159 | 0 | if (getBusinessObjectClass() == null) { |
| 160 | 0 | LOG.error("Business object class not set in inquirable."); |
| 161 | 0 | throw new RuntimeException("Business object class not set in inquirable."); |
| 162 | |
} |
| 163 | |
|
| 164 | 0 | InquiryRestrictions inquiryRestrictions = KNSServiceLocator.getBusinessObjectAuthorizationService() |
| 165 | |
.getInquiryRestrictions(bo, GlobalVariables.getUserSession().getPerson()); |
| 166 | |
|
| 167 | 0 | Collection<InquirySectionDefinition> inquirySections = getBusinessObjectDictionaryService().getInquirySections( |
| 168 | |
getBusinessObjectClass()); |
| 169 | 0 | for (Iterator<InquirySectionDefinition> iter = inquirySections.iterator(); iter.hasNext();) { |
| 170 | 0 | InquirySectionDefinition inquirySection = iter.next(); |
| 171 | 0 | if (!inquiryRestrictions.isHiddenSectionId(inquirySection.getId())) { |
| 172 | 0 | Section section = SectionBridge.toSection(this, inquirySection, bo, inquiryRestrictions); |
| 173 | 0 | sections.add(section); |
| 174 | |
} |
| 175 | 0 | } |
| 176 | |
|
| 177 | 0 | return sections; |
| 178 | |
} |
| 179 | |
|
| 180 | |
|
| 181 | |
|
| 182 | |
|
| 183 | |
|
| 184 | |
|
| 185 | |
|
| 186 | |
|
| 187 | |
|
| 188 | |
|
| 189 | |
@Deprecated |
| 190 | |
public HtmlData getInquiryUrl(BusinessObject businessObject, String attributeName, boolean forceInquiry) { |
| 191 | 0 | Properties parameters = new Properties(); |
| 192 | 0 | AnchorHtmlData hRef = new AnchorHtmlData(KRADConstants.EMPTY_STRING, KRADConstants.EMPTY_STRING); |
| 193 | 0 | parameters.put(KRADConstants.DISPATCH_REQUEST_PARAMETER, "start"); |
| 194 | |
|
| 195 | 0 | Class inquiryBusinessObjectClass = null; |
| 196 | 0 | String attributeRefName = ""; |
| 197 | 0 | boolean isPkReference = false; |
| 198 | |
|
| 199 | 0 | boolean doesNestedReferenceHaveOwnPrimitiveReference = false; |
| 200 | 0 | BusinessObject nestedBusinessObject = null; |
| 201 | |
|
| 202 | 0 | Class businessObjectClass = ObjectUtils.materializeClassForProxiedObject(businessObject); |
| 203 | 0 | if (attributeName.equals(getBusinessObjectDictionaryService().getTitleAttribute(businessObjectClass))) { |
| 204 | 0 | inquiryBusinessObjectClass = businessObjectClass; |
| 205 | 0 | isPkReference = true; |
| 206 | |
} |
| 207 | |
else { |
| 208 | 0 | if (ObjectUtils.isNestedAttribute(attributeName)) { |
| 209 | |
|
| 210 | |
|
| 211 | |
|
| 212 | |
|
| 213 | |
|
| 214 | |
|
| 215 | |
|
| 216 | |
|
| 217 | |
|
| 218 | |
|
| 219 | |
|
| 220 | 0 | String nestedReferenceName = ObjectUtils.getNestedAttributePrefix(attributeName); |
| 221 | 0 | Object nestedReferenceObject = ObjectUtils.getNestedValue(businessObject, nestedReferenceName); |
| 222 | |
|
| 223 | 0 | if (ObjectUtils.isNotNull(nestedReferenceObject) && nestedReferenceObject instanceof BusinessObject) { |
| 224 | 0 | nestedBusinessObject = (BusinessObject) nestedReferenceObject; |
| 225 | 0 | String nestedAttributePrimitive = ObjectUtils.getNestedAttributePrimitive(attributeName); |
| 226 | 0 | Class nestedBusinessObjectClass = ObjectUtils |
| 227 | |
.materializeClassForProxiedObject(nestedBusinessObject); |
| 228 | |
|
| 229 | 0 | if (nestedAttributePrimitive.equals(getBusinessObjectDictionaryService().getTitleAttribute( |
| 230 | |
nestedBusinessObjectClass))) { |
| 231 | |
|
| 232 | |
|
| 233 | 0 | inquiryBusinessObjectClass = nestedBusinessObjectClass; |
| 234 | |
|
| 235 | |
|
| 236 | 0 | doesNestedReferenceHaveOwnPrimitiveReference = false; |
| 237 | |
} |
| 238 | |
else { |
| 239 | 0 | Map primitiveReference = LookupUtils.getPrimitiveReference(nestedBusinessObject, |
| 240 | |
nestedAttributePrimitive); |
| 241 | 0 | if (primitiveReference != null && !primitiveReference.isEmpty()) { |
| 242 | 0 | attributeRefName = (String) primitiveReference.keySet().iterator().next(); |
| 243 | 0 | inquiryBusinessObjectClass = (Class) primitiveReference.get(attributeRefName); |
| 244 | 0 | doesNestedReferenceHaveOwnPrimitiveReference = true; |
| 245 | |
} |
| 246 | |
else { |
| 247 | |
|
| 248 | |
|
| 249 | 0 | inquiryBusinessObjectClass = ObjectUtils |
| 250 | |
.materializeClassForProxiedObject(nestedBusinessObject); |
| 251 | |
|
| 252 | |
|
| 253 | 0 | doesNestedReferenceHaveOwnPrimitiveReference = false; |
| 254 | |
} |
| 255 | |
} |
| 256 | |
} |
| 257 | 0 | } |
| 258 | |
else { |
| 259 | 0 | Map primitiveReference = LookupUtils.getPrimitiveReference(businessObject, attributeName); |
| 260 | 0 | if (primitiveReference != null && !primitiveReference.isEmpty()) { |
| 261 | 0 | attributeRefName = (String) primitiveReference.keySet().iterator().next(); |
| 262 | 0 | inquiryBusinessObjectClass = (Class) primitiveReference.get(attributeRefName); |
| 263 | |
} |
| 264 | |
} |
| 265 | |
} |
| 266 | |
|
| 267 | 0 | if (inquiryBusinessObjectClass != null && DocumentHeader.class.isAssignableFrom(inquiryBusinessObjectClass)) { |
| 268 | 0 | String documentNumber = (String) ObjectUtils.getPropertyValue(businessObject, attributeName); |
| 269 | 0 | if (!StringUtils.isBlank(documentNumber)) { |
| 270 | |
|
| 271 | |
|
| 272 | |
|
| 273 | |
|
| 274 | |
|
| 275 | |
|
| 276 | |
|
| 277 | |
|
| 278 | 0 | hRef.setHref(getKualiConfigurationService().getPropertyString(KRADConstants.WORKFLOW_URL_KEY) |
| 279 | |
+ KRADConstants.DOCHANDLER_DO_URL + documentNumber + KRADConstants.DOCHANDLER_URL_CHUNK); |
| 280 | |
} |
| 281 | 0 | return hRef; |
| 282 | |
} |
| 283 | |
|
| 284 | 0 | if (inquiryBusinessObjectClass == null |
| 285 | |
|| getBusinessObjectDictionaryService().isInquirable(inquiryBusinessObjectClass) == null |
| 286 | |
|| !getBusinessObjectDictionaryService().isInquirable(inquiryBusinessObjectClass).booleanValue()) { |
| 287 | 0 | return hRef; |
| 288 | |
} |
| 289 | |
|
| 290 | 0 | synchronized (SUPER_CLASS_TRANSLATOR_LIST) { |
| 291 | 0 | for (Class clazz : SUPER_CLASS_TRANSLATOR_LIST) { |
| 292 | 0 | if (clazz.isAssignableFrom(inquiryBusinessObjectClass)) { |
| 293 | 0 | inquiryBusinessObjectClass = clazz; |
| 294 | 0 | break; |
| 295 | |
} |
| 296 | |
} |
| 297 | 0 | } |
| 298 | |
|
| 299 | 0 | if (!inquiryBusinessObjectClass.isInterface() |
| 300 | |
&& ExternalizableBusinessObject.class.isAssignableFrom(inquiryBusinessObjectClass)) { |
| 301 | 0 | inquiryBusinessObjectClass = ExternalizableBusinessObjectUtils |
| 302 | |
.determineExternalizableBusinessObjectSubInterface(inquiryBusinessObjectClass); |
| 303 | |
} |
| 304 | |
|
| 305 | 0 | parameters.put(KRADConstants.BUSINESS_OBJECT_CLASS_ATTRIBUTE, inquiryBusinessObjectClass.getName()); |
| 306 | |
|
| 307 | |
|
| 308 | |
|
| 309 | 0 | List<String> keys = new ArrayList<String>(getBusinessObjectMetaDataService().listPrimaryKeyFieldNames( |
| 310 | |
inquiryBusinessObjectClass)); |
| 311 | |
|
| 312 | 0 | if (keys == null) { |
| 313 | 0 | keys = Collections.emptyList(); |
| 314 | |
} |
| 315 | |
|
| 316 | 0 | BusinessObjectRelationship businessObjectRelationship = null; |
| 317 | |
|
| 318 | 0 | if (attributeRefName != null && !"".equals(attributeRefName)) { |
| 319 | 0 | businessObjectRelationship = getBusinessObjectMetaDataService().getBusinessObjectRelationship( |
| 320 | |
businessObject, attributeRefName); |
| 321 | |
|
| 322 | 0 | if (businessObjectRelationship != null && businessObjectRelationship.getParentToChildReferences() != null) { |
| 323 | 0 | for (String targetNamePrimaryKey : businessObjectRelationship.getParentToChildReferences().values()) { |
| 324 | 0 | keys.add(targetNamePrimaryKey); |
| 325 | |
} |
| 326 | |
} |
| 327 | |
} |
| 328 | |
|
| 329 | 0 | String keyName = null; |
| 330 | 0 | String keyConversion = null; |
| 331 | 0 | Map<String, String> fieldList = new HashMap<String, String>(); |
| 332 | 0 | for (Iterator iter = keys.iterator(); iter.hasNext();) { |
| 333 | 0 | keyName = (String) iter.next(); |
| 334 | 0 | keyConversion = keyName; |
| 335 | 0 | if (ObjectUtils.isNestedAttribute(attributeName)) { |
| 336 | 0 | if (doesNestedReferenceHaveOwnPrimitiveReference) { |
| 337 | 0 | String nestedAttributePrefix = ObjectUtils.getNestedAttributePrefix(attributeName); |
| 338 | |
|
| 339 | |
|
| 340 | |
|
| 341 | |
|
| 342 | |
|
| 343 | 0 | String foreignKeyFieldName = getBusinessObjectMetaDataService().getForeignKeyFieldName( |
| 344 | |
nestedBusinessObject.getClass(), attributeRefName, keyName); |
| 345 | 0 | keyConversion = nestedAttributePrefix + "." + foreignKeyFieldName; |
| 346 | 0 | } |
| 347 | |
else { |
| 348 | 0 | keyConversion = ObjectUtils.getNestedAttributePrefix(attributeName) + "." + keyName; |
| 349 | |
} |
| 350 | |
} |
| 351 | |
else { |
| 352 | 0 | if (isPkReference) { |
| 353 | 0 | keyConversion = keyName; |
| 354 | |
} |
| 355 | 0 | else if (businessObjectRelationship != null) { |
| 356 | |
|
| 357 | |
|
| 358 | |
|
| 359 | |
|
| 360 | |
|
| 361 | |
|
| 362 | |
|
| 363 | |
|
| 364 | |
|
| 365 | |
|
| 366 | |
|
| 367 | |
|
| 368 | |
|
| 369 | |
|
| 370 | 0 | BidiMap bidiMap = new DualHashBidiMap(businessObjectRelationship.getParentToChildReferences()); |
| 371 | 0 | keyConversion = (String) bidiMap.getKey(keyName); |
| 372 | |
|
| 373 | |
|
| 374 | |
|
| 375 | |
} |
| 376 | |
} |
| 377 | 0 | Object keyValue = null; |
| 378 | 0 | if (keyConversion != null) { |
| 379 | 0 | keyValue = ObjectUtils.getPropertyValue(businessObject, keyConversion); |
| 380 | |
} |
| 381 | |
|
| 382 | 0 | if (keyValue == null) { |
| 383 | 0 | keyValue = ""; |
| 384 | |
} |
| 385 | 0 | else if (keyValue instanceof java.sql.Date) { |
| 386 | |
|
| 387 | 0 | if (Formatter.findFormatter(keyValue.getClass()) != null) { |
| 388 | 0 | Formatter formatter = Formatter.getFormatter(keyValue.getClass()); |
| 389 | 0 | keyValue = (String) formatter.format(keyValue); |
| 390 | 0 | } |
| 391 | |
} |
| 392 | |
else { |
| 393 | 0 | keyValue = keyValue.toString(); |
| 394 | |
} |
| 395 | |
|
| 396 | |
|
| 397 | |
|
| 398 | |
|
| 399 | |
|
| 400 | 0 | AttributeSecurity attributeSecurity = KRADServiceLocatorWeb.getDataDictionaryService().getAttributeSecurity( |
| 401 | |
businessObject.getClass().getName(), keyName); |
| 402 | 0 | if (attributeSecurity != null && attributeSecurity.hasRestrictionThatRemovesValueFromUI()) { |
| 403 | |
try { |
| 404 | 0 | keyValue = getEncryptionService().encrypt(keyValue); |
| 405 | |
} |
| 406 | 0 | catch (GeneralSecurityException e) { |
| 407 | 0 | LOG.error("Exception while trying to encrypted value for inquiry framework.", e); |
| 408 | 0 | throw new RuntimeException(e); |
| 409 | 0 | } |
| 410 | |
} |
| 411 | |
|
| 412 | 0 | parameters.put(keyName, keyValue); |
| 413 | 0 | fieldList.put(keyName, keyValue.toString()); |
| 414 | 0 | } |
| 415 | |
|
| 416 | 0 | return getHyperLink(inquiryBusinessObjectClass, fieldList, |
| 417 | |
UrlFactory.parameterizeUrl(KRADConstants.INQUIRY_ACTION, parameters)); |
| 418 | |
} |
| 419 | |
|
| 420 | |
@Deprecated |
| 421 | |
protected AnchorHtmlData getHyperLink(Class inquiryClass, Map<String, String> fieldList, String inquiryUrl) { |
| 422 | 0 | AnchorHtmlData a = new AnchorHtmlData(inquiryUrl, KRADConstants.EMPTY_STRING); |
| 423 | 0 | a.setTitle(HtmlData.getTitleText(this.createTitleText(inquiryClass), inquiryClass, fieldList)); |
| 424 | 0 | return a; |
| 425 | |
} |
| 426 | |
|
| 427 | |
|
| 428 | |
|
| 429 | |
|
| 430 | |
|
| 431 | |
|
| 432 | |
|
| 433 | |
|
| 434 | |
@Deprecated |
| 435 | |
protected String createTitleText(Class<?> dataObjectClass) { |
| 436 | 0 | String titleText = ""; |
| 437 | |
|
| 438 | 0 | String titlePrefixProp = getKualiConfigurationService().getPropertyString(INQUIRY_TITLE_PREFIX); |
| 439 | 0 | if (StringUtils.isNotBlank(titlePrefixProp)) { |
| 440 | 0 | titleText += titlePrefixProp + " "; |
| 441 | |
} |
| 442 | |
|
| 443 | 0 | String objectLabel = getDataDictionaryService().getDataDictionary() |
| 444 | |
.getBusinessObjectEntry(dataObjectClass.getName()).getObjectLabel(); |
| 445 | 0 | if (StringUtils.isNotBlank(objectLabel)) { |
| 446 | 0 | titleText += objectLabel + " "; |
| 447 | |
} |
| 448 | |
|
| 449 | 0 | return titleText; |
| 450 | |
} |
| 451 | |
|
| 452 | |
@Deprecated |
| 453 | |
public void addAdditionalSections(List columns, BusinessObject bo) { |
| 454 | 0 | } |
| 455 | |
|
| 456 | |
|
| 457 | |
|
| 458 | |
|
| 459 | |
@Deprecated |
| 460 | |
public String getHtmlMenuBar() { |
| 461 | |
|
| 462 | 0 | return getBusinessObjectDictionaryService().getLookupMenuBar(getBusinessObjectClass()); |
| 463 | |
} |
| 464 | |
|
| 465 | |
|
| 466 | |
|
| 467 | |
|
| 468 | |
@Deprecated |
| 469 | |
public String getTitle() { |
| 470 | 0 | return getBusinessObjectDictionaryService().getInquiryTitle(getBusinessObjectClass()); |
| 471 | |
} |
| 472 | |
|
| 473 | |
|
| 474 | |
|
| 475 | |
|
| 476 | |
|
| 477 | |
@Deprecated |
| 478 | |
public void setBusinessObjectClass(Class businessObjectClass) { |
| 479 | 0 | this.dataObjectClass = businessObjectClass; |
| 480 | 0 | } |
| 481 | |
|
| 482 | |
|
| 483 | |
|
| 484 | |
|
| 485 | |
@Deprecated |
| 486 | |
public Class getBusinessObjectClass() { |
| 487 | 0 | return dataObjectClass; |
| 488 | |
} |
| 489 | |
|
| 490 | |
|
| 491 | |
|
| 492 | |
|
| 493 | |
@Deprecated |
| 494 | |
public Map<String, Boolean> getInactiveRecordDisplay() { |
| 495 | 0 | return inactiveRecordDisplay; |
| 496 | |
} |
| 497 | |
|
| 498 | |
|
| 499 | |
|
| 500 | |
|
| 501 | |
@Deprecated |
| 502 | |
public boolean getShowInactiveRecords(String collectionName) { |
| 503 | 0 | return InactiveRecordsHidingUtils.getShowInactiveRecords(inactiveRecordDisplay, collectionName); |
| 504 | |
} |
| 505 | |
|
| 506 | |
|
| 507 | |
|
| 508 | |
|
| 509 | |
|
| 510 | |
@Deprecated |
| 511 | |
public void setShowInactiveRecords(String collectionName, boolean showInactive) { |
| 512 | 0 | InactiveRecordsHidingUtils.setShowInactiveRecords(inactiveRecordDisplay, collectionName, showInactive); |
| 513 | 0 | } |
| 514 | |
|
| 515 | |
protected LookupService getLookupService() { |
| 516 | 0 | if (lookupService == null) { |
| 517 | 0 | lookupService = KRADServiceLocatorWeb.getLookupService(); |
| 518 | |
} |
| 519 | 0 | return lookupService; |
| 520 | |
} |
| 521 | |
|
| 522 | |
public void setLookupService(LookupService lookupService) { |
| 523 | 0 | this.lookupService = lookupService; |
| 524 | 0 | } |
| 525 | |
|
| 526 | |
protected BusinessObjectDictionaryService getBusinessObjectDictionaryService() { |
| 527 | 0 | if (businessObjectDictionaryService == null) { |
| 528 | 0 | businessObjectDictionaryService = KRADServiceLocatorWeb.getBusinessObjectDictionaryService(); |
| 529 | |
} |
| 530 | 0 | return businessObjectDictionaryService; |
| 531 | |
} |
| 532 | |
|
| 533 | |
public void setBusinessObjectDictionaryService(BusinessObjectDictionaryService businessObjectDictionaryService) { |
| 534 | 0 | this.businessObjectDictionaryService = businessObjectDictionaryService; |
| 535 | 0 | } |
| 536 | |
|
| 537 | |
protected PersistenceStructureService getPersistenceStructureService() { |
| 538 | 0 | if (persistenceStructureService == null) { |
| 539 | 0 | persistenceStructureService = KRADServiceLocator.getPersistenceStructureService(); |
| 540 | |
} |
| 541 | 0 | return this.persistenceStructureService; |
| 542 | |
} |
| 543 | |
|
| 544 | |
public void setPersistenceStructureService(PersistenceStructureService persistenceStructureService) { |
| 545 | 0 | this.persistenceStructureService = persistenceStructureService; |
| 546 | 0 | } |
| 547 | |
|
| 548 | |
protected EncryptionService getEncryptionService() { |
| 549 | 0 | if (encryptionService == null) { |
| 550 | 0 | encryptionService = CoreApiServiceLocator.getEncryptionService(); |
| 551 | |
} |
| 552 | 0 | return this.encryptionService; |
| 553 | |
} |
| 554 | |
|
| 555 | |
public void setEncryptionService(EncryptionService encryptionService) { |
| 556 | 0 | this.encryptionService = encryptionService; |
| 557 | 0 | } |
| 558 | |
|
| 559 | |
protected ConfigurationService getKualiConfigurationService() { |
| 560 | 0 | return getConfigurationService(); |
| 561 | |
} |
| 562 | |
|
| 563 | |
public void setKualiConfigurationService(ConfigurationService kualiConfigurationService) { |
| 564 | 0 | setConfigurationService(kualiConfigurationService); |
| 565 | 0 | } |
| 566 | |
|
| 567 | |
protected BusinessObjectMetaDataService getBusinessObjectMetaDataService() { |
| 568 | 0 | if (businessObjectMetaDataService == null) { |
| 569 | 0 | businessObjectMetaDataService = KNSServiceLocator.getBusinessObjectMetaDataService(); |
| 570 | |
} |
| 571 | 0 | return this.businessObjectMetaDataService; |
| 572 | |
} |
| 573 | |
|
| 574 | |
public void setBusinessObjectMetaDataService(BusinessObjectMetaDataService businessObjectMetaDataService) { |
| 575 | 0 | this.businessObjectMetaDataService = businessObjectMetaDataService; |
| 576 | 0 | } |
| 577 | |
|
| 578 | |
protected BusinessObjectService getBusinessObjectService() { |
| 579 | 0 | if (businessObjectService == null) { |
| 580 | 0 | businessObjectService = KRADServiceLocator.getBusinessObjectService(); |
| 581 | |
} |
| 582 | 0 | return businessObjectService; |
| 583 | |
} |
| 584 | |
|
| 585 | |
protected BusinessObjectAuthorizationService getBusinessObjectAuthorizationService() { |
| 586 | 0 | if (this.businessObjectAuthorizationService == null) { |
| 587 | 0 | this.businessObjectAuthorizationService = KNSServiceLocator.getBusinessObjectAuthorizationService(); |
| 588 | |
} |
| 589 | 0 | return this.businessObjectAuthorizationService; |
| 590 | |
} |
| 591 | |
|
| 592 | |
public void setBusinessObjectAuthorizationService( |
| 593 | |
BusinessObjectAuthorizationService businessObjectAuthorizationService) { |
| 594 | 0 | this.businessObjectAuthorizationService = businessObjectAuthorizationService; |
| 595 | 0 | } |
| 596 | |
|
| 597 | |
@Deprecated |
| 598 | |
protected AnchorHtmlData getInquiryUrlForPrimaryKeys(Class clazz, Object businessObject, List<String> primaryKeys, |
| 599 | |
String displayText) { |
| 600 | 0 | if (businessObject == null) |
| 601 | 0 | return new AnchorHtmlData(KRADConstants.EMPTY_STRING, KRADConstants.EMPTY_STRING); |
| 602 | |
|
| 603 | 0 | Properties parameters = new Properties(); |
| 604 | 0 | parameters.put(KRADConstants.DISPATCH_REQUEST_PARAMETER, KRADConstants.START_METHOD); |
| 605 | 0 | parameters.put(KRADConstants.BUSINESS_OBJECT_CLASS_ATTRIBUTE, clazz.getName()); |
| 606 | |
|
| 607 | |
String titleAttributeValue; |
| 608 | 0 | Map<String, String> fieldList = new HashMap<String, String>(); |
| 609 | 0 | for (String primaryKey : primaryKeys) { |
| 610 | 0 | titleAttributeValue = (String) ObjectUtils.getPropertyValue(businessObject, primaryKey); |
| 611 | 0 | parameters.put(primaryKey, titleAttributeValue); |
| 612 | 0 | fieldList.put(primaryKey, titleAttributeValue); |
| 613 | |
} |
| 614 | 0 | if (StringUtils.isEmpty(displayText)) |
| 615 | 0 | return getHyperLink(clazz, fieldList, UrlFactory.parameterizeUrl(KRADConstants.INQUIRY_ACTION, parameters)); |
| 616 | |
else |
| 617 | 0 | return getHyperLink(clazz, fieldList, UrlFactory.parameterizeUrl(KRADConstants.INQUIRY_ACTION, parameters), |
| 618 | |
displayText); |
| 619 | |
} |
| 620 | |
|
| 621 | |
@Deprecated |
| 622 | |
protected AnchorHtmlData getHyperLink(Class inquiryClass, Map<String, String> fieldList, String inquiryUrl, |
| 623 | |
String displayText) { |
| 624 | 0 | AnchorHtmlData a = new AnchorHtmlData(inquiryUrl, KRADConstants.EMPTY_STRING, displayText); |
| 625 | 0 | a.setTitle(AnchorHtmlData.getTitleText(getKualiConfigurationService().getPropertyString(INQUIRY_TITLE_PREFIX) |
| 626 | |
+ " " |
| 627 | |
+ getDataDictionaryService().getDataDictionary().getBusinessObjectEntry(inquiryClass.getName()) |
| 628 | |
.getObjectLabel() + " ", inquiryClass, fieldList)); |
| 629 | 0 | return a; |
| 630 | |
} |
| 631 | |
|
| 632 | |
} |