Creating folder

cancel
Showing results for 
Search instead for 
Did you mean: 
Active Member

Creating folder

Jump to solution

How to create a folder inside CompanyHome (JAVA) ?

1 Solution

Accepted Solutions
Senior Member II

Re: Creating folder

Jump to solution

Hi,

You can create folder inside Company Home using repository service.

Ex.

String folderName = String.valueOf(new Date().getTime());
HashMap<QName, Serializable> props = new HashMap<QName, Serializable>();
props.put(ContentModel.PROP_NAME, folderName);

nodeService.createNode(repository.getCompanyHome(), ContentModel.ASSOC_CONTAINS,                                QName.createQName(folderName),
          ContentModel.TYPE_FOLDER, props);

Thanks,

Sanjay

Thanks & Regards,
Sanjay

View solution in original post

4 Replies
Senior Member II

Re: Creating folder

Jump to solution

Hi,

You can create folder inside Company Home using repository service.

Ex.

String folderName = String.valueOf(new Date().getTime());
HashMap<QName, Serializable> props = new HashMap<QName, Serializable>();
props.put(ContentModel.PROP_NAME, folderName);

nodeService.createNode(repository.getCompanyHome(), ContentModel.ASSOC_CONTAINS,                                QName.createQName(folderName),
          ContentModel.TYPE_FOLDER, props);

Thanks,

Sanjay

Thanks & Regards,
Sanjay

View solution in original post

Active Member

Re: Creating folder

Jump to solution

Hi,
Thanks.
And how can I check a folder existence ?

Senior Member II

Re: Creating folder

Jump to solution

Hi,

You can use getChildByName() method of NodeService to check that given name folder is exist or not.

Ex.

nodeService.getChildByName(folderNode, ContentModel.ASSOC_CONTAINS,Constants.HELP_DOCUMENTS);

Thanks & Regards,
Sanjay
Active Member

Re: Creating folder

Jump to solution

Thanks.