org.openmrs.api.impl
Class FormServiceImpl

java.lang.Object
  extended by org.openmrs.api.impl.BaseOpenmrsService
      extended by org.openmrs.api.impl.FormServiceImpl
All Implemented Interfaces:
FormService, OpenmrsService

public class FormServiceImpl
extends BaseOpenmrsService
implements FormService

Default implementation of the FormService

This class should not be instantiated alone, get a service class from the Context: Context.getFormService();

See Also:
Context, FormService

Field Summary
protected  org.apache.commons.logging.Log log
           
 
Constructor Summary
FormServiceImpl()
          Default empty constructor
 
Method Summary
 void createField(Field field)
          Deprecated.  
 Form createForm(Form form)
          Deprecated.  
 void createFormField(FormField formField)
          Deprecated.  
 void deleteField(Field field)
          Deprecated.  
 void deleteForm(Form form)
          Deprecated.  
 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)
          Deprecated.  
 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.  
 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
 FormField getFormField(Form form, Concept concept)
          Deprecated.  
 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.  
 java.util.List<Form> getForms()
          Deprecated.  
 java.util.List<Form> getForms(boolean publishedOnly)
          Deprecated.  
 java.util.List<Form> getForms(boolean publishedOnly, boolean includeRetired)
          Deprecated.  
 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 partialName, java.lang.Boolean published, java.util.Collection<EncounterType> encounterTypes, java.lang.Boolean retired, java.util.Collection<FormField> containingAnyFormField, java.util.Collection<FormField> containingAllFormFields)
          Deprecated. see getForms(String, Boolean, Collection, Boolean, Collection, Collection, Collection)
 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 (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.
 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
 void setFormDAO(FormDAO dao)
          Method used to inject the data access object.
 Field unretireField(Field field)
          Unretires field
 void unretireForm(Form form)
          Unretires a Form that had previous been retired.
 void updateField(Field field)
          Deprecated.  
 void updateForm(Form form)
          Deprecated.  
 void updateFormField(FormField formField)
          Deprecated.  
 
Methods inherited from class org.openmrs.api.impl.BaseOpenmrsService
onShutdown, onStartup
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.openmrs.api.OpenmrsService
onShutdown, onStartup
 

Field Detail

log

protected final org.apache.commons.logging.Log log
Constructor Detail

FormServiceImpl

public FormServiceImpl()
Default empty constructor

Method Detail

setFormDAO

public void setFormDAO(FormDAO dao)
Method used to inject the data access object.

Parameters:
dao -

createForm

@Deprecated
public Form createForm(Form form)
                throws APIException
Deprecated. 

Specified by:
createForm in interface FormService
Throws:
APIException
See Also:
FormService.createForm(org.openmrs.Form)

getForm

public Form getForm(java.lang.Integer formId)
             throws APIException
Description copied from interface: FormService
Get form by internal form identifier

Specified by:
getForm in interface FormService
Parameters:
formId - internal identifier
Returns:
requested form
Throws:
APIException
See Also:
FormService.getForm(java.lang.Integer)

getForms

@Deprecated
public java.util.List<Form> getForms(boolean publishedOnly)
                              throws APIException
Deprecated. 

Description copied from interface: FormService
Get all forms. If publishedOnly is true, a form must be marked as 'published' to be included in the list

Specified by:
getForms in interface FormService
Returns:
List of forms
Throws:
APIException
See Also:
FormService.getForms(boolean, boolean)

getForms

@Deprecated
public java.util.List<Form> getForms(boolean publishedOnly,
                                                boolean includeRetired)
                              throws APIException
Deprecated. 

Description copied from interface: FormService
Get all forms. If publishedOnly is true, a form must be marked as 'published' to be included in the list. If includeRetired is true 'retired' must be set to false to be include in the list

Specified by:
getForms in interface FormService
Returns:
List
object of all matching forms
Throws:
APIException
See Also:
FormService.getForms(boolean, boolean)

updateForm

@Deprecated
public void updateForm(Form form)
                throws APIException
Deprecated. 

Description copied from interface: FormService
Save changes to form

Specified by:
updateForm in interface FormService
Throws:
APIException
See Also:
FormService.updateForm(org.openmrs.Form)

duplicateForm

public Form duplicateForm(Form form)
                   throws APIException
Duplicate this form and form_fields associated with this form

Specified by:
duplicateForm in interface FormService
Parameters:
form -
Returns:
New duplicated form
Throws:
APIException
See Also:
FormService.duplicateForm(org.openmrs.Form)

retireForm

public void retireForm(Form form,
                       java.lang.String reason)
                throws APIException
Description copied from interface: FormService
Retires the Form, leaving it in the database, but removing it from data entry screens

Specified by:
retireForm in interface FormService
Parameters:
form - the Form to retire
reason - the retiredReason to set
Throws:
APIException
See Also:
FormService.retireForm(org.openmrs.Form, java.lang.String)

unretireForm

public void unretireForm(Form form)
                  throws APIException
Description copied from interface: FormService
Unretires a Form that had previous been retired.

Specified by:
unretireForm in interface FormService
Parameters:
form - the Form to revive
Throws:
APIException
See Also:
FormService.unretireForm(org.openmrs.Form)

deleteForm

@Deprecated
public void deleteForm(Form form)
                throws APIException
Deprecated. 

Description copied from interface: FormService
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.

Specified by:
deleteForm in interface FormService
Throws:
APIException
See Also:
FormService.deleteForm(org.openmrs.Form)

getFieldTypes

@Deprecated
public java.util.List<FieldType> getFieldTypes()
                                        throws APIException
Deprecated. 

Specified by:
getFieldTypes in interface FormService
Throws:
APIException
See Also:
FormService.getFieldTypes()

getAllFieldTypes

public java.util.List<FieldType> getAllFieldTypes()
                                           throws APIException
Description copied from interface: FormService
Get all field types in the database including the retired ones

Specified by:
getAllFieldTypes in interface FormService
Returns:
list of all field types
Throws:
APIException
See Also:
FormService.getAllFieldTypes()

getAllFieldTypes

public java.util.List<FieldType> getAllFieldTypes(boolean includeRetired)
                                           throws APIException
Description copied from interface: FormService
Get all field types in the database with or without retired ones

Specified by:
getAllFieldTypes in interface FormService
Parameters:
includeRetired - true/false whether to include the retired field types
Returns:
list of all field types
Throws:
APIException
See Also:
FormService.getAllFieldTypes(boolean)

getFieldType

public FieldType getFieldType(java.lang.Integer fieldTypeId)
                       throws APIException
Description copied from interface: FormService
Get fieldType by internal identifier

Specified by:
getFieldType in interface FormService
Parameters:
fieldTypeId - Integer id of FieldType to get
Returns:
fieldType with given internal identifier
Throws:
APIException
See Also:
FormService.getFieldType(java.lang.Integer)

getForms

@Deprecated
public java.util.List<Form> getForms()
                              throws APIException
Deprecated. 

Specified by:
getForms in interface FormService
Throws:
APIException
See Also:
FormService.getForms()

getForms

@Deprecated
public java.util.Set<Form> getForms(Concept c)
                             throws APIException
Deprecated. 

Specified by:
getForms in interface FormService
Throws:
APIException
See Also:
FormService.getForms(org.openmrs.Concept)

getFormFields

@Deprecated
public java.util.List<FormField> getFormFields(Form form)
                                        throws APIException
Deprecated. 

Specified by:
getFormFields in interface FormService
Throws:
APIException
See Also:
FormService.getFormFields(org.openmrs.Form)

findFields

@Deprecated
public java.util.List<Field> findFields(java.lang.String searchPhrase)
                                 throws APIException
Deprecated. 

Specified by:
findFields in interface FormService
Returns:
list of fields in the db matching part of search term
Throws:
APIException
See Also:
FormService.findFields(java.lang.String)

findFields

@Deprecated
public java.util.List<Field> findFields(Concept concept)
                                 throws APIException
Deprecated. 

Specified by:
findFields in interface FormService
Throws:
APIException
See Also:
FormService.findFields(org.openmrs.Concept)

getFields

@Deprecated
public java.util.List<Field> getFields()
                                throws APIException
Deprecated. 

Specified by:
getFields in interface FormService
Throws:
APIException
See Also:
FormService.getFields()

getField

public Field getField(java.lang.Integer fieldId)
               throws APIException
Description copied from interface: FormService
Gets a Field by internal database id

Specified by:
getField in interface FormService
Parameters:
fieldId - the id of the Field to fetch
Returns:
the Field with the given id
Throws:
APIException
See Also:
FormService.getField(java.lang.Integer)

createField

@Deprecated
public void createField(Field field)
                 throws APIException
Deprecated. 

Specified by:
createField in interface FormService
Throws:
APIException
See Also:
FormService.createField(org.openmrs.Field)

updateField

@Deprecated
public void updateField(Field field)
                 throws APIException
Deprecated. 

Specified by:
updateField in interface FormService
Throws:
APIException
See Also:
FormService.updateField(org.openmrs.Field)

deleteField

@Deprecated
public void deleteField(Field field)
                 throws APIException
Deprecated. 

Specified by:
deleteField in interface FormService
Throws:
APIException
See Also:
FormService.deleteField(org.openmrs.Field)

getFormField

public FormField getFormField(java.lang.Integer formFieldId)
                       throws APIException
Description copied from interface: FormService
Gets a FormField by internal database id

Specified by:
getFormField in interface FormService
Parameters:
formFieldId - the internal id to search on
Returns:
the FormField with the given id
Throws:
APIException
See Also:
FormService.getFormField(java.lang.Integer)

getFormField

@Deprecated
public FormField getFormField(Form form,
                                         Concept concept)
                       throws APIException
Deprecated. 

Description copied from interface: FormService
Finds the FormField defined for this form/concept combination Calls FormService.getFormField(Form, Concept, Collection, boolean) with an empty ignore list and with force set to false

Specified by:
getFormField in interface FormService
Parameters:
form - Form that this concept was found on
concept - (question) on this form that is being requested
Returns:
Formfield for this concept on this form
Throws:
APIException
See Also:
FormService.getFormField(org.openmrs.Form, org.openmrs.Concept), getFormField(Form, Concept, Collection, boolean)

getFormField

public FormField getFormField(Form form,
                              Concept concept,
                              java.util.Collection<FormField> ignoreFormFields,
                              boolean force)
                       throws APIException
Description copied from interface: FormService
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. 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.

Specified by:
getFormField in interface FormService
Parameters:
form - Form that this concept was found on
concept - Concept (question) on this form that is being requested
ignoreFormFields - 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 returned
Returns:
Formfield for this concept on this form
Throws:
APIException
See Also:
FormService.getFormField(org.openmrs.Form, org.openmrs.Concept, java.util.Collection, boolean)

createFormField

@Deprecated
public void createFormField(FormField formField)
                     throws APIException
Deprecated. 

Specified by:
createFormField in interface FormService
Throws:
APIException
See Also:
FormService.createFormField(org.openmrs.FormField)

updateFormField

@Deprecated
public void updateFormField(FormField formField)
                     throws APIException
Deprecated. 

Specified by:
updateFormField in interface FormService
Throws:
APIException
See Also:
FormService.updateFormField(org.openmrs.FormField)

deleteFormField

@Deprecated
public void deleteFormField(FormField formField)
                     throws APIException
Deprecated. 

Specified by:
deleteFormField in interface FormService
Throws:
APIException
See Also:
FormService.deleteFormField(org.openmrs.FormField)

getFieldByUuid

public Field getFieldByUuid(java.lang.String uuid)
                     throws APIException
Description copied from interface: FormService
Get Field by its UUID

Specified by:
getFieldByUuid in interface FormService
Returns:
Throws:
APIException
See Also:
FormService.getFieldByUuid(java.lang.String)

getFieldAnswerByUuid

public FieldAnswer getFieldAnswerByUuid(java.lang.String uuid)
                                 throws APIException
Description copied from interface: FormService
Get FieldAnswer by its UUID

Specified by:
getFieldAnswerByUuid in interface FormService
Returns:
Throws:
APIException

getFieldTypeByUuid

public FieldType getFieldTypeByUuid(java.lang.String uuid)
                             throws APIException
Description copied from interface: FormService
Get FieldType by its UUID

Specified by:
getFieldTypeByUuid in interface FormService
Returns:
Throws:
APIException
See Also:
FormService.getFieldTypeByUuid(java.lang.String)

getFormByUuid

public Form getFormByUuid(java.lang.String uuid)
                   throws APIException
Description copied from interface: FormService
Get Form by its UUID

Specified by:
getFormByUuid in interface FormService
Returns:
Throws:
APIException
See Also:
FormService.getFormByUuid(java.lang.String)

getFormFieldByUuid

public FormField getFormFieldByUuid(java.lang.String uuid)
                             throws APIException
Description copied from interface: FormService
Get FormField by its UUID

Specified by:
getFormFieldByUuid in interface FormService
Returns:
Throws:
APIException
See Also:
FormService.getFormFieldByUuid(java.lang.String)

findForms

@Deprecated
public java.util.List<Form> findForms(java.lang.String text,
                                                 boolean includeUnpublished,
                                                 boolean includeRetired)
Deprecated. 

Specified by:
findForms in interface FormService
See Also:
FormService.findForms(java.lang.String, boolean, boolean)

getAllFields

public java.util.List<Field> getAllFields()
                                   throws APIException
Description copied from interface: FormService
Fetches all Fields in the database, including retired ones

Specified by:
getAllFields in interface FormService
Returns:
all Fields
Throws:
APIException
See Also:
FormService.getAllFields()

getAllFields

public java.util.List<Field> getAllFields(boolean includeRetired)
                                   throws APIException
Description copied from interface: FormService
Fetches all Fields in the database, possibly including retired ones

Specified by:
getAllFields in interface FormService
Parameters:
includeRetired - whether or not to include retired Fields
Returns:
all Fields
Throws:
APIException
See Also:
FormService.getAllFields(boolean)

getAllFormFields

public java.util.List<FormField> getAllFormFields()
                                           throws APIException
Description copied from interface: FormService
Returns all FormFields in the database

Specified by:
getAllFormFields in interface FormService
Returns:
all FormFields in the database
Throws:
APIException
See Also:
FormService.getAllFormFields()

getAllForms

public java.util.List<Form> getAllForms()
                                 throws APIException
Description copied from interface: FormService
Gets all Forms, including retired ones.

Specified by:
getAllForms in interface FormService
Returns:
all Forms, including retired ones
Throws:
APIException
See Also:
FormService.getAllForms()

getAllForms

public java.util.List<Form> getAllForms(boolean includeRetired)
                                 throws APIException
Description copied from interface: FormService
Gets all forms, possibly including retired ones

Specified by:
getAllForms in interface FormService
Parameters:
includeRetired - whether or not to return retired forms
Returns:
all forms, possibly including retired ones
Throws:
APIException
See Also:
FormService.getAllForms(boolean)

getFields

public 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
Description copied from interface: FormService
Returns all Fields that match these (nullable) criteria

Specified by:
getFields in interface FormService
Parameters:
forms - on any of these Forms
fieldTypes - having any of these FieldTypes
concepts - for any of these Concepts
tableNames - for any of these table names
attributeNames - for any of these attribute names
selectMultiple - whether to return only select-multi fields
containsAllAnswers - fields with all the following answers
containsAnyAnswer - fields with any of the following answers
retired - only retired/unretired fields
Returns:
all Fields matching the given criteria
Throws:
APIException
See Also:
FormService.getFields(java.util.Collection, java.util.Collection, java.util.Collection, java.util.Collection, java.util.Collection, java.lang.Boolean, java.util.Collection, java.util.Collection, java.lang.Boolean)

getForm

public Form getForm(java.lang.String name)
             throws APIException
Description copied from interface: FormService
Get form by exact name match. If there are multiple forms with this name, then this returns the one with the highest version (sorted alphabetically)

Specified by:
getForm in interface FormService
Parameters:
name - exact name of the form to fetch
Returns:
requested form
Throws:
APIException
See Also:
FormService.getForm(java.lang.String)
Expected behavior:
return the form with the highest version, if more than one form with the given name exists

getForm

public Form getForm(java.lang.String name,
                    java.lang.String version)
             throws APIException
Description copied from interface: FormService
Get form by exact name & version match. If version is null, then this method behaves like FormService.getForm(String)

Specified by:
getForm in interface FormService
Parameters:
name - exact name of the form to fetch
version - exact version of the form to fetch
Returns:
requested form
Throws:
APIException
See Also:
FormService.getForm(java.lang.String, java.lang.String)

getForms

public java.util.List<Form> getForms(java.lang.String fuzzyName,
                                     boolean onlyLatestVersion)
Description copied from interface: FormService
Gets all forms with name similar to the given name. (The precise fuzzy matching algorithm is not specified.)

Specified by:
getForms in interface FormService
Parameters:
fuzzyName - approximate name to match
onlyLatestVersion - whether or not to return only the latest version of each form (by name)
Returns:
forms with names similar to fuzzyName
See Also:
FormService.getForms(java.lang.String, boolean)

getForms

@Deprecated
public 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)
Deprecated. see getForms(String, Boolean, Collection, Boolean, Collection, Collection, Collection)

Specified by:
getForms in interface FormService

getForms

public 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)
Description copied from interface: FormService
Gets all forms that match all the (nullable) criteria

Specified by:
getForms in interface FormService
Parameters:
partialName - partial search of name
published - whether the form is published
encounterTypes - whether the form has any of these encounter types
retired - whether the form is retired
containingAnyFormField - includes forms that contain any of the specified FormFields
containingAllFormFields - includes forms that contain all of the specified FormFields
fields - 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
Returns:
All forms that match the criteria
See Also:
FormService.getForms(java.lang.String, java.lang.Boolean, java.util.Collection, java.lang.Boolean, java.util.Collection, java.util.Collection)

getPublishedForms

public java.util.List<Form> getPublishedForms()
                                       throws APIException
Description copied from interface: FormService
Returns all published forms (not including retired ones)

Specified by:
getPublishedForms in interface FormService
Returns:
all published non-retired forms
Throws:
APIException
See Also:
FormService.getPublishedForms()

purgeField

public void purgeField(Field field)
                throws APIException
Description copied from interface: FormService
Completely removes a Field from the database. Not reversible.

Specified by:
purgeField in interface FormService
Parameters:
field - the Field to purge
Throws:
APIException
See Also:
FormService.purgeField(org.openmrs.Field)

purgeField

public void purgeField(Field field,
                       boolean cascade)
                throws APIException
Description copied from interface: FormService
Completely removes a Field from the database. Not reversible. !! WARNING: calling this with cascade=true can be very destructive !!

Specified by:
purgeField in interface FormService
Parameters:
field - the Field to purge
cascade - whether to cascade delete all FormFields pointing to this field
Throws:
APIException
See Also:
FormService.purgeField(org.openmrs.Field, boolean)

purgeForm

public void purgeForm(Form form)
               throws APIException
Description copied from interface: FormService
Completely remove a Form from the database. This is not reversible. It will fail if this form has already been used to create Encounters

Specified by:
purgeForm in interface FormService
Throws:
APIException
See Also:
FormService.purgeForm(org.openmrs.Form)

purgeForm

public void purgeForm(Form form,
                      boolean cascade)
               throws APIException
Description copied from interface: FormService
Completely remove a Form from the database. This is not reversible. !! WARNING: Calling this method with cascade=true can be very destructive !!

Specified by:
purgeForm in interface FormService
cascade - whether or not to cascade delete all dependent objects (including encounters!)
Throws:
APIException
See Also:
FormService.purgeForm(org.openmrs.Form, boolean)

purgeFormField

public void purgeFormField(FormField formField)
                    throws APIException
Description copied from interface: FormService
Completely removes the given FormField from the database. This is not reversible

Specified by:
purgeFormField in interface FormService
Parameters:
formField - the FormField to purge
Throws:
APIException
See Also:
FormService.purgeFormField(org.openmrs.FormField)

retireField

public Field retireField(Field field)
                  throws APIException
Description copied from interface: FormService
Retires field

Specified by:
retireField in interface FormService
Parameters:
field - the Field to retire
Returns:
the Field that was retired
Throws:
APIException
See Also:
FormService.retireField(org.openmrs.Field)

saveField

public Field saveField(Field field)
                throws APIException
Description copied from interface: FormService
Creates or updates the given Field

Specified by:
saveField in interface FormService
Parameters:
field - the Field to save
Returns:
the Field that was saved
Throws:
APIException
See Also:
FormService.saveField(org.openmrs.Field)

saveForm

public Form saveForm(Form form)
              throws APIException
Description copied from interface: FormService
Create or update the given Form in the database

Specified by:
saveForm in interface FormService
Parameters:
form - the Form to save
Returns:
the Form that was saved
Throws:
APIException
See Also:
FormService.saveForm(org.openmrs.Form)

saveFormField

public FormField saveFormField(FormField formField)
                        throws APIException
Description copied from interface: FormService
Creates or updates the given FormField

Specified by:
saveFormField in interface FormService
Parameters:
formField - the FormField to save
Returns:
the formField that was just saved
Throws:
APIException
See Also:
FormService.saveFormField(org.openmrs.FormField)

unretireField

public Field unretireField(Field field)
                    throws APIException
Description copied from interface: FormService
Unretires field

Specified by:
unretireField in interface FormService
Parameters:
field - the Field to unretire
Returns:
the Field that was unretired
Throws:
APIException
See Also:
FormService.unretireField(org.openmrs.Field)

getFields

public java.util.List<Field> getFields(java.lang.String fuzzySearchPhrase)
                                throws APIException
Description copied from interface: FormService
Find all Fields whose names are similar to or contain the given phrase. (The exact similarity algorithm is unspecified.) (includes retired fields)

Specified by:
getFields in interface FormService
Returns:
Fields with names similar to or containing the given phrase
Throws:
APIException
See Also:
FormService.getFields(java.lang.String)

getFieldsByConcept

public java.util.List<Field> getFieldsByConcept(Concept concept)
                                         throws APIException
Description copied from interface: FormService
Finds all Fields that point to the given concept, including retired ones.

Specified by:
getFieldsByConcept in interface FormService
Parameters:
concept - the concept to search for in the Field table
Returns:
fields that point to the given concept
Throws:
APIException
See Also:
FormService.getFieldsByConcept(org.openmrs.Concept)

getFormsContainingConcept

public java.util.List<Form> getFormsContainingConcept(Concept concept)
                                               throws APIException
Description copied from interface: FormService
Returns all forms that contain the given concept as a field in their schema. (includes retired forms)

Specified by:
getFormsContainingConcept in interface FormService
Parameters:
concept - the concept to search for in forms
Returns:
forms containing the specified concept in their schema
Throws:
APIException
See Also:
FormService.getFormsContainingConcept(org.openmrs.Concept)

purgeFieldType

public void purgeFieldType(FieldType fieldType)
                    throws APIException
Description copied from interface: FormService
Deletes the given field type from the database. This should not be done. It is preferred to just retired this field type with #retireFieldType(FieldType)

Specified by:
purgeFieldType in interface FormService
Parameters:
fieldType - the field type to purge
Throws:
APIException
See Also:
FormService.purgeFieldType(org.openmrs.FieldType)

saveFieldType

public FieldType saveFieldType(FieldType fieldType)
                        throws APIException
Description copied from interface: FormService
Saves the given field type to the database

Specified by:
saveFieldType in interface FormService
Parameters:
fieldType - the field type to save
Returns:
the saved field type
Throws:
APIException
See Also:
FormService.saveFieldType(org.openmrs.FieldType)

mergeDuplicateFields

public int mergeDuplicateFields()
                         throws APIException
Description copied from interface: FormService
Audit form, consolidate similar fields

Specified by:
mergeDuplicateFields in interface FormService
Throws:
APIException
See Also:
org.openmrs.api.FormService#auditForm(org.openmrs.Form)

OpenMRS-1.7.x

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