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();
}
}
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();
}
}
No comments:
Post a Comment