import fr.gouv.minefi.cp.helios.pes_v2.facture.r0.aller.TPESFacture;
import fr.gouv.minefi.cp.helios.pes_v2.facture.r0.aller.TPESFactureOld;
import fr.gouv.minefi.cp.helios.pes_v2.rev0.aller.PESAller;
+import org.apache.commons.io.FilenameUtils;
/**
* Etape de sélection du fichier PES à analyser
int response = chooseFileDialog.showDialog(getWizardProcess().getWizardDialog(), "Enregistrer");
if (response == JFileChooser.APPROVE_OPTION) {
- this.referenceComptablePanelUI.setBusy(true);
- pesPjFile = chooseFileDialog.getSelectedFile();
- PESAller pesAller = getWizardProcess().getPesAller();
- if(factureObj != null){
- pesAller.setPESFacture(factureObj);
- }
- pesAller.setPESPJ(GeneratePesUtils.generatePesPj(pesAller, getWizardProcess().getPjStep().getPjs()));
-
+ this.referenceComptablePanelUI.setBusy(true);
try{
+ pesPjFile = chooseFileDialog.getSelectedFile();
+
+ if(!FilenameUtils.isExtension(pesPjFile.getName(), "xml")){
+ pesPjFile = new File(pesPjFile.getAbsolutePath()+".xml");
+ if(!pesPjFile.exists()){
+ pesPjFile.createNewFile();
+ }
+ }
+
+ PESAller pesAller = getWizardProcess().getPesAller();
+ if(factureObj != null){
+ pesAller.setPESFacture(factureObj);
+ }
+ pesAller.setPESPJ(GeneratePesUtils.generatePesPj(pesAller, getWizardProcess().getPjStep().getPjs()));
+
FileOutputStream fos = new FileOutputStream(pesPjFile);
// Génration du flux XML
try {