Package org.opencms.report

Examples of org.opencms.report.I_CmsReport


    super();
  }

  public void cmsEvent(CmsEvent event) {
    if (event.getType() == I_CmsEventListener.EVENT_PUBLISH_PROJECT) {
          I_CmsReport report = null;
          // CmsDbContext dbc;

      try {
        String exportUser = OpenCms.getDefaultUsers().getUserExport();
        CmsObject cms = OpenCms.initCmsObject(exportUser);

        CmsUUID projectId = (CmsUUID) event.getData().get(I_CmsEventListener.KEY_PROJECTID);
        CmsUUID publishHistoryId = new CmsUUID((String)event.getData().get(I_CmsEventListener.KEY_PUBLISHID));
        report = (I_CmsReport)event.getData().get(I_CmsEventListener.KEY_REPORT);
       
        PublishProjectEventContext context = new PublishProjectEventContext(cms, projectId, report);
       
        boolean isInitialized = false;
       
        @SuppressWarnings("unchecked")
        List<CmsPublishedResource> resources = cms.readPublishedResources(publishHistoryId);
        Iterator<CmsPublishedResource> iter = resources.iterator();
       
        while (iter.hasNext()) {
          CmsPublishedResource resource = (CmsPublishedResource) iter.next();
          if (handler.handlesResource(context, resource)) {
            if (!isInitialized) {
                    handler.initialize(context);
                    isInitialized = true;
            }
            handler.handleResource(context, resource);
          }
        }
        if (isInitialized) {
          handler.finish(context);
        }
      } catch (CmsException e) {
        if (report != null) {
          report.addError(e);
          report.println(e);
        }
        LOG.error("Error", e);
      }
    }
  }
View Full Code Here

TOP

Related Classes of org.opencms.report.I_CmsReport

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.