CommcareCaseService¶
-
public interface
CommcareCaseService
¶ This service provides two main features: Interacting with CommCareHQ’s programmatic case APIs and uploading case XML wrapped in a form instance to CommCareHQ.
Methods¶
getCaseByCaseId¶
-
CaseInfo
getCaseByCaseId
(String caseId, String configName)¶ Query CommCareHQ for a case by its case id.
Parameters: - caseId – the id of the case on CommCareHQ
- configName – the name of the configuration used for connecting to CommcareHQ, null means default configuration
Returns: the CaseInfo object representing the state of the case or null if that case does not exist.
getCaseByCaseId¶
-
CaseInfo
getCaseByCaseId
(String caseId)¶ Same as
getCaseByCaseId
but uses default Commcare configuration.
getCases¶
-
List<CaseInfo>
getCases
(Integer pageSize, Integer pageNumber, String configName)¶ Query CommCareHQ for all cases of a given page.
Parameters: - pageSize – the size of the page
- pageNumber – the number of the page
- configName – the name of the configuration used for connecting to CommcareHQ, null means default configuration
Returns: the list of CaseInfo objects representing cases of the given page found on the given CommcareHQ configuration
getCases¶
getCasesByCasesNameAndTimeWithMetadata¶
-
CasesInfo
getCasesByCasesNameAndTimeWithMetadata
(String caseName, String dateModifiedStart, String dateModifiedEnd, Integer pageSize, Integer pageNumber, String configName)¶ Query CommCareHQ for all cases of a given case name, date modified range, page and cases metadata.
Parameters: - caseName – the case name of case on CommCareHQ
- dateModifiedStart – the start of the date range
- dateModifiedEnd – the end of the date range
- pageSize – the size of the page
- pageNumber – the number of the page
- configName – the name of the configuration used for connecting to CommcareHQ, null means default configuration
Returns: the CasesInfo wrapper, containing CaseInfo objects and case metadata from CommCareHQ
getCasesByCasesNameAndTimeWithMetadata¶
getCasesByCasesNameWithMetadata¶
-
CasesInfo
getCasesByCasesNameWithMetadata
(String caseName, Integer pageSize, Integer pageNumber, String configName)¶ Query CommCareHQ for all cases of a given case name, page and cases metadata.
Parameters: - caseName – the case name of case on CommCareHQ
- pageSize – the size of the page
- pageNumber – the number of the page
- configName – the name of the configuration used for connecting to CommcareHQ, null means default configuration
Returns: the CasesInfo wrapper, containing CaseInfo objects and case metadata from CommCareHQ
getCasesByCasesNameWithMetadata¶
getCasesByCasesTimeWithMetadata¶
-
CasesInfo
getCasesByCasesTimeWithMetadata
(String dateModifiedStart, String dateModifiedEnd, Integer pageSize, Integer pageNumber, String configName)¶ Query CommCareHQ for all cases of a given date modified range, page and cases metadata.
Parameters: - dateModifiedStart – the start of the date range
- dateModifiedEnd – the end of the date range
- pageSize – the size of the page
- pageNumber – the number of the page
- configName – the name of the configuration used for connecting to CommcareHQ, null means default configuration
Returns: the CasesInfo wrapper, containing CaseInfo objects and case metadata from CommCareHQ.
getCasesByCasesTimeWithMetadata¶
getCasesByType¶
-
List<CaseInfo>
getCasesByType
(String type, Integer pageSize, Integer pageNumber, String configName)¶ Query CommCareHQ for all cases of a given case type and page.
Parameters: - type – the type of case on CommCareHQ
- pageSize – the size of the page
- pageNumber – the number of the page
- configName – the name of the configuration used for connecting to CommcareHQ, null means default configuration
Returns: the list of CaseInfo objects representing cases of the given type and page found on the given CommcareHQ configuration
getCasesByType¶
getCasesByUserId¶
-
List<CaseInfo>
getCasesByUserId
(String userId, Integer pageSize, Integer pageNumber, String configName)¶ Query CommCareHQ for all cases under a given user id.
Parameters: - userId – the user id from CommCareHQ
- pageSize – the size of the page
- pageNumber – the number of the page
- configName – the name of the configuration used for connecting to CommcareHQ, null means default configuration
Returns: the list of CaseInfo objects representing cases under the given user id and page found on the given CommcareHQ configuration
getCasesByUserId¶
getCasesByUserIdAndType¶
-
List<CaseInfo>
getCasesByUserIdAndType
(String userId, String type, Integer pageSize, Integer pageNumber, String configName)¶ Query CommCareHQ for all cases of a given case type, user id and page.
Parameters: - userId – the user id from CommCareHQ
- type – the type of case on CommCareHQ
- pageSize – the size of the page
- pageNumber – the number of the page
- configName – the name of the configuration used for connecting to CommcareHQ, null means default configuration
Returns: the list of CaseInfo objects representing cases of the given type, user id and page found on the given CommcareHQ configuration
getCasesByUserIdAndType¶
getCasesWithMetadata¶
-
CasesInfo
getCasesWithMetadata
(Integer pageSize, Integer pageNumber, String configName)¶ Query CommCareHQ for all cases of the given page and cases metadata
Parameters: - pageSize – the size of the page
- pageNumber – the number of the page
- configName – the name of the configuration used for connecting to CommcareHQ, null means default configuration
Returns: the CasesInfo wrapper, containing CaseInfo objects and case metadata from CommCareHQ
getCasesWithMetadata¶
-
CasesInfo
getCasesWithMetadata
(Integer pageSize, Integer pageNumber)¶ Same as
getCasesWithMetadata
but uses default Commcare configuration.
uploadCase¶
-
OpenRosaResponse
uploadCase
(CaseTask caseTask, String configName)¶ Upload case xml wrapped in a minimal xform instance to CommCareHQ.
Parameters: - caseTask – An object representing the case information and case actions to be submitted as case xml
- configName – the name of the configuration used for connecting to CommcareHQ, null means default configuration
Returns: an informational object representing the status, nature and message of the response from CommCareHQ when attempting to upload this instance of case xml. Returns null if your case xml was incorrect.
uploadCase¶
-
OpenRosaResponse
uploadCase
(CaseTask caseTask)¶ Same as
uploadCase
but uses default Commcare configuration.