// Decompiled by Jad v1.5.8e. Copyright 2001 Pavel Kouznetsov.
// Jad home page: http://www.geocities.com/kpdus/jad.html
// Decompiler options: packimports(3) deadcode 
// Source File Name:   DependsOnQueryService.java

package com.ptc.windchill.pdmlink.doc.server.processors;

import java.beans.PropertyChangeEvent;
import java.io.*;
import java.util.*;
import wt.doc.*;
import wt.enterprise.tabularresults.BaseQueryService;
import wt.fc.EvolvableHelper;
import wt.introspection.PropertyDisplayName;
import wt.pds.PDSObjectInput;
import wt.util.WTException;
import wt.util.WTPropertyVetoException;

public class DependsOnQueryService extends BaseQueryService
    implements Externalizable
{

    public DependsOnQueryService()
    {
        tableFormatName = null;
        dataFormatName = null;
        columnNames = null;
    }

    public void writeExternal(ObjectOutput output)
        throws IOException
    {
        output.writeLong(0x6e2eb6c4aabedbf2L);
        super.writeExternal(output);
        output.writeObject(columnNames);
        output.writeObject(dataFormatName);
        output.writeObject(tableFormatName);
    }

    public void readExternal(ObjectInput input)
        throws IOException, ClassNotFoundException
    {
        long readSerialVersionUID = input.readLong();
        readVersion(this, input, readSerialVersionUID, false, false);
    }

    protected boolean readVersion(DependsOnQueryService thisObject, ObjectInput input, long readSerialVersionUID, boolean passThrough, boolean superDone)
        throws IOException, ClassNotFoundException
    {
        boolean success = true;
        if(readSerialVersionUID == 0x6e2eb6c4aabedbf2L)
        {
            if(!superDone)
                super.readExternal(input);
            columnNames = (String[])input.readObject();
            dataFormatName = (String)input.readObject();
            tableFormatName = (String)input.readObject();
        } else
        {
            success = readOldVersion(input, readSerialVersionUID, passThrough, superDone);
            if(input instanceof PDSObjectInput)
                EvolvableHelper.requestRewriteOfEvolvedBlobbedObject();
        }
        return success;
    }

    private boolean readOldVersion(ObjectInput input, long readSerialVersionUID, boolean passThrough, boolean superDone)
        throws IOException, ClassNotFoundException
    {
        boolean success = true;
        if(readSerialVersionUID == 0xea7466f48baef787L)
        {
            columnNames = (String[])input.readObject();
            dataFormatName = (String)input.readObject();
            tableFormatName = (String)input.readObject();
        } else
        if(!superDone)
        {
            success = super.readVersion(this, input, readSerialVersionUID, false, false);
            if(success && !passThrough && readSerialVersionUID != 0xd4b6b5eeea339daL)
                readVersion(this, input, input.readLong(), false, true);
        } else
        {
            throw new InvalidClassException(CLASSNAME, "Local class not compatible: stream classdesc externalizationVersionUID=" + readSerialVersionUID + " local class externalizationVersionUID=" + 0x6e2eb6c4aabedbf2L);
        }
        return success;
    }

    /**
     * @deprecated Method getConceptualClassname is deprecated
     */

    public String getConceptualClassname()
    {
        return CLASSNAME;
    }

    public static DependsOnQueryService newDependsOnQueryService()
        throws WTException
    {
        DependsOnQueryService instance = new DependsOnQueryService();
        instance.initialize();
        return instance;
    }

    public String getTableFormatName()
    {
        return tableFormatName;
    }

    public void setTableFormatName(String a_TableFormatName)
        throws WTPropertyVetoException
    {
        tableFormatNameValidate(a_TableFormatName);
        tableFormatName = a_TableFormatName;
    }

    private void tableFormatNameValidate(String a_TableFormatName)
        throws WTPropertyVetoException
    {
        if(a_TableFormatName != null && a_TableFormatName.length() > 200)
        {
            Object args[] = {
                new PropertyDisplayName(CLASSNAME, "tableFormatName"), "200"
            };
            throw new WTPropertyVetoException("wt.introspection.introspectionResource", "20", args, new PropertyChangeEvent(this, "tableFormatName", tableFormatName, a_TableFormatName));
        } else
        {
            return;
        }
    }

    public String getDataFormatName()
    {
        return dataFormatName;
    }

    public void setDataFormatName(String a_DataFormatName)
        throws WTPropertyVetoException
    {
        dataFormatNameValidate(a_DataFormatName);
        dataFormatName = a_DataFormatName;
    }

    private void dataFormatNameValidate(String a_DataFormatName)
        throws WTPropertyVetoException
    {
        if(a_DataFormatName != null && a_DataFormatName.length() > 200)
        {
            Object args[] = {
                new PropertyDisplayName(CLASSNAME, "dataFormatName"), "200"
            };
            throw new WTPropertyVetoException("wt.introspection.introspectionResource", "20", args, new PropertyChangeEvent(this, "dataFormatName", dataFormatName, a_DataFormatName));
        } else
        {
            return;
        }
    }

    public String[] getColumnNames()
    {
        return columnNames;
    }

    public void setColumnNames(String a_ColumnNames[])
        throws WTPropertyVetoException
    {
        columnNames = a_ColumnNames;
    }

    public Object getQuery(Object context_obj, Properties parameters, Locale locale)
        throws WTException
    {
        Vector results = new Vector();
        wt.fc.QueryResult qr = null;
        if(context_obj instanceof WTDocument)
        {
            WTDocument doc = (WTDocument)context_obj;
            qr = WTDocumentHelper.service.getDependsOnWTDocuments(doc, false);
        }
        return qr;
    }

    protected void initialize()
    {
    }

    static Class _mthclass$(String x0)
    {
        return Class.forName(x0);
        ClassNotFoundException x1;
        x1;
        throw (new NoClassDefFoundError()).initCause(x1);
    }

    private static final String RESOURCE = "com.ptc.windchill.pdmlink.doc.server.processors.processorsResource";
    private static final String CLASSNAME;
    private String tableFormatName;
    private String dataFormatName;
    private String columnNames[];
    static final long serialVersionUID = 1L;
    public static final long EXTERNALIZATION_VERSION_UID = 0x6e2eb6c4aabedbf2L;
    protected static final long OLD_FORMAT_VERSION_UID = 0xea7466f48baef787L;

    static 
    {
        CLASSNAME = (com.ptc.windchill.pdmlink.doc.server.processors.DependsOnQueryService.class).getName();
    }
}
