// 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:   DocumentRelationshipWizardProcessor.java

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

import com.ptc.core.HTMLtemplateutil.server.processors.WizardProcessor;
import java.io.*;
import java.util.Locale;
import java.util.Properties;
import wt.doc.WTDocumentDependencyLink;
import wt.fc.EvolvableHelper;
import wt.pds.PDSObjectInput;
import wt.util.WTException;
import wt.util.WTProperties;

public class DocumentRelationshipWizardProcessor extends WizardProcessor
    implements Externalizable
{

    public DocumentRelationshipWizardProcessor()
    {
    }

    public void writeExternal(ObjectOutput output)
        throws IOException
    {
        output.writeLong(0xa6700984c6548630L);
        super.writeExternal(output);
    }

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

    protected boolean readVersion(DocumentRelationshipWizardProcessor thisObject, ObjectInput input, long readSerialVersionUID, boolean passThrough, boolean superDone)
        throws IOException, ClassNotFoundException
    {
        boolean success = true;
        if(readSerialVersionUID == 0xa6700984c6548630L)
        {
            if(!superDone)
                super.readExternal(input);
        } 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 != 0x57d877da225755d5L)
            if(!superDone)
            {
                success = super.readVersion(this, input, readSerialVersionUID, false, false);
                if(success && !passThrough && readSerialVersionUID != 0x5c9ab67f442bc0d1L)
                    readVersion(this, input, input.readLong(), false, true);
            } else
            {
                throw new InvalidClassException(CLASSNAME, "Local class not compatible: stream classdesc externalizationVersionUID=" + readSerialVersionUID + " local class externalizationVersionUID=" + 0xa6700984c6548630L);
            }
        return success;
    }

    public void getComments(Properties parameters, Locale locale, OutputStream os)
        throws WTException
    {
        Properties formData = getFormData();
        Object c_obj = getContextObj();
        WTDocumentDependencyLink link = null;
        if(c_obj instanceof WTDocumentDependencyLink)
            link = (WTDocumentDependencyLink)c_obj;
        String comment = link.getLinkDescription();
        if(comment != null)
        {
            PrintWriter out = getPrintWriter(os, locale);
            out.println(comment);
            out.flush();
        }
    }

    public void getDownloadDocument(Properties parameters, Locale locale, OutputStream os)
        throws WTException
    {
        if(VERBOSE)
            System.out.println("I am in the DocumentRelationshipWizardProcessor.");
        Properties formData = getFormData();
        Object c_obj = getContextObj();
        String applet_tag = formData.getProperty("appletTag");
        if(applet_tag == null || applet_tag.length() == 0)
            applet_tag = "<script language=\"Javascript\"> displayMessagesFromClosingWindow(); wfWindowClose(); </script>";
        PrintWriter out = getPrintWriter(os, locale);
        out.println(applet_tag);
        out.flush();
    }

    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;
    static final long serialVersionUID = 1L;
    public static final long EXTERNALIZATION_VERSION_UID = 0xa6700984c6548630L;
    protected static final long OLD_FORMAT_VERSION_UID = 0x57d877da225755d5L;
    protected static boolean VERBOSE = false;
    protected static String DELIM;

    static 
    {
        CLASSNAME = (com.ptc.windchill.pdmlink.doc.server.processors.DocumentRelationshipWizardProcessor.class).getName();
        try
        {
            WTProperties properties = WTProperties.getLocalProperties();
            VERBOSE = properties.getProperty("com.ptc.windchill.pdmlink.doc.client.verbose", false);
            DELIM = properties.getProperty("wt.doc.hiddenFieldDelimiter", ";;;qqq");
        }
        catch(Throwable t)
        {
            t.printStackTrace(System.err);
            throw new ExceptionInInitializerError(t);
        }
    }
}
