com.polarion.platform.persistence.IDataService


FIELDS
Modifiers and TypeNameDescription
String ID_INVALID_CHARS
METHODS
Modifiers and TypeNameDescription
boolean isValidId(String) Test if a given string is a valid ID (primary key) for the PObject. Must not have leading or trailing white spaces or contain {@link #ID_INVALID_CHARS} characters.
IPrototype getPrototype(String) This is a shortcut for calling the prototype service.
ICustomFieldsService getCustomFieldsService()
ICalculatedFieldsService getCalculatedFieldsService()
IObjectHierarchyProvider getObjectHierarchyProvider()
IQueryHelper getQueryHelper()
IEventManager getEventManager()
IPObjectList searchInstances(IPrototype,String,String) Searches for objects of the given type matching the query. A shortcut for

searchInstances(proto.getName(), query, sort);

Note: In general, the searching does not preserve inheritance. In other words, if Proto2 extends Proto1, then searching for Proto1 does not return the instances of Proto2.

IPObjectList searchInstances(IPrototype,String,String,int) Searches for objects of the given type matching the query. A shortcut for

searchInstances(proto.getName(), query, sort, resultLimit);

Note: In general, the searching does not preserve inheritance. In other words, if Proto2 extends Proto1, then searching for Proto1 does not return the instances of Proto2.

IPObjectList searchInstances(String,String,String) Searches the objects in the given index. In a typical case, the index name corresponds to the prototype name, however, there can be some additional indices defined, that don't correspond to a particular prototype.
IPObjectList searchInstancesInBaseline(String,String,String,String) Searches the objects in the given index from a given revision. In a typical case, the index name corresponds to the prototype name, however, there can be some additional indices defined, that don't correspond to a particular prototype.
IPObjectList searchInstances(String,String,String,int) Searches the objects in the given index. Only first resultLimit items are returned if there are more objects found.

In a typical case, the index name corresponds to the prototype name, however, there can be some additional indices defined, that don't correspond to a particular prototype.

IPObjectList searchInstancesInBaseline(String,String,String,int,String) Searches the objects in the given index from a given revision. Only first resultLimit items are returned if there are more objects found.

In a typical case, the index name corresponds to the prototype name, however, there can be some additional indices defined, that don't correspond to a particular prototype.

IPObjectList<T> sqlSearch(String) Searches the persistent objects by executing the specified SQL-query in the database for the current revision.

You can also use {@link #search()} . {@link IObjectsSearch#database() database()} . {@link IDatabaseSearch#instancesInBaseline(String,String) instances(String)} for the same purpose. SQL searches should only be used for advanced querying/counting when joins and the other SQL-capabilities, that cannot be achieved using Lucene queries, are needed. In other cases the {@link IDataService} 's search/count methods that work with Lucene queries are preferred. For example, {@link IDataService#searchInstances(String,String,String)} , {@link IDataService#getInstancesCount(String,String)} , etc.

IPObjectList<T> sqlSearchInBaseline(String,String) Searches the persistent objects by executing the specified SQL-query in the database for the specified revision. *

You can also use {@link #search()} . {@link IObjectsSearch#database() database()} . {@link IDatabaseSearch#instancesInBaseline(String,String) instancesInBaseline(String, String)} for the same purpose. SQL searches should only be used for advanced querying/counting when joins and the other SQL-capabilities, that cannot be achieved using Lucene queries, are needed. In other cases the {@link IDataService} 's search/count methods that work with Lucene queries are preferred. For example, {@link IDataService#searchInstances(String,String,String)} , {@link IDataService#getInstancesCount(String,String)} , etc.

IObjectsSearch search() Returns an instance of {@link IObjectsSearch} that allows for the search and count of the persistent objects in various secondary data sources.
int getInstancesCount(String,String) Returns the count of instances for a query.
int getInstancesCount(IPrototype,String) Returns the instances count for a query.
IPObject getInstance(SubterraURI) Returns an instance of the correct type for the given URI. The object is unresolved and it is not guaranteed that it exists.
IPObject getInstance(IObjectId) Returns an instance of the correct type for the object id.
IPObjectList getInstances(List)
IPObject createInstance(String) Creates the new instance of the given prototype. The object is not yet persistent and an attempt to read its ID or to link it to other objects (e.g. otherObject.setXXX(created) will result in an exception. Performing the save operation on the object will create the object persistently and makes its ID readable.
void save(IPObject)
void save(IPObjectList) Only the instances with {@link IPObject#isModified()} == true are saved. Instances that are not resolved are ignored. Instances, that did not exist before, are created.
void resolve(IPObject) Resolves the IPObject with data from the server. If the object is already resolved, it does nothing.
void resolve(IPObjectList) A more efficient way for resolving more objects at once, than to resolve each one individually.
void delete(IPObject)
void delete(IPObjectList)
ITypedList createCollectionForKey(IPObject,String,List) Creates an instance of a collection object, corresponding to the model definition. Use the dot notation, if the collection is under another structure or collection (e.g. mystructure.substructure).
ITypedList createCollectionForTypeId(IPObject,String,List) Creates the instance of the list object, that corresponds to the model definition.
IStructure createStructureForKey(IPObject,String,Map) Creates the instance of the structure object, that corresponds to the model definition. Use the dot notation, if the structure is under another structure or collection (e.g. mystructure.substructure).
IStructure createStructureForTypeId(IPObject,String,Map) Creates the instance of a structure object, that corresponds to the model definition.
IEnumeration getEnumerationForKey(String,String,IContextId) Returns the instance of the enum factory, that handles the enumeration for a given key.

Use the dot notation, if the enum is under a structure or collection (e.g. mystructure.substructure).

This is a shortcut for determining the enum ID and then calling {@link #getEnumerationForEnumId(IEnumType,IContextId)}

IEnumeration getEnumerationForEnumId(IEnumType,IContextId) Returns the enumeration for a given enumeration type.
Map getEnumerationObjectFactories() Returns a map of all enumeration object factories
Set getConstantEnumerationIds() Returns a set of constant enumeration IDs. It does NOT contain enumerations that can be modified in Administration.
IPObject getObjectFromEnumOption(IEnumOption) Returns the IPObject instance from the given IEnumOption if it exists.
IPObjectList<T> getObjectHistory(T) Returns the whole history of the a given object, in the form of its versioned objects. The objects in the returned collection are not resolved and the client should be able to handle the situation, when not all objects in the history are resolvable.

The history list is sorted from the oldest (first) to the newest (last).

An empty list is returned if the object does not support history retrieval.

IPObject getVersionedInstance(SubterraURI,String) Returns a versioned object for the given uri and revision.

The object may be unresolvable.

IPObject getVersionedInstance(IObjectId,String) Returns a versioned object for the given uri and revision.

The object may be unresolvable.

IPrototype getPrototypeFromObjectURI(SubterraURI) Returns the prototype that the uri of the given object belongs to. For example if its a passed uri of some work item, then it returns the WorkItem prototype.

public, SubterraURI getSubterraURIForObjectId(IObjectId) Return SubterraURI for given object id. Reverse method to {@link #getObjectIdForSubterraURI(SubterraURI)}
public, IObjectId getObjectIdForSubterraURI(SubterraURI) Reverse method to {@link #getSubterraURIForObjectId(IObjectId)}
public, Object adapt(IPObject,Class) Adapts the given IPObject to the instance of the given target class. Returns null if such an adaptation is not supported.
public, Class[] getSupportedTargetClasses(String) Even if the adaptation is possible for the given prototype in general, it can still be impossible for a particular instance.
public, IDiffManager getDiffManager()
public, IPersistencePolicy getPersistencePolicy()
ISecurityService getSecurityService() Shortcut method to get the platform security service.
IRevision getRevision(IContextId,String) Same as {@link #getRevision(String,String)} , but the repository name is determined from the context.
IRevision getRevision(String,String) Same as {@link #getRevision(IContextId,String)} , but the revision.
IRevision getLastStorageRevision() This method should be used instead of {@link IRepositoryReadOnlyConnection#getCurrentRepositoryState()} in use cases related to the model objects (i.e. the ones returned by {@link #getInstance(IObjectId)} )
IRevision getStorageRevisionAt(Date) This method should be used instead of {@link IRepositoryReadOnlyConnection#getRepositoryState(Date)} in use cases related to the model objects (i.e. the ones returned by {@link #getInstance(IObjectId)} )
IRevision getValidRevisionInBaseline(String)
IRevision getPreviousStorageRevision(String) This method should be used instead of {@link IRepositoryReadOnlyConnection#getPreviousState(String)} in use cases related to the model objects (i.e. the ones returned by {@link #getInstance(IObjectId)} )
void objectsChanged(Collection) Causes the objects with the given uris being refreshed in the cache and index. This method is especially meant for derived fields providers, who should call this method whenever the derived fields change (because of external events) to notify persistence about this change.

The clients should be aware, that the method is likely to take a long time (depending on the number of uris to process).

void clearCaches() Clear all object and document caches in the system. (Works for the whole cluster in cluster setup.)
void clearCaches(Collection) For given uris, clear all object and document caches in the system.
void clearCaches(Collection,boolean) For given uris, clear all object and document caches in the system.
void clearCaches(String) For a given node in a cluster, clear all object and document caches in the system.
T doInBaseline(String,RunnableWEx) Executes code in the given runnable, inside the baseline context.
T doOutsideBaseline(RunnableWEx)
String getCurrentBaselineRevision()
String getLastRevisionCommitedByCurrentThread()
void refreshEnumerations(IContextId) Refreshes enumerations (stored in the database) in a given project. If contextId is null, refreshes enumerations in all projects.
int getInstancesCountInBaseline(String,String,String) Searches the count of objects in the given index from a given revision. In a typical case, the index name corresponds to the prototype name, however, there can be some additional indices defined, that don't correspond to a particular prototype.

Back to Index