2

我有两个解决方案。如何获得另一种解决方案?

我认为 icm.util.SearchPayload 允许您获取当前解决方案的案例。

    buildPayload: function (values) {
            if (!values) {
                    console.log("An invalid values is received!");
                    return;
            }

            var searchPayload = new icm.util.SearchPayload();
            // CURRENT SOLUTION
            var solution = this.widget.solution;
            var params = {};
            params.ObjectStore = solution.getTargetOS().id;

            params.ceQuery = "SELECT t.[FolderName], t.[LastModifier], t.[DateLastModified], t.[CmAcmCaseTypeFolder], t.[CmAcmCaseState], t.[CmAcmCaseIdentifier], t.[DateCreated], t.[Creator], t.[Id], t.[ContainerType], t.[LockToken], t.[LockTimeout],  t.[ClassDescription], t.[DateLastModified], t.[FolderName] FROM [CmAcmCaseFolder] t where ";
            params.ceQuery += "t.[CmAcmCaseIdentifier] LIKE '%%' AND ";

            for (var key in values) {
                    var attr = values[key].attr;
                    if (attr.dataType === "xs:string") {
                            params.ceQuery += "t.[" + key + "] LIKE '%" + values[key].value + "%' AND ";
                    } else {
                            params.ceQuery += "t.[" + key + "] = " + values[key].value + " AND ";
                    }
            }

            params.ceQuery = params.ceQuery.substring(0, params.ceQuery.length - 4);

            var that = this;
            this.widget.solution.retrieveCaseTypes(function (types) {
                    console.log(params.ceQuery);
                    params.caseType = types && types.length > 0 && types[0].name; // default to the first case type
                    params.solution = solution;

                    searchPayload.setModel(params);
                    var payload = searchPayload.getSearchPayload(function (payload) {
                            that.widget.onBroadcastEvent("icm.SearchCases", payload);
                            console.log(payload);
                            that.displayPayload(payload);
                    });
                    //
            });
    },

或许

ecm.model.desktop.retrieveSolutions?

谢谢!

4

1 回答 1

0

解决方案:

define(["dojo/_base/declare", 
"dojo/_base/lang",
"dojo/_base/array",
"icm/base/Constants",
"icm/model/Case",   
"ecm/LoggerMixin",
"icm/model/_DesktopMixin"], 
function(declare, lang, array, Constants, Case, LoggerMixin, _DesktopMixin){
    return declare("icm.custom.pgwidget.customSearchWidget.CustomWidgetContentPaneEventListener", [LoggerMixin, _DesktopMixin], {

        searchTemplate: null,
        widget: null,

        constructor: function(widget){
            this.widget = widget;
        },

        buildPayload: function(values) {
            if(!values) {
                console.log("An invalid values is received!");
                return;
            }

            console.log("retrieveSolutions");
            var that = this;
            this.retrieveSolutions(function(solutionList) {
                array.forEach(solutionList, function(solution) {
                    if (solution.id === "CBFPSFED_57_2") {
                        console.log("CBFPSFED_57_2");

                        var searchPayload = new icm.util.SearchPayload();

                        var params = {};
                        params.ObjectStore = solution.getTargetOS().id;

                        params.ceQuery = "SELECT t.[FolderName], t.[LastModifier], t.[DateLastModified], t.[CmAcmCaseTypeFolder], t.[CmAcmCaseState], t.[CmAcmCaseIdentifier], t.[DateCreated], t.[Creator], t.[Id], t.[ContainerType], t.[LockToken], t.[LockTimeout],  t.[ClassDescription], t.[DateLastModified], t.[FolderName] FROM [CmAcmCaseFolder] t where ";
                        params.ceQuery += "t.[CmAcmCaseIdentifier] LIKE '%%'  AND t.[JR572_name] LIKE '%%%'";

                        solution.retrieveCaseTypes(function(types) {
                            console.log(types);             
                            console.log(params.ceQuery);
                            params.caseType = types && types.length > 0 && types[0].name; // default to the first case type
                            params.solution = solution;

                            searchPayload.setModel(params);
                            var payload = searchPayload.getSearchPayload(function(payload) {
                                that.widget.onBroadcastEvent("icm.SearchCases", payload);
                                console.log("buildPayload");
                                console.log(payload);
                            });
                        });
                    }
                });
            });
        },

        _eoc_: null
    });
});

关键点:

icm/model/_DesktopMixin

this.retrieveSolutions(function(solutionList) {

于 2018-09-18T13:47:33.170 回答