You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

1792 lines
59 KiB

/*jadclipse*/// Decompiled by Jad v1.5.8g. Copyright 2001 Pavel Kouznetsov.
package com.teamcenter.rac.kernel;
import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import javax.xml.parsers.ParserConfigurationException;
import org.apache.log4j.Logger;
import org.eclipse.core.runtime.Assert;
import org.eclipse.core.runtime.Platform;
import org.xml.sax.SAXException;
import com.teamcenter.rac.aif.AIFShell;
import com.teamcenter.rac.aif.kernel.AIFComponentContext;
import com.teamcenter.rac.aif.kernel.InterfaceAIFComponentOpen;
import com.teamcenter.rac.services.IDocumentManagementService;
import com.teamcenter.rac.util.FileUtility;
import com.teamcenter.rac.util.Instancer;
import com.teamcenter.rac.util.OSGIUtil;
import com.teamcenter.rac.util.Registry;
import com.teamcenter.rac.util.log.Debug;
// Referenced classes of package com.teamcenter.rac.kernel:
// TCComponent, TCException, TCSession, AEShellManager,
// TCComponentDatasetType, TCRDVService, TCComponentEncapsulation, KernelPlugin,
// TCReservationService, TCComponentUser, TCComponentSite, TCProperty,
// TCComponentType, TCPreferenceService, TCComponentDatasetDefinition, TCComponentTool,
// ToolOperationInfo, NamedReferenceContext, TCComponentDatasetContext, AEShell,
// TypeInfo, InterfaceDatasetAction, PreActionShell, AliasOpenAction,
// AbstractDatasetOpenPreAction, TCComponentGroup, TCComponentContextList, TCComponentTcFile,
// TCComponentDatasetDefinitionType, TCComponentMSExcelX
public class TCComponentDataset extends TCComponent implements
InterfaceAIFComponentOpen, Comparable {
public TCComponentDataset() {
inIcContext = false;
paramArrayList = new ArrayList();
isOfficeType = false;
}
public int compareTo(TCComponentDataset tccomponentdataset) {
return toString().compareTo(tccomponentdataset.toString());
}
public String getWorkingDir() throws TCException {
Date date = new Date();
long l = date.getTime();
String s = FileUtility.getExportDir();
TCSession tcsession = getSession();
String s1 = tcsession.getUserName();
AEShellManager aeshellmanager = tcsession.getAEShellManager();
int i = aeshellmanager.size();
String s2 = (new StringBuilder("tc_")).append(s1).append("_").append(i)
.append("_").append(l).toString();
String s3 = (new StringBuilder(String.valueOf(s)))
.append(File.separator).append(s2).toString();
Assert.isTrue(
FileUtility.isValidPathString(s3),
(new StringBuilder(String.valueOf(Registry.getRegistry(
TCComponentDataset.class).getString(
FileUtility.getInvalidPathMessage())))).append(" - ")
.append(s3).toString());
File file = new File(s3);
if (!file.exists() && !file.mkdir()) {
Registry registry = getSession().getRegistry();
throw TCComponent.handleException((new StringBuilder(String
.valueOf(registry.getString("createDirFailed"))))
.append(' ').append(s3).append("\n\n")
.append(registry.getString("checkTCExportDir")).toString());
} else {
setCurrentWorkingDir(s3);
return s3;
}
}
public void removeWorkingDir(String s) throws TCException {
Assert.isTrue(
FileUtility.isValidPathString(s),
(new StringBuilder(String.valueOf(Registry.getRegistry(
FileUtility.class).getString(
FileUtility.getInvalidPathMessage())))).append(" - ")
.append(s).toString());
File file = new File(s);
String as[] = file.list();
if (as != null) {
int i = as.length;
for (int j = 0; j < i; j++) {
File file1 = new File(file, as[j]);
try {
file1.delete();
} catch (SecurityException securityexception) {
throw TCComponent.handleException(securityexception);
}
}
}
if (!file.delete())
logger.debug((new StringBuilder("Unable to delete directory: "))
.append(file.getAbsolutePath()).toString());
}
public TCComponent[] getNamedRefComponents(String s) throws TCException {
return ((TCComponentDatasetType) getTypeComponent())
.getNamedRefComponents(this, s);
}
public TCComponent getNamedRefComponent(String s) throws TCException {
TCComponent atccomponent[] = ((TCComponentDatasetType) getTypeComponent())
.getNamedRefComponents(this, s);
return atccomponent != null && atccomponent.length >= 1 ? atccomponent[0]
: null;
}
public int getHighestRevision() throws TCException {
return ((TCComponentDatasetType) getTypeComponent())
.getHighestRevision(this);
}
public File[] getFiles(String s) throws TCException {
return ((TCComponentDatasetType) getTypeComponent()).getFiles(this, s);
}
public File[] getFiles(String s, String s1) throws TCException {
return ((TCComponentDatasetType) getTypeComponent()).getFiles(this, s,
s1);
}
public File getFile(String s, String s1, String s2) throws TCException {
return ((TCComponentDatasetType) getTypeComponent()).getFile(this, s,
s1, s2);
}
public File getFile(String s, String s1) throws TCException {
return ((TCComponentDatasetType) getTypeComponent()).getFile(this, s,
s1);
}
public void replaceFiles(File afile[], String as[], String as1[],
String as2[]) throws TCException {
((TCComponentDatasetType) getTypeComponent()).replaceFiles(this, afile,
as, as1, as2);
}
public TCComponentDataset revise() throws TCException {
return ((TCComponentDatasetType) getTypeComponent()).revise(this);
}
public TCComponentDataset latest() throws TCException {
return ((TCComponentDatasetType) getTypeComponent()).latest(this);
}
public void setFiles(String as[], String as1[], String as2[], String as3[])
throws TCException {
((TCComponentDatasetType) getTypeComponent()).setFiles(this, as, as1,
as2, as3);
}
public void setFiles(String as[], String as1[], String as2[], String as3[],
int i) throws TCException {
((TCComponentDatasetType) getTypeComponent()).setFiles(this, as, as1,
as2, as3, i);
}
public TCComponentDataset setFiles(String s, String s1, String s2,
String as[], String as1[]) throws TCException {
return ((TCComponentDatasetType) getTypeComponent()).setFiles(s, s1,
s2, as, as1);
}
public void setFiles(String as[], String as1[]) throws TCException {
((TCComponentDatasetType) getTypeComponent()).setFiles(this, as, as1);
}
public void addNamedReference(TCComponent tccomponent, String s)
throws TCException {
((TCComponentDatasetType) getTypeComponent()).addNamedReference(this,
tccomponent, s);
}
public void removeNamedReference(String s) throws TCException {
((TCComponentDatasetType) getTypeComponent()).removeNamedReference(
this, s);
fireComponentChangeEvent();
}
public void removeFiles(String as[], String as1[]) throws TCException {
((TCComponentDatasetType) getTypeComponent())
.removeFiles(this, as, as1);
fireComponentChangeEvent();
}
public void removeFiles(String s) throws TCException {
((TCComponentDatasetType) getTypeComponent()).removeFiles(this, s);
fireComponentChangeEvent();
}
public TCComponentDataset[] getAllVersions() throws TCException {
return ((TCComponentDatasetType) getTypeComponent())
.getAllVersions(this);
}
public TCComponentDataset getVersion0() throws TCException {
return ((TCComponentDatasetType) getTypeComponent()).getVersion0(this);
}
public String[] getPrimaryFileNames(TCComponent tccomponent, int i)
throws TCException {
return ((TCComponentDatasetType) getTypeComponent())
.getPrimaryFileNames(this, tccomponent, i);
}
public String[] getAIEPrimaryFileNames(TCComponent tccomponent, int i)
throws TCException {
return ((TCComponentDatasetType) getTypeComponent())
.getPrimaryFileNames(this, tccomponent, i);
}
public String[] getFileNames(String s) throws TCException {
return ((TCComponentDatasetType) getTypeComponent()).getFileNames(this,
s);
}
public void print() throws TCException, IOException {
String s = getWorkingDir();
reqDir = s;
boolean flag = false;
Assert.isTrue(
FileUtility.isValidPathString(s),
(new StringBuilder(String.valueOf(Registry.getRegistry(
FileUtility.class).getString(
FileUtility.getInvalidPathMessage())))).append(" - ")
.append(s).toString());
File file = new File(s);
if (file.isDirectory()) {
prepareToolForLaunching(null, s, flag, null, 2, 0, false);
} else {
TCSession tcsession = getSession();
String s1 = tcsession.getRegistry().getString("createDirFailed");
throw TCComponent.handleException((new StringBuilder(String
.valueOf(s1))).append(' ').append(s).toString());
}
}
public void copyGrdvTransformFiles(String s) {
TCSession tcsession = getSession();
try {
String as[] = tcsession.getServerConfigInfo();
String s1 = as[2];
String s2 = (new StringBuilder(String.valueOf(s1))).append("//")
.append("grdv_transform_files").toString();
String s3 = (new StringBuilder(String.valueOf(s2))).append("//")
.append("js").toString();
String s4 = (new StringBuilder(String.valueOf(s2))).append("//")
.append("css").toString();
String s5 = (new StringBuilder(String.valueOf(s2))).append("//")
.append("images").toString();
String s6 = "BINARY";
boolean flag = false;
TCRDVService tcrdvservice = tcsession.getRDVService();
Assert.isTrue(
FileUtility.isValidPathString(s),
(new StringBuilder(String.valueOf(Registry.getRegistry(
FileUtility.class).getString(
FileUtility.getInvalidPathMessage()))))
.append(" - ").append(s).toString());
File file = new File((new StringBuilder(String.valueOf(s)))
.append("//").append("js").toString());
if (file.mkdir()) {
tcrdvservice.getFile(s3, "common.js", file.getAbsolutePath(),
"common.js", s6, flag);
tcrdvservice.getFile(s3, "dialog.js", file.getAbsolutePath(),
"dialog.js", s6, flag);
tcrdvservice.getFile(s3, "excel.js", file.getAbsolutePath(),
"excel.js", s6, flag);
tcrdvservice.getFile(s3, "filter.js", file.getAbsolutePath(),
"filter.js", s6, flag);
tcrdvservice.getFile(s3, "select.js", file.getAbsolutePath(),
"select.js", s6, flag);
tcrdvservice.getFile(s3, "select_row.js",
file.getAbsolutePath(), "select_row.js", s6, flag);
tcrdvservice.getFile(s3, "sortabletable.js",
file.getAbsolutePath(), "sortabletable.js", s6, flag);
}
File file1 = new File((new StringBuilder(String.valueOf(s)))
.append("//").append("css").toString());
if (file1.mkdir()) {
tcrdvservice.getFile(s4, "dialog.css", file1.getAbsolutePath(),
"dialog.css", s6, flag);
tcrdvservice.getFile(s4, "excel.css", file1.getAbsolutePath(),
"excel.css", s6, flag);
}
File file2 = new File((new StringBuilder(String.valueOf(s)))
.append("//").append("images").toString());
if (file2.mkdir()) {
tcrdvservice.getFile(s5, "downsimple.png",
file2.getAbsolutePath(), "downsimple.png", s6, flag);
tcrdvservice.getFile(s5, "upsimple.png",
file2.getAbsolutePath(), "upsimple.png", s6, flag);
}
} catch (Exception exception) {
logger.error(exception.getLocalizedMessage(), exception);
}
}
public void print(TCComponent tccomponent, String s, String s1, String s2)
throws TCException, IOException {
boolean flag = true;
if (s == null) {
s = getWorkingDir();
flag = false;
}
File file = new File(s);
if (file.isDirectory()) {
File file1 = getFile(s1, s2, s);
prepareToolForLaunching(tccomponent, s, flag, file1.getPath(), 2,
0, false);
} else {
TCSession tcsession = getSession();
String s3 = tcsession.getRegistry().getString("createDirFailed");
throw TCComponent.handleException((new StringBuilder(String
.valueOf(s3))).append(' ').append(s).toString());
}
}
public void openForView() throws TCException, IOException {
boolean flag = false;
try {
open(flag);
} catch (TCException tcexception) {
throw tcexception;
}
}
public void openForEdit() throws TCException, IOException {
boolean flag = true;
try {
System.out.println("aaaa aaaaaa");
open(flag);
System.out.println("bbbb bbbbbb");
} catch (TCException tcexception) {
throw tcexception;
}
}
public void open() throws TCException, IOException {
boolean flag = true;
try {
open(flag);
} catch (TCException tcexception) {
throw tcexception;
}
}
public void open(boolean flag) throws TCException, IOException {
if (logger.isDebugEnabled())
logger.debug((new StringBuilder("==> "))
.append(getClass().getName()).append(".open() [")
.append(toString()).append("], type [").append(getType())
.append("], url [").append(url).append("]").toString());
boolean flag1 = false;
boolean flag2 = false;
boolean flag3 = false;
if (flag)
flag3 = isEditable();
if (!flag2 && !flag3)
flag1 = openWithAppLauncher(this, false);
else
flag1 = openWithAppLauncher(this, flag);
if (flag1)
return;
flag1 = TCComponentEncapsulation.openAdvancedEncapsulation(this);
if (!flag1 && url != null) {
if (logger.isDebugEnabled())
logger.debug(" startTcOffice...");
flag1 = startTcOffice();
}
System.out.println("cccc cccc");
if (!flag1)
open(flag3, flag);
System.out.println("ddddd dddd");
}
public boolean isEditable() throws TCException {
boolean flag = false;
boolean flag1 = false;
TCReservationService tcreservationservice = (TCReservationService) OSGIUtil
.getService(KernelPlugin.getDefault(),
TCReservationService.class);
flag = tcreservationservice.isAutoCheckoutEnabled();
if (logger.isDebugEnabled())
logger.debug((new StringBuilder("TC_Auto_Checkout [")).append(flag)
.append("]").toString());
if (flag || tcreservationservice.isReserved(this))
flag1 = okToModify();
return flag1;
}
private boolean openWithAppLauncher(TCComponentDataset tccomponentdataset,
boolean flag) {
if (logger.isDebugEnabled())
logger.debug((new StringBuilder("try to open dataset ["))
.append(tccomponentdataset.toString())
.append("] with app launcher").toString());
boolean flag1 = false;
if (!isOfficeType)
return flag1;
boolean flag3 = checkUseAppLauncherConfig();
if (!flag3) {
return flag1;
} else {
IDocumentManagementService idocumentmanagementservice = (IDocumentManagementService) OSGIUtil
.getService(KernelPlugin.getDefault(),
IDocumentManagementService.class);
boolean flag2 = idocumentmanagementservice.openWithAppLauncher(
tccomponentdataset, flag);
return flag2;
}
}
private boolean checkUseAppLauncherConfig() {
TCSession tcsession = getSession();
boolean flag = tcsession.getRegistry().getBoolean("useAppLauncher",
false);
return flag;
}
public void setOfficeType(boolean flag) {
isOfficeType = flag;
}
public void open(boolean flag, boolean flag1) throws TCException,
IOException {
if (logger.isDebugEnabled())
logger.debug((new StringBuilder(String
.valueOf(getClass().getName())))
.append(".open(reserveFlag [").append(flag).append("]) [")
.append(toString()).append("], type [").append(getType())
.append("]").toString());
int i = 0;
try {
if (flag)
i = reserveDataset();
String s = getWorkingDir();
reqDir = s;
boolean flag2 = false;
if (logger.isDebugEnabled())
logger.debug((new StringBuilder(" checkedOutState "))
.append(i).append(", workdir [").append(s).append("]")
.toString());
File file = new File(s);
if (file.isDirectory()) {
prepareToolForLaunching(null, s, flag2, null, 3, i, flag1);
} else {
TCSession tcsession1 = getSession();
if (flag) {
TCReservationService tcreservationservice1 = tcsession1
.getReservationService();
tcreservationservice1.cancelReservation(this);
}
String s1 = tcsession1.getRegistry().getString(
"createDirFailed");
throw TCComponent.handleException((new StringBuilder(String
.valueOf(s1))).append(' ').append(s).toString());
}
} catch (TCException tcexception) {
if (flag && i == 1) {
TCSession tcsession = getSession();
TCReservationService tcreservationservice = tcsession
.getReservationService();
tcreservationservice.cancelReservation(this);
}
throw tcexception;
}
}
public void setUrlCookie(String s, String s1) {
url = s;
cookie = s1;
}
private boolean startTcOffice() {
if (url == null)
return false;
byte byte0 = ((byte) (cookie != null ? 2 : 1));
String as[] = new String[byte0];
as[0] = (new StringBuilder("-url=")).append(url).toString();
if (cookie != null)
as[1] = (new StringBuilder("-cookie=")).append(cookie).toString();
AIFShell aifshell = new AIFShell("");
aifshell.setCommand(as);
aifshell.setAction("O");
aifshell.start();
return true;
}
protected int reserveDataset() throws TCException {
if (logger.isDebugEnabled())
logger.debug((new StringBuilder(String
.valueOf(getClass().getName())))
.append(".reserveDataset(): name [").append(toString())
.append("], type [").append(getType()).append("]")
.toString());
byte byte0 = 0;
TCSession tcsession = getSession();
TCReservationService tcreservationservice = tcsession
.getReservationService();
try {
if (!tcreservationservice.isReserved(this)) {
tcreservationservice.reserve(this, "", "", (short) 5);
byte0 = 1;
} else {
TCComponent tccomponent = tcreservationservice
.getReservation(this);
boolean flag = false;
boolean flag1 = false;
TCComponentUser tccomponentuser = (TCComponentUser) tccomponent
.getRelatedComponent("user_object");
if (tccomponentuser == null)
flag1 = true;
TCComponentSite tccomponentsite = (TCComponentSite) tccomponent
.getRelatedComponent("remote_site");
if (tccomponentsite == null)
flag = true;
boolean flag2 = false;
flag2 = tccomponent.getLogicalProperty("site_reserved");
if (flag1) {
if (flag2 && flag) {
tcreservationservice.reserve(this, "", "", (short) 5);
byte0 = 1;
}
} else {
String s = tccomponentuser.getUserId();
String s1 = tcsession.getUser().getUserId();
if (!s1.equals(s)) {
String s2 = tcsession.getRegistry().getString(
"failedToOpen");
throw TCComponent.handleException(new TCException(
(new StringBuilder(String.valueOf(s2)))
.append(' ').append(s).toString()));
}
tccomponent.clearCache("reservation_type");
TCProperty tcproperty = tccomponent
.getTCProperty("reservation_type");
int i = tcproperty.getIntValue();
if (i == 5)
byte0 = 1;
else if (i == 6) {
tcreservationservice.reserve(this, "", "", (short) 5);
byte0 = 1;
} else {
byte0 = 2;
}
}
}
} catch (TCException tcexception) {
throw tcexception;
}
return byte0;
}
void prepareToolForLaunching(TCComponent tccomponent, String s,
boolean flag, String s1, int i, int j, boolean flag1)
throws IOException, TCException {
if (logger.isDebugEnabled())
logger.debug((new StringBuilder(String
.valueOf(getClass().getName())))
.append(".prepareToolForLaunching(): name [")
.append(toString()).append("], type [").append(getType())
.append("]\n").append(" selectedTool [")
.append(tccomponent).append("], workdir [").append(s)
.append("], userDefinedDir [").append(flag)
.append("], primaryFileName [").append(s1)
.append("], action [").append(getAction(i))
.append("], reservedState [").append(j).append("]")
.toString());
boolean flag2 = true;
String s2 = null;
String s3 = null;
String s4 = null;
TCComponentDatasetDefinition tccomponentdatasetdefinition = getDatasetDefinitionComponent();
TCComponentDatasetType tccomponentdatasettype = (TCComponentDatasetType) getTypeComponent();
TCSession tcsession = getSession();
TCPreferenceService tcpreferenceservice = tcsession
.getPreferenceService();
String s5 = getTypeComponent().getTypeName();
if (tccomponent == null)
tccomponent = getSelectedTool(tccomponentdatasettype, tcsession,
s5, flag1 ? "_Tool" : "_Default_View_Tool");
if (tccomponent == null) {
if (logger.isDebugEnabled())
logger.debug((new StringBuilder(
"prepareToolForLaunching(): Could not find a valid tool of dataset ["))
.append(this).append("], give up").toString());
return;
}
String s6 = (new StringBuilder("TC_")).append(s5).append("_")
.append(tccomponent.toString()).append("_searchBy").toString();
String s7 = tcpreferenceservice.getStringValue(s6);
System.out.println(">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> 0000 =" + s6
+ " | " + s7);
NamedReferenceContext anamedreferencecontext[] = tccomponentdatasetdefinition
.getNamedReferenceContexts();
if (logger.isDebugEnabled())
logger.debug((new StringBuilder(
"prepareToolForLaunching(): searchKey ["))
.append(s6)
.append("] value [")
.append(s7)
.append("], ")
.append(anamedreferencecontext != null ? anamedreferencecontext.length
: 0).append(" namedReferences").toString());
if (anamedreferencecontext == null || anamedreferencecontext.length < 1) {
if (logger.isDebugEnabled())
logger.debug((new StringBuilder(
"prepareToolForLaunching(): Could not find namedReferences of dataset ["))
.append(this).append("], give up").toString());
return;
}
NamedReferenceContext namedreferencecontext = null;
try {
if (s1 == null) {
namedreferencecontext = ((TCComponentDatasetType) getTypeComponent())
.getPrimaryNamedRefInfo(this, tccomponent, i);
if (logger.isDebugEnabled())
logger.debug((new StringBuilder(
"prepareToolForLaunching(): NamedReferenceContext ["))
.append(namedreferencecontext).append("]")
.toString());
} else {
ToolOperationInfo atooloperationinfo[] = getDatasetDefinitionComponent()
.getToolOperationRefs((TCComponentTool) tccomponent, i);
if (logger.isDebugEnabled())
logger.debug((new StringBuilder(
"prepareToolForLaunching(): "))
.append(atooloperationinfo != null ? atooloperationinfo.length
: 0).append(" ToolOperationInfo")
.toString());
if (atooloperationinfo == null
|| atooloperationinfo.length == 0) {
logger.debug("Found no ToolOperationInfo, throw exception");
Registry registry = Registry.getRegistry(this);
throw TCComponent.handleException(registry
.getString("noNamedReference"));
}
if (dsNamedRefs == null)
dsNamedRefs = getDatasetDefinitionComponent()
.getNamedReferenceContexts();
String s8 = null;
int k = -1;
int l = s1.lastIndexOf(".");
if (l > -1)
s8 = s1.substring(l);
for (int i1 = 0; i1 < atooloperationinfo.length && k == -1; i1++)
if (atooloperationinfo[i1].getExportVerdict() != 0) {
String s10 = atooloperationinfo[i1].getReference();
for (int k1 = 0; dsNamedRefs != null
&& k1 < dsNamedRefs.length; k1++) {
if (!dsNamedRefs[k1].getNamedReference()
.equals(s10))
continue;
String s12 = dsNamedRefs[k1].getFileTemplate();
if (s8 != null) {
if (s12.endsWith(s8))
k = k1;
} else if (s12.equals("*") || s12.equals(".*")
|| s12.equals("*.*"))
k = k1;
break;
}
}
if (k > -1) {
String s9 = tccomponent.getProperty("site_classification");
namedreferencecontext = new NamedReferenceContext(
dsNamedRefs[k].getNamedReference(),
dsNamedRefs[k].getFileFormat(), s8, s1, s9);
if (logger.isDebugEnabled())
logger.debug((new StringBuilder(
"could not match reference, use mimetype ["))
.append(s9).append("] of selectedtool [")
.append(tccomponent)
.append("], NamedReferenceContext [")
.append(namedreferencecontext).append("]")
.toString());
}
}
} catch (TCException tcexception) {
logger.debug(tcexception.getLocalizedMessage(), tcexception);
throw tcexception;
}
ToolOperationInfo atooloperationinfo1[] = null;
atooloperationinfo1 = tccomponentdatasetdefinition
.getToolOperationRefs((TCComponentTool) tccomponent, i);
if (logger.isDebugEnabled())
logger.debug((new StringBuilder("Got "))
.append(atooloperationinfo1 != null ? atooloperationinfo1.length
: 0).append(" ToolOperationInfo for selectedTool[")
.append(tccomponent).append("]").toString());
if (atooloperationinfo1 == null || atooloperationinfo1.length < 1) {
if (logger.isDebugEnabled())
logger.debug((new StringBuilder(
"prepareToolForLaunching(): Could not find ToolOperationInfo of dataset ["))
.append(this).append("], give up").toString());
return;
}
boolean flag3 = true;
if (j == 0)
flag3 = false;
TCComponentDatasetContext tccomponentdatasetcontext = tccomponentdatasettype
.getFiles(this, tccomponent, i, s, flag3);
if (logger.isDebugEnabled())
logger.debug((new StringBuilder("TCComponentDatasetContext ["))
.append(tccomponentdatasetcontext).append("]").toString());
boolean flag4 = false;
File afile[] = tccomponentdatasetcontext.getFiles();
if ((i == 2 || i == 9) && afile.length == 0) {
removeWorkingDir(s);
return;
}
if (namedreferencecontext == null) {
namedreferencecontext = tccomponentdatasettype
.getPrimaryNamedRefInfo(this, tccomponent, i);
if (logger.isDebugEnabled())
logger.debug((new StringBuilder("DatasetType ["))
.append(tccomponentdatasettype)
.append("] getPrimaryNamedRefInfo() for tool [")
.append(tccomponent).append("] action ")
.append(getAction(i)).append(" returns [")
.append(namedreferencecontext).append("]").toString());
if (namedreferencecontext == null
|| namedreferencecontext.getNamedReference() == null) {
namedreferencecontext = anamedreferencecontext[0];
if (logger.isDebugEnabled())
logger.debug((new StringBuilder(
" default to use the first namedref ["))
.append(namedreferencecontext).append("]")
.toString());
}
}
s3 = namedreferencecontext.getFileName();
s2 = namedreferencecontext.getNamedReference();
s4 = namedreferencecontext.getMimeType();
if (s4 == null) {
s4 = tccomponentdatasetdefinition.getToolMimeType(tccomponent);
if (logger.isDebugEnabled())
logger.debug((new StringBuilder("get tool_mimetype ["))
.append(s4).append("] from datasettype [")
.append(tccomponentdatasetdefinition)
.append("] for selectedtool [").append(tccomponent)
.append("]").toString());
}
File file = null;
if (afile != null && afile.length > 0) {
if (s1 != null) {
File afile1[];
int i2 = (afile1 = afile).length;
for (int l1 = 0; l1 < i2; l1++) {
File file1 = afile1[l1];
String s13 = file1.getName();
if (!s13.equalsIgnoreCase(s1))
continue;
file = file1;
break;
}
}
if (file == null)
file = afile[0];
flag2 = true;
if (logger.isDebugEnabled())
logger.debug((new StringBuilder("Got fileToLaunch ["))
.append(file).append("] from ").append(afile.length)
.append(" exportedFiles").toString());
} else {
int j1;
for (j1 = 0; j1 < atooloperationinfo1.length; j1++) {
if (tccomponent != atooloperationinfo1[j1].getTool()
|| !namedreferencecontext.getNamedReference()
.equalsIgnoreCase(
atooloperationinfo1[j1].getReference()))
continue;
flag2 = atooloperationinfo1[j1].getExportVerdict() > 0;
break;
}
if (j1 >= atooloperationinfo1.length)
return;
if (flag2) {
if (s3 == null)
s3 = getProperty("object_name");
file = new File(s, s3);
if (!file.createNewFile())
logger.debug((new StringBuilder("Unable to create file: "))
.append(file.getAbsolutePath()).toString());
flag4 = true;
if (logger.isDebugEnabled())
logger.debug((new StringBuilder("create fileToLaunch ["))
.append(file)
.append("] since no existing files to export")
.toString());
}
}
if (file != null)
file.setWritable(flag1);
String s11;
if (flag2) {
s11 = file.getPath();
} else {
if (s == null && s3 == null)
s11 = null;
else if (s == null)
s11 = s3;
else if (s3 == null)
s11 = s;
else
s11 = (new StringBuilder(String.valueOf(s)))
.append(File.separator).append(s3).toString();
afile = null;
}
AEShell aeshell = new AEShell(tccomponentdatasetcontext, s, flag, i);
aeshell.setExportedFiles(afile);
TCComponentDataset atccomponentdataset[] = tccomponentdatasettype
.getAllVersions(this);
aeshell.setSelectedDataset(this);
aeshell.setRev0DS(atccomponentdataset[0]);
aeshell.setSelectedFileName(s11);
aeshell.setSelectedMimeType(s4);
aeshell.setSelectedNamedRef(s2);
aeshell.setReserveOption(j);
aeshell.setSelectedTool(tccomponent);
aeshell.setReadOnly(!flag3);
if (s7 != null && !s7.isEmpty())
aeshell.setSearchBy(s7);
AEShellManager aeshellmanager = tcsession.getAEShellManager();
if (flag1) {
List list = getEditableOpenFilesOfDSInSession();
File afile2[] = aeshell.askExportedFiles();
if (flag4) {
afile2 = new File[1];
afile2[0] = file;
}
if (afile2 != null) {
File afile3[];
int k2 = (afile3 = afile2).length;
for (int j2 = 0; j2 < k2; j2++) {
File file2 = afile3[j2];
String s15 = file2.getName();
Assert.isTrue(
FileUtility.isValidPathString(s15),
(new StringBuilder(
String.valueOf(Registry
.getRegistry(FileUtility.class)
.getString(
FileUtility
.getInvalidPathMessage()))))
.append(" - ").append(s15).toString());
if (!list.contains(s15))
continue;
file2.setWritable(false);
aeshell.setReadOnly(true);
flag1 = false;
break;
}
}
}
aeshellmanager.addShell(aeshell);
if (flag4)
aeshell.setNewFileCreatedTime(file);
if (logger.isDebugEnabled())
logger.debug("prepareToolForLaunching(): calling launchingTool()");
String s14 = "Edit";
if (!flag1)
s14 = "View";
launchingTool(aeshell, i, s14);
System.out.println(">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> 6666666");
if (Platform.getOS().equals("win32")
&& tccomponentdatasettype.toString().equals("XMLAuditLog"))
copyGrdvTransformFiles(s);
System.out.println(">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> 7777777");
}
private List getEditableOpenFilesOfDSInSession() throws TCException {
TCSession tcsession = getSession();
AEShellManager aeshellmanager = tcsession.getAEShellManager();
AEShell aaeshell[] = aeshellmanager.getShells();
ArrayList arraylist = new ArrayList();
AEShell aaeshell1[];
int j = (aaeshell1 = aaeshell).length;
for (int i = 0; i < j; i++) {
AEShell aeshell = aaeshell1[i];
File afile[] = aeshell.askExportedFiles();
TCComponentDataset tccomponentdataset = aeshell
.askSelectedDataset();
if (tccomponentdataset == this)
if (afile != null) {
File afile1[];
int l = (afile1 = afile).length;
for (int k = 0; k < l; k++) {
File file = afile1[k];
boolean flag = file.canWrite();
if (flag)
arraylist.add(file.getName());
}
} else {
String s = aeshell.askSelectedFileName();
File file1 = new File(s);
boolean flag1 = file1.canWrite();
if (flag1)
arraylist.add(file1.getName());
}
}
return arraylist;
}
private TCComponent getSelectedTool(
TCComponentDatasetType tccomponentdatasettype, TCSession tcsession,
String s, String s1) throws TCException {
TCComponent tccomponent = null;
try {
String s2 = (new StringBuilder("TC_")).append(s).append(s1)
.toString();
String s3 = tcsession.getPreferenceService().getStringValue(s2);
if (logger.isDebugEnabled())
logger.debug((new StringBuilder("use preference [")).append(s2)
.append("] to find default tool [").append(s3)
.append("]").toString());
if (s3 != null && !s3.isEmpty()) {
TCComponentType tccomponenttype = tcsession
.getTypeComponent("Tool");
com.teamcenter.rac.kernel.TypeInfo typeinfo = tccomponenttype
.getTcTypes("Tool", false);
if (typeinfo != null) {
TCComponent tccomponent1 = typeinfo
.getTypeComponentFromName(s3);
if (tccomponent1 != null)
tccomponent = tccomponent1;
}
}
if (tccomponent == null)
try {
tccomponent = tccomponentdatasettype.getDefaultTool(this);
if (logger.isDebugEnabled())
logger.debug((new StringBuilder("use default tool ["))
.append(tccomponent).append("]").toString());
} catch (TCException tcexception1) {
logger.info(tcexception1.getLocalizedMessage(),
tcexception1);
throw tcexception1;
} catch (Exception exception1) {
logger.error(exception1.getLocalizedMessage(), exception1);
}
} catch (TCException tcexception) {
logger.info(tcexception.getLocalizedMessage(), tcexception);
throw tcexception;
} catch (Exception exception) {
throw TCComponent.handleException(exception);
}
return tccomponent;
}
void launchingTool(AEShell aeshell, int i, String s) throws TCException {
String s1 = getType();
Registry registry = Registry.getRegistry(this);
if (logger.isDebugEnabled())
logger.debug((new StringBuilder("launchingTool(): AEShell ["))
.append(aeshell).append("], action ").append(getAction(i))
.append(" for dataset [").append(toString()).append("]")
.toString());
String s2 = null;
String s4 = null;
String s5 = aeshell.askSelectedTool().toString();
String s6 = ((TCComponentDatasetType) getTypeComponent())
.getDefaultTool(this).toString();
if (s5.equals(s6))
s4 = getApplRegKey(s1);
if (s4 != null)
s2 = (new StringBuilder(String.valueOf(s4))).append(
".ACTION_OBJECT").toString();
else
s2 = (new StringBuilder(String.valueOf(s1))).append(
".ACTION_OBJECT").toString();
String as[] = registry.getStringArray(s2, null, null);
if (as == null) {
String s3 = (new StringBuilder(String.valueOf(getType()))).append(
".ACTION_OBJECT").toString();
as = registry.getStringArray(s3, null, null);
}
if (as != null) {
int j = as.length;
Object obj = null;
for (int k = 0; k < j; k++) {
InterfaceDatasetAction interfacedatasetaction = (InterfaceDatasetAction) Instancer
.newInstance(as[k]);
if (interfacedatasetaction != null) {
int l = interfacedatasetaction.preProcess(this, aeshell, i);
if (l < 0) {
interfacedatasetaction = null;
TCSession tcsession = getSession();
AEShellManager aeshellmanager = tcsession
.getAEShellManager();
aeshellmanager.removeShell(aeshell);
return;
}
if (l == 0)
k = j;
}
interfacedatasetaction = null;
}
}
TCComponent tccomponent = aeshell.askSelectedTool();
TCComponent tccomponent1 = getDatasetDefinitionComponent()
.getPreAction(tccomponent, i);
String s7 = null;
if (tccomponent1 != null)
s7 = getDatasetDefinitionComponent().getToolMimeType(tccomponent1);
if (tccomponent1 != null && s7 != null && !s7.isEmpty()) {
String s8 = aeshell.askSelectedFileName();
String s9 = aeshell.askSelectedNamedRef();
String as1[] = getDatasetDefinitionComponent()
.getPreActionParameters(tccomponent, i);
String as2[] = buildInputParams(s8, as1, s9, i);
AIFShell aifshell = new AIFShell("");
if (as2 != null && as2.length > 0)
aifshell.setCommand(as2);
aifshell.setMimeType(s7);
String s10 = tccomponent1.getStringProperty("symbol_name");
int i1 = s10.lastIndexOf('\\');
String s11 = "";
if (i1 > 0)
s11 = s10.substring(i1 + 1);
else
s11 = s10;
aifshell.setApplicationName(s11);
aifshell.addJobChangeListener(new PreActionShell(aeshell, i));
if (i == 3 || i == 4) {
aifshell.setAction("O");
aifshell.setToolName(tccomponent1
.getStringProperty("object_name"));
aifshell.setViewOrEdit(s);
} else if (i == 2 || i == 9)
aifshell.setAction("P");
String s12 = (new StringBuilder("TC_"))
.append(getTypeComponent().getTypeName()).append("_")
.append(tccomponent1.toString()).append("_searchBy")
.toString();
TCPreferenceService tcpreferenceservice = getSession()
.getPreferenceService();
String s13 = tcpreferenceservice.getStringValue(s12);
if (logger.isDebugEnabled() || Debug.isOn("tool"))
logger.info((new StringBuilder("Preference [")).append(s12)
.append("] value [").append(s13).append("]").toString());
if (s13 != null && !s13.isEmpty())
aifshell.setSearchBy(s13);
aifshell.start();
} else {
toolStartUp(aeshell, i, s);
}
}
void toolStartUp(AEShell aeshell, int i) throws TCException {
toolStartUp(aeshell, i, "Open");
}
void toolStartUp(AEShell aeshell, int i, String s) throws TCException {
TCComponent tccomponent = aeshell.askSelectedTool();
File afile[] = aeshell.askExportedFiles();
String s1 = aeshell.askSelectedFileName();
String s2 = aeshell.askSelectedNamedRef();
String s3 = aeshell.askSelectedMimeType();
String s4 = aeshell.askSearchBy();
System.out.println(">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> 1111");
Object obj = null;
Registry registry = Registry.getRegistry(this);
String as[] = getDatasetDefinitionComponent().getToolInputSwitches(
tccomponent, i);
paramArrayList.clear();
if (as != null && (logger.isDebugEnabled() || Debug.isOn("tool"))) {
StringBuilder stringbuilder = new StringBuilder();
stringbuilder.append(" input switches: ");
String as3[];
int i1 = (as3 = as).length;
for (int k = 0; k < i1; k++) {
String s7 = as3[k];
stringbuilder.append(s7).append(' ');
}
logger.info(stringbuilder);
}
System.out.println(">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> 2222222222222");
if (i == 3 || i == 4) {
String s6 = tccomponent.toString();
String s8 = getApplRegKey(getType());
if (s8 != null && s8.equals("CAE"))
try {
String s9 = getCurrentWorkingDir();
if (s6.equalsIgnoreCase("MeshingTool"))
launchPreAction(aeshell);
paramArrayList.add("Generic_Encapsulation");
paramArrayList.add(s9);
} catch (Exception exception) {
throw (TCException) exception;
}
String s5 = registry.getString("AliasProjectDatasetTool");
if (s6.equals(s5))
try {
launchPreAction(aeshell);
String s10 = AliasOpenAction.ouputXMLFilePath;
String s11 = null;
String s14 = registry.getString("AliasEncapArgs");
if (s10 != null)
s11 = (new StringBuilder(String.valueOf(s14)))
.append("=")
.append(AliasOpenAction.ouputXMLFilePath)
.toString();
paramArrayList.add("-e");
paramArrayList.add(s11);
} catch (Exception exception1) {
throw (TCException) exception1;
}
String as1[] = buildInputParams(s1, as, s2, i);
String as5[];
int l1 = (as5 = as1).length;
for (int k1 = 0; k1 < l1; k1++) {
String s12 = as5[k1];
paramArrayList.add(s12);
}
System.out.println(">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> 33333");
if (s3 != null && s3.equals("application/ugmportal")) {
String s13 = "";
if (TCSession.isFourTier())
s13 = "4-tier";
else
s13 = "2-tier";
paramArrayList.add(s13);
}
String as2[] = (String[]) paramArrayList.toArray(new String[0]);
AIFShell aifshell = new AIFShell("");
try {
if (Debug.isOn("runner")) {
aifshell.setVerbose();
if ((logger.isDebugEnabled() || Debug.isOn("tool"))
&& as2 != null) {
StringBuilder stringbuilder1 = new StringBuilder();
stringbuilder1.append("AIFShell command: ");
String as6[];
int l2 = (as6 = as2).length;
for (int j2 = 0; j2 < l2; j2++) {
String s16 = as6[j2];
stringbuilder1.append(s16).append(' ');
}
logger.info(stringbuilder1);
}
}
} catch (Exception exception2) {
logger.debug(exception2.getLocalizedMessage(), exception2);
}
System.out.println(">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> 4444");
if (as2 != null && as2.length > 0)
aifshell.setCommand(as2);
if (s3 != null && !s3.isEmpty())
aifshell.setMimeType(s3);
aifshell.addJobChangeListener(aeshell);
aifshell.setAction("O");
TCComponentType.cacheTCPropertiesSet(new Object[] { tccomponent },
new String[] { "symbol_name", "object_name" }, true);
String s15 = tccomponent.getStringProperty("symbol_name");
int i2 = s15.lastIndexOf('\\');
String s18 = "";
if (i2 > 0)
s18 = s15.substring(i2 + 1);
else
s18 = s15;
aifshell.setApplicationName(s18);
aifshell.setToolName(tccomponent.getStringProperty("object_name"));
aifshell.setViewOrEdit(s);
aifshell.setAction("O");
if (s4 != null && !s4.isEmpty())
aifshell.setSearchBy(s4);
if (logger.isDebugEnabled() || Debug.isOn("tool"))
logger.info((new StringBuilder("Starting AIFShell ["))
.append(aifshell).append("]").toString());
aifshell.start();
} else if ((i == 2 || i == 9) && afile != null) {
Object obj1 = null;
int j = 0;
int l = afile.length;
for (int j1 = 0; j1 < l; j1++) {
File file = afile[j1];
String as4[] = buildInputParams(file.getPath(), as, s2, i);
AIFShell aifshell1 = new AIFShell("");
if (as4 != null && as4.length > 0)
aifshell1.setCommand(as4);
if (s3 != null && !s3.isEmpty())
aifshell1.setMimeType(s3);
aifshell1.setAction("P");
String s17 = tccomponent.getStringProperty("symbol_name");
int k2 = s17.lastIndexOf('\\');
String s19 = "";
if (k2 > 0)
s19 = s17.substring(k2 + 1);
else
s19 = s17;
aifshell1.setApplicationName(s19);
if (++j == l)
aifshell1.addJobChangeListener(aeshell);
aifshell1.start();
}
}
System.out.println(">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> 5555");
}
void launchPreAction(AEShell aeshell) throws Exception {
Registry registry = Registry.getRegistry(this);
Object obj = null;
TCComponent tccomponent = aeshell.askSelectedTool();
String s = registry.getString(
(new StringBuilder(String.valueOf(tccomponent.toString())))
.append(".").append("PREACTION").toString(), null);
if (logger.isDebugEnabled() || Debug.isOn("tool"))
logger.info((new StringBuilder(
"launchPreAction() with selectedToolName [")).append(s)
.append("]").toString());
if (s != null)
try {
AbstractDatasetOpenPreAction abstractdatasetopenpreaction = (AbstractDatasetOpenPreAction) Instancer
.newInstanceEx(s, aeshell);
abstractdatasetopenpreaction.startPreAction();
} catch (Exception exception) {
logger.error(exception.getLocalizedMessage(), exception);
throw exception;
}
}
String[] buildInputParams(String s, String as[], String s1, int i) {
boolean flag = true;
ArrayList arraylist = new ArrayList();
String as1[] = null;
Assert.isTrue(
FileUtility.isValidPathString(s),
(new StringBuilder(String.valueOf(Registry.getRegistry(
FileUtility.class).getString(
FileUtility.getInvalidPathMessage())))).append(" - ")
.append(s).toString());
File file = new File(s);
File file1 = file.getParentFile();
String s2 = null;
if (file1 != null && file1.isDirectory() && file1.exists()) {
as1 = file1.list();
s2 = file1.getName();
}
String s3 = s != null ? file.getName() : null;
if (logger.isDebugEnabled() || Debug.isOn("tool")) {
StringBuilder stringbuilder = new StringBuilder();
stringbuilder.append("==> buildInputParams(inputFileName [")
.append(s).append("], ref_name [").append(s1)
.append("], action ").append(i).append(") ");
if (as != null) {
String as3[];
int j1 = (as3 = as).length;
for (int l = 0; l < j1; l++) {
String s4 = as3[l];
stringbuilder.append('\t').append(s4).append(' ');
}
stringbuilder.append("\n\tinputFile [").append(s3)
.append("], currExportDir [").append(file1);
if (as1 != null) {
stringbuilder.append("] has ")
.append(as1 != null ? as1.length : 0)
.append(" exported files");
String as4[];
int k1 = (as4 = as1).length;
for (int i1 = 0; i1 < k1; i1++) {
String s5 = as4[i1];
stringbuilder.append('\t').append(s5).append(' ');
}
}
}
logger.info(stringbuilder);
}
if (as != null && as.length > 0)
try {
int j = as.length;
for (int k = 0; k < j; k++) {
if (logger.isDebugEnabled() || Debug.isOn("tool"))
logger.info((new StringBuilder("==> Processing ["))
.append(as[k]).append("]").toString());
if (as[k].equals("$OBJECT_TAG")) {
String s6 = getObjectString();
arraylist.add(s6);
} else if (as[k].equals("$OBJECT")) {
String s7 = getProperty("object_name");
arraylist.add(s7);
} else if (as[k].equals("$USER")) {
String s8 = getSession().getUser().getUserId();
arraylist.add(s8);
} else if (as[k].equals("$GROUP")) {
String s9 = getSession().getGroup().getFullName();
arraylist.add(s9);
} else if (as[k].equals("$ACCESS")) {
Registry registry = Registry.getRegistry(this);
String s12 = null;
if (okToModify())
s12 = registry.getString("WRITE_ACCESS", "W_ONLY");
else
s12 = registry.getString("READ_ACCESS", "R_ONLY");
arraylist.add(s12);
} else if (as[k].equals("$ACTION")) {
if (i == 3)
arraylist.add("open");
else if (i == 4)
arraylist.add("openusing");
else if (i == 2)
arraylist.add("print");
else if (i == 9)
arraylist.add("printusing");
} else if (as[k].charAt(0) == '$') {
String s10 = as[k].substring(1);
if (flag) {
if (s10.compareTo(s1) == 0) {
arraylist.add(s);
flag = false;
if (logger.isDebugEnabled()
|| Debug.isOn("tool"))
logger.info((new StringBuilder(
" Matched ref name [")).append(s1)
.append("] with [").append(as[k])
.append("]").toString());
}
} else if (as1 != null && as1.length > 0) {
if (dsNamedRefs == null)
dsNamedRefs = getDatasetDefinitionComponent()
.getNamedReferenceContexts();
String s13 = null;
NamedReferenceContext anamedreferencecontext[];
int l2 = (anamedreferencecontext = dsNamedRefs).length;
for (int j2 = 0; j2 < l2; j2++) {
NamedReferenceContext namedreferencecontext = anamedreferencecontext[j2];
if (s10.compareTo(namedreferencecontext
.getNamedReference()) != 0)
continue;
s13 = namedreferencecontext.getFileTemplate();
if (logger.isDebugEnabled()
|| Debug.isOn("tool"))
logger.info((new StringBuilder("NameRef ["))
.append(namedreferencecontext
.getNamedReference())
.append("] template [").append(s13)
.append("]").toString());
if (s13 != null && s13.charAt(0) == '*')
s13 = s13.substring(1);
break;
}
if (s13 != null && !s13.isEmpty()) {
String as6[];
int i3 = (as6 = as1).length;
for (int k2 = 0; k2 < i3; k2++) {
String s14 = as6[k2];
if (s3.equals(s14)) {
if (logger.isDebugEnabled()
|| Debug.isOn("tool"))
logger.info((new StringBuilder(
" Skipped file ["))
.append(s14).append("]")
.toString());
continue;
}
if (!s14.endsWith(s13))
continue;
if (logger.isDebugEnabled()
|| Debug.isOn("tool"))
logger.info((new StringBuilder(
"Matched filename ["))
.append(s14)
.append("] with template [")
.append(s13).append("]")
.toString());
if (s2 != null) {
String s15 = (new StringBuilder())
.append(file1)
.append(File.separator)
.append(s14).toString();
arraylist.add(s15);
} else {
arraylist.add(s14);
}
break;
}
}
}
} else {
arraylist.add(as[k]);
}
}
} catch (TCException _ex) {
}
String as2[] = new String[arraylist.size()];
arraylist.toArray(as2);
if (as2 != null && (logger.isDebugEnabled() || Debug.isOn("tool"))) {
StringBuilder stringbuilder1 = new StringBuilder();
stringbuilder1.append("buildInputParams() returns: ");
String as5[];
int i2 = (as5 = as2).length;
for (int l1 = 0; l1 < i2; l1++) {
String s11 = as5[l1];
stringbuilder1.append(s11).append(' ');
}
logger.info(stringbuilder1);
}
return as2;
}
public void open(TCComponent tccomponent, String s, String s1)
throws TCException, IOException {
boolean flag = okToModify();
open(tccomponent, s, s1, flag);
}
public void open(TCComponent tccomponent, String s, String s1, boolean flag)
throws TCException, IOException {
int i = 0;
try {
boolean flag1 = false;
if (flag) {
TCReservationService tcreservationservice = (TCReservationService) OSGIUtil
.getService(KernelPlugin.getDefault(),
TCReservationService.class);
boolean flag3 = tcreservationservice.isAutoCheckoutEnabled();
if (logger.isDebugEnabled())
logger.debug((new StringBuilder("TC_Auto_Checkout ["))
.append(flag3).append("]").toString());
if (flag3 || tcreservationservice.isReserved(this))
flag1 = okToModify();
}
if (flag1)
i = reserveDataset();
boolean flag2 = true;
if (s == null) {
s = getWorkingDir();
flag2 = false;
}
File file = new File(s);
if (file.isDirectory()) {
prepareToolForLaunching(tccomponent, s, flag2, s1, 4, i, flag);
} else {
TCSession tcsession1 = getSession();
if (flag) {
TCReservationService tcreservationservice2 = tcsession1
.getReservationService();
tcreservationservice2.cancelReservation(this);
}
String s2 = tcsession1.getRegistry().getString(
"createDirFailed");
throw TCComponent.handleException((new StringBuilder(String
.valueOf(s2))).append(" ").append(s).toString());
}
} catch (TCException tcexception) {
if (flag && i == 1) {
TCSession tcsession = getSession();
TCReservationService tcreservationservice1 = tcsession
.getReservationService();
tcreservationservice1.cancelReservation(this);
}
throw tcexception;
}
}
public void purge() throws TCException {
((TCComponentDatasetType) getTypeComponent()).purge(this);
fireComponentChangeEvent();
}
public TCComponentDataset saveAs(String s) throws TCException {
return ((TCComponentDatasetType) getTypeComponent()).saveAs(this, s);
}
public TCComponentDataset saveAs(String s, String s1, String s2)
throws TCException {
return ((TCComponentDatasetType) getTypeComponent()).saveAs(this, s,
s1, s2);
}
public TCComponentDataset saveVersionAs(String s, String s1, String s2,
int i) throws TCException {
return ((TCComponentDatasetType) getTypeComponent()).saveVersionAs(
this, i, s, s1, s2);
}
public TCComponent[] getNamedReferences() throws TCException {
return getRelatedComponents("ref_list");
}
public TCComponentTcFile[] getTcFiles() throws TCException {
TCComponentContextList tccomponentcontextlist = getRelatedList();
TCComponent atccomponent[] = tccomponentcontextlist
.toTCComponentArray();
ArrayList arraylist = new ArrayList();
TCComponent atccomponent1[];
int j = (atccomponent1 = atccomponent).length;
for (int i = 0; i < j; i++) {
TCComponent tccomponent = atccomponent1[i];
if (tccomponent != null) {
String s = tccomponent.getType();
if (s.equalsIgnoreCase("ImanFile"))
arraylist.add(tccomponent);
}
}
return (TCComponentTcFile[]) arraylist
.toArray(new TCComponentTcFile[arraylist.size()]);
}
public TCComponent[] getNonTcFileObjects() throws TCException {
TCComponentContextList tccomponentcontextlist = getRelatedList();
TCComponent atccomponent[] = tccomponentcontextlist
.toTCComponentArray();
ArrayList arraylist = new ArrayList();
TCComponent atccomponent1[];
int j = (atccomponent1 = atccomponent).length;
for (int i = 0; i < j; i++) {
TCComponent tccomponent = atccomponent1[i];
if (tccomponent != null
&& !(tccomponent instanceof TCComponentTool)
&& !(tccomponent instanceof TCComponentTcFile)
&& !(tccomponent instanceof TCComponentDatasetDefinition)
&& !(tccomponent instanceof TCComponentUser)
&& !(tccomponent instanceof TCComponentGroup)
&& !(tccomponent instanceof TCComponentSite)
&& !tccomponent.getType()
.equalsIgnoreCase("RevisionAnchor"))
arraylist.add(tccomponent);
}
return (TCComponent[]) arraylist.toArray(new TCComponent[arraylist
.size()]);
}
public boolean isSuitableForOpenAs() throws TCException {
TCComponentDataset atccomponentdataset[] = getAllVersions();
if (atccomponentdataset != null && atccomponentdataset.length > 1)
return true;
TCComponent atccomponent[] = getDatasetDefinitionComponent().getTools();
if (atccomponent != null && atccomponent.length == 1) {
String as[] = getPrimaryFileNames(atccomponent[0], 3);
return as != null && as.length > 1;
} else {
return true;
}
}
public TCComponentDatasetDefinition getDatasetDefinitionComponent()
throws TCException {
if (dsDefinitionComp == null) {
String s = getTypeComponent().getTypeName();
TCComponentDatasetDefinitionType tccomponentdatasetdefinitiontype = (TCComponentDatasetDefinitionType) getSession()
.getTypeComponent("DatasetType");
dsDefinitionComp = tccomponentdatasetdefinitiontype.find(s);
}
return dsDefinitionComp;
}
public void setUploadingFlag(boolean flag) {
uploadingDataset = flag;
}
public boolean askUploadingFlag() {
return uploadingDataset;
}
public void setDefaultTool(TCComponent tccomponent) throws TCException {
if (tccomponent == null)
return;
TCProperty tcproperty = getTCProperty("tool_used");
TCComponent tccomponent1 = tcproperty.getReferenceValue();
if (tccomponent1 != null && tccomponent1.equals(tccomponent)) {
return;
} else {
String s = tccomponent.getProperty("object_name");
((TCComponentDatasetType) getTypeComponent()).setDefaultTool(this,
s);
return;
}
}
public TCComponent getDefaultTool() throws TCException {
return ((TCComponentDatasetType) getTypeComponent())
.getDefaultTool(this);
}
public String getApplRegKey(String s) {
String s1 = null;
TCPreferenceService tcpreferenceservice = getSession()
.getPreferenceService();
String s2 = "TC_encapsulation_application_key";
String as[] = tcpreferenceservice.getStringValues(s2);
if (as != null) {
String as1[];
int j = (as1 = as).length;
for (int i = 0; i < j; i++) {
String s3 = as1[i];
if (s3.equals("CAE")) {
String s4 = "CAE_analysis_tools";
String as2[] = tcpreferenceservice.getStringValues(s4);
if (as2 != null) {
String as3[];
int l = (as3 = as2).length;
for (int k = 0; k < l; k++) {
String s5 = as3[k];
if (!s.equals(s5))
continue;
s1 = "CAE";
break;
}
}
}
}
}
return s1;
}
public void setCurrentWorkingDir(String s) {
reqDir = s;
}
public String getCurrentWorkingDir() {
return reqDir;
}
public static String getAction(int i) {
if (i < 0 || i >= actionString.length)
return actionString[0];
else
return actionString[i];
}
public boolean inIsIcContext() {
return inIcContext;
}
public void setInIcContext() {
if (!inIcContext) {
inIcContext = true;
try {
((TCComponentDatasetType) getTypeComponent())
.setInIcContext(this);
} catch (TCException tcexception) {
logger.error(tcexception.getLocalizedMessage(), tcexception);
}
}
}
public void resetInIcContext() {
if (inIcContext) {
inIcContext = false;
try {
((TCComponentDatasetType) getTypeComponent())
.resetInIcContext(this);
} catch (TCException tcexception) {
logger.error(tcexception.getLocalizedMessage(), tcexception);
}
}
}
public void validateFiles(TCComponentDataset tccomponentdataset,
File afile[]) throws TCException, ParserConfigurationException,
SAXException, IOException {
if (isValidComponentForExcelLive(tccomponentdataset)) {
String s = tccomponentdataset.getProperty("object_name");
TCComponentMSExcelX tccomponentmsexcelx = new TCComponentMSExcelX();
tccomponentmsexcelx.validateFile(getSession(), afile, s);
}
}
public boolean isValidComponentForExcelLive(
TCComponentDataset tccomponentdataset) throws TCException {
if (tccomponentdataset.isTypeOf("MSExcelX")) {
TCComponent tccomponent = null;
AIFComponentContext aaifcomponentcontext[] = tccomponentdataset
.whereReferencedByTypeRelation(new String[0],
new String[] { "IMAN_specification" });
if (aaifcomponentcontext != null) {
AIFComponentContext aaifcomponentcontext2[];
int j = (aaifcomponentcontext2 = aaifcomponentcontext).length;
for (int i = 0; i < j; i++) {
AIFComponentContext aifcomponentcontext = aaifcomponentcontext2[i];
com.teamcenter.rac.aif.kernel.InterfaceAIFComponent interfaceaifcomponent = aifcomponentcontext
.getComponent();
if ((interfaceaifcomponent instanceof TCComponent)
&& ((TCComponent) interfaceaifcomponent)
.isTypeOf("ExcelTemplateRevision"))
tccomponent = (TCComponent) interfaceaifcomponent;
}
}
if (tccomponent != null) {
AIFComponentContext aaifcomponentcontext1[] = tccomponent
.getRelated("items_tag");
if (aaifcomponentcontext1 != null) {
AIFComponentContext aaifcomponentcontext3[];
int l = (aaifcomponentcontext3 = aaifcomponentcontext1).length;
for (int k = 0; k < l; k++) {
AIFComponentContext aifcomponentcontext1 = aaifcomponentcontext3[k];
com.teamcenter.rac.aif.kernel.InterfaceAIFComponent interfaceaifcomponent1 = aifcomponentcontext1
.getComponent();
if ((interfaceaifcomponent1 instanceof TCComponent)
&& ((TCComponent) interfaceaifcomponent1)
.isTypeOf("ExcelTemplate"))
return true;
}
}
}
}
return false;
}
public int compareTo(Object paramTCComponentDataset) {
return toString().compareTo(paramTCComponentDataset.toString());
}
private static final Logger logger;
public static final int ACTION_UNKNOWN = 0;
public static final int ACTION_CREATE = 1;
public static final int ACTION_PRINT = 2;
public static final int ACTION_OPEN = 3;
public static final int ACTION_OPEN_USING = 4;
public static final int ACTION_SAVE_AS = 5;
public static final int ACTION_DESTROY = 6;
public static final int ACTION_PURGE = 7;
public static final int ACTION_IMPORT = 8;
public static final int ACTION_PRINT_USING = 9;
public static final int ACTION_MORE = 10;
public static final int ACTION_IMPORT_TO_EXISTING = 11;
public static final int ACTION_SEND = 12;
private boolean inIcContext;
private static String actionString[] = { "ACTION_UNKNOWN", "ACTION_CREATE",
"ACTION_PRINT", "ACTION_OPEN", "ACTION_OPEN_USING",
"ACTION_SAVE_AS", "ACTION_DESTROY", "ACTION_PURGE",
"ACTION_IMPORT", "ACTION_PRINT_USING", "ACTION_MORE",
"ACTION_IMPORT_TO_EXISTING", "ACTION_SEND" };
public static final String ACTION_OBJECT_SUFFIX = ".ACTION_OBJECT";
public static final int NOT_CHECKED_OUT = 0;
public static final int SHORT_TERM_CHECKED_OUT = 1;
public static final int LONG_TERM_CHECKED_OUT = 2;
private static String reqDir;
private static boolean uploadingDataset = false;
private TCComponentDatasetDefinition dsDefinitionComp;
private NamedReferenceContext dsNamedRefs[];
private List paramArrayList;
private boolean isOfficeType;
private String url;
private String cookie;
static {
logger = Logger.getLogger(TCComponentDataset.class);
if (!logger.isDebugEnabled() && Debug.isOn("dataset"))
logger.setLevel(org.apache.log4j.Level.DEBUG);
}
}
/*
* DECOMPILATION REPORT
*
* Decompiled from:
* F:\Teamcenter10.1.4Env\portal\plugins\com.teamcenter.rac.kernel_10000.1.0.jar
* Total time: 154 ms Jad reported messages/errors: Exit status: 0 Caught
* exceptions:
*/