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

package com.ptc.windchill.enterprise.doc.server.impl;

import com.ptc.core.command.server.delegate.ServerCommandDelegateUtility;
import com.ptc.core.meta.common.*;
import com.ptc.core.meta.container.common.*;
import java.util.HashMap;
import wt.content.*;
import wt.doc.WTDocument;
import wt.fc.ObjectReference;

public class SACFDocumentHasContents
    implements ServerAttributeContainerFunction
{

    public SACFDocumentHasContents()
    {
        _ati = null;
    }

    public Object calculate(AttributeContainer the_attribute_container)
        throws InvalidFunctionArgumentException
    {
        Boolean hasContents = new Boolean(false);
        try
        {
            TypeInstanceIdentifier tii = (TypeInstanceIdentifier)the_attribute_container.getIdentifier();
            ObjectReference doc_ref = ServerCommandDelegateUtility.getObjectReference(tii);
            WTDocument doc = (WTDocument)doc_ref.getObject();
            FormatContentHolder fchldr = (FormatContentHolder)ContentHelper.service.getContents(doc);
            wt.content.ContentItem item = ContentHelper.getPrimary(fchldr);
            if(item != null && (item instanceof ApplicationData))
                hasContents = new Boolean(true);
        }
        catch(Exception e) { }
        return hasContents;
    }

    public Object calculate(AttributeContainer the_attribute_container, AssociationIdentifier entry_point)
        throws InvalidFunctionArgumentException
    {
        return null;
    }

    public Object[] getArguments()
    {
        return (new Object[] {
            _ati
        });
    }

    public Object getPrimaryArgument()
    {
        return _ati;
    }

    public Object[] getArgumentsRecursive()
    {
        return getArguments();
    }

    public AttributeIdentifier[] getArgumentsRecursive(AttributeContainer the_attribute_container, AssociationIdentifier entry_point)
    {
        return AttributeContainerFunctionUtility.resolveArgumentsRecursive(getArgumentsRecursive(), the_attribute_container, entry_point);
    }

    public AttributeContainerFunction cloneWithNewArguments(HashMap old_to_new_map)
        throws InvalidFunctionArgumentException
    {
        return this;
    }

    public AttributeContainerFunction valueOf(String str)
        throws InvalidFunctionArgumentException
    {
        return null;
    }

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

    private static final String CLASSNAME;
    private AttributeTypeIdentifier _ati;
    private static boolean debug = false;

    static 
    {
        CLASSNAME = (com.ptc.windchill.enterprise.doc.server.impl.SACFDocumentHasContents.class).getName();
    }
}
