11-27-2019 02:45 AM
hello.
I try to create additional module for Alfresco.
I created project All-in-One by instruction https://github.com/Alfresco/alfresco-sdk/blob/master/docs/getting-started.md
SDK 4.0, Alfresco 6.1
in class DemoComponent
import org.alfresco.repo.nodelocator.NodeLocatorService;
import org.alfresco.service.cmr.repository.NodeRef;
import org.alfresco.service.cmr.repository.NodeService;
private NodeService nodeService;
private NodeLocatorService nodeLocatorService;
public NodeRef getCompanyHome(){
return nodeLocatorService.getNode("companyhome", null, null);
}
<bean id="testpackage.DemoComponent" class="testpackage.platformsample.DemoComponent" parent="module.baseComponent" >
<property name="moduleId" value="testartifact-platform" /> <!-- See module.properties -->
<property name="name" value="DemoComponent" />
<property name="description" value="A demonstration component" />
<property name="sinceVersion" value="2.0" />
<property name="appliesFromVersion" value="2.0" /> <!-- 1.0 would not work here when using SNAPSHOT version in project -->
<property name="nodeService" ref="nodeService" />
<property name="nodeLocatorService" ref="nodeLocatorService" />
</bean>
I run project (./run.sh build_start), but line getCompanyHome() take me error
java.lang.NullPointerException
at testpackage.platformsample.DemoComponent.getCompanyHome(DemoComponent.java:93)
at testpackage.platformsample.DemoComponent.executeInternal(DemoComponent.java:61)
at testpackage.platformsample.HelloWorldWebScript.executeImpl(HelloWorldWebScript.java:129)
at testpackage.platformsample.HelloWorldWebScriptControllerTest.testController(HelloWorldWebScriptControllerTest.java:47)
How can I get nodeService, nodeLocatorService?
Maybe anybody link me to example project, please.
I would be very grateful for the information. Thanks to all.
Tetyana
12-02-2019 05:20 AM
The project is on GitHub
12-02-2019 05:26 AM
12-03-2019 03:45 AM
Explore our Alfresco products with the links below. Use labels to filter content by product module.