אתה מציג תוכן עזרה עבור גרסה:
- 6.4
- 6.3
- 6.2
- גירסאות קודמות
AEM Forms portal drafts and submissions component allows users to save their forms as drafts and submit later from any device. Also, users can view their submitted forms on portal. To enable this functionality, AEM Forms provides data and metadata services to store the data filled in by a user in the form and the form metadata associated with drafts and submitted forms. This data is stored in the CRX repository, by default. However, as users interact with forms through AEM publish instance, which is generally outside the enterprise firewall, organizations may want to customize data storage for it to be more secure and reliable.
The sample, discussed in this document, is a reference implementation of customized data and metadata services to integrate drafts and submissions component with a database. The database used in the sample implementation is MySQL 5.6.24. However, you can integrate the drafts and submissions component with any database of your choice.
הערה:
- The examples and configurations explained in this document are according to MySQL 5.6.24 and you must substitute them appropriately for your database system.
- Ensure that you have installed latest version of AEM Forms add-on package. For the list of available packages, see the AEM Forms releases article.
Perform the following steps, on all the author and publish instances, to install and configure the sample :
-
הורד
-
Property Description Value Forms Portal Draft Data Service Identifier for draft data service formsportal.sampledataservice Forms Portal Draft Metadata Service Identifier for draft metadata service formsportal.samplemetadataservice Forms Portal Submit Data Service Identifier for submit data service formsportal.sampledataservice Forms Portal Submit Metadata Service Identifier for submit metadata service formsportal.samplemetadataservice Forms Portal Pending Sign Data Service Identifier for Pending Sign data service formsportal.sampledataservice Forms Portal Pending Sign Metadata Service Identifier for Pending Sign metadata service formsportal.samplemetadataservice הערה:
The services are resolved by their names mentioned as value for the aem.formsportal.impl.prop key as follows:
@Service(value = {SubmitDataService.class, DraftDataService.class}) @Property(name = "aem.formsportal.impl.prop", value = "formsportal.sampledataservice") @Service(value = { SubmitMetadataService.class, DraftMetadataService.class }) @Property(name = "aem.formsportal.impl.prop", value = "formsportal.samplemetadataservice")
You can change names of the data and metadata tables.
To provide a different name for the metadata table:
- In the Web Console Configuration, find and click Forms Portal Metadata Service Sample Implementation. You can change the values of data source, metadata/additional metadata table name.
To provide a different name for the data table:
- In the Web Console Configuration, find and click Forms Portal Data Service Sample Implementation. You can change the values of data source and data table name.
Note: If you change the table names, provide them in the Form Portal configuration.
-
For Apache Sling connection, find and click to open Apache Sling Connection Pooled DataSource in edit mode in the Web Console Configuration. Specify the values for properties as described in the following table:
Property Value Datasource name A datasource name for filtering drivers from the data source pool
Note: The sample implementation uses FormsPortal as the datasource name.
JDBC driver class com.mysql.jdbc.Driver JDBC connection URI
jdbc:mysql://[host]:[port]/[schema_name] Username A username to authenticate and perform actions on database tables Password Password associated with the username Transaction Isolation READ_COMMITTED Max Active Connections 1000 Max Idle Connections 100 Min Idle Connections 10 Initial Size 10 Max Wait 100000 Test on Borrow Checked Test while Idle Checked Validation Query Example values are SELECT 1(mysql), select 1 from dual(oracle), SELECT 1(MS Sql Server) (validationQuery) Validation Query timeout 10000 הערה:
- The JDBC driver for MySQL is not provided with the sample. Ensure that you have provisioned for it and provide the required information to configure the JDBC connection pool.
- Point your author and publish instances to use same database. Value of the JDBC connection URI field must be same for all the author and publish instances.
-
If you already have a table in the database schema, skip to the next step.
Otherwise, if you do not already have a table in the database schema, execute the following SQL statements to create separate tables for data, metadata, and additional metadata in the database schema:
הערה:
You do not require different databases for author and publish instances. Use same database on all the author and publish instances.
CREATE TABLE `data` ( `owner` varchar(255) DEFAULT NULL, `data` longblob, `metadataId` varchar(45) DEFAULT NULL, `id` varchar(45) NOT NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE `metadata` ( `formPath` varchar(1000) DEFAULT NULL, `formType` varchar(100) DEFAULT NULL, `description` text, `formName` varchar(255) DEFAULT NULL, `owner` varchar(255) DEFAULT NULL, `enableAnonymousSave` varchar(45) DEFAULT NULL, `renderPath` varchar(1000) DEFAULT NULL, `nodeType` varchar(45) DEFAULT NULL, `charset` varchar(45) DEFAULT NULL, `userdataID` varchar(45) DEFAULT NULL, `status` varchar(45) DEFAULT NULL, `formmodel` varchar(45) DEFAULT NULL, `markedForDeletion` varchar(45) DEFAULT NULL, `showDorClass` varchar(255) DEFAULT NULL, `sling:resourceType` varchar(1000) DEFAULT NULL, `attachmentList` longtext, `draftID` varchar(45) DEFAULT NULL, `submitID` varchar(45) DEFAULT NULL, `id` varchar(60) NOT NULL, `profile` varchar(255) DEFAULT NULL, `submitUrl` varchar(1000) DEFAULT NULL, `xdpRef` varchar(1000) DEFAULT NULL, `agreementId` varchar(255) DEFAULT NULL, `nextSigners` varchar(255) DEFAULT NULL, `eSignStatus` varchar(45) DEFAULT NULL, `pendingSignID` varchar(45) DEFAULT NULL, `agreementDataId` varchar(255) DEFAULT NULL, `enablePortalSubmit` varchar(45) DEFAULT NULL, `submitType` varchar(45) DEFAULT NULL, `dataType` varchar(45) DEFAULT NULL, `jcr:lastModified` varchar(45) DEFAULT NULL, PRIMARY KEY (`id`), UNIQUE KEY `ID_UNIQUE` (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE `additionalmetadatatable` ( `value` text, `key` varchar(255) NOT NULL, `id` varchar(60) NOT NULL, PRIMARY KEY (`id`,`key`), CONSTRAINT ‘additionalmetadatatable_fk’ FOREIGN KEY (`id`) REFERENCES `metadata` (`id`) ON DELETE CASCADE ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE `commenttable` ( `commentId` varchar(255) DEFAULT NULL, `comment` text DEFAULT NULL, `ID` varchar(255) DEFAULT NULL, `commentowner` varchar(255) DEFAULT NULL, `time` varchar(255) DEFAULT NULL);
-
If you already have the tables (data, metadata, and additionalmetadatatable) in the database schema, execute the following alter table queries:
ALTER TABLE `data` CHANGE `owner` `owner` VARCHAR(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL;
ALTER TABLE metadata add markedForDeletion varchar(45) DEFAULT NULL
הערה:
The ALTER TABLE metadata add query fails if you have already run it and the markedforDeletion column is present in the table.
ALTER TABLE metadata add agreementId varchar(255) DEFAULT NULL, add nextSigners varchar(255) DEFAULT NULL, add eSignStatus varchar(45) DEFAULT NULL, add pendingSignID varchar(45) DEFAULT NULL, add agreementDataId varchar(255) DEFAULT NULL, add enablePortalSubmit varchar(45) DEFAULT NULL, add submitType varchar(45) DEFAULT NULL, add dataType varchar(45) DEFAULT NULL;
ALTER TABLE `metadata` CHANGE `formPath` `formPath` VARCHAR(1000) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL, CHANGE `formType` `formType` VARCHAR(100) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL, CHANGE `description` `description` TEXT CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL, CHANGE `formName` `formName` VARCHAR(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL, CHANGE `owner` `owner` VARCHAR(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL, CHANGE `renderPath` `renderPath` VARCHAR(1000) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL, CHANGE `showDorClass` `showDorClass` VARCHAR(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL, CHANGE `sling:resourceType` `sling:resourceType` VARCHAR(1000) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL, CHANGE `profile` `profile` VARCHAR(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL, CHANGE `submitUrl` `submitUrl` VARCHAR(1000) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL, CHANGE `xdpRef` `xdpRef` VARCHAR(1000) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL;
ALTER TABLE `additionalmetadatatable` CHANGE `value` `value` TEXT CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL, CHANGE `key` `key` VARCHAR(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL;
The sample implementation is now configured, which you can use to list your drafts and submissions while storing all data and metadata in a database. Let’s now see how data and metadata services are configured in the sample.
Perform the following steps,on all the author and publish instances, to install the mysql-connector-java-5.1.39-bin.jar file:
The following zip contains FormsPortalSampleDataServiceImpl and FormsPortalSampleMetadataServiceImpl (implementation classes) for data and metadata service interfaces. Additionally, it contains all the classes required for compilation of above mentioned implementation classes.
הורד
Database implementation of Forms Portal uses additional metadata table. The table has a composite primary key based on Key and id columns of the table. MySQL allows primary keys up to the length of 255 characters. You can use the following client-side validation script to verify the length of filename attached to the file widget. The validation is run when a file is attached. The script provided in the following procedure displays a message, when the filename is larger than 150 (including extension). You can modify the script to check it for a different number of characters.
Perform the following steps to create a client library and use the script:
-
Right-click the node, click create new file, and create a file with extension .txt. For example, js.txt Add the following code to the newly created .txt file and click Save All.
#base=util
util.jsIn the above code, util is the name of the folder and util.js name of the file in the util folder. The util folder and util.js file are created in suceeeding steps.
-
Add the following code to util.js file and click Save All. The code validate length of the file name.
/* * ADOBE CONFIDENTIAL * ___________________ * * Copyright 2016 Adobe Systems Incorporated * All Rights Reserved. * * NOTICE: All information contained herein is, and remains * the property of Adobe Systems Incorporated and its suppliers, * if any. The intellectual and technical concepts contained * herein are proprietary to Adobe Systems Incorporated and its * suppliers and may be covered by U.S. and Foreign Patents, * patents in process, and are protected by trade secret or copyright law. * Dissemination of this information or reproduction of this material * is strictly forbidden unless prior written permission is obtained * from Adobe Systems Incorporated. * */ (function () { var connectWithGuideBridge = function (gb) { gb.connect(function () { //For first time load window.guideBridge.on("elementValueChanged" , function(event, payload) { var component = payload.target; // Field whose value has changed if(component.name == 'fileAttachment' && component.parent) { var fileItems = $('#'+payload.target.parent.id).find(".guide-fu-fileItem"); for (i = 0;i<fileItems.length;i++) { var filename = $(fileItems[i]).find(".guide-fu-fileName").text(); //check whether it is previously attached file or a newly attached one if(filename.length > 150 && filename.indexOf("fp.attach.jsp") < 0) { window.alert("filename is larger than 150 : "+filename); $(fileItems[i]).find(".guide-fu-fileClose.close").click(); } } } }); }); }; if (window.guideBridge) { connectWithGuideBridge(window.guideBridge); } else { window.addEventListener("bridgeInitializeStart", function (event) { connectWithGuideBridge(event.detail.guideBridge); }); } })();
הערה:
The script is for out of the box (OOTB) attachment widget component. If you have customized the OOTB attachment widget then change the above script to incorporate respective changes.
-
Navigate to /etc/clientlibs/fd/af/guideRuntimewithXFA and append the fp.validation value to embed property.
הערה:
If you are using custom client libraries instead of of the guideRuntime and guideRuntimeWithXfa client libraries, use the category name to embed the client library created in this procedure to your custom libraries loaded at runtime.