Get all records in contentstatushistory via IPSContentWs.findRevisions()

I’m writing a custom itemfilter to fix a publishing issue. The itemfilter needs to look at past revisions for the last revision that was ever in a certain workflow state, and if so use that revision. I am trying to figure out a way to get a list of workflow state ids that the item was in during the lifetime of the revision.

For that to work I need all the records for an item in the contentstatushistory table. However, the way I’m getting revisions for an item is only showing me the first contentstatushistory record for a revision. Any ideas for another way to get the entire content status history?

Here’s a summary/part of the code:

IPSContentWs contentWebService = PSContentWsLocator.getContentWebservice();
List<PSRevisions> revisionsList = contentWebService.findRevisions(guidList);				
if (revisionsList != null && revisionsList.size() > 0) {			
	PSRevisions revisions = revisionsList.get(0);
	List<PSContentStatusHistory> contentStatusHistoryList = revisions.getRevisions();
	for (PSContentStatusHistory contentStatusHistory : contentStatusHistoryList) {
		log.debug("Previous Revision Id: " + contentStatusHistory.getRevision());
		log.debug("Previous Revision State: " + contentStatusHistory.getStateName());	
		log.debug("Workflow STate id: " + contentStatusHistory.getStateId());
	}
}

The debug shows that there’s only one PSContentStatusHistory item for each revision, which holds the values of the first (oldest) contentstatushistory record in the DB for that revision.

Anyone have any ideas for a different way to get the full content status history?

Thanks,
Brian

Looks like the constructor for PSRevisions is filtering the list of contentstatushistory objects returned to only keep the first for each revision.
PSSystemService.findContentStatusHistory() is what’s being called by the content web service to find revisions before they get filtered. I’m going to try that unless anyone has any other suggestions.

[QUOTE=bhwilliamson;20491]Looks like the constructor for PSRevisions is filtering the list of contentstatushistory objects returned to only keep the first for each revision.
PSSystemService.findContentStatusHistory() is what’s being called by the content web service to find revisions before they get filtered. I’m going to try that unless anyone has any other suggestions.[/QUOTE]

That will return all of the revisions for the item, sorted asc by the CONTENTSTATUSHISTORYID.

Something like:

import com.percussion.services.system.PSSystemServiceLocator;

IPSSystemService sysSvc = PSSystemServiceLocator.getSystemService();


List<PSContentStatusHistory> histList = sysSvc.findContentStatusHistory(guid);

Should give you what you need.

-n

That does the trick, thanks!