11-12-2013 05:42 PM
import org.alfresco.web.evaluator.BaseEvaluator;
import org.json.simple.JSONObject;
import org.springframework.extensions.surf.ServletUtil;
import org.springframework.extensions.surf.exception.ConnectorServiceException;
import org.springframework.extensions.surf.support.ThreadLocalRequestContext;
import org.springframework.extensions.webscripts.connector.Connector;
public class CustomEvaluator extends BaseEvaluator
{
@Override
public boolean evaluate(JSONObject node)
{
try
{
Connector conn = ThreadLocalRequestContext.getRequestContext().getServiceRegistry().getConnectorService().getConnector("alfresco");
return conn.call("/some/webscript/run?nodeRef=" + (String) node.get("nodeRef")).getResponse().equals("YES");
}
catch (ConnectorServiceException ex)
{
return false;
}
}
}
11-13-2013 07:00 AM
11-13-2013 07:03 AM
11-13-2013 09:44 AM
<?xml version='1.0' encoding='UTF-8'?>
<!DOCTYPE beans PUBLIC '-//SPRING//DTD BEAN//EN' 'http://www.springframework.org/dtd/spring-beans.dtd'>
<beans>
<!– No problems with this one –>
<bean id="evaluator.doclib.action.isPdf" parent="evaluator.doclib.action.isMimetype">
<property name="mimetypes">
<list>
<value>application/pdf</value>
</list>
</property>
</bean>
<!– This is the problematic one –>
<bean id="evaluator.doclib.action.isItReady" class="some.internal.package.CustomEvaluator" />
</beans>
<alfresco-config>
…
<config evaluator="string-compare" condition="DocumentLibrary" replace="true">
…
<indicators>
<indicator id="indicator.doclib.action.isItReady" icon="myicon-16.png" index="100" label="Yea!">
<evaluator>evaluator.doclib.action.isItReady</evaluator>
</indicator>
</indicators>
</config>
</alfresco-config>
<webscript>
<shortname>Some name</shortname>
<description>Some description</description>
<url>/some/folder/isItReady</url>
<authentication>user</authentication>
<format default="json">argument</format>
<family>Custom</family>
</webscript>
11-13-2013 06:14 PM
11-14-2013 05:29 PM
11-14-2013 01:23 PM
11-14-2013 05:25 PM
11-14-2013 05:39 PM
GET /alfresco/s/some/folder/isItReady?nodeRef=workspace://SpacesStore/2d4e61ab-8508-4f7f-834c-1f49170d096c HTTP/1.1
User-Agent: Jakarta Commons-HttpClient/3.1
Host: localhost:8080
HTTP/1.1 401 Unauthorized
Server: Apache-Coyote/1.1
WWW-Authenticate: Basic realm="Alfresco"
Content-Type: text/html;charset=utf-8
Content-Length: 951
Date: Thu, 14 Nov 2013 22:23:54 GMT
(Some HTML…)
This request requires HTTP authentication.
(Some more HTML…)
11-15-2013 10:13 AM
Tags
Find what you came for
We want to make your experience in Hyland Connect as valuable as possible, so we put together some helpful links.