⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 jco$function.java

📁 SAP这个系统的一个转换器
💻 JAVA
字号:
// Decompiled by Jad v1.5.8e2. Copyright 2001 Pavel Kouznetsov.
// Jad home page: http://kpdus.tripod.com/jad.html
// Decompiler options: packimports(3) 
// Source File Name:   JCO.java

package com.sap.mw.jco;

import com.sap.mw.jco.util.XMLWriterBase;
import java.io.*;
import java.util.Date;

// Referenced classes of package com.sap.mw.jco:
//            IFunctionTemplate, JCO

public static class JCO$Function
    implements Serializable
{

    public String getName()
    {
        return name;
    }

    public void setName(String name)
    {
        this.name = name;
    }

    public List getImportParameterList()
    {
        return import_parameters;
    }

    public void setImportParameterList(List import_parameters)
    {
        if(((JCO$MetaData) (import_parameters)).rec_name == null)
            import_parameters.rec_name = "INPUT";
        this.import_parameters = import_parameters;
    }

    public List getExportParameterList()
    {
        return export_parameters;
    }

    public void setExportParameterList(List export_parameters)
    {
        if(((JCO$MetaData) (export_parameters)).rec_name == null)
            export_parameters.rec_name = "OUTPUT";
        this.export_parameters = export_parameters;
    }

    public List getTableParameterList()
    {
        return table_parameters;
    }

    public void setTableParameterList(List table_parameters)
    {
        if(((JCO$MetaData) (table_parameters)).rec_name == null)
            table_parameters.rec_name = "OUTPUT";
        this.table_parameters = table_parameters;
    }

    public tion[] getExceptionList()
    {
        return exception_list;
    }

    public void setExceptionList(tion exception_list[])
    {
        this.exception_list = exception_list;
    }

    public tion getException(String key)
    {
        if(exception_list == null)
            return null;
        for(int i = 0; i < exception_list.length; i++)
            if(exception_list[i].getKey().equalsIgnoreCase(key))
            {
                tion ex = exception_list[i];
                return new tion(ex.getKey(), ex.getMessage() != null ? ex.getMessage() : ex.getKey());
            }

        return null;
    }

    public String toString()
    {
        StringBuffer b = new StringBuffer();
        b.append("Name:   " + getName() + JCO.CRLF);
        b.append("Input:  \n" + import_parameters + JCO.CRLF);
        b.append("Output: \n" + export_parameters + JCO.CRLF);
        b.append("Tables: \n" + table_parameters + JCO.CRLF);
        if(exception_list != null)
        {
            b.append("Exceptions: \n");
            for(int i = 0; i < exception_list.length; i++)
                b.append(exception_list[i].getKey() + JCO.CRLF);

        }
        return b.toString();
    }

    public void writeHTML(String html_filename)
    {
        try
        {
            writeHTML(((Writer) (new FileWriter(html_filename))));
        }
        catch(Exception ex)
        {
            throw new nException("Cannot write function " + getName() + " to HTML file " + html_filename);
        }
    }

    public void writeHTML(Writer writer)
        throws IOException
    {
        String bg = JCO.getProperty("jco.html.table_header_background1");
        String fg = JCO.getProperty("jco.html.table_header_foreground1");
        String fface = JCO.getProperty("jco.html.font_face");
        String fsize = JCO.getProperty("jco.html.font_size");
        PrintWriter os = new PrintWriter(writer);
        os.println("<html><head></head>");
        os.println("<body bgcolor='" + JCO.getProperty("jco.html.background") + "'>");
        os.println("<font face='" + fface + "' size='" + fsize + "'>");
        os.println("<table width='100%' border='1' bgcolor='" + bg + "'>");
        os.println("<tr align='left'><td><b><font color='" + fg + "'>" + name + "&nbsp;&nbsp;&nbsp;Date: " + new Date() + "</font></b></td></tr>");
        os.println("<tr align='left'><td><b><font color='" + fg + "'>Input Parameters</font></b></td></td>");
        os.println("<tr align='left'><td>");
        if(import_parameters != null && import_parameters.getFieldCount() > 0)
            import_parameters.intHTML(os);
        else
            os.print("None");
        os.println("</td></tr>");
        os.println("<tr align='left'><td><b><font color='" + fg + "'>Output Parameters</font></b></td></td>");
        os.println("<tr align='left'><td>");
        if(export_parameters != null && export_parameters.getFieldCount() > 0)
            export_parameters.intHTML(os);
        else
            os.print("None");
        os.println("</td></tr>");
        os.println("<tr align='left'><td><b><font color='" + fg + "'>Table Parameters</font></b></td></td>");
        os.println("<tr align='left'><td>");
        if(table_parameters != null && table_parameters.getFieldCount() > 0)
            table_parameters.intHTML(os);
        else
            os.print("None");
        os.println("</td></tr>");
        os.println("</table></font></body></html>");
        os.close();
    }

    public void writeXML(String xml_filename)
    {
        try
        {
            FileOutputStream os = new FileOutputStream(xml_filename);
            writeXML(((OutputStream) (os)));
            os.close();
        }
        catch(IOException ex)
        {
            throw new nException("Cannot write function " + getName() + " to XML file " + xml_filename);
        }
    }

    protected void writeXML(OutputStream output_stream)
        throws IOException
    {
        XMLWriterBase xmlWriterBase = new XMLWriterBase();
        OutputStreamWriter os = new OutputStreamWriter(output_stream, "UTF-8");
        PrintWriter out = new PrintWriter(os);
        out.println("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
        out.println("<" + xmlWriterBase.escape(getName()) + ">");
        if(getImportParameterList() != null)
            out.println(getImportParameterList().XML());
        if(getExportParameterList() != null)
            out.println(getExportParameterList().XML());
        if(getTableParameterList() != null)
            out.println(getTableParameterList().XML());
        out.println("</" + xmlWriterBase.escape(getName()) + ">");
        out.flush();
        os.flush();
    }

    private static final long serialVersionUID = 0x199d2b6fe1L;
    private String name;
    private List import_parameters;
    private List export_parameters;
    private List table_parameters;
    private tion exception_list[];

    public JCO$Function(String name)
    {
        this(name, null, null, null);
    }

    public JCO$Function(String name, List input, List output, List tables)
    {
        if(input != null && ((JCO$MetaData) (input)).rec_name == null)
            input.rec_name = "INPUT";
        if(output != null && ((JCO$MetaData) (output)).rec_name == null)
            output.rec_name = "OUTPUT";
        if(tables != null && ((JCO$MetaData) (tables)).rec_name == null)
            tables.rec_name = "TABLES";
        this.name = name;
        import_parameters = input;
        export_parameters = output;
        table_parameters = tables;
    }

    public JCO$Function(IFunctionTemplate template)
    {
        name = template.getName();
        IMetaData import_meta = template.getImportParameterList();
        IMetaData export_meta = template.getExportParameterList();
        IMetaData tables_meta = template.getTableParameterList();
        exception_list = template.getExceptionList();
        if(import_meta != null)
        {
            import_parameters = new init>(import_meta, export_meta, exception_list);
            import_parameters.c_type &= 0xef;
        }
        if(export_meta != null)
        {
            export_parameters = new JCO$Response(export_meta, import_meta, exception_list);
            export_parameters.c_type &= 0xdf;
        }
        if(tables_meta != null)
            table_parameters = new List(tables_meta);
        exception_list = template.getExceptionList();
    }
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -