本文整理汇总了Java中org.alfresco.service.cmr.action.ParameterizedItem类的典型用法代码示例。如果您正苦于以下问题:Java ParameterizedItem类的具体用法?Java ParameterizedItem怎么用?Java ParameterizedItem使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ParameterizedItem类属于org.alfresco.service.cmr.action包,在下文中一共展示了ParameterizedItem类的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: checkMandatoryProperties
import org.alfresco.service.cmr.action.ParameterizedItem; //导入依赖的package包/类
/**
* Checked whether all the mandatory parameters for the rule item have been assigned.
*
* @param ruleItem the rule item
* @param ruleItemDefinition the rule item definition
*/
protected void checkMandatoryProperties(ParameterizedItem ruleItem, ParameterizedItemDefinition ruleItemDefinition)
{
List<ParameterDefinition> definitions = ruleItemDefinition.getParameterDefinitions();
if (definitions!= null && definitions.size()>0)
{
for (ParameterDefinition definition : definitions)
{
if (definition.isMandatory() == true)
{
// Check that a value has been set for the mandatory parameter
if (ruleItem.getParameterValue(definition.getName()) == null)
{
// Error since a mandatory parameter has a null value
throw new RuleServiceException(
MessageFormat.format(ERR_MAND_PROP, new Object[]{definition.getName(), ruleItemDefinition.getName()}));
}
}
}
}
}
示例2: checkMandatoryProperties
import org.alfresco.service.cmr.action.ParameterizedItem; //导入依赖的package包/类
/**
* Checked whether all the mandatory parameters for the rule item have been assigned.
*
* @param ruleItem the rule item
* @param ruleItemDefinition the rule item definition
*/
protected void checkMandatoryProperties(ParameterizedItem ruleItem, ParameterizedItemDefinition ruleItemDefinition)
{
List<ParameterDefinition> definitions = ruleItemDefinition.getParameterDefinitions();
if (definitions!= null && definitions.size()>0)
{
for (ParameterDefinition definition : definitions)
{
if (definition.isMandatory() == true)
{
// Check that a value has been set for the mandatory parameter
if (ruleItem.getParameterValue(definition.getName()) == null)
{
// Error since a mandatory parameter has a null value
throw new RuleServiceException(
MessageFormat.format(ERR_MAND_PROP, new Object[]{definition.getName(), ruleItemDefinition.getName()}));
}
}
}
}
}
示例3: process
import org.alfresco.service.cmr.action.ParameterizedItem; //导入依赖的package包/类
/**
*
* @param ruleItem
* @param ruleItemDefinition
* @param actionedUponNodeRef
*/
public void process(ParameterizedItem ruleItem, ParameterizedItemDefinition ruleItemDefinition, NodeRef actionedUponNodeRef)
{
for (Map.Entry<String, Serializable> entry : ruleItem.getParameterValues().entrySet())
{
String parameterName = entry.getKey();
Object parameterValue = entry.getValue();
// only sub string property values
if (parameterValue instanceof String)
{
// set the updated parameter value
ruleItem.setParameterValue(parameterName, process((String)parameterValue, actionedUponNodeRef));
}
}
}
示例4: saveParameters
import org.alfresco.service.cmr.action.ParameterizedItem; //导入依赖的package包/类
/**
* Saves the parameters associated with an action or condition
*
* @param parameterizedNodeRef the parameterized item node reference
* @param item the parameterized item
*/
private void saveParameters(NodeRef parameterizedNodeRef, ParameterizedItem item)
{
Map<String, Serializable> parameterMap = new HashMap<String, Serializable>();
parameterMap.putAll(item.getParameterValues());
List<ChildAssociationRef> parameters = this.nodeService.getChildAssocs(parameterizedNodeRef,
ActionModel.ASSOC_PARAMETERS, ActionModel.ASSOC_PARAMETERS);
for (ChildAssociationRef ref : parameters)
{
NodeRef paramNodeRef = ref.getChildRef();
Map<QName, Serializable> nodeRefParameterMap = this.nodeService.getProperties(paramNodeRef);
String paramName = (String) nodeRefParameterMap.get(ActionModel.PROP_PARAMETER_NAME);
if (parameterMap.containsKey(paramName) == false)
{
// Delete parameter from node ref
this.nodeService.removeChild(parameterizedNodeRef, paramNodeRef);
}
else
{
// Update the parameter value
nodeRefParameterMap.put(ActionModel.PROP_PARAMETER_VALUE, parameterMap.get(paramName));
this.nodeService.setProperties(paramNodeRef, nodeRefParameterMap);
parameterMap.remove(paramName);
}
}
// Add any remaining parameters
for (Map.Entry<String, Serializable> entry : parameterMap.entrySet())
{
Map<QName, Serializable> nodeRefProperties = new HashMap<QName, Serializable>(2);
nodeRefProperties.put(ActionModel.PROP_PARAMETER_NAME, entry.getKey());
nodeRefProperties.put(ActionModel.PROP_PARAMETER_VALUE, entry.getValue());
this.nodeService.createNode(parameterizedNodeRef, ActionModel.ASSOC_PARAMETERS,
ActionModel.ASSOC_PARAMETERS, ActionModel.TYPE_ACTION_PARAMETER, nodeRefProperties);
}
}
示例5: populateParameters
import org.alfresco.service.cmr.action.ParameterizedItem; //导入依赖的package包/类
/**
* Populate the parameters of a parameterized item from the parameterized
* item node reference
*
* @param parameterizedItemNodeRef the parameterized item node reference
* @param parameterizedItem the parameterized item
*/
private void populateParameters(NodeRef parameterizedItemNodeRef, ParameterizedItem parameterizedItem)
{
List<ChildAssociationRef> parameters = this.nodeService.getChildAssocs(parameterizedItemNodeRef,
RegexQNamePattern.MATCH_ALL, ActionModel.ASSOC_PARAMETERS);
for (ChildAssociationRef parameter : parameters)
{
NodeRef parameterNodeRef = parameter.getChildRef();
Map<QName, Serializable> properties = this.nodeService.getProperties(parameterNodeRef);
parameterizedItem.setParameterValue((String) properties.get(ActionModel.PROP_PARAMETER_NAME), properties
.get(ActionModel.PROP_PARAMETER_VALUE));
}
}
示例6: checkMandatoryProperties
import org.alfresco.service.cmr.action.ParameterizedItem; //导入依赖的package包/类
@Override
protected void checkMandatoryProperties(ParameterizedItem ruleItem, ParameterizedItemDefinition ruleItemDefinition)
{
super.checkMandatoryProperties(ruleItem, ruleItemDefinition);
String publishChannelName = (String) ruleItem.getParameterValue(PARAM_PUBLISH_CHANNEL_NAME);
String publishChannelId = (String) ruleItem.getParameterValue(PARAM_PUBLISH_CHANNEL_ID);
if (publishChannelId == null && publishChannelName == null)
{
throw new RuleServiceException(MSG_NEITHER_CHANNEL_NAME_NOR_ID_SPECIFIED);
}
}