Hello,
I am having a content file (say Amit.txt) in company Home. And assuming that I have a custom method by name checkOut(String A), where parameter “String A” is Amit.txt that will be send by any invoking class. Now can you please suggest me how to get NodeRef for Amit.txt? Below is the full code scenario where I want to use this(basically its to checkout Amit.txt in company home itself).
#####################################################################
public void checkOut(String A){
//this.fileRef=fileRef;
try{
ApplicationContext context = new ClassPathXmlApplicationContext("classpath:alfresco/application-context.xml");
Repository repository = (Repository)context.getBean("JCR.Repository");
Session session = repository.login(new SimpleCredentials("admin", "admin".toCharArray()));
NodeRef NR= ????????????????????
ChildAssociationRef Parent=nodeSevice.getPrimaryParent(NR);
FileInfo fileinfo = fileFolderService.getFileInfo(NR);
fileRef = fileinfo.getNodeRef();
CheckOutCheckInService checkOutCheckInService= serviceRegistry.getCheckOutCheckInService();
checkOutCheckInService.checkout(fileRef, Parent.getParentRef(), ContentModel.ASSOC_CONTAINS, ContentModel.TYPE_CONTAINER);
session.save();
}
catch (Exception exp ){
System.out.println (" error while creating nodes " + exp);
exp.printStackTrace();
}
}
#####################################################################################
Thanks
Amit.