Package org.exoplatform.portal.mop.management.exportimport

Examples of org.exoplatform.portal.mop.management.exportimport.PageExportTask


        BindingProvider bindingProvider = operationContext.getBindingProvider();

        Collection<Page> pagesList = pages.getChildren();
        List<ExportTask> tasks = new ArrayList<ExportTask>(pagesList.size());

        PageExportTask pageExportTask = new PageExportTask(siteKey, dataStorage, pageService, bindingProvider.getMarshaller(
                org.exoplatform.portal.config.model.Page.PageSet.class, ContentType.XML));

        String pageName = operationContext.getAddress().resolvePathTemplate("page-name");
        for (Page page : pagesList) {
            if (pageName == null) {
                PathAddress pageAddress = operationContext.getAddress().append(page.getName());
                // We need to look up the subresource because this sets the path template resolver to be used by the filter.
                operationContext.getManagedResource().getSubResource(pageAddress);

                PathTemplateFilter filter;
                try {
                    filter = PathTemplateFilter.parse(operationContext.getAttributes().getValues("filter"));
                } catch (ParseException e) {
                    throw new OperationException(operationContext.getOperationName(), "Could not parse filter attributes.", e);
                }

                if (pageAddress.accepts(filter)) {
                    pageExportTask.addPageName(page.getName());
                }
            } else if (pageName.equals(page.getName())) {
                pageExportTask.addPageName(page.getName());
            }
        }

        if (pageExportTask.getPageNames().isEmpty() && pageName != null) {
            throw new ResourceNotFoundException("No page found for " + new PageKey(siteKey, pageName));
        } else if (pageExportTask.getPageNames().isEmpty()) {
            resultHandler.completed(new ExportResourceModel(Collections.<ExportTask> emptyList()));
        } else {
            tasks.add(pageExportTask);
            resultHandler.completed(new ExportResourceModel(tasks));
        }
View Full Code Here


      BindingProvider bindingProvider = operationContext.getBindingProvider();

      Collection<Page> pagesList = pages.getChildren();
      List<ExportTask> tasks = new ArrayList<ExportTask>(pagesList.size());

      PageExportTask pageExportTask =
         new PageExportTask(siteKey, dataStorage, bindingProvider.getMarshaller(
            org.exoplatform.portal.config.model.Page.PageSet.class, ContentType.XML));

      String pageName = operationContext.getAddress().resolvePathTemplate("page-name");
      for (Page page : pagesList)
      {
         if (pageName == null)
         {
            PathAddress pageAddress = operationContext.getAddress().append(page.getName());
            // We need to look up the subresource because this sets the path template resolver to be used by the filter.
            operationContext.getManagedResource().getSubResource(pageAddress);

            PathTemplateFilter filter;
            try
            {
               filter = PathTemplateFilter.parse(operationContext.getAttributes().getValues("filter"));
            }
            catch (ParseException e)
            {
               throw new OperationException(operationContext.getOperationName(), "Could not parse filter attributes.", e);
            }

            if (pageAddress.accepts(filter))
            {
               pageExportTask.addPageName(page.getName());
            }
         }
         else if (pageName.equals(page.getName()))
         {
            pageExportTask.addPageName(page.getName());
         }
      }

      if (pageExportTask.getPageNames().isEmpty() && pageName != null)
      {
         throw new ResourceNotFoundException("No page found for " + new PageKey(siteKey, pageName));
      }
      else if (pageExportTask.getPageNames().isEmpty())
      {
         resultHandler.completed(new ExportResourceModel(Collections.<ExportTask>emptyList()));
      }
      else
      {
View Full Code Here

TOP

Related Classes of org.exoplatform.portal.mop.management.exportimport.PageExportTask

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.