當前位置: 首頁>>代碼示例>>Java>>正文


Java DataDefinition類代碼示例

本文整理匯總了Java中org.kuali.rice.core.api.reflect.DataDefinition的典型用法代碼示例。如果您正苦於以下問題:Java DataDefinition類的具體用法?Java DataDefinition怎麽用?Java DataDefinition使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


DataDefinition類屬於org.kuali.rice.core.api.reflect包,在下文中一共展示了DataDefinition類的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: getValidActions

import org.kuali.rice.core.api.reflect.DataDefinition; //導入依賴的package包/類
public org.kuali.rice.kew.api.action.ValidActions getValidActions(PrincipalContract principal, DocumentRouteHeaderValue document) {
	try {
		org.kuali.rice.kew.api.action.ValidActions.Builder builder = org.kuali.rice.kew.api.action.ValidActions.Builder.create();
		List<ActionRequestValue> activeRequests = new ArrayList<ActionRequestValue>();
        // this looks like ActionRequestServiceImpl.findAllPendingRequests
		for ( ActionRequestValue ar : document.getActionRequests() ) {
			if ( (ar.getCurrentIndicator() != null && ar.getCurrentIndicator()) && StringUtils.equals( ar.getStatus(), ActionRequestStatus.ACTIVATED.getCode() ) ) {
				activeRequests.add(ar);
			}
		}
		for (String actionTakenCode : actionMap.keySet())
		{
			List<DataDefinition> parameters = new ArrayList<DataDefinition>();
			parameters.add(new DataDefinition(document));
			parameters.add(new DataDefinition(principal));
			ActionTakenEvent actionEvent = createAction(actionTakenCode, parameters);
			if (StringUtils.isEmpty(actionEvent.validateActionRules(activeRequests)))
			{
				builder.addValidAction(ActionType.fromCode(actionTakenCode));
			}
		}
		return builder.build();
	} catch (ResourceUnavailableException e) {
		throw new WorkflowRuntimeException(e);
	}
}
 
開發者ID:kuali,項目名稱:kc-rice,代碼行數:27,代碼來源:ActionRegistryImpl.java

示例2: createAction

import org.kuali.rice.core.api.reflect.DataDefinition; //導入依賴的package包/類
public ActionTakenEvent createAction(String actionCode, List<DataDefinition> parameters) throws ResourceUnavailableException {
	String actionClassName = actionMap.get(actionCode);
	if (actionClassName == null) {
		throw new IllegalArgumentException("No action has been registered for the given action code of '" + actionCode + "'.");
	}
	ObjectDefinition actionDefinition = new ObjectDefinition(actionClassName);
	if (parameters != null && !parameters.isEmpty()) {
		actionDefinition.setConstructorParameters(parameters);
	}
	try {
		//ActionTakenEvent actionTaken = (ActionTakenEvent)GlobalResourceLoader.getResourceLoader().getObject(actionDefinition);
		// TODO ActionTakenEvent is not an interface so we can't fetch them through the GlobalResourceLoader, for now, just use
		// the ObjectDefinitionResolver
		ActionTakenEvent actionTaken = (ActionTakenEvent) ObjectDefinitionResolver.createObject(actionDefinition, ClassLoaderUtils.getDefaultClassLoader(), false);
		if (actionTaken == null) {
			// TODO the exception handling here is a bit wonky
			throw new ResourceUnavailableException("Could not locate action taken class '" + actionClassName + "'");
		}
		return actionTaken;
	} catch (Exception e) {
           LOG.debug("createAction() Exception thrown while working with action class name '" + actionClassName + "'");
		if (e instanceof ResourceUnavailableException) {
			throw (ResourceUnavailableException)e;
		}
		throw new ResourceUnavailableException(e);
	}
}
 
開發者ID:kuali,項目名稱:kc-rice,代碼行數:28,代碼來源:ActionRegistryImpl.java

示例3: isValidAction

import org.kuali.rice.core.api.reflect.DataDefinition; //導入依賴的package包/類
@Override
public boolean isValidAction(String actionTypeCode, PrincipalContract principal,
        DocumentRouteHeaderValue document) {
    boolean validAction = false;
    try {
        List<ActionRequestValue> activeRequests = new ArrayList<ActionRequestValue>();
        for (ActionRequestValue ar : document.getActionRequests()) {
            if ((ar.getCurrentIndicator() != null && ar.getCurrentIndicator()) && StringUtils.equals(ar.getStatus(),
                    ActionRequestStatus.ACTIVATED.getCode())) {
                activeRequests.add(ar);
            }
        }

        List<DataDefinition> parameters = new ArrayList<DataDefinition>();
        parameters.add(new DataDefinition(document));
        parameters.add(new DataDefinition(principal));

        ActionTakenEvent actionEvent = createAction(actionTypeCode, parameters);
        if (StringUtils.isEmpty(actionEvent.validateActionRules(activeRequests))) {
            validAction = true;
        }
    } catch (ResourceUnavailableException e) {
        throw new WorkflowRuntimeException(e);
    }

    return validAction;
}
 
開發者ID:kuali,項目名稱:kc-rice,代碼行數:28,代碼來源:ActionRegistryImpl.java

示例4: buildConstructorParamTypes

import org.kuali.rice.core.api.reflect.DataDefinition; //導入依賴的package包/類
protected static Class<?>[] buildConstructorParamTypes(List<DataDefinition> constructorParameters) {
	Class<?>[] params = new Class[constructorParameters.size()];
	int index = 0;
	for (Iterator iterator = constructorParameters.iterator(); iterator.hasNext();) {
		DataDefinition dataDef = (DataDefinition) iterator.next();
		params[index++] = dataDef.getType();
	}
	return params;
}
 
開發者ID:kuali,項目名稱:kc-rice,代碼行數:10,代碼來源:ObjectDefinitionResolver.java

示例5: buildConstructorParams

import org.kuali.rice.core.api.reflect.DataDefinition; //導入依賴的package包/類
protected static Object[] buildConstructorParams(List<DataDefinition> constructorParameters) {
	Object[] params = new Object[constructorParameters.size()];
	int index = 0;
	for (Iterator iterator = constructorParameters.iterator(); iterator.hasNext();) {
		DataDefinition dataDef = (DataDefinition) iterator.next();
		params[index++] = dataDef.getValue();
	}
	return params;
}
 
開發者ID:kuali,項目名稱:kc-rice,代碼行數:10,代碼來源:ObjectDefinitionResolver.java

示例6: convertWorkflowAttributeDefinition

import org.kuali.rice.core.api.reflect.DataDefinition; //導入依賴的package包/類
/**
 * New for Rice 2.0
 */
public static AttributeDefinition convertWorkflowAttributeDefinition(WorkflowAttributeDefinition definition) {
    if (definition == null) {
        return null;
    }
    //KULRICE-7643
    ExtensionDefinition extensionDefinition = null;
    List<RuleAttribute> ruleAttribute = KEWServiceLocator.getRuleAttributeService().findByClassName(definition.getAttributeName());
    if (ruleAttribute == null || ruleAttribute.isEmpty()) {
        extensionDefinition = KewApiServiceLocator.getExtensionRepositoryService().getExtensionByName(definition.getAttributeName());
    }else{
        //TODO: Should we do something more intelligent here? Rice 1.x returned only a single entry but we can now have a list
        RuleAttribute tmpAttr = ruleAttribute.get(0);
        extensionDefinition = RuleAttribute.to(tmpAttr);
        if(ruleAttribute.size() > 1){
            LOG.warn("AttributeDefinition lookup (findByClassName) returned multiple attribute for the same class name. This should not happen, investigation recommended for classname: " 
        + definition.getAttributeName() + " which has " + ruleAttribute.size() + " entries.");
        }
    }
    
    if (extensionDefinition == null) {
        throw new WorkflowRuntimeException("Extension " + definition.getAttributeName() + " not found");
    }
    /*RuleAttribute ruleAttribute = KEWServiceLocator.getRuleAttributeService().findByName(definition.getAttributeName());
    if (ruleAttribute == null) {
        throw new WorkflowRuntimeException("Attribute " + definition.getAttributeName() + " not found");
    }*/

    ObjectDefinition objectDefinition = new ObjectDefinition(extensionDefinition.getResourceDescriptor());
    if (definition.getParameters() != null) {
        for (String parameter : definition.getParameters()) {
            objectDefinition.addConstructorParameter(new DataDefinition(parameter, String.class));
        }
    }
    boolean propertiesAsMap = KewApiConstants.RULE_XML_ATTRIBUTE_TYPE.equals(extensionDefinition.getType()) || KewApiConstants
            .SEARCHABLE_XML_ATTRIBUTE_TYPE.equals(extensionDefinition.getType());
    if (!propertiesAsMap && definition.getPropertyDefinitions() != null) {
        for (org.kuali.rice.kew.api.document.PropertyDefinition propertyDefinition : definition
                .getPropertyDefinitions()) {
            objectDefinition.addProperty(new PropertyDefinition(propertyDefinition.getName(), new DataDefinition(
                    propertyDefinition.getValue(), String.class)));
        }
    }

    return new AttributeDefinition(extensionDefinition, objectDefinition);
}
 
開發者ID:kuali,項目名稱:kc-rice,代碼行數:49,代碼來源:DTOConverter.java

示例7: createAction

import org.kuali.rice.core.api.reflect.DataDefinition; //導入依賴的package包/類
/**
 * Constructs and returns the ActionTakenEvent implementation which can be used to invoke the
 * Action with the given parameters.

 * @throws org.kuali.rice.kew.api.exception.ResourceUnavailableException if the action class cannot be constructed
 * @throws IllegalArgumentException if the given actionCode has not been registered
 */
public ActionTakenEvent createAction(String actionCode, List<DataDefinition> parameters) throws ResourceUnavailableException;
 
開發者ID:kuali,項目名稱:kc-rice,代碼行數:9,代碼來源:ActionRegistry.java


注:本文中的org.kuali.rice.core.api.reflect.DataDefinition類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。