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();
}
}