Creating folder

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

Creating folder

Jump to solution

How to create a folder inside CompanyHome (JAVA) ?

1 Solution

Accepted Solutions
sanjaybandhniya
Intermediate

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

View solution in original post

4 Replies
sanjaybandhniya
Intermediate

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

riadhazzouz
Active Member

Re: Creating folder

Jump to solution

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

sanjaybandhniya
Intermediate

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);

riadhazzouz
Active Member

Re: Creating folder

Jump to solution

Thanks.