配置實體計數工具
您可以使用 EntityReportingFunction 延伸點,來新增如何指定及計算實體的自訂邏輯。 您必須先將延伸點實作類別上傳至系統及系統中登錄的 URL ,才能執行及檢視實體計數報告。
關於此作業
實體係指說明及支援「本程式」之「實體計數工具」所辨識之商業物件 (例如: 產品、合約、項目、資產、位置、夥伴) 之資料類別及相關屬性與功能。
程序
範例
從使用者介面執行實體報告時,系統會啟動延伸點的不同方法。 會根據使用者回覆值來計算報告的必要值,並持續保存報告,指派實體報告 ID。
此程式碼顯示 EntityReportingFunction 延伸點的範例實作類別,以及在您執行報告時如何使用它來提供系統中實體的相關資訊。
package com.ibm.ccd.api.extensionpoints;
import java.util.ArrayList;
import java.util.Collection;
import com.ibm.pim.catalog.Catalog;
import com.ibm.pim.common.PIMObject;
import com.ibm.pim.extensionpoints.EntityReportingFunction;
/**
* This is the user implementation of system supplied extension point interface: EntityReportingFunction
* This class is complied, uploaded to docstore (or made available via user jar mechanism)
* The location of the class needs to be provided under the Company attributes page before the 'Run Report' can be invoked
* from the 'Entity Count Reports' screen.
*/
public class EntityReportingFunctionImpl_new implements EntityReportingFunction
{
/**
* Returns the names of the applicable containers in the system, for the given container type.
* Please refer to EntityReportingFunction interface for the supported container types.
* Note that the containers with the given name should exist in the system.
*/
public Set<String> getApplicableContainerNames(ContainerType cType)
{
TreeSet <String> applContainerNames = new TreeSet <String>();
if (cType.equals(ContainerType.CATALOG)) {
applContainerNames.add("Appl Catalog 1");
applContainerNames.add("Appl Catalog 2");
}
else if (cType.equals(ContainerType.HIERARCHY)) {
applContainerNames.add("Appl Hierarchy 1");
applContainerNames.add("Appl Hierarchy 2");
}
else if (cType.equals(ContainerType.LOOKUPTABLE)) {
applContainerNames.add("Appl Lookup Table 1");
applContainerNames.add("Appl Lookup Table 2");
applContainerNames.add("Appl Lookup Table 3");
}
else if (cType.equals(ContainerType.ORGANIZATIONHIERARCHY)) {
applContainerNames.add("Appl Organization Hierarchy 1");
}
return applContainerNames;
}
/**
* Returns the names of the non-applicable containers in the system, for the given container type.
* Please refer to EntityReportingFunction interface for the supported container types.
* Note that the containers with the given name should exist in the system.
*/
public Set<String> getNonApplicableContainerNames(ContainerType cType)
{
TreeSet <String> nonApplContainerNames = new TreeSet <String>();
if (cType.equals(ContainerType.CATALOG)) {
nonApplContainerNames.add("Non Appl Catalog 1");
nonApplContainerNames.add("Non Appl Catalog 2");
}
else if (cType.equals(ContainerType.HIERARCHY)) {
nonApplContainerNames.add("Non Appl Hierachy 1");
}
else if (cType.equals(ContainerType.LOOKUPTABLE)) {
nonApplContainerNames.add("Non Appl Lookup Table 1");
nonApplContainerNames.add("Non Appl Lookup Table 2");
}
else if (cType.equals(ContainerType.ORGANIZATIONHIERARCHY)) {
; //Assume all of the org hierarchies are applicable...
}
return nonApplContainerNames;
}
/**
* Returns the names of the entities in a given container.
* Please refer to EntityReportingFunction interface for the supported container types.
* Note that the entity names are purely user defined.
*/
public Set<String> getEntityTypes(PIMObject container, ContainerType cType)
{
TreeSet <String> entityTypes = new TreeSet <String>();
if (cType.equals(ContainerType.CATALOG))
{
//The code below handles two applicable catalogs
if (((Catalog)container).getName().equals("Appl Catalog 1")) {
entityTypes.add("Manufactured goods");
entityTypes.add("Assets and commodities");
}
else if (((Catalog)container).getName().equals("Appl Catalog 2"))
{
entityTypes.add("Locations");
entityTypes.add("Trading partners");
}
}
else if (cType.equals(ContainerType.HIERARCHY))
{
//The code below returns the same entity types for all applicable
//hierarchies
entityTypes.add("Products");
entityTypes.add("Sub Products");
}
else if (cType.equals(ContainerType.LOOKUPTABLE))
{
entityTypes.add("Company Codes");
entityTypes.add("Employee Departments");
}
else if (cType.equals(ContainerType.ORGANIZATIONHIERARCHY))
{
entityTypes.add("Department 1");
entityTypes.add("Department 2");
}
return entityTypes;
}
/**
* Returns the names of the entities in a given container.
* Please refer to EntityReportingFunction interface for the supported container types.
* Note that the entity names are purely user defined.
*/
public int getEntityCountByType(PIMObject container, ContainerType cType, String entityType)
{
int count = 0;
//Optionally, the specific container names can be checked below in-
//addition to the container type.
if (cType.equals(ContainerType.CATALOG)) {
if (entityType.equalsIgnoreCase("Manufactured goods"))
count = 100;
//the logic to compute the entity counts is user defined. For ex, //using JavaAPIs,
code can compute the number of items under a given //catalog.
//In this case, a hardcoded count is being returned
else if (entityType.equalsIgnoreCase("Assets and commodities"))
count = 250;
else if (entityType.equalsIgnoreCase("Locations"))
count = 300;
else if (entityType.equalsIgnoreCase("Trading partners"))
count = 1000;
}
else if (cType.equals(ContainerType.HIERARCHY)) {
if (entityType.equalsIgnoreCase("Products"))
count = 10;
else if (entityType.equalsIgnoreCase("Sub Products"))
count = 25;
}
else if (cType.equals(ContainerType.LOOKUPTABLE)) {
if (entityType.equalsIgnoreCase("Company Codes"))
count = 30;
else if (entityType.equalsIgnoreCase("Employee Departments"))
count = 500;
}
else if (cType.equals(ContainerType.ORGANIZATIONHIERARCHY)) {
if (entityType.equalsIgnoreCase("Department 1"))
count = 99;
else if (entityType.equalsIgnoreCase("Department 2"))
count = 88;
}
return count;
}
/**
* Returns user defined comments for a a given container.
* Please refer to EntityReportingFunction interface for the supported container types.
*/
public String getComment(PIMObject container, ContainerType cType)
{
String comment = "";
//Only container type is checked and same comment returned for all container types.
if (cType.equals(ContainerType.CATALOG))
{
comment = "Attribute used as product identifier: [BasicProductSpec/name]";
}
else if (cType.equals(ContainerType.HIERARCHY))
{
comment = "All occurrences of attribute SKU have been counted";
}
else if (cType.equals(ContainerType.LOOKUPTABLE))
{
comment = "Generic comment for all lookup tables";
}
else if (cType.equals(ContainerType.ORGANIZATIONHIERARCHY))
{
comment = "Generic comment for all org hierarchies";
}
return comment;
}
}下一步
- 按一下 系統管理者 > 實體計數報告。
- 按一下 執行報告。 即會顯示 執行報告 對話框。
- 選擇您是要在背景中執行工作,還是立即按一下 確定。 如果您選取背景選項,則會以工作形式在排程器上執行實體報告,而不是在 appserver 上執行。 此選項提供鏈結,讓您可以檢查工作的狀態。 如果您選擇立即執行,則會執行報告,並在右導覽窗格中載入詳細資料。