Class Control

java.lang.Object
com.pathomation.Control

public class Control extends Object
Wrapper class around PMA.control API
  • Constructor Details

    • Control

      public Control()
  • Method Details

    • setDebugFlag

      public static void setDebugFlag(boolean flag)
      This method is used to determine whether the Java SDK runs in debugging mode or not. When in debugging mode (flag = true), extra output is produced when certain conditions in the code are not met
      Parameters:
      flag - Debugging mode (activated or deactivated)
    • getVersionInfo

      public static String getVersionInfo(String pmaControlURL)
      This method is used to get version info from PMA.control instance running at pmacontrolURL
      Parameters:
      pmaControlURL - PMA Control's URL
      Returns:
      Version information
    • formatTrainingSessionProperly

      public static Map<String,Object> formatTrainingSessionProperly(org.json.JSONObject session)
      Helper method to convert a JSON representation of a PMA.control training session to a proper Java-esque structure
      Parameters:
      session - Session details
      Returns:
      Map of formatted session information
    • getTrainingSessionsForParticipant

      public static Map<Integer,Map<String,Object>> getTrainingSessionsForParticipant(String pmaControlURL, String participantUsername, String pmaCoreSessionID)
      This method is used to get sessions for a certain participant
      Parameters:
      pmaControlURL - URL for PMA.Control
      participantUsername - PMA.core username
      pmaCoreSessionID - PMA.core session ID
      Returns:
      Map of sessions for a certain participant
    • getTrainingSessionParticipants

      public static Map<String,org.json.JSONObject> getTrainingSessionParticipants(String pmaControlURL, Integer pmaControlTrainingSessionID, String pmaCoreSessionID)
      This method is used to extract the participants in a particular session
      Parameters:
      pmaControlURL - URL for PMA.Control
      pmaControlTrainingSessionID - Training session ID
      pmaCoreSessionID - PMA.core session ID
      Returns:
      Map of participants in a particular session
    • isParticipantInTrainingSession

      public static Boolean isParticipantInTrainingSession(String pmaControlURL, String participantUsername, Integer pmaControlTrainingSessionID, String pmaCoreSessionID)
      This method is used to check if a specific user participates in a specific session
      Parameters:
      pmaControlURL - URL for PMA.Control
      participantUsername - PMA.core username
      pmaControlTrainingSessionID - Training session ID
      pmaCoreSessionID - PMA.core session ID
      Returns:
      True if a specific user participates in a specific session, false otherwise.
    • getTrainingSessionURL

      public static String getTrainingSessionURL(String pmaControlURL, String participantSessionID, String participantUsername, Integer pmaControlTrainingSessionID, Integer pmaControlCaseCollectionID, String pmaCoreSessionID) throws Exception
      Parameters:
      pmaControlURL - URL for PMA.Control
      participantSessionID - The participant's session ID to allow for eventual impersonation
      participantUsername - participant username
      pmaControlTrainingSessionID - Training session ID
      pmaControlCaseCollectionID - Case collection ID
      pmaCoreSessionID - PMA.core session ID, the administrative session ID to verify that the participant is registered for the training session
      Returns:
      Session's URL
      Throws:
      Exception - If participantUsername isn't registred for this session
    • getAllParticipants

      public static Map<String,Map<Integer,String>> getAllParticipants(String pmaControlURL, String pmaCoreSessionID)
      This method is used to get all participants registered across all sessions
      Parameters:
      pmaControlURL - PMA.control URL
      pmaCoreSessionID - PMA.core session ID
      Returns:
      Map of all participants registered across all sessions
    • registerParticipantForTrainingSession

      public static String registerParticipantForTrainingSession(String pmaControlURL, String participantUsername, Integer pmaControlTrainingSessionID, Control.PmaTrainingSessionRole pmaControlRole, String pmaCoreSessionID)
      This method is used to register a participant for a session, assign a specific role
      Parameters:
      pmaControlURL - PMA.control URL
      participantUsername - PMA.core username
      pmaControlTrainingSessionID - Training session ID
      pmaControlRole - Role
      pmaCoreSessionID - PMA.core session ID
      Returns:
      URL connection output in JSON format
    • registerParticipantsForProject

      public static String registerParticipantsForProject(String pmaControlURL, String participantUsername, Integer pmaControlProjectID, Control.PmaTrainingSessionRole pmaControlRole, String pmaCoreSessionID, Integer pmaControlInteractionMode)
      This method is used to register a participant for all sessions in a given project, assigning a specific role
      Parameters:
      pmaControlURL - PMA.control URL
      participantUsername - PMA.core username
      pmaControlProjectID - Project's ID
      pmaControlRole - Role
      pmaCoreSessionID - PMA.core session ID
      pmaControlInteractionMode - The interaction mode to use
      Returns:
      List of all sessions in a project that the participant was registered to
    • getCaseCollectionTrainingSessionID

      public static Integer getCaseCollectionTrainingSessionID(String pmaControlURL, Integer pmaControlTrainingSessionID, Integer pmaControlCaseCollectionID, String pmaCoreSessionID)
      This method is a helper to obtain internal technical keys that link training sessions with case collections
      Parameters:
      pmaControlURL - PMA.control URL
      pmaControlTrainingSessionID - Training session ID
      pmaControlCaseCollectionID - Case collection ID
      pmaCoreSessionID - PMA.core session ID
      Returns:
      Identifier caseCollectionTrainingSessionID
    • setParticipantInteractionMode

      public static String setParticipantInteractionMode(String pmaControlURL, String participantUsername, Integer pmaControlTrainingSessionID, Integer pmaControlCaseCollectionID, Integer pmaControlInteractionMode, String pmaCoreSessionID) throws Exception
      This method is an overload of previous one. We created to add the possibility to assign an interaction mode outside the defined enum values
      Parameters:
      pmaControlURL - PMA.control URL
      participantUsername - PMA.core username
      pmaControlTrainingSessionID - Training session ID
      pmaControlCaseCollectionID - Case collection ID
      pmaControlInteractionMode - Interaction mode
      pmaCoreSessionID - PMA.core session ID
      Returns:
      URL connection output in JSON format
      Throws:
      Exception - If user is NOT registered in the provided PMA.control training session
    • getTrainingSessionTitles

      public static List<String> getTrainingSessionTitles(String pmaControlURL, Integer pmaControlProjectID, String pmaCoreSessionID, String sessionTitle)
      This method is used to retrieve sessions (possibly filtered by project ID), titles only
      Parameters:
      pmaControlURL - URL for PMA.Control
      pmaControlProjectID - Project's ID
      pmaCoreSessionID - PMA.core session ID
      sessionTitle - An optional session title filter
      Returns:
      List of session titles
    • getTrainingSessionTitlesDict

      public static Map<Integer,String> getTrainingSessionTitlesDict(String pmaControlURL, Integer pmaControlProjectID, String pmaCoreSessionID, String sessionTitle)
      This method is used to retrieve (training) sessions (possibly filtered by project ID), returns a map of session IDs and titles
      Parameters:
      pmaControlURL - URL for PMA.Control
      pmaControlProjectID - Project's ID
      pmaCoreSessionID - PMA.core session ID
      sessionTitle - an optional session title filter
      Returns:
      Map of session IDs and titles
    • getTrainingSessions

      public static Map<Integer,Map<String,Object>> getTrainingSessions(String pmaControlURL, Integer pmaControlProjectID, String pmaCoreSessionID)
      This method is used to retrieve (training) sessions (possibly filtered by project ID)
      Parameters:
      pmaControlURL - URL for PMA.Control
      pmaControlProjectID - Project's ID
      pmaCoreSessionID - PMA.core session ID
      Returns:
      Map of session IDs and titles
    • getTrainingSessionsViaProject

      public static Map<Integer,Map<String,Object>> getTrainingSessionsViaProject(String pmaControlURL, Integer pmaControlProjectID, String pmaCoreSessionID, String sessionTitle)
      This method is used to retrieve (training) sessions (possibly filtered by project ID)
      Parameters:
      pmaControlURL - URL for PMA.Control
      pmaControlProjectID - Project's ID
      pmaCoreSessionID - PMA.core session ID
      sessionTitle - An optional session title filter
      Returns:
      Map of session IDs and titles
    • getTrainingSession

      public static Map<String,Object> getTrainingSession(String pmaControlURL, Integer pmaControlTrainingSessionID, String pmaCoreSessionID)
      This method is used to get the first (training) session with ID = pmaControlTrainingSessionID
      Parameters:
      pmaControlURL - URL for PMA.Control
      pmaControlTrainingSessionID - Training session's ID
      pmaCoreSessionID - PMA.core session ID
      Returns:
      First training session with ID = pmacontrolTrainingSessionID
    • searchTrainingSession

      public static Map<String,Object> searchTrainingSession(String pmaControlURL, String keyword, String pmaCoreSessionID)
      This method is used to return the first (training) session that has keyword as part of its string; search is case insensitive
      Parameters:
      pmaControlURL - URL for PMA.Control
      keyword - key word to search against
      pmaCoreSessionID - PMA.core session ID
      Returns:
      Map of the first (training) session whose title matches the search criteria
    • getCaseCollections

      public static Map<Integer,org.json.JSONObject> getCaseCollections(String pmaControlURL, Integer pmaControlProjectID, String pmaCoreSessionID)
      This method is used to retrieve case collection details that belong to a specific project
      Parameters:
      pmaControlURL - URL for PMA.Control
      pmaControlProjectID - Project's ID
      pmaCoreSessionID - PMA.core session ID
      Returns:
      Map of case collection details
    • getCaseCollectionTitles

      public static List<String> getCaseCollectionTitles(String pmaControlURL, Integer pmaControlProjectID, String pmaCoreSessionID)
      This method is used to retrieve case collections (possibly filtered by project ID), titles only
      Parameters:
      pmaControlURL - URL for PMA.Control
      pmaControlProjectID - Project's ID
      pmaCoreSessionID - PMA.core session ID
      Returns:
      List of case collections titles
    • getCaseCollectionByTitle

      public static org.json.JSONObject getCaseCollectionByTitle(String pmaControlURL, String pmaCoreSessionID, String caseCollectionTitle)
      This method is used to get a case collection by its title
      Parameters:
      pmaControlURL - URL for PMA.Control
      pmaCoreSessionID - PMA.core session ID
      caseCollectionTitle - The case collection's title
      Returns:
      The case collection in json object format
    • getCaseCollectionTitlesDict

      public static Map<Integer,String> getCaseCollectionTitlesDict(String pmaControlURL, Integer pmaControlProjectID, String pmaCoreSessionID)
      This method is used to retrieve case collections (possibly filtered by project ID), returns a map of case collection IDs and titles
      Parameters:
      pmaControlURL - URL for PMA.Control
      pmaControlProjectID - Project's ID
      pmaCoreSessionID - PMA.core session ID
      Returns:
      Map of case collection IDs and titles
    • getCaseCollection

      public static org.json.JSONObject getCaseCollection(String pmaControlURL, Integer pmaControlCaseCollectionID, String pmaCoreSessionID)
      This method is used to get a case collection details (by ID)
      Parameters:
      pmaControlURL - URL for PMA.Control
      pmaControlCaseCollectionID - Case collection's ID
      pmaCoreSessionID - PMA.core session ID
      Returns:
      The case collection in json object format
    • getCaseForCaseCollection

      public static org.json.JSONArray getCaseForCaseCollection(String pmaControlURL, Integer pmaControlCaseCollectionID, String pmaCoreSessionID)
      This method is used to retrieve cases for a specific collection
      Parameters:
      pmaControlURL - PMA.control URL
      pmaControlCaseCollectionID - Case collection ID
      pmaCoreSessionID - PMA.core session ID
      Returns:
      List of cases for a specific collection
    • searchCaseCollection

      public static org.json.JSONObject searchCaseCollection(String pmaControlURL, String keyword, String pmaCoreSessionID)
      This method is used to return the first collection that has keyword as part of its string; search is case insensitive
      Parameters:
      pmaControlURL - URL for PMA.Control
      keyword - Keyword to seach collections against
      pmaCoreSessionID - PMA.core session ID
      Returns:
      The first collection that matches the search criteria
    • getProjects

      public static Map<Integer,org.json.JSONObject> getProjects(String pmaControlURL, String pmaCoreSessionID)
      This method is used to retrieve project details for all projects
      Parameters:
      pmaControlURL - URL for PMA.Control
      pmaCoreSessionID - PMA.core session ID
      Returns:
      Map of project details for all projects
    • getProjectTitles

      public static List<String> getProjectTitles(String pmaControlURL, String pmaCoreSessionID)
      This method is used to retrieve the projects then returns exclusively their titles
      Parameters:
      pmaControlURL - URL for PMA.Control
      pmaCoreSessionID - PMA.core session ID
      Returns:
      List of projects' titles
    • getProjectTitlesDict

      public static Map<Integer,String> getProjectTitlesDict(String pmaControlURL, String pmaCoreSessionID, String title)
      This method is used to retrieve projects then returns a map of project-IDS and titles
      Parameters:
      pmaControlURL - URL for PMA.Control
      pmaCoreSessionID - PMA.core session ID
      title - Optional title filter
      Returns:
      Map of project-IDs and titles
    • getProject

      public static Map<String,Object> getProject(String pmaControlURL, Integer pmaControlProjectID, String pmaCoreSessionID)
      This method is used to get a project details (project defined by its ID)
      Parameters:
      pmaControlURL - URL for PMA.Control
      pmaControlProjectID - Project's ID
      pmaCoreSessionID - PMA.core session ID
      Returns:
      Map of the project's details
    • getProjectByCaseID

      public static Map<String,Object> getProjectByCaseID(String pmaControlURL, Integer pmacontrolCaseID, String pmaCoreSessionID)
      This method is used to retrieve project based on the case ID
      Parameters:
      pmaControlURL - URL for PMA.Control
      pmacontrolCaseID - Case's ID
      pmaCoreSessionID - PMA.core session ID
      Returns:
      Map of the project details
    • getProjectByCaseCollectionID

      public static Map<String,Object> getProjectByCaseCollectionID(String pmaControlURL, Integer pmacontrolCaseCollectionID, String pmaCoreSessionID)
      This method is used to retrieve project based on the case collection ID
      Parameters:
      pmaControlURL - URL for PMA.Control
      pmacontrolCaseCollectionID - Case collection's ID
      pmaCoreSessionID - PMA.core session ID
      Returns:
      Map of the project details
    • searchProjects

      public static List<Map<String,Object>> searchProjects(String pmaControlURL, String keyword, String pmaCoreSessionID)
      This method is used to get the projects whose title matches a certain keyword search pattern
      Parameters:
      pmaControlURL - URL for PMA.Control
      keyword - Keyword to seach projects against
      pmaCoreSessionID - PMA.core session ID
      Returns:
      List of Maps of projects whose title matches the search criteria
    • setParticipantInteractionModeCaseCollection

      public static String setParticipantInteractionModeCaseCollection(String pmaControlURL, String participantUsername, Integer pmaControlTrainingSessionID, int[] pmaControlCaseCollectionIDs, Integer pmaControlInteractionMode, String pmaCoreSessionID) throws Exception
      This method is used to a ssign an interaction mode to a particpant for an array of Case Collections within a training session
      Parameters:
      pmaControlURL - PMA.control URL
      participantUsername - PMA.core username
      pmaControlTrainingSessionID - Training session ID
      pmaControlCaseCollectionIDs - Array of Case collection IDs
      pmaControlInteractionMode - Interaction mode
      pmaCoreSessionID - PMA.core session ID
      Returns:
      URL connection output in JSON format
      Throws:
      Exception - If user is NOT registered in the provided PMA.control training session
    • setParticipantInteractionModeInBatch

      public static String setParticipantInteractionModeInBatch(String pmaControlURL, String participantUsername, List<Map<String,Object>> trainingSessions, Integer pmaControlInteractionMode, String pmaCoreSessionID) throws Exception
      This method is used to assign an interaction mode to a particpant for training sessions in batch mode
      Parameters:
      pmaControlURL - PMA.control URL
      participantUsername - PMA.core username
      trainingSessions - Training sessions
      pmaControlInteractionMode - Interaction mode
      pmaCoreSessionID - PMA.core session ID
      Returns:
      URL connection output in JSON format
      Throws:
      Exception - If user is NOT registered in the provided PMA.control training session