コード例 #1
0
  public void saveXml(XmlFile inFile, User inUser, Lock lock) throws OpenEditException {

    // Lock lock = getLockManager().lock("system", inFile.getPath(), null ); //this will retry 10
    // times then timeout and throw an exception

    Page page = getPageManager().getPage(inFile.getPath(), false);

    ContentItem tmp = getPageManager().getRepository().getStub(inFile.getPath() + ".tmp.xml");
    tmp.setMakeVersion(false);
    getXmlUtil().saveXml(inFile.getRoot(), tmp.getOutputStream(), page.getCharacterEncoding());

    ContentItem xmlcontent = getPageManager().getRepository().getStub(inFile.getPath());
    xmlcontent.setMakeVersion(false);
    getPageManager()
        .getRepository()
        .remove(xmlcontent); // might be a little faster to remove it first
    getPageManager().getRepository().move(tmp, xmlcontent);
    getPageManager().firePageModified(page);

    xmlcontent = getPageManager().getRepository().getStub(inFile.getPath());
    inFile.setLastModified(xmlcontent.getLastModified());
    inFile.setExist(true);
    // log.info("Save " + inFile.getPath());

  }
コード例 #2
0
 public long getLastModified(String inPath) throws OpenEditException {
   if (inPath.startsWith("/WEB-INF/data")) {
     ContentItem input = getPageManager().getRepository().get(inPath);
     return input.getLastModified();
   } else {
     return getPageManager().getPage(inPath).lastModified();
   }
 }