Information Management IBM InfoSphere Master Data Management, Version 11.3

Defining location attributes for items

You can define location attributes for items so that users can use location attributes. For example, if the price of an item varies from location to location, the user can maintain the item-specific price attribute and the location-specific price attribute.

Before you begin

Ensure that the catalog is empty. Also, ensure that you configure the catalog to support location attributes for specific hierarchies.

About this task

To enable support for location data, set the enable_location_data property to true in the common.properties file. populate_location_default_values, run_pre_script_for_locations, and run_post_script_for_locations are some of the other location specific parameters.

Procedure

Define the location attributes using any of the following methods: user interface, Java™ API, or script API. You must specify a hierarchy, access control group, and secondary spec for the location-specific attributes. You must set enable_location_data attribute to "true" in common.properties configuration file to make the location-specific attributes tab visible.
Option Description
User interface
  1. In the left pane, right-click in the blank area under Catalog module.
  2. Click Catalog Attributes.
  3. Click the Define Location Specific Attributes tab in the Catalog Detail screen.
  4. Choose the hierarchy, access control group, and secondary spec for defining the location-specific attributes.
Java API The following sample Java API code defines the location attributes.
Defining location attributes for items Java APIContext ctx = PIMContextFactory.getContext(USERNAME, PASSWORD, COMPANY_NAME);

// Get a reference to the catalog

CatalogManager catalogManager = ctx.getCatalogManager();

Catalog catalog = catalogManager.getCatalog(CATALOG_NAME);

// Get a reference to the hierarchy to be used as the location hierarchy

HierarchyManager hierarchyManager = ctx.getHierarchyManager();

Hierarchy locationHierarchy = hierarchyManager.getHierarchy(LOCATION_HIERARCHY_NAME);

// Get a reference to the location spec to be used
 SpecManager specManager = ctx.getSpecManager();

SecondarySpec locationSpec = (SecondarySpec) specManager.getSpec(LOCATION_SPEC_NAME);

// Add a location data configuration.

LocationDataConfiguration locationConfig = catalog.addLocationDataConfiguration(locationHierarchy, locationSpec);

// (Optionally), identify the attributes that are inheritable

AttributeCollectionManager attributeCollectionManager = ctx.getAttributeCollectionManager();

AttributeCollection locationAttributesCollection = 
attributeCollectionManager.getAttributeCollection(LOCATION_SPEC_ATTRIBUTES);
 
ArrayList<AttributeCollection>attributeCollectionList = new ArrayList<AttributeCollection>();

attributeCollectionList.add( locationAttributesCollection );

locationConfig.setAttributeCollections(attributeCollectionList);
Script The following sample script API defines the location attributes.
var MY_CTG_NAME = "My Catalog";	
		//catalog with a location hierarchy
 var MY_LOC_HIER = "My Location Hierarchy"; 
 		//hierarchy with defined locations
var MY_LOC_SPEC = "My Location Spec";	
			//secondary spec for locations
var MY_LOC_AC = "My Location Attribute Collection";
 //collection of the location spec

var ctg = getCtgByName(MY_CTG_NAME);
var hier = getCategoryTreeByName(MY_LOC_HIER);
var locSpec = getSpecByName(MY_LOC_SPEC);
var secSpecAC = getAttrGroupByName(MY_LOC_AC);
	
//create attribute collection for location attributes
var inhAttrGrps=[];
inhAttrGrps.add(secSpecAC);
	
//define location attributes
ctg.defineLocationSpecificData(hier, locSpec, inhAttrGrps);
ctg.saveCatalog();

//optional: make a location available for an item to populate data
var MY_LOC_PATH = "My Location";		
	//category path under the location hierarchy above
var MY_LOC_ITEM_PK = "MyLocItem";			
//primary key of an item with location data
var dataLoc = hier.getCategoryByPath(MY_LOC_PATH,"/");
var dataLocItem = ctg.getEntryByPrimaryKey(MY_LOC_ITEM_PK);
if(!dataLocItem.isItemAvailableInLocation(dataLoc)){	dataLocItem.makeItemAvailableInLocation(dataLoc, true);
	var errs = dataLocItem.saveCtgItem();
}
The location-specific attributes are defined. Users can view them in the Define Location Specific Attributes tab of the Catalog Detail screen.


Last updated: 8 Mar 2016