Determine the page state within workflow

Before you need to update a page from a program I usually check the page state. Means, is the page in draft I cannot change anything on it. Therefore the following check methods are available:

String logonGuid="0904ABF0E43443D2881FE7481339650E";
String sessionKey="490EC675042F4C5A8A6DF1ED63ADD7A6";
String projectGuid="268F46EF5EB74A75824856D3DA1C6597";

CmsClient client = new CmsClient(logonGuid);
Project project = client.getProject(sessionKey, projectGuid);

Page currentPg = project.getPageById(“34009”);
currentPg.isInStateSavedAsDraft();
currentPg.isInStateSavedAsDraftNew();
currentPg.isInStateSavedAsDraftChanged();

currentPg.isInStateWaitingForCorrection();
currentPg.isInStateWaitingForRelease();
currentPg.isInStateReleased();

currentPg.isChangeable();
currentPg.getStateInfo();

The first method isInStateSavedAsDraft() is a simple combination of the both following savedAsDraft methods.

All of that methods look at the page state from a global point of view. The result of these methods did not depend on the pages the connected user has in his Tasks.

The method isChangeable() instead consider what pages the connect user has in workflow. Return isChangeable() true you are sure that the connected user can update the page. The currentPg is therefore in draft or globally released at all.

The last method getStateInfo() simply return a text describing the state in words.

 

Advertisements
Post a comment or leave a trackback: Trackback URL.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: