org.openmrs.api.db
Interface FormDAO

All Known Implementing Classes:
HibernateFormDAO

public interface FormDAO

Database access functions for the Form, FormField, and Field objects


Method Summary
 void deleteField(Field field)
          Deletes a field from the database.
 void deleteFieldType(FieldType fieldType)
          Delete the given field type from the database
 void deleteForm(Form form)
          Delete form from database.
 void deleteFormField(FormField formField)
          Deletes a FormField from the database.
 Form duplicateForm(Form form)
          Creates new form from the given Form
 java.util.List<Field> getAllFields(boolean includeRetired)
          Returns all fields in the database, possibly including retired ones
 java.util.List<FieldType> getAllFieldTypes(boolean includeRetired)
          Get all field types
 java.util.List<FormField> getAllFormFields()
          Returns all FormFields in the database
 java.util.List<Form> getAllForms(boolean includeRetired)
          Returns all forms in the database, possibly including retired ones
 Field getField(java.lang.Integer fieldId)
           
 FieldAnswer getFieldAnswerByUuid(java.lang.String uuid)
           
 Field getFieldByUuid(java.lang.String uuid)
          Auto generated method comment
 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 a broad range of (nullable) criteria
 java.util.List<Field> getFields(java.lang.String search)
           
 FieldType getFieldType(java.lang.Integer fieldTypeId)
          Get fieldType by internal identifier
 FieldType getFieldTypeByUuid(java.lang.String uuid)
          Auto generated method comment
 Form getForm(java.lang.Integer formId)
          Get form by internal form identifier
 Form getForm(java.lang.String name, java.lang.String version)
          Get form by exact name and version
 Form getFormByUuid(java.lang.String uuid)
          Auto generated method comment
 FormField getFormField(Form form, Concept concept, java.util.Collection<FormField> ignoreFormFields, boolean force)
           
 FormField getFormField(java.lang.Integer formFieldId)
           
 FormField getFormFieldByUuid(java.lang.String uuid)
          Auto generated method comment
 java.util.List<FormField> getFormFieldsByField(Field field)
          Return a list of FormFields given a Field
 java.util.List<Form> getForms(java.lang.String partialName, 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 criteria.
 java.util.List<Form> getFormsByName(java.lang.String name)
          Gets all forms with the given name, sorted (alphabetically) by descending version
 java.util.List<Form> getFormsContainingConcept(Concept concept)
          Get all forms that contain the given Concept as one of their fields.
 Field saveField(Field field)
           
 FieldType saveFieldType(FieldType fieldType)
          Save the given field type to the database
 Form saveForm(Form form)
           
 FormField saveFormField(FormField formField)
           
 

Method Detail

saveForm

Form saveForm(Form form)
              throws DAOException
Throws:
DAOException
See Also:
FormService.saveForm(Form)

duplicateForm

Form duplicateForm(Form form)
                   throws DAOException
Creates new form from the given Form

Parameters:
form - Form to duplicate
Returns:
newly duplicated Form
Throws:
DAOException

getForm

Form getForm(java.lang.Integer formId)
             throws DAOException
Get form by internal form identifier

Parameters:
formId - Integer internal identifier for requested Form
Returns:
requested Form
Throws:
DAOException

getForm

Form getForm(java.lang.String name,
             java.lang.String version)
             throws DAOException
Get form by exact name and version

Parameters:
name - the name of the form to get
version - the version of the form to get
Returns:
the form with the exact name and version given
Throws:
DAOException

getFormsByName

java.util.List<Form> getFormsByName(java.lang.String name)
                                    throws DAOException
Gets all forms with the given name, sorted (alphabetically) by descending version

Parameters:
name - String name of the forms to get
Returns:
All forms with the given name, sorted by (alphabetically) by descending version
Throws:
DAOException

deleteForm

void deleteForm(Form form)
                throws DAOException
Delete form from database. This is included for troubleshooting and low-level system administration. Ideally, this method should never be called — 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.

Parameters:
form - Form to delete
Throws:
DAOException

getAllFieldTypes

java.util.List<FieldType> getAllFieldTypes(boolean includeRetired)
                                           throws DAOException
Get all field types

Parameters:
includeRetired - boolean - include retired field types as well?
Returns:
List object with all FieldTypes, possibly including retired ones
Throws:
DAOException

getFieldType

FieldType getFieldType(java.lang.Integer fieldTypeId)
                       throws DAOException
Get fieldType by internal identifier

Parameters:
fieldTypeId - Internal Integer identifier of FieldType
Returns:
The FieldType with specified internal identifier
Throws:
DAOException

getAllForms

java.util.List<Form> getAllForms(boolean includeRetired)
                                 throws DAOException
Returns all forms in the database, possibly including retired ones

Parameters:
includeRetired - boolean - include retired forms?
Returns:
List
object of all forms, possibly including retired ones
Throws:
DAOException

getAllFormFields

java.util.List<FormField> getAllFormFields()
                                           throws DAOException
Returns all FormFields in the database

Returns:
List object of all FormFields in the database
Throws:
DAOException

getFormField

FormField getFormField(Form form,
                       Concept concept,
                       java.util.Collection<FormField> ignoreFormFields,
                       boolean force)
                       throws DAOException
Throws:
DAOException
See Also:
FormService.getFormField(org.openmrs.Form, org.openmrs.Concept, java.util.Collection, boolean)

getFields

java.util.List<Field> getFields(java.lang.String search)
                                throws DAOException
Parameters:
search - String phrase to search for
Returns:
list of fields in the database matching search phrase
Throws:
DAOException

getAllFields

java.util.List<Field> getAllFields(boolean includeRetired)
                                   throws DAOException
Returns all fields in the database, possibly including retired ones

Parameters:
includeRetired - whether or not to return retired fields
Returns:
all fields in the database, possibly including retired ones
Throws:
DAOException

getField

Field getField(java.lang.Integer fieldId)
               throws DAOException
Throws:
DAOException
See Also:
FormService.getField(Integer)

saveField

Field saveField(Field field)
                throws DAOException
Throws:
DAOException
See Also:
FormService.saveField(Field)

deleteField

void deleteField(Field field)
                 throws DAOException
Deletes a field from the database.

This will fail if any other entities reference this field via a foreign key

Parameters:
field - the Field to delete
Throws:
DAOException

getFormField

FormField getFormField(java.lang.Integer formFieldId)
                       throws DAOException
Throws:
DAOException
See Also:
FormService.getFormField(Integer)

saveFormField

FormField saveFormField(FormField formField)
                        throws DAOException
Throws:
DAOException
See Also:
FormService.saveFormField(FormField)

deleteFormField

void deleteFormField(FormField formField)
                     throws DAOException
Deletes a FormField from the database. This will fail if any other entities reference this FormField via a foreign key

Parameters:
formField - the FormField to delete
Throws:
DAOException

getFields

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 DAOException
Returns all fields that match a broad range of (nullable) criteria

Parameters:
forms - Collection of Form to which the requested Fields must belong
fieldTypes - Collection of FieldType of which the requested fields must be
concepts - Collection of Concepts which the fields must point to
tableNames - Collection of TableNames which the fields must point to
attributeNames - Collection of String attribute names which the fields must point to
selectMultiple - Boolean value that matching fields must have for selectMultiple
containsAllAnswers - Collection of FieldAnswers, all of which a matching field must contain (not yet implemented)
containsAnyAnswer - Collection of FieldAnswers, any one of which a matching field must contain (not yet implemented)
retired - Boolean retired status that fields must match
Returns:
All Fields that match the criteria
Throws:
DAOException

getFormsContainingConcept

java.util.List<Form> getFormsContainingConcept(Concept concept)
                                               throws DAOException
Get all forms that contain the given Concept as one of their fields. (Includes retired forms.)

Parameters:
concept - the Concept to search through form fields for
Returns:
forms that contain a form field referencing the given concept
Throws:
DAOException

getForms

java.util.List<Form> getForms(java.lang.String partialName,
                              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)
                              throws DAOException
Gets all forms that match all the criteria. Expects the list objects to be non-null

Parameters:
partialName - String of partial name of form to search on
published - boolean - is the form published?
encounterTypes - Collection of EncounterTypes that the form must represent
retired - boolean - is the form retired?
containingAnyFormField - Collection of FormFields, any one of which must be contained in the form
containingAllFormFields - Collection of FormFields, all of which must be contained in the form
fields - Collection of Fields that the form must contain
Returns:
All forms that match the criteria
Throws:
DAOException
See Also:
FormService.getForms(java.lang.String, java.lang.Boolean, java.util.Collection, java.lang.Boolean, java.util.Collection, java.util.Collection, java.util.Collection)

deleteFieldType

void deleteFieldType(FieldType fieldType)
                     throws DAOException
Delete the given field type from the database

Parameters:
fieldType - FieldType to delete
Throws:
DAOException

getFieldByUuid

Field getFieldByUuid(java.lang.String uuid)
Auto generated method comment

Parameters:
uuid -
Returns:

getFieldAnswerByUuid

FieldAnswer getFieldAnswerByUuid(java.lang.String uuid)

getFieldTypeByUuid

FieldType getFieldTypeByUuid(java.lang.String uuid)
Auto generated method comment

Parameters:
uuid -
Returns:

getFormByUuid

Form getFormByUuid(java.lang.String uuid)
Auto generated method comment

Parameters:
uuid -
Returns:

getFormFieldByUuid

FormField getFormFieldByUuid(java.lang.String uuid)
Auto generated method comment

Parameters:
uuid -
Returns:

saveFieldType

FieldType saveFieldType(FieldType fieldType)
                        throws DAOException
Save the given field type to the database

Parameters:
fieldType - FieldType to save to the database
Returns:
the newly saved field type
Throws:
DAOException

getFormFieldsByField

java.util.List<FormField> getFormFieldsByField(Field field)
Return a list of FormFields given a Field

Parameters:
field -
Returns:
List of FormFields

OpenMRS-1.7.x

Generated Apr 27 2012 10:06 PM. NOTE - these libraries are in active development and subject to change