@Transactional public interface FormService extends OpenmrsService
Modifier and Type | Method and Description |
---|---|
void |
createField(Field field)
Deprecated.
use
saveField(Field) |
Form |
createForm(Form form)
Deprecated.
use
saveForm(Form) |
void |
createFormField(FormField formField)
Deprecated.
|
void |
deleteField(Field field)
Deprecated.
|
void |
deleteForm(Form form)
Deprecated.
use
purgeForm(Form) |
void |
deleteFormField(FormField formField)
Deprecated.
|
Form |
duplicateForm(Form form)
Duplicate this form and form_fields associated with this form
|
java.util.List<Field> |
findFields(Concept concept)
Deprecated.
|
java.util.List<Field> |
findFields(java.lang.String searchPhrase)
Deprecated.
|
java.util.List<Form> |
findForms(java.lang.String text,
boolean includeUnpublished,
boolean includeRetired)
|
java.util.List<Field> |
getAllFields()
Fetches all Fields in the database, including retired ones
|
java.util.List<Field> |
getAllFields(boolean includeRetired)
Fetches all Fields in the database, possibly including retired ones
|
java.util.List<FieldType> |
getAllFieldTypes()
Get all field types in the database including the retired ones
|
java.util.List<FieldType> |
getAllFieldTypes(boolean includeRetired)
Get all field types in the database with or without retired ones
|
java.util.List<FormField> |
getAllFormFields()
Returns all FormFields in the database
|
java.util.List<Form> |
getAllForms()
Gets all Forms, including retired ones.
|
java.util.List<Form> |
getAllForms(boolean includeRetired)
Gets all forms, possibly including retired ones
|
Field |
getField(java.lang.Integer fieldId)
Gets a Field by internal database id
|
FieldAnswer |
getFieldAnswerByUuid(java.lang.String uuid)
Get FieldAnswer by its UUID
|
Field |
getFieldByUuid(java.lang.String uuid)
Get Field by its UUID
|
java.util.List<Field> |
getFields()
Deprecated.
use
getAllFields() |
java.util.List<Field> |
getFields(java.util.Collection<Form> forms,
java.util.Collection<FieldType> fieldTypes,
java.util.Collection<Concept> concepts,
java.util.Collection<java.lang.String> tableNames,
java.util.Collection<java.lang.String> attributeNames,
java.lang.Boolean selectMultiple,
java.util.Collection<FieldAnswer> containsAllAnswers,
java.util.Collection<FieldAnswer> containsAnyAnswer,
java.lang.Boolean retired)
Returns all Fields that match these (nullable) criteria
|
java.util.List<Field> |
getFields(java.lang.String fuzzySearchPhrase)
Find all Fields whose names are similar to or contain the given phrase.
|
java.util.List<Field> |
getFieldsByConcept(Concept concept)
Finds all Fields that point to the given concept, including retired ones.
|
FieldType |
getFieldType(java.lang.Integer fieldTypeId)
Get fieldType by internal identifier
|
FieldType |
getFieldTypeByUuid(java.lang.String uuid)
Get FieldType by its UUID
|
java.util.List<FieldType> |
getFieldTypes()
Deprecated.
|
Form |
getForm(java.lang.Integer formId)
Get form by internal form identifier
|
Form |
getForm(java.lang.String name)
Get form by exact name match.
|
Form |
getForm(java.lang.String name,
java.lang.String version)
Get form by exact name & version match.
|
Form |
getFormByUuid(java.lang.String uuid)
Get Form by its UUID
|
java.lang.Integer |
getFormCount(java.lang.String partialNameSearch,
java.lang.Boolean published,
java.util.Collection<EncounterType> encounterTypes,
java.lang.Boolean retired,
java.util.Collection<FormField> containingAnyFormField,
java.util.Collection<FormField> containingAllFormFields,
java.util.Collection<Field> fields)
Same as
getForms(String, Boolean, Collection, Boolean, Collection, Collection, Collection)
except that it returns an integer that is the size of the list that would be returned |
FormField |
getFormField(Form form,
Concept concept)
Finds the FormField defined for this form/concept combination Calls
getFormField(Form, Concept, Collection, boolean) with an empty ignore list and with
force set to false |
FormField |
getFormField(Form form,
Concept concept,
java.util.Collection<FormField> ignoreFormFields,
boolean force)
Finds the FormField defined for this form/concept combination while discounting any form
field found in the
ignoreFormFields collection This method was added when
needing to relate observations to form fields during a display. |
FormField |
getFormField(java.lang.Integer formFieldId)
Gets a FormField by internal database id
|
FormField |
getFormFieldByUuid(java.lang.String uuid)
Get FormField by its UUID
|
java.util.List<FormField> |
getFormFields(Form form)
Deprecated.
|
FormResource |
getFormResource(Form form,
java.lang.String name)
Finds a FormResource based on a given Form and name
|
FormResource |
getFormResource(java.lang.Integer formResourceId)
Finds a FormResource by its id
|
FormResource |
getFormResourceByUuid(java.lang.String uuid)
Finds a FormResource by its uuid
|
java.util.Collection<FormResource> |
getFormResourcesForForm(Form form)
Finds all FormResources tied to a given form
|
java.util.List<Form> |
getForms()
Deprecated.
use
getAllForms() |
java.util.List<Form> |
getForms(boolean publishedOnly)
Deprecated.
use
getAllForms() or getPublishedForms() |
java.util.List<Form> |
getForms(boolean publishedOnly,
boolean includeRetired)
|
java.util.Set<Form> |
getForms(Concept c)
Deprecated.
|
java.util.List<Form> |
getForms(java.lang.String fuzzyName,
boolean onlyLatestVersion)
Gets all forms with name similar to the given name.
|
java.util.List<Form> |
getForms(java.lang.String partialNameSearch,
java.lang.Boolean published,
java.util.Collection<EncounterType> encounterTypes,
java.lang.Boolean retired,
java.util.Collection<FormField> containingAnyFormField,
java.util.Collection<FormField> containingAllFormFields)
|
java.util.List<Form> |
getForms(java.lang.String partialNameSearch,
java.lang.Boolean published,
java.util.Collection<EncounterType> encounterTypes,
java.lang.Boolean retired,
java.util.Collection<FormField> containingAnyFormField,
java.util.Collection<FormField> containingAllFormFields,
java.util.Collection<Field> fields)
Gets all forms that match all the (nullable) criteria
|
java.util.List<Form> |
getFormsContainingConcept(Concept concept)
Returns all forms that contain the given concept as a field in their schema.
|
java.util.List<Form> |
getPublishedForms()
Returns all published forms (not including retired ones)
|
int |
mergeDuplicateFields()
Audit form, consolidate similar fields
|
void |
purgeField(Field field)
Completely removes a Field from the database.
|
void |
purgeField(Field field,
boolean cascade)
Completely removes a Field from the database.
|
void |
purgeFieldType(FieldType fieldType)
Deletes the given field type from the database.
|
void |
purgeForm(Form form)
Completely remove a Form from the database.
|
void |
purgeForm(Form form,
boolean cascade)
Completely remove a Form from the database.
|
void |
purgeFormField(FormField formField)
Completely removes the given FormField from the database.
|
void |
purgeFormResource(FormResource formResource)
Purges a form resource
|
Field |
retireField(Field field)
Retires field
|
void |
retireForm(Form form,
java.lang.String reason)
Retires the Form, leaving it in the database, but removing it from data entry screens
|
Field |
saveField(Field field)
Creates or updates the given Field
|
FieldType |
saveFieldType(FieldType fieldType)
Saves the given field type to the database
|
Form |
saveForm(Form form)
Create or update the given Form in the database
|
FormField |
saveFormField(FormField formField)
Creates or updates the given FormField
|
FormResource |
saveFormResource(FormResource formResource)
Saves or updates the given form resource
|
Field |
unretireField(Field field)
Unretires field
|
void |
unretireForm(Form form)
Unretires a Form that had previous been retired.
|
void |
updateField(Field field)
Deprecated.
use
saveField(Field) |
void |
updateForm(Form form)
Deprecated.
use
saveForm(Form) |
void |
updateFormField(FormField formField)
Deprecated.
|
onShutdown, onStartup
@Authorized(value="Manage Forms") Form saveForm(Form form) throws APIException
form
- the Form to saveAPIException
@Deprecated @Authorized(value="Manage Forms") Form createForm(Form form) throws APIException
saveForm(Form)
APIException
@Transactional(readOnly=true) @Authorized(value="View Forms") Form getForm(java.lang.Integer formId) throws APIException
formId
- internal identifierAPIException
@Transactional(readOnly=true) @Authorized(value="View Forms") Form getForm(java.lang.String name) throws APIException
name
- exact name of the form to fetchAPIException
@Transactional(readOnly=true) Form getFormByUuid(java.lang.String uuid) throws APIException
uuid
- APIException
@Transactional(readOnly=true) @Authorized(value="View Forms") Form getForm(java.lang.String name, java.lang.String version) throws APIException
getForm(String)
name
- exact name of the form to fetchversion
- exact version of the form to fetchAPIException
@Transactional(readOnly=true) @Authorized(value="View Forms") java.util.List<Form> getAllForms() throws APIException
APIException
@Transactional(readOnly=true) @Authorized(value="View Forms") java.util.List<Form> getAllForms(boolean includeRetired) throws APIException
includeRetired
- whether or not to return retired formsAPIException
@Transactional(readOnly=true) @Authorized(value="View Forms") java.util.List<Form> getForms(java.lang.String fuzzyName, boolean onlyLatestVersion)
fuzzyName
- approximate name to matchonlyLatestVersion
- whether or not to return only the latest version of each form (by
name)@Deprecated @Transactional(readOnly=true) @Authorized(value="View Forms") java.util.List<Form> getForms(java.lang.String partialNameSearch, java.lang.Boolean published, java.util.Collection<EncounterType> encounterTypes, java.lang.Boolean retired, java.util.Collection<FormField> containingAnyFormField, java.util.Collection<FormField> containingAllFormFields)
@Transactional(readOnly=true) @Authorized(value="View Forms") java.util.List<Form> getForms(java.lang.String partialNameSearch, java.lang.Boolean published, java.util.Collection<EncounterType> encounterTypes, java.lang.Boolean retired, java.util.Collection<FormField> containingAnyFormField, java.util.Collection<FormField> containingAllFormFields, java.util.Collection<Field> fields)
partialNameSearch
- partial search of namepublished
- whether the form is publishedencounterTypes
- whether the form has any of these encounter typesretired
- whether the form is retiredcontainingAnyFormField
- includes forms that contain any of the specified FormFieldscontainingAllFormFields
- includes forms that contain all of the specified FormFieldsfields
- whether the form has any of these fields. If a field is used more than once on
a form, that form is returning more than once in this list@Transactional(readOnly=true) @Authorized(value="View Forms") java.lang.Integer getFormCount(java.lang.String partialNameSearch, java.lang.Boolean published, java.util.Collection<EncounterType> encounterTypes, java.lang.Boolean retired, java.util.Collection<FormField> containingAnyFormField, java.util.Collection<FormField> containingAllFormFields, java.util.Collection<Field> fields)
getForms(String, Boolean, Collection, Boolean, Collection, Collection, Collection)
except that it returns an integer that is the size of the list that would be returned@Transactional(readOnly=true) @Authorized(value="View Forms") java.util.List<Form> getPublishedForms() throws APIException
APIException
@Deprecated @Transactional(readOnly=true) @Authorized(value="View Forms") java.util.List<Form> getForms(boolean publishedOnly) throws APIException
getAllForms()
or getPublishedForms()
publishedOnly
- APIException
@Deprecated @Transactional(readOnly=true) @Authorized(value="View Forms") java.util.List<Form> getForms(boolean publishedOnly, boolean includeRetired) throws APIException
getAllForms()
or getPublishedForms()
or
getForms(String, Boolean, Collection, Boolean, Collection, Collection)
publishedOnly
- includeRetired
- APIException
@Authorized(value="Manage Forms") int mergeDuplicateFields() throws APIException
APIException
@Deprecated @Authorized(value="Manage Forms") void updateForm(Form form) throws APIException
saveForm(Form)
form
- APIException
@Authorized(value="Manage Forms") Form duplicateForm(Form form) throws APIException
form
- APIException
@Authorized(value="Manage Forms") void retireForm(Form form, java.lang.String reason) throws APIException
form
- the Form to retirereason
- the retiredReason to setAPIException
@Authorized(value="Manage Forms") void unretireForm(Form form) throws APIException
form
- the Form to reviveAPIException
@Authorized(value="Manage Forms") void purgeForm(Form form) throws APIException
form
- APIException
@Authorized(value="Manage Forms") void purgeForm(Form form, boolean cascade) throws APIException
form
- cascade
- whether or not to cascade delete all dependent objects (including encounters!)APIException
@Deprecated @Authorized(value="Manage Forms") void deleteForm(Form form) throws APIException
purgeForm(Form)
Forms
should be retired and not deleted altogether (since many foreign key
constraints depend on forms, deleting a form would require deleting all traces, and any
historical trail would be lost). This method only clears form roles and attempts to delete
the form record. If the form has been included in any other parts of the database (through a
foreign key), the attempt to delete the form will violate foreign key constraints and fail.form
- APIException
@Deprecated @Authorized(value="View Field Types") @Transactional(readOnly=true) java.util.List<FieldType> getFieldTypes() throws APIException
getAllFieldTypes()
APIException
@Authorized(value="View Field Types") @Transactional(readOnly=true) java.util.List<FieldType> getAllFieldTypes() throws APIException
APIException
@Authorized(value="View Field Types") @Transactional(readOnly=true) java.util.List<FieldType> getAllFieldTypes(boolean includeRetired) throws APIException
includeRetired
- true/false whether to include the retired field typesAPIException
@Transactional(readOnly=true) @Authorized(value="View Field Types") FieldType getFieldType(java.lang.Integer fieldTypeId) throws APIException
fieldTypeId
- Integer id of FieldType to getAPIException
@Transactional(readOnly=true) FieldType getFieldTypeByUuid(java.lang.String uuid) throws APIException
uuid
- APIException
@Deprecated @Transactional(readOnly=true) @Authorized(value="View Forms") java.util.List<Form> getForms() throws APIException
getAllForms()
APIException
@Deprecated @Transactional(readOnly=true) @Authorized(value="View Forms") java.util.Set<Form> getForms(Concept c) throws APIException
getFormsContainingConcept(Concept)
APIException
@Transactional(readOnly=true) @Authorized(value="View Forms") java.util.List<Form> getFormsContainingConcept(Concept concept) throws APIException
concept
- the concept to search for in formsAPIException
@Deprecated @Transactional(readOnly=true) @Authorized(value="View Forms") java.util.List<FormField> getFormFields(Form form) throws APIException
Form.getFormFields()
APIException
@Transactional(readOnly=true) @Authorized(value="View Forms") java.util.List<FormField> getAllFormFields() throws APIException
APIException
@Deprecated @Transactional(readOnly=true) @Authorized(value="View Forms") java.util.List<Field> findFields(java.lang.String searchPhrase) throws APIException
getFields(String)
APIException
@Transactional(readOnly=true) @Authorized(value="View Forms") java.util.List<Field> getFields(java.lang.String fuzzySearchPhrase) throws APIException
fuzzySearchPhrase
- APIException
@Deprecated @Transactional(readOnly=true) @Authorized(value="View Forms") java.util.List<Field> findFields(Concept concept) throws APIException
getFieldsByConcept(Concept)
APIException
@Transactional(readOnly=true) @Authorized(value="View Forms") java.util.List<Field> getFieldsByConcept(Concept concept) throws APIException
concept
- the concept to search for in the Field tableAPIException
@Transactional(readOnly=true) @Authorized(value="View Forms") java.util.List<Field> getAllFields() throws APIException
APIException
@Transactional(readOnly=true) @Authorized(value="View Forms") java.util.List<Field> getAllFields(boolean includeRetired) throws APIException
includeRetired
- whether or not to include retired FieldsAPIException
@Transactional(readOnly=true) @Authorized(value="View Forms") java.util.List<Field> getFields(java.util.Collection<Form> forms, java.util.Collection<FieldType> fieldTypes, java.util.Collection<Concept> concepts, java.util.Collection<java.lang.String> tableNames, java.util.Collection<java.lang.String> attributeNames, java.lang.Boolean selectMultiple, java.util.Collection<FieldAnswer> containsAllAnswers, java.util.Collection<FieldAnswer> containsAnyAnswer, java.lang.Boolean retired) throws APIException
forms
- on any of these FormsfieldTypes
- having any of these FieldTypesconcepts
- for any of these ConceptstableNames
- for any of these table namesattributeNames
- for any of these attribute namesselectMultiple
- whether to return only select-multi fieldscontainsAllAnswers
- fields with all the following answerscontainsAnyAnswer
- fields with any of the following answersretired
- only retired/unretired fieldsAPIException
@Deprecated @Transactional(readOnly=true) @Authorized(value="View Forms") java.util.List<Field> getFields() throws APIException
getAllFields()
APIException
@Transactional(readOnly=true) @Authorized(value="View Forms") Field getField(java.lang.Integer fieldId) throws APIException
fieldId
- the id of the Field to fetchAPIException
@Transactional(readOnly=true) Field getFieldByUuid(java.lang.String uuid) throws APIException
uuid
- APIException
@Transactional(readOnly=true) FieldAnswer getFieldAnswerByUuid(java.lang.String uuid) throws APIException
uuid
- APIException
@Authorized(value="Manage Forms") Field saveField(Field field) throws APIException
field
- the Field to saveAPIException
@Deprecated @Authorized(value="Manage Forms") void createField(Field field) throws APIException
saveField(Field)
APIException
@Deprecated @Authorized(value="Manage Forms") void updateField(Field field) throws APIException
saveField(Field)
APIException
@Authorized(value="Manage Forms") void purgeField(Field field) throws APIException
field
- the Field to purgeAPIException
@Authorized(value="Manage Forms") void purgeField(Field field, boolean cascade) throws APIException
field
- the Field to purgecascade
- whether to cascade delete all FormFields pointing to this fieldAPIException
@Deprecated @Authorized(value="Manage Forms") void deleteField(Field field) throws APIException
purgeField(Field)
APIException
@Transactional(readOnly=true) @Authorized(value="View Forms") FormField getFormField(java.lang.Integer formFieldId) throws APIException
formFieldId
- the internal id to search onAPIException
@Transactional(readOnly=true) FormField getFormFieldByUuid(java.lang.String uuid) throws APIException
uuid
- APIException
@Transactional(readOnly=true) @Authorized(value="View Forms") FormField getFormField(Form form, Concept concept) throws APIException
getFormField(Form, Concept, Collection, boolean)
with an empty ignore list and with
force
set to falseform
- Form that this concept was found onconcept
- (question) on this form that is being requestedAPIException
getFormField(Form, Concept, Collection, boolean)
@Transactional(readOnly=true) @Authorized(value="View Forms") FormField getFormField(Form form, Concept concept, java.util.Collection<FormField> ignoreFormFields, boolean force) throws APIException
ignoreFormFields
collection This method was added when
needing to relate observations to form fields during a display. The use case would be that
you know a Concept for a obs, which was defined on a form (via a formField). You can relate
the formFields to Concepts easily enough, but if a Form reuses a Concept in two separate
FormFields you don't want to only associate that first formField with that concept. So, keep
a running list of formFields you've seen and pass them back in here to rule them out.form
- Form that this concept was found onconcept
- Concept (question) on this form that is being requestedignoreFormFields
- FormFields to ignore (aka already seen formfields)force
- if true and there are zero matches because all formFields were ignored (because
of ignoreFormFields) than the first result is returnedAPIException
@Authorized(value="Manage Forms") FormField saveFormField(FormField formField) throws APIException
formField
- the FormField to saveAPIException
@Deprecated @Authorized(value="Manage Forms") void createFormField(FormField formField) throws APIException
saveFormField(FormField)
APIException
@Deprecated @Authorized(value="Manage Forms") void updateFormField(FormField formField) throws APIException
saveFormField(FormField)
APIException
@Authorized(value="Manage Forms") void purgeFormField(FormField formField) throws APIException
formField
- the FormField to purgeAPIException
@Deprecated @Authorized(value="Manage Forms") void deleteFormField(FormField formField) throws APIException
purgeFormField(FormField)
APIException
@Deprecated @Transactional(readOnly=true) @Authorized(value="View Forms") java.util.List<Form> findForms(java.lang.String text, boolean includeUnpublished, boolean includeRetired)
@Authorized(value="Manage Forms") Field retireField(Field field) throws APIException
field
- the Field to retireAPIException
@Authorized(value="Manage Forms") Field unretireField(Field field) throws APIException
field
- the Field to unretireAPIException
@Authorized(value="Manage Field Types") FieldType saveFieldType(FieldType fieldType) throws APIException
fieldType
- the field type to saveAPIException
@Authorized(value="Purge Field Types") void purgeFieldType(FieldType fieldType) throws APIException
fieldType
- the field type to purgeAPIException
FormResource getFormResource(java.lang.Integer formResourceId) throws APIException
formResourceId
- the id of the resourceAPIException
FormResource getFormResourceByUuid(java.lang.String uuid) throws APIException
uuid
- the uuid of the resourceAPIException
FormResource getFormResource(Form form, java.lang.String name) throws APIException
form
- the Form that the resource belongs toname
- the name of the resourceAPIException
java.util.Collection<FormResource> getFormResourcesForForm(Form form) throws APIException
form
- APIException
FormResource saveFormResource(FormResource formResource) throws APIException
formResource
- the resource to be savedAPIException
void purgeFormResource(FormResource formResource) throws APIException
formResource
- the resource to be purgedAPIException
Copyright © 2018 OpenMRS Inc.. All Rights Reserved.