draganr
I'm new here

How to deploy a page from the Content Creator?

Jump to solution

Hello all,

I'm using the following script to start the deployment process from the ContentCreator.

//!Beanshell

import de.espirit.firstspirit.access.ServicesBroker;

import de.espirit.firstspirit.access.AdminService;

// schedulerName = "publish %country% LIVE - PRESS";

schedulerName = "TEST Country Deployment RU";

try {

    context.logInfo("Starting");

   

    // Start deployment

    sStorage = context.requireSpecialist(ServicesBroker.TYPE).getService(AdminService.class).getScheduleStorage();

    sEntry = sStorage.getScheduleEntry(context.getProject(), schedulerName);

    sEntry.execute();

   

    context.logInfo("Started scheduler '" + schedulerName + "'");

    context.showForm(false, "successMessage");

} catch(Exception e) {

    context.logError("Couldn't start scheduler", e);

}

How can I add the current page in this script, from where the editor has started it?

How to deploy the page from where the script is executed, in the ContentCreator?

If you have a better approach, please share it with me. It doesn't need to be a script, it can be a workflow as well. That would be even better.

Kind Regards,

Dragan Rakita

0 Kudos
1 Solution

Accepted Solutions
mbergmann
Crownpeak employee

Hi Dragan,

the usual approach is: The schedule contains at least a normal generation task (configured as partial generation but without start nodes) and a deployment task.

The idea is to temporarily modify the partial generation and add the desired PageRef as a start node.

Before calling .execute() on the schedule entry, get the generation task from the schedule, usually by iterating through its tasks and check for instanceof GenerateTask if there’s only one.

generateTask = ...

Then, use something like

generateTask.getStartNodes().add(myPageRef);

sEntry.execute();

Regards,

Michael

View solution in original post

0 Kudos
2 Replies
mbergmann
Crownpeak employee

Hi Dragan,

the usual approach is: The schedule contains at least a normal generation task (configured as partial generation but without start nodes) and a deployment task.

The idea is to temporarily modify the partial generation and add the desired PageRef as a start node.

Before calling .execute() on the schedule entry, get the generation task from the schedule, usually by iterating through its tasks and check for instanceof GenerateTask if there’s only one.

generateTask = ...

Then, use something like

generateTask.getStartNodes().add(myPageRef);

sEntry.execute();

Regards,

Michael

0 Kudos

Dear Mr. Bergmann,

Thank you very much.

Kind Regards,

Dragan Rakita

0 Kudos