Skip to main content
Skip table of contents

Creating and Adding Folders

You may need to create a new folder and add it to a structure. 

Folders and generators are items that are managed entirely by Structure add-on, so you'll need to use Structure's services to create the item first, giving you the item identify, and then insert a row into a forest.

Read more about Changing Structure Content for general ideas about updating a structure.


Create the Folder entity

CODE
long folderId = myStructureComponents.getFolderManager().createFolder(Folder.named("My Stuff").build());

The folder is now stored in the database.

Define folder's identity

CODE
ItemIdentity itemId = CoreIdentities.folder(folderId);

Add folder to structure

CODE
forestSource.apply(new ForestAction.Add(itemId, 0, 0, 0));
JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.