Hello,
I'm trying to create a behaviour that updates a number of properties with the "onUpdateProperties".
I've managed to create a behaviour that writes a log entry each time I update the properties of my content type.
And now I can't use any of the services to read or update the properties.
I added the service registry like this:
private ServiceRegistry serviceRegistry;
public void setServiceRegistry(ServiceRegistry serviceRegistry)
{
this.serviceRegistry = serviceRegistry;
}
And now I'm trying to get some properties back from the services like:
String un = serviceRegistry.getAuthenticationService().getCurrentUserName();
or
String copyName = (String)serviceRegistry.getNodeService().getProperty(nodeRef, ContentModel.PROP_NAME);
I've also tried to get the nodeservice directly:
private NodeService nodeService;
public void setNodeService(NodeService nodeService)
{
this.nodeService = nodeService;
}
and String copyName = (String)this.nodeService.getProperty(nodeRef, ContentModel.PROP_NAME);
But no matter how I always get the following error:
14:51:57,466 User:beglelae ERROR [ui.common.Utils] A system error happened during the operation: null
java.lang.NullPointerException
at org.cmc.behaviour.tenderMetadata.getUserName(tenderMetadata.java:90)
at org.cmc.behaviour.tenderMetadata.onUpdateProperties(tenderMetadata.java:83)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.alfresco.repo.policy.JavaBehaviour$JavaMethodInvocationHandler.invoke(JavaBehaviour.java:179)
at $Proxy13.onUpdateProperties(Unknown Source)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.alfresco.repo.policy.PolicyFactory$MultiHandler.invoke(PolicyFactory.java:306)
at org.alfresco.repo.policy.$Proxy179.onUpdateProperties(Unknown Source)
………………
And this error always refers to line where I try to use the service.
What am I doing wrong?
Thanks,
Glenn