/* * MicrocallerServer.java * * Created on 14 de julio de 2005, 16:20 * */ package com.omatech.utils; import java.util.Iterator; public final class MicrocallerServer { public MicrocallerServer() { } public static String resultError(String p_procedure, String p_retcode, String p_errbuff) { String l_res=""; l_res=l_res+"\n"; l_res=l_res+""; return l_res; } public static String resultOK(String p_procedure, String p_retcode) { String l_res=""; l_res=l_res+"\n"; l_res=l_res+""; return l_res; } public static String resultOK(String p_procedure, String p_retcode, String p_content) { String l_res=""; l_res=l_res+"\n"; l_res=l_res+"\n"; l_res=l_res+" \n"; l_res=l_res+""; return l_res; } public static String resultOKHeader(String p_procedure, String p_retcode) { String l_res=""; l_res=l_res+"\n"; l_res=l_res+"\n"; return l_res; } public static String resultOKFooter() { String l_res=""; l_res=l_res+"\n"; return l_res; } public static String content(String p_name, int p_int_content) { return(content(p_name, null, null, new Integer(p_int_content).toString())); } public static String content(String p_name, long p_long_content) { return(content(p_name, null, null, new Long(p_long_content).toString())); } public static String content(String p_name, String p_content) { return(content(p_name, null, null, p_content)); } public static String content(String p_name, String p_type, String p_transformation, String p_content) { String l_type="text/html"; if (p_type!=null) { l_type=p_type; } return(contentHeader(p_name, l_type, p_transformation)+p_content+contentFooter(l_type)); } public static String repetitiveContents(String p_prefix, String p_counter_name, String p_type, Iterator p_it) { String l_type="text/html"; String l_ret=""; if (p_type!=null) { l_type=p_type; } int i=0; while (p_it.hasNext()) { l_ret=l_ret+contentHeader(p_prefix+i, l_type, null)+p_it.next().toString()+contentFooter(l_type); i++; } l_ret=l_ret+contentHeader(p_counter_name, l_type, null)+i+contentFooter(l_type); return(l_ret); } public static String CjtContents(String p_cjt_name, String p_type, Iterator p_it) { String l_type="text/html"; String l_ret=""; if (p_type!=null) { l_type=p_type; } l_ret=l_ret+""; int i=0; while (p_it.hasNext()) { l_ret=l_ret+""+contentHeader(i, l_type, null)+p_it.next().toString()+contentFooter(l_type)+""; i++; } l_ret=l_ret+""; return(l_ret); } public static String contentHeader(String p_name, String p_type, String p_transformation) { String l_res=""; if (p_transformation==null) { l_res=l_res+" \n"; } else { l_res=l_res+" \n"; } if (!p_type.equalsIgnoreCase("text/xml")) { l_res=l_res+""; } l_res=l_res+"\n"; return l_res; } public static String contentFooter() { return contentFooter("text/html"); } }