本文整理汇总了Java中org.kuali.rice.kew.util.PerformanceLogger类的典型用法代码示例。如果您正苦于以下问题:Java PerformanceLogger类的具体用法?Java PerformanceLogger怎么用?Java PerformanceLogger使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
PerformanceLogger类属于org.kuali.rice.kew.util包,在下文中一共展示了PerformanceLogger类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: activateRequests
import org.kuali.rice.kew.util.PerformanceLogger; //导入依赖的package包/类
/**
* Activates the action requests that are pending at this routelevel of the
* document. The requests are processed by priority and then request ID. It
* is implicit in the access that the requests are activated according to
* the route level above all.
* <p>
* FYI and acknowledgment requests do not cause the processing to stop. Only
* action requests for approval or completion cause the processing to stop
* and then only for route level with a serialized activation policy. Only
* requests at the current document's current route level are activated.
* Inactive requests at a lower level cause a routing exception.
* <p>
* Exception routing and adhoc routing are processed slightly differently.
*
* @return True if the any approval actions were activated.
* @throws org.kuali.rice.kew.api.exception.ResourceUnavailableException
* @throws WorkflowException
*/
public boolean activateRequests(RouteContext context, DocumentRouteHeaderValue document,
RouteNodeInstance nodeInstance) throws WorkflowException {
MDC.put("docId", document.getDocumentId());
PerformanceLogger performanceLogger = new PerformanceLogger(document.getDocumentId());
List<ActionItem> generatedActionItems = new ArrayList<ActionItem>();
List<ActionRequestValue> requests = new ArrayList<ActionRequestValue>();
if (context.isSimulation()) {
for (ActionRequestValue ar : context.getDocument().getActionRequests()) {
// TODO logic check below duplicates behavior of the ActionRequestService.findPendingRootRequestsByDocIdAtRouteNode(documentId, routeNodeInstanceId) method
if (ar.getCurrentIndicator()
&& (ActionRequestStatus.INITIALIZED.getCode().equals(ar.getStatus())
|| ActionRequestStatus.ACTIVATED.getCode().equals(ar.getStatus()))
&& ar.getNodeInstance().getRouteNodeInstanceId().equals(nodeInstance.getRouteNodeInstanceId())
&& ar.getParentActionRequest() == null) {
requests.add(ar);
}
}
requests.addAll(context.getEngineState().getGeneratedRequests());
} else {
requests = KEWServiceLocator.getActionRequestService().findPendingRootRequestsByDocIdAtRouteNode(
document.getDocumentId(), nodeInstance.getRouteNodeInstanceId());
}
if (LOG.isDebugEnabled()) {
LOG.debug("Pending Root Requests " + requests.size());
}
boolean activatedApproveRequest = activateRequestsCustom(context, requests, generatedActionItems, document,
nodeInstance);
// now let's send notifications, since this code needs to be able to activate each request individually, we need
// to collection all action items and then notify after all have been generated
notify(context, generatedActionItems, nodeInstance);
performanceLogger.log("Time to activate requests.");
return activatedApproveRequest;
}
示例2: findOldDelegationRules
import org.kuali.rice.kew.util.PerformanceLogger; //导入依赖的package包/类
/**
* This method will find any old delegation rules on the previous version of the parent rule which are not on the
* new version of the rule so that they can be marked non-current.
*/
@SuppressWarnings("unchecked")
private List<RuleBaseValues> findOldDelegationRules(RuleBaseValues oldRule, RuleBaseValues newRule, PerformanceLogger performanceLogger) {
performanceLogger.log("Begin to get delegation rules.");
List<RuleBaseValues> oldDelegations = getRuleDAO().findOldDelegations(oldRule, newRule);
performanceLogger.log("Located "+oldDelegations.size()+" old delegation rules.");
return oldDelegations;
}
示例3: fetchAllCurrentRulesForTemplateDocCombination
import org.kuali.rice.kew.util.PerformanceLogger; //导入依赖的package包/类
@Override
public List fetchAllCurrentRulesForTemplateDocCombination(String ruleTemplateName, String documentType, Timestamp effectiveDate){
String ruleTemplateId = getRuleTemplateService().findByRuleTemplateName(ruleTemplateName).getId();
PerformanceLogger performanceLogger = new PerformanceLogger();
performanceLogger.log("Time to fetchRules by template " + ruleTemplateName + " not caching.");
return getRuleDAO().fetchAllCurrentRulesForTemplateDocCombination(ruleTemplateId, getDocGroupAndTypeList(documentType), effectiveDate);
}
示例4: populateDocumentAttributesValues
import org.kuali.rice.kew.util.PerformanceLogger; //导入依赖的package包/类
/**
* This method performs searches against the search attribute value tables (see classes implementing
* {@link org.kuali.rice.kew.docsearch.SearchableAttributeValue}) to get data to fill in search attribute values on the given resultBuilder parameter
*
* @param resultBuilder - document search result object getting search attributes added to it
* @param searchAttributeStatement - statement being used to call the database for queries
* @throws SQLException
*/
public void populateDocumentAttributesValues(DocumentSearchResult.Builder resultBuilder, Statement searchAttributeStatement) throws SQLException {
searchAttributeStatement.setFetchSize(50);
String documentId = resultBuilder.getDocument().getDocumentId();
List<SearchableAttributeValue> attributeValues = DocumentSearchInternalUtils
.getSearchableAttributeValueObjectTypes();
PerformanceLogger perfLog = new PerformanceLogger(documentId);
for (SearchableAttributeValue searchAttValue : attributeValues) {
String attributeSql = "select KEY_CD, VAL from " + searchAttValue.getAttributeTableName() + " where DOC_HDR_ID = '" + documentId + "'";
ResultSet attributeResultSet = null;
try {
attributeResultSet = searchAttributeStatement.executeQuery(attributeSql);
while (attributeResultSet.next()) {
searchAttValue.setSearchableAttributeKey(attributeResultSet.getString("KEY_CD"));
searchAttValue.setupAttributeValue(attributeResultSet, "VAL");
if ( (!org.apache.commons.lang.StringUtils.isEmpty(searchAttValue.getSearchableAttributeKey())) && (searchAttValue.getSearchableAttributeValue() != null) ) {
DocumentAttribute documentAttribute = searchAttValue.toDocumentAttribute();
resultBuilder.getDocumentAttributes().add(DocumentAttributeFactory.loadContractIntoBuilder(
documentAttribute));
}
}
} finally {
if (attributeResultSet != null) {
try {
attributeResultSet.close();
} catch (Exception e) {
LOG.warn("Could not close searchable attribute result set for class " + searchAttValue.getClass().getName(),e);
}
}
}
}
perfLog.log("Time to execute doc search search attribute queries.", true);
}
示例5: activateRequests
import org.kuali.rice.kew.util.PerformanceLogger; //导入依赖的package包/类
/**
* Activates the action requests that are pending at this routelevel of the document. The requests are processed by
* priority and then request ID. It is implicit in the access that the requests are activated according to the route
* level above all.
*
* <p>FYI and acknowledement requests do not cause the processing to stop. Only action requests for approval or
* completion cause the processing to stop and then only for route level with a serialized or priority-parallel
* activation policy. Only requests at the current document's current route level are activated. Inactive requests
* at a lower level cause a routing exception.</p>
*
* <p>Exception routing and adhoc routing are processed slightly differently.</p>
*
* @return true if the any approval actions were activated.
*/
public boolean activateRequests(RouteContext context, DocumentRouteHeaderValue document, RouteNodeInstance nodeInstance) throws WorkflowException {
MDC.put("docId", document.getDocumentId());
PerformanceLogger performanceLogger = new PerformanceLogger(document.getDocumentId());
List<ActionItem> generatedActionItems = new ArrayList<ActionItem>();
List<ActionRequestValue> requests = new ArrayList<ActionRequestValue>();
if (context.isSimulation()) {
for (ActionRequestValue ar : context.getDocument().getActionRequests()) {
// logic check below duplicates behavior of the ActionRequestService.findPendingRootRequestsByDocIdAtRouteNode(documentId, routeNodeInstanceId) method
if (ar.getCurrentIndicator()
&& (ActionRequestStatus.INITIALIZED.getCode().equals(ar.getStatus()) || ActionRequestStatus.ACTIVATED.getCode().equals(ar.getStatus()))
&& ar.getNodeInstance().getRouteNodeInstanceId().equals(nodeInstance.getRouteNodeInstanceId())
&& ar.getParentActionRequest() == null) {
requests.add(ar);
}
}
requests.addAll(context.getEngineState().getGeneratedRequests());
} else {
requests = KEWServiceLocator.getActionRequestService().findPendingRootRequestsByDocIdAtRouteNode(document.getDocumentId(), nodeInstance.getRouteNodeInstanceId());
}
if ( LOG.isDebugEnabled() ) {
LOG.debug("Pending Root Requests " + requests.size());
}
boolean activatedApproveRequest = activateRequestsCustom( context, requests, generatedActionItems, document, nodeInstance );
// now let's send notifications, since this code needs to be able to activate each request individually, we need
// to collection all action items and then notify after all have been generated
notify(context, generatedActionItems, nodeInstance);
performanceLogger.log("Time to activate requests.");
return activatedApproveRequest;
}
示例6: findOldDelegationRules
import org.kuali.rice.kew.util.PerformanceLogger; //导入依赖的package包/类
/**
* This method will find any old delegation rules on the previous version of the parent rule which are not on the
* new version of the rule so that they can be marked non-current.
*/
private List<RuleBaseValues> findOldDelegationRules(RuleBaseValues oldRule, RuleBaseValues newRule, PerformanceLogger performanceLogger) {
performanceLogger.log("Begin to get delegation rules.");
List<RuleBaseValues> oldDelegations = getRuleDAO().findOldDelegations(oldRule, newRule);
performanceLogger.log("Located "+oldDelegations.size()+" old delegation rules.");
return oldDelegations;
}
示例7: activateRequests
import org.kuali.rice.kew.util.PerformanceLogger; //导入依赖的package包/类
/**
* Activates the action requests that are pending at this routelevel of the document. The requests are processed by priority and then request ID.
* It is implicit in the access that the requests are activated according to the route level above all.
* <p>
* FYI and acknowledgement requests do not cause the processing to stop. Only action requests for approval or completion cause the processing to
* stop and then only for route level with a serialized activation policy. Only requests at the current document's current route level are activated.
* Inactive requests at a lower level cause a routing exception.
* <p>
* Exception routing and adhoc routing are processed slightly differently.
*
*
* @param context the RouteContext
* @param document the document we are processing
* @param nodeInstance the node instance we are processing
* @return True if the any blocking actions requests (approve or complete) were activated.
* @throws org.kuali.rice.kew.api.exception.ResourceUnavailableException
* @throws org.kuali.rice.kew.api.exception.WorkflowException
*/
private boolean activateRequests(RouteContext context, DocumentRouteHeaderValue document, RouteNodeInstance nodeInstance) throws WorkflowException {
MDC.put("docId", document.getDocumentId());
PerformanceLogger performanceLogger = new PerformanceLogger(document.getDocumentId());
List generatedActionItems = new ArrayList();
List<ActionRequestValue> requests = KEWServiceLocator.getActionRequestService().findPendingRootRequestsByDocIdAtRouteNode(document.getDocumentId(), nodeInstance.getRouteNodeInstanceId());
if (context.isSimulation()) {
requests.addAll(context.getEngineState().getGeneratedRequests());
}
// this will sort higher priority requests to the front
// blocking requests are higher priority, so all blocking requests will be
// activated before non-blocking requests
Collections.sort(requests, new Utilities.PrioritySorter());
LOG.info("Pending Root Requests " + requests.size());
String activationType = nodeInstance.getRouteNode().getActivationType();
boolean isParallel = KewApiConstants.ROUTE_LEVEL_PARALLEL.equals(activationType);
boolean activatedApproveRequest = false;
for (Iterator iter = requests.iterator(); iter.hasNext();) {
if (activatedApproveRequest && !isParallel) {
LOG.info("Already activated an apprve request and serial, so not activating any more");
break;
}
ActionRequestValue request = (ActionRequestValue) iter.next();
LOG.info("ActionRequestValue: " + request);
if (request.getParentActionRequest() != null || request.getNodeInstance() == null) {
// 1. disregard request if it's not a top-level request
// 2. disregard request if it's a "future" request and hasn't been attached to a node instance yet
continue;
}
if (request.isActive()) {
activatedApproveRequest = activatedApproveRequest || request.isApproveOrCompleteRequest();
continue;
}
logProcessingMessage(request);
LOG.info("Activating request. " + request);
activatedApproveRequest = activateRequest(context, request, nodeInstance, generatedActionItems) || activatedApproveRequest;
}
// now let's send notifications, since this code needs to be able to activate each request individually, we need
// to collection all action items and then notify after all have been generated
if (!context.isSimulation()) {
KEWServiceLocator.getNotificationService().notify(generatedActionItems);
}
performanceLogger.log("Time to activate requests.");
return activatedApproveRequest;
}
示例8: selectRules
import org.kuali.rice.kew.util.PerformanceLogger; //导入依赖的package包/类
public List<Rule> selectRules(RouteContext context, DocumentRouteHeaderValue routeHeader, RouteNodeInstance nodeInstance, String selectionCriterion, Timestamp effectiveDate) {
// for TemplateRuleSelector, the criterion is taken as a ruletemplate name
final String ruleTemplateName = selectionCriterion;
Set<MassRuleAttribute> massRules = new HashSet<MassRuleAttribute>();
RuleTemplate template = KewApiServiceLocator.getRuleService().getRuleTemplateByName(ruleTemplateName);
if (template == null) {
throw new WorkflowRuntimeException("Could not locate the rule template with name " + ruleTemplateName + " on document " + routeHeader.getDocumentId());
}
for (RuleTemplateAttribute templateAttribute : template.getActiveRuleTemplateAttributes()) {
String ruleAttributeName = templateAttribute.getRuleAttribute().getName();
if (!RuleAttribute.isWorkflowAttribute(templateAttribute.getRuleAttribute().getType())) {
continue;
}
ExtensionDefinition extensionDefinition = KewApiServiceLocator.getExtensionRepositoryService().getExtensionByName(ruleAttributeName);
Object attribute = ExtensionUtils.loadExtension(extensionDefinition);
if (attribute == null) {
throw new RiceIllegalArgumentException("Failed to load WorkflowRuleAttribute for: " + extensionDefinition);
}
if (!WorkflowRuleAttribute.class.isAssignableFrom(attribute.getClass())) {
throw new RiceIllegalArgumentException("Failed to locate a WorkflowRuleAttribute with the given name: " + ruleAttributeName);
}
if (attribute instanceof XmlConfiguredAttribute) {
((XmlConfiguredAttribute)attribute).setExtensionDefinition(extensionDefinition);
}
WorkflowRuleAttribute ruleAttribute = (WorkflowRuleAttribute)attribute;
if (ruleAttribute instanceof MassRuleAttribute) {
massRules.add((MassRuleAttribute) attribute);
}
}
List<org.kuali.rice.kew.api.rule.Rule> rules;
if (effectiveDate == null) {
rules = KewApiServiceLocator.getRuleService()
.getRulesByTemplateNameAndDocumentTypeName(ruleTemplateName,
routeHeader.getDocumentType().getName());
} else {
rules = KewApiServiceLocator.getRuleService()
.getRulesByTemplateNameAndDocumentTypeNameAndEffectiveDate(ruleTemplateName,
routeHeader.getDocumentType().getName(), new DateTime(effectiveDate.getTime()));
}
numberOfSelectedRules = rules.size();
// TODO really the route context just needs to be able to support nested create and clears
// (i.e. a Stack model similar to transaction intercepting in Spring) and we wouldn't have to do this
if (context.getDocument() == null) {
context.setDocument(routeHeader);
}
if (context.getNodeInstance() == null) {
context.setNodeInstance(nodeInstance);
}
DocumentContent documentContent = context.getDocumentContent();
PerformanceLogger performanceLogger = new PerformanceLogger();
// have all mass rule attributes filter the list of non applicable rules
for (MassRuleAttribute massRuleAttribute : massRules) {
rules = massRuleAttribute.filterNonMatchingRules(context, rules);
}
performanceLogger.log("Time to filter massRules for template " + template.getName());
List<Rule> ruleList = new ArrayList<Rule>(rules.size());
for (org.kuali.rice.kew.api.rule.Rule ruleDefinition: rules) {
ruleList.add(new RuleImpl(ruleDefinition));
}
return ruleList;
}
示例9: getActionRequests
import org.kuali.rice.kew.util.PerformanceLogger; //导入依赖的package包/类
/**
* Generates action requests
* @param routeHeader the document route header
* @param routeNodeDef the RouteNode definition of the route node instance
* @param nodeInstance the route node instance; this may be null!
* @param ruleTemplateName the rule template
* @return list of action requests
* @throws WorkflowException
*/
public List<ActionRequestValue> getActionRequests(DocumentRouteHeaderValue routeHeader, RouteNode routeNodeDef, RouteNodeInstance nodeInstance, String ruleTemplateName) {
RouteContext context = RouteContext.getCurrentRouteContext();
// TODO really the route context just needs to be able to support nested create and clears
// (i.e. a Stack model similar to transaction intercepting in Spring) and we wouldn't have to do this
if (context.getDocument() == null) {
context.setDocument(routeHeader);
}
if (context.getNodeInstance() == null) {
context.setNodeInstance(nodeInstance);
}
LOG.debug("Making action requests for document " + routeHeader.getDocumentId());
RuleSelector ruleSelector = loadRuleSelector(routeNodeDef, nodeInstance);
List<Rule> rules = ruleSelector.selectRules(context, routeHeader, nodeInstance, ruleTemplateName, effectiveDate);
// XXX: FIXME: this is a special case hack to expose info from the default selection implementation
// this is used in exactly one place, RoutingReportAction, to make a distinction between no rules being
// selected, and no rules actually matching when evaluated
// if (numberOfRules == 0) {
// errors.add(new WorkflowServiceErrorImpl("There are no rules.", "routereport.noRules"));
// } else {
// errors.add(new WorkflowServiceErrorImpl("There are rules, but no matches.", "routereport.noMatchingRules"));
// }
if (ruleSelector instanceof TemplateRuleSelector) {
selectedRules += ((TemplateRuleSelector) ruleSelector).getNumberOfSelectedRules();
}
PerformanceLogger performanceLogger = new PerformanceLogger();
ActionRequestFactory arFactory = new ActionRequestFactory(routeHeader, context.getNodeInstance());
List<ActionRequestValue> actionRequests = new ArrayList<ActionRequestValue>();
if (rules != null) {
LOG.info("Total number of rules selected by RuleSelector for documentType=" + routeHeader.getDocumentType().getName() + " and ruleTemplate=" + ruleTemplateName + ": " + rules.size());
for (Rule rule: rules) {
RuleExpressionResult result = rule.evaluate(rule, context);
if (result.isSuccess() && result.getResponsibilities() != null) {
// actionRequests.addAll(makeActionRequests(context, rule, routeHeader, null, null));
org.kuali.rice.kew.api.rule.Rule ruleDef = org.kuali.rice.kew.api.rule.Rule.Builder.create(rule.getDefinition()).build();
makeActionRequests(arFactory, result.getResponsibilities(), context, ruleDef, routeHeader, null, null);
}
}
}
actionRequests = new ArrayList<ActionRequestValue>(arFactory.getRequestGraphs());
performanceLogger.log("Time to make action request for template " + ruleTemplateName);
return actionRequests;
}
示例10: makeCurrent
import org.kuali.rice.kew.util.PerformanceLogger; //导入依赖的package包/类
protected void makeCurrent(RuleDelegationBo ruleDelegation, RuleBaseValues rule, boolean isRetroactiveUpdatePermitted) {
PerformanceLogger performanceLogger = new PerformanceLogger();
boolean isGenerateRuleArs = false;
if (isRetroactiveUpdatePermitted) {
isGenerateRuleArs = true;
String generateRuleArs = CoreFrameworkServiceLocator.getParameterService().getParameterValueAsString(KewApiConstants.KEW_NAMESPACE, KRADConstants.DetailTypes.RULE_DETAIL_TYPE, KewApiConstants.RULE_GENERATE_ACTION_REQESTS_IND);
if (!StringUtils.isBlank(generateRuleArs)) {
isGenerateRuleArs = KewApiConstants.YES_RULE_CHANGE_AR_GENERATION_VALUE.equalsIgnoreCase(generateRuleArs);
}
}
Set<String> responsibilityIds = new HashSet<String>();
performanceLogger.log("Preparing rule: " + rule.getDescription());
generateRuleNameIfNeeded(rule);
assignResponsibilityIds(rule);
rule.setCurrentInd(Boolean.TRUE);
Timestamp date = CoreApiServiceLocator.getDateTimeService().getCurrentTimestamp();
rule.setActivationDate(date);
rule.setDeactivationDate(null);
rule.setVersionNumber(null);
rule.setObjectId(null);
RuleBaseValues oldRule = null;
if (rule.getPreviousRuleId() != null) {
oldRule = findRuleBaseValuesById(rule.getPreviousRuleId());
}
if (oldRule != null) {
performanceLogger.log("Setting previous rule: " + oldRule.getId() + " to non current.");
oldRule.setCurrentInd(Boolean.FALSE);
oldRule.setDeactivationDate(date);
responsibilityIds.addAll(getModifiedResponsibilityIds(oldRule, rule));
rule.setVersionNbr(getNextVersionNumber(oldRule));
oldRule = getRuleDAO().save(oldRule);
rule.setPreviousVersion(oldRule);
performanceLogger.log("Saved old rule: " + oldRule.getId());
}
// }
for(RuleResponsibilityBo ruleResponsibilityBo : rule.getRuleResponsibilities()){
if(StringUtils.isBlank(ruleResponsibilityBo.getId())){
ruleResponsibilityBo.setVersionNumber(null);
}
ruleResponsibilityBo.setRuleBaseValues(rule);
}
// now save the new rule
rule = getRuleDAO().save(rule);
performanceLogger.log("Saved rule: " + rule.getId());
boolean isRuleDelegation = ruleDelegation != null;
if (isRuleDelegation) {
// update our reference to the delegation rule, because it could have changed
ruleDelegation.setDelegationRule(rule);
responsibilityIds.add(ruleDelegation.getResponsibilityId());
ruleDelegation.setDelegateRuleId(rule.getId());
getRuleDelegationService().save(ruleDelegation);
}
if (isGenerateRuleArs
&& org.apache.commons.collections.CollectionUtils.isNotEmpty(responsibilityIds)) {
getActionRequestService().updateActionRequestsForResponsibilityChange(responsibilityIds);
}
performanceLogger.log("Time to make current");
}
示例11: placeInExceptionRouting
import org.kuali.rice.kew.util.PerformanceLogger; //导入依赖的package包/类
protected DocumentRouteHeaderValue placeInExceptionRouting(String errorMessage, RouteNodeInstance nodeInstance, PersistedMessageBO persistedMessage, RouteContext routeContext, DocumentRouteHeaderValue document, boolean invokePostProcessor) throws Exception {
String documentId = document.getDocumentId();
MDC.put("docId", documentId);
PerformanceLogger performanceLogger = new PerformanceLogger(documentId);
try {
// mark all active requests to initialized and delete the action items
List<ActionRequestValue> actionRequests = KEWServiceLocator.getActionRequestService().findPendingByDoc(documentId);
for (ActionRequestValue actionRequest : actionRequests) {
if (actionRequest.isActive()) {
actionRequest.setStatus(ActionRequestStatus.INITIALIZED.getCode());
for (ActionItem actionItem : actionRequest.getActionItems()) {
KEWServiceLocator.getActionListService().deleteActionItem(actionItem);
}
KEWServiceLocator.getActionRequestService().saveActionRequest(actionRequest);
}
}
LOG.debug("Generating exception request for doc : " + documentId);
if (errorMessage == null) {
errorMessage = "";
}
if (errorMessage.length() > KewApiConstants.MAX_ANNOTATION_LENGTH) {
errorMessage = errorMessage.substring(0, KewApiConstants.MAX_ANNOTATION_LENGTH);
}
List<ActionRequestValue> exceptionRequests = new ArrayList<ActionRequestValue>();
if (nodeInstance.getRouteNode().isExceptionGroupDefined()) {
exceptionRequests = generateExceptionGroupRequests(routeContext);
} else {
exceptionRequests = generateKimExceptionRequests(routeContext);
}
if (exceptionRequests.isEmpty()) {
LOG.warn("Failed to generate exception requests for exception routing!");
}
document = activateExceptionRequests(routeContext, exceptionRequests, errorMessage, invokePostProcessor);
if (persistedMessage == null) {
LOG.warn("Attempting to delete null persisted message.");
} else {
KSBServiceLocator.getMessageQueueService().delete(persistedMessage);
}
} finally {
performanceLogger.log("Time to generate exception request.");
MDC.remove("docId");
}
return document;
}
示例12: refreshDocument
import org.kuali.rice.kew.util.PerformanceLogger; //导入依赖的package包/类
/**
* Requeues a document, and sets notification suppression data
*
* @see org.kuali.rice.kew.api.document.DocumentRefreshQueue#refreshDocument(java.lang.String)
*/
@Override
public void refreshDocument(String documentId) {
if (StringUtils.isBlank(documentId)) {
throw new RiceIllegalArgumentException("documentId is null or blank");
}
PerformanceLogger performanceLogger = new PerformanceLogger();
KEWServiceLocator.getRouteHeaderService().lockRouteHeader(documentId);
Collection<RouteNodeInstance> activeNodes = getRouteNodeService().getActiveNodeInstances(documentId);
List<ActionRequestValue> requestsToDelete = new ArrayList<ActionRequestValue>();
NotificationSuppression notificationSuppression = new NotificationSuppression();
for (RouteNodeInstance nodeInstance : activeNodes) {
// only "requeue" if we're dealing with a request activation node
if (helper.isRequestActivationNode(nodeInstance.getRouteNode())) {
List<ActionRequestValue> deletesForThisNode =
getActionRequestService().findPendingRootRequestsByDocIdAtRouteNode(documentId, nodeInstance.getRouteNodeInstanceId());
for (ActionRequestValue deleteForThisNode : deletesForThisNode) {
// check either the request or its first present child request to see if it is system generated
boolean containsRoleOrRuleRequests = deleteForThisNode.isRouteModuleRequest();
if (!containsRoleOrRuleRequests) {
if (CollectionUtils.isNotEmpty(deleteForThisNode.getChildrenRequests())) {
containsRoleOrRuleRequests = deleteForThisNode.getChildrenRequests().get(0).isRouteModuleRequest();
}
}
if (containsRoleOrRuleRequests) {
// remove all route or rule system generated requests
requestsToDelete.add(deleteForThisNode);
// suppress duplicate notifications
notificationSuppression.addNotificationSuppression(nodeInstance, deleteForThisNode);
}
}
// this will trigger a regeneration of requests
nodeInstance.setInitial(true);
getRouteNodeService().save(nodeInstance);
}
}
for (ActionRequestValue requestToDelete : requestsToDelete) {
getActionRequestService().deleteActionRequestGraphNoOutbox(requestToDelete);
}
try {
OrchestrationConfig config = new OrchestrationConfig(EngineCapability.STANDARD);
KEWServiceLocator.getWorkflowEngineFactory().newEngine(config).process(documentId, null);
} catch (Exception e) {
throw new WorkflowRuntimeException(e);
}
performanceLogger.log("Time to run DocumentRequeuer for document " + documentId);
}
示例13: processResultSet
import org.kuali.rice.kew.util.PerformanceLogger; //导入依赖的package包/类
@Override
public DocumentSearchResults.Builder processResultSet(DocumentSearchCriteria criteria, boolean criteriaModified, Statement searchAttributeStatement, ResultSet resultSet, int maxResultCap, int fetchLimit) throws SQLException {
DocumentSearchCriteria.Builder criteriaBuilder = DocumentSearchCriteria.Builder.create(criteria);
DocumentSearchResults.Builder results = DocumentSearchResults.Builder.create(criteriaBuilder);
results.setCriteriaModified(criteriaModified);
List<DocumentSearchResult.Builder> resultList = new ArrayList<DocumentSearchResult.Builder>();
results.setSearchResults(resultList);
Map<String, DocumentSearchResult.Builder> resultMap = new HashMap<String, DocumentSearchResult.Builder>();
int startAt = (criteria.getStartAtIndex()==null) ? 0 : criteria.getStartAtIndex();
int iteration = 0;
boolean resultSetHasNext = resultSet.next();
PerformanceLogger perfLog = new PerformanceLogger();
while (resultSetHasNext && resultMap.size() < maxResultCap && iteration < fetchLimit && startAt >= 0) {
if (iteration >= startAt) {
DocumentSearchResult.Builder resultBuilder = processRow(criteria, searchAttributeStatement, resultSet);
String documentId = resultBuilder.getDocument().getDocumentId();
if (!resultMap.containsKey(documentId)) {
resultList.add(resultBuilder);
resultMap.put(documentId, resultBuilder);
} else {
// handle duplicate rows with different search data
DocumentSearchResult.Builder previousEntry = resultMap.get(documentId);
handleMultipleDocumentRows(previousEntry, resultBuilder);
}
}
iteration++;
resultSetHasNext = resultSet.next();
}
perfLog.log("Time to read doc search results.", true);
// if we have threshold+1 results, then we have more results than we are going to display
results.setOverThreshold(resultSetHasNext);
LOG.debug("Processed " + resultMap.size() + " document search result rows.");
return results;
}
示例14: setup
import org.kuali.rice.kew.util.PerformanceLogger; //导入依赖的package包/类
/**
* Override of setup of AbstractAgendaBoTest (not setUp) to ensure correct test values
*/
@Override
@Before
public void setup() {
// Reset TestActionTypeService
TestActionTypeService.resetActionsFired();
termBoService = KrmsRepositoryServiceLocator.getTermBoService();
contextRepository = KrmsRepositoryServiceLocator.getContextBoService();
krmsTypeRepository = KrmsRepositoryServiceLocator.getKrmsTypeRepositoryService();
ruleBoService = KrmsRepositoryServiceLocator.getRuleBoService();
agendaBoService = KrmsRepositoryServiceLocator.getAgendaBoService();
actionBoService = KrmsRepositoryServiceLocator.getBean("actionBoService");
functionBoService = KrmsRepositoryServiceLocator.getBean("functionRepositoryService");
krmsAttributeDefinitionService = KrmsRepositoryServiceLocator.getKrmsAttributeDefinitionService();
ContextDefinition contextDefintion1 = contextRepository.getContextByNameAndNamespace(CONTEXT1, NAMESPACE1);
// only set this stuff up if we don't already have Context1 (we don't clear out KRMS tables between test methods)
// run at least once in case previous tests have used this context and to ensure correct values
if (contextDefintion1 == null || localInitNeeded) {
localInitNeeded = false;
PerformanceLogger perfLog = new PerformanceLogger();
perfLog.log("starting agenda creation");
contextDefintion1 = createContextDefinition(NAMESPACE1, CONTEXT1, Collections.singletonMap(CONTEXT1_QUALIFIER,
CONTEXT1_QUALIFIER_VALUE));
createAgendaDefinition(AGENDA1, contextDefintion1, TSUNAMI_EVENT, NAMESPACE1);
ContextDefinition contextDefinition2 = createContextDefinition(NAMESPACE2, CONTEXT2,
Collections.singletonMap(CONTEXT2_QUALIFIER, CONTEXT2_QUALIFIER_VALUE));
ContextDefinition contextDefinition3 = createContextDefinition(NAMESPACE1, CONTEXT3,
Collections.<String,String>emptyMap());
// Create multiple agendas so that we can test selection
createAgendaDefinition(AGENDA2, contextDefinition2, EARTHQUAKE_EVENT, NAMESPACE2);
createAgendaDefinition(AGENDA3, contextDefinition2, EARTHQUAKE_EVENT, NAMESPACE2);
createAgendaDefinition(AGENDA4, contextDefinition2, TSUNAMI_EVENT, NAMESPACE2);
createAgendaDefinition2(AGENDA5, contextDefinition3, NAMESPACE1);
perfLog.log("finished agenda creation", true);
}
}
示例15: testNullFact
import org.kuali.rice.kew.util.PerformanceLogger; //导入依赖的package包/类
@Transactional
@Test
public void testNullFact() {
Map<String,String> contextQualifiers = new HashMap<String,String>();
contextQualifiers.put(NAMESPACE_CODE, NAMESPACE1);
contextQualifiers.put(NAME, CONTEXT3);
Map<String,String> agendaQualifiers = new HashMap<String,String>();
agendaQualifiers.put(NAME, AGENDA5);
DateTime now = new DateTime();
SelectionCriteria sc1 = SelectionCriteria.createCriteria(now, contextQualifiers, agendaQualifiers);
Facts.Builder factsBuilder1 = Facts.Builder.create();
factsBuilder1.addFact(NULL_FACT, null);
ExecutionOptions xOptions1 = new ExecutionOptions();
xOptions1.setFlag(ExecutionFlag.LOG_EXECUTION, true);
PerformanceLogger perfLog = new PerformanceLogger();
perfLog.log("starting rule execution");
EngineResults eResults1 = KrmsApiServiceLocator.getEngine().execute(sc1, factsBuilder1.build(), xOptions1);
perfLog.log("finished rule execution", true);
List<ResultEvent> rEvents1 = executeEngineResults(eResults1);
List<ResultEvent> ruleEvaluationResults1 = eResults1.getResultsOfType(ResultEvent.RULE_EVALUATED.toString());
assertEquals("1 rules should have been evaluated", 1, ruleEvaluationResults1.size());
assertTrue("rule 0 should have evaluated to true", ruleEvaluationResults1.get(0).getResult());
// ONLY agenda 5 should have been selected
assertTrue(TestActionTypeService.actionFired("Agenda5::Rule5::TestAction"));
assertAgendaDidNotExecute(AGENDA1);
assertAgendaDidNotExecute(AGENDA2);
assertAgendaDidNotExecute(AGENDA3);
assertAgendaDidNotExecute(AGENDA4);
}