Package com.polarion.alm.projects
Interface IProjectService
public interface IProjectService
The root service to manage projects. This component provides ways
to create, modify and delete projects.
In some environments, project creation and deletion might not be
supported, because they are controlled by other means. If so, the
getLifecycleManager()
will return null
.
- Author:
- dobisekm
-
Method Summary
Modifier and TypeMethodDescriptionint
countProjects
(String query) int
countUsers
(String query) createUser
(String loginName) Creates the new instance of theIUser
temporary object.createUserGroup
(String id, String name) Creates a new instance of theIUserGroup
temporary object.void
deleteUser
(IUser user) Deletes the given user instance.ConsultsISecurityService
to identify the User ID executing this code and transforms the ID into the (unresolved)IUser
object.The base data service instance used by the IProjectService.getGroupEntityForContextId
(IContextId contextId) Similar togetGroupEntityAtLocation(ILocation)
, but returns the entity even if the given location lies inside that entity.Deprecated.getProject
(String projectId) Returns the project located at the given location.getProjectForContextId
(IContextId contextId) Returns theIProject
representing the given context or null if the context represents a project Group.Returns the project Group located at the given location.getProjectGroupForContextId
(IContextId contextId) Returns theIProjectGroup
representing the given context or null if the context represents a project.getProjectGroupForPath
(String projectGroupPath) Returns theIProjectGroup
, that contains the location.Returns the project Group that contains the given location.Returns the project located at or above a given location.getProjectUsers
(IProject project) Returns the user with the given ID.getUserAvatarURL
(String userId) Returns a user avatar image URL.getUserGroup
(String userGroupId) Returns the User Group with the given ID.getUsers()
getUsersNotInProject
(IProject project) hasBeenModifiedSince
(String revision) Useful for the invalidation of some project caches.ldap()
Constructs the LDAP synchronization flow builder.
Polarion supports multiple LDAP configurations, defined in theauthentication.xml
file.login()
Create a login flow builderDeprecated.Since 3.21.1 please uselogin()
andILogin.IUsingAuthenticator.with(com.polarion.platform.security.login.IPassword)
loginWithToken
(String token, String source) Deprecated.Since 3.21.1 please uselogin()
andILogin.IUsingAuthenticator.with(com.polarion.platform.security.login.IToken)
searchProjects
(String query) searchProjects
(String query, String sort) searchProjectUsers
(IProject project, String query, String sort) searchUserGroups
(String query, String sort, int resultLimit) Searches for User Groups matching the query.searchUsers
(String query) searchUsers
(String query, String sort)
-
Method Details
-
getDataService
IDataService getDataService()The base data service instance used by the IProjectService.- Returns:
- the
IDataService
used by this service.
-
createUser
Creates the new instance of theIUser
temporary object. The instance is not persistent until the save method is invoked.- Parameters:
loginName
-- Returns:
- the new
IUser
instance.
-
deleteUser
Deletes the given user instance.- Parameters:
user
-
-
getUser
Returns the user with the given ID.- Returns:
- the unresolved IPObject with the given ID. The operation is
performed using only the IDs, so there is no guarantee that such a
user actually exists and will be resolvable. Never returns
null
.
-
getUserAvatarURL
Returns a user avatar image URL. Can be the user's uploaded image, a reference to an external image or the default image. The URL may be absolute, or relative to the portal's base URL. The user can be unresolvable, or not yet persisted. The user ID can also be null.- Parameters:
userId
- ID of a user ornull
- Returns:
- avatar URL, never
null
- Since:
- 3.6.0
-
getCurrentUser
IUser getCurrentUser()ConsultsISecurityService
to identify the User ID executing this code and transforms the ID into the (unresolved)IUser
object.Note: the resulting
IUser
is not guaranteed to be resolvable.- Returns:
- the current user or
null
if there is no subject executing this code.
-
getUsers
- Returns:
- a list of everyone registered in the system
IUser
-
getProjectUsers
- Parameters:
project
-- Returns:
- a list of project users
IUser
-
getUsersNotInProject
- Parameters:
project
-- Returns:
- a list of users that do not belong to a specified project
IUser
In other words it returns a list of all users except the users returned by getProjectUsers().
-
searchProjectUsers
- Returns:
- a list of users found in the project
IUser
. It is significantly slower than getProjectUsers, so use it only when needed.
-
searchUsers
- Returns:
- a list of all users found in the system.
IUser
-
searchUsers
- Returns:
- list of all users found in the system
IUser
-
countUsers
- Returns:
- the number of users matching the given query. This should
be faster than
searchUsers(query).size()
- See Also:
-
getRootProjectGroup
IProjectGroup getRootProjectGroup() -
searchProjects
-
searchProjects
-
countProjects
- Returns:
- the number of projects matching the given query. This should
be faster than
searchProjects(query).size()
- See Also:
-
getLifecycleManager
IProjectLifecycleManager getLifecycleManager()- Returns:
- the project life cycle manager or
null
if life cycle management is not supported in this environment.
-
getProject
- Returns:
- the unresolved IPObject with the given ID. The operation is
performed with just the IDs, so there is no guarantee that such a
project really exists and will be resolvable. Never returns
null
. - Throws:
IllegalArgumentException
- if projectId isnull
-
getGroupEntityAtLocation
Returns theIGroupEntity
(aIProject
orIProjectGroup
), that exactly matches the given location. Returnsnull
if the location does not match any Group entity (even if it lies INSIDE of the entity).- Parameters:
loc
- The Location, might benull
(= root Group).- See Also:
-
getGroupEntityOwningLocation
Similar togetGroupEntityAtLocation(ILocation)
, but returns the entity even if the given location lies inside that entity.- Parameters:
loc
- the Location, might benull
(= root Group).- Returns:
- the Group entity owning the location.
Never returns
null
, since even a completely nonexistent location is still owned by the ROOT Group. - See Also:
-
getGroupEntityForContextId
- Parameters:
contextId
-- Returns:
IGroupEntity
(aIProject
orIProjectGroup
), never returnsnull
.- Throws:
IllegalArgumentException
- if thecontextId
isnull
or no such context exists.- See Also:
-
getProjectAtLocation
Returns the project located at the given location. Returns null if the location does not map to a project or if it maps toIProjectGroup
.- Parameters:
loc
- the Location. Might benull
(= root group).- Returns:
- the project or
null
- See Also:
-
getProjectOwningLocation
Returns the project located at or above a given location. Returnsnull
if the location lies inside (inclusive) of a project.- Parameters:
loc
- the Location, might benull
(= root Group).- Returns:
- the project or
null
- See Also:
-
getProjectForContextId
Returns theIProject
representing the given context or null if the context represents a project Group.- Parameters:
contextId
-- Returns:
IProject
ornull
.- Throws:
IllegalArgumentException
- if thecontextId
isnull
or no such context exists.- See Also:
-
getProjectGroupAtLocation
Returns the project Group located at the given location. Returnsnull
if the location does not map to a project group. (For example, if it maps to a project).- Parameters:
loc
- the Location, might benull
(= root group).- Returns:
- the project Group or
null
- See Also:
-
getProjectGroupOwningLocation
Returns the project Group that contains the given location. Even if the location lies inside the project in this Group, the Group is still returned.- Parameters:
loc
- the Location, might benull
(= root Group).- Returns:
- the project Group. Never returns
null
, since all locations are owned by the Root Group. - See Also:
-
getProjectGroupForContextId
Returns theIProjectGroup
representing the given context or null if the context represents a project.- Parameters:
contextId
-- Returns:
IProjectGroup
ornull
.- Throws:
IllegalArgumentException
- if thecontextId
isnull
or no such context exists.- See Also:
-
getProjectGroupForPath
Returns theIProjectGroup
, that contains the location. created from the givenpath
. Even if the location lies inside the project in this Group, the Group is still returned.- Parameters:
path
- the Group path to create the appropriate location.- Returns:
- the project Group. Never returns
null
, since all locations are owned by the Root Group. - Since:
- 3.10.1
- See Also:
-
getLDAPUserSynchronization
Deprecated.Since 3.20.1 usegetLdapUsersSynchronization()
. -
getLdapUsersSynchronization
- Since:
- 3.20.1
-
getLdapUserGroupSynchronization
- Since:
- 3.20.1
-
ldap
Constructs the LDAP synchronization flow builder.
Polarion supports multiple LDAP configurations, defined in theauthentication.xml
file. These configurations can be used for user and group synchronizations.
For more information about theauthentication.xml
file, see the "Authentication guide" section in Polarion's Help.
This method must be used instead ofgetLDAPUserSynchronization()
,getLdapUsersSynchronization()
,getLdapUserGroupSynchronization()
, if Polarion is configured to work with multiple LDAP configurations.- Returns:
- synchronization process flow builder
- Since:
- 3.21.1
-
login
@Deprecated Subject login(String userId, String credentials, String source) throws AuthenticationFailedException, LoginDeniedException Deprecated.Since 3.21.1 please uselogin()
andILogin.IUsingAuthenticator.with(com.polarion.platform.security.login.IPassword)
A user object with the given ID must exist for a successful login. It can however be auto-created as a part of the call of this method. (If auto-creation is configured appropriately). Must NOT be called within a transaction.
Requires only one configured authentication provider. If more than one is configured, use the method with authenticatorId parameter- Parameters:
userId
-credentials
-source
-- Returns:
- authenticated subject (not
null
) - Throws:
IllegalStateException
- if Polarion is configured to use more than one authentication provider.AuthenticationFailedException
LoginDeniedException
-
loginWithToken
@Deprecated @NotNull Subject loginWithToken(@NotNull String token, @NotNull String source) throws AuthenticationFailedException Deprecated.Since 3.21.1 please uselogin()
andILogin.IUsingAuthenticator.with(com.polarion.platform.security.login.IToken)
Logs in the user with SASL security
To have Teamcenter Security Services (TCSS) log in with a token, you need to first use the following method to create a Base64 encoded tokenTcssToken.create(String, String)
.
For SAML, a token should be passed as is. For SPNEGO/Kerberos or OAuth2 it should be encoded using theBase64
Requires only one configured authentication provider. If more than one is configured, use the method with authenticatorId parameter- Parameters:
token
- the token used for validation. Cannot benull
. The token must be encoded using theBase64
encoding scheme.source
- the login source (e.g. "portal/IP" or "system") - Used only for logging.- Returns:
- Authenticated subject (not
null
). - Throws:
AuthenticationFailedException
- If the given token is not valid or if the user does not exist in the system and auto-creation is not enabled. It also throws an exception if a user does not have sufficient permissions to log in.IllegalArgumentException
- If themechanism
,token
orsource
arenull
.IllegalStateException
- if Polarion is configured to use more than one authentication provider.- Since:
- 3.17.0
-
login
Create a login flow builder- Returns:
- new login flow builder
- Since:
- 3.21.1
-
hasBeenModifiedSince
Useful for the invalidation of some project caches. Inspired by the if-modified-since feature of the http protocol.- Parameters:
revision
- the last revision seen by the client. (The revision of its cached data), ornull
if not known.- Returns:
null
if data in the related projects has not been changed, or a new revision of project related data signals that the client has to invalidate its caches.- Since:
- 3.7.3
-
getUserGroup
Returns the User Group with the given ID.- Returns:
- the unresolved
IPObject
with the given ID. The operation is performed using only the IDs, so there is no guarantee that such a User Group exists and will be resolvable. Never returnsnull
. - Since:
- 3.19.3
-
getUserGroups
- Returns:
- a list of all User Groups in the system.
- Since:
- 3.19.3
-
searchUserGroups
@NotNull IPObjectList<IUserGroup> searchUserGroups(@Nullable String query, @Nullable String sort, int resultLimit) Searches for User Groups matching the query.- Parameters:
query
-sort
-resultLimit
- The maximum size of the returned list. A negative number means that there is no limit.- Returns:
- a
IPObjectList
containing the result of the query. - Since:
- 3.19.3
- See Also:
-
createUserGroup
Creates a new instance of theIUserGroup
temporary object. The instance is not persistent until the save method is invoked.- Returns:
- a new
IUserGroup
instance. - Since:
- 3.19.3
-
getLdapUsersSynchronization()
.