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

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

import java.io.PrintStream;
import java.util.Properties;
import wt.content.*;
import wt.templateutil.processor.FormTaskDelegate;
import wt.util.WTMessage;
import wt.util.WTProperties;

/**
 * @deprecated Class CreateTemplateDocCloseWindowFormTaskDelegate is deprecated
 */

public class CreateTemplateDocCloseWindowFormTaskDelegate extends FormTaskDelegate
{

    public CreateTemplateDocCloseWindowFormTaskDelegate()
    {
    }

    /**
     * @deprecated Method processAction is deprecated
     */

    public void processAction(ContentHTTPStream contentStream)
        throws Exception
    {
        if(VERBOSE)
            System.err.println("Entering CreateTemplateDocCloseWindowFormTaskDelegate.processAction");
        Properties props = getQueryData();
        String formName = (String)props.get("formName");
        if(getContextAction().equals("CreateTemplateDocumentUploadFailure"))
        {
            addToResponseHeaders(new WTMessage("com.ptc.windchill.pdmlink.doc.server.processors.processorsResource", "28", null));
        } else
        {
            String uploaded = (String)props.get("uploaded");
            if(uploaded != null && uploaded.equalsIgnoreCase("true"))
            {
                long checksum = 0L;
                try
                {
                    checksum = Long.parseLong((String)props.get("checksum"));
                }
                catch(Exception e)
                {
                    e.printStackTrace();
                }
                FormatContentHolder holder = (FormatContentHolder)getContextObj();
                holder = (FormatContentHolder)ContentHelper.service.getContents(holder);
                wt.content.ContentItem item = ContentHelper.getPrimary(holder);
                if(item instanceof ApplicationData)
                {
                    ApplicationData app = (ApplicationData)item;
                    app.setChecksum(checksum);
                    try
                    {
                        ContentHelper.service.updateAppData(holder, app);
                    }
                    catch(Exception e)
                    {
                        e.printStackTrace();
                    }
                }
            }
        }
        deleteFormDataFromSession(formName);
        setContextAction("ComplexCloseWizardWindow");
        getContextProperties().put("refreshOnly", "true");
    }

    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 static boolean VERBOSE;

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