Skip Headers

Agile Product Lifecycle Management SDK Developer Guide - Using APIs Release 9.3.3 E39307-01 |
| Contents

Previous | Next |

# 20 Managing Product Governance & Compliance

Agile Product Governance & Compliance (PG&C) addresses the growing number of environmental regulations and corporate environmental policies that impact product definition and the import, export, and disposal of restricted substances. Agile PG&C is designed to help OEM manufacturers audit the amount of regulated substances used in their products, and show that they responsibly dispose of, recycle or reuse electronics containing those substances.

Agile PG&C allows companies to cost-effectively comply with environmental regulations. Companies can use Agile PG&C to obtain compliance data for parts from their suppliers. This allows companies to

- Meet substance restrictions

- Satisfy reporting requirements for regulations

- Design recyclable products

- Minimize compliance costs

- Eliminate noncompliance on future products

Agile PG&C is a communication vehicle between the Compliance Manager and suppliers. The Compliance Manager ensures that a company's products adhere to government regulations and company policy. As the Material Provider, the supplier completes and signs off on material declarations, thereby disclosing which hazardous substances are contained within the components and subassemblies it provides. For a more detailed overview of Agile PG&C features, refer to the Product Governance & Compliance User Guide.

## 20.1 Agile PG&C Interfaces and Classes

The following table lists Agile PG&C-related interfaces and classes:

Object | Interface | Constants Class
--- | --- | ---
Declaration | IDeclaration | DeclarationConstants
Specification | ISpecification | SpecficationConstants
Substance | ISubstance | SubstanceConstants
Part Groups | ICommodity | PartGroupConstants

Items, Manufacturer Parts, and Part Groups are objects that are also related to Agile PG&C. They have Specifications, Compositions, and Substances tables that are populated with data when declarations are released. For Manufacturer Parts, you can edit the Compositions and Substances tables directly without submitting a declaration.

Note: The terms "part group" and "commodity" are used interchangeably in this guide to refer to any ICommodityobject. ICommodity represents the Part Group base class, which includes the Commodity and Part Family subclasses.

Of course, other common Agile API interfaces, such as ITable, IDataObject, and ICell, are also used to work with Agile PG&C objects.

## 20.2 Agile PG&C Roles

Agile PLM provides two out-of-the-box roles designed for Agile PG&C users:

- Compliance Manager - This provides privileges needed to create and manage Agile PG&C objects, such as Declarations, Substances, and Specifications, and run Agile PG&C reports. Compliance Managers are responsible for routing material declarations to suppliers.

- (Restricted) Material Provider - This provides privileges needed to create and modify declarations, as well as read all other types of Agile PG&C objects. This role is typically assigned to supplier users, who have restricted access to the Agile PLM system. Material Providers are responsible for completing and signing off on material declarations.

To use Agile PG&C APIs mentioned in this chapter, make sure you log in as a user assigned either the Compliance Manager role, or the (Restricted) Material Provider role. For more information about Agile PLM roles, refer to the Agile PLM Administrator Guide.

Note: The Discover Change privilege mask is not included in the Compliance Manager role. If you only have the Compliance Manager role, then you do not have sufficient privileges to use the API to set the calculated compliance of a part in a Declaration, and pass the Change Number to the SDK call. To pass the Change Number in the SDK call, you must have the Discover Change privilege mask for that object in the Change Orders class. For more information, see Setting Values in the Calculated Compliance Field for Declaration Objects.

## 20.3 Creating Declarations, Specifications, and Substances

The following paragraphs provide definitions and procedures to define and manage these PG&C classes.

### 20.3.1 Creating Declarations

A Declaration object is the main record of Agile PG&C. It tracks the substances and materials that are used for items, manufacturer parts, and part groups. When you release a declaration, the information gathered from it is published to the product record, thereby updating the Composition data contained within the items, manufacturer parts, and part groups listed by the declaration.

There are seven declaration subclasses provided with Agile PLM:

- Homogeneous Material Declaration - A homogeneous material composition declaration that uses material-level specifications.

- IPC 1752-1 Declaration - A material composition declaration for electronic products that conforms to IPC standards and uses only one part-level specification.

- IPC 1752-2 Declaration - A homogeneous material composition declaration for electronic products that conforms to IPC standards and uses only one material-level specification.

- JGPSSI Declaration - A material composition declaration that follows the Japanese Green Procurement (JGP) standard and uses part-level specifications.

- Part Declaration - A material composition declaration that uses part-level or material-level specifications.

- Substance Declaration - A material composition declaration for each substance within part-level specifications.

- Supplier Declaration of Conformance - A questionnaire to assess supplier compliance with specifications from customers and government agencies. The survey addresses compliance at a general company level. Can be used for CSR type declarations.

The procedure for creating a declaration is the same for all declaration subclasses. You must specify the declaration subclass as well as values for the Cover Page.Name and Cover Page.Supplier attributes. Other declaration attributes are optional.

By default, the Cover Page.Name field uses an Autonumber format with the prefix "MD" (for "Material Declaration"). Although the Autonumber format isn't required, it makes sense to use the same prefix for all declarations to make it easier to search for them.

Note: The case required for the Cover Page.Name field depends on the selected character set for the field. For more information about defining and modifying character sets, Refer to the Agile PLM Administrator Guide.

Supplier users with the (Restricted) Material Provider role can also create declarations. However, in this case, only the Cover Page.Name attribute is required to create the object. The Cover Page.Supplier attribute is filled in automatically with the user's supplier organization.

The following example shows how to create a JGPSSI declaration.

Example: Creating a JGPSSI Declaration

    public void CreateJGPSSIDeclaration(String num, ISupplier supplier) throws Exception {
    // Create a Map object to store parameters

Map params = new HashMap();

    // Initialize the params object
    // Create a Map object to store parameters

params.put(DeclarationConstants.ATT_COVER_PAGE_NAME, num);

params.put(DeclarationConstants.ATT_COVER_PAGE_SUPPLIER, supplier);

    // Get the JGPSSI Declaration subclass

IAgileClass declClass = m_session.getAdminInstance().getAgileClass(

DeclarationConstants.CLASS_JGPSSI_DECLARATION);

    // Create a new JGPSSI declaration
    }

IDeclaration object = (IDeclaration)m_session.createObject(declClass, params);

### 20.3.2 Creating Specifications

Specifications are used to state the criteria that a product is expected to meet or exceed. They are generally used to limit the amount of restricted substances contained in a product. Specifications can be internal documents issued by a company or industry, or, more commonly, they are regulations issued by a governing body. Here are some examples of government regulations:

- Restrictions on the Use of Certain Hazardous Substances in Electrical and Electronic Equipment (RoHS) Directive, issued by the European Union

- Waste Electrical and Electronic Equipment (WEEE) Directive, issued by the European Union

- Food Allergen Labeling and Consumer Protection Act (FALCPA), issued by the U.S.A. Food and Drug Administration (FDA)

A specification defines a list of substances, the parts-per-million (PPM) threshold for each substance, and whether a particular substance is restricted. Compliance Managers can use specifications to pre-populate material declarations with appropriate substances to ensure compliance.

The only required attribute you must specify when you create a specification is General Info.Name. The name must be unique. The name is case-insensitive, which means "ROHS" is treated the same as "Rohs".

The General Info.Validation Type attribute is important because it determines whether the specification is Part Level (the default) or Homogeneous Material Level, which affects the types of declarations that can be used with the specification. Another optional attribute is General Info.Lifecycle Phase. When you create a specification, the default lifecycle phase is Active. To make the specification obsolete, change the value of its lifecycle phase attribute to Obsolete.

Example: Creating a specification

    public void createSpecification (String name) throws Exception {

ISpecification spec =

(ISpecification) m_session.createObject(SpecificationConstants.CLASS_SPECIFICATION, name);

    }

## 20.4 Creating Substances

There are four substance subclasses provided with Agile PLM:

- Subpart - a subunit of a component manufacturer part. The Composition table of a subpart can have other subparts, materials, substance groups, and substances.

- Material - a compound consisting of several substances. The Composition table of a material can have substance groups or substances.

- Substance Group - a group of substances. The Composition table of a substance group can have only substances.

- Substance - a single element, such as lead, chromium, or cadmium. Substances do not have a Composition table.

These substance subclasses comprise the hierarchy of objects that can appear on a Composition table, also known as the Bill of Substances.

### 20.4.1 Creating a Substance

Like material objects, the only attribute you need to specify to create a substance is the General Info.Name attribute, which is equivalent to the substance number. You can also specify other optional attributes, such as General Info.CAS Number.

Example: Creating a substance

    public void createSubstance(String num, String casNumber) throws Exception {

Map params = new HashMap();

    // Initialize the params object
    // Create a Map object to store parameters

params.put(SubstanceConstants.ATT_GENERAL_INFO_NAME, num);

params.put(SubstanceConstants.ATT_GENERAL_INFO_CAS_NUMBER, casNumber);

    // Get the Substance subclass

IAgileClass subsClass =

m_session.getAdminInstance().getAgileClass(SubstanceConstants.CLASS_SUBSTANCE);

    // Create a new substance

ISubstance substance =

(ISubstance)m_session.createObject(subsClass, params);

    }

### 20.4.2 Creating a Substance Group

A substance group object is a group of multiple substances tracked in Agile PLM that have a common base substance. Every substance within the group has a conversion factor used to convert the weight of the base substance of the group.

Example: Creating a substance group

    public void createSubstanceGroup(String num, ISubstance sub) throws Exception {

Map params = new HashMap();

    // Initialize the map object
    // Create a Map object to store parameters

params.put(SubstanceConstants.ATT_GENERAL_INFO_NAME, num);

params.put(SubstanceConstants.ATT_GENERAL_INFO_BASE_SUBSTANCE, sub);

    // Get the Substance Group subclass

IAgileClass subsClass =

m_session.getAdminInstance().getAgileClass(SubstanceConstants.CLASS_SUBSTANCE_GROUP);

    // Create a new Substance Group
    }

ISubstance sub = (ISubstance)m_session.createObject(subsClass, params);

### 20.4.3 Creating a Material

When you create a material object, the only attribute you need to specify is the General Info.Name attribute, which is equivalent to the substance number. After you create a material object, you can add substances to its Composition table.

Example: Creating a material object and adding substances to it

    public void createMaterial(String num, ISubstance[] substances) throws Exception {

Map params = new HashMap();

    // Initialize the params object
    // Create a Map object to store parameters
    // Create a new material

params.put(SubstanceConstants.ATT_GENERAL_INFO_NAME, num);

ISubstance material =

(ISubstance)m_session.createObject(SubstanceConstants.CLASS_MATERIAL, params );

    // Get the Composition table

ITable composition =

material.getTable(SubstanceConstants.TABLE_COMPOSITION);

    // Add substances to the Composition table

for (int i = 0; i < substances.length; ++i) {

IRow row = composition.createRow(substances[i]);

}

    }

### 20.4.4 Creating a Subpart

A subpart object is a subunit of a component that is tracked in Agile PLM. Subparts are parts without a part number that are used to create a bill of material of manufacturer parts or parts within a composition.

Example: Creating a subpart

    public void createSubpart(String num) throws Exception {

Map params = new HashMap();

    // Initialize the map object
    ISubstance sub =
    // Get the Subpart subclass
     IAgileClass subsClass =

params.put(SubstanceConstants.ATT_GENERAL_INFO_NAME, num);

m_session.getAdminInstance().getAgileClass(SubstanceConstants.CLASS_SUBPART);

    // Create a new Subpart

(ISubstance)m_session.createObject(class, params);

    }
    public void setFieldsNeededForRouting(IDeclaration dec) throws Exception {

## 20.5 Adding Items, Manufacturer Parts, and Part Groups to Declarations

Each declaration has separate tables for items, manufacturer parts, and part groups. Each of these also has an associated composition table: Item Composition, Manufacturer Part Composition, and Part Group Composition.

When you add an item to the Items table of a declaration, the latest released revision of the item is used. If the item does not have a released revision, the Introductory revision is used.

The following example shows how to add items, manufacturer parts, and part groups to a declaration.

Example: Adding items, manufacturer parts, and part groups to a declaration

    public void addDecObjects(IDeclaration dec) throws APIException {

try {

HashMap params = new HashMap();

    //Add an Item to the Items table

ITable tblItems =

dec.getTable(DeclarationConstants.TABLE_ITEMS);

params.clear();

params.put(DeclarationConstants.ATT_ITEMS_ITEM_NUMBER, "1000-02");

IRow rowItems =

tblItems.createRow(params);

    //Add a Manufacturer Part to the Manufacturer Parts table

ITable tblMfrParts =

dec.getTable(DeclarationConstants.TABLE_MANUFACTURERPARTS);

params.clear();

params.put(DeclarationConstants.ATT_MANUFACTURER_PARTS_MFR_PART_NUMBER, "Widget103");

params.put(DeclarationConstants.ATT_MANUFACTURER_PARTS_MFR_NAME, "ACME");

IRow rowMfrParts = tblMfrParts.createRow(params);

    //Add a Commodity to the Part Groups table

ITable tblPartGroups =

dec.getTable(DeclarationConstants.TABLE_PARTGROUPS);

params.clear();

params.put(DeclarationConstants.ATT_PART_GROUPS_NAME, "RES");

IRow rowPartGroups = tblPartGroups.createRow(params);

} catch (APIException ex) {

System.out.println(ex);

}

    }

## 20.6 Adding Substances to Declarations

You can add substances to the Item Composition, Manufacturer Part Composition, and Part Group Composition tables contained within a declaration. To publish substances into items, manufacturer parts, and part groups, you release the declaration. When the declaration is released, the substances get added automatically to the Substances tables of the corresponding items, manufacturer parts, and part groups.

The composition tables for a declaration are mapping tables; they map parts to their substances. If there are no substances for the parent object, the composition table has no rows.

To add a row to the composition tables of a declaration, use the ITable.createRow() method. Because the composition tables are mapping tables, you cannot pass an ISubstance object to create the row. Instead, specify a Map object containing attribute-value pairs.

Important The Substances and Composition tables for items and part groups are read-only. They get populated with data only when declarations are released.

To add a substance to one of the Composition tables of a declaration:

1. Add an item, manufacturer part, or part group to the Items, Manufacturer Parts, or Part Groups tables of a declaration, respectively.

2. Add a substance row to the Composition table that references the parent row on the Items, Manufacturer Parts, or Part Groups table. Use the virtual attribute DeclarationConstants.ATT_PARENT_ROW to specify the parent row. When you add a substance, specify the substance name and substance type.

Important: For the Agile SDK, Composition tables for declarations list all parent objects contained in the Items, Manufacturer Parts, and Part Groups tables. Agile Web Client represents Composition tables differently. It shows a separate Composition table for each parent object.

When you create a row in the Composition tables, you pass a Map object containing attribute-value pairs. The following table lists the attributes the Map object must contain:

Composition Table | Required Attributes | DeclarationConstants
--- | --- | ---
Item Composition | Item Row Substance Name | ATT_PARENT_ROW ATT_ITEM_COMPOSITION_SUBSTANCE_NAME
Manufacturer Part Composition | Manufacturer Part Row Substance Name | ATT_PARENT_ROW ATT_MANUFACTURER_PART_COMPOSITION_SUBSTANCE_NAME
Part Group Composition | Part Group Row Substance Name | ATT_PARENT_ROW ATT_PART_GROUP_COMPOSITION_SUBSTANCE_NAME

### 20.6.1 Structure of Bill of Substances

When you add substances to the Composition tables of a declaration, you can structure them in multiple levels. The number of levels you can use depends on the type of declaration.

- Homogeneous Materials Declaration - You can create a multilevel Bill of Substances with subparts, materials, substance groups, and substances. The composition must contain either a subpart or a material as a direct child. It can also include substances and substance groups, but they must be attached to a subpart or material.

- Substance Declaration/JGPSSI Declaration - Users can add substances or substance groups to the Composition tables.

- Part Declaration/Supplier Declaration of Conformance - These declarations do not have Composition tables.

Figure 20-1 Hierarchy for a Bill of Substances (Composition) with four child levels

### 20.6.2 Rules for Adding Substances

Follow these rules when adding substances to a Composition table:

- Parent objects must be added before their children.

- Subparts can have the following children: other Subparts, Materials, Substance Groups, or Substances.

  - A Subpart cannot contain Subparts, Materials, Substance Groups, and Substances all at the same level.

  - A Subpart can contain other Subparts and Material at the same level.

  - A Subpart can contain Substance Groups and Substances at the same level.

- Material can have the following children: Substance Groups or Substances.

- Substance Groups can have the following children: Substances only.

### 20.6.3 Adding Subparts and Materials that Do Not Exist

When you add substances to a Composition table of a declaration, you can specify "dummy" subparts and materials that do not exist in the Agile PLM system. Such subparts and materials will be visible only within the Composition table. When you add "dummy" subparts and materials to the Composition table, you must specify the Substance Type attribute:

- ATT_ITEM_COMPOSITION_SUBSTANCE_TYPE

- ATT_MANUFACTURER_PART_COMPOSITION_SUBSTANCE_TYPE

- ATT_PART_GROUP_COMPOSITION_SUBSTANCE_TYPE

The following example shows how to add a dummy subpart or material to the Manufacturer Part Composition table. Because the Substance Type field is a list field, the value passed for it is an IAgileList.

Example: Adding a dummy subpart or material to the Manufacturer Part Composition table

    public IRow addDummy(IDeclaration dec, IRow parentRow,

String dummyName, IAgileList subtype)

throws APIException {

try {

HashMap params = new HashMap();

ITable tblMfrPartComp =

dec.getTable(DeclarationConstants.TABLE_MANUFACTURERPARTCOMPOSITION);

params.put(DeclarationConstants.ATT_PARENT_ROW, parentRow);

params.put(DeclarationConstants.ATT_MANUFACTURER_PART_COMPOSITION_SUBSTANCE_NAME, dummyName);

params.put(DeclarationConstants.ATT_MANUFACTURER_PART_COMPOSITION_SUBSTANCE_TYPE, subtype);

IRow dummyRow =

tblMfrPartComp.createRow(params);

return dummyRow;

} catch (APIException ex) {

System.out.println(ex);

}

    }

### 20.6.4 Examples of Adding Substances

The following examples show how to add:

- Substances to the Manufacturer Part Composition Table of a Homogeneous Material Declaration

- Substances to the Manufacturer Part Composition Table of a Substance Declaration

#### 20.6.4.1 Adding Substances to Manufacturer Part Composition Table of Homogeneous Material Declarations

The following example shows how to add substances to a Manufacturer Part Composition table of a Homogeneous Material Declaration. The table has four levels: subparts, materials, substance groups, and substances. When you add a substance row to the table, we recommend that you pass a substance object (ISubstance) instead of a substance name (String) as the input parameter.

Example: Adding Homogeneous Material Level substances to a Manufacturer Part Composition table

    public void addHomogeneousMaterialComp(IAgileSession m_session) throws APIException {

try {

HashMap params = new HashMap();

    // Create a Declaration

String num =

"MDTEST001";

ISupplier supplier =

(ISupplier)m_session.getObject(ISupplier.OBJECT_TYPE, "DISTRIBUTOR00007");

params.put(DeclarationConstants.ATT_COVER_PAGE_NAME, num); params.put(DeclarationConstants.ATT_COVER_PAGE_SUPPLIER, supplier);

IAgileClass declClass =

m_session.getAdminInstance().getAgileClass(DeclarationConstants.CLASS_HOMOGENEOUS_MATERIAL_DECLARATION);

IDeclaration dec =

(IDeclaration)m_session.createObject(declClass, params);

    // Add a Homogeneous Material Level spec to the Specifications table

ITable tblSpec =

dec.getTable(DeclarationConstants.TABLE_SPECIFICATION);

params.clear();

ISpecification spec =

(ISpecification)m_session.getObject(ISpecification.OBJECT_TYPE, "Lead Homogeneneous Material Level");

IRow rowSpec = tblSpec.createRow(spec);

    // Add a Manufacturer Part to the Manufacturer Parts table

ITable tblMfrParts =

dec.getTable(DeclarationConstants.TABLE_MANUFACTURERPARTS);

params.clear();

params.put(DeclarationConstants.ATT_MANUFACTURER_PARTS_MFR_PART_NUMBER, "Widget103");

params.put(DeclarationConstants.ATT_MANUFACTURER_PARTS_MFR_NAME, "ACME");

IManufacturerPart mfrPart =

(IManufacturerPart) m_session. getObject(IManufacturerPart.OBJECT_TYPE, params);

IRow rowMfrParts =

tblMfrParts.createRow(mfrPart);

    // Add a subpart to the Composition table

ITable tblMfrPartComp =

dec.getTable(DeclarationConstants.TABLE_MANUFACTURERPARTCOMPOSITION);

ISubstance subpart =

(ISubstance)m_session.getObject(SubstanceConstants.CLASS_SUBPART, "Steel Casing");

params.clear(); params.put(DeclarationConstants.ATT_PARENT_ROW, rowMfrParts);

params.put(DeclarationConstants.ATT_MANUFACTURER_PART_COMPOSITION_SUBSTANCE_NAME, subpart);

IRow rowSubpart =

tblMfrPartComp.createRow(params);

    // Add a material

ISubstance material =

(ISubstance)m_session.getObject(SubstanceConstants.CLASS_MATERIAL, "Steel");

params.clear();

params.put(DeclarationConstants.ATT_PARENT_ROW, rowSubpart);

params.put(DeclarationConstants.ATT_MANUFACTURER_PART_COMPOSITION_SUBSTANCE_NAME, material);

IRow rowMaterial =

tblMfrPartComp.createRow(params);

    // Add a substance group

ISubstance sg =

(ISubstance)m_session.getObject(SubstanceConstants.CLASS_SUBSTANCE_GROUP,"Lead Compounds");

params.clear(); params.put(DeclarationConstants.ATT_PARENT_ROW, rowMaterial);

params.put(DeclarationConstants.ATT_MANUFACTURER_PART_COMPOSITION_SUBSTANCE_NAME, sg);

IRow rowSubGroup =

tblMfrPartComp.createRow(params);

    // Add a substance

ISubstance sub =

(ISubstance)m_session.getObject(SubstanceConstants.CLASS_SUBSTANCE,"Lead");

params.clear();

params.put(DeclarationConstants.ATT_PARENT_ROW, rowSubGroup);

params.put(DeclarationConstants.ATT_MANUFACTURER_PART_COMPOSITION_SUBSTANCE_NAME, sub);

IRow rowSubs =

tblMfrPartComp.createRow(params);

} catch (APIException ex) {

System.out.println(ex);

}

    }

#### 20.6.4.2 Adding Substances to Manufacturer Part Composition Table of Substance Declarations

The following example shows how to add substances to a Manufacturer Part Composition table of a Substance Declaration. The table has two levels: substance groups and substances.

Example: Adding Part Level substances to a Manufacturer Part Composition table

    public void addSubstanceComp(IAgileSession m_session) throws APIException {

try {

HashMap params = new HashMap();

    //Create a Declaration

String num =

"MDTEST001";

ISupplier supplier =

(ISupplier)m_session.getObject(ISupplier.OBJECT_TYPE, "DISTRIBUTOR00007");

params.put(DeclarationConstants.ATT_COVER_PAGE_NAME, num); params.put(DeclarationConstants.ATT_COVER_PAGE_SUPPLIER, supplier);

IAgileClass declClass =

m_session.getAdminInstance().getAgileClass(DeclarationConstants.CLASS_SUBSTANCE_DECLARATION);

IDeclaration dec =

(IDeclaration)m_session.createObject(declClass, params);

    //Add a Specification to the Specifications table

ITable tblSpec =

dec.getTable(DeclarationConstants.TABLE_SPECIFICATION);

params.clear();

    // Part Level

ISpecification spec =

(ISpecification)m_session.getObject(ISpecification.OBJECT_TYPE, "Lead Part Level");

IRow rowSpec =

tblSpec.createRow(spec);

    //Add a Manufacturer Part to the Manufacturer Parts table

ITable tblMfrParts =

dec.getTable(DeclarationConstants.TABLE_MANUFACTURERPARTS);

params.clear();

params.put(DeclarationConstants.ATT_MANUFACTURER_PARTS_MFR_PART_NUMBER, "Widget103");

params.put(DeclarationConstants.ATT_MANUFACTURER_PARTS_MFR_NAME, "ACME");

IManufacturerPart mfrPart =

(IManufacturerPart) m_session.getObject(IManufacturerPart.OBJECT_TYPE, params);

IRow rowMfrParts =

tblMfrParts.createRow(mfrPart);

    //Add a substance group

ITable tblMfrPartComp =

dec.getTable(DeclarationConstants.TABLE_MANUFACTURERPARTCOMPOSITION);

ISubstance sg =

(ISubstance)m_session.getObject(SubstanceConstants.CLASS_SUBSTANCE_GROUP,"Lead Compounds");

params.clear();

params.put(DeclarationConstants.ATT_PARENT_ROW, rowMfrParts);

params.put(DeclarationConstants.ATT_MANUFACTURER_PART_COMPOSITION_SUBSTANCE_NAME, sg);

IRow rowSubGroup =

tblMfrPartComp.createRow(params);

    //Add a substance

ISubstance sub =

(ISubstance)m_session.getObject(SubstanceConstants.CLASS_SUBSTANCE,"Lead");

params.clear(); params.put(DeclarationConstants.ATT_PARENT_ROW, rowSubGroup);

params.put(DeclarationConstants.ATT_MANUFACTURER_PART_COMPOSITION_SUBSTANCE_NAME, sub);

IRow rowSubs =

tblMfrPartComp.createRow(params);

} catch (APIException ex) {

System.out.println(ex);

}

    }

## 20.7 Adding Substances to a Specification

The Substances table of a specification is important to Agile PG&C because it identifies which substances are restricted and their threshold mass parts per million (PPM). Only substances and substance groups can be added to the Substances table of a Specification. To add a substance to the Substances table, use the ITable.createRow() method. You can pass an ISubstance or a Map object to create the new row.

Example: Adding a substance to a specification

    public void addSubstanceToSpec(ISpecification spec, ISubstance substance)

throws Exception {

IRow row = null;

//Add a substance to the Substances table

ITable tableSub = spec.getTable(SpecificationConstants.TABLE_SUBSTANCES);

row = tableSub.createRow(substance);

if (row!=null){

    //Set value of Restricted

ICell cell = row.getCell(SpecificationConstants.ATT_SUBSTANCES_RESTRICTED);

IAgileList list = (IAgileList)cell.getAvailableValues();

list.setSelection(new Object[] {"Yes"});

cell.setValue(list);

    //Set value of Threshold Mass PPM

row.setValue(SpecificationConstants.ATT_SUBSTANCES_THRESHOLD_MASS_PPM, new Integer(10));

}

}

## 20.8 Adding Specifications to a Declaration

The Specifications table of a declaration lists specifications related to the items, manufacturer parts, and part groups contained in the declaration. The purpose of a declaration is to the ensure that suppliers comply with any restrictions stated in the specifications.RU

### 20.8.1 Rules for Adding Specifications

Specifications are optional for declarations. If you submit a declaration without a specification, it means you intend to collect raw data (mass or PPM) at the substance level. The supplier must provide information on all materials and substances.

If you add a specification to a declaration, note that declaration classes support different types of specifications. The following table lists the specification requirements for each type of declaration:

Declaration Type | Supported Specification Validation Types
--- | ---
Homogeneous Material Declaration | Homogeneous Material Level
IPC 1752-1 Declaration | Part Level
IPC 1752-2 Declaration | Homogeneous Material Level
JGPSSI Declaration | Part Level
Part Declaration | Part Level and Homogeneous Material Level
Substance Declaration | Part Level
Supplier Declaration of Conformance | Part Level and Homogeneous Material Level

Specifications may concern many substances, including those not used by the parts contained in the declaration. When the declaration is opened to the supplier, any relevant substances from the specifications are automatically added to the Item Composition, Manufacturer Part Composition, and Part Group Composition tables. This ensures that you are properly tracking any restricted substances contained in parts listed in the declaration.

Example: Adding specifications to the Specification table

    private void addSpecifications(IDeclaration dec, ISpecification[] specs) throws Exception {

ITable tableSpecs = dec.getTable(DeclarationConstants.TABLE_SPECIFICATION);

for (int i = 0; i < specs.length; ++i) {

ISpecification spec = specs[i];

IRow row = tableSpecs.createRow(spec);

}

    }

## 20.9 Routing Declarations

The Default Declarations Workflow follows a straightforward process flow, as shown in the following figure.

Figure 20-2 Default Declarations workflow

The following table describes each status in the Default Declarations workflow.

Status | Description
--- | ---
Pending | The Compliance Manager creates a new declaration, adding new items, manufacturer parts, or part groups. He also adds specifications to the declaration.
Open To Supplier | The Compliance Manager opens the declaration to the supplier, asking him to confirm whether parts comply with specifications. When the Workflow status of a declaration is changed from "Pending" to "Open To Supplier," the Agile PLM server automatically populates the declaration's Substances tables with any substances listed on its specifications.
Submit to Manager | The supplier electronically "signs" and submits the declaration back to the Compliance Manager.
Review | The Compliance Manager and other reviewers verify and approve the contents of the declaration.
Released | The Compliance Manager releases the declaration, thereby publishing the materials into the product record.
Implemented | Once the parts are manufactured and disseminated in the field, the Compliance Manager implements the declaration, thereby completing the workflow.

Before you can route a declaration, you should set values for the following three Cover Page fields:

- Cover Page.Compliance Manager

- Cover Page.Workflow

- Cover Page.Due Date

Technically, only the Compliance Manager and Workflow fields are required to route the declaration. The Due Date field is optional but should be specified for tracking purposes. The following example shows how to set values for these three fields.

    Setting values for the Compliance Manager, Workflow, and Due Date fields
    //Set the Compliance Manager field

IUser user = m_session.getCurrentUser();

dec.setValue(DeclarationConstants.ATT_COVER_PAGE_COMPLIANCE_MANAGER, user);

    //Set the Workflow field
    // Change to the Submit to Manager status (signoff password is "agile")

IWorkflow workflow = dec.getWorkflows()[0];

dec.setWorkflow(workflow);

//Set the Due Date field

DateFormat df = new SimpleDateFormat("MM/dd/yy");

dec.setValue(DeclarationConstants.ATT_COVER_PAGE_DUE_DATE, df.parse("05/01/05"));

    }

To change the status of a declaration, use the IRoutable.changeStatus() method. Once a declaration is opened to a supplier, only the supplier's contact users can edit it. For other users, including the Compliance Manager, the declaration becomes read-only. The following example shows how the Compliance Manager can change the status of a declaration to "Open To Supplier."

Example: Opening a declaration to a supplier

    public void openToSupplier(IDeclaration dec) throws Exception {
    // Get the Open to Supplier status type

IStatus status = null;

IStatus[] stats = dec.getNextStatuses();

for (int i = 0; i < stats.length; i++) {

if (stats[i].toString().equals("Open To Supplier")) {

status = stats[i];

break;

}

}

// Change to the Open to Supplier status

dec.changeStatus(status, false, null, false, false, null, null, null, false);

    }

For more information about Agile APIs that support Workflow processes, see Managing Workflow on page 227.

## 20.10 Completing a Declaration

When a declaration is opened to a supplier, the supplier is responsible for completing the declaration and disclosing if any restricted substances are contained in the components and subassemblies it provides and whether those substances comply with specifications. To complete and sign off on declarations, one or more contact users for the supplier must be assigned the (Restricted) Material Provider role.

The Material Provider user should do the following to complete a declaration:

- Fill in the Mass and Declared PPM fields or the Declared Compliance field for every substance listed on the Item Composition, Manufacturer Part Composition, and Part Group Composition tables, particularly for substances that are restricted by specifications.

- Complete other flex fields on the Composition tables as necessary.

- Add or remove substances from the declaration.

When the declaration is complete, the Material Provider user can sign off and submit the declaration to the Compliance Manager, described below.

## 20.11 Submitting Declarations to Compliance Managers

When the supplier changes the status of the declaration from "Open to Supplier" to "Submit to Manager," he must sign-off on the declaration. Therefore, he must use the changeStatus() method that has an additional password parameter:

    changeStatus(IStatus newStatus, boolean auditRelease, String comment, boolean notifyOriginator, boolean notifyCCB, Object[] notifyList, Object[] approvers, Object[] observers, boolean urgent, String password)

The following example shows how the supplier can sign off and submit the declaration to the Compliance Manager.

Example: Signing off and submitting a declaration to the Compliance Manager

    public void submitToCM(IDeclaration dec) throws Exception {

IStatus status = null;

    // Get the Submit to Manager status type

IStatus[] stats = dec.getNextStatuses();

for (int i = 0; i < stats.length; i++) {

if (stats[i].toString().equals("Submit To Manager")) {

status = stats[i];

break;

}

}

    dec.changeStatus(status, false, null, false, false, null, null, null, false, "agile");
    }

## 20.12 Publishing a Declaration

The Agile API does not provide a method to publish a material declaration to the product record. Instead, a declaration is automatically published when it is released. Therefore, as far as the API is concerned, the substances table for an item, manufacturer part, or part group always reflects the last released declarations. However, Agile Web Client allows you to select an later declaration and publish it, thereby updating the substances information in the product record.

## 20.13 Getting and Setting Weight Values

Unit of Measure fields in Agile PLM support mass (weight) values for Agile PG&C objects. The Unit of Measure datatype is a compound datatype, that includes a numeric value and a unit, for example, grams or ounces.

You can configure and manage weight fields using the following interfaces:

- IMeasure

- IUnit

- IUnitOfMeasure

- IUnitOfMeasureManager

### 20.13.1 Converting an Object's Unit of Measure to a Different Unit of Measure

This conversion is explained with the aid of the following example which converts an object's weight from Kilograms to Grams. You can use this example to conver the unit of measure that measured the volume of the object, or its height.

Example: Converting the Unit of Measure from Kilogram to Gram

Note: This example converts the unit of measure in the source object from 1234.21 Kilograms to its equivalent weight in Grams. Thus, convertFrom is the source number you want to convert, Kilogram is source unit of measure, and Gram is that target unit of measure which are all randomly selected for this example.

    try {
    private void setMassValue(IItem item, double value, String unit) throws APIException {

double convertFrom = 1234.21;

com.agile.api.IUnitOfMeasureManager uomManager = (IUnitOfMeasureManager) session

.getManager(IUnitOfMeasureManager.class);

IUnitOfMeasure fromUOM = uomManager.createUOM(0, "Kilogram");

IUnitOfMeasure toUOM = uomManager.createUOM(0, "Gram");

IUnit fromUnit = fromUOM.getUnit();

IUnit toUnit = toUOM.getUnit();

double conversionFactor = fromUnit.getConversionFactor()

/ toUnit.getConversionFactor(); // This example returns 1000/1 = 1000

    double convertedValue = convertFrom*conversionFactor;
               System.out.println(ex);

} catch (APIException ex) {

}

Although the Agile PLM administrator can define new measures from the UOM node in Agile Java Client, the Agile API supports only the Weight measure for Agile PG&C objects. You cannot use the Agile API to define new measures.

Note In Agile 9.2.1, the Title Block.Weight field for items was changed to Title Block.Mass. However, the Agile API constant for the field is still ItemConstants.TITLE_BLOCK_WEIGHT.

The following example shows how to get and set values for the Title Block.Mass field of an item.

Example: Getting and setting the mass (weight) value for an item

    private IUnitOfMeasure getMassValue(IItem item) throws APIException {

IUnitOfMeasure uom =

(IUnitOfMeasure)item.getValue(ItemConstants.ATT_TITLE_BLOCK_WEIGHT);

System.out.println("Value: " + uom.getValue());

System.out.println("Unit: " + uom.getUnit().toString());

return uom;

    }

IUnitOfMeasure uom = null;

IUnitOfMeasureManager uomm =

(IUnitOfMeasureManager)m_session.getManager(IUnitOfMeasureManager.class);

uom = uomm.createUOM(value, unit);

item.setValue(ItemConstants.ATT_TITLE_BLOCK_WEIGHT, uom);

System.out.println("Value: " + uom.getValue());

System.out.println("Unit: " + uom.getUnit().toString());

}

If you create a query to search for items by mass, only the numeric value is searched, not the unit. The server converts mass values to the standard unit before returning query results. For example, the following query returns all items whose mass value is between 1.0 and 2.0 grams (the default standard unit). Items with a mass between 1000 and 2000 milligrams would also be included in the search results.

Example: Searching for items by mass

    try {
    ISubstance material =

IQuery query = (IQuery)m_session.createObject(IQuery.OBJECT_TYPE,

"select * from [Items] where [Title Block.Weight] between (1.0, 2.0)");

ITable results = query.execute();

## 20.14 Adding Substance Compositions for Manufacturer Parts

With appropriate privileges, you can modify the Specifications, Compositions, and Substances tables of a manufacturer part directly without submitting a declaration. This feature is useful for manufacturing partners that want to specify composition information for their parts. To add a row to the Specifications, Compositions, and Substances tables, use the ITable.createRow(Object) method.

Note: Once a row has been added to the Compositions and Substances tables of a Manufacturer Part, you cannot update or remove it.

The procedure for adding rows to the Substances table of a Manufacturer Part is similar to the way you add rows to the composition tables for a declaration. Follow these steps to add substance compositions into a manufacturer part:

1. Optionally, add a specification to the Specifications table.

2. Add a row to the Compositions table. You must specify a value for the ManufacturerPartConstants.ATT_COMPOSITIONS_COMPOSITION_TYPE attribute.

3. Add one or more rows to the Substances table. Each row must reference the parent row from the Compositions table. Use the virtual attribute ManufacturerPartConstants.ATT_PARENT_ROW to specify the parent row. When you add a substance, specify the substance name and substance type.

For additional rules about adding substances to the Substances table, see Rules for Adding Substances on page 342.

The Composition Type attribute for the parent row determines the types of substances you can add to the Substances table. There are three possible Composition Type values:

- Homogeneous Material Composition - You can create a multilevel Bill of Substances with subparts, materials, substance groups, and substances. The composition must contain either a subpart or a material as a direct child. It can also include substances and substance groups, but they can only be attached to a subpart or material.

- Substance Composition - The Substances table can contain only substance groups and substances.

- Part Composition - You can't add rows to the Substances table.

Specifications that you reference in a row in the Compositions table must match the Composition Type attribute for that row. For example, if the Composition Type for the row is Homogeneous Material Composition, the validation type for a specification referenced in that row must be Homogeneous Material Level.

The following example shows how to define a Homogeneous Material composition for a manufacturer part. The Substances table has four levels: subparts, materials, substance groups, and substances.

Example: Adding specifications, compositions, and substances to a Manufacturer Part

    public void addMfrPartSubs(IAgileSession m_session) throws APIException {

try {

    // Create a Manufacturer Part

HashMap params = new HashMap();

params.put(ManufacturerPartConstants.ATT_GENERAL_INFO_MANUFACTURER_PART_NUMBER,"Widget");

params.put(ManufacturerPartConstants.ATT_GENERAL_INFO_MANUFACTURER_NAME, "ACME");

IManufacturerPart mfrPart =

(IManufacturerPart) m_session.createObject(ManufacturerPartConstants.CLASS_MANUFACTURER_PART, params);

    // Add a Specification to the Specifications table

ITable tblSpec =

mfrPart.getTable(ManufacturerPartConstants.TABLE_SPECIFICATIONS);

ISpecification spec =

(ISpecification)m_session.getObject(ISpecification.OBJECT_TYPE,"Lead Spec");

    // Add Spec

IRow rowSpec =

tblSpec.createRow(spec);

    // Get the Compositions table and Set as Homogeneous Material Level

ITable tblComp =

mfrPart.getTable(ManufacturerPartConstants.TABLE_COMPOSITIONS);

    // Add a row to the Compositions table that references the specification

params.clear();

params.put(ManufacturerPartConstants.ATT_COMPOSITIONS_SPECIFICATION, spec.getName());

params.put(ManufacturerPartConstants.ATT_COMPOSITIONS_COMPOSITION_TYPE, "Homogeneous Material Composition");

IRow rowComp =

tblComp.createRow(params);

    // Get the Substances table

ITable tblSubs =

mfrPart.getTable(ManufacturerPartConstants.TABLE_SUBSTANCES);

    // Add a subpart

ISubstance subpart =

(ISubstance)m_session.

getObject(SubstanceConstants.CLASS_SUBPART, "Steel Casing");

params.clear();

params.put(ManufacturerPartConstants.ATT_PARENT_ROW, rowComp);

params.put(ManufacturerPartConstants.ATT_SUBSTANCES_SUBSTANCE_NAME, subpart);

IRow rowSubpart =

tblSubs.createRow(params);

    // Add a material

(ISubstance)m_session.getObject(SubstanceConstants.CLASS_MATERIAL, "Steel");

params.clear();

params.put(ManufacturerPartConstants.ATT_PARENT_ROW, rowSubpart);

params.put(ManufacturerPartConstants.ATT_SUBSTANCES_SUBSTANCE_NAME, material);

IRow rowMaterial =

tblSubs.createRow(params);

    // Add a substance group
    query.setCriteria("["+SDKWrapper.getString("TITLE_BLOCK")+"."+SDKWrapper.getString("IQuery_Number")+"] Equal To '"+item.getName()+"'");

ISubstance sg =

(ISubstance)m_session.getObject(SubstanceConstants.CLASS_SUBSTANCE_GROUP, "Lead Compounds");

params.clear();

params.put(ManufacturerPartConstants.ATT_PARENT_ROW, rowMaterial);

params.put(ManufacturerPartConstants.ATT_SUBSTANCES_SUBSTANCE_NAME, sg);

IRow rowSubGroup =

tblSubs.createRow(params);

    // Add a substance

ISubstance sub =

(ISubstance)m_session.getObject(SubstanceConstants.CLASS_SUBSTANCE,"Lead");

params.clear();

params.put(ManufacturerPartConstants.ATT_PARENT_ROW, rowSubGroup);

params.put(ManufacturerPartConstants.ATT_SUBSTANCES_SUBSTANCE_NAME, sub);

IRow rowSubs =

tblSubs.createRow(params);

} catch (APIException ex) {

System.out.println(ex);

}

    }

## 20.15 Rolling Up Compliance Data

After gathering compliance data for items, manufacturer parts, and part groups, compliance managers review the completed declarations to determine if the data is ready for publication into the product record. Once declarations are published with the data written through to parts and part groups on BOMs, compliance managers must examine and test BOMs to ensure the assemblies and products are compliant. This process is called compliance validation and is fulfilled through compliance rollups. Rollups are built into the system. They are easy to use and rollup results are available on the UI. For more information on rolling up compliance data and the business logic behind this process, refer to the Agile Product Governance & Compliance User Guide.

The SDK supports calling the PG&C Rollup function on the server side. This is the same rollup function that is called by the UI. The IPGCRollup interface supports this feature.

### 20.15.1 Understanding the IPGCRollup Interface

The IPGCRollup interface provides the following methods to support rolling up compliance data:

- rollup()

- rollup(Date)

One of these methods has no parameters and the other has Date as a parameter. The Date parameter in the rollup API is used by the system to set the timestamp for the rollup, when it is done.

Example: IPGCRollup methods

public interface IPGCRollup {

public void rollup()

throws APIException;

public void rollup(Date rollupDate)

throws APIException;

}

Note After invoking rollup(Date), it is necessary to call IDataObject.refresh() to make sure the rollup function has taken effect. Otherwise, the system will display the results obtained in the previous rollup if the timestamp of the recent rollup is the same as the Date parameter.

#### 20.15.1.1 Passing the Date Parameter

If you do not pass the date, the system will use the current time provided by the system. When a rollup is performed on a set of items, if the timestamp of the recent rollup on an item is the same as the passed Date parameter, the system will not repeat the rollup process on that item. Instead, it will display the results obtained in the previous rollup. You may want to use this date feature if there is a large number of items to rollup and you want to use the SDK to call all of them. In this case, you will get the current date first, and then the pass that date for the subsequent SDK Rollup(Date) call. For example, you want to use the SDK to roll up data for Assembly 1 and Assembly 2. In this case, the SDK is called twice. The first instance, to roll up data for Assembly 1, and the second instance, to rollup data for Assembly 2. With the date parameter already inside the rollup when performing the rollup on Assembly 2, the system will reuse the previous rollup data obtained for Item1.

    Assembly 1

Item1

Iitem2

    Assembly 2

Item1

Item3

### 20.15.2 Using the IPGCRollup Interface

The following examples roll up the assembled data on Items and Manufacturer Parts:

- Item (latest released ECO or MCO)

- MPN (latest released ECO or MCO)

#### 20.15.2.1 Rolling Up Assembled Data on Items

This example calls an API using the SDK to identify the top level parent of a given Item (its latest released ECO or MCO). Next, it will call the rollup API on the top level parent returned by the previous API to ensure the assemblies and products are compliant.

Example: Identifying the top level parent for an Item

    public void itemRollup(String itemStr) throws Exception{

try {

IItem item =

(IItem)m_session.getObject(IItem.OBJECT_TYPE, itemStr);

IQuery query =

(IQuery)m_session.createObject(IQuery.OBJECT_TYPE, ItemConstants.CLASS_ITEM_BASE_CLASS);

    //IQuery query = (IQuery)

m_session.createObject(IQuery.OBJECT_TYPE, ItemConstants.CLASS_PART);

query.setSearchType(QueryConstants.WHERE_USED_TOP_LEVEL);

query.setCriteria("[1001] Equal To '"+item.getName()+"'");

    //

ITable results=query.execute();

if (results.size() > 0) {

Iterator it =

results.getReferentIterator();

if (it.hasNext()) {

IItem obj =

(IItem)it.next();

IItem tlaItem =

(IItem)m_session.getObject(IItem.OBJECT_TYPE, obj.getName());

tlaItem.rollup();

}

}

else {

item.rollup();

}

} catch (APIException e) {

throw e;

}

return;

}

#### 20.15.2.2 Rolling Up Assembled Data on MPNs

This example calls an API using the SDK to identify the top level parent of a given MPN (its latest released ECO or MCO). Next, it will call the rollup API on the top level parent returned by the previous API to ensure the assemblies and products are compliant.

Example: Identifying the top level parent for an MPN

    public void testMfrPartRollup() throws Exception {
    IManufacturerPart mfrp =

(IManufacturerPart) m_session.getObject(IManufacturerPart.OBJECT_TYPE, "HARRIS::IS82C55A96");

    ITable whereused =
    String itemStr =
    Iterator it =

mfrp.getTable(ManufacturerPartConstants.TABLE_WHEREUSED);

whereused.iterator();

    while(it.hasNext())

{

IRow r = (IRow)it.next();

    // read item number

r.getValue(ManufacturerPartConstants.ATT_WHERE_USED_ITEM_NUMBER).toString();

try {

itemRollup(itemStr);

} catch (APIException e) {

int error =

((Integer)e.getErrorCode()).intValue();

}

    }
    // If the added part in Declaration is a Mfr Part, the changeName should be "null"
    }

return;

#### 20.15.2.3 Setting Values in the Calculated Compliance Field for Item Objects

Use the following API to set the value of the Calculated Compliance field on the Specifications table of Item and ManufacturerPart objects:

Public void setCalculatedComplianceForPartSpec(Object specName, Object complianceEntryValue) throws APIException

In this API, the specName parameter is the name of the Specification object, and the complianceEntryValue parameter is the actual value of the Calculated Compliance field, which can be any entry in the Calculated Compliance list. Both parameters are of type String.

When this value is set by the SDK Client, it is never overwritten during the Rollup. This API allows users to set the calculated compliance value based on their own defined logic, instead of using the system's default logic.

Example: Setting the value of the Calculated Compliance field for Item objects

    // COMPLIANT is the actual value of the Calculated Compliance field which shows the Specification is compliant or not, based on the customized calculated compliance result.
    // spec_num is the Specification Name in Item object's Specification Table

String COMPLIANT = "Compliant";

String spec_num =

row.getValue(ItemConstants.ATT_SPECIFICATIONS_SPECIFICATION).toString();

item.setCalculatedComplianceForPartSpec(spec_num, COMPLIANT);

#### 20.15.2.4 Setting Values in the Calculated Compliance Field for Declaration Objects

This is similar to the previous API that enabled setting the Calculated Compliance field for Item objects. You can use this API to set the value of the Calculated Compliance field in Item table and Manufacturer Part table for Declaration objects.

Public void setCalculatedComplianceForMDOPartSpec (Object partName, Object partClassName, Object changeNumber, Object specName, Object complianceEntryValue)) throws APIException

The system recognizes that the SDK Client has set this value and will use the new setting in the subsequent response during Rollup. In this API, the parameter changeNumber is optional. When the Declaration object has only one revision of an item, you can set the value of changeNumber to null. If the Declaration object has more than one revision of an item, you must set the value of changeNumber for the proper execution of the API.

Similar to the previous API, when this value is set by the SDK Client, it is never overwritten during the Rollup within the declaration. This API allows users to set the calculated compliance value based on their own defined logic, instead of using the system's default logic.

Note: If the SDK developer intends to pass the changeNumber field to setCalculatedComplianceForDeclarationPartSpec(), the developer must have the Discover Change privilege mask to make this change.

Example: Setting the value of the Calculated Compliance field for Declaration objects

    // complianceValue -- This is the customized calculated compliance

value and shows if the part is compliant to a Spec

String ComplianceValue = "Compliant";

    // partName is the Item/Mfr Part name in Declaration's Item/MfrPart table.

If it is a mfr part, it should be like "MfrName::MfrPartName"

String partName ="P00001";

String partClassName = "Parts";

    // If the added part in Declaration is an Item, the changeName should be the Change number corresponding to the Item's revision.

String changeName = "C00001";

    // spec_num is the Specification Name in Declaration object's

Specification Table

String specName = "Rohs";

Declaration.setCalculatedComplianceForDeclarationPartSpec

(partName, partClassName, changeName, specName, complianceValue);

#### 20.15.2.5 Setting Values in the Calculated Overall Compliance Field for Item and Manufacturer Part Objects

The SDK supports this Compliance by exposing the setCalculateOverallCompliance API.

public void setCalculateOverallCompliance () throws APIException;

The following examples use this API to set values the Overall Compliance field of an Item and a Manufacture Part.

Example: Setting the value of the Calculated Overall Compliance field for an Item object

Private static void test_OverallComplianceofItem (IAgileSession session) {

Try {

// Load an existing Item.

IItem item = (IItem) session.getObject (ItemConstants.CLASS_PART, "P00007");

item. SetCalculateOverallCompliance ();

} catch (APIException e) {

e.printStackTrace ();

}

}

Example: Setting the value of the Calculated Overall Compliance field for a Manufacture Part object

private static void test_OverallComplianceOfMfrpart(IAgileSession session) {

HashMap params = new HashMap();

params.put(ManufacturerPartConstants.ATT_GENERAL_INFO_MANUFACTURER_PART_NUMBER, "mfrpart001");

params.put(ManufacturerPartConstants.ATT_GENERAL_INFO_MANUFACTURER_NAME, "ACT");

try {

IManufacturerPart mfrPart =

(IManufacturerPart) session.getObject(ManufacturerPartConstants.CLASS_MANUFACTURER_PART, params);

mfrPart.setCalculateOverallCompliance();

} catch (APIException e) {

e.printStackTrace();

}

}

#### 20.15.2.6 Modifying the Calculated Compliance Field in the Specification Table of Part, Manufacturer Part, and Part Group Objects

The SDK supports modifying the value of this Calculated Compliance field by exposing the following API:

public void setCalculatedComplianceForPartSpec (Object specName, Object calComplianceEntryValue,boolean can_bemodified) throws APIException;

The following examples use this API to set values the Calculated Compliance field of an Item, Manufacturer Part, and Commodity,

Example: Modifying the Calculated Compliance field in the specification table of an Item

private static void test_set_calculated_compliance_For_Item(IAgileSession session) {

IItem item;

try {

item = (IItem)session.getObject(ItemConstants.CLASS_PART,"P00007");

item.setCalculatedComplianceForPartSpec("WEEE", "Non-Compliant",true);

} catch (APIException e) {

e.printStackTrace();

}

}

Example: Modifying the Calculated Compliance field in the specification table of a Manufacturer Part

private static void test_set_calculated_compliance_For_Mfrpart(IAgileSession session) {

try {

HashMap params = new HashMap();

params.put(ManufacturerPartConstants.ATT_GENERAL_INFO_MANUFACTURER_PART_NUMBER, "mfrpart001");

params.put(ManufacturerPartConstants.ATT_GENERAL_INFO_MANUFACTURER_NAME, "ACT");

IManufacturerPart mfrPart =

(IManufacturerPart)session.getObject(ManufacturerPartConstants.CLASS_MANUFACTURER_PART, params);

mfrPart.setCalculatedComplianceForPartSpec("WEEE", "Non-Compliant",true);

} catch (APIException e) {

}

}

Example: Modifying the Calculated Compliance field in the specification table of a Commodity

private static void test_set_calculated_compliance_For_Commotidy(IAgileSession session){

try {

ICommodity commodity;

commodity =

(ICommodity)session.getObject(ICommodity.OBJECT_TYPE, "Commodity1");

commodity.setCalculatedComplianceForPartSpec("WEEE", "Non-Compliant",true);

} catch (APIException e) {

e.printStackTrace();

}

}

#### 20.15.2.7 Modifying Settings in Scheduled Rollups for Declarations

Scheduled rollups, as the name implies, are run according to a schedule and Declarations are objects that enable Agile customers gather compliance information. These rollups use a server-based task that initiates a search for the set of objects that need rollup at the scheduled time. These objects are identified by a flag called need rollup. Once found, rollup is performed on these objects and their status is updated. The SDK exposes the setNeedRollupForDeclaration API to set (modify) the Need Rollup attribute to True or False.

Example: Modifying settings in the Need Rollup Flag

public void setNeedRollupForDeclaration(boolean complianceEntryValue) throws APIException

IDeclaration subdeclaration = (IDeclaration) session.getObject (DeclarationConstants.CLASS_SUBSTANCE_DECLARATION,"SD1");

subdeclaration.setNeedRollupForDeclaration (false);

#### 20.15.2.8 Performing External Compliance Rollups on Specification Objects

PG&C's Specification objects have a cover page attribute called the Rollup Engine. This attribute enables PG&C users to perform only External Compliance Rollups on Specification objects and avoid Internal Compliance Rollups. The Rollup Engine is linked to an 'Internal/External' switch that enables identifying Specification objects requiring a Rollup. For example, if the attribute is set to External, the Rollup Engine ignores performing the Rollup on the Specification and if it is set to Internal, the Internal Rollup Engine performs the Rollup. This new attribute can link Specification, Declaration, Item, Manufacturer Part, and Part Group objects. The following IExternalRollupManager.java interface enables performing external rollups with SDK. The related APIs included in this interface are listed below.

- Int triggerExtractRollupDataforObject(Object partName, Object partClassName, Object changeNumber) throws APIException; - This API invokes an external Rollup against a specific Object (item, mfrpart, part group).

#### 20.15.2.9 Example

String objnumber="P00010";

String objclass="Parts";

int job_id=externalrollupManager.triggerExtractRollupDataforObject (objnumber, objclass, null);

- Integer [] triggerExternalRollup(int jobID) throws APIException; - This API triggers the external rollup engine to perform the required external rollup

#### 20.15.2.10 Example

Integer[] extract_id=externalrollupManager.triggerExternalRollup (jobid);

- IVOExternalComposition getObjectComposition (int extract_id) throws APIException; - This API gets the Composition of the Object which is passed as parameters in Integer [] triggerExternalRollup(int jobID) throws APIException; API's returns.

#### 20.15.2.11 Example

IVOExternalComposition

objectcomposition=(IVOExternalComposition)externalrollupManager.getObjectComposition(extractid);

- IRow AppendUpdateRow (Object partName, Object partClassName, Object changeNumber, Object siteNumber, IVOExternalComposition externalComposition) throws APIException; - This API adds the composition information obtained by VOExternalComposition getObjectComposition (int extract_id) throws APIException; into the archived (inactive) composition table.

#### 20.15.2.12 Example

String objnumber="P00010";

String objclass="Parts";

String change_number=null;

String site_number=null;

IRow row=externalrollupManager.AppendUpdateRow(objnumber, objclass, change_number,site_number, objectextercompostion);

- IVOExternalCompositionSubstance[] getCompositionSubstances (int resultID) throws APIException; - This API gets the Substance information of the Object which is passed as parameters in the returned value of the Integer [] triggerExternalRollup(int jobID) throws APIException; API.

#### 20.15.2.13 Example

IVOExternalCompositionSubstance[]

substance=externalrollupManager.getCompositionSubstances(extratid);

- IRow [] bulkAppendUpdateSubstance (String objectname, String objClassclass, int rowID, IVOExternalCompositionSubstance [] externalCompositionSubstance) throws APIException; - This API adds the substances information of the object after it is obtained into the Substance Table.

#### 20.15.2.14 Example

String objnumber="P00010";

String objclass="Parts";

Int row_id=row. getRowId ();

IRow[] rows=externalrollupManager.bulkAppendUpdateSubstance(objnumber, objclass, row_id, substances);

- Void activeComposition (Object partName, Object partClassName, Object changeNumber, int compositionId) throws APIException; - This API actives the composition row placed in the archived Table by the IRow AppendUpdateRow (Object partName, Object partClassName, Object changeNumber, Object siteNumber, IVOExternalComposition externalComposition) throws APIException; API.

#### 20.15.2.15 Example

String objnumber="P00010";

String objclass="Parts";

Int row_id=row. getRowId ();

ArrayList list=new ArrayList();

list.add(row_id);

externalrollupManager.activeComposition(objnumber, objclass, change_number, list);

- Boolean deleteExtractData (int jobID) throws APIException; - This API deletes records in the Fact_table that were generated by the Int triggerExtractRollupDataforObject(Object partName, Object partClassName, Object changeNumber) throws APIException; API.

#### 20.15.2.16 Example

boolean flag=externalrollupManager.deleteExtractData(jobid);

#### 20.15.2.17 Updating Values of Calculated Compliance Attributes Against External Specifications

To update the value of the calculated compliance attribute against an external specification, use the updatePartRollupResult API in IExternalRollupManager interface.

boolean updatePartRollupResult(String objectnumber,String objectclassname,String changenumber, int spec ID,int calculatedCompliance, Date rolluptime) throws APIException;

Description of Data Fields

    specID
    External specification ID
    calculatedCompliance
    Calculated compliance value
    rolluptime
    Rollup time

Example: Updating the Value of a Calculated Compliance Attribute Against External Specifications

boolean flag =externalrollupManager.updatePartRollupResult("P00020","Parts","",6103610,4,new Date());

#### 20.15.2.18 Creating External or Internal Specifications

The IRollupRegulationFactory interface uses the following API to create external or internal specifications.

public ISpecification createRegulationwithNameRollupEngine(String subclasstypename,String regulation_name,

boolean isexternalengine) throws APIException;

Example: Creating Internal and External Specifications

IRollupRegulationFactory rollupregulation=(IRollupRegulationFactory)session.getManager(IRollupRegulationFactory.class);

ISpecification sp=regulation.createRegulationwithNumberRollupEngine("Specification", "sina", true);

### 20.15.3 Using the IDeclaration Interface

Agile SDK supports modifying values in the Calculated Compliance Field of Part Group, Item Composition, Manufacturer Part Composition, and Part Group Composition Objects by exposing the following API.

public void setCalculatedComplianceForDeclarationPartSpecSubstance (Object part_number, Object part_type, Object change_number, Object spec, Object substance, Object complianceEntryValue) throws APIException;

These examples use this API to set values the Calculated Compliance field for Item Composition, Manufacturer Part Composition, and Part Group Composition Objects by exposing the following APIs.

#### 20.15.3.1 Modifying value of the Calculated Compliance field of Declarations

Example: Modifying Values in Item Composition Table

private static void TestItemSetValue(IAgileSession session2) throws APIException {

IDeclaration dec =

IDeclaration)session.getObject(DeclarationConstants.CLASS_SUBSTANCE_DECLARATIONS_CLASS, "MD00009");

dec.setCalculatedComplianceForDeclarationPartSpecSubstance("P00001","Parts", "", "SPEC01", "1,4-BUTANOLIDE", "Non-Compliant"); }

Example: Modifying Values in Manufacturer Part Composition Table

private static void TestMfrpartSetValue(IAgileSession session2) throws APIException {

IDeclaration dec =

(IDeclaration)session.getObject(DeclarationConstants.CLASS_SUBSTANCE_DECLARATIONS_CLASS, "MD00009");

dec.setCalculatedComplianceForDeclarationPartSpecSubstance("AMP::12345","Manufacturer parts", null, "", null, "Non-Compliant");}

Example: Modifying Values in Part Group Composition Table

private static void TestPartFamliySetValue(IAgileSession session) throws APIException {

IDeclaration dec =

(IDeclaration)session.getObject(DeclarationConstants.CLASS_SUBSTANCE_DECLARATIONS_CLASS, "MD00009");

dec.setCalculatedComplianceForDeclarationPartSpecSubstance("CAP","Part groups", "", "WEEE", "AL", "Missing Info");