本文整理汇总了Java中org.alfresco.service.cmr.action.Action.getParameterValue方法的典型用法代码示例。如果您正苦于以下问题:Java Action.getParameterValue方法的具体用法?Java Action.getParameterValue怎么用?Java Action.getParameterValue使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.alfresco.service.cmr.action.Action
的用法示例。
在下文中一共展示了Action.getParameterValue方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: executeImpl
import org.alfresco.service.cmr.action.Action; //导入方法依赖的package包/类
/**
* Send an email message
*
* @throws AlfrescoRuntimeException
*/
@Override
protected void executeImpl(
final Action ruleAction,
final NodeRef actionedUponNodeRef)
{
NodeRef failingPersonNodeRef = (NodeRef)ruleAction.getParameterValue(PARAM_FAILING_PERSON_NODEREF);
NodeRef personNodeRef = (NodeRef)ruleAction.getParameterValue(PARAM_PERSON_NODEREF);
String userName = (String)ruleAction.getParameterValue(PARAM_USERNAME);
System.out.println("userName = " + userName);
if(personNodeRef.equals(failingPersonNodeRef))
{
numFailed.incrementAndGet();
throw new AlfrescoRuntimeException("");
}
numSuccessful.incrementAndGet();
}
示例2: checkParameterValues
import org.alfresco.service.cmr.action.Action; //导入方法依赖的package包/类
@Override
protected void checkParameterValues(Action action)
{
// Some numerical parameters should not be zero or negative.
checkNumericalParameterIsPositive(action, PARAM_RESIZE_WIDTH);
checkNumericalParameterIsPositive(action, PARAM_RESIZE_HEIGHT);
checkNumericalParameterIsPositive(action, CropSourceOptionsSerializer.PARAM_CROP_HEIGHT);
checkNumericalParameterIsPositive(action, CropSourceOptionsSerializer.PARAM_CROP_WIDTH);
// Target mime type should only be an image MIME type
String mimeTypeParam = (String)action.getParameterValue(PARAM_MIME_TYPE);
if (mimeTypeParam != null && !mimeTypeParam.startsWith("image"))
{
StringBuilder msg = new StringBuilder();
msg.append("Parameter ").append(PARAM_MIME_TYPE)
.append(" had illegal non-image MIME type: ").append(mimeTypeParam);
throw new IllegalArgumentException(msg.toString());
}
}
示例3: executeImpl
import org.alfresco.service.cmr.action.Action; //导入方法依赖的package包/类
@Override
protected void executeImpl(Action action, NodeRef actionedUponNodeRef) {
List<String> mimeTypes = null;
String rawTypes = (String)action.getParameterValue(PARAM_MIME_TYPES);
if(rawTypes != null && rawTypes.length() > 0)
{
mimeTypes = new ArrayList<String>();
StringTokenizer st = new StringTokenizer(rawTypes, ",");
while(st.hasMoreTokens())
{
mimeTypes.add( st.nextToken().trim() );
}
}
extractor.extract(actionedUponNodeRef, mimeTypes);
}
示例4: executeImpl
import org.alfresco.service.cmr.action.Action; //导入方法依赖的package包/类
/**
* @see org.alfresco.repo.action.executer.ActionExecuterAbstractBase#executeImpl(org.alfresco.service.cmr.action.Action, org.alfresco.service.cmr.repository.NodeRef)
*/
@SuppressWarnings("unchecked")
@Override
protected void executeImpl(Action action, NodeRef actionedUponNodeRef)
{
if (nodeService.exists(actionedUponNodeRef) == true)
{
// Check that the actioned upon node has the rules aspect applied
if (nodeService.hasAspect(actionedUponNodeRef, RuleModel.ASPECT_RULES) == true)
{
List<NodeRef> rules = (List<NodeRef>)action.getParameterValue(PARAM_RULES);
int index = 0;
for (NodeRef rule : rules)
{
ruleService.setRulePosition(actionedUponNodeRef, rule, index);
index++;
}
}
}
}
示例5: executeImpl
import org.alfresco.service.cmr.action.Action; //导入方法依赖的package包/类
/**
* @see org.alfresco.repo.action.executer.ActionExecuter#execute(Action, NodeRef)
*/
public void executeImpl(Action ruleAction, NodeRef actionedUponNodeRef)
{
if (this.nodeService.exists(actionedUponNodeRef) == true)
{
// Get the type of the node
QName currentType = this.nodeService.getType(actionedUponNodeRef);
QName destinationType = (QName)ruleAction.getParameterValue(PARAM_TYPE_NAME);
// Ensure that we are performing a specialise
if (currentType.equals(destinationType) == false &&
this.dictionaryService.isSubClass(destinationType, currentType) == true)
{
// Specialise the type of the node
this.nodeService.setType(actionedUponNodeRef, destinationType);
}
}
}
示例6: executeImpl
import org.alfresco.service.cmr.action.Action; //导入方法依赖的package包/类
@Override
protected void executeImpl(Action action, NodeRef actionedUponNodeRef)
{
String transferId = (String)action.getParameterValue(PARAM_TRANSFER_ID);
if (log.isDebugEnabled())
{
log.debug("Transfer id = " + transferId);
}
receiver.commit(transferId);
}
示例7: getRenditionDefinition
import org.alfresco.service.cmr.action.Action; //导入方法依赖的package包/类
/**
* This method gets the (mandatory) rendition definition parameter from the containing action.
* @param containingAction the containing action.
* @return the rendition definition.
* @throws IllegalArgumentException if the rendition definition is missing.
*/
private RenditionDefinition getRenditionDefinition(final Action containingAction)
{
Serializable rendDefObj = containingAction.getParameterValue(PARAM_RENDITION_DEFINITION);
ParameterCheck.mandatory(PARAM_RENDITION_DEFINITION, rendDefObj);
return (RenditionDefinition) rendDefObj;
}
示例8: checkNumericalParameterIsPositive
import org.alfresco.service.cmr.action.Action; //导入方法依赖的package包/类
/**
* This method checks that if the specified parameter is non-null, that it has a
* positive numerical value. That is it is non-zero and positive.
*
* @param action Action
* @param numericalParamName must be an instance of java.lang.Number or null.
*/
private void checkNumericalParameterIsPositive(Action action, String numericalParamName)
{
Number param = (Number)action.getParameterValue(numericalParamName);
if (param != null && param.longValue() <= 0)
{
StringBuilder msg = new StringBuilder();
msg.append("Parameter ").append(numericalParamName)
.append(" had illegal non-positive value: ").append(param.intValue());
throw new IllegalArgumentException(msg.toString());
}
}
示例9: executeImpl
import org.alfresco.service.cmr.action.Action; //导入方法依赖的package包/类
/**
* @see org.alfresco.repo.action.executer.ActionExecuterAbstractBase#executeImpl(Action, org.alfresco.service.cmr.repository.NodeRef)
*/
@Override
protected void executeImpl(
Action ruleAction,
NodeRef actionedUponNodeRef)
{
if (this.nodeService.exists(actionedUponNodeRef) == true &&
this.nodeService.hasAspect(actionedUponNodeRef, ApplicationModel.ASPECT_SIMPLE_WORKFLOW) == false)
{
// Get the parameter values
String approveStep = (String)ruleAction.getParameterValue(PARAM_APPROVE_STEP);
NodeRef approveFolder = (NodeRef)ruleAction.getParameterValue(PARAM_APPROVE_FOLDER);
Boolean approveMove = (Boolean)ruleAction.getParameterValue(PARAM_APPROVE_MOVE);
String rejectStep = (String)ruleAction.getParameterValue(PARAM_REJECT_STEP);
NodeRef rejectFolder = (NodeRef)ruleAction.getParameterValue(PARAM_REJECT_FOLDER);
Boolean rejectMove = (Boolean)ruleAction.getParameterValue(PARAM_REJECT_MOVE);
// Set the property values
Map<QName, Serializable> propertyValues = new HashMap<QName, Serializable>();
propertyValues.put(ApplicationModel.PROP_APPROVE_STEP, approveStep);
propertyValues.put(ApplicationModel.PROP_APPROVE_FOLDER, approveFolder);
if (approveMove != null)
{
propertyValues.put(ApplicationModel.PROP_APPROVE_MOVE, approveMove.booleanValue());
}
propertyValues.put(ApplicationModel.PROP_REJECT_STEP, rejectStep);
propertyValues.put(ApplicationModel.PROP_REJECT_FOLDER, rejectFolder);
if (rejectMove != null)
{
propertyValues.put(ApplicationModel.PROP_REJECT_MOVE, rejectMove.booleanValue());
}
// Apply the simple workflow aspect to the node
this.nodeService.addAspect(actionedUponNodeRef, ApplicationModel.ASPECT_SIMPLE_WORKFLOW, propertyValues);
}
}
示例10: testActionResult
import org.alfresco.service.cmr.action.Action; //导入方法依赖的package包/类
/**
* Test the action result parameter
*/
public void testActionResult()
{
// Create the script node reference
NodeRef script = this.nodeService.createNode(
this.folder,
ContentModel.ASSOC_CONTAINS,
QName.createQName(NamespaceService.CONTENT_MODEL_1_0_URI, "testScript.js"),
ContentModel.TYPE_CONTENT).getChildRef();
this.nodeService.setProperty(script, ContentModel.PROP_NAME, "testScript.js");
ContentWriter contentWriter = this.contentService.getWriter(script, ContentModel.PROP_CONTENT, true);
contentWriter.setMimetype("text/plain");
contentWriter.setEncoding("UTF-8");
contentWriter.putContent("\"VALUE\";");
// Create the action
Action action1 = this.actionService.createAction(ScriptActionExecuter.NAME);
action1.setParameterValue(ScriptActionExecuter.PARAM_SCRIPTREF, script);
// Execute the action
this.actionService.executeAction(action1, this.nodeRef);
// Get the result
String result = (String)action1.getParameterValue(ActionExecuter.PARAM_RESULT);
assertNotNull(result);
assertEquals("VALUE", result);
}
示例11: newTransformationOptions
import org.alfresco.service.cmr.action.Action; //导入方法依赖的package包/类
@Override
protected TransformationOptions newTransformationOptions(Action ruleAction, NodeRef sourceNodeRef)
{
ImageTransformationOptions options = new ImageTransformationOptions();
options.setSourceNodeRef(sourceNodeRef);
options.setSourceContentProperty(ContentModel.PROP_NAME);
options.setTargetContentProperty(ContentModel.PROP_NAME);
String convertCommand = (String) ruleAction.getParameterValue(PARAM_CONVERT_COMMAND);
options.setCommandOptions(convertCommand);
return options;
}
示例12: executeImpl
import org.alfresco.service.cmr.action.Action; //导入方法依赖的package包/类
/**
* @see org.alfresco.repo.action.executer.ActionExecuterAbstractBase#executeImpl(org.alfresco.service.cmr.action.Action, org.alfresco.service.cmr.repository.NodeRef)
*/
@Override
protected void executeImpl(Action action, NodeRef actionedUponNodeRef)
{
// Check if thumbnailing is generally disabled
if (!thumbnailService.getThumbnailsEnabled())
{
if (logger.isDebugEnabled())
{
logger.debug("Thumbnail transformations are not enabled");
}
return;
}
// Get the thumbnail
NodeRef thumbnailNodeRef = (NodeRef)action.getParameterValue(PARAM_THUMBNAIL_NODE);
if (thumbnailNodeRef == null)
{
thumbnailNodeRef = actionedUponNodeRef;
}
if (this.nodeService.exists(thumbnailNodeRef) == true &&
renditionService.isRendition(thumbnailNodeRef))
{
// Get the thumbnail Name
ChildAssociationRef parent = renditionService.getSourceNode(thumbnailNodeRef);
String thumbnailName = parent.getQName().getLocalName();
// Get the details of the thumbnail
ThumbnailRegistry registry = this.thumbnailService.getThumbnailRegistry();
ThumbnailDefinition details = registry.getThumbnailDefinition(thumbnailName);
if (details == null)
{
throw new AlfrescoRuntimeException("The thumbnail name '" + thumbnailName + "' is not registered");
}
// Get the content property
QName contentProperty = (QName)action.getParameterValue(PARAM_CONTENT_PROPERTY);
if (contentProperty == null)
{
contentProperty = ContentModel.PROP_CONTENT;
}
Serializable contentProp = nodeService.getProperty(actionedUponNodeRef, contentProperty);
if (contentProp == null)
{
logger.info("Creation of thumbnail, null content for " + details.getName());
return;
}
if(contentProp instanceof ContentData)
{
ContentData content = (ContentData)contentProp;
String mimetype = content.getMimetype();
if (mimetypeMaxSourceSizeKBytes != null)
{
Long maxSourceSizeKBytes = mimetypeMaxSourceSizeKBytes.get(mimetype);
if (maxSourceSizeKBytes != null && maxSourceSizeKBytes >= 0 && maxSourceSizeKBytes < (content.getSize()/1024L))
{
logger.debug("Unable to create thumbnail '" + details.getName() + "' for " +
mimetype + " as content is too large ("+(content.getSize()/1024L)+"K > "+maxSourceSizeKBytes+"K)");
return; //avoid transform
}
}
}
// Create the thumbnail
this.thumbnailService.updateThumbnail(thumbnailNodeRef, details.getTransformationOptions());
}
}
示例13: executeImpl
import org.alfresco.service.cmr.action.Action; //导入方法依赖的package包/类
/**
* Execute action implementation
*/
@Override
protected void executeImpl(Action ruleAction, NodeRef actionedUponNodeRef)
{
// Double check that the node still exists
if (this.nodeService.exists(actionedUponNodeRef) == true)
{
// Get the rule parameter values
QName categoryAspect = (QName)ruleAction.getParameterValue(PARAM_CATEGORY_ASPECT);
if (categoryAspect == null)
{
// Use the default general classifiable aspect
//cm:generalclassifiable
categoryAspect = ContentModel.ASPECT_GEN_CLASSIFIABLE;
}
NodeRef categoryValue = (NodeRef)ruleAction.getParameterValue(PARAM_CATEGORY_VALUE);
// Check that the aspect is classifiable and is currently applied to the node
if (this.dictionaryService.isSubClass(categoryAspect, ContentModel.ASPECT_CLASSIFIABLE) == true)
{
// Get the category property qname
QName categoryProperty = null;
Map<QName, PropertyDefinition> propertyDefs = this.dictionaryService.getAspect(categoryAspect).getProperties();
for (Map.Entry<QName, PropertyDefinition> entry : propertyDefs.entrySet())
{
if (DataTypeDefinition.CATEGORY.equals(entry.getValue().getDataType().getName()) == true)
{
// Found the category property
categoryProperty = entry.getKey();
break;
}
}
// Check that the category property is not null
if (categoryProperty == null)
{
throw new AlfrescoRuntimeException("The category aspect " + categoryAspect.toPrefixString() + " does not have a category property to set.");
}
if (categoryAspect != null)
{
if (this.nodeService.hasAspect(actionedUponNodeRef, categoryAspect) == false)
{
// Add the aspect and set the category property value
Map<QName, Serializable> properties = new HashMap<QName, Serializable>();
properties.put(categoryProperty, categoryValue);
this.nodeService.addAspect(actionedUponNodeRef, categoryAspect, properties);
}
else
{
// Append the category value to the existing values
Serializable value = this.nodeService.getProperty(actionedUponNodeRef, categoryProperty);
Collection<NodeRef> categories = null;
if (value == null)
{
categories = DefaultTypeConverter.INSTANCE.getCollection(NodeRef.class, categoryValue);
}
else
{
categories = DefaultTypeConverter.INSTANCE.getCollection(NodeRef.class, value);
if (categories.contains(categoryValue) == false)
{
categories.add(categoryValue);
}
}
this.nodeService.setProperty(actionedUponNodeRef, categoryProperty, (Serializable)categories);
}
}
}
}
}
示例14: executeImpl
import org.alfresco.service.cmr.action.Action; //导入方法依赖的package包/类
/**
* @see org.alfresco.repo.action.executer.ActionExecuter#execute(Action, NodeRef)
*/
public void executeImpl(Action ruleAction, NodeRef actionedUponNodeRef)
{
File zipFile = null;
try
{
String packageName = (String)ruleAction.getParameterValue(PARAM_PACKAGE_NAME);
File dataFile = new File(packageName);
File contentDir = new File(packageName);
// create a temporary file to hold the zip
zipFile = TempFileProvider.createTempFile(TEMP_FILE_PREFIX, ACPExportPackageHandler.ACP_EXTENSION);
ACPExportPackageHandler zipHandler = new ACPExportPackageHandler(new FileOutputStream(zipFile),
dataFile, contentDir, mimetypeService);
ExporterCrawlerParameters params = new ExporterCrawlerParameters();
boolean includeChildren = true;
Boolean withKids = (Boolean)ruleAction.getParameterValue(PARAM_INCLUDE_CHILDREN);
if (withKids != null)
{
includeChildren = withKids.booleanValue();
}
params.setCrawlChildNodes(includeChildren);
boolean includeSelf = false;
Boolean andMe = (Boolean)ruleAction.getParameterValue(PARAM_INCLUDE_SELF);
if (andMe != null)
{
includeSelf = andMe.booleanValue();
}
params.setCrawlSelf(includeSelf);
params.setExportFrom(new Location(actionedUponNodeRef));
// perform the actual export
this.exporterService.exportView(zipHandler, params, null);
// now the export is done we need to create a node in the repository
// to hold the exported package
NodeRef zip = createExportZip(ruleAction, actionedUponNodeRef);
ContentWriter writer = this.contentService.getWriter(zip, ContentModel.PROP_CONTENT, true);
writer.setEncoding((String)ruleAction.getParameterValue(PARAM_ENCODING));
writer.setMimetype(MimetypeMap.MIMETYPE_ACP);
writer.putContent(zipFile);
}
catch (FileNotFoundException fnfe)
{
throw new ActionServiceException("export.package.error", fnfe);
}
finally
{
// try and delete the temporary file
if (zipFile != null)
{
zipFile.delete();
}
}
}
示例15: executeImpl
import org.alfresco.service.cmr.action.Action; //导入方法依赖的package包/类
@Override
protected void executeImpl(Action ruleAction, NodeRef actionedUponNodeRef)
{
// retrieve workflow definition
String workflowName = (String)ruleAction.getParameterValue(PARAM_WORKFLOW_NAME);
WorkflowDefinition def = workflowService.getDefinitionByName(workflowName);
// create workflow package to contain actioned upon node
NodeRef workflowPackage = (NodeRef)ruleAction.getParameterValue(WorkflowModel.ASSOC_PACKAGE.toPrefixString(namespaceService));
workflowPackage = workflowService.createPackage(workflowPackage);
ChildAssociationRef childAssoc = nodeService.getPrimaryParent(actionedUponNodeRef);
nodeService.addChild(workflowPackage, actionedUponNodeRef, WorkflowModel.ASSOC_PACKAGE_CONTAINS, childAssoc.getQName());
// build map of workflow start task parameters
Map<String, Serializable> paramValues = ruleAction.getParameterValues();
Map<QName, Serializable> workflowParameters = new HashMap<QName, Serializable>();
workflowParameters.put(WorkflowModel.ASSOC_PACKAGE, workflowPackage);
for (Map.Entry<String, Serializable> entry : paramValues.entrySet())
{
if (!entry.getKey().equals(PARAM_WORKFLOW_NAME))
{
QName qname = QName.createQName(entry.getKey(), namespaceService);
Serializable value = entry.getValue();
workflowParameters.put(qname, value);
}
}
// provide a default context, if one is not specified
Serializable context = workflowParameters.get(WorkflowModel.PROP_CONTEXT);
if (context == null)
{
workflowParameters.put(WorkflowModel.PROP_CONTEXT, childAssoc.getParentRef());
}
// start the workflow
WorkflowPath path = workflowService.startWorkflow(def.getId(), workflowParameters);
// determine whether to auto-end the start task
Boolean endStartTask = (Boolean)ruleAction.getParameterValue(PARAM_END_START_TASK);
String startTaskTransition = (String)ruleAction.getParameterValue(PARAM_START_TASK_TRANSITION);
endStartTask = (endStartTask == null) ? true : false;
// auto-end the start task with the provided transition (if one)
if (endStartTask)
{
List<WorkflowTask> tasks = workflowService.getTasksForWorkflowPath(path.getId());
for (WorkflowTask task : tasks)
{
workflowService.endTask(task.getId(), startTaskTransition);
}
}
}