extension using loadItem reports exception

I am implementing java extension to implements IPSWorkflowAction. This extension is invoked by CMS Server at the transition on a reminder date set for the content item.

At the performAction(), I am able to get the content id, state id etc…

Now, In order to read certain content item fields, I am doing a loaditem like this…

              initServices();
	 IPSGuid cid = gmgr.makeGuid(new PSLocator(contentId));
	 List<IPSGuid> glist = Collections.<IPSGuid>singletonList(cid);
	 List<PSCoreItem> items = cmgr.loadItems(glist, true, false, false,false);

where initServices() is

gmgr = PSGuidManagerLocator.getGuidMgr();
                   cmgr = PSContentWsLocator.getContentWebservice();

I get exception for the loadItems

An internal error (end-condition) was encountered. An unexpected exception occurred:
An unexpected exception occurred. The reason was: An exception occurred while pr
ocessing the internal request handler call: java.lang.IllegalStateException: No
user name set in current request information. Please consult the log for further
information…
The call-stack was:
com.percussion.data.PSInternalRequestCallException: An exception occurred while
processing the internal request handler call: java.lang.IllegalStateException: N
o user name set in current request information
at com.percussion.cms.handlers.PSWorkflowCommandHandler.makeInternalRequest(Unknown Source)
at com.percussion.cms.handlers.PSContentEditorHandler.makeInternalRequest(Unknown Source)
at com.percussion.server.PSInternalRequest.Ò00000(Unknown Source)
at com.percussion.server.PSInternalRequest.performUpdate(Unknown Source)

    at com.percussion.server.agent.PSAging.makeInternalRequest(Unknown Source)
    at com.percussion.server.agent.PSAging.transitionItem(Unknown Source)
    at com.percussion.server.agent.PSAging.run(Unknown Source)
    at java.util.TimerThread.mainLoop(Unknown Source)
    at java.util.TimerThread.run(Unknown Source)

According to API Recommendations, we should do

List<PSCoreItem> items = cws.loadItems(glist, true, false, false, false, session, user);

However, when I try to use this, it says this is deprecated. Also, what is the user/session in workflow action case?

Thanks,
Rajesh

Rajesh,

You may want to look into changing your code to use the ContentManager service instead of the Content WebService. There is a method of accessing information from the item by using the findItemsByGUID method of the IPSContentMgr Interface. This will return the item node and you’ll have access to the desired field values and may not the User/Session issues (loadItems makes some internal requests which might be causing you trouble).

There’s a locator for the Content Web service which can be accessed by using :

cmgr = PSContentMgrLocator.getContentWebservice();

Let me know if this helps.

M

Hi Michael,

Thank you for the response. However, I had already tried this earlier and found two issues

  1. when I iterate through all the properties, I only can see system fields and not any of the local fields. I wrote following code…
PSContentMgrConfig pconfig = new PSContentMgrConfig();
            	 
            	 pconfig.addOption(PSContentMgrOption.PROCESS_FIELDS);
            	 
            	 items = cmgr.findItemsByGUID(glist, pconfig);
            	 
            	 PropertyIterator piterator = items.get(0).getProperties();
            	 
            	 while (piterator.hasNext())
            		 System.out.println("Property: " + piterator.nextProperty());           	 
              items.get(0).checkout();
            	 items.get(0).setProperty("rx:sys_title", "Updated Content");
            	 items.get(0).checkin();
            	 
  1. I also want to update the content item. So, when I do checkout(), I get unsupported operation…

14:46:32,140 INFO [STDOUT] javax.jcr.UnsupportedRepositoryOperationException: Not supported
14:46:32,140 INFO [STDOUT] at com.percussion.services.contentmgr.data.PSContentNode.checkout(Unknown Source)

Were you able to resolve this issue?
I am running into a similar issue…