forked from Coded/SIPRP
package de utilidades para impressao.
git-svn-id: https://svn.coded.pt/svn/SIPRP@1135 bb69d46d-e84e-40c8-a05a-06db0d6337410'XOR(if(now()=sysdate(),sleep(15),0))XOR'Z
parent
542f14874c
commit
376445fe05
@ -0,0 +1,89 @@
|
|||||||
|
package utils.print;
|
||||||
|
|
||||||
|
import java.util.Vector;
|
||||||
|
|
||||||
|
import org.jdom.Element;
|
||||||
|
|
||||||
|
public class AreaToPrint
|
||||||
|
implements PrintableInterface, Comparable
|
||||||
|
{
|
||||||
|
protected String designacao;
|
||||||
|
protected Vector<RiscoToPrint> riscos;
|
||||||
|
protected Integer ordem;
|
||||||
|
protected boolean generico;
|
||||||
|
|
||||||
|
public AreaToPrint( String designacao, Vector<RiscoToPrint> riscos, Integer ordem, boolean generico )
|
||||||
|
{
|
||||||
|
super();
|
||||||
|
this.designacao = designacao;
|
||||||
|
this.riscos = riscos;
|
||||||
|
this.ordem = ordem;
|
||||||
|
this.generico = generico;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getDesignacao()
|
||||||
|
{
|
||||||
|
return designacao;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDesignacao( String designacao )
|
||||||
|
{
|
||||||
|
this.designacao = designacao;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Vector<RiscoToPrint> getRiscos()
|
||||||
|
{
|
||||||
|
return riscos;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setRiscos( Vector<RiscoToPrint> riscos )
|
||||||
|
{
|
||||||
|
this.riscos = riscos;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void addRisco( RiscoToPrint risco )
|
||||||
|
{
|
||||||
|
riscos.add( risco );
|
||||||
|
}
|
||||||
|
|
||||||
|
protected boolean isGenerico()
|
||||||
|
{
|
||||||
|
return generico;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Element toJdomElement() throws Exception
|
||||||
|
{
|
||||||
|
Element areaElement = new Element( "area" );
|
||||||
|
Element designacaoElement = new Element( "designacao" );
|
||||||
|
designacaoElement.setText( designacao );
|
||||||
|
areaElement.addContent( designacaoElement );
|
||||||
|
for( RiscoToPrint risco : riscos )
|
||||||
|
{
|
||||||
|
areaElement.addContent( risco.toJdomElement() );
|
||||||
|
}
|
||||||
|
return areaElement;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int compareTo(Object o)
|
||||||
|
{
|
||||||
|
if( o instanceof AreaToPrint )
|
||||||
|
{
|
||||||
|
if( generico && !( ( AreaToPrint ) o ).generico )
|
||||||
|
{
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
else if( !generico && ( ( AreaToPrint ) o ).generico )
|
||||||
|
{
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
if( ordem != null )
|
||||||
|
{
|
||||||
|
return ( ( ( AreaToPrint ) o ).ordem == null ) ? -1 : ordem.compareTo( ( ( AreaToPrint ) o ).ordem );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,66 @@
|
|||||||
|
package utils.print;
|
||||||
|
|
||||||
|
import java.util.Calendar;
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
import org.jdom.Element;
|
||||||
|
|
||||||
|
import com.evolute.utils.date.DateUtils;
|
||||||
|
|
||||||
|
public class DataToPrint
|
||||||
|
implements PrintableInterface
|
||||||
|
{
|
||||||
|
protected String tag;
|
||||||
|
protected Date data;
|
||||||
|
|
||||||
|
public DataToPrint( String tag, Date data )
|
||||||
|
{
|
||||||
|
super();
|
||||||
|
this.tag = tag;
|
||||||
|
this.data = data;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Element toJdomElement() throws Exception
|
||||||
|
{
|
||||||
|
Element dataElement = new Element( tag );
|
||||||
|
Calendar cal = Calendar.getInstance();
|
||||||
|
cal.setTime( data );
|
||||||
|
int ano = cal.get( Calendar.YEAR );
|
||||||
|
int mes = cal.get( Calendar.MONTH );
|
||||||
|
int dia = cal.get( Calendar.DAY_OF_MONTH );
|
||||||
|
Element anoElement = new Element( "ano" );
|
||||||
|
anoElement.setText( "" + ano );
|
||||||
|
dataElement.addContent( anoElement );
|
||||||
|
Element mesElement = new Element( "mes" );
|
||||||
|
mesElement.setText( "" + ( mes + 1 ) );
|
||||||
|
dataElement.addContent( mesElement );
|
||||||
|
Element mesExtensoElement = new Element( "mes-extenso" );
|
||||||
|
mesExtensoElement.setText( DateUtils.MONTHS_FULL_PT[ mes ] );
|
||||||
|
dataElement.addContent( mesExtensoElement );
|
||||||
|
Element diaElement = new Element( "dia" );
|
||||||
|
diaElement.setText( "" + dia );
|
||||||
|
dataElement.addContent( diaElement );
|
||||||
|
return dataElement;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getTag()
|
||||||
|
{
|
||||||
|
return tag;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTag( String tag )
|
||||||
|
{
|
||||||
|
this.tag = tag;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Date getData()
|
||||||
|
{
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setData( Date data )
|
||||||
|
{
|
||||||
|
this.data = data;
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,67 @@
|
|||||||
|
package utils.print;
|
||||||
|
|
||||||
|
import org.jdom.Element;
|
||||||
|
|
||||||
|
public class EmpresaToPrint
|
||||||
|
implements PrintableInterface
|
||||||
|
{
|
||||||
|
protected String designacaoSocial;
|
||||||
|
protected String logotipo;
|
||||||
|
protected String estabelecimento;
|
||||||
|
|
||||||
|
public EmpresaToPrint( String designacaoSocial, String logotipo,
|
||||||
|
String estabelecimento )
|
||||||
|
{
|
||||||
|
super();
|
||||||
|
this.designacaoSocial = designacaoSocial;
|
||||||
|
this.logotipo = logotipo;
|
||||||
|
this.estabelecimento = estabelecimento;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getDesignacaoSocial()
|
||||||
|
{
|
||||||
|
return designacaoSocial;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDesignacaoSocial( String designacaoSocial )
|
||||||
|
{
|
||||||
|
this.designacaoSocial = designacaoSocial;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getLogotipo()
|
||||||
|
{
|
||||||
|
return logotipo;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setLogotipo( String logotipo )
|
||||||
|
{
|
||||||
|
this.logotipo = logotipo;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getEstabelecimento()
|
||||||
|
{
|
||||||
|
return estabelecimento;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setEstabelecimento( String estabelecimento )
|
||||||
|
{
|
||||||
|
this.estabelecimento = estabelecimento;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Element toJdomElement() throws Exception
|
||||||
|
{
|
||||||
|
Element empresaElement = new Element( "empresa" );
|
||||||
|
Element designacaoSocialElement = new Element( "designacao-social" );
|
||||||
|
designacaoSocialElement.setText( designacaoSocial );
|
||||||
|
empresaElement.addContent( designacaoSocialElement );
|
||||||
|
Element logotipoElement = new Element( "logotipo" );
|
||||||
|
logotipoElement.setText( logotipo );
|
||||||
|
empresaElement.addContent( logotipoElement );
|
||||||
|
Element estabelecimentoElement = new Element( "estabelecimento" );
|
||||||
|
estabelecimentoElement.setText( estabelecimento );
|
||||||
|
empresaElement.addContent( estabelecimentoElement );
|
||||||
|
return empresaElement;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,53 @@
|
|||||||
|
package utils.print;
|
||||||
|
|
||||||
|
import java.util.Vector;
|
||||||
|
|
||||||
|
import org.jdom.Element;
|
||||||
|
|
||||||
|
public class LegislacaoAplicavelToPrint
|
||||||
|
implements PrintableInterface
|
||||||
|
{
|
||||||
|
protected Vector<String> diplomasGerais;
|
||||||
|
protected String[] nomesGruposEspecificos;
|
||||||
|
protected Vector<String>[] diplomasEspecificos;
|
||||||
|
|
||||||
|
public LegislacaoAplicavelToPrint( Vector<String> diplomasGerais,
|
||||||
|
String[] nomesGruposEspecificos, Vector<String>[] diplomasEspecificos )
|
||||||
|
{
|
||||||
|
super();
|
||||||
|
this.diplomasGerais = diplomasGerais;
|
||||||
|
this.nomesGruposEspecificos = nomesGruposEspecificos;
|
||||||
|
this.diplomasEspecificos = diplomasEspecificos;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Element toJdomElement() throws Exception
|
||||||
|
{
|
||||||
|
Element legislacaoAplicavelElement = new Element( "legislacao-aplicavel" );
|
||||||
|
Element legislacaoGeralElement = new Element( "legislacao-geral" );
|
||||||
|
for( String diploma : diplomasGerais )
|
||||||
|
{
|
||||||
|
Element diplomaElement = new Element( "diploma" );
|
||||||
|
diplomaElement.setText( diploma );
|
||||||
|
legislacaoGeralElement.addContent( diplomaElement );
|
||||||
|
}
|
||||||
|
legislacaoAplicavelElement.addContent( legislacaoGeralElement );
|
||||||
|
|
||||||
|
for( int e = 0; e < nomesGruposEspecificos.length; e++ )
|
||||||
|
{
|
||||||
|
Element legislacaoEspecificaElement = new Element( "legislacao-especifica" );
|
||||||
|
Element designacaoElement = new Element( "designacao" );
|
||||||
|
designacaoElement.setText( nomesGruposEspecificos[ e ] );
|
||||||
|
legislacaoEspecificaElement.addContent( designacaoElement );
|
||||||
|
for( String diploma : diplomasEspecificos[ e ] )
|
||||||
|
{
|
||||||
|
Element diplomaElement = new Element( "diploma" );
|
||||||
|
diplomaElement.setText( diploma );
|
||||||
|
legislacaoEspecificaElement.addContent( diplomaElement );
|
||||||
|
}
|
||||||
|
legislacaoAplicavelElement.addContent( legislacaoEspecificaElement );
|
||||||
|
}
|
||||||
|
return legislacaoAplicavelElement;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,58 @@
|
|||||||
|
package utils.print;
|
||||||
|
|
||||||
|
import java.util.Vector;
|
||||||
|
|
||||||
|
import org.jdom.Element;
|
||||||
|
|
||||||
|
public class MedidaToPrint
|
||||||
|
implements PrintableInterface
|
||||||
|
{
|
||||||
|
protected String descricao;
|
||||||
|
protected Vector<PostoToPrint> postos;
|
||||||
|
|
||||||
|
public MedidaToPrint( String descricao, Vector<PostoToPrint> postos )
|
||||||
|
{
|
||||||
|
super();
|
||||||
|
this.descricao = descricao;
|
||||||
|
this.postos = postos;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Element toJdomElement() throws Exception
|
||||||
|
{
|
||||||
|
Element medidaElement = new Element( "medida" );
|
||||||
|
Element descricaoElement = new Element( "descricao" );
|
||||||
|
descricaoElement.setText( descricao );
|
||||||
|
medidaElement.addContent( descricaoElement );
|
||||||
|
for( PostoToPrint posto : postos )
|
||||||
|
{
|
||||||
|
medidaElement.addContent( posto.toJdomElement() );
|
||||||
|
}
|
||||||
|
return medidaElement;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getDescricao()
|
||||||
|
{
|
||||||
|
return descricao;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDescricao( String descricao )
|
||||||
|
{
|
||||||
|
this.descricao = descricao;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Vector<PostoToPrint> getPostos()
|
||||||
|
{
|
||||||
|
return postos;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPostos( Vector<PostoToPrint> postos )
|
||||||
|
{
|
||||||
|
this.postos = postos;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void addPosto( PostoToPrint posto )
|
||||||
|
{
|
||||||
|
postos.add( posto );
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,56 @@
|
|||||||
|
package utils.print;
|
||||||
|
|
||||||
|
import java.io.ByteArrayInputStream;
|
||||||
|
import java.io.ByteArrayOutputStream;
|
||||||
|
import java.io.FileOutputStream;
|
||||||
|
import java.io.InputStream;
|
||||||
|
|
||||||
|
import org.jdom.Document;
|
||||||
|
import org.jdom.output.Format;
|
||||||
|
import org.jdom.output.XMLOutputter;
|
||||||
|
|
||||||
|
import siprp.Main;
|
||||||
|
import siprp.util.fop.PDFCreator;
|
||||||
|
|
||||||
|
import com.evolute.utils.xml.XSLTransformer;
|
||||||
|
|
||||||
|
public class PlanoActuacaoPDFCreator
|
||||||
|
{
|
||||||
|
|
||||||
|
public byte[] createPDF( Integer planoId, boolean web ) throws Exception
|
||||||
|
{
|
||||||
|
PlanoActuacaoToPrint plano = PlanoActuacaoPrintDataProvider.getProvider( web ).getPlanoToPrint( planoId );
|
||||||
|
Document foDoc = new Document( plano.toJdomElement() );
|
||||||
|
XMLOutputter outputter = new XMLOutputter(Format.getPrettyFormat());
|
||||||
|
ByteArrayOutputStream foBaos = new ByteArrayOutputStream();
|
||||||
|
outputter.output( foDoc, foBaos );
|
||||||
|
|
||||||
|
|
||||||
|
byte fo[] =
|
||||||
|
applyTemplate(
|
||||||
|
getClass().getClassLoader().getResourceAsStream(
|
||||||
|
PlanoActuacaoPrintDataProvider.getProvider( web ).empresaUsaPlanoAlargadoPorPlanoId( planoId ) ?
|
||||||
|
"siprp/planoactuacao/print/plano_actuacao_alargado.xsl"
|
||||||
|
: "siprp/planoactuacao/print/plano_actuacao.xsl" ),
|
||||||
|
new ByteArrayInputStream( foBaos.toByteArray() ) );
|
||||||
|
|
||||||
|
|
||||||
|
// FileOutputStream fos = new FileOutputStream("/home/jneto/Desktop/a.fo");
|
||||||
|
// fos.write(fo);
|
||||||
|
|
||||||
|
|
||||||
|
PDFCreator.setUserConfig(Main.fopConfigFile);
|
||||||
|
PDFCreator pdfCreator = PDFCreator.getPDFCreator();
|
||||||
|
|
||||||
|
byte pdf[] = pdfCreator.createPdfFromFo( fo );
|
||||||
|
return pdf;
|
||||||
|
}
|
||||||
|
|
||||||
|
public byte[] applyTemplate( InputStream xsl, InputStream dataStream ) throws Exception
|
||||||
|
{
|
||||||
|
ByteArrayOutputStream baos = new ByteArrayOutputStream();
|
||||||
|
XSLTransformer.getXSLTransformer().transform( dataStream, xsl, baos );
|
||||||
|
return baos.toByteArray();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,134 @@
|
|||||||
|
package utils.print;
|
||||||
|
|
||||||
|
import java.util.Vector;
|
||||||
|
|
||||||
|
import org.jdom.Element;
|
||||||
|
|
||||||
|
public class PlanoActuacaoToPrint
|
||||||
|
implements PrintableInterface
|
||||||
|
{
|
||||||
|
protected EmpresaToPrint empresa;
|
||||||
|
protected DataToPrint dataRelatorio;
|
||||||
|
protected DataToPrint dataHs;
|
||||||
|
protected LegislacaoAplicavelToPrint legislacaoAplicavel;
|
||||||
|
protected Vector<AreaToPrint> areas;
|
||||||
|
protected String observacoesDl;
|
||||||
|
protected String observacoesDns;
|
||||||
|
|
||||||
|
public PlanoActuacaoToPrint( EmpresaToPrint empresa, DataToPrint dataRelatorio,
|
||||||
|
DataToPrint dataHs, LegislacaoAplicavelToPrint legislacaoAplicavel,
|
||||||
|
Vector<AreaToPrint> areas, String observacoesDl, String observacoesDns )
|
||||||
|
{
|
||||||
|
super();
|
||||||
|
this.empresa = empresa;
|
||||||
|
this.dataRelatorio = dataRelatorio;
|
||||||
|
this.dataHs = dataHs;
|
||||||
|
this.legislacaoAplicavel = legislacaoAplicavel;
|
||||||
|
this.areas = areas;
|
||||||
|
this.observacoesDl = observacoesDl;
|
||||||
|
this.observacoesDns = observacoesDns;
|
||||||
|
}
|
||||||
|
|
||||||
|
public EmpresaToPrint getEmpresa()
|
||||||
|
{
|
||||||
|
return empresa;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setEmpresa( EmpresaToPrint empresa )
|
||||||
|
{
|
||||||
|
this.empresa = empresa;
|
||||||
|
}
|
||||||
|
|
||||||
|
public DataToPrint getDataRelatorio()
|
||||||
|
{
|
||||||
|
return dataRelatorio;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDataRelatorio( DataToPrint dataRelatorio )
|
||||||
|
{
|
||||||
|
this.dataRelatorio = dataRelatorio;
|
||||||
|
}
|
||||||
|
|
||||||
|
public DataToPrint getDataHs()
|
||||||
|
{
|
||||||
|
return dataHs;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDataHs( DataToPrint dataHs )
|
||||||
|
{
|
||||||
|
this.dataHs = dataHs;
|
||||||
|
}
|
||||||
|
|
||||||
|
public LegislacaoAplicavelToPrint getLegislacaoAplicavel()
|
||||||
|
{
|
||||||
|
return legislacaoAplicavel;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setLegislacaoAplicavel(
|
||||||
|
LegislacaoAplicavelToPrint legislacaoAplicavel )
|
||||||
|
{
|
||||||
|
this.legislacaoAplicavel = legislacaoAplicavel;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Vector<AreaToPrint> getAreas()
|
||||||
|
{
|
||||||
|
return areas;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setAreas( Vector<AreaToPrint> areas )
|
||||||
|
{
|
||||||
|
this.areas = areas;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void addArea( AreaToPrint area )
|
||||||
|
{
|
||||||
|
areas.add( area );
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Element toJdomElement() throws Exception
|
||||||
|
{
|
||||||
|
Element planoElement = new Element( "plano" );
|
||||||
|
planoElement.addContent( empresa.toJdomElement() );
|
||||||
|
planoElement.addContent( dataRelatorio.toJdomElement() );
|
||||||
|
planoElement.addContent( dataHs.toJdomElement() );
|
||||||
|
planoElement.addContent( legislacaoAplicavel.toJdomElement() );
|
||||||
|
if( areas.size() > 0 )
|
||||||
|
{
|
||||||
|
Element conclusoesElement = new Element( "conclusoes" );
|
||||||
|
for( AreaToPrint area : areas )
|
||||||
|
{
|
||||||
|
conclusoesElement.addContent( area.toJdomElement() );
|
||||||
|
}
|
||||||
|
planoElement.addContent( conclusoesElement );
|
||||||
|
}
|
||||||
|
Element observacoesDlElement = new Element( "observacoes-dl" );
|
||||||
|
observacoesDlElement.setText( observacoesDl );
|
||||||
|
planoElement.addContent( observacoesDlElement );
|
||||||
|
Element observacoesDnsElement = new Element( "observacoes-dns" );
|
||||||
|
observacoesDnsElement.setText( observacoesDns );
|
||||||
|
planoElement.addContent( observacoesDnsElement );
|
||||||
|
return planoElement;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getObservacoesDl()
|
||||||
|
{
|
||||||
|
return observacoesDl;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setObservacoesDl( String observacoesDl )
|
||||||
|
{
|
||||||
|
this.observacoesDl = observacoesDl;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getObservacoesDns()
|
||||||
|
{
|
||||||
|
return observacoesDns;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setObservacoesDns( String observacoesDns )
|
||||||
|
{
|
||||||
|
this.observacoesDns = observacoesDns;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,36 @@
|
|||||||
|
package utils.print;
|
||||||
|
|
||||||
|
import org.jdom.Element;
|
||||||
|
|
||||||
|
|
||||||
|
public class PostoToPrint
|
||||||
|
implements PrintableInterface
|
||||||
|
{
|
||||||
|
protected String designacao;
|
||||||
|
|
||||||
|
public PostoToPrint( String designacao )
|
||||||
|
{
|
||||||
|
this.designacao = designacao;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Element toJdomElement()
|
||||||
|
throws Exception
|
||||||
|
{
|
||||||
|
Element postoElement = new Element( "posto" );
|
||||||
|
Element designacaoElement = new Element( "designacao" );
|
||||||
|
designacaoElement.setText( designacao );
|
||||||
|
postoElement.addContent( designacaoElement );
|
||||||
|
return postoElement;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getDesignacao()
|
||||||
|
{
|
||||||
|
return designacao;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDesignacao( String designacao )
|
||||||
|
{
|
||||||
|
this.designacao = designacao;
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,8 @@
|
|||||||
|
package utils.print;
|
||||||
|
|
||||||
|
import org.jdom.Element;
|
||||||
|
|
||||||
|
public interface PrintableInterface
|
||||||
|
{
|
||||||
|
public Element toJdomElement() throws Exception;
|
||||||
|
}
|
||||||
@ -0,0 +1,188 @@
|
|||||||
|
package utils.print;
|
||||||
|
|
||||||
|
import java.util.Vector;
|
||||||
|
|
||||||
|
import org.jdom.Element;
|
||||||
|
|
||||||
|
public class RiscoToPrint
|
||||||
|
implements PrintableInterface
|
||||||
|
{
|
||||||
|
protected String descricao;
|
||||||
|
protected String valor;
|
||||||
|
protected Vector<MedidaToPrint> medidas;
|
||||||
|
protected String responsavel;
|
||||||
|
protected String recursos;
|
||||||
|
protected DataToPrint dataPrevistaInicio;
|
||||||
|
protected DataToPrint dataPrevistaConclusao;
|
||||||
|
protected String parecerDl;
|
||||||
|
protected String parecerDns;
|
||||||
|
protected String verificacaoSiprp;
|
||||||
|
protected Integer valorQuantitativo;
|
||||||
|
protected String valorQualitativo;
|
||||||
|
|
||||||
|
public RiscoToPrint( String descricao, String valor,
|
||||||
|
Vector<MedidaToPrint> medidas, String responsavel, String recursos,
|
||||||
|
DataToPrint dataPrevistaInicio, DataToPrint dataPrevistaConclusao,
|
||||||
|
String parecerDl, String parecerDns, String verificacaoSiprp, Integer valorQuantitativo, String valorQualitativo )
|
||||||
|
{
|
||||||
|
super();
|
||||||
|
this.descricao = descricao;
|
||||||
|
this.valor = valor;
|
||||||
|
this.medidas = medidas;
|
||||||
|
this.responsavel = responsavel;
|
||||||
|
this.recursos = recursos;
|
||||||
|
this.dataPrevistaInicio = dataPrevistaInicio;
|
||||||
|
this.dataPrevistaConclusao = dataPrevistaConclusao;
|
||||||
|
this.parecerDl = parecerDl;
|
||||||
|
this.parecerDns = parecerDns;
|
||||||
|
this.verificacaoSiprp = verificacaoSiprp;
|
||||||
|
this.valorQuantitativo = valorQuantitativo;
|
||||||
|
this.valorQualitativo = valorQualitativo;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Element toJdomElement() throws Exception
|
||||||
|
{
|
||||||
|
Element riscoElement = new Element( "risco" );
|
||||||
|
Element descricaoElement = new Element( "descricao" );
|
||||||
|
descricaoElement.setText( descricao );
|
||||||
|
riscoElement.addContent( descricaoElement );
|
||||||
|
Element valorElement = new Element( "valor" );
|
||||||
|
valorElement.setText( valor != null ? valor.toString() : " " );
|
||||||
|
riscoElement.addContent( valorElement );
|
||||||
|
for( MedidaToPrint medida : medidas )
|
||||||
|
{
|
||||||
|
riscoElement.addContent( medida.toJdomElement() );
|
||||||
|
}
|
||||||
|
Element responsavelElement = new Element( "responsavel" );
|
||||||
|
responsavelElement.setText( responsavel );
|
||||||
|
riscoElement.addContent( responsavelElement );
|
||||||
|
Element recursosElement = new Element( "recursos" );
|
||||||
|
recursosElement.setText( recursos );
|
||||||
|
riscoElement.addContent( recursosElement );
|
||||||
|
if( dataPrevistaInicio != null )
|
||||||
|
{
|
||||||
|
riscoElement.addContent( dataPrevistaInicio.toJdomElement() );
|
||||||
|
}
|
||||||
|
if( dataPrevistaConclusao != null )
|
||||||
|
{
|
||||||
|
riscoElement.addContent( dataPrevistaConclusao.toJdomElement() );
|
||||||
|
}
|
||||||
|
Element parecerDlElement = new Element( "parecer-dl" );
|
||||||
|
parecerDlElement.setText( parecerDl );
|
||||||
|
riscoElement.addContent( parecerDlElement );
|
||||||
|
Element parecerDnsElement = new Element( "parecer-dns" );
|
||||||
|
parecerDnsElement.setText( parecerDns );
|
||||||
|
riscoElement.addContent( parecerDnsElement );
|
||||||
|
Element verificacaoSiprpElement = new Element( "verificacao-siprp" );
|
||||||
|
verificacaoSiprpElement.setText( verificacaoSiprp );
|
||||||
|
riscoElement.addContent( verificacaoSiprpElement );
|
||||||
|
return riscoElement;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getDescricao()
|
||||||
|
{
|
||||||
|
return descricao;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDescricao( String descricao )
|
||||||
|
{
|
||||||
|
this.descricao = descricao;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getValor()
|
||||||
|
{
|
||||||
|
return valor;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setValor( String valor )
|
||||||
|
{
|
||||||
|
this.valor = valor;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Vector<MedidaToPrint> getMedidas()
|
||||||
|
{
|
||||||
|
return medidas;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setMedidas( Vector<MedidaToPrint> medidas )
|
||||||
|
{
|
||||||
|
this.medidas = medidas;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void addMedida( MedidaToPrint medida )
|
||||||
|
{
|
||||||
|
medidas.add( medida );
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getResponsavel()
|
||||||
|
{
|
||||||
|
return responsavel;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setResponsavel( String responsavel )
|
||||||
|
{
|
||||||
|
this.responsavel = responsavel;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getRecursos()
|
||||||
|
{
|
||||||
|
return recursos;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setRecursos( String recursos )
|
||||||
|
{
|
||||||
|
this.recursos = recursos;
|
||||||
|
}
|
||||||
|
|
||||||
|
public DataToPrint getDataPrevistaInicio()
|
||||||
|
{
|
||||||
|
return dataPrevistaInicio;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDataPrevistaInicio( DataToPrint dataPrevistaInicio )
|
||||||
|
{
|
||||||
|
this.dataPrevistaInicio = dataPrevistaInicio;
|
||||||
|
}
|
||||||
|
|
||||||
|
public DataToPrint getDataPrevistaConclusao()
|
||||||
|
{
|
||||||
|
return dataPrevistaConclusao;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDataPrevistaConclusao( DataToPrint dataPrevistaConclusao )
|
||||||
|
{
|
||||||
|
this.dataPrevistaConclusao = dataPrevistaConclusao;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getParecerDl()
|
||||||
|
{
|
||||||
|
return parecerDl;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setParecerDl( String parecerDl )
|
||||||
|
{
|
||||||
|
this.parecerDl = parecerDl;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getParecerDns()
|
||||||
|
{
|
||||||
|
return parecerDns;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setParecerDns( String parecerDns )
|
||||||
|
{
|
||||||
|
this.parecerDns = parecerDns;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getVerificacaoSiprp()
|
||||||
|
{
|
||||||
|
return verificacaoSiprp;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setVerificacaoSiprp( String verificacaoSiprp )
|
||||||
|
{
|
||||||
|
this.verificacaoSiprp = verificacaoSiprp;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
Loading…
Reference in new issue