Sign in

E-mail *, (xx@domain.com)
Password *

Register | Forgot password

Blogs

  • Bram de Kruijff
  • Ivo Ladage
  • Mark van Cuijk
  • Martin van Mierloo
  • Martijn van Berkum
  • Michel Teunissen
  • Patrick Atoon

Recent blogs

RSS - Blogs
March 9, 2010
State of OSGi in the Java world
March 4, 2010
Reach more people with Google Translate
March 3, 2010
Get My Advice
February 26, 2010
What? Where!?!
February 11, 2010
Split it!

All Blogs...


9.7 API additions

January 21, 2009

Well, it’s been too long since my last (first) blog so it's time for me to add some knowledge ;)


As you all may know, GX Webmanager 9.7 is about to be released. It’s not for me to brag about all nice new features and functionality we add with 9.7 but I do want to tell you a bit more about one in particular: The developers’ API.

There are different ‘types’ of API’s you can make use of as a GX Webmanager developer. It’s all java but they do have a different purpose hence the distinction.

  • The JSP API you use to get the content in your pages using JSTL
  • The WCB API you have to adhere to when building each type of Webmanager Component Bundle (WCB)
  • The Content API that allows you the manipulate content stored within GX Webmanager equal to what an editor could do manually

GX Webmanager 9.7.x will specifically add features to both the JSP- and the Content API even though the JSP one wasn’t deliberate but more a side effect of the notification framework also being added in WM 9.7.x

So what will be added?

  • Getters and Setters on all (well.. almost all..) direct properties of PageVersion and MediaItemVersion including settings the DiscussionConfiguration for a MediaItemVersion
  • Getters for all attributes of almost all elements (the side effect I mentioned before...)
  • Workflow manipulation for PageVersion and MediaItemVersion
  • Setters on TextElement and ImageElement

These additions are useful when you want or need to create pages and/or mediaitems with basic content on them from within a WCB.

Examples:

  • Let a webuser post some text and pictures via a form and create a mediaitem, set the metadata of that mediaitem, including leadimage and add text and images to the content after which you set the mediaitems’ state to public or whatever other state you want.
  • Write a Service – WCB – that migrates content from the old site and create pages with basic content on it.

 

Have a look at the following classes that form the cornerstones:

  • PageManagementService
  • MediaRepositoryManagementService
  • ElementManagementService
  • PageVersion
  • MediaItemVersion

 

Workflow

The Workflow isn’t that straightforward since it makes use of the workflow capabilities supported by the underlying model that are hidden from the regular editor.

Let’s assume we’d want to set the workflow state of somePageVersion to one of the public ones’:

PageVersion somePageVersion = somePage.getCurrent();
somePageVersion.getWorkflowModelInstance();
WorkflowActivityInstance[] activityInstances = somePageVersion.getWorkflowModelInstance().getActivityInstances();
for (WorkflowActivityInstance activityInstance: activityInstances) {
  WorkflowAction[] actions = activityInstance.getActivity().getActions();
  for (WorkflowAction action: actions) {
    if (action.getState().isPublic()) {
      try {
        pageService.performWorkflowAction(somePageVersion,action);
      } catch (UnExecutableWorkflowActionException e) {
        LOG.severe("Oops", e.getMessage(), e);
      }
    }
  }
}

As you might suspect, we’re not finished with the API yet. In the ideal world you would be able to everything an editor can do via the API but that’s not true yet, so stay tuned ;)

PS. For those of you that don’t know yet, the API doc can be found at http://api.gxdeveloperweb.com


To be continued..

About the Author

Return to all blogs

Michel Teunissen

Michel is Professional Services Architect and is known for his unique approach to complex problems. Michel writes about both conceptual topics such as his interpretation of CMS Zen Garden and Thesaurus, to the more complex technical implementation topics.

Read all Michels blog entries

Other blog entries:

March 6, 2008
Zengarden & WCM


Share:

del.icio.us
digg
Technorati
Slashdot
Reddit
YahooMyWeb
NewsVine
ekudos
© 2010 GX creative online development B.V.

Disclaimer

This website (GXdeveloperweb.com) may discuss or contain opinions, (sample) coding, software or other information that does not include GX official interfaces, instructions or guidelines and therefore is not supported by GX. Changes made based on this information are not supported.  GX will not be held liable for any damages caused by using or misusing the information, software, instructions, code or methods suggested on this website, and anyone using these methods does so at his/her own risk. GX offers no guarantees and assumes no responsibility or liability of any type with respect to the content of this website, including any liability resulting from incompatibility between the content of this website and the materials and services offered by GX. By using this website you will not hold, or seek to hold, GX responsible or liable with respect to the content of this website.