Class WebService

    • Constructor Summary

      Constructors 
      Constructor Description
      WebService()  
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      protected void assertNormalProject​(String objectId, String loggedInUser)
      Validates the given object id and throws an Exception if it does not represent a normal project.
      protected void assertProjectGroup​(String objectId, String loggedInUser)
      Validates the given object id and throws an Exception if it does not represent a project group.
      protected boolean canGiveFullUserDetails​(String username, String loggedInUser)
      Overloaded form to process `UserSoapRow'
      protected void checkGeneralPermission​(com.vasoftware.sf.server.types.Path path, com.vasoftware.sf.common.access.rbac.Operation operation, String loggedInUser)
      Check to see if the user has the specified permission, without doing any resource checking.
      protected void checkPermission​(com.vasoftware.sf.server.types.ObjectKey objectId, com.vasoftware.sf.common.access.rbac.Operation operation, com.vasoftware.sf.server.types.ProjectPath projectPath, String loggedInUser)
      Checks RBAC permission and throws an exception if permission is denied.
      protected void checkPermission​(com.vasoftware.sf.server.types.Path path, com.vasoftware.sf.common.access.rbac.Operation operation, String loggedInUser)
      Checks RBAC permission and throws an exception if permission is denied.
      protected void checkSiteWidePermission​(com.vasoftware.sf.common.access.rbac.Operation operation, String loggedInUser)
      Checks if the current user has the given site wide permission to perform the operation
      protected com.vasoftware.sf.server.types.UserSessionKey createUserSessionKey​(String username)
      Creates and returns user session key.
      protected javax.activation.DataHandler downloadFile​(com.vasoftware.sf.server.types.GuidKey fileKey, String loggedInUser)
      Downloads a file stored within the file storage.
      protected List<String> filterInvalidProjMembers​(String projectId, List<String> userNames, String loggedInUser)
      Filter Invalid Project Members from List of Given Users.
      protected String generateFolderName​(com.vasoftware.sf.server.types.FolderPath folderPath, String title, String loggedInUser)
      Generates unique folder name from title.
      protected static com.collabnet.ctf.access.service.AccessControlService getAccessControlService()
      Returns the Access Control Service
      protected com.collabnet.ctf.applicationregistry.service.ApplicationRegistryService getApplicationRegistryService()
      Gets the application registry service handle
      protected com.collabnet.ctf.attachment.service.AttachmentService getAttachment()
      Returns Attachment API handle.
      protected com.collabnet.ctf.authentication.service.AuthenticationService getAuthenticationService()
      Returns the Authentication Service
      protected com.collabnet.ctf.categorization.service.CategorizationService getCategorization()
      Returns the categorization API handle.
      protected com.collabnet.ctf.core.service.CoreService getCoreService()
      Returns the Core Service
      protected com.collabnet.ctf.discussion.service.DiscussionService getDiscussion()
      Returns the discussion API handle.
      protected com.collabnet.ctf.document.service.DocumentService getDocMan()
      Returns the DocumentService handle.
      protected com.vasoftware.sf.server.types.FolderPath getDocumentRootFolder​(String projectId, String loggedInUser)
      Returns the root document folder path.
      protected com.collabnet.ctf.filestorage.service.FileStorageService getFileStorageService()
      Returns the FileStorageService API handle.
      protected com.vasoftware.sf.server.types.FolderKey getFolderKey​(String folderId, String loggedInUser)
      Returns the folder key for the specified string.
      protected com.vasoftware.sf.server.types.FolderPath getFolderPath​(String folderId, com.vasoftware.sf.server.types.FolderType folderType, com.vasoftware.sf.server.types.FolderType appFolderType, String loggedInUser)
      Returns the path of the specified folder and verifies it to be of the specified type.
      protected com.vasoftware.sf.server.types.FolderPath getFolderPath​(String folderId, com.vasoftware.sf.server.types.FolderType folderType, String loggedInUser)
      Returns the path of the specified folder and verifies it to be of the specified type.
      protected com.vasoftware.sf.server.types.FolderPath getFolderPath​(String folderId, String loggedInUser)
      Returns the path of the specified folder.
      protected com.collabnet.ctf.frs.service.FrsService getFrs()
      Returns the frs API handle.
      protected com.collabnet.ctf.integrationdata.service.IntegrationDataService getIntegrationData()
      Returns the integration data API handle.
      protected com.vasoftware.sf.server.types.ItemPath getItemPath​(String itemId, com.vasoftware.sf.server.types.ItemType itemType, String loggedInUser)
      Returns the path of the specified item and verifies it to be of the specified type.
      protected com.vasoftware.sf.server.types.ItemPath getItemPath​(String itemId, String loggedInUser)
      Returns the path of the specified item.
      protected Locale getLocale​(String locale)
      Returns locale object from string specification.
      protected com.collabnet.ctf.monitoring.service.MonitoringService getMonitoring()
      Gets the monitoring service API handle
      protected com.collabnet.ctf.news.service.NewsService getNews()
      Returns the news API handle.
      protected Date getNulledMinSoapDate​(Date date)
      Return the date, but return null if it's the magic soap value that .net uses
      protected com.vasoftware.sf.server.types.ObjectKey getObjectKey​(String objectId, String loggedInUser)
      Returns an object's key object from the string id.
      protected com.vasoftware.sf.server.types.Path getObjectPath​(String objectId, String loggedInUser)
      Returns an object's path by its ID.
      protected com.vasoftware.sf.common.access.rbac.Operation getOperation​(String operationString, String idForPluggable, com.vasoftware.sf.server.types.UserSessionKey sessionKey)
      Gets Operation object from operation string.
      protected com.collabnet.ctf.page.service.PageService getPages()
      Returns the Pages API handle
      protected com.collabnet.ctf.planning.service.PlanningFolderService getPlanning()
      Returns the planning API handle.
      protected com.collabnet.ctf.pluggable.service.PluggableService getPluggableComponent()
      Returns the Pluggable data API handle.
      protected com.vasoftware.sf.server.types.ProjectKey getProjectId​(com.vasoftware.sf.server.types.ItemKey itemKey, String loggedInUser)
      Returns the project ID of an item for marshaling purposes.
      protected com.vasoftware.sf.server.types.ProjectPath getProjectPath​(com.vasoftware.sf.server.types.Path path)
      Obtains the project path from the given path.
      protected com.vasoftware.sf.server.types.ProjectPath getProjectPath​(String projectId, String loggedInUser)
      Returns the path of the specified project.
      protected com.collabnet.ctf.rbac.service.RBACService getRbac()
      Returns the integration data API handle.
      protected com.collabnet.ctf.search.service.SearchService getSearch()
      Returns the search API handle
      protected long getStoredFileSize​(com.vasoftware.sf.server.types.GuidKey fileKey, String loggedInUser)
      Returns the size of a stored file.
      protected String getStoredFileText​(com.vasoftware.sf.server.types.GuidKey fileKey, String loggedInUser)
      Returns the text content of a stored file.
      protected com.collabnet.ctf.tag.service.TagService getTagService()
      Gets the tag service API handle
      protected com.collabnet.ctf.team.service.TeamService getTeam()
      Returns the team API handle.
      protected com.collabnet.ctf.template.service.TemplateService getTemplate()
      Returns Template API handle.
      protected com.collabnet.ctf.tracker.service.TrackerService getTracker()
      Returns the tracker API handle.
      protected com.collabnet.ctf.common.services.user.UserService getUser()
      Returns the user API handle.
      protected com.vasoftware.sf.server.services.user.UserDO getUserData​(String username)
      Returns user data.
      protected String getUsername​(String oAuthToken)
      Gets username from OAuth token
      protected static com.collabnet.ctf.user.service.UserService getUserService()
      Returns the User Service
      protected com.collabnet.ctf.wiki.service.WikiService getWiki()
      Returns the wiki API handle.
      protected boolean hasPermission​(com.vasoftware.sf.server.types.ObjectKey objectId, com.vasoftware.sf.common.access.rbac.Operation operation, com.vasoftware.sf.server.types.ProjectPath projectPath, String loggedInUser)
      Checks RBAC permission.
      protected boolean hasSiteWidePermission​(com.vasoftware.sf.common.access.rbac.Operation operation, String loggedInUser)
      Checks if the current user has the given site wide permission to perform the operation
      protected static boolean isFolderResource​(String resourceName)
      Check if a resource is a folder resource
      protected boolean isProjectGroup​(String objectId, String loggedInUser)
      Checks if the specified object id is a project group id.
      protected boolean isProjectId​(String objectId)
      Checks if the specified object id is a project id.
      protected boolean isStrEmpty​(String s)
      Checks if the specified string is null or zero length.
      protected boolean isSuperUser​(String username)
      Checks if current user is a super-user.
      protected boolean isValidEmail​(String value)
      validates Email
      protected com.vasoftware.sf.server.services.filestorage.StoredFileDO[] makeStoredFileDO​(String fileName, String mimeType, String fileId, String loggedInUser)
      Prepare StoredFileDO object
      protected com.vasoftware.sf.server.services.filestorage.StoredFileDO[] makeStoredFileDOs​(AttachmentSoapDO[] attachmentFiles, String loggedInUser)
      Makes StoredFileDo's from Attachment List.
      protected void requireProjectAdminPermission​(String projectId, String loggedInUser)
      Checks to see if the currently logged in user is a user with project administrator edit permission.
      protected void setPartialOrFullUserData​(UserSoapList userSoapList, String loggedInUser)
      Overloaded form for processing `UserSoapList'
      protected void setUserNameToResponse​(String userName)
      Sets username to response header to get it recorded in access log
      protected com.vasoftware.sf.server.types.GuidKey storeFile​(String fileId, String loggedInUser)
      Stores uploaded file in the file storage.
      protected com.vasoftware.sf.server.types.GuidKey storeTextFile​(String text, String loggedInUser)
      Stores text as a file.
      protected void validateChoice​(String name, int[] choices, int value)
      Validates integer value to be one of the possible choices.
      protected void validateChoice​(String name, String[] choices, String value)
      Validates string to be one of the possible choices.
      protected void validateIconFile​(String iconFileName, String iconMimeType)
      Validates the icon fileName and mime type.
      protected void validateString​(String name, String value)
      Validates string to be non-null and non-empty.
      protected void validateStringArray​(String name, String[] values)
      Validates values in the string array to be non-null and non-empty.
      protected void validateStringWithTrim​(String name, String value)
      Validates string to be non-null and non-empty with ignoring white spaces at starting and ending of the string
      protected String validateTokenAndExactUsername​(String oAuthToken)
      Validates input OAuth token and returns username
      protected com.nimbusds.jwt.ReadOnlyJWTClaimsSet validateTokenAndExactUsername​(String oAuthToken, boolean triggerLicenseCheck)
      Validates input OAuth token and returns ReadOnlyJWTClaimsSet
      protected void validateWikiPageName​(String name, String value)
      Validates wiki page name to be conformant.
      protected void verifyLicense​(String oAuthToken)
      Make sure the license hasn't expired on the app server.
    • Constructor Detail

      • WebService

        public WebService()
    • Method Detail

      • checkPermission

        protected void checkPermission​(com.vasoftware.sf.server.types.Path path,
                                       com.vasoftware.sf.common.access.rbac.Operation operation,
                                       String loggedInUser)
                                throws InvalidSessionFault,
                                       PermissionDeniedFault,
                                       SystemFault
        Checks RBAC permission and throws an exception if permission is denied.
        Parameters:
        path - Path of the object.
        operation - Permission to check.
        loggedInUser - the logged in user
        Throws:
        InvalidSessionFault - when the sessionId is invalid.
        PermissionDeniedFault - when permission is denied for the specified operation.
        SystemFault - when an unexpected system error occurs.
      • checkPermission

        protected void checkPermission​(com.vasoftware.sf.server.types.ObjectKey objectId,
                                       com.vasoftware.sf.common.access.rbac.Operation operation,
                                       com.vasoftware.sf.server.types.ProjectPath projectPath,
                                       String loggedInUser)
                                throws InvalidSessionFault,
                                       PermissionDeniedFault,
                                       SystemFault
        Checks RBAC permission and throws an exception if permission is denied.
        Parameters:
        objectId - Path of the object.
        operation - Permission to check.
        projectPath - the path of the project that objectId is under
        loggedInUser - the logged in user
        Throws:
        InvalidSessionFault - when the sessionId is invalid.
        PermissionDeniedFault - when permission is denied for the specified operation.
        SystemFault - when an unexpected system error occurs.
      • checkGeneralPermission

        protected void checkGeneralPermission​(com.vasoftware.sf.server.types.Path path,
                                              com.vasoftware.sf.common.access.rbac.Operation operation,
                                              String loggedInUser)
                                       throws InvalidSessionFault,
                                              PermissionDeniedFault,
                                              SystemFault
        Check to see if the user has the specified permission, without doing any resource checking. This checks to see if the user has the specified operation in any of the roles in this project, without applying the context of an object with a resource
        Parameters:
        path - Path of the object.
        operation - Permission to check.
        loggedInUser - the logged in user
        Throws:
        InvalidSessionFault - when the sessionId is invalid.
        PermissionDeniedFault - when permission is denied for the specified operation.
        SystemFault - when an unexpected system error occurs.
      • hasPermission

        protected boolean hasPermission​(com.vasoftware.sf.server.types.ObjectKey objectId,
                                        com.vasoftware.sf.common.access.rbac.Operation operation,
                                        com.vasoftware.sf.server.types.ProjectPath projectPath,
                                        String loggedInUser)
                                 throws InvalidSessionFault,
                                        SystemFault
        Checks RBAC permission.
        Parameters:
        objectId - Path of the object.
        operation - Permission to check.
        projectPath - the path of the project that objectId is under
        loggedInUser - the logged in user
        Returns:
        true if the user has permission
        Throws:
        InvalidSessionFault - when the sessionId is invalid.
        SystemFault - when an unexpected system error occurs.
      • hasSiteWidePermission

        protected boolean hasSiteWidePermission​(com.vasoftware.sf.common.access.rbac.Operation operation,
                                                String loggedInUser)
                                         throws InvalidSessionFault,
                                                SystemFault
        Checks if the current user has the given site wide permission to perform the operation
        Parameters:
        operation -
        loggedInUser - the logged in user
        Returns:
        true if the user has the permission for the operation at Site-Wide scope false otherwise
        Throws:
        InvalidSessionFault - when the sessionId is invalid
        SystemFault - when an unexpected system error occurs
      • validateTokenAndExactUsername

        protected String validateTokenAndExactUsername​(String oAuthToken)
                                                throws InvalidSessionFault
        Validates input OAuth token and returns username
        Parameters:
        oAuthToken - the OAuth token
        Returns:
        the username
        Throws:
        InvalidSessionFault - when oauth token is invalid
      • validateTokenAndExactUsername

        protected com.nimbusds.jwt.ReadOnlyJWTClaimsSet validateTokenAndExactUsername​(String oAuthToken,
                                                                                      boolean triggerLicenseCheck)
                                                                               throws InvalidSessionFault
        Validates input OAuth token and returns ReadOnlyJWTClaimsSet
        Parameters:
        oAuthToken - the OAuth token
        triggerLicenseCheck - if true license check will be triggered
        Returns:
        Throws:
        InvalidSessionFault - when oauth token is invalid
      • verifyLicense

        protected void verifyLicense​(String oAuthToken)
                              throws InvalidSessionFault
        Make sure the license hasn't expired on the app server. If so, throw InvalidSessionFault
        Parameters:
        oAuthToken - Input OAuth Token
        Throws:
        InvalidSessionFault - if the license has expired on the appserver
      • setUserNameToResponse

        protected void setUserNameToResponse​(String userName)
        Sets username to response header to get it recorded in access log
        Parameters:
        userName - session username
      • createUserSessionKey

        protected com.vasoftware.sf.server.types.UserSessionKey createUserSessionKey​(String username)
                                                                              throws InvalidSessionFault
        Creates and returns user session key.
        Returns:
        User session key.
        Throws:
        InvalidSessionFault - when the username is invalid.
      • getUserData

        protected com.vasoftware.sf.server.services.user.UserDO getUserData​(String username)
        Returns user data.
        Parameters:
        username - the username
        Returns:
        user data
        Throws:
        com.collabnet.ctf.base.SfSystemException - when username cannot be found.
      • isSuperUser

        protected boolean isSuperUser​(String username)
        Checks if current user is a super-user.
        Parameters:
        username - the username
        Returns:
        true if user is a super-user, false otherwise.
        Throws:
        com.collabnet.ctf.base.SfSystemException - when username cannot be found.
      • getObjectKey

        protected com.vasoftware.sf.server.types.ObjectKey getObjectKey​(String objectId,
                                                                        String loggedInUser)
                                                                 throws InvalidSessionFault,
                                                                        NoSuchObjectFault
        Returns an object's key object from the string id.
        Parameters:
        objectId - String ID.
        loggedInUser - the logged in user
        Returns:
        Key instance.
        Throws:
        InvalidSessionFault - when the user session is invalid.
        NoSuchObjectFault - when the specified objectId is invalid.
      • getProjectPath

        protected com.vasoftware.sf.server.types.ProjectPath getProjectPath​(String projectId,
                                                                            String loggedInUser)
                                                                     throws InvalidSessionFault,
                                                                            NoSuchObjectFault
        Returns the path of the specified project.
        Parameters:
        projectId - Project id.
        loggedInUser - the logged in user
        Returns:
        Project path.
        Throws:
        InvalidSessionFault - when session is invalid (or not active).
        NoSuchObjectFault - when specified object id is invalid.
      • getProjectPath

        protected com.vasoftware.sf.server.types.ProjectPath getProjectPath​(com.vasoftware.sf.server.types.Path path)
        Obtains the project path from the given path.
        Parameters:
        path - the path for which the project path is to be obtained
        Returns:
        project path
      • getFolderPath

        protected com.vasoftware.sf.server.types.FolderPath getFolderPath​(String folderId,
                                                                          String loggedInUser)
                                                                   throws InvalidSessionFault,
                                                                          NoSuchObjectFault
        Returns the path of the specified folder.
        Parameters:
        folderId - Folder id.
        loggedInUser - the logged in user
        Returns:
        Folder path.
        Throws:
        InvalidSessionFault - when session is invalid (or not active).
        NoSuchObjectFault - when specified object id is invalid.
      • getFolderPath

        protected com.vasoftware.sf.server.types.FolderPath getFolderPath​(String folderId,
                                                                          com.vasoftware.sf.server.types.FolderType folderType,
                                                                          String loggedInUser)
                                                                   throws InvalidSessionFault,
                                                                          NoSuchObjectFault
        Returns the path of the specified folder and verifies it to be of the specified type.
        Parameters:
        folderId - Folder id.
        folderType - Folder type.
        loggedInUser - the logged in user
        Returns:
        Folder path.
        Throws:
        InvalidSessionFault - when session is invalid (or not active).
        NoSuchObjectFault - when specified object id is invalid.
      • getFolderPath

        protected com.vasoftware.sf.server.types.FolderPath getFolderPath​(String folderId,
                                                                          com.vasoftware.sf.server.types.FolderType folderType,
                                                                          com.vasoftware.sf.server.types.FolderType appFolderType,
                                                                          String loggedInUser)
                                                                   throws InvalidSessionFault,
                                                                          NoSuchObjectFault
        Returns the path of the specified folder and verifies it to be of the specified type.
        Parameters:
        folderId - Folder id.
        folderType - Folder type.
        appFolderType - Alternative application folder type.
        loggedInUser - the logged in user
        Returns:
        Folder path.
        Throws:
        InvalidSessionFault - when session is invalid (or not active).
        NoSuchObjectFault - when specified object id is invalid.
      • getFolderKey

        protected com.vasoftware.sf.server.types.FolderKey getFolderKey​(String folderId,
                                                                        String loggedInUser)
                                                                 throws InvalidSessionFault,
                                                                        NoSuchObjectFault
        Returns the folder key for the specified string.
        Parameters:
        folderId - Folder id.
        loggedInUser - the logged in user.
        Returns:
        Folder key object.
        Throws:
        InvalidSessionFault - when session is invalid (or not active).
        NoSuchObjectFault - when specified object id is invalid.
      • getItemPath

        protected com.vasoftware.sf.server.types.ItemPath getItemPath​(String itemId,
                                                                      com.vasoftware.sf.server.types.ItemType itemType,
                                                                      String loggedInUser)
                                                               throws InvalidSessionFault,
                                                                      NoSuchObjectFault
        Returns the path of the specified item and verifies it to be of the specified type.
        Parameters:
        itemId - Item id.
        itemType - Item Type.
        loggedInUser - the logged in user.
        Returns:
        Item path.
        Throws:
        InvalidSessionFault - when session is invalid (or not active).
        NoSuchObjectFault - when specified object id is invalid.
      • getObjectPath

        protected com.vasoftware.sf.server.types.Path getObjectPath​(String objectId,
                                                                    String loggedInUser)
                                                             throws InvalidSessionFault,
                                                                    NoSuchObjectFault
        Returns an object's path by its ID.
        Parameters:
        objectId - Id of the object whose path is needed.
        loggedInUser - the logged in user
        Returns:
        Path of the object.
        Throws:
        InvalidSessionFault - when session is invalid (or not active).
        NoSuchObjectFault - when specified object id is invalid.
      • isProjectId

        protected boolean isProjectId​(String objectId)
        Checks if the specified object id is a project id.
        Parameters:
        objectId - ID of the object to check.
        Returns:
        true if specified id is that of a project, false otherwise.
      • generateFolderName

        protected String generateFolderName​(com.vasoftware.sf.server.types.FolderPath folderPath,
                                            String title,
                                            String loggedInUser)
                                     throws InvalidSessionFault,
                                            SystemFault
        Generates unique folder name from title. If no unique name can be generated, or if the title contains any characters outside the Unicode "Basic Latin" character set, this method returns null.
        Parameters:
        folderPath - Parent folder path.
        title - Title from which to generate unique folder name.
        loggedInUser - the logged in user
        Returns:
        Unique folder name, or null if one cannot be generated.
        Throws:
        InvalidSessionFault - when session is invalid (or not active).
        SystemFault - when a system level error occurs.
      • isStrEmpty

        protected boolean isStrEmpty​(String s)
        Checks if the specified string is null or zero length.
        Parameters:
        s - String to check.
        Returns:
        true if string is null or zero length, false otherwise.
      • storeTextFile

        protected com.vasoftware.sf.server.types.GuidKey storeTextFile​(String text,
                                                                       String loggedInUser)
                                                                throws InvalidSessionFault,
                                                                       SystemFault
        Stores text as a file.
        Parameters:
        text - Text to store.
        loggedInUser - the logged in user
        Returns:
        Stored file key.
        Throws:
        InvalidSessionFault - when session is invalid (or not active).
        SystemFault - when a system level error occurs.
      • storeFile

        protected com.vasoftware.sf.server.types.GuidKey storeFile​(String fileId,
                                                                   String loggedInUser)
                                                            throws InvalidSessionFault,
                                                                   NoSuchObjectFault,
                                                                   SystemFault
        Stores uploaded file in the file storage. Uploaded files are initially in the temporary storage.
        Parameters:
        fileId - File id from temporary store.
        loggedInUser - the logged in user
        Returns:
        Stored file key.
        Throws:
        InvalidSessionFault - when session is invalid (or not active).
        SystemFault - when a system level error occurs.
        NoSuchObjectFault - when the specified file id is invalid.
      • getStoredFileSize

        protected long getStoredFileSize​(com.vasoftware.sf.server.types.GuidKey fileKey,
                                         String loggedInUser)
                                  throws InvalidSessionFault,
                                         SystemFault
        Returns the size of a stored file.
        Parameters:
        fileKey - Key to stored file.
        loggedInUser - the logged in user
        Returns:
        File size in bytes.
        Throws:
        InvalidSessionFault - when session is invalid (or not active).
        SystemFault - when a system level error occurs.
      • getStoredFileText

        protected String getStoredFileText​(com.vasoftware.sf.server.types.GuidKey fileKey,
                                           String loggedInUser)
                                    throws InvalidSessionFault,
                                           SystemFault
        Returns the text content of a stored file.
        Parameters:
        fileKey - Key to stored file.
        loggedInUser - the logged in user
        Returns:
        File content as text string.
        Throws:
        InvalidSessionFault - when session is invalid (or not active).
        SystemFault - when a system level error occurs.
      • downloadFile

        protected javax.activation.DataHandler downloadFile​(com.vasoftware.sf.server.types.GuidKey fileKey,
                                                            String loggedInUser)
                                                     throws InvalidSessionFault,
                                                            SystemFault
        Downloads a file stored within the file storage.
        Parameters:
        fileKey - Stored file key.
        loggedInUser - the logged in user
        Returns:
        Data for SOAP download.
        Throws:
        InvalidSessionFault - when session is invalid (or not active).
        SystemFault - when a system level error occurs.
      • getDocumentRootFolder

        protected com.vasoftware.sf.server.types.FolderPath getDocumentRootFolder​(String projectId,
                                                                                  String loggedInUser)
                                                                           throws NoSuchObjectFault,
                                                                                  InvalidSessionFault
        Returns the root document folder path.
        Parameters:
        projectId - Project id.
        loggedInUser - the logged in user.
        Returns:
        Root document folder path.
        Throws:
        NoSuchObjectFault - when the specified project id is invalid.
        InvalidSessionFault - when there is no active session.
      • getTemplate

        protected com.collabnet.ctf.template.service.TemplateService getTemplate()
        Returns Template API handle.
        Returns:
        Template API handle.
      • getPages

        protected com.collabnet.ctf.page.service.PageService getPages()
        Returns the Pages API handle
        Returns:
        pages API handle
      • getPlanning

        protected com.collabnet.ctf.planning.service.PlanningFolderService getPlanning()
        Returns the planning API handle.
        Returns:
        PlanningFolderService Planning folder service instance
      • getTracker

        protected com.collabnet.ctf.tracker.service.TrackerService getTracker()
        Returns the tracker API handle.
        Returns:
        Tracker API handle.
      • getAttachment

        protected com.collabnet.ctf.attachment.service.AttachmentService getAttachment()
        Returns Attachment API handle.
        Returns:
        Attachment API handle.
      • getCoreService

        protected com.collabnet.ctf.core.service.CoreService getCoreService()
        Returns the Core Service
        Returns:
        the core service
      • getUserService

        protected static com.collabnet.ctf.user.service.UserService getUserService()
        Returns the User Service
        Returns:
        the user service instance
      • getAuthenticationService

        protected com.collabnet.ctf.authentication.service.AuthenticationService getAuthenticationService()
        Returns the Authentication Service
        Returns:
        the Authentication service
      • getAccessControlService

        protected static com.collabnet.ctf.access.service.AccessControlService getAccessControlService()
        Returns the Access Control Service
        Returns:
        the AccessControlService instance
      • getTeam

        protected com.collabnet.ctf.team.service.TeamService getTeam()
        Returns the team API handle.
        Returns:
        Team API handle.
      • getUser

        protected com.collabnet.ctf.common.services.user.UserService getUser()
        Returns the user API handle.
        Returns:
        User API handle.
      • getDocMan

        protected com.collabnet.ctf.document.service.DocumentService getDocMan()
        Returns the DocumentService handle.
        Returns:
        DocumentService handle.
      • getFileStorageService

        protected com.collabnet.ctf.filestorage.service.FileStorageService getFileStorageService()
        Returns the FileStorageService API handle.
        Returns:
        FileStorageService API handle.
      • getWiki

        protected com.collabnet.ctf.wiki.service.WikiService getWiki()
        Returns the wiki API handle.
        Returns:
        Wiki API handle.
      • getSearch

        protected com.collabnet.ctf.search.service.SearchService getSearch()
        Returns the search API handle
        Returns:
        Search API handle
      • getDiscussion

        protected com.collabnet.ctf.discussion.service.DiscussionService getDiscussion()
        Returns the discussion API handle.
        Returns:
        Discussion API handle.
      • getNews

        protected com.collabnet.ctf.news.service.NewsService getNews()
        Returns the news API handle.
        Returns:
        News API handle.
      • getFrs

        protected com.collabnet.ctf.frs.service.FrsService getFrs()
        Returns the frs API handle.
        Returns:
        Frs API handle.
      • getCategorization

        protected com.collabnet.ctf.categorization.service.CategorizationService getCategorization()
        Returns the categorization API handle.
        Returns:
        Categorization API handle.
      • getIntegrationData

        protected com.collabnet.ctf.integrationdata.service.IntegrationDataService getIntegrationData()
        Returns the integration data API handle.
        Returns:
        integration data API handle.
      • getRbac

        protected com.collabnet.ctf.rbac.service.RBACService getRbac()
        Returns the integration data API handle.
        Returns:
        integration data API handle.
      • getMonitoring

        protected com.collabnet.ctf.monitoring.service.MonitoringService getMonitoring()
        Gets the monitoring service API handle
        Returns:
        monitoring service implementation
      • getApplicationRegistryService

        protected com.collabnet.ctf.applicationregistry.service.ApplicationRegistryService getApplicationRegistryService()
        Gets the application registry service handle
        Returns:
        monitoring service implementation
      • getTagService

        protected com.collabnet.ctf.tag.service.TagService getTagService()
        Gets the tag service API handle
        Returns:
        tag service implementation
      • validateString

        protected void validateString​(String name,
                                      String value)
                               throws IllegalArgumentFault
        Validates string to be non-null and non-empty.
        Parameters:
        name - Parameter name.
        value - Parameter value.
        Throws:
        IllegalArgumentFault - when the specified argument is invalid (empty or null)
      • validateStringWithTrim

        protected void validateStringWithTrim​(String name,
                                              String value)
                                       throws IllegalArgumentFault
        Validates string to be non-null and non-empty with ignoring white spaces at starting and ending of the string
        Parameters:
        name - Parameter name.
        value - Parameter value.
        Throws:
        IllegalArgumentFault - when the specified argument is invalid (empty or null)
      • validateStringArray

        protected void validateStringArray​(String name,
                                           String[] values)
                                    throws IllegalArgumentFault
        Validates values in the string array to be non-null and non-empty.
        Parameters:
        name - Parameter name.
        values - Parameter array of value.
        Throws:
        IllegalArgumentFault - when the specified argument is invalid (empty or null)
      • validateWikiPageName

        protected void validateWikiPageName​(String name,
                                            String value)
                                     throws IllegalArgumentFault
        Validates wiki page name to be conformant.
        Parameters:
        name - Parameter name.
        value - Parameter value (wiki page name).
        Throws:
        IllegalArgumentFault - when the specified argument is invalid.
      • validateChoice

        protected void validateChoice​(String name,
                                      String[] choices,
                                      String value)
                               throws IllegalArgumentFault
        Validates string to be one of the possible choices.
        Parameters:
        name - Parameter name.
        choices - Value choices.
        value - Parameter value.
        Throws:
        IllegalArgumentFault - when the specified value is not a valid choice.
      • validateChoice

        protected void validateChoice​(String name,
                                      int[] choices,
                                      int value)
                               throws IllegalArgumentFault
        Validates integer value to be one of the possible choices.
        Parameters:
        name - Parameter name.
        choices - Value choices.
        value - Parameter value.
        Throws:
        IllegalArgumentFault - when the specified value is not a valid choice.
      • validateIconFile

        protected void validateIconFile​(String iconFileName,
                                        String iconMimeType)
                                 throws IllegalArgumentFault
        Validates the icon fileName and mime type.
        Parameters:
        iconFileName - the name of the icon file
        iconMimeType - the mime-type of the icon file
        Throws:
        IllegalArgumentFault - thrown if given arguements are invalid
      • getLocale

        protected Locale getLocale​(String locale)
                            throws IllegalArgumentFault
        Returns locale object from string specification.
        Parameters:
        locale - Locale string.
        Returns:
        Locale object.
        Throws:
        IllegalArgumentFault - when specified locale is invalid.
      • getNulledMinSoapDate

        protected Date getNulledMinSoapDate​(Date date)
        Return the date, but return null if it's the magic soap value that .net uses
        Parameters:
        date - the date
        Returns:
        the date, or null if magic
      • getProjectId

        protected com.vasoftware.sf.server.types.ProjectKey getProjectId​(com.vasoftware.sf.server.types.ItemKey itemKey,
                                                                         String loggedInUser)
                                                                  throws InvalidSessionFault,
                                                                         com.collabnet.ctf.common.exceptions.NoSuchObjectException
        Returns the project ID of an item for marshaling purposes.
        Parameters:
        itemKey - Item key.
        loggedInUser - the logged in user.
        Returns:
        Item's project key.
        Throws:
        InvalidSessionFault - when the session is invalid.
        com.collabnet.ctf.common.exceptions.NoSuchObjectException - when the specified item id is invalid.
      • isFolderResource

        protected static boolean isFolderResource​(String resourceName)
        Check if a resource is a folder resource
        Parameters:
        resourceName - The name of the resource to check
        Returns:
        If the resource is a folder resource TODO: determine if it is a folder resource in a better way, using a service call and the resource type
      • assertNormalProject

        protected void assertNormalProject​(String objectId,
                                           String loggedInUser)
                                    throws InvalidSessionFault,
                                           NoSuchObjectFault
        Validates the given object id and throws an Exception if it does not represent a normal project.
        Parameters:
        objectId - ID of the object to check.
        loggedInUser - the logged in user
        Throws:
        NoSuchObjectFault - when the specified object id is invalid or does not represent a project.
        InvalidSessionFault - when there is no active session.
      • isProjectGroup

        protected boolean isProjectGroup​(String objectId,
                                         String loggedInUser)
                                  throws InvalidSessionFault,
                                         NoSuchObjectFault
        Checks if the specified object id is a project group id.
        Parameters:
        objectId - ID of the object to check.
        loggedInUser - the logged in user
        Returns:
        true if specified id is that of a project group, false otherwise.
        Throws:
        NoSuchObjectFault - when the specified object id is invalid.
        InvalidSessionFault - when there is no active session.
      • assertProjectGroup

        protected void assertProjectGroup​(String objectId,
                                          String loggedInUser)
                                   throws InvalidSessionFault,
                                          NoSuchObjectFault
        Validates the given object id and throws an Exception if it does not represent a project group.
        Parameters:
        objectId - The id of the object to check.
        loggedInUser - the logged in user.
        Throws:
        NoSuchObjectFault - when the specified object id is invalid or does not represent a project group.
        InvalidSessionFault - when there is no active session.
      • isValidEmail

        protected boolean isValidEmail​(String value)
        validates Email
        Parameters:
        value - email value
        Returns:
        boolean true or false
      • canGiveFullUserDetails

        protected boolean canGiveFullUserDetails​(String username,
                                                 String loggedInUser)
                                          throws InvalidSessionFault,
                                                 SystemFault
        Overloaded form to process `UserSoapRow'
        Parameters:
        username - username to check
        loggedInUser - the logged in user
        Returns:
        boolean return true if the given user can see full user details, false otherwise.
        Throws:
        InvalidSessionFault - when session is invalid
        SystemFault - when something wrong happened
      • getOperation

        protected com.vasoftware.sf.common.access.rbac.Operation getOperation​(String operationString,
                                                                              String idForPluggable,
                                                                              com.vasoftware.sf.server.types.UserSessionKey sessionKey)
                                                                       throws IllegalArgumentException,
                                                                              com.vasoftware.sf.server.services.application.NoSuchOperationException
        Gets Operation object from operation string.
        Parameters:
        operationString - The string representation of the operation. This should be in the format objectTypeName.operationCategory.operationName. For a list of operation strings for various object types, see OperationConstants interface. For integrated application, this should be in the format PluggableLink.plugid.permission_name.permission_name or PluggableLink.permission_name.permission_name.
        idForPluggable - Link id of the pluggable-project link or plug id for pluggable object. Required only when operationString is in the format PluggableLink.permission_name.permission_name.
        sessionKey - sessionKey of the user. Required only when operationString is in the format PluggableLink.permission_name.permission_name.
        Returns:
        Operation object
        Throws:
        IllegalArgumentException - If the operationString is in an invalid format
        com.vasoftware.sf.server.services.application.NoSuchOperationException - If specified operation doesn't exist
      • filterInvalidProjMembers

        protected List<String> filterInvalidProjMembers​(String projectId,
                                                        List<String> userNames,
                                                        String loggedInUser)
                                                 throws InvalidSessionFault,
                                                        com.collabnet.ctf.common.exceptions.NoSuchObjectException
        Filter Invalid Project Members from List of Given Users.
        Parameters:
        projectId - projectId.
        userNames - List of user names.
        loggedInUser - the logged in user
        Throws:
        InvalidSessionFault - when session is invalid
        com.collabnet.ctf.common.exceptions.NoSuchObjectException - when the specified item id is invalid.
      • getPluggableComponent

        protected com.collabnet.ctf.pluggable.service.PluggableService getPluggableComponent()
        Returns the Pluggable data API handle.
        Returns:
        pluggable data API handle.