本文整理汇总了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);
}
}
示例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);
}
}
示例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;
}
示例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;
}
示例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;
}
示例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);
}
示例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;