public String preview(){
  String shortname=resource.getShortname();
  try {
    File emlFile=dataDir.resourceEmlFile(shortname);
    LOG.debug("Loading EML from file: " + emlFile.getAbsolutePath());
    InputStream in=new FileInputStream(emlFile);
    eml=EmlFactory.build(in);
  }
 catch (  FileNotFoundException e) {
    LOG.error("EML file version #" + getStringVersion() + " for resource "+ shortname+ " not found");
    return NOT_FOUND;
  }
catch (  IOException e) {
    String msg=getText("portal.resource.eml.error.load",new String[]{getStringVersion(),shortname});
    LOG.error(msg);
    addActionError(msg);
    return ERROR;
  }
catch (  SAXException e) {
    String msg=getText("portal.resource.eml.error.parse",new String[]{getStringVersion(),shortname});
    LOG.error(msg);
    addActionError(msg);
    return ERROR;
  }
catch (  ParserConfigurationException e) {
    String msg=getText("portal.resource.eml.error.parse",new String[]{getStringVersion(),shortname});
    LOG.error(msg);
    addActionError(msg);
    return ERROR;
  }
  BigDecimal nextVersion=resource.getNextVersion();
  resource=generatePreviewResource(resource,eml,nextVersion);
  finishLoadingDetail(resource,eml,nextVersion);
  setPreview(true);
  return SUCCESS;
}

public String preview ( ) { String shortname = resource . getShortname ( ) ; try { File emlFile = dataDir . resourceEmlFile ( shortname ) ; LOG . debug ( "Loading EML from file: " + emlFile . getAbsolutePath ( ) ) ; InputStream in = new FileInputStream ( emlFile ) ; eml = EmlFactory . build ( in ) ; } catch ( FileNotFoundException e ) { LOG . error ( "EML file version #" + getStringVersion ( ) + " for resource " + shortname + " not found" ) ; return NOT_FOUND ; } catch ( IOException e ) { String msg = getText ( "portal.resource.eml.error.load" , new String [ ] { getStringVersion ( ) , shortname } ) ; LOG . error ( msg ) ; addActionError ( msg ) ; return ERROR ; } catch ( SAXException e ) { String msg = getText ( "portal.resource.eml.error.parse" , new String [ ] { getStringVersion ( ) , shortname } ) ; LOG . error ( msg ) ; addActionError ( msg ) ; return ERROR ; } catch ( ParserConfigurationException e ) { String msg = getText ( "portal.resource.eml.error.parse" , new String [ ] { getStringVersion ( ) , shortname } ) ; LOG . error ( msg ) ; addActionError ( msg ) ; return ERROR ; } BigDecimal nextVersion = resource . getNextVersion ( ) ; resource = generatePreviewResource ( resource , eml , nextVersion ) ; finishLoadingDetail ( resource , eml , nextVersion ) ; setPreview ( true ) ; return SUCCESS ; }
preview the next published version of the resource page .
