+

Search Tips   |   Advanced Search

Obtain creation contexts

We need a creation context to define immutable properties of a resource created. Use the creation context builder factory to generate multiple such creation contexts without having to implement those interfaces directly. The creation context builder factory can do both of the following:

  • Generate single creation contexts, that is contexts containing only one or more immutable properties.

    • A creation context for an object ID contains only the object ID property.
    • A layout control creation context contains two properties, portlet definition and portlet entity.

  • Combine several creation contexts into one in order to define multiple immutable properties.

We can only combine creation contexts that have not already been combined using the creation context builder.


Example

Obtain a simple creation context:

// obtain creation context builder
final CreationContextBuilderFactory builder = CreationContextBuilderFactory.getInstance();
 // obtain creation context 
final CreationContext creationContext = builder.newIdentifiableCreationContext(objectID);

Obtain a combined creation context:

// obtain creation context builder
final CreationContextBuilderFactory builder = CreationContextBuilderFactory.getInstance();
 // obtain combined creation context 
final CreationContext creationContext = builder.combine
(
    new CreationContext[] 
    {
        builder.newContentPageCreationContext(true), builder.newIdentifiableCreationContext(objectID)
});


What to do next

The following list describes creation contexts we can create using the creation context builder factory:

    ContentPageCreationContext
    Define whether a page created is private. Applies to the resource type ContentPage on the ContentModelController.

    DerivedContentPageCreationContext
    Define the derivation parent of a page to create. Applies to the resource type ContentPage on the ContentModelController. Derives from the ContentPageCreationContext.

    IdentifiableCreationContext
    Define an object ID for a resource to create. Applies to all resource types: ContentModelController, LayoutModelController, PortletModelController.

    PortletDefinitionCloningContext
    Define the portlet definition ID, and optionally, the domain for the portlet definition to clone. Applies to the resource type PortletDefinition on the PortletModelController.

    PortletEntityCreationContext
    Define the parent ID, and optionally, the domain for the portlet entity to create. Applies to the resource type PortletEntity on the PortletModelController.


Parent Create resources