Package ch.entwine.weblounge.common.impl.content

Examples of ch.entwine.weblounge.common.impl.content.GeneralResourceURIImpl


    // Create the resource uri, either from the id or the path. If none is
    // specified, and we are not in jsp compilation mode, issue a warning
    ResourceURI uri = null;
    if (StringUtils.isNotBlank(resourceId)) {
      uri = new GeneralResourceURIImpl(site, null, resourceId);
    } else if (StringUtils.isNotBlank(resourcePath)) {
      uri = new GeneralResourceURIImpl(site, resourcePath);
    } else {
      logger.warn("Neither uuid nor path were specified for resource on {}", request.getUrl());
      return SKIP_BODY;
    }
View Full Code Here


          }
        } else {
          filePath = "/" + uriSuffix;
          fileName = FilenameUtils.getName(filePath);
        }
        fileURI = new GeneralResourceURIImpl(site, filePath, id);
      } else {
        filePath = path;
        fileName = FilenameUtils.getName(filePath);
        fileURI = new FileResourceURIImpl(site, filePath, null);
      }
View Full Code Here

    pageURI = new PageURIImpl(site, path, uuid, Resource.WORK);

    // Make sure the page doesn't exist
    try {
      if (contentRepository.existsInAnyVersion(new GeneralResourceURIImpl(site, pageURI.getPath()))) {
        logger.warn("Tried to create already existing page {} in site '{}'", pageURI, site);
        throw new WebApplicationException(Status.CONFLICT);
      }
    } catch (IllegalArgumentException e) {
      logger.warn("Tried to create a page with an invalid path '{}': {}", path, e.getMessage());
View Full Code Here

   */
  public ResourceURI getResourceURI(String resourceId)
      throws ContentRepositoryException {
    if (!isStarted())
      throw new IllegalStateException("Content repository is not connected");
    ResourceURI uri = new GeneralResourceURIImpl(getSite(), null, resourceId);
    if (!index.exists(uri))
      return null;
    uri.setType(index.getType(uri));
    uri.setPath(index.getPath(uri));
    return uri;
  }
View Full Code Here

    if (!StringUtils.isBlank(path)) {
      try {
        if (!path.startsWith("/"))
          path = "/" + path;
        WebUrl url = new WebUrlImpl(site, path);
        resourceURI = new GeneralResourceURIImpl(site, url.getPath(), uuid);

        // Make sure the resource doesn't exist
        if (contentRepository.exists(new GeneralResourceURIImpl(site, url.getPath()))) {
          logger.warn("Tried to create already existing resource {} in site '{}'", resourceURI, site);
          throw new WebApplicationException(Status.CONFLICT);
        }
      } catch (IllegalArgumentException e) {
        logger.warn("Tried to create a resource with an invalid path '{}': {}", path, e.getMessage());
        throw new WebApplicationException(Status.BAD_REQUEST);
      } catch (ContentRepositoryException e) {
        logger.warn("Resource lookup {} failed for site '{}'", resourceURI, site);
        throw new WebApplicationException(Status.INTERNAL_SERVER_ERROR);
      }
    } else {
      resourceURI = new GeneralResourceURIImpl(site, "/" + uuid.replaceAll("-", ""), uuid);
    }

    URI uri = null;
    Resource<?> resource = null;
    try {
View Full Code Here

            path = "/" + path;
          WebUrl url = new WebUrlImpl(site, path);
          resourceURI.setPath(url.getPath());

          // Make sure the resource doesn't exist
          if (contentRepository.exists(new GeneralResourceURIImpl(site, url.getPath()))) {
            logger.warn("Tried to create already existing resource {} in site '{}'", resourceURI, site);
            throw new WebApplicationException(Status.CONFLICT);
          }
        } catch (IllegalArgumentException e) {
          logger.warn("Tried to create a resource with an invalid path '{}': {}", path, e.getMessage());
View Full Code Here

TOP

Related Classes of ch.entwine.weblounge.common.impl.content.GeneralResourceURIImpl

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.