All Downloads are FREE. Search and download functionalities are using the official Maven repository.

fr.lixbox.io.edi.service.UnMarshaller Maven / Gradle / Ivy

The newest version!
/*******************************************************************************
 *    
 *                           FRAMEWORK Lixbox
 *                          ==================
 *      
 * This file is part of lixbox-io.
 *
 *    lixbox-supervision is free software: you can redistribute it and/or modify
 *    it under the terms of the GNU General Public License as published by
 *    the Free Software Foundation, either version 3 of the License, or
 *    (at your option) any later version.
 *
 *    lixbox-supervision is distributed in the hope that it will be useful,
 *    but WITHOUT ANY WARRANTY; without even the implied warranty of
 *    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *    GNU General Public License for more details.
 *
 *   You should have received a copy of the GNU General Public License
 *    along with lixbox-io.  If not, see 
 *   
 *   @AUTHOR Lixbox-team
 *
 ******************************************************************************/
package fr.lixbox.io.edi.service;

import java.io.Serializable;
import java.util.Calendar;

import fr.lixbox.common.exceptions.BusinessException;
import fr.lixbox.common.model.ConteneurEvenement;
import fr.lixbox.common.util.DateUtil;
import fr.lixbox.common.util.StringUtil;
import fr.lixbox.io.edi.model.Document;
import fr.lixbox.io.edi.model.Element;
import fr.lixbox.io.edi.model.Segment;
import fr.lixbox.io.edi.model.SegmentGroup;
import fr.lixbox.io.edi.ressource.EdiResources;



/**
 *  Cette classe genere une chaine EDI image du
 *  document JAVA
 *  
 *  @author ludovic.terral
 */
public class UnMarshaller implements Serializable
{  
    // ----------- Attribut -----------   
    private static final long serialVersionUID = 427614917256748743L;
    private Document doc;

    

    // ----------- Methode -----------
    public UnMarshaller(Document doc)
    {
        super();
        this.doc = doc;
    }
     
    

    /**
     * Cette methode permet de mapper un document EDI dans
     * les objets Java associes.
     * 
     * @return l'image du document EDI sous forme de chaine
     * 
     * @throws BusinessException 
     */
    public String unMarshall() throws BusinessException
    {
        StringBuilder sb = new StringBuilder();
        sb.append(representEnteDocumentToEdi(doc.getSyntaxType(),doc.getSyntaxVersion(),doc.getDocType(),
                doc.getDocVersion(),doc.getDocRelease(), doc.getDocAgency(),doc.getDateRedaction(),
                doc.getControl(),doc.getSender(),
                doc.getReceiver()));
        for (Integer i=0; i




© 2015 - 2024 Weber Informatics LLC | Privacy Policy