private static DataDictionaryService getDataDictionaryService() { if (dataDictionaryService == null) { dataDictionaryService = KRADServiceLocatorWeb.getDataDictionaryService(); } return dataDictionaryService; } private static MaintenanceDocumentDictionaryService maintenanceDocumentDictionaryService;
protected static DocumentDictionaryService getDocumentDictionaryService() { if (documentDictionaryService == null) { documentDictionaryService = KRADServiceLocatorWeb.getDocumentDictionaryService(); } return documentDictionaryService; }
protected DocumentService getDocumentService() { if (documentService == null) { documentService = KRADServiceLocatorWeb.getDocumentService(); } return this.documentService; }
protected static LegacyDataAdapter getLegacyDataAdapter() { if (legacyDataAdapter == null) { legacyDataAdapter = KRADServiceLocatorWeb.getLegacyDataAdapter(); } return legacyDataAdapter; }
private static KualiModuleService getKualiModuleService() { if (kualiModuleService == null) { kualiModuleService = KRADServiceLocatorWeb.getKualiModuleService(); } return kualiModuleService; }
@Override public void submitToWorkflow(LeavePayout leavePayout) throws WorkflowException { //leavePayout.setStatus(HrConstants.ROUTE_STATUS.ENROUTE); /*MaintenanceDocument document = KRADServiceLocatorWeb.getMaintenanceDocumentService().setupNewMaintenanceDocument(LeavePayout.class.getName(), "LeavePayoutDocumentType",KRADConstants.MAINTENANCE_NEW_ACTION);*/ MaintenanceDocument document = (MaintenanceDocument) KRADServiceLocatorWeb.getDocumentService().getNewDocument("LeavePayoutDocumentType"); document.getDocumentHeader().setDocumentDescription(TKUtils.getDocumentDescription(leavePayout.getPrincipalId(), leavePayout.getEffectiveLocalDate())); Map<String,String[]> params = new HashMap<String,String[]>(); KRADServiceLocatorWeb.getMaintenanceDocumentService().setupMaintenanceObject(document, KRADConstants.MAINTENANCE_NEW_ACTION, params); LeavePayout lpObj = (LeavePayout) document.getNewMaintainableObject().getDataObject(); lpObj.setAccrualCategoryRule(leavePayout.getAccrualCategoryRule()); lpObj.setEffectiveDate(leavePayout.getEffectiveDate()); lpObj.setLeaveCalendarDocumentId(leavePayout.getLeaveCalendarDocumentId()); lpObj.setForfeitedAmount(leavePayout.getForfeitedAmount()); lpObj.setFromAccrualCategory(leavePayout.getFromAccrualCategory()); lpObj.setPrincipalId(leavePayout.getPrincipalId()); lpObj.setEarnCode(leavePayout.getEarnCode()); lpObj.setPayoutAmount(leavePayout.getPayoutAmount()); lpObj.setDocumentHeaderId(document.getDocumentHeader().getWorkflowDocument().getDocumentId()); //document.getNewMaintainableObject().setDataObject(lpObj); KRADServiceLocatorWeb.getDocumentService().saveDocument(document); document.getDocumentHeader().getWorkflowDocument().saveDocument(""); document.getDocumentHeader().getWorkflowDocument().route(""); }
@Override public boolean isAuthorizedForDocument(String principalId, Document document) { try { MissedPunchDocument mpd = (MissedPunchDocument) KRADServiceLocatorWeb.getDocumentService().getByDocumentHeaderId(document.getDocumentId()); String groupKey = mpd.getGroupKeyCode(); Long workArea = mpd.getWorkArea(); String department = mpd.getDepartment(); String location = mpd.getGroupKey() != null ? mpd.getGroupKey().getLocationId() : HrServiceLocator.getHrGroupKeyService().getHrGroupKey(mpd.getGroupKeyCode(), mpd.getMissedPunch().getActionLocalDate()).getLocationId(); Map<String, String> roleQualification = new HashMap<String, String>(); roleQualification.put(KimConstants.AttributeConstants.PRINCIPAL_ID, principalId); roleQualification.put(KPMERoleMemberAttribute.DEPARTMENT.getRoleMemberAttributeName(), department); roleQualification.put(KPMERoleMemberAttribute.WORK_AREA.getRoleMemberAttributeName(), workArea.toString()); roleQualification.put(KPMERoleMemberAttribute.GROUP_KEY_CODE.getRoleMemberAttributeName(), groupKey); roleQualification.put(KPMERoleMemberAttribute.LOCATION.getRoleMemberAttributeName(), location); Map<String, String> permissionDetails = new HashMap<String, String>(); permissionDetails.put(KimConstants.AttributeConstants.DOCUMENT_TYPE_NAME, KRADServiceLocatorWeb.getDocumentDictionaryService().getDocumentTypeByClass(MissedPunchDocument.class)); return (!KimApiServiceLocator.getPermissionService().isPermissionDefinedByTemplate(KPMENamespace.KPME_WKFLW.getNamespaceCode(), KPMEPermissionTemplate.VIEW_KPME_RECORD.getPermissionTemplateName(), new HashMap<String, String>()) || KimApiServiceLocator.getPermissionService().isAuthorizedByTemplate(principalId, KPMENamespace.KPME_WKFLW.getNamespaceCode(), KPMEPermissionTemplate.VIEW_KPME_RECORD.getPermissionTemplateName(), permissionDetails, roleQualification)); } catch (WorkflowException e) { return false; } } }
/** * @see org.kuali.rice.krad.service.KeyValuesService#findAll(java.lang.Class) */ @Override public <T> Collection<T> findAll(Class<T> clazz) { ModuleService responsibleModuleService = KRADServiceLocatorWeb.getKualiModuleService().getResponsibleModuleService(clazz); if(responsibleModuleService!=null && responsibleModuleService.isExternalizable(clazz)){ return (Collection<T>) responsibleModuleService.getExternalizableBusinessObjectsList((Class<ExternalizableBusinessObject>) clazz, Collections.<String, Object>emptyMap()); } if (containsActiveIndicator(clazz)) { return KRADServiceLocatorWeb.getLegacyDataAdapter().findMatching(clazz, Collections.singletonMap(CoreConstants.CommonElements.ACTIVE, true)); } if (LOG.isDebugEnabled()) { LOG.debug("Active indicator not found for class " + clazz.getName()); } return KRADServiceLocatorWeb.getLegacyDataAdapter().findAll(clazz); }
/** * Default constructor a MaintenanceDocumentRuleBase.java. */ public MaintenanceDocumentRuleBase() { priorErrorPath = new ArrayList(); // Pseudo-inject some services. // // This approach is being used to make it simpler to convert the Rule classes // to spring-managed with these services injected by Spring at some later date. // When this happens, just remove these calls to the setters with // SpringServiceLocator, and configure the bean defs for spring. try { this.setPersistenceStructureService(KNSServiceLocator.getPersistenceStructureService()); this.setDdService(KRADServiceLocatorWeb.getDataDictionaryService()); this.setBusinessObjectMetaDataService(KNSServiceLocator.getBusinessObjectMetaDataService()); this.setBoService(KNSServiceLocator.getBusinessObjectService()); this.setBoDictionaryService(KNSServiceLocator.getBusinessObjectDictionaryService()); this.setDictionaryValidationService(super.getDictionaryValidationService()); this.setConfigService(CoreApiServiceLocator.getKualiConfigurationService()); this.setDocumentHelperService(KNSServiceLocator.getDocumentHelperService()); this.setMaintDocDictionaryService(KNSServiceLocator.getMaintenanceDocumentDictionaryService()); this.setWorkflowDocumentService(KRADServiceLocatorWeb.getWorkflowDocumentService()); this.setPersonService(KimApiServiceLocator.getPersonService()); this.setBusinessObjectAuthorizationService(KNSServiceLocator.getBusinessObjectAuthorizationService()); } catch (Exception ex) { // do nothing, avoid blowing up if called prior to spring initialization } }
protected PessimisticLockService getPessimisticLockService() { if (pessimisticLockService == null) { pessimisticLockService = KRADServiceLocatorWeb.getPessimisticLockService(); } return this.pessimisticLockService; }
private static WorkflowDocumentService getWorkflowDocumentService() { if (workflowDocumentService == null) { workflowDocumentService = KRADServiceLocatorWeb.getWorkflowDocumentService(); } return workflowDocumentService; }
protected LookupService getLookupService() { if (lookupService == null) { lookupService = KRADServiceLocatorWeb.getLookupService(); } return lookupService; }
@Override protected boolean processCustomSaveDocumentBusinessRules(Document document) { if (!(document instanceof AccountRequestDocument)) { return false; } boolean valid = true; GlobalVariables.getMessageMap().addToErrorPath("document"); KRADServiceLocatorWeb.getDictionaryValidationService().validateDocument(document); GlobalVariables.getMessageMap().removeFromErrorPath("document"); return valid; } }
private static MaintenanceDocumentService getMaintenanceDocumentService() { if (maintenanceDocumentService == null) { maintenanceDocumentService = KRADServiceLocatorWeb.getMaintenanceDocumentService(); } return maintenanceDocumentService; }
/** * @see org.kuali.rice.krad.service.KeyValuesService#findAllOrderBy(java.lang.Class, java.lang.String, boolean) */ @Override public <T> Collection<T> findAllOrderBy(Class<T> clazz, String sortField, boolean sortAscending) { if (containsActiveIndicator(clazz)) { return KRADServiceLocatorWeb.getLegacyDataAdapter().findMatchingOrderBy(clazz, Collections.singletonMap(CoreConstants.CommonElements.ACTIVE, true), sortField, sortAscending); } if (LOG.isDebugEnabled()) { LOG.debug("Active indicator not found for class " + clazz.getName()); } return KRADServiceLocatorWeb.getLegacyDataAdapter().findMatchingOrderBy(clazz, new HashMap<String,Object>(), sortField, sortAscending); }
private synchronized static KualiModuleService getKualiModuleService() { if (kualiModuleService == null) { kualiModuleService = KRADServiceLocatorWeb.getKualiModuleService(); } return kualiModuleService; }
MaintenanceDocument document = (MaintenanceDocument) KRADServiceLocatorWeb.getDocumentService().getNewDocument("BalanceTransferDocumentType"); KRADServiceLocatorWeb.getMaintenanceDocumentService().setupMaintenanceObject(document, KRADConstants.MAINTENANCE_NEW_ACTION, params); BalanceTransfer btObj = (BalanceTransfer) document.getNewMaintainableObject().getDataObject(); KRADServiceLocatorWeb.getDocumentService().saveDocument(document); document.getDocumentHeader().getWorkflowDocument().saveDocument("");
public static Boolean isDocumentLocked(String documentId) { List<PessimisticLock> pessimisticLocks = KRADServiceLocatorWeb.getPessimisticLockService().getPessimisticLocksForDocument(documentId); if (pessimisticLocks.isEmpty()) { return false; } else { return true; } }
protected void addStandardAttributes(Document document, Map<String, String> attributes) { WorkflowDocument wd = document.getDocumentHeader().getWorkflowDocument(); attributes.put(KimConstants.AttributeConstants.DOCUMENT_NUMBER, document.getDocumentNumber()); attributes.put(KimConstants.AttributeConstants.DOCUMENT_TYPE_NAME, wd.getDocumentTypeName()); if (wd.isInitiated() || wd.isSaved()) { attributes.put(KimConstants.AttributeConstants.ROUTE_NODE_NAME, PRE_ROUTING_ROUTE_NAME); } else { attributes.put(KimConstants.AttributeConstants.ROUTE_NODE_NAME, KRADServiceLocatorWeb.getWorkflowDocumentService().getCurrentRouteNodeNames(wd)); } attributes.put(KimConstants.AttributeConstants.ROUTE_STATUS_CODE, wd.getStatus().getCode()); }
/** * Gets the lookupService attribute. * * @return Returns the lookupService. */ protected LookupService getLookupService() { return lookupService != null ? lookupService : KRADServiceLocatorWeb.getLookupService(); }