代理UI允許代理準備併發送互動式通信到後置進程。 工程師會視需要進行修改,並將互動式通訊提交至後置程式,例如電子郵件或列印。
建立互動式通信後,代理可以在代理UI中開啟互動式通信,並通過輸入資料和管理內容和附件來準備特定於收件人的副本。 最後,代理可將互動式通訊提交至後置程式。
使用代理UI準備互動式通訊時,代理會先在代理UI中管理互動式通訊的下列方面,再將它送出至後置程式:
選擇Forms > Forms & Documents。
選擇適當的「Interactive Communication(互動式通信)」 ,然後按一下「Open Agent UI(開啟代理UI)」。
代理UI僅在選定的互動式通信具有打印通道時才起作用。
根據Interactive Communication的內容和屬性,代理UI將顯示為以下三個頁籤:資料、內容和附件。
繼續輸入資料、管理內容以及管理附件。
在「資料」索引標籤中,視需要輸入變數、表單資料模型屬性和列印範本(XDP)欄位的資料。 填寫所有標有星號(*)的必填欄位,以啟用Submit按鈕。
在「互動式通訊」預覽中點選資料欄位值,以在「資料」索引標籤中反白顯示對應的資料欄位,反之亦然。
在「內容」索引標籤中,管理「互動式通訊」中的檔案片段和內容變數等內容。
選擇內容。 此時將顯示「互動式通信」的內容頁籤。
視需要在「內容」索引標籤中編輯檔案片段。 若要將焦點放在內容階層中的相關片段上,您可以在「互動式通訊」預覽中點選相關行或段落,或直接在「內容」階層中點選片段。
例如,檔案片段的行為是「立即線上付款……」」在下圖的預覽中選取,而「內容」索引標籤中也選取了相同的檔案片段。
在「內容」或「資料」索引標籤中,點選預覽左上角的「反白標示內容中選取的模組」(),可停用或啟用在預覽中點選/選取相關文字、段落或資料欄位時移至檔案片段的功能。
建立交互通信時允許由代理編輯的片段具有編輯選定內容()表徵圖。 點選「編輯選取的內容」圖示,以編輯模式啟動片段並在其中進行變更。 使用下列選項來格式化和管理文字:
有關Agent用戶介面中各種文檔片段的可用操作的詳細資訊,請參閱Agent用戶介面中的可用操作和資訊。
要將分頁符添加到互動式通信的打印輸出中,請將游標置於要插入分頁符的位置,然後選擇「分頁前」或「分頁後」()。
在「互動式通訊」中插入明確的分頁符預留位置。 若要檢視明確的分頁符號如何影響互動式通訊,請參閱列印預覽。
繼續管理互動式通訊的附件。
選擇附件。 Agent UI顯示建立交互通信時設定的可用附件。
您可以點選檢視圖示,選擇不隨附件一起提交「互動式通訊」,也可以點選附件中的交叉點以從「互動式通訊」中刪除附件(如果允許代理刪除或隱藏附件)。 對於在建立互動式通信時指定為必備附件的附件,將禁用「查看」和「刪除」表徵圖。
點選「資料庫存取」()圖示,以存取「內容庫」,將DAM資產插入為附件。
只有在建立互動式通訊時(在列印頻道的「檔案容器」屬性中)啟用資料庫存取時,才能使用「資料庫存取」圖示。
如果在建立「交互通信」時未鎖定附件順序,則可以通過選擇附件並點選向下和向上箭頭來重新排序附件。
使用「網頁預覽和列印預覽」,查看這兩個輸出是否符合您的需求。
如果您發現預覽結果令人滿意,請點選Submit以提交/傳送互動式通訊至貼文程式。 或者,若要進行變更,請退出預覽,返回進行變更。
在代理UI中編輯文字片段時,工具列會依您選擇進行的編輯類型而變更:字型、段落或清單:
字型工具列
段落工具列
清單工具列
若要反白\強調可編輯片段中的部分文字,請選取文字並點選「反白顯示顏色」。
Agent UI已內建支援210個特殊字元。 管理員可以透過自訂新增對更多/自訂特殊字元的支援。
編輯(僅限文字片段):開啟豐富式文字編輯器,以編輯文字檔案片段。 如需詳細資訊,請參閱格式化文字。
選取範圍(眼睛圖示):包含\排除「互動式通訊」中的檔案片段。
未填充的值(資訊):指出檔案片段中未填入的變數數。
您可以使用Agent UI為每個「互動式通訊」儲存一或多個草稿,並稍後擷取草稿以繼續處理。 您可以為每個草稿指定不同的名稱以加以識別。
Adobe建議依序執行這些指示,以成功將互動式通訊儲存為草稿。
預設情況下,「另存為拔模」(Save as a Draft)特徵不啟用。 執行下列步驟以啟用功能:
實施ccrDocumentInstance服務提供商介面(SPI)。
SPI可讓您將互動式通信的草稿版本以草稿ID作為唯一標識符保存到資料庫。 這些指示假設您先前已具備使用Maven專案建立OSGi套件的相關知識。
有關SPI實施示例,請參見Sample ccrDocumentInstance SPI實施。
開啟http://<hostname>:<port>/ system/console/bundles
並點選安裝/更新以上傳OSGi套件。 驗證已上載包的狀態是否顯示為活動。 如果軟體包的狀態未顯示為活動,請重新啟動伺服器。
前往 https://'[server]:[port]'/system/console/configMgr
.
點選建立對應設定。
選擇「使用CCRDocumentInstanceService 啟用儲存」,然後點選「儲存」。
執行以下步驟將互動式通信另存為草稿:
在Forms Manager中選擇「互動式通訊」,然後點選Open Agent UI。
在代理UI中進行適當的更改,然後點選「另存為草稿」。
在Name欄位中指定草稿名稱,然後點選Done。
將「互動式通訊」儲存為草稿後,請點選「儲存變更」以儲存對草稿的任何進一步變更。
將互動式通訊儲存為草稿後,您可以擷取它以繼續處理它。 使用下列方法檢索互動式通信:
https://server:port/aem/forms/createcorrespondence.hmtl?draftid=[draftid]
[將] 互動式通訊儲存為草稿後產生之草稿版本的唯一識別碼。
如果您在將「互動式通訊」儲存為草稿後對它進行任何變更,則草稿版本無法開啟。
實作ccrDocumentInstance
SPI,將互動式通訊儲存為草稿。 以下是ccrDocumentInstance
SPI的示例實現。
package Implementation;
import com.adobe.fd.ccm.ccr.ccrDocumentInstance.api.exception.CCRDocumentException;
import com.adobe.fd.ccm.ccr.ccrDocumentInstance.api.model.CCRDocumentInstance;
import com.adobe.fd.ccm.ccr.ccrDocumentInstance.api.services.CCRDocumentInstanceService;
import org.apache.commons.lang3.StringUtils;
import org.osgi.service.component.annotations.Component;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.util.*;
@Component(service = CCRDocumentInstanceService.class, immediate = true)
public class CCRDraftService implements CCRDocumentInstanceService {
private static final Logger logger = LoggerFactory.getLogger(CCRDraftService.class);
private HashMap<String, Object> draftDataMap = new HashMap<>();
@Override
public String save(CCRDocumentInstance ccrDocumentInstance) throws CCRDocumentException {
String documentInstanceName = ccrDocumentInstance.getName();
if (StringUtils.isNotEmpty(documentInstanceName)) {
logger.info("Saving ccrData with name : {}", ccrDocumentInstance.getName());
if (!CCRDocumentInstance.Status.SUBMIT.equals(ccrDocumentInstance.getStatus())) {
ccrDocumentInstance = mySQLDataBaseServiceCRUD(ccrDocumentInstance,null, "SAVE");
}
} else {
logger.error("Could not save data as draft name is empty");
}
return ccrDocumentInstance.getId();
}
@Override
public void update(CCRDocumentInstance ccrDocumentInstance) throws CCRDocumentException {
String documentInstanceName = ccrDocumentInstance.getName();
if (StringUtils.isNotEmpty(documentInstanceName)) {
logger.info("Saving ccrData with name : {}", documentInstanceName);
mySQLDataBaseServiceCRUD(ccrDocumentInstance, ccrDocumentInstance.getId(), "UPDATE");
} else {
logger.error("Could not save data as draft Name is empty");
}
}
@Override
public CCRDocumentInstance get(String id) throws CCRDocumentException {
CCRDocumentInstance cCRDocumentInstance;
if (StringUtils.isEmpty(id)) {
logger.error("Could not retrieve data as draftId is empty");
cCRDocumentInstance = null;
} else {
cCRDocumentInstance = mySQLDataBaseServiceCRUD(null, id,"GET");
}
return cCRDocumentInstance;
}
@Override
public List<CCRDocumentInstance> getAll(String userId, Date creationTime, Date updateTime,
Map<String, Object> optionsParams) throws CCRDocumentException {
List<CCRDocumentInstance> ccrDocumentInstancesList = new ArrayList<>();
HashMap<String, Object> allSavedDraft = mySQLGetALLData();
for (String key : allSavedDraft.keySet()) {
ccrDocumentInstancesList.add((CCRDocumentInstance) allSavedDraft.get(key));
}
return ccrDocumentInstancesList;
}
//The APIs call the service in the database using the following section.
private CCRDocumentInstance mySQLDataBaseServiceCRUD(CCRDocumentInstance ccrDocumentInstance,String draftId, String method){
if(method.equals("SAVE")){
String autoGenerateId = draftDataMap.size() + 1 +"";
ccrDocumentInstance.setId(autoGenerateId);
draftDataMap.put(autoGenerateId, ccrDocumentInstance);
return ccrDocumentInstance;
}else if (method.equals("UPDATE")){
draftDataMap.put(ccrDocumentInstance.getId(), ccrDocumentInstance);
return ccrDocumentInstance;
}else if(method.equals("GET")){
return (CCRDocumentInstance) draftDataMap.get(draftId);
}
return null;
}
private HashMap<String, Object> mySQLGetALLData(){
return draftDataMap;
}
}
save
、update
、get
和getAll
操作調用資料庫服務,以將互動式通信另存為草稿、更新互動式通信、從資料庫檢索資料,以及檢索資料庫中所有可用互動式通信的資料。 此示例使用mySQLDataBaseServiceCRUD
作為資料庫服務的名稱。
下表說明了示例ccrDocumentInstance
SPI實現。 它演示了save
、update
、get
和getAll
操作在示例實施中如何調用資料庫服務。
操作 |
資料庫服務示例 |
您可以建立互動式通訊的草稿,或直接提交。 儲存作業的API會檢查「互動式通訊」是否以草稿形式提交,並包含草稿名稱。 然後,API會以「儲存為輸入法」呼叫mySQLDataBaseServiceCRUD服務。 ![]() |
mySQLDataBaseServiceCRUD服務會驗證「另存為輸入方法」,並產生自動產生的草稿ID並將其傳回AEM。 產生草稿ID的邏輯會因資料庫而異。 ![]() |
更新操作的API會擷取互動式通訊草稿的狀態,並檢查互動式通訊是否包含草稿名稱。 API會呼叫mySQLDataBaseServiceCRUD服務,以在資料庫中更新該狀態。 ![]() |
mySQLDataBaseServiceCRUD服務將「更新」驗證為輸入方法,並將「交互通信」草稿的狀態保存在資料庫中。 ![]() |
取得作業的API會檢查互動式通訊是否包含草稿ID。 然後,API會以Get作為輸入方法呼叫mySQLDataBaseServiceCRUD服務,以擷取互動式通訊的資料。 ![]() |
mySQLDataBaseServiceCRUD服務驗證Get作為輸入方法,並基於草稿ID檢索互動式通信的資料。 ![]() |
getAll操作的API調用mySQLGetALLData服務,以檢索資料庫中保存的所有互動式通信的資料。 ![]() |
mySQLGetALLData服務檢索資料庫中保存的所有互動式通信的資料。 ![]() |
以下是實施中pom.xml
檔案的範例:
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.adobe.livecycle</groupId>
<artifactId>draft-sample</artifactId>
<version>2.0.0-SNAPSHOT</version>
<name>Interact</name>
<packaging>bundle</packaging>
<dependencies>
<dependency>
<groupId>com.adobe.aemfd</groupId>
<artifactId>aemfd-client-sdk</artifactId>
<version>6.0.160</version>
</dependency>
</dependencies>
<!-- ====================================================================== -->
<!-- B U I L D D E F I N I T I O N -->
<!-- ====================================================================== -->
<build>
<plugins>
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<version>3.3.0</version>
<extensions>true</extensions>
<executions>
<!--Configure extra execution of 'manifest' in process-classes phase to make sure SCR metadata is generated before unit test runs-->
<execution>
<id>scr-metadata</id>
<goals>
<goal>manifest</goal>
</goals>
</execution>
</executions>
<configuration>
<exportScr>true</exportScr>
<instructions>
<!-- Enable processing of OSGI DS component annotations -->
<_dsannotations>*</_dsannotations>
<!-- Enable processing of OSGI metatype annotations -->
<_metatypeannotations>*</_metatypeannotations>
<Bundle-SymbolicName>${project.groupId}-${project.artifactId}</Bundle-SymbolicName>
</instructions>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>8</source>
<target>8</target>
</configuration>
</plugin>
</plugins>
</build>
<profiles>
<profile>
<id>autoInstall</id>
<build>
<plugins>
<plugin>
<groupId>org.apache.sling</groupId>
<artifactId>maven-sling-plugin</artifactId>
<executions>
<execution>
<id>install-bundle</id>
<phase>install</phase>
<goals>
<goal>install</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
</profiles>
</project>
確保將pom.xml
檔案中的aemfd-client-sdk
相關性更新為6.0.160。