PSLocator constructor revisions

There is a PSLocator constructor which only takes the content id.

public PSLocator(int id)

Convenience constructor {#link PSLocator(int, int)} with an undefined revision. The revision of the constructed object is default to -1 and it is also default to persisted.

What revision does it uses? Does it defaults to the most recent revision or something else?

This is explained in the API Recommendations document.

When the revision is unspecified, there is no revision. It’s NOT the same as when the latest revision is specified.

I am trying to find the owners for a content item. I am building the guid id for the content item using both the content id, and the revision id.

To the findOwners() method I am passing the load operation flag as false, and the Relationship filter as NULL.

However, the result that is returned contains a list of owners which are both current as well as past ones. This is causing problems for us, as we do not want old parents to show up in the list.

Is there anyway to limit the result set to only have the current owners?

manvinder

You need to pass a Relationship Filter (as the last parameter).

Set the limitToEditOrCurrentOwnerRevision flag to “true”.

When I pass the RelationshipFilter, I am getting Null pointer exception.
This is my method:

private List<PSItemSummary> getOwners(IPSGuid guid) throws PSErrorException {
PSRelationshipFilter filter = new PSRelationshipFilter();
filter.setName(“findCurrentParents”);
filter.limitToEditOrCurrentOwnerRevision(true);
filter.setCategory(“rs_activeassembly”);
System.out.println(“finding the owners”);
List<PSItemSummary> result = cws.findOwners(guid, filter, false);
return result;
}

The Null Pointer Exception is coming as:

The call-stack was:
java.lang.NullPointerException
at com.percussion.webservices.content.impl.PSContentWs.setFilterByAaCategorysIfNeeded(Unknown Source)
at com.percussion.webservices.content.impl.PSContentWs.findOwners(Unknown Source)

thanks
Manvinder

The Name that you pass to setName() must be the name of a valid relationship type that is configured in your system. Almost certainly, you do NOT need this parameter at all.

Thanks Dave…how do we configure this name in the system?

You can find the “Relationship Type name” from Workbench, in “System Design”, under “Relationship Types” node