Übersicht

Mit AEM Forms können Sie ein Formular als Entwurf speichern. Mit der Entwurfsfunktion können Sie ein aktuelles Formular beibehalten, welches Sie zu einem späteren Zeitpunkt auf einem anderen Gerät abschließen und senden können.

Standardmäßig speichert AEM Forms die Benutzerdaten, die mit dem Entwurf und der Übermittlung eines Formulars im Knoten /content/forms/fp in der Veröffentlichungsinstanz verknüpft sind. Darüber hinaus stellen die AEM Forms-Portalkomponenten Datendienste bereit, die Sie zum Anpassen des Speicherns der Benutzerdaten für Entwürfe und Übermittlungen verwenden können. Beispielsweise können Sie Benutzerdaten in einem Datenspeicher speichern.

Entwurfsdatendienst

Um das Speichern der Benutzerdaten für Entwürfe anzupassen, müssen Sie alle Methoden der DraftDataService-Schnittstelle implementieren. Im Folgenden Beispielcode werden die Methoden und die Argumente beschrieben.

public interface DraftDataService {
	
    /**
     * To save/modify user data for this userDataID, it will be null in case of creation 
     * @param userDataID, unique identifier associated with this user data
     * @param formName, name of the form whose draft is being saved
     * @param formData, user data associated with this draft
     * @return userdataID, corresponding to which user data has been stored and which can be used later to retrieve this user data
     * @throws FormsPortalException
     */
	public String saveData (String userDataID, String formName, String formData) throws FormsPortalException;
	
	/**
	 * Returns the user data stored against the ID passed as the argument
	 * @param draftDataID unique data id for data associated with a draft
	 * @return user data associated with this data ID
	 * @throws FormsPortalException
	 */
	
	public byte[] getData (String draftDataID) throws FormsPortalException;
	
	/**
	 * To delete data associated with this draft
	 * @param draftDataID unique data id for data associated with a draft
	 * @return status of delete operation on data associated with this draft 
	 * @throws FormsPortalException
	 */
	
	public boolean deleteData (String draftDataID) throws FormsPortalException;
	
	/**
	 * Saves the attachment for current form instance 
	 * @param draftID associated with this draft
	 * @param attachmentsBytes would expect byte array of the attachment to be saved
	 * @return unique id for the attachment just saved (so that it could be retrieved later)
	 * @throws FormsPortalException
	 */
	public String saveAttachment (String draftID, byte[] attachmentBytes) throws FormsPortalException;
	
	/**
	 * To delete an attachment
	 * @param attachmentID, unique id for this attachment
	 * @return status of delete operation performed on attachment corresponding to this attachment ID
	 * @throws FormsPortalException
	 */
	public boolean deleteAttachment (String attachmentID) throws FormsPortalException;
	
	/**
	 * To get attachment bytes
	 * @param attachmentID, unique id for this attachment
	 * @return data corresponding to this attachmentID
	 * @throws FormsPortalException
	 */
	public byte[] getAttachment (String attachmentID) throws FormsPortalException;
}

Übermittlungsdatendienst

Um das Speichern der Benutzerdaten für Übermittlungen anzupassen, müssen Sie alle Methoden der SubmitDataService-Schnittstelle implementieren. Im Folgenden Beispielcode werden die Methoden und die Argumente beschrieben.

public interface SubmitDataService {
	
	/**
	 * Submits the user data passed in argument map
	 * @param userDataID, unique identifier associated with this user data
	 * @param formName, name of the form whose draft is being submitted
	 * @param formData, user data associated with this submission
	 * @return userdataID, corresponding to which the user data has been stored and which can be used later to retrieve this data
	 * @throws FormsPortalException
	 */
	public String saveData (String userDataID, String formName, String formData) throws FormsPortalException;
	
	/**
	 * Gets the user data stored against the ID passed as argument
	 * @param userDataID, unique id associated with this user data for this submission
	 * @return user data associated with this submission
	 * @throws FormsPortalException
	 */
	public byte[] getData(String userDataID) throws FormsPortalException;
	
	/**
	 * Deletes user data stored against the userDataID
	 * @param userDataID, unique id associated with this user data for this submission
	 * @return status of the delete operation on this submission
	 * @throws FormsPortalException
	 */
	
	public boolean deleteData(String userDataID) throws FormsPortalException;
	
	
	/**
	 * Submits the attachment bytes passed as argument
	 * @param submitID, unique id associated with the submission metadata
	 * @param attachmentsBytes would expect byte array of the attachment for this submission
	 * @return id for the attachment just saved (so that it could be retrieved later) 
	 * @throws FormsPortalException
	 */
	public String saveAttachment(String submitID, byte[] attachmentBytes) throws FormsPortalException;

	/**
	 * To delete an attachment
	 * @param attachmentID, unique id for this attachment
	 * @return status of delete operation performed on attachment corresponding to this attachment ID
	 * @throws FormsPortalException
	 */
	public boolean deleteAttachment (String attachmentID) throws FormsPortalException;
	
	/**
	 * To get attachment bytes
	 * @param attachmentID, unique id for this attachment
	 * @return data corresponding to this attachmentID
	 * @throws FormsPortalException
	 */
	public byte[] getAttachment (String attachmentID) throws FormsPortalException;
}

Dieses Werk unterliegt den Bedingungen der Creative Commons Attribution-Noncommercial-Share Alike 3.0 Unported License.  Twitter™- und Facebook-Beiträge fallen nicht unter die Bedingungen der Creative Commons-Lizenz.

Rechtliche Hinweise   |   Online-Datenschutzrichtlinie