IBM Content Navigator ContentList设置行项目的属性

问题描述

我正在尝试建立自定义搜索,并且遵循了红皮书中的示例。但是,我没有创建新功能,而是通过修改在FileNet数据库上执行的查询来修改当前的搜索行为。根据示例,仅设置和显示了几个默认属性。我正在努力设置其他文档属性。

  private static void buildResultStructure(JSONResultSetResponse jsonResultSet,MessageResources resources,Locale clientLocale) { 
    String[] states = new String[1]; 
    states[0] = "isLocked"; 
    jsonResultSet.addColumn(new JSONResultSetColumn(" ","multiStateIcon",false,states));
    jsonResultSet.addColumn(new JSONResultSetColumn(" ","17px","mimeTypeIcon",null,false)); 
    jsonResultSet.addColumn(new JSONResultSetColumn(resources.getMessage(clientLocale,"search.results.header.id"),"200px","ID",false));
    jsonResultSet.addColumn(new JSONResultSetColumn("Class Name","125px","className","search.results.header.lastModifiedByUser"),"ModifiedBy","search.results.header.lastModifiedTimestamp"),"175px","LastModified","search.results.header.version"),"50px","Version",false));
    jsonResultSet.addMagazineColumn(new JSONResultSetColumn("thumbnail","60px","thumbnail",null)); 
    com.ibm.json.java.JSONArray fieldsToDisplay = new com.ibm.json.java.JSONArray();
    com.ibm.json.java.JSONObject jsonObj = new com.ibm.json.java.JSONObject(); 
    jsonObj.put("field","className");
    jsonObj.put("displayName","Class"); 
    fieldsToDisplay.add(jsonObj); 
    jsonObj =new com.ibm.json.java.JSONObject(); 
    jsonObj.put("field","ModifiedBy");
    jsonObj.put("displayName",resources.getMessage(clientLocale,"search.results.header.lastModifiedByUser")); 
    fieldsToDisplay.add(jsonObj);
    jsonObj = new com.ibm.json.java.JSONObject(); 
    jsonObj.put("field","LastModified");
    jsonObj.put("displayName","search.results.header.lastModifiedTimestamp"));
    fieldsToDisplay.add(jsonObj);
    jsonObj = new com.ibm.json.java.JSONObject();
    jsonObj.put("field","Version"); 
    jsonObj.put("displayName","search.results.header.version"));
    fieldsToDisplay.add(jsonObj); 
    
    jsonResultSet.addMagazineColumn(new JSONResultSetColumn("content","100%","content",fieldsToDisplay,null));
  }

解决方法

首先转到文件SamplePluginSearchServiceP8.java 和buildP8ResultStructure函数。 删除不必要的列。 添加具有相关格式的新列

jsonResultSet.addColumn(new JSONResultSetColumn(“”,您的列宽,字段名,可排序?,false));

执行完此操作后,转到同一java文件上的executeP8Search, 查看第122行,迭代返回的查询结果以及来自查询的值的searchResults, 为每行添加相关值。

JSONResultSetRow行=新的JSONResultSetRow(sbId.toString(),doc.get_Name(),doc.get_MimeType(),特权);

row.addAttribute(“您的字段名称”,doc.isLocked(),JSONResultSetRow.TYPE_BOOLEAN,null,(new Boolean(doc.isLocked()))。toString()); // ***请注意将相关类型,字符串添加到字符串值,int,bool等。

jsonResultSet.addRow(row);

不要忘记以相同的方式修复ContinueQueryService.java。

相关问答

错误1:Request method ‘DELETE‘ not supported 错误还原:...
错误1:启动docker镜像时报错:Error response from daemon:...
错误1:private field ‘xxx‘ is never assigned 按Alt...
报错如下,通过源不能下载,最后警告pip需升级版本 Requirem...