package com.k_int.webapp3;

import java.io.ByteArrayInputStream;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

import com.k_int.bank.service.dto.ImportReportDTO;
import com.k_int.webapp3.util.DTOToDoc;
import com.k_int.zthes.service.impl.ZThesServiceImpl;

public class CreateOrUpdateTermAction extends AbstractXmlOrHtmlAction {
  private static final long serialVersionUID = 1L;
  private final Log log = LogFactory.getLog(CreateOrUpdateVocabAction.class);
  private String xml;
  
  public void setXml(String xml) { this.xml = xml; }
  public String getXml()         { return xml;     }
  
  
  public String responseSpecificExecute() throws Exception {
    log.debug("Getting zthes service and running import");
    ZThesServiceImpl svc   = (ZThesServiceImpl) ctx.getBean("ZThesService");
    ImportReportDTO report = svc.importThesRevisionPart(new ByteArrayInputStream(xml.getBytes()));

    log.debug("Import done... getting results");
    doc = DTOToDoc.createReportDocument(report);

    return SUCCESS;
  }
}
