Skip Headers
Agile Product Lifecycle Management SDK Developer Guide - Using APIs
Release 9.3.3
E39307-02
  Go To Table Of Contents
Contents

Previous
Previous
 
Next
Next
 

7 Working with Items, BOMs, and AMLs

This chapter includes the following:

7.1 Working with Items

An item is an object that helps define a product. Parts and documents are examples of types of items. A part is shipped as part of a product and has costs associated with it. A part can also be an assembly. A bill of material, or BOM, lists the separate components that make up the assembly. A document generally is an internal document, drawing, or procedure that references a part.

Items are different from other Agile PLM objects because they:

  • Have a revision history, with a set of data for each revision

  • Can be incorporated, or locked from future changes

  • Can have site-specific BOMs or approved manufacturers lists (AMLs)

7.1.1 Supported Page 2 Item Attributes

SDK supports the following Page 2 Item attributes.

  • Item.P2.Text26 to Text50 (25 new constants) IItem.P2.List26 to List50 (25 new constants) Item.P2.MultiList16 to MultiList25 (10 new constants) Item.P2.MultiList46 to MultiList52 (7 new constants

For more listing, refer to SDK samples folder at: http://www.oracle.com/technetwork/indexes/samplecode/agileplm-sample-520945.htm.

7.1.2 Getting and Setting the Revision of an Item

The revision for an item is a special type of Agile PLM attribute. The revision is always paired with another value, the number of its associated change object (such as an ECO). When you load an item, it's always loaded with the latest released revision.

The correct way to get and set the revision for an item is to use methods of the IRevisioned interface, as shown in the following example, which loads an item and then iterates through the item's revisions.

Example 7-1 Getting and setting the revision of an item

try {
// Get an item   IItem item = (IItem)m_session.getObject(IItem.OBJECT_TYPE, "1000-02");

// Print the item's current revision   System.out.println("current rev : " + item.getRevision());

// Get all revisions for the item   Map revisions = item.getRevisions();

// Get the set view of the map   Set set = revisions.entrySet();

// Get an iterator for the set   Iterator it = set.iterator();

// Iterate through the revisions and set each revision value   while (it.hasNext()) {      Map.Entry entry = (Map.Entry)it.next();      String rev = (String)entry.getValue();      System.out.println("Setting rev : " + rev + "....");item.setRevision(rev);      System.out.println("current rev : " + item.getRevision());   }   catch (APIException ex) {      System.out.println(ex);   }}

The IRevisioned.setRevision() method accommodates several different ways to specify a revision. The change parameter of the setRevision() method can be any of the following types of objects:

  • A null object to specify an Introductory revision:

      item.setRevision(null);

  • An IChange object associated with a particular revision:

      item.setRevision(changeObject);

A change number (a String) associated with a particular revision:       item.setRevision("C00450")

revision identifier (a String such as ”Introductory”, ”A”, ”B”, ”C”, and so on):       item.setRevision("A");

  • A String containing both a revision identifier and a change number separated by eight spaces (”A 23450"):

      item.setRevision("A        C00450");

The last type of String object that you can specify for the change parameter allows you to pass the same value used in other Rev cells in Agile PLM tables. For example, the BOM.Item Rev cell, unlike Title Block.Rev, is directly accessible. If you get the value for the cell, it returns a String containing the revision identifier and a change number separated by eight spaces.

Example 7-2 Setting the revision using BOM.Item Rev

// Get an Item
try {    IItem item = (IItem)m_session.getObject(IItem.OBJECT_TYPE, "1000-02");

// Get the BOM table
   ITable bomTable = item.getTable(ItemConstants.TABLE_BOM);

// Get part 1543-01 in the BOM   ITwoWayIterator it = bomTable.getTableIterator();   while (it.hasNext()) {      IRow row = (IRow)it.next();      String num =         (String)row.getValue(ItemConstants.ATT_BOM_ITEM_NUMBER);      if (num.equals("1543-01")) {

// Get the revision for this BOM item where bomRev = revID + 8 spaces +        changeNumber)
   String bomRev = (String)row.getValue(ItemConstants.ATT_BOM_ITEM_REV);

// Load the referenced part   IItem bomItem = (IItem)row.getReferent();

// Set the revision      System.out.println("Setting rev : " + bomRev + "....");      bomItem.setRevision(bomRev);      System.out.println("current rev : " + bomItem.getRevision());      break;      }   }} catch (APIException ex) {      System.out.println(ex);}

Note:

If an item has no released revisions and no pending changes, the IRevisioned.getRevision() method returns a null String and the IRevisioned.getRevisions() method returns an empty Map object.

7.1.2.1 Failing to get a of an Item using the Title Block.Rev field

Unlike other attributes, the Title Block.Rev field whose ID constant for an item is ItemConstants.ATT_TITLE_BLOCK_REV, is not directly accessible. This means that you cannot retrieve or set a revision value using the getValue() and setValue() methods. For example, the revValue() variable in the following code sample is always a null String

Example 7-3 Failing to get a revision using the Title Block.Rev field

(IItem)m_session.getObject(IItem.OBJECT_TYPE, "1000-02");
    IAgileList listRevValue =
    (IAgileList)item.getValue(ItemConstants.ATT_TITLE_BLOCK_REV);
    String revValue = listRevValue.toString();
  if (revValue==null) {
      System.out.println("Failed to get the revision.");

7.1.3 Changing the Incorporated Status of a Revision

Each revision of an item can be incorporated. When you incorporate the revision of an item, all attachments for that revision are locked and cannot be checked out. After an item is incorporated, you can still use Agile Web Client to view the item's attachments, but you cannot modify them unless you submit a new Change.

To incorporate or unincorporate an item, use the IAttachmentContainer.setIncorporated() method. Special Agile PLM privileges are required to incorporate and unincorporate Items. If a user does not have the appropriate privileges, the setIncorporated() method throws an exception.

Only items that have revision numbers can be incorporated. Therefore, a preliminary item that has not been released cannot be incorporated. Once an ECO is submitted for that item and a pending revision number is specified, the revision can then be incorporated. Example 7-4 shows how to change the incorporated status of an item.

Example 7-4 Changing the incorporated status of an Item

try {
// Get an item   IItem item = (IItem)m_session.getObject(IItem.OBJECT_TYPE, "1000-02");

//Incorporate or Unincorporate the Item, dedepending on its current state 
   item.setIncorporated(!item.isIncorporated());} catch (APIException ex) {   System.out.println(ex);
}

7.2 Working with BOMs

A bill of material, or BOM, shows the components that make up a product. Each item that is listed on a BOM can be a single item or an assembly of several items.

The BOM table, like other Agile PLM tables, consists of columns, or fields, of data. Each column represents an Agile PLM attribute, such as BOM.Item Number. Each row of the BOM table represents a separate item, either a part, a document, or a user-defined subclass.

In addition to the BOM table, there is also a redline BOM, which records redline changes to a BOM. When you load a BOM table using the DataObject.getTable()method, make sure you specify the correct table ID constant.

BOM Table ID Constant
Current BOM table ItemConstants.TABLE_BOM
Redline BOM table ItemConstants.TABLE_REDLINEBOM

For an example to retrieve a BOM table, see "Retrieving a Table."

7.2.1 Adding an Item to a BOM

Before adding an item to the BOM table, specify the manufacturing site. A BOM item is either site-specific or common to all sites. Use the IManufacturingSiteSelectable.setManufacturingSite() method to specify the site. To add an item to the common BOM, use ManufacturingSiteConstants.COMMON_SITE. Otherwise, specify a specific site, such as the user's default site.


Note:

You can't add rows to a BOM if the parent item is currently set to display all sites. Before adding a row to a BOM, make sure the item's site is not set to ManufacturingSiteConstants.ALL_SITES. Otherwise, the API throws an exception.

Example 7-5 Adding items to a BOM

//Add an item to the common BOMpublic void addCommonBOMItem(IItem item, String bomnumber) throws APIException {   HashMap map = new HashMap();   map.put(ItemConstants.ATT_BOM_ITEM_NUMBER, bomnumber);   item.setManufacturingSite(ManufacturingSiteConstants.COMMON_SITE);      item.getTable(ItemConstants.TABLE_BOM).createRow(map);}

//Add a site-specific item to the BOM using the user's default site   public void addSiteBOMItem(IItem item, String bomnumber) throws APIException {   HashMap map = new HashMap();   map.put(ItemConstants.ATT_BOM_ITEM_NUMBER, bomnumber);   item.setManufacturingSite(((IAgileList)m_session.getCurrentUser().getValue()      UserConstants.ATT_GENERAL_INFO_DEFAULT_SITE)).getSelection()[0].getValue());      item.getTable(ItemConstants.TABLE_BOM).createRow(map);}

For more information about manufacturing sites, see Chapter 10, "Managing Manufacturing Sites."

7.2.2 Expanding a BOM

The BOM table can be viewed as a table containing multiple levels even though the API doesn't present it that way. By default, the BOM table contains only top-level items. To expand a BOM to show its hierarchy, you need to recursively load each BOM item and its subassemblies. The following example shows how to print multiple levels of a BOM.

Example 7-6 Printing multiple levels of a BOM

private void printBOM(IItem item, int level) throws APIException {   ITable bom = item.getTable(ItemConstants.TABLE_BOM);   Iterator i = bom.getReferentIterator();   while (i.hasNext()) {      IItem bomItem = (IItem)i.next();      System.out.print(indent(level));      System.out.println(bomItem.getName());      printBOM(bomItem, level + 1);   }}private String indent(int level) {   if (level <= 0) {      return "";   }   char c[] = new char[level*2];   Arrays.fill(c, ' ');   return new String(c);}

7.2.3 Copying one BOM into another BOM

Frequently, the BOMs of two items can be very similar. Instead of creating a BOM from scratch, it is often easier to copy a BOM from one item to another and then make slight changes. You can use the Collection.addAll() method to copy the contents of one table into a target table. The addAll() method does not set a new revision for the item.


Note:

If you copy a BOM from one item to another, the target item must have the same associated manufacturing sites as the source item.

Example 7-7 Copying a BOM using Collection.addAll()

private static void copyBOM(IItem source, IItem target) throws APIException {

// Get the source BOM   ITable sourceBOM = source.getTable(ItemConstants.TABLE_BOM);

// Get the target BOM   ITable targetBOM = target.getTable(ItemConstants.TABLE_BOM);

// Add all rows from the source BOM to the target BOM   targetBOM.addAll(sourceBOM);}

Another way to copy a BOM is to iterate through the rows of a source BOM and copy each row to a target BOM.

Example 7-8 Copying a BOM by iteration

private static void copyBOM1(IItem source, IItem target) throws APIException {

// Get the source BOM   ITable sourceBOM = source.getTable(ItemConstants.TABLE_BOM);

// Get an iterator for the source BOM   Iterator i = sourceBOM.iterator();

// Get the target BOM   ITable targetBOM = target.getTable(ItemConstants.TABLE_BOM);

// Copy each source BOM row to the target BOM   while (i.hasNext()) {      targetBOM.createRow(i.next());   }
}

7.2.4 Creating BOM-Related Product Reports

The SDK provides the IProductReport API with constants defined in ProductReportConstants to prepare the following BOM-related product reports. These reports are produced in the XML format.

  • BOM Explosion reports - The BOM Explosion report displays the items that are in the bill of Material(BOM) for the one or more specified assembly, up to the desired number of levels.

  • BOM Comparison reports - The BOM Comparison XML reports is the result of comparing two different BOMs up to the specified number of levels.

For example, when a base BOM compared with the target BOM, the comparison will show:

  • d shown in BOM node - indicates only base assembly has the BOM

  • a shown in BOM node - indicates only target assembly has the BOM

  • u shown in BOM node - indicates both root assemblies have the same BOM

  • m shown in BOM node - indicates both root assemblies have the BOM but with some differences

All first level BOMs of both base and target assembly are categorized into another node BOMs. BOM nodes under BOMs are first sorted by FindNum and then by ItemNumber.

There are several use cases for these reports. For example, archiving or comparative analysis with outputs of ERP systems.

To create a product report, you must use the IAgileSession object. The following examples show how to use IAgileSession and ProductReportConstants to prepare BOM Explosion and BOM Comparison reports.

Example 7-9 Creating an Agile Session

AgileSessionFactory factory =    AgileSessionFactory.getInstance("http://agileServer/virtualPath"); 
     Map params = 
       new HashMap(); params.put(AgileSessionFactory.USERNAME, "username");        params.put(AgileSessionFactory.PASSWORD, "pwd"); 
       IAgileSession session = factory.createSession(params);

Example 7-10 Preparing a BOM Comparison report

Map param = new HashMap();   param.put(ProductReportConstants.REPORTPARAM_REPORT_TYPE,    ProductReportConstants.REPORT_BOM_COMPARISON);   param.put(ProductReportConstants.REPORTPARAM_ITEMREVSITE, "item1;item2");   param.put(ProductReportConstants.BOMCOMP_BOM_ATTRS, 
      ProductReportConstants.BOM_ATT_ITEM_NUM +”;” + 
         ProductReportConstants.BOM_ATT_FIND_NUM);   param.put(ProductReportConstants.BOMCOMP_BOMLEVEL, "4");

IProductReport report = (IProductReport)   session.createObject
     (IProductReport.OBJECT_TYPE, "My BOM Comparison Report");   String xmlReport = report.execute(param);

If the value for ProductReportConstants.BOMCOMP_BOM_ATTRS is not specified, then it is assumed its value is Find Num;Item Number;Sites.

Example 7-11 Preparing a BOM Explosion report

Map param = new HashMap();   param.put(ProductReportConstants.REPORTPARAM_REPORT_TYPE,    ProductReportConstants.REPORT_BOM_EXPLOSION);   param.put(ProductReportConstants.BOMEXP_OBJTYPE, "Document;Part;");   param.put(ProductReportConstants.
         REPORTPARAM_ITEMREVSITE, "MM75-01|23450|India;");   param.put(ProductReportConstants.BOMEXP_MAXLEVEL, "5");IProductReport report = (IProductReport)   session.createObject(IProductReport.OBJECT_TYPE, "My BOM Explosion Report");String xmlReport = report.execute(param);

In BOM Explosion reports, the value for ProductReportConstants.REPORTPARAM_ITEMREVSITE can be as follows:

  • <Item_number>|<Change_number>|<Site_number> where <Change_Number> and <Site_number> are optional if:

       -<Change_number> is not specified it is assumed to be the Latest revision

       -<Site_number> is not specified it is assumed as Common Sites

  • The value can have one or more Items delimited by semicolon

  • Item1;Item2;Item3 are the Latest revision of Item1,Item2 and Item3 for Common Sites

  • Item1|ECO1;Item2;Item3 (Item1 with ECO1 revision and latest revision of Item2, Item3)

  • Item1|ECO1|Site1;Item2|ECO2 (Item1 with ECO1 revision with Site1 Specific BOM and Item2 with ECO2 revision)

  • Item1|Site1;Item2 (Item1 with Site1 Specific BOM and Latest revision of Item2 with Common Sites)

In BOM Comparison reports, the value for ProductReportConstants.REPORTPARAM_ITEMREVSITE can be as follows:

  • <Item_number>|<Change_number>|<Site_number> where <Change_Number> and <Site_number> are optional when:

       -<Change_number> is not specified, then it is assumed as Latest revision.

       -<Site_number> is not specified, it is assumed as Common Sites.

  • The value must include two Items delimited by a semicolon

  • Item1;Item2 (Latest revision of Item1 and Item2 and all Sites)

  • Item1|ECO1;Item2 (Item1 with ECO1 revision and Latest revision of Item2)

  • Item1|ECO1|Site1;Item2|ECO2 (Item1 with ECO1 revision with Site1 Specific BOM and Item2 with ECO2 revision)

  • Item1|Site1;Item2 (Item1 with Site1 Specific BOM and Latest revision of Item2 with Common Sites)

7.2.5 Redlining a BOM

To redline a BOM table, follow these steps:

  1. Get a released assembly item.

  2. Create a new Change Order, such as an ECO, for the item.

  3. Add the item to the Affected Items table of the ECO. Also, specify the new revision in the change and set the item's revision to the associated change.

  4. Modify the item's Redline BOM table.

In the following sections, there are code examples for each of these steps.


Note:

You can remove redlines from a row of the BOM table. See "Removing Redline Changes."

7.2.5.1 Getting a Released Assembly Item

The following example loads an assembly item from the Part subclass. Make sure the Part you specify is released and has a BOM.

Example 7-12 Getting a released assembly

// Load a released assembly itemprivate static IItem loadItem(IAgileSession myServer, Integer ITEM_NUMBER) 
      throws APIException {   IItem item = (IItem)myServer.getObject("Part", ITEM_NUMBER);

//Check if the item is released and has a BOM
   if (item != null) {    if (item.getRevision().equals("Introductory") ||         !item.isFlagSet(ItemConstants.FLAG_HAS_BOM)){   System.out.println("Item must be released and have a BOM.");   item = null;   }   return item;}

7.2.5.2 Creating a Change Order

To redline a BOM, you must create a Change Order, such as an ECO. Example below shows how to create an ECO and select a Workflow for the selected ECO.

Example 7-13

private static IChange createChange(IAgileSession myServer, Integer ECO_NUMBER)   throws APIException {IChange change =      IChange)myServer.createObject(ChangeConstants.CLASS_ECO, ECO_NUMBER);

// Set the Workflow ID   change.setWorkflow(change.getWorkflows()[0]);   return change;}

7.2.5.3 Adding Items to the Affected Items tab of a Change Order

After you create an ECO, you can add the Part you loaded to the Affected Items table of the ECO. Every ECO is associated with a revision. The following example shows how to specify the new revision in the ECO, and then set the revision for the Part to the one associated with the ECO.

Example 7-14 Adding an item to the Affected Items table of a change order

private static void addAffectedItems(IAgileSession myServer, 
   IItem item, IChange change) throws APIException {

// Get the Affected Items table   ITable affectedItems = 
      change.getTable(ChangeConstants.TABLE_AFFECTEDITEMS);

// Create a Map object to store parameters
   Map params = new HashMap();

// Set the value of the item number by specifying the item object   params.put(ChangeConstants.ATT_AFFECTED_ITEMS_ITEM_NUMBER, item);

// Specify the revision for the change   params.put(ChangeConstants.ATT_AFFECTED_ITEMS_NEW_REV, "B");

// Add a new row to the Affected Items table   IRow affectedItemRow = affectedItems.createRow(params);

// Select the new revision for the part   item.setRevision(change);
}

7.2.5.4 Modifying the Redline BOM Table

After the Part has been added to the Affected Items table of an ECO and a revision has been specified, you can begin to modify the Part's Redline BOM table. The following example shows how to get the Redline BOM table, add and remove rows, and set specific cell values.

Example 7-15 Modifying the Redline BOM table

private static void modifyRedlineBOM(IAgileSession myServer, IItem item) 
      throws APIException {

// Get the Redline BOM table   ITable redlineBOM = item.getTable(ItemConstants.TABLE_REDLINEBOM);

// Create two new items, 1000-002 and 1000-003   IItem item1 = (IItem) myServer.createObject(ItemConstants.CLASS_PART,       "1000-002");   IItem item2 = (IItem) myServer.createObject(ItemConstants.CLASS_PART,       "1000-003");

// Add item 1000-002 to the table   IRow redlineRow = redlineBOM.createRow(item1);   redlineRow.setValue(ItemConstants.ATT_BOM_QTY, new Integer(50));   redlineRow.setValue(ItemConstants.ATT_BOM_FIND_NUM, new Integer(777));

// Add item 1000-003 to the table   redlineRow = redlineBOM.createRow(item2);   redlineRow.setValue(ItemConstants.ATT_BOM_QTY, new Integer(50));   redlineRow.setValue(ItemConstants.ATT_BOM_FIND_NUM, new Integer(778));

// Remove item 1000-003 from the table   IRow delRow;   String itemNumber;   Iterator it = redlineBOM.iterator();   while (it.hasNext()) {      delRow = (IRow)it.next();   itemNumber = (String)delRow.getValue(ItemConstants.ATT_BOM_ITEM_NUMBER);   if (itemNumber.equals("1000-003")) {      redlineBOM.removeRow(delRow);   break;      }   }

// Change the Qty value for item 1000-002   IRow modRow;   it = redlineBOM.iterator();   while (it.hasNext()) {      modRow = (IRow)it.next();      itemNumber =         (String)modRow.getValue(ItemConstants.ATT_BOM_ITEM_NUMBER);   if (itemNumber.equals("1000-002")) {         modRow.setValue(ItemConstants.ATT_BOM_QTY, new Integer(123));      }   }}

7.3 Working with AMLs

An AML is the Approved Manufacturer List for an item. It lists the preferred or alternate manufacturers that have been approved to supply a particular item. When you source parts for a project, you can choose to source them by assembly, by AML, or both. The list identifies the manufacturer part for that item.

The Manufacturers table consists of columns, or fields, of data. Each column represents an Agile PLM attribute, such as Manufacturers.MfrName. Each row of the Manufacturers table references a separate manufacturer part. In addition to the Manufacturers table, there is also a redline Manufacturers table, which records redline changes. When you load a Manufacturers table using the DataObject.getTable()method, make sure you specify the correct table ID constant.

BOM Table ID Constant
Current Manufacturers table ItemConstants.TABLE_MANUFACTURERS
Redline Manufacturers table ItemConstants.TABLE_REDLINEMANUFACTURERS

7.3.1 Adding an Approved Manufacturer to the Manufacturers Table

Similar to the BOM Table, the Manufacturers Table requires that you specify the manufacturing site before adding a new row to the table. An approved manufacturer is either site-specific or common to all sites. Use the IManufacturingSiteSelectable.setManufacturingSite() method to specify the site. To add an approved manufacturer to the common Manufacturers table, use ManufacturingSiteConstants.COMMON_SITE. Otherwise, select a specific site, such as the user's default site.


Note:

You can't add rows to an AML if the parent item is currently set to display all sites. Before adding a row to an AML, make sure the item's site is not set to ManufacturingSiteConstants.ALL_SITES. Otherwise, the API throws an exception.

Example 7-16 Adding approved manufacturers to an AML

//Add a MfrPart to the common AMLpublic void addCommonApprMfr(IItem item, String mfrName, String mfrPartNum) 
      throws APIException {   HashMap map = new HashMap();   map.put(ManufacturerPartConstants.
         ATT_GENERAL_INFO_MANUFACTURER_PART_NUMBER, mfrPartNum);   map.put(ManufacturerPartConstants.ATT_GENERAL_INFO_MANUFACTURER_NAME, mfrName);   IManufacturerPart mfrPart = (IManufacturerPart)m_session.getObject(      ManufacturerPartConstants.CLASS_MANUFACTURER_PART, map);      item.setManufacturingSite(ManufacturingSiteConstants.COMMON_SITE);       item.getTable(ItemConstants.TABLE_MANUFACTURERS).createRow(mfrPart);}

// Add a site-specific MfrPart to the AML using the user's default site
public void addSiteApprMfr(IItem item, String mfrName, String mfrPartNum) 
      throws APIException {   HashMap map = new HashMap();      map.put(ManufacturerPartConstants.
         ATT_GENERAL_INFO_MANUFACTURER_PART_NUMBER, mfrPartNum);      map.put(ManufacturerPartConstants.
         ATT_GENERAL_INFO_MANUFACTURER_NAME, mfrName);   IManufacturerPart mfrPart = (IManufacturerPart)m_session.getObject(   ManufacturerPartConstants.CLASS_MANUFACTURER_PART, map);   item.setManufacturingSite(((IAgileList)m_session.getCurrentUser().
      getValue(UserConstants.ATT_GENERAL_INFO_DEFAULT_SITE)).getSelection()[0]);   item.getTable(ItemConstants.TABLE_MANUFACTURERS).createRow(mfrPart);}

For more information about manufacturing sites, see Chapter 10, "Managing Manufacturing Sites."

7.3.2 Updating AML Split Percentages in Sourcing Projects

An AML can have manufacturer parts of status preferred, alternate, or any additional status that is configured in the Java Client. For each internal item, there can be multiple manufacturer parts. In such cases, you can specify AML percentage splits. For example, you may want to use 70% of one manufacturer part and 30% of another, based on cost or availability. The sum of the AML percentage splits must equal 100. Manufacturers listed in a project AML must already exist in the Item Master.

SDK exposes the setAmlSplits() method to update AML Splits by percentage, the same as in PLM Clients.

Example 7-17 Updating AML Split in a Sourcing Project

public static void setAmlSplits() throws APIException {   IProject prj = 
      (IProject) session.getObject(IProject.OBJECT_TYPE, "PRJ_A");   ITable tbl_items=prj.getTable(ProjectConstants.TABLE_ITEMS);   HashMap[] mapx = new HashMap[2];   IRow[] rowArray = new IRow[2];   HashMap rows = new HashMap();   Iterator itms= tbl_items.getTableIterator();   while (itms.hasNext()){      IRow row_item = (IRow) itms.next();      ITable tbl_aml = (ITable)row_item.getValue(ProjectConstants.ATT_ITEMS_AML);      Iterator amls = tbl_aml.getTableIterator();      while (amls.hasNext()){      IRow row_aml=(IRow)amls.next();      if(row_aml.getValue(ProjectConstants.ATT_AML_MFR_PART_NUMBER).
         equals("MPN_1")){mapx[0] = new HashMap();mapx[0].put(ProjectConstants.ATT_AML_AML_SPLIT, "08");rowArray[0]=row_aml;rows.put(rowArray[0], mapx[0]);}
   else 
      if(row_aml.getValue(ProjectConstants.ATT_AML_MFR_PART_NUMBER). 
         equals("MPN_2")){      mapx[1] = new HashMap();      mapx[1].put(ProjectConstants.ATT_AML_AML_SPLIT, "12");      rowArray[1]=row_aml;      rows.put(rowArray[1], mapx[1]);         }      }      ((ITableCell)tbl_aml).updateAMLSplit(rows);   }}

7.3.3 Retrieving AML Data from the Item Master

The AML data for a project item is updated in the Item Master. Agile SDK supports retrieving AML data from the Item Master into a project as shown in the following example.

Example 7-18 Retrieving AML Data from item the Master

import com.agile.api.*;import com.agile.util.CMObjectID;import com.agile.util.CMObjectKey;
public class sampleProjectAMLsync {   public static void connect(String url, String userName, String passWord) 
      throws APIException {   AgileSessionFactory factory = AgileSessionFactory.getInstance(url);   Map params = new HashMap();   params.put(AgileSessionFactory.USERNAME, userName);   params.put(AgileSessionFactory.PASSWORD, passWord);   session = factory.createSession(params);   System.out.println("...Connect to PLM server:" + url);   }   public static void disconnect() {      if (session != null) {      session.close();   }   System.out.println("...Disconnect from PLM server!");}
   public static void main(String[] args) throws Exception {      String url = "http://my-pc:8888/web";      String user = "admin";      String pwd = "agile";      connect(url, user, pwd);      IProject prj = (IProject) session.
         getObject(IProject.OBJECT_TYPE, "PRJ00006");      ITable prjTableAML=prj.getTable(ProjectConstants.TABLE_AML);      List itmIdLst=new ArrayList();      List itmNmbrLst=new ArrayList();      List itmCMObjIdLst=new ArrayList();      List itmObjLst=new ArrayList();   for(Iterator it=prjTableAML.iterator(); it.hasNext();){      IRow rowAML=(IRow) it.next();      ITable xx=(ITable)rowAML.getValue(ProjectConstants.ATT_ITEMS_AML);      String itemNumber=(String)rowAML.
         getValue(ProjectConstants.ATT_ITEMS_NUMBER);      IItem item = (IItem) session.getObject(ItemConstants.
         CLASS_PART, itemNumber);      Integer rowid= rowAML.getRowId
      CMObjectID rfrnt= (CMObjectID)rowAML.getReferent().getId();      Integer itmId=rfrnt.getObjectID();      itmIdLst.add(itmId);      itmNmbrLst.add(itemNumber);      itmCMObjIdLst.add(rfrnt);      itmObjLst.add(item);   }   Map params=new HashMap();      params.put(ProjectConstants.OPT_DIALOG_UPDATE_AML_ADD_DELETE, true);      params.put(ProjectConstants.
         OPT_DIALOG_UPDATE_AML_ADD_DELETE_OVERWRITE, true);
params.put(ProjectConstants.OPT_DIALOG_UPDATE_AML_ATTR, false);
params.put(ProjectConstants.OPT_DIALOG_UPDATE_AML_ATTR_OVERWRITE, false);      params.put(ProjectConstants.ATT_ITEMS_NUMBER, itmCMObjIdLst);      prj.updateAMLfromIM(params);      disconnect();   }   private static IAgileSession session = null;}

7.3.4 Redlining an AML

Once an item is released, you can change the Manufacturers table only by issuing a new change order. The change order allows you to redline the Manufacturers table.


Note:

You can remove redlines from a row of the Manufacturers table. See "Removing Redline Changes."

To redline a Manufacturers table:

  1. Get a released revision of an item.

  2. Create a new ECO, MCO, or SCO.

    - ECOs lets you modify an item's BOM or Manufacturers tables.

    - MCOs lets you modify an item's Manufacturers table.

    - SCOs let you modify an item's site-specific BOM or Manufacturers tables.

  3. Add the item to the Affected Items table of the change.

  4. For ECOs, specify the new revision in the change. SCOs and MCOs do not affect an item's revision.

  5. Modify the Redline Manufacturers table.