Showing posts with label PLM Teamcenter. Show all posts
Showing posts with label PLM Teamcenter. Show all posts

Saturday, March 6, 2021

How to install fsc in Teamcenter?

FSC can be install by running "installfsc.bat" file.

"installfsc.bat" file is located at FSC folder of TC_ROOT.


Command to run  "installfsc.bat": Run below commands in command tc_commandprompt

installfsc %JAVA_HOME% %FSC_HOME% fscid

%JAVA_HOME% = JAVA path

%FSC_HOME% = FSC folder location

fscid = fscid

for example : c:\apps\Siemens\Teamcenter10\fsc>installfsc "C:\Program Files\Java\jre7"

"D:\apps\Siemens\Teamcenter10\fsc" FSC_SVI6W181_user1


fscid can be get from "configuration.xml" file which is located in install folder of TC_ROOT.

fscid can be get from "masterfsc.xml" file which is located in FSC folder of TC_ROOT.


NOTE:If space are there in JAVA_HOME and FSC_HOME location put in double quote.



Tuesday, January 5, 2021

Difference between HOT Deploy and COLD Deploy in BMIDE

 HOT Deploy

  • Hot deploy can be done directly over the BMIDE.
  • Hot deploy is only good for non-schema object change.
  • Create custom business object, create custom properties, UOM, create LOVs, Create Rules etc. comes under non-schema.
  • Hot deploy good for adding LOVs value, changing display name, adding some properties.
  • Every time needs  to restart server manager when we make Hot deploy.
COLD Deploy
  • Cold deploy can be done only by tem.
  • Cold deploy used for both schema and non-schema changes.
  • Create custom business object, create custom properties, UOM, create LOVs, Create Rules etc. comes under non-schema.
  • Classes and Attribute comes under schema object.
  • Every time needs  to restart server manager when we make Cold deploy.

What is Property Constant in BMIDE ?

Property Constant

Property constants is used to change the characteristics of business object properties.  

We can attach property constants to make properties enabled, modifiable, exportable, required, a stub property, visible, or to set the initial value etc. 

We can also create our own property constants to apply our own characteristics.

Property constants provide default values to business object properties. Because these constants are attached to properties.




Monday, January 4, 2021

How to make a property mandatory in BMIDE?



Select property of an Business Object from properties Tab, in the property constants tab, make Required  property constant value as True.




Display Rules

 Display Rules

Business object display rules determine the members of the organization who cannot view a business object type in menus in the Teamcenter user interface. The Display Rules editor displays the groups and roles that are not allowed to see the selected type of business object in menus. This rule is primarily used to hide business objects from creation (File→New) menus, thereby restricting those who can create the business object type.


Business object display rules can be applied to the following business objects and their children:

• Dataset

• Folder

• Form

• Item


 Note:

  • Although users cannot create objects associated with restricted object types, they can view them and perform other operations, such as copying, modifying, or deleting the objects.

  • Business object display rules are subject to the principles of group hierarchy and inheritance. Rules defined at the site level are inherited by all groups and roles within groups. Rules defined for a group are inherited by all subgroups, but rules applied to a subgroup do not affect the parent groups or other subgroups at the same level in the hierarchy (sibling groups). Rules applied to roles within groups apply to all users with that role, but do not affect other roles in the same group.

Sunday, January 3, 2021

Deep copy rules

Deep Copy Rules 

Deep copy rules define whether objects belonging to a business object instance are copied when a user performs a save as or revise operation on that instance. Deep copy rules can be applied to any business object type and are inherited by children business object types.


Available actions to perform deep copy rules are :

CopyAsObject

Creates a new object of the same type as the related object and relates to the new revision. Objects created by this method are totally independent of the source object. Therefore, modifications to the new object are not reflected in the source object.

CopyAsReference

Creates a new relation between the new revision and the related object. Therefore, modifications performed on the copied object are propagated to the source object

NoCopy

Does not copy forward objects of the specified property type and relation.


Important Note:

Deep copy rules with high specificity have higher precedence than those with more general applicability. Four levels of specificity, and thus precedence, are possible:

Rule Level 1 {Target Business Object, Relation Type, Attached Business Object} - 1st highest precedence

Rule Level 2 {Target Business Object, Relation Type, Match All} - 2nd highest precedence

Rule Level 3 {Target Business Object, Match All, Attached Business Object} - 3rd highest precedence

Rule Level 4 {Target Business Object, Match All, Match All} - 4th highest precedence

At each level, a rule with a custom condition=true has higher precedence over a rule with

isTrue condition.

GRM rules(Generic Relationship Manager)

GRM rules (Generic Relationship Manager)

Generic Relationship Management (GRM) rules is used to apply constraints on the relationship between two business objects.

Using Generic Relationship Management (GRM) rules we can apply limit what objects can be pasted to other objects.

For example, if you do not want a certain type of object to have a specification relation to another type, you can set the cardinality to 0 to deny pasting of one type of object to another with the specification relation.

When you create a GRM rule, you select the primary business objects and secondary business objects for the relationship, the relationship they have to one another, and the constraints to be applied. 

Available relationships are children of the ImanRelation business object.


Cardinality : Determines the number of allowed occurrences of the primary object in relation to the secondary object, and of the secondary object in relation to the primary object.

When you create a GRM rule, type a number in the Primary Cardinality or Secondary Cardinality, allowed numbers are:

-1 or *                   =     Allow an unlimited number of relationships.

0                            =     Do not allow any relationships.

1, or 2, or 3, and so on    =    Allow the specified number of relationships.


Inheritance of GRM rules

The GRM rule applies for all children of the primary and secondary objects. However, rules defined for a sub-business object take precedence over the relation rules defined for a parent object.

For Example : 

If the ItemRevision business object is chosen as the primary object, and the DirectModel dataset is chosen as the secondary object, then all children of these objects that have the relationship inherit the rule.

Therefore, all instances of the children of ItemRevision that are related by the relation specified in the rule to any instance of children of DirectModel are subject to the constraints defined by the rule.

Thursday, December 31, 2020

Difference between Teamcenter 2-Tier and 4-Tier Architecture.

 2 - Tier Architecture

Client Tier : Client tier contains Rich client, Teamcenter  Servers, CAD Applications like NX and TC Visualizations that integrate with Rich client.

Resource Tier : Resource tier comprises of Database and Volume. It stores metadata and files managed by Teamcenter.

  •  Metadeta stores in Database.
  •  Files stores in Volume


4 - Tier Architecture

Client Tier : Client tier contains Rich client, Thin client ,Teamcenter  Servers, CAD Applications like NX, MS Office and TC Visualizations that integrate with both Rich client and Thin client.

Web Tier :

  •  Web tier manages the Teamcenter Client installation.
  • It runs the web applications like JBOSS, Tomcat, WebLogic etc.
  • This tier is responsible for communication between Client tier and Enterprise tier. It transfer the client request to Enterprise tier.

Enterprise Tier

  • Enterprise tier consists of server pool manager. A pool of server process, managed by the server manager/pool manager.
  • It retrieves the data from database and store the data in database.

Resource Tier

  • Resource tier comprises of Database and Volume. It stores metadata and files managed by Teamcenter.
  •  Metadeta stores in Database.
  •  Files stores in Volume

Wednesday, December 30, 2020

What is the difference between Rich Client and Thin Client in Teamcenter ?

  1. Rich Client : Rich client is a Java based Application, used to interact with Teamcenter interface.
  2. Thin client : Thin client is Browser based interface, it provide access to Teamcenter data over the web using web browser.

Friday, May 24, 2019

How to deploy Projects JAR to teamcenter


How to deploy Projects JAR to teamcenter

Copy the jar file which you want to deploy.

Paste it to:
Tc-Root(Teamcenter installed location) -> Portal -> Plugins

Now,Open registry folder

Run genregxml.bat file

Wait for sometime console will close automatically.

Thursday, May 16, 2019

Is Item Exist

import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.JTextField;

import com.teamcenter.rac.aif.AbstractAIFApplication;
import com.teamcenter.rac.aifrcp.AIFUtility;
import com.teamcenter.rac.kernel.TCComponent;
import com.teamcenter.rac.kernel.TCComponentQuery;
import com.teamcenter.rac.kernel.TCComponentQueryType;
import com.teamcenter.rac.kernel.TCException;
import com.teamcenter.rac.kernel.TCSession;

public class IsItemExist {

String msg="";
TCComponentQueryType qtype=null;
TCComponentQuery tcq=null;
JTextField text=new JTextField();
JFrame frame=new JFrame("Search Item");

AbstractAIFApplication app=AIFUtility.getCurrentApplication();
TCSession session=(TCSession) app.getSession();

public void Dialoge() throws TCException
{
text.setSize(100, 29);
frame.setSize(250, 130);

JPanel panel=new JPanel();
panel.setSize(250, 125);
panel.setLayout(null);

JLabel label1=new JLabel("Item Id");
JLabel label2=new JLabel("Enter Item Id to search");

JButton Search=new JButton("SEARCH");
label2.setBounds(50, 10, 150, 29);
label1.setBounds(30, 40, 80, 29);
text.setBounds(120,40, 100,29);
Search.setBounds(40, 70, 100, 29);

Search.addActionListener(new ActionListener() {

@Override
public void actionPerformed(ActionEvent e) {
// TODO Auto-generated method stub
try {
isItemExist();
} catch (TCException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
}
});

panel.add(label2);
panel.add(label1);
panel.add(text);
panel.add(Search);
frame.add(panel);

frame.setVisible(true);
frame.repaint();

}
public void isItemExist() throws TCException
{
String ItemId=text.getText();
qtype=(TCComponentQueryType) session.getTypeComponent("ImanQuery");
tcq=(TCComponentQuery) qtype.find("Item...");

String[] entry={"Item ID"};
String[] value={ItemId};

TCComponent[] result=tcq.execute(entry, value);

if(result==null || result.length==0)
{
JOptionPane.showMessageDialog(frame, "No such Item found with Item ID "+ItemId);
//System.out.println("No such Item found with Item ID "+ItemId);
}
else
{
JOptionPane.showMessageDialog(frame, ItemId+" Item Found");
//System.out.println("Item Found");
}
}

}

Create Excel Report using Execute Query on selected Dates

import java.awt.Color;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.text.SimpleDateFormat;
import java.util.Calendar;

import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JTextField;

import org.apache.poi.openxml4j.exceptions.InvalidFormatException;
import org.apache.poi.ss.usermodel.Cell;
import org.apache.poi.ss.usermodel.Sheet;
import org.apache.poi.ss.usermodel.Workbook;
import org.apache.poi.ss.usermodel.WorkbookFactory;

import com.teamcenter.rac.aif.AbstractAIFApplication;
import com.teamcenter.rac.aifrcp.AIFUtility;
import com.teamcenter.rac.kernel.TCComponent;
import com.teamcenter.rac.kernel.TCComponentQuery;
import com.teamcenter.rac.kernel.TCComponentQueryType;
import com.teamcenter.rac.kernel.TCProperty;
import com.teamcenter.rac.kernel.TCSession;
import com.teamcenter.rac.util.iTextField;

public class SearchDateItem {

  JFrame frame=new JFrame();
JPanel panel=new JPanel();

JLabel label1=new JLabel("Start Date");
JLabel label2=new JLabel("End Date");

JButton button1=new JButton("Search");

iTextField textfield1=new iTextField();
iTextField textfield2=new iTextField();

String s1;
String s2;

TCProperty Object_Name;
    TCProperty Type;
    TCProperty Owner;
    TCProperty GropupID;
    TCProperty DateModified;
   
 
public void search() throws InvalidFormatException, IOException
{
s1=textfield1.getText();
s2=textfield2.getText();
FileInputStream input=new FileInputStream(new File("C:\\Temp\\ExcelWorksheet.xlsx"));
Workbook workbook=WorkbookFactory.create(input);

Sheet sheet=(Sheet) workbook.getSheetAt(0);

AbstractAIFApplication app=AIFUtility.getCurrentApplication();
TCSession session=(TCSession) app.getSession();

try
{
TCComponentQueryType querytype=(TCComponentQueryType) session.getTypeComponent("ImanQuery");
TCComponentQuery query=(TCComponentQuery) querytype.find("Item...");

String[] EntryName={"Created After","Created Before"};
String[] EntryValue={s1,s2};
//Date formate
//dd-mmm-yyyy
//e.g- 19-may-2000

TCComponent[] comp=query.execute(EntryName, EntryValue);

int rowincr=1;
        int colincr=0;
     
        for(int i=0;i<comp.length;i++)
{
TCComponent taskcomp=(TCComponent) comp[i];
Object_Name=taskcomp.getTCProperty("object_name");
Type=taskcomp.getTCProperty("object_type");
Owner=taskcomp.getTCProperty("owning_user");
GropupID=taskcomp.getTCProperty("owning_group");
DateModified=taskcomp.getTCProperty("last_mod_date");


Cell cell1=sheet.getRow(rowincr).getCell(colincr);
cell1.setCellValue(Object_Name.toString());
colincr++;

Cell cell2=sheet.getRow(rowincr).getCell(colincr);
cell2.setCellValue(Type.toString());
colincr++;

Cell cell3=sheet.getRow(rowincr).getCell(colincr);
cell3.setCellValue(Owner.toString());
colincr++;

Cell cell4=sheet.getRow(rowincr).getCell(colincr);
cell4.setCellValue(GropupID.toString());
colincr++;

Cell cell5=sheet.getRow(rowincr).getCell(colincr);
cell5.setCellValue(DateModified.toString());
colincr++;

colincr=0;

rowincr++;

} catch (Exception e) {

}
FileOutputStream fos = new FileOutputStream("C:\\Temp\\ExcelWorksheet.xlsx");
workbook.write(fos);
fos.close();

}
public void createDialoge()
{
frame.setTitle("Report Generation");
    frame.getContentPane().setBackground(Color.WHITE);
    frame.setResizable(true);
    frame.setSize(400, 150);
 
    panel.setBounds(0, 0, 400, 150);
    panel.setBackground(Color.white);
panel.setLayout(null);
    panel.add(label1);
    label1.setBounds(20, 20, 100, 29);
 
    panel.add(label2);
    label2.setBounds(20, 50, 100, 29);
 
    panel.add(button1);
    button1.setBounds(150, 80, 150, 25);
 
    panel.add(textfield1);
    textfield1.setBounds(150, 20, 100, 25);
   
    panel.add(textfield2);
    textfield2.setBounds(150, 50, 100, 25);
 
    button1.addActionListener(new ActionListener() {

@Override
public void actionPerformed(ActionEvent e) {

SearchDateItem sdi=new SearchDateItem();
try {

sdi.search();
System.out.println("hi");
} catch (InvalidFormatException e1) {

e1.printStackTrace();
} catch (IOException e1) {

e1.printStackTrace();
}
}
});
 
    frame.add(panel);
    frame.setLayout(null);
    frame.setVisible(true);
    frame.revalidate();
    frame.repaint();
    frame.setVisible(true);
 
}
}

Wednesday, May 15, 2019

Create Excel Report of Multiple Schedule Task of Schedule Manager

//This will create excel report of mutliple schedule task stored in folder.

import java.io.FileOutputStream;

import org.apache.poi.hssf.util.HSSFColor;
import org.apache.poi.ss.usermodel.BorderStyle;
import org.apache.poi.ss.usermodel.CellStyle;
import org.apache.poi.xssf.usermodel.XSSFCellStyle;
import org.apache.poi.xssf.usermodel.XSSFFont;
import org.apache.poi.xssf.usermodel.XSSFRow;
import org.apache.poi.xssf.usermodel.XSSFSheet;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;

import com.teamcenter.rac.aif.AbstractAIFApplication;
import com.teamcenter.rac.aif.kernel.AIFComponentContext;
import com.teamcenter.rac.aifrcp.AIFUtility;
import com.teamcenter.rac.kernel.TCComponent;
import com.teamcenter.rac.kernel.TCComponentFolder;
import com.teamcenter.rac.kernel.TCComponentQuery;
import com.teamcenter.rac.kernel.TCComponentQueryType;
import com.teamcenter.rac.kernel.TCComponentSchedule;
import com.teamcenter.rac.kernel.TCProperty;
import com.teamcenter.rac.kernel.TCSession;

public class CreateReport {
int count=1;
FileOutputStream fileOut ;

public CreateReport() throws Exception
{
AbstractAIFApplication app=AIFUtility.getCurrentApplication();
TCSession session=(TCSession) app.getSession();
session.getUser();

String filename="C:\\Temp\\ScheduleExcelReport.xlsx";
XSSFWorkbook workbook = new XSSFWorkbook();
        XSSFSheet sheet = workbook.createSheet("FirstSheet");  
        sheet.setColumnWidth(0, 6000);
        sheet.setColumnWidth(1, 6000);
        sheet.setColumnWidth(2, 6000);
        sheet.setColumnWidth(3, 6000);
        sheet.setColumnWidth(4, 6000);
        sheet.setColumnWidth(5, 6000);
        
        XSSFCellStyle mystyle=workbook.createCellStyle();
        XSSFFont myfont=workbook.createFont();
        myfont.setBold(true);
        mystyle.setFont(myfont);
        mystyle.setFillForegroundColor(HSSFColor.GOLD.index);
        mystyle.setFillPattern(CellStyle.SOLID_FOREGROUND);
        mystyle.setBorderBottom(BorderStyle.MEDIUM);
        
        XSSFRow rowhead = sheet.createRow((short)0);
                rowhead.createCell(0).setCellValue("TASK NAME");
                rowhead.getCell(0).setCellStyle(mystyle);
            
               rowhead.createCell(1).setCellValue("START DATE");
               rowhead.getCell(1).setCellStyle(mystyle);
               rowhead.createCell(2).setCellValue("FINISHED DATE");
               rowhead.getCell(2).setCellStyle(mystyle);
               rowhead.createCell(3).setCellValue("ACTUAL START DATE");
               rowhead.getCell(3).setCellStyle(mystyle);
               rowhead.createCell(4).setCellValue("ACTUAL FINISH DATE");
               rowhead.getCell(4).setCellStyle(mystyle);
               rowhead.createCell(5).setCellValue("RESOURCE ASSIGNMENT");
               rowhead.getCell(5).setCellStyle(mystyle);
            
              fileOut = new FileOutputStream(filename);

      TCComponentQueryType querytype=(TCComponentQueryType)                                                                                               session.getTypeComponent("ImanQuery");
          TCComponentQuery query=(TCComponentQuery) querytype.find("General...");

String[] EntryName={"Name","Type"};
String[] EntryValue={"ScheduleFolder","Folder"};

TCComponent[] comp=query.execute(EntryName, EntryValue);

if(comp[0] instanceof TCComponentFolder)
{
AIFComponentContext[] context=comp[0].getChildren();
TCProperty Object_Name;
        TCProperty Start_Date;
          TCProperty Finish_Date;
TCProperty Actual_Start_Date;
TCProperty Actual_finish_Date;
TCProperty Resource_Assignment;
    
for (int i = 0; i < context.length; i++)
{
TCComponent tcc=(TCComponent) context[i].getComponent();

if (tcc instanceof TCComponentSchedule)
{
AIFComponentContext[] children=tcc.getChildren();
AIFComponentContext[]                                                                                                                                             SecChi=children[0].getComponent().getChildren();

XSSFRow row1 = sheet.createRow((short)count);
row1.createCell(0).setCellValue("               ");
count++;
XSSFRow row2 = sheet.createRow((short)count);
                        row2.createCell(1).setCellValue(children[0].toString());
                        row2.getCell(1).setCellStyle(mystyle);
                        count++;
                        XSSFRow row3 = sheet.createRow((short)count);
                         row3.createCell(0).setCellValue("               ");
                        count++;
                for(int j=0;j<SecChi.length;j++)
{
         TCComponent taskcomp=(TCComponent) 
                                                                                                      SecChi[j].getComponent();
Object_Name=taskcomp.getTCProperty("object_name");
Start_Date=taskcomp.getTCProperty("start_date");
Finish_Date=taskcomp.getTCProperty("finish_date");
Actual_Start_Date=taskcomp.getTCProperty("actual_start_date");
Actual_finish_Date=taskcomp.getTCProperty("actual_finish_date Resource_Assignment=taskcomp.getTCProperty("ResourceAssignment");

XSSFRow row = sheet.createRow((short)count);
            row.createCell(0).setCellValue(Object_Name.toString());
            row.createCell(1).setCellValue(Start_Date.toString());
            row.createCell(2).setCellValue(Finish_Date.toString());
            row.createCell(3).setCellValue(Actual_Start_Date.toString());
            row.createCell(4).setCellValue(Actual_finish_Date.toString());
            row.createCell(5).setCellValue(Resource_Assignment.toString());
            count++;
}   
}
}
}
workbook.write(fileOut);
fileOut.flush();
fileOut.close();
}
}

Create Excel Report of Selected Single Schedule Task in Schedule Manager

import java.io.FileOutputStream;
import java.io.IOException;

import org.apache.poi.hssf.util.HSSFColor;
import org.apache.poi.openxml4j.exceptions.InvalidFormatException;
import org.apache.poi.ss.usermodel.BorderStyle;
import org.apache.poi.ss.usermodel.CellStyle;
import org.apache.poi.xssf.usermodel.XSSFCellStyle;
import org.apache.poi.xssf.usermodel.XSSFFont;
import org.apache.poi.xssf.usermodel.XSSFRow;
import org.apache.poi.xssf.usermodel.XSSFSheet;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;

import com.teamcenter.rac.aif.kernel.AIFComponentContext;
import com.teamcenter.rac.aifrcp.AIFUtility;
import com.teamcenter.rac.kernel.TCComponent;
import com.teamcenter.rac.kernel.TCException;
import com.teamcenter.rac.kernel.TCProperty;
import com.teamcenter.rac.kernel.TCSession;

public class SingleReport {

int count=1;
FileOutputStream fileOut ;
TCSession session;

public SingleReport() throws InvalidFormatException, IOException, TCException
{
TCComponent tcc=(TCComponent)                                                                                                                                          AIFUtility.getCurrentApplication().getTargetComponent();
session=tcc.getSession();
session.getUser();

String filename="C:\\Temp\\SingleScheduleExcelReport.xlsx";
XSSFWorkbook workbook = new XSSFWorkbook();
                XSSFSheet sheet = workbook.createSheet("FirstSheet");
     
                sheet.setColumnWidth(0, 6000);
                sheet.setColumnWidth(1, 6000);
                sheet.setColumnWidth(2, 6000);
                sheet.setColumnWidth(3, 6000);
               sheet.setColumnWidth(4, 6000);
               sheet.setColumnWidth(5, 6000);
     
              XSSFCellStyle mystyle=workbook.createCellStyle();
              XSSFFont myfont=workbook.createFont();
              myfont.setBold(true);
              mystyle.setFont(myfont);
              mystyle.setFillForegroundColor(HSSFColor.GOLD.index);
              mystyle.setFillPattern(CellStyle.SOLID_FOREGROUND);
              mystyle.setBorderBottom(BorderStyle.MEDIUM);
     
              XSSFRow rowhead = sheet.createRow((short)0);
              rowhead.createCell(0).setCellValue("TASK NAME");
              rowhead.getCell(0).setCellStyle(mystyle);
     
        rowhead.createCell(1).setCellValue("START DATE");
        rowhead.getCell(1).setCellStyle(mystyle);
        rowhead.createCell(2).setCellValue("FINISHED DATE");
        rowhead.getCell(2).setCellStyle(mystyle);
        rowhead.createCell(3).setCellValue("ACTUAL START DATE");
        rowhead.getCell(3).setCellStyle(mystyle);
        rowhead.createCell(4).setCellValue("ACTUAL FINISH DATE");
        rowhead.getCell(4).setCellStyle(mystyle);
        rowhead.createCell(5).setCellValue("RESOURCE ASSIGNMENT");
        rowhead.getCell(5).setCellStyle(mystyle);
     
        fileOut = new FileOutputStream(filename);

AIFComponentContext[] children=tcc.getChildren();

TCProperty Object_Name;
        TCProperty Start_Date;
TCProperty Finish_Date;
        TCProperty Actual_Start_Date;
        TCProperty Actual_finish_Date;
 TCProperty Resource_Assignment;
 
        XSSFRow row1 = sheet.createRow((short)count);
row1.createCell(0).setCellValue("               ");
count++;
XSSFRow row2 = sheet.createRow((short)count);
        row2.createCell(1).setCellValue(children[0].toString());
        row2.getCell(1).setCellStyle(mystyle);
        count++;
        XSSFRow row3 = sheet.createRow((short)count);
        row3.createCell(0).setCellValue("               ");
        count++;
     
            for(int j=0;j<children.length;j++)
{
TCComponent taskcomp=(TCComponent) children[j].getComponent();
Object_Name=taskcomp.getTCProperty("object_name");
Start_Date=taskcomp.getTCProperty("start_date");
Finish_Date=taskcomp.getTCProperty("finish_date");
Actual_Start_Date=taskcomp.getTCProperty("actual_start_date");
Actual_finish_Date=taskcomp.getTCProperty("actual_finish_date");
Resource_Assignment=taskcomp.getTCProperty("ResourceAssignment");


    XSSFRow row = sheet.createRow((short)count);
            row.createCell(0).setCellValue(Object_Name.toString());
            row.createCell(1).setCellValue(Start_Date.toString());
            row.createCell(2).setCellValue(Finish_Date.toString());
            row.createCell(3).setCellValue(Actual_Start_Date.toString());
            row.createCell(4).setCellValue(Actual_finish_Date.toString());
            row.createCell(5).setCellValue(Resource_Assignment.toString());
            count++;
}
            workbook.write(fileOut);
fileOut.flush();
fileOut.close();
}
}

Execute Query for search all ITEM

import org.eclipse.core.commands.AbstractHandler;
import org.eclipse.core.commands.ExecutionEvent;
import org.eclipse.core.commands.ExecutionException;
import org.eclipse.ui.IWorkbenchWindow;
import org.eclipse.ui.handlers.HandlerUtil;
import org.eclipse.jface.dialogs.MessageDialog;

import com.teamcenter.rac.aif.AbstractAIFApplication;
import com.teamcenter.rac.aif.kernel.AIFComponentContext;
import com.teamcenter.rac.aifrcp.AIFUtility;
import com.teamcenter.rac.kernel.TCComponent;
import com.teamcenter.rac.kernel.TCComponentQuery;
import com.teamcenter.rac.kernel.TCComponentQueryType;
import com.teamcenter.rac.kernel.TCProperty;
import com.teamcenter.rac.kernel.TCSession;

public class SampleHandler extends AbstractHandler {

public SampleHandler() {
}
public Object execute(ExecutionEvent event) throws ExecutionException {

AbstractAIFApplication app=AIFUtility.getCurrentApplication();
TCSession session=(TCSession) app.getSession();

try
{
TCComponentQueryType querytype=(TCComponentQueryType)                                                                                               session.getTypeComponent("ImanQuery");
TCComponentQuery query=(TCComponentQuery) querytype.find("Item...");

String[] EntryName={"Item ID","Type"};
String[] EntryValue={"*","*Item"};


TCComponent[] comp=query.execute(EntryName, EntryValue);

int count=comp.length;

if(count>0)
{
for (int i = 0; i < comp.length; i++) {
System.out.println(comp[i]);
System.out.println("");
}
}
else
{
System.out.println("no item found");
}
} catch (Exception e) {

}

IWorkbenchWindow window = HandlerUtil.getActiveWorkbenchWindowChecked(event);
MessageDialog.openInformation(
window.getShell(),
"ExecuteQuery",
"Item found");
return null;
}
}

Display secondary object of teamcenter

import org.eclipse.core.commands.AbstractHandler;
import org.eclipse.core.commands.ExecutionEvent;
import org.eclipse.core.commands.ExecutionException;

import org.eclipse.ui.handlers.HandlerUtil;

import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.IStructuredSelection;

import com.teamcenter.rac.aif.kernel.AIFComponentContext;
import com.teamcenter.rac.kernel.TCComponent;
import com.teamcenter.rac.kernel.TCComponentItem;
import com.teamcenter.rac.kernel.TCComponentItemRevision;


public class SampleHandler extends AbstractHandler {

TCComponentItemRevision rev;
TCComponentItem item;

public Object execute(ExecutionEvent event) throws ExecutionException {
ISelection selection=HandlerUtil.getCurrentSelection(event);
if(selection instanceof IStructuredSelection)
{
AIFComponentContext context=(AIFComponentContext)
((IStructuredSelection) selection).getFirstElement();
TCComponent comp=(TCComponent) context.getComponent();

if(comp instanceof TCComponentItem)
{
item=(TCComponentItem) context.getComponent();
}
try {
rev=item.getLatestItemRevision();
AIFComponentContext context1[]=rev.getChildren();
for (int i = 0; i < context1.length; i++) {
System.out.println("Name="+context1[i].getComponent().toString());
}
} catch (Exception e) {
e.getStackTrace();
}
}
return null;
}
}

Display Home Folder Contents

import org.eclipse.core.commands.AbstractHandler;
import org.eclipse.core.commands.ExecutionEvent;
import org.eclipse.core.commands.ExecutionException;


import com.teamcenter.rac.aif.AbstractAIFUIApplication;
import com.teamcenter.rac.aif.kernel.AIFComponentContext;
import com.teamcenter.rac.aifrcp.AIFUtility;
import com.teamcenter.rac.kernel.TCComponent;
import com.teamcenter.rac.kernel.TCComponentFolder;
import com.teamcenter.rac.kernel.TCComponentUser;
import com.teamcenter.rac.kernel.TCSession;

public class SampleHandler extends AbstractHandler {

public Object execute(ExecutionEvent event) throws ExecutionException {

AbstractAIFUIApplication app=AIFUtility.getCurrentApplication();
System.out.println("app="+app);

                TCSession session=(TCSession) app.getSession();
System.out.println("session="+session);

                TCComponentUser user=session.getUser();
System.out.println("user="+user);

                 try {
TCComponentFolder tf=user.getHomeFolder();

System.out.println("tf="+tf);
AIFComponentContext[] child=tf.getChildren();
for (int i = 0; i < child.length; i++) {
TCComponent ch=(TCComponent) child[i].getComponent();
System.out.println("child="+ch.toString());
}
} catch (Exception e)
                {
e.getStackTrace();
}

return null;
}
}

Display BOM Properties in Table

import java.awt.BorderLayout;

import javax.swing.JFrame;
import javax.swing.JScrollPane;
import javax.swing.ScrollPaneConstants;

import javax.swing.JTable;

import javax.swing.table.DefaultTableModel;

import org.eclipse.core.commands.AbstractHandler;
import org.eclipse.core.commands.ExecutionEvent;
import org.eclipse.core.commands.ExecutionException;
import com.teamcenter.rac.aif.kernel.AIFComponentContext;
import com.teamcenter.rac.aifrcp.AIFUtility;
import com.teamcenter.rac.kernel.TCComponent;
import com.teamcenter.rac.kernel.TCException;
import com.teamcenter.rac.kernel.TCProperty;
import com.teamcenter.rac.kernel.TCSession;

public class SampleHandler extends AbstractHandler {
DefaultTableModel model=null;
JTable table=null;

public void DisplayProperties() throws TCException
{
JFrame frame=new JFrame();
TCComponent tcc=(TCComponent) AIFUtility.getCurrentApplication().getTargetComponent();
TCSession session = tcc.getSession();
session.getUser();
AIFComponentContext[] children=tcc.getChildren();
frame.setTitle("BOM PROPERTIES");

String[] columnNames={"BOM Line","ItemID","ItemName","RevisionId","ItemRevisionSate","ItemType"};

model=new DefaultTableModel(columnNames, children.length);
table=new JTable(model);
table.setBounds(20, 30, 200, 300);


TCProperty BOMLine;
    TCProperty ItemId;
    TCProperty ItemName;
    TCProperty RevisionId;
    TCProperty ItemRevisionState;
    TCProperty ItemType;
 
    for (int i = 0; i < children.length; i++)
    {
TCComponent tc=(TCComponent) children[i].getComponent();
BOMLine=tc.getTCProperty("bl_indented_title");
ItemId=tc.getTCProperty("bl_item_item_id");
ItemName=tc.getTCProperty("bl_item_object_name");
RevisionId=tc.getTCProperty("bl_rev_fnd0RevisionId");
ItemRevisionState=tc.getTCProperty("bl_rev_release_status_list");
ItemType=tc.getTCProperty("bl_item_object_type");

table.setValueAt(BOMLine, i,0 );

table.setValueAt(ItemId, i,1 );

table.setValueAt(ItemName, i,2 );

table.setValueAt(RevisionId, i,3 );

table.setValueAt(ItemRevisionState, i,4 );

table.setValueAt(ItemType, i,5 );
}

    JScrollPane scrollPane = new JScrollPane(table);
    scrollPane.setHorizontalScrollBarPolicy
                   (ScrollPaneConstants.HORIZONTAL_SCROLLBAR_ALWAYS);

    scrollPane.setVerticalScrollBarPolicy
                  (ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS);

                frame.add(scrollPane, BorderLayout.CENTER);
frame.setSize(600,600);
frame.setVisible(true);
}
}

Display all Released Item

import org.eclipse.core.commands.AbstractHandler;
import org.eclipse.core.commands.ExecutionEvent;
import org.eclipse.core.commands.ExecutionException;

import com.teamcenter.rac.aif.AbstractAIFUIApplication;
import com.teamcenter.rac.aif.kernel.AIFComponentContext;
import com.teamcenter.rac.aifrcp.AIFUtility;
import com.teamcenter.rac.kernel.TCComponent;
import com.teamcenter.rac.kernel.TCComponentFolder;
import com.teamcenter.rac.kernel.TCComponentItem;
import com.teamcenter.rac.kernel.TCComponentItemRevision;
import com.teamcenter.rac.kernel.TCComponentUser;
import com.teamcenter.rac.kernel.TCProperty;
import com.teamcenter.rac.kernel.TCSession;



public class SampleHandler extends AbstractHandler {

public Object execute(ExecutionEvent event) throws ExecutionException {

AbstractAIFUIApplication app=AIFUtility.getCurrentApplication();
TCSession session=(TCSession) app.getSession();
TCComponentUser user=session.getUser();

try
{
TCComponentFolder tf=user.getHomeFolder();
AIFComponentContext[] child=tf.getChildren();

for (int i = 0; i < child.length; i++) {
TCComponent comp=(TCComponent) child[i].getComponent();
if(comp instanceof TCComponentItem )
{
TCComponentItemRevision item=((TCComponentItem) comp).getLatestItemRevision();

TCProperty releaseIR=item.getTCProperty("release_status_list");

String prop_value=releaseIR.toString();

if(prop_value.equals("TCM Released"))
{
AIFComponentContext[] secobj=item.getChildren();
for (int j = 0; j < secobj.length; j++) {

System.out.println("secondary object attached to released Item Revision="+secobj[i].getComponent().toString());
}
}
}
}
}
catch (Exception e)
{

}

return null;
}
}

HTML Report Generation of selected ItemRevision

import java.io.File;
import java.io.FileWriter;
import java.io.IOException;

import org.eclipse.core.commands.AbstractHandler;
import org.eclipse.core.commands.ExecutionEvent;
import org.eclipse.core.commands.ExecutionException;



import com.teamcenter.rac.aif.kernel.AIFComponentContext;
import com.teamcenter.rac.aifrcp.AIFUtility;
import com.teamcenter.rac.kernel.TCComponent;

import com.teamcenter.rac.kernel.TCException;
import com.teamcenter.rac.kernel.TCProperty;

import com.teamcenter.rac.kernel.TCSession;

public class SampleHandler extends AbstractHandler {

File f1;
TCComponent tccomponent=null;
TCSession session=null;
public void createReportHtml() throws TCException, IOException
{
tccomponent=(TCComponent) AIFUtility.getCurrentApplication().getTargetComponent();
session=(TCSession) tccomponent.getSession();
session.getUser();

String s1="<html>" +
"<head><title>Report</title>"+
"<style>thead{color:green;}tbody{color:blue;}" +
"table,th,td{border:1px solid black;}</style>" +
"</head>" +
"<body>" +
"<table ><thead><tr><th>OBJECT NAME</th><th>OBJECT TYPE</th>" +
"<th>RELATION</th><th>OWNER</th><th>GROUP ID<th>DATE                                                    MODIFIED</th></tr>";

                f1=new File("C:\\TEMP\\HTMLReport.html");

FileWriter write=new FileWriter(f1);

AIFComponentContext[] children=tccomponent.getChildren();
TCProperty Object_Name=null;
TCProperty Type=null;
TCProperty Owner=null;
TCProperty GropupID=null;
TCProperty DateModified=null;

write.write(s1);

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

TCComponent taskcomp=(TCComponent) children[i].getComponent();
Object_Name=taskcomp.getTCProperty("object_name");
Type=taskcomp.getTCProperty("object_type");
Owner=taskcomp.getTCProperty("owning_user");
GropupID=taskcomp.getTCProperty("owning_group");
DateModified=taskcomp.getTCProperty("last_mod_date");
try
{
String str="<tbody><tr><th>"+Object_Name+"</th><td>"+Type+"</td><td>"+"Contents"+"</td><td>"+Owner+"</td><td>"+GropupID+"</td><td>"+    DateModified     +"</td></tr></tbody>" ;

                        write.write(str);
}
catch (IOException e1)
{
e1.printStackTrace();
}
}
write.close();
}
}