本文整理汇总了Java中org.alfresco.service.cmr.action.ParameterDefinition.getType方法的典型用法代码示例。如果您正苦于以下问题:Java ParameterDefinition.getType方法的具体用法?Java ParameterDefinition.getType怎么用?Java ParameterDefinition.getType使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.alfresco.service.cmr.action.ParameterDefinition
的用法示例。
在下文中一共展示了ParameterDefinition.getType方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: extractActionParams
import org.alfresco.service.cmr.action.ParameterDefinition; //导入方法依赖的package包/类
private Map<String, Serializable> extractActionParams(org.alfresco.service.cmr.action.ActionDefinition actionDefinition, Map<String, String> params)
{
Map<String, Serializable> parameterValues = new HashMap<>();
try
{
for (Map.Entry<String, String> entry : params.entrySet())
{
String propertyName = entry.getKey();
Object propertyValue = entry.getValue();
// Get the parameter definition we care about
ParameterDefinition paramDef = actionDefinition.getParameterDefintion(propertyName);
if (paramDef == null && !actionDefinition.getAdhocPropertiesAllowed())
{
throw new AlfrescoRuntimeException("Invalid parameter " + propertyName + " for action/condition " + actionDefinition.getName());
}
if (paramDef != null)
{
QName typeQName = paramDef.getType();
// Convert the property value
Serializable value = convertValue(typeQName, propertyValue);
parameterValues.put(propertyName, value);
}
else
{
// If there is no parameter definition we can only rely on the .toString()
// representation of the ad-hoc property
parameterValues.put(propertyName, propertyValue.toString());
}
}
}
catch (JSONException je)
{
throw new WebScriptException(Status.STATUS_BAD_REQUEST, "Could not parse JSON from req.", je);
}
return parameterValues;
}
示例2: ActionParameterField
import org.alfresco.service.cmr.action.ParameterDefinition; //导入方法依赖的package包/类
public ActionParameterField(ParameterDefinition parameterDef, ActionService actionService)
{
//TODO i18n
this.name = parameterDef.getName();
QName type = parameterDef.getType();
final List<FieldConstraint> fieldConstraints = processActionConstraints(parameterDef, actionService);
if (DataTypeDefinition.NODE_REF.equals(type) && fieldConstraints.isEmpty())
{
// Parameters of type NodeRef need to be AssociationPickers so that a NodeRef can be selected in the form
// using the association picker for navigation.
// However this is only true for NodeRef parameters without constraints.
// NodeRef parameters which are constrained (to a list of particular NodeRefs) will
// be handled below.
this.fieldDef = new AssociationFieldDefinition(this.name, "cm:cmobject", AssociationFieldDefinition.Direction.TARGET);
AssociationFieldDefinition assocFieldDef = (AssociationFieldDefinition) this.fieldDef;
assocFieldDef.setEndpointMandatory(parameterDef.isMandatory());
assocFieldDef.setEndpointMany(parameterDef.isMultiValued());
}
else
{
if (DataTypeDefinition.NODE_REF.equals(type))
{
// constrained NodeRef parameter (assumed list of particular NodeRefs)
this.fieldDef = new PropertyFieldDefinition(this.name, DataTypeDefinition.TEXT.getLocalName());
}
else
{
this.fieldDef = new PropertyFieldDefinition(this.name, type.getLocalName());
}
PropertyFieldDefinition propFieldDef = (PropertyFieldDefinition)this.fieldDef;
propFieldDef.setMandatory(parameterDef.isMandatory());
propFieldDef.setRepeating(parameterDef.isMultiValued());
if (!fieldConstraints.isEmpty())
{
propFieldDef.setConstraints(fieldConstraints);
}
}
// Properties common to PropertyFieldDefinitions and AssociationFieldDefinitions.
this.fieldDef.setDescription(parameterDef.getName());
this.fieldDef.setLabel(parameterDef.getDisplayLabel());
this.fieldDef.setDataKeyName(this.name);
}
示例3: parseJsonParameterValues
import org.alfresco.service.cmr.action.ParameterDefinition; //导入方法依赖的package包/类
protected Map<String, Serializable> parseJsonParameterValues(JSONObject jsonParameterValues, String name, boolean isAction) throws JSONException
{
Map<String, Serializable> parameterValues = new HashMap<String, Serializable>();
// get parameters names
JSONArray names = jsonParameterValues.names();
if (names == null)
{
return null;
}
// Get the action or condition definition
ParameterizedItemDefinition definition = null;
if (isAction == true)
{
definition = actionService.getActionDefinition(name);
}
else
{
definition = actionService.getActionConditionDefinition(name);
}
if (definition == null)
{
throw new AlfrescoRuntimeException("Could not find defintion for action/condition " + name);
}
for (int i = 0; i < names.length(); i++)
{
String propertyName = names.getString(i);
Object propertyValue = jsonParameterValues.get(propertyName);
// Get the parameter definition we care about
ParameterDefinition paramDef = definition.getParameterDefintion(propertyName);
if (paramDef == null && !definition.getAdhocPropertiesAllowed())
{
throw new AlfrescoRuntimeException("Invalid parameter " + propertyName + " for action/condition " + name);
}
if (paramDef != null)
{
QName typeQName = paramDef.getType();
// Convert the property value
Serializable value = convertValue(typeQName, propertyValue);
parameterValues.put(propertyName, value);
}
else
{
// If there is no parameter definition we can only rely on the .toString() representation of the ad-hoc property
parameterValues.put(propertyName, propertyValue.toString());
}
}
return parameterValues;
}