本文整理汇总了Java中org.apache.commons.betwixt.io.BeanWriter类的典型用法代码示例。如果您正苦于以下问题:Java BeanWriter类的具体用法?Java BeanWriter怎么用?Java BeanWriter使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
BeanWriter类属于org.apache.commons.betwixt.io包,在下文中一共展示了BeanWriter类的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: execute
import org.apache.commons.betwixt.io.BeanWriter; //导入依赖的package包/类
public ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest request,
HttpServletResponse response) throws Exception
{
DominioDelegate delegate = DelegateUtil.getDominioDelegate();
Long idDominio = new Long ( request.getParameter( "codigo" ) );
Dominio dominio = delegate.obtenerDominio( idDominio );
response.setContentType("application/octet-stream");
String contentDispositionHeader = "attachment; filename=\"dominio-" + dominio.getIdentificador() + ".xml\"";
response.setHeader( "Content-Disposition", contentDispositionHeader );
BeanWriter beanWriter = new BeanWriter(response.getOutputStream(), ConstantesXML.ENCODING );
beanWriter.writeXmlDeclaration("<?xml version=\"1.0\" encoding=\"" + ConstantesXML.ENCODING + "\" ?>");
Configurator.configure(beanWriter);
beanWriter.write(dominio);
beanWriter.close();
return null;
}
开发者ID:GovernIB,项目名称:sistra,代码行数:17,代码来源:ExportarDominioAction.java
示例2: getWriter
import org.apache.commons.betwixt.io.BeanWriter; //导入依赖的package包/类
/**
* Returns a new bean writer configured to writer database models.
*
* @param output The target output writer
* @return The writer
*/
protected BeanWriter getWriter(Writer output) throws DdlUtilsException
{
try
{
BeanWriter writer = new BeanWriter(output);
writer.getXMLIntrospector().register(getBetwixtMapping());
writer.getXMLIntrospector().getConfiguration().setAttributesForPrimitives(true);
writer.getXMLIntrospector().getConfiguration().setWrapCollectionsInElement(false);
writer.getXMLIntrospector().getConfiguration().setElementNameMapper(new HyphenatedNameMapper());
writer.getBindingConfiguration().setMapIDs(false);
writer.enablePrettyPrint();
return writer;
}
catch (Exception ex)
{
throw new DdlUtilsException(ex);
}
}
开发者ID:flex-rental-solutions,项目名称:apache-ddlutils,代码行数:27,代码来源:DatabaseIO.java
示例3: toXml
import org.apache.commons.betwixt.io.BeanWriter; //导入依赖的package包/类
public byte[] toXml()
{
byte[] result = null;
try
{
ByteArrayOutputStream baos = new ByteArrayOutputStream();
BeanWriter beanWriter = new BeanWriter(baos, "UTF-8");
beanWriter.writeXmlDeclaration("<?xml version=\"1.0\" encoding=\"UTF-8\" ?>");
Configurator.configure(beanWriter);
beanWriter.write(this);
beanWriter.close();
result = baos.toByteArray();
}
catch ( IOException e )
{
e.printStackTrace();
}
catch ( IntrospectionException ie )
{
ie.printStackTrace();
}
catch ( SAXException saxe )
{
saxe.printStackTrace();
}
return result;
}
开发者ID:GovernIB,项目名称:sistra,代码行数:28,代码来源:Dominio.java
示例4: execute
import org.apache.commons.betwixt.io.BeanWriter; //导入依赖的package包/类
public ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest request,
HttpServletResponse response) throws Exception {
// Recuperamos version tramite
TramiteVersionDelegate delegate = DelegateUtil.getTramiteVersionDelegate();
Long idTramiteVersion = new Long(request.getParameter("codigo"));
TramiteVersion tramiteVersion = delegate.obtenerTramiteVersion( idTramiteVersion );
tramiteVersion = delegate.obtenerTramiteVersionCompleto( tramiteVersion.getTramite().getIdentificador(), tramiteVersion.getVersion() );
tramiteVersion.setFechaExportacion(new Date());
// Reseteamos informacion de bloqueo (xa que cuando se importe no este bloqueado)
tramiteVersion.setBloqueadoModificacion("N");
tramiteVersion.setBloqueadoModificacionPor(null);
// Generamos xml de exportacion
ByteArrayOutputStream bos = new ByteArrayOutputStream(8192);
BeanWriter beanWriter = new BeanWriter(bos, ConstantesXML.ENCODING );
beanWriter.writeXmlDeclaration("<?xml version=\"1.0\" encoding=\"" + ConstantesXML.ENCODING + "\" ?>");
//beanWriter.writeXmlDeclaration("<?xml version=\"1.0\" encoding=\"ISO-8859-15\" ?>");
Configurator.configure(beanWriter);
beanWriter.write(tramiteVersion);
beanWriter.close();
byte[] contentFic = bos.toByteArray();
String nombreFic = "tramite-" + tramiteVersion.getTramite().getIdentificador()+ "-" + tramiteVersion.getVersion() + ".xml";
bos.close();
// Devolvemos XML
request.setAttribute( Constants.NOMBREFICHERO_KEY, nombreFic );
request.setAttribute( Constants.DATOSFICHERO_KEY, contentFic );
return mapping.findForward( "success" );
}
开发者ID:GovernIB,项目名称:sistra,代码行数:33,代码来源:GenerarXMLAction.java
示例5: toXml
import org.apache.commons.betwixt.io.BeanWriter; //导入依赖的package包/类
public byte[] toXml()
{
byte[] result = null;
try
{
ByteArrayOutputStream baos = new ByteArrayOutputStream();
BeanWriter beanWriter = new BeanWriter(baos, "UTF-8");
beanWriter.writeXmlDeclaration("<?xml version=\"1.0\" encoding=\"UTF-8\" ?>");
Configurator.configure(beanWriter);
beanWriter.write(this);
beanWriter.close();
result = baos.toByteArray();
}
catch ( IOException e )
{
e.printStackTrace();
}
catch ( IntrospectionException ie )
{
ie.printStackTrace();
}
catch ( SAXException saxe )
{
saxe.printStackTrace();
}
return result;
}
开发者ID:GovernIB,项目名称:sistra,代码行数:28,代码来源:Formulario.java
示例6: exportBuildFile
import org.apache.commons.betwixt.io.BeanWriter; //导入依赖的package包/类
private static void exportBuildFile(String directory, String language) {
String source = OBPropertiesProvider.getInstance().getOpenbravoProperties().get("source.path")
.toString();
try {
FileReader xmlReader = new FileReader(source
+ "/src/org/openbravo/erpCommon/ad_process/buildStructure/buildStructure.xml");
BeanReader beanReader = new BeanReader();
beanReader.getBindingConfiguration().setMapIDs(false);
beanReader.getXMLIntrospector().register(
new InputSource(new FileReader(new File(source,
"/src/org/openbravo/erpCommon/ad_process/buildStructure/mapping.xml"))));
beanReader.registerBeanClass("Build", Build.class);
Build build = (Build) beanReader.parse(xmlReader);
FileWriter outputWriterT = new FileWriter(directory + "/buildStructureTrl.xml");
outputWriterT.write("<?xml version='1.0' ?>\n");
BeanWriter beanWriterT = new BeanWriter(outputWriterT);
beanWriterT.getXMLIntrospector().getConfiguration().setAttributesForPrimitives(false);
beanWriterT.getXMLIntrospector().register(
new InputSource(new FileReader(new File(source,
"/src/org/openbravo/erpCommon/ad_process/buildStructure/mapping.xml"))));
beanWriterT.getBindingConfiguration().setMapIDs(false);
beanWriterT.enablePrettyPrint();
BuildTranslation trl = build.generateBuildTranslation(language);
beanWriterT.write("BuildTranslation", trl);
outputWriterT.flush();
outputWriterT.close();
} catch (Exception e) {
log4j.error("Error while generating build structure file", e);
}
}
开发者ID:mauyr,项目名称:openbravo-brazil,代码行数:41,代码来源:TranslationManager.java
示例7: saveModel
import org.apache.commons.betwixt.io.BeanWriter; //导入依赖的package包/类
public static void saveModel(Model model, OutputStream out) throws Exception {
BeanWriter writer = new BeanWriter(out);
writer.getXMLIntrospector().getConfiguration().setAttributesForPrimitives(
true);
writer.enablePrettyPrint();
writer.getBindingConfiguration().setMapIDs(true);
writer.getXMLIntrospector().getConfiguration().setAttributeNameMapper(
new HyphenatedNameMapper());
writer.getXMLIntrospector().getConfiguration().setElementNameMapper(
new DecapitalizeNameMapper());
// write out the bean
writer.write(model);
System.out.println("");
}
开发者ID:unsftn,项目名称:bisis-v4,代码行数:16,代码来源:ModelFactory.java
示例8: convertReportParamsToXml
import org.apache.commons.betwixt.io.BeanWriter; //导入依赖的package包/类
public static String convertReportParamsToXml(ReportParams reportParams) throws Exception {
String xml = null;
StringWriter outputWriter = null;
try{
outputWriter = new StringWriter();
outputWriter.write("<?xml version='1.0' ?>");
BeanWriter beanWriter = getBeanWriter(outputWriter);
beanWriter.write("ReportParams", reportParams);
xml = outputWriter.toString();
}finally{
outputWriter.close();
}
return xml;
}
开发者ID:sakaiproject,项目名称:sakai,代码行数:15,代码来源:DigesterUtil.java
示例9: convertReportDefsToXml
import org.apache.commons.betwixt.io.BeanWriter; //导入依赖的package包/类
public static String convertReportDefsToXml(List<ReportDef> reportDef) throws Exception {
String xml = null;
StringWriter outputWriter = null;
try{
outputWriter = new StringWriter();
outputWriter.write("<?xml version='1.0' ?>");
BeanWriter beanWriter = getBeanWriter(outputWriter);
beanWriter.write("List", reportDef);
xml = outputWriter.toString();
}finally{
outputWriter.close();
}
return xml;
}
开发者ID:sakaiproject,项目名称:sakai,代码行数:15,代码来源:DigesterUtil.java
示例10: getBeanWriter
import org.apache.commons.betwixt.io.BeanWriter; //导入依赖的package包/类
private static BeanWriter getBeanWriter(final StringWriter outputWriter) {
BeanWriter beanWriter = new BeanWriter(outputWriter);
beanWriter.getXMLIntrospector().getConfiguration().setAttributesForPrimitives(false);
beanWriter.getBindingConfiguration().setMapIDs(false);
beanWriter.getBindingConfiguration().setValueSuppressionStrategy(new NullEmptyValueSuppressionStrategy());
beanWriter.getBindingConfiguration().setObjectStringConverter(new SitestatsObjectStringConverter());
beanWriter.setEndOfLine("");
return beanWriter;
}
开发者ID:sakaiproject,项目名称:sakai,代码行数:10,代码来源:DigesterUtil.java
示例11: write
import org.apache.commons.betwixt.io.BeanWriter; //导入依赖的package包/类
/**
* Internal method that writes the database model using the given bean writer.
*
* @param model The database model
* @param writer The bean writer
*/
private void write(Database model, BeanWriter writer) throws DdlUtilsException
{
try
{
writer.writeXmlDeclaration("<?xml version=\"1.0\"?>\n<!DOCTYPE database SYSTEM \"" + LocalEntityResolver.DTD_PREFIX + "\">");
writer.write(model);
}
catch (Exception ex)
{
throw new DdlUtilsException(ex);
}
}
开发者ID:flex-rental-solutions,项目名称:apache-ddlutils,代码行数:19,代码来源:DatabaseIO.java
示例12: configure
import org.apache.commons.betwixt.io.BeanWriter; //导入依赖的package包/类
public static void configure(BeanWriter beanWriter) {
configure(beanWriter.getBindingConfiguration());
configure(beanWriter.getXMLIntrospector().getConfiguration());
beanWriter.enablePrettyPrint();
}
开发者ID:GovernIB,项目名称:sistra,代码行数:6,代码来源:Configurator.java
示例13: execute
import org.apache.commons.betwixt.io.BeanWriter; //导入依赖的package包/类
public ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest request,
HttpServletResponse response) throws Exception {
FormularioDelegate delegate = DelegateUtil.getFormularioDelegate();
Long idForm = new Long(request.getParameter("idForm"));
if( Boolean.valueOf( DelegateUtil.getConfiguracionDelegate().obtenerConfiguracion().getProperty("habilitar.permisos")).booleanValue()){
GruposDelegate gruposDelegate = DelegateUtil.getGruposDelegate();
if( !(gruposDelegate.existeUsuarioByGruposForm(request.getUserPrincipal().getName(),idForm)
|| gruposDelegate.existeUsuarioByForm(request.getUserPrincipal().getName(),idForm)
))
{
request.setAttribute("message","No tiene permisos para exportar este formulario");
return mapping.findForward("fail");
}
}
Formulario formulario = delegate.obtenerFormularioCompleto(idForm);
formulario.setFechaExportacion(new Date());
try{
modificarScriptsB64(formulario);
}catch(Exception ex){
ActionErrors errors = new ActionErrors();
errors.add("version", new ActionError("errors.exportacion.saltoLineasScripts"));
saveErrors(request, errors);
return mapping.findForward("fail");
}
// No generamos info de bloqueo
formulario.setBloqueado(false);
formulario.setBloqueadoPor(null);
/* INDRA: CONTROL ELEMENTOS CON XPATHS DUPLICADOS */
String generarDuplicados = request.getParameter("generarDuplicados");
if (StringUtils.isEmpty(generarDuplicados)) {
List duplicados = Util.controlXpathDuplicados(formulario);
if (duplicados.size() > 0){
request.setAttribute("idForm",idForm);
request.setAttribute("duplicados",duplicados);
return mapping.findForward("controlDuplicados");
}
}else{
if (generarDuplicados.equals("N")){
return mapping.findForward("fail");
}
}
/* INDRA: CONTROL ELEMENTOS CON XPATHS DUPLICADOS */
/* INDRA: BUG EXPORTACION - NOS ASEGURAMOS QUE LAS VALIDACIONES TENGAN PROPIEDADES NO NULAS PARA ASEGURAR QUE SE EXPORTA EL VALOR */
for (Iterator it = formulario.getPantallas().iterator();it.hasNext();){
Pantalla p = (Pantalla) it.next();
for (Iterator it2 = p.getCampos().iterator();it2.hasNext();){
Campo c = (Campo) it2.next();
for (Iterator it3 = c.getValidaciones().iterator();it3.hasNext();){
Validacion v = (Validacion) it3.next();
String [] valores = v.getValores();
for (int i=0;i<valores.length;i++){
if (valores[i] == null) valores[i]="";
}
v.setValores(valores);
}
}
}
/* INDRA: BUG EXPORTACION - NOS ASEGURAMOS QUE LAS VALIDACIONES TENGAN PROPIEDADES NO NULAS */
ByteArrayOutputStream bos = new ByteArrayOutputStream(8192);
BeanWriter beanWriter = new BeanWriter(bos, "UTF-8");
beanWriter.writeXmlDeclaration("<?xml version=\"1.0\" encoding=\"UTF-8\" ?>");
Configurator.configure(beanWriter);
beanWriter.write(formulario);
beanWriter.close();
String nombreFic = "form-" + formulario.getModelo() + ".xml";
byte[] contentFic = bos.toByteArray();
bos.close();
// Devolvemos XML
request.setAttribute( org.ibit.rol.form.back.Constants.NOMBREFICHERO_KEY, nombreFic );
request.setAttribute( org.ibit.rol.form.back.Constants.DATOSFICHERO_KEY, contentFic );
return mapping.findForward( "success" );
}
开发者ID:GovernIB,项目名称:sistra,代码行数:80,代码来源:GenerarXMLAction.java
注:本文中的org.apache.commons.betwixt.io.BeanWriter类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论