Configuring the Entity Count Tool

You use the EntityReportingFunction extension point to add custom logic on how entities are designated and counted. Before you can run and view the entity count report, the extension point implementation class needs to be uploaded to the system and the URL registered in the system.

About this task

The entity count tool enables you to count the number of entities in the system.

Entities are classes of data and associated attributes and functions that describe and support a business object (for example, product, agreement, item, asset, location, partner), as recognized by the Program's Entity Count Tool.

Procedure

  1. Implement the EntityReportFunction extension point. See the example below.
  2. Make the extension point implementation available to the system. Perform one of the following tasks:
    • Upload the compiled class to the docstore, or
    • Make the compiled class part of a .jar file and make the .jar file available to the system by using the custom jar mechanism. For more information, Deploying a third party or custom user .jar file.
  3. Register the location of the extension point class. Perform the following steps:
    1. Click Data Model Manager > Security > Company Attributes.
    2. In the Entity Count Report Extension Point Url field, under the General settings section, provide the japi URL to where the location of the extension point class is.
      For example,
      japi:///uploaded_java_classes:com.ibm.ccd.api.extensionpoints.EntityReportingFunctionImpl_new.class

Example

When the entity report is run from the user interface, different methods of the extension point are started by the system. Required values for the report are computed based on the user returned values and the report is persisted, assigning an entity report id.

This code shows a sample implementation class of the EntityReportingFunction extension point and how it is used to provide information about the entities in the system when you run a report.
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;
    }
}

What to do next

After you have uploaded the extension point implementation class and registered the URL to the system, you can then run and view the entity count report.
  1. Click System Administrator > Entity Count Reports.
  2. Click Run report. A Run report dialog displays.
  3. Choose if you want to run the job in the background or immediately and click OK. If you select the background option, the entity report is run on the scheduler as a job, instead of running on the appserver. This option provides a link so that you can check the status of the job. If you select to run immediately, the report will run and load the details in the right navigation pane.