Java Code Examples for org.alfresco.service.cmr.action.Action#getParameterValue()
The following examples show how to use
org.alfresco.service.cmr.action.Action#getParameterValue() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ActionFormProcessor.java From alfresco-repository with GNU Lesser General Public License v3.0 | 6 votes |
@Override protected ActionFormResult internalPersist(ActionDefinition item, FormData data) { if (logger.isDebugEnabled()) logger.debug("Persisting form for: " + item); final Action actionToExecute = createActionAndParams(item, data); final NodeRef actionedUponNodeRef = getActionedUponNodeRef(item, data); final boolean isAsync = isAsynchronousActionRequest(item, data); // execute the action actionService.executeAction(actionToExecute, actionedUponNodeRef, true, isAsync); // extract the result Object result = actionToExecute.getParameterValue(ActionExecuter.PARAM_RESULT); return new ActionFormResult(actionToExecute, result); }
Example 2
Source File: ActionFormProcessorTest.java From alfresco-repository with GNU Lesser General Public License v3.0 | 6 votes |
@SuppressWarnings("unchecked") @Override protected void executeImpl(Action action, NodeRef actionedUponNodeRef) { Object checkValue = action.getParameterValue("check"); assertEquals("Parameter value should be Boolean", checkValue.getClass(), Boolean.class); Object dateValue = action.getParameterValue("date"); assertEquals("Parameter value should be Date", dateValue.getClass(), Date.class); Object qnameValue = action.getParameterValue("qname"); assertEquals("Parameter value should be ArrayList", qnameValue.getClass(), ArrayList.class); for (QName qname : (ArrayList<QName>)qnameValue) { assertEquals("The item value should be QName", qname.getClass(), QName.class); } Object nodeRefsValue = action.getParameterValue("nodeRefs"); assertEquals("Parameter value should be ArrayList", nodeRefsValue.getClass(), ArrayList.class); for (NodeRef nodeRef : (ArrayList<NodeRef>)nodeRefsValue) { assertEquals("The item value should be NodeRef", nodeRef.getClass(), NodeRef.class); } }
Example 3
Source File: SpecialiseTypeActionExecuter.java From alfresco-repository with GNU Lesser General Public License v3.0 | 6 votes |
/** * @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); } } }
Example 4
Source File: ReorderRules.java From alfresco-repository with GNU Lesser General Public License v3.0 | 6 votes |
/** * @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++; } } } }
Example 5
Source File: TikaPoweredContainerExtractor.java From alfresco-repository with GNU Lesser General Public License v3.0 | 6 votes |
@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); }
Example 6
Source File: MoveActionExecuter.java From alfresco-repository with GNU Lesser General Public License v3.0 | 5 votes |
/** * @see org.alfresco.repo.action.executer.ActionExecuter#execute(Action, NodeRef) */ public void executeImpl(Action ruleAction, NodeRef actionedUponNodeRef) { // ALF-17635: A move action should not fire on a working copy - wait until check in if (this.nodeService.exists(actionedUponNodeRef) && !this.nodeService.hasAspect(actionedUponNodeRef, ContentModel.ASPECT_WORKING_COPY)) { NodeRef destinationParent = (NodeRef) ruleAction.getParameterValue(PARAM_DESTINATION_FOLDER); // Check the destination not to be in a pending delete list // MNT-11695 Set<QName> destinationAspects = nodeService.getAspects(destinationParent); if (destinationAspects.contains(ContentModel.ASPECT_PENDING_DELETE)) { return; } try { fileFolderService.move(actionedUponNodeRef, destinationParent, null); } catch (FileNotFoundException e) { // Do nothing } } }
Example 7
Source File: RemoveFeaturesActionExecuter.java From alfresco-repository with GNU Lesser General Public License v3.0 | 5 votes |
/** * @see org.alfresco.repo.action.executer.ActionExecuter#execute(Action, NodeRef) */ public void executeImpl(Action ruleAction, NodeRef actionedUponNodeRef) { if (this.nodeService.exists(actionedUponNodeRef) == true) { // Remove the aspect QName aspectQName = (QName)ruleAction.getParameterValue(PARAM_ASPECT_NAME); this.nodeService.removeAspect(actionedUponNodeRef, aspectQName); } }
Example 8
Source File: CheckInActionExecuter.java From alfresco-repository with GNU Lesser General Public License v3.0 | 5 votes |
/** * @see org.alfresco.repo.action.executer.ActionExecuter#execute(Action, org.alfresco.service.cmr.repository.NodeRef) */ public void executeImpl(Action ruleAction, NodeRef actionedUponNodeRef) { // First ensure that the actionedUponNodeRef is a workingCopy if (this.nodeService.exists(actionedUponNodeRef) == true && this.nodeService.hasAspect(actionedUponNodeRef, ContentModel.ASPECT_WORKING_COPY) == true) { // Get the version description String description = (String)ruleAction.getParameterValue(PARAM_DESCRIPTION); Map<String, Serializable> versionProperties = new HashMap<String, Serializable>(1); versionProperties.put(Version.PROP_DESCRIPTION, description); // determine whether the change is minor or major Boolean minorChange = (Boolean)ruleAction.getParameterValue(PARAM_MINOR_CHANGE); if (minorChange != null && minorChange.booleanValue() == false) { versionProperties.put(VersionModel.PROP_VERSION_TYPE, VersionType.MAJOR); } else { versionProperties.put(VersionModel.PROP_VERSION_TYPE, VersionType.MINOR); } // TODO determine whether the document should be kept checked out // Check the node in this.cociService.checkin(actionedUponNodeRef, versionProperties); } }
Example 9
Source File: ActionServiceImplTest.java From alfresco-repository with GNU Lesser General Public License v3.0 | 5 votes |
/** * Test the action result parameter */ @Test public void testActionResult() { // We need to run this test as Administrator. The ScriptAction has to run as a full user (instead of as System) // so that we can setup the Person object in the ScriptNode AuthenticationUtil.setFullyAuthenticatedUser(AuthenticationUtil.getAdminUserName()); try { // 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); } finally { AuthenticationUtil.clearCurrentSecurityContext(); } }
Example 10
Source File: SimpleWorkflowActionExecuter.java From alfresco-repository with GNU Lesser General Public License v3.0 | 5 votes |
/** * @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); } }
Example 11
Source File: ImageRenderingEngine.java From alfresco-repository with GNU Lesser General Public License v3.0 | 5 votes |
/** * 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()); } }
Example 12
Source File: CreateVersionActionExecuter.java From alfresco-repository with GNU Lesser General Public License v3.0 | 5 votes |
/** * @see org.alfresco.repo.action.executer.ActionExecuter#execute(Action, NodeRef) */ public void executeImpl(Action ruleAction, NodeRef actionedUponNodeRef) { if (this.nodeService.exists(actionedUponNodeRef) == true && this.nodeService.hasAspect(actionedUponNodeRef, ContentModel.ASPECT_VERSIONABLE) == true) { Map<String, Serializable> versionProperties = new HashMap<String, Serializable>(2); // Get the version description String description = (String)ruleAction.getParameterValue(PARAM_DESCRIPTION); if (description != null && description.length() != 0) { versionProperties.put(Version.PROP_DESCRIPTION, description); } // determine whether the change is minor or major Boolean minorChange = (Boolean)ruleAction.getParameterValue(PARAM_MINOR_CHANGE); if (minorChange != null && minorChange.booleanValue() == false) { versionProperties.put(VersionModel.PROP_VERSION_TYPE, VersionType.MAJOR); } else { versionProperties.put(VersionModel.PROP_VERSION_TYPE, VersionType.MINOR); } // Create the version this.versionService.createVersion(actionedUponNodeRef, versionProperties); } }
Example 13
Source File: TransferAsyncAction.java From alfresco-repository with GNU Lesser General Public License v3.0 | 5 votes |
@SuppressWarnings("unchecked") @Override protected void executeImpl(Action action, NodeRef actionedUponNodeRef) { logger.debug("In TransferAsyncAction"); String targetName = (String) action.getParameterValue("targetName"); TransferDefinition definition = (TransferDefinition) action.getParameterValue("definition"); Collection<TransferCallback> callback = (Collection<TransferCallback>) action.getParameterValue("callbacks"); transferService.transfer(targetName, definition, callback); }
Example 14
Source File: CheckOutActionExecuter.java From alfresco-repository with GNU Lesser General Public License v3.0 | 5 votes |
/** * @see org.alfresco.repo.action.executer.ActionExecuter#execute(Action, org.alfresco.service.cmr.repository.NodeRef) */ public void executeImpl(Action ruleAction, NodeRef actionedUponNodeRef) { if (this.nodeService.exists(actionedUponNodeRef) == true && this.nodeService.hasAspect(actionedUponNodeRef, ContentModel.ASPECT_WORKING_COPY) == false && isApplicableType(actionedUponNodeRef) == true) { // Get the destination details NodeRef destinationParent = (NodeRef)ruleAction.getParameterValue(PARAM_DESTINATION_FOLDER); QName destinationAssocTypeQName = (QName)ruleAction.getParameterValue(PARAM_ASSOC_TYPE_QNAME); QName destinationAssocQName = (QName)ruleAction.getParameterValue(PARAM_ASSOC_QNAME); if (destinationParent == null || destinationAssocTypeQName == null || destinationAssocQName == null) { // Check the node out to the current location this.cociService.checkout(actionedUponNodeRef); } else { // Check the node out to the specified location this.cociService.checkout( actionedUponNodeRef, destinationParent, destinationAssocTypeQName, destinationAssocQName); } } }
Example 15
Source File: ContentSignatureActionExecuter.java From CounterSign with GNU Affero General Public License v3.0 | 4 votes |
@Override protected void executeImpl(Action ruleAction, NodeRef actionedUponNodeRef) { NodeService nodeService = serviceRegistry.getNodeService(); ContentService contentService = serviceRegistry.getContentService(); byte[] sigBytes; if (nodeService.exists(actionedUponNodeRef) == false) { return; } String location = (String)ruleAction.getParameterValue(PARAM_LOCATION); String geolocation = (String)ruleAction.getParameterValue(PARAM_GEOLOCATION); String reason = (String)ruleAction.getParameterValue(PARAM_REASON); String keyPassword = (String)ruleAction.getParameterValue(PARAM_KEY_PASSWORD); // get a hash of the document InputStream contentStream = contentService. getReader(actionedUponNodeRef, ContentModel.PROP_CONTENT).getContentInputStream(); try { // get the user's private key String user = AuthenticationUtil.getRunAsUser(); SignatureProvider signatureProvider = signatureProviderFactory.getSignatureProvider(user); KeyStore keystore = signatureProvider.getUserKeyStore(keyPassword); PrivateKey key = (PrivateKey)keystore.getKey(alias, keyPassword.toCharArray()); // compute the document hash byte[] hash = signatureProvider.computeHash(contentStream); // sign the hash sigBytes = signatureProvider.signHash(hash, keyPassword); // create a "signature" node and associate it with the signed doc NodeRef sig = addSignatureNodeAssociation(actionedUponNodeRef, location, reason, "none", new java.util.Date(), geolocation, -1, "none"); // save the signature ContentWriter writer = contentService.getWriter(sig, ContentModel.PROP_CONTENT, true); writer.putContent(new ByteArrayInputStream(sigBytes)); // also save the expected hash in the signature nodeService.setProperty(sig, CounterSignSignatureModel.PROP_DOCHASH, new String(hash)); } catch(UnrecoverableKeyException uke) { throw new AlfrescoRuntimeException(uke.getMessage()); } catch (KeyStoreException kse) { throw new AlfrescoRuntimeException(kse.getMessage()); } catch (NoSuchAlgorithmException nsae) { throw new AlfrescoRuntimeException(nsae.getMessage()); } catch (Exception e) { throw new AlfrescoRuntimeException(e.getMessage()); } }
Example 16
Source File: ExporterActionExecuter.java From alfresco-repository with GNU Lesser General Public License v3.0 | 4 votes |
/** * @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(); } } }
Example 17
Source File: ExporterActionExecuter.java From alfresco-repository with GNU Lesser General Public License v3.0 | 4 votes |
/** * Creates the ZIP file node in the repository for the export * * @param ruleAction The rule being executed * @return The NodeRef of the newly created ZIP file */ private NodeRef createExportZip(Action ruleAction, NodeRef actionedUponNodeRef) { // create a node in the repository to represent the export package NodeRef exportDest = (NodeRef)ruleAction.getParameterValue(PARAM_DESTINATION_FOLDER); String packageName = (String)ruleAction.getParameterValue(PARAM_PACKAGE_NAME); // add the default Alfresco content package extension if an extension hasn't been given if (!packageName.endsWith("." + ACPExportPackageHandler.ACP_EXTENSION)) { packageName += (packageName.charAt(packageName.length() -1) == '.') ? ACPExportPackageHandler.ACP_EXTENSION : "." + ACPExportPackageHandler.ACP_EXTENSION; } // set the name for the new node Map<QName, Serializable> contentProps = new HashMap<QName, Serializable>(1); contentProps.put(ContentModel.PROP_NAME, packageName); // create the node to represent the zip file String assocName = QName.createValidLocalName(packageName); ChildAssociationRef assocRef = this.nodeService.createNode( exportDest, ContentModel.ASSOC_CONTAINS, QName.createQName(NamespaceService.CONTENT_MODEL_1_0_URI, assocName), ContentModel.TYPE_CONTENT, contentProps); NodeRef zipNodeRef = assocRef.getChildRef(); // build a description string to be set on the node representing the content package String desc = ""; String storeRef = (String)ruleAction.getParameterValue(PARAM_STORE); NodeRef rootNode = this.nodeService.getRootNode(new StoreRef(storeRef)); if (rootNode.equals(actionedUponNodeRef)) { desc = I18NUtil.getMessage("export.root.package.description"); } else { String spaceName = (String)this.nodeService.getProperty(actionedUponNodeRef, ContentModel.PROP_NAME); String pattern = I18NUtil.getMessage("export.package.description"); if (pattern != null && spaceName != null) { desc = MessageFormat.format(pattern, spaceName); } } // apply the titled aspect to behave in the web client Map<QName, Serializable> titledProps = new HashMap<QName, Serializable>(3, 1.0f); titledProps.put(ContentModel.PROP_TITLE, packageName); titledProps.put(ContentModel.PROP_DESCRIPTION, desc); this.nodeService.addAspect(zipNodeRef, ContentModel.ASPECT_TITLED, titledProps); return zipNodeRef; }
Example 18
Source File: MailActionExecuter.java From alfresco-repository with GNU Lesser General Public License v3.0 | 4 votes |
private void sendEmail(final Action ruleAction, MimeMessageHelper preparedMessage) { try { // Send the message unless we are in "testMode" if (!testMode) { mailService.send(preparedMessage.getMimeMessage()); onSend(); } else { lastTestMessage = preparedMessage.getMimeMessage(); testSentCount++; } } catch (NullPointerException | MailException e) { onFail(); String to = (String)ruleAction.getParameterValue(PARAM_TO); if (to == null) { Object obj = ruleAction.getParameterValue(PARAM_TO_MANY); if (obj != null) { to = obj.toString(); } } // always log the failure logger.error("Failed to send email to " + to + " : " + e); // optionally ignore the throwing of the exception Boolean ignoreError = (Boolean)ruleAction.getParameterValue(PARAM_IGNORE_SEND_FAILURE); if (ignoreError == null || ignoreError.booleanValue() == false) { throw new AlfrescoRuntimeException("Failed to send email to:" + to); } } }
Example 19
Source File: ActionServiceImplTest.java From alfresco-repository with GNU Lesser General Public License v3.0 | 4 votes |
@Override protected void executeImpl(Action action, NodeRef actionedUponNodeRef) { executingThread = Thread.currentThread(); //System.err.println("Sleeping for " + sleepMs + " for " + action); try { Thread.sleep(sleepMs); } catch (InterruptedException ignored) { // Intentionally empty } finally { incrementTimesExecutedCount(); } Boolean fail = (Boolean)action.getParameterValue(GO_BANG); Boolean failFatally = (Boolean)action.getParameterValue(FAIL_FATALLY); if (fail != null && fail) { // this should fail if (failFatally != null && failFatally) { // this should fail fatally throw new RuntimeException("Bang!"); } else { // this should fail non-fatally throw new ActionServiceTransientException("Pop!"); } } if(action instanceof CancellableSleepAction) { CancellableSleepAction ca = (CancellableSleepAction)action; boolean cancelled = actionTrackingService.isCancellationRequested(ca); if(cancelled) throw new ActionCancelledException(ca); } }
Example 20
Source File: UpdateThumbnailActionExecuter.java From alfresco-repository with GNU Lesser General Public License v3.0 | 4 votes |
/** * @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()); } }