Package ch.entwine.weblounge.common.content

Examples of ch.entwine.weblounge.common.content.ResourceURI


      synchronized (operations) {
        for (ResourceURI u : operationsPerResource.keySet()) {
          if (u.getIdentifier().equals(uri.getIdentifier())) {
            ContentRepositoryOperation<?> currentOp = CurrentOperation.get();
            if (currentOp instanceof ContentRepositoryResourceOperation<?>) {
              ResourceURI currentURI = ((ContentRepositoryResourceOperation<?>) currentOp).getResourceURI();
              if (!u.equals(currentURI))
                return true;
            }
          }
        }
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

   *          the languages to build the previews for
   */
  protected void createPreviews(final Resource<?> resource,
      Language... languages) {

    ResourceURI uri = resource.getURI();

    // Compile the full list of image styles
    if (imageStyleTracker == null) {
      logger.info("Skipping preview generation for {}: image styles are unavailable", uri);
      return;
    }

    final List<ImageStyle> previewStyles = new ArrayList<ImageStyle>();

    // Add the global image styles that have the preview flag turned on
    for (ImageStyle s : imageStyleTracker.getImageStyles()) {
      if (s.createPreview(resource.getURI().getType())) {
        previewStyles.add(s);
        logger.debug("Preview images will be generated for {}", s);
      } else {
        logger.debug("Preview image generation will be skipped for {}", s);
      }
    }

    // Add the site's preview image styles as well as
    for (Module m : getSite().getModules()) {
      for (ImageStyle s : m.getImageStyles()) {
        if (s.createPreview(resource.getURI().getType())) {
          previewStyles.add(s);
          logger.debug("Preview images will be generated for {}", s);
        } else {
          logger.debug("Preview image generation will be skipped for {}", s);
        }
      }
    }

    // If no language has been specified, we create the preview for all
    // languages
    if (languages == null || languages.length == 0) {
      languages = uri.getSite().getLanguages();
    }

    // Create the previews
    PreviewOperation previewOp = null;
    synchronized (currentPreviewOperations) {
View Full Code Here

   * {@inheritDoc}
   *
   * @see java.lang.Runnable#run()
   */
  public void run() {
    ResourceURI resourceURI = resource.getURI();
    String resourceType = resourceURI.getType();

    try {

      // Find the resource serializer
      ResourceSerializer<?, ?> serializer = contentRepository.getSerializerByType(resourceType);
View Full Code Here

   * @return returns the preview file
   */
  private File createPreview(Resource<?> resource, ImageStyle style,
      Language language, PreviewGenerator previewGenerator, String format) {

    ResourceURI resourceURI = resource.getURI();
    String resourceType = resourceURI.getType();

    // Create the filename
    ResourceContent content = resource.getContent(language);

    // Initiate creation of previews
View Full Code Here

    // resource version
    long version = (Long) metadataMap.get(VERSION).getValues().get(0);

    // FIXME Add exception handling
    ResourceURI uri = new PageURIImpl(site, path, id, version);
    WebUrl url = new WebUrlImpl(site, path);

    PageSearchResultItemImpl result = new PageSearchResultItemImpl(uri, url, relevance, site, metadata);

    if (metadataMap.get(XML) != null)
View Full Code Here

    } else {
      path = URI_PREFIX + "/" + id;
      url = new WebUrlImpl(site, path);
    }

    ResourceURI uri = new ImageResourceURIImpl(site, path, id, version);

    ImageResourceSearchResultItemImpl result = new ImageResourceSearchResultItemImpl(uri, url, relevance, site, metadata);

    if (metadataMap.get(XML) != null)
      result.setResourceXml((String) metadataMap.get(XML).getValues().get(0));
View Full Code Here

    } else {
      path = URI_PREFIX + "/" + id;
      url = new WebUrlImpl(site, path);
    }

    ResourceURI uri = new MovieResourceURIImpl(site, path, id, version);
    MovieResourceSearchResultItemImpl result = new MovieResourceSearchResultItemImpl(uri, url, relevance, site, metadata);

    if (metadataMap.get(XML) != null)
      result.setResourceXml((String) metadataMap.get(XML).getValues().get(0));
    if (metadataMap.get(HEADER_XML) != null)
View Full Code Here

   * @throws ContentRepositoryException
   */
  protected void createHomepage() throws IllegalStateException,
      ContentRepositoryException {
    // Make sure there is a home page
    ResourceURI homeURI = new ResourceURIImpl(Page.TYPE, site, "/");
    if (!existsInAnyVersion(homeURI)) {
      try {
        Page page = new PageImpl(homeURI);
        User siteAdmininstrator = new UserImpl(site.getAdministrator());
        page.setTemplate(site.getDefaultTemplate().getIdentifier());
View Full Code Here

        // Apply the changes to the original resource
        ContentRepositoryResourceOperation<?> resourceOp = (ContentRepositoryResourceOperation<?>) op;

        // Is the resource about to be deleted?
        ResourceURI opURI = resourceOp.getResourceURI();
        if (op instanceof DeleteOperation && equalsByIdOrPath(uri, opURI)) {
          DeleteOperation deleteOp = (DeleteOperation) op;
          List<ResourceURI> deleteCandidates = new ArrayList<ResourceURI>();
          for (ResourceURI u : uris) {
            if (deleteOp.allVersions() || u.getVersion() == opURI.getVersion()) {
              deleteCandidates.add(u);
            }
          }
          uris.removeAll(deleteCandidates);
        }
View Full Code Here

TOP

Related Classes of ch.entwine.weblounge.common.content.ResourceURI

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.