Oracle BPMワークリストでカスタマイズされたアプリケーションを有効化するJavaコード

次に、Oracle BPMワークリストで、カスタマイズされたアプリケーションを有効化するJavaコードを示します。

「カスタマイズされたアプリケーションおよびリンクを有効にする方法」では、Oracle BPMワークリストの「アプリケーション・プリファレンス」ページを使用してカスタム・アプリケーションを指定する方法について説明しています。この指定を実行するJavaコードは、次のとおりです:

package view.customisationimpl;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import oracle.bpel.services.workflow.client.IWorkflowServiceClient;
import oracle.bpel.services.workflow.runtimeconfig.IRuntimeConfigService;
import oracle.bpel.services.workflow.runtimeconfig.model.AttributeLabelType;
import oracle.bpel.services.workflow.runtimeconfig.model.AttributeLabelUsageList;
import oracle.bpel.services.workflow.runtimeconfig.model.AttributeLabelUsages;
import oracle.bpel.services.workflow.verification.IWorkflowContext;
import oracle.bpm.ui.customization.CustomLink;
import oracle.bpm.ui.customization.IBPMUICustomizations;

public class WorkspaceCustomisationImpl implements IBPMUICustomizations {
    private static Map displayNameMap = new HashMap();
    public WorkspaceCustomisationImpl() {
        displayNameMap.put("instanceId", "Instance Id");
        displayNameMap.put("protectedTextAttribute1", "Business Status");
    }
    public List<CustomLink> getCustomGlobalLinks() {
        CustomLink globalLink1 =
            new CustomLink("Oracle Home Page", "www.oracle.com", null);
        CustomLink globalLink2 =
            new CustomLink("Self Services Application", "http://global-ebusiness.example.com/",
                           null);
        CustomLink globalLink3 =
            new CustomLink("BUG DB", "https://bug.example.com/", null);
        List<CustomLink> globalLinks = new ArrayList<CustomLink>();
        globalLinks.add(globalLink1);
        globalLinks.add(globalLink2);
        globalLinks.add(globalLink3);
        return globalLinks;
    }
    public String getColumnNames() {
        return "title,taskNumber,instanceId,creator,protectedTextAttribute1";
    }
 
    private static void initDisplayMap(IWorkflowServiceClient client,
        IWorkflowContext context) {
        // you can use service to load all label namess for text attributes
        if (displayNameMap == null) {
            synchronized (String.class) {
                if (displayNameMap == null) {
                    displayNameMap = new HashMap();
                    try {
                        IRuntimeConfigService service =
                            client.getRuntimeConfigService();
                        AttributeLabelUsageList list =
                            service.getAttributeLabelUsages(context, "Text");
                        List<AttributeLabelUsages> list1 =
                            list.getAttributeLabelUsages();
                        for (AttributeLabelUsages usage : list1) {
                            AttributeLabelType type = usage.getLabel();
                            displayNameMap.put(type.getTaskAttribute(),
                                               type.getLabelName());
                        }
                    } catch (Exception exc) {
                    }
                }
            }
        }
    }
 
    public String getColumnDisplayName(IWorkflowServiceClient client,
                                       IWorkflowContext context,
                                       java.lang.String colName) {
        initDisplayMap(client, context);
        return (String)displayNameMap.get(colName);
    }
}