03-27-2007 10:10 PM
03-28-2007 07:22 AM
03-28-2007 08:24 AM
03-28-2007 09:14 AM
03-28-2007 09:51 AM
03-29-2007 05:48 AM
package perext;
import java.util.Set;
import org.alfresco.repo.jscript.BaseScriptImplementation;
import org.alfresco.repo.jscript.Node;
import org.alfresco.service.ServiceRegistry;
import org.alfresco.service.cmr.security.AccessPermission;
import org.alfresco.util.ApplicationContextHelper;
import org.springframework.context.ApplicationContext;
public class Perext extends BaseScriptImplementation {
/**
* @return Array of permissions applied to this Node.
* Strings returned are of the format [ALLOWED|DENIED];[USERNAME|GROUPNAME];PERMISSION for example
* ALLOWED;kevinr;Consumer so can be easily tokenized on the ';' character.
*/
public String[] getPermissions(Node node)
{
// initialise app content
ApplicationContext ctx = ApplicationContextHelper.getApplicationContext();
// get registry of services
ServiceRegistry services = (ServiceRegistry) ctx.getBean(ServiceRegistry.SERVICE_REGISTRY);
String userName = services.getAuthenticationService().getCurrentUserName();
Set<AccessPermission> acls = services.getPermissionService().getAllSetPermissions(node.getNodeRef());
String[] permissions = new String[acls.size()];
int count = 0;
for (AccessPermission permission : acls)
{
StringBuilder buf = new StringBuilder(64);
buf.append(permission.getAccessStatus())
.append(';')
.append(permission.getAuthority())
.append(';')
.append(permission.getPermission());
permissions[count++] = buf.toString();
}
return permissions;
}
}
<bean id="perextScript" parent="baseScriptImplementation" class="perext.Perext">
<property name="scriptName">
<value>perext</value>
</property>
</bean>
21:30:09,514 ERROR [hibernate.engine.ActionQueue] could not release a cache lock
org.hibernate.cache.CacheException: java.lang.IllegalStateException: The org.hibernate.cache.UpdateTimestampsCache Cache is not alive.
…(snip)…
21:30:09,598 ERROR [util.transaction.SpringAwareUserTransaction] Transaction didn't commit
org.alfresco.service.cmr.repository.ScriptException: Failed to execute script 'workspace://SpacesStore/8558e240-d8b0-11db-88a6-67c46e9dea50': Wrapped org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'serverConnector' defined in class path resource [alfresco/core-services-context.xml]: Initialization of bean failed; nested exception is java.io.IOException: Cannot bind to URL [rmi://localhost:50500/alfresco/jmxrmi]: javax.naming.NameAlreadyBoundException: alfresco/jmxrmi [Root exception is java.rmi.AlreadyBoundException: alfresco/jmxrmi] (AlfrescoScript#12)
at org.alfresco.repo.jscript.RhinoScriptService.executeScript(RhinoScriptService.java:168)
…(snip)…
21:30:15,763 ERROR [quartz.core.JobRunShell] Job DEFAULT.org.springframework.scheduling.quartz.JobDetailBean#1e3bbd7 threw an unhandled Exception:
java.lang.IllegalStateException: The org.alfresco.repo.domain.hibernate.TransactionImpl Cache is not alive.
21:30:15,766 ERROR [quartz.core.ErrorLogger] Job (DEFAULT.org.springframework.scheduling.quartz.JobDetailBean#1e3bbd7 threw an exception.
org.quartz.SchedulerException: Job threw an unhandled exception. [See nested exception: java.lang.IllegalStateException: The org.alfresco.repo.domain.hibernate.TransactionImpl Cache is not alive.]
at org.quartz.core.JobRunShell.run(JobRunShell.java:213)
04-03-2007 06:24 AM
// initialise app content
ApplicationContext ctx = ApplicationContextHelper.getApplicationContext();
// get registry of services
ServiceRegistry services = (ServiceRegistry) ctx.getBean(ServiceRegistry.SERVICE_REGISTRY);
/**
* Sets the service registry
*
* @param services the service registry
*/
public void setServiceRegistry(ServiceRegistry services)
{
this.services = services;
}
and the configuration sets via spring thus:
<bean id="utilsScript" parent="baseScriptImplementation" class="org.alfresco.repo.jscript.ScriptUtils">
<property name="scriptName">
<value>utils</value>
</property>
<property name="serviceRegistry">
<ref bean="ServiceRegistry"/>
</property>
</bean>
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.