Tabnine Logo
Content
Code IndexAdd Tabnine to your IDE (free)

How to use
Content
in
it.tidalwave.northernwind.core.model

Best Java code snippets using it.tidalwave.northernwind.core.model.Content (Showing top 20 results out of 315)

origin: it.tidalwave.northernwind/it-tidalwave-northernwind-frontend-components

 @Override
 protected List<? extends SiteNode> computeResults()
  {
   log.info("findCompositeContents()");
   final List<SiteNode> results = new ArrayList<>();
   try
    {
     final ResourceProperties componentProperties = siteNode.getPropertyGroup(view.getId());
     for (final Content post : findAllPosts(componentProperties))
      {
       try
        {
         final ResourcePath relativeUri = siteNode.getRelativeUri().appendedWith(post.getExposedUri());
         results.add(new ChildSiteNode(siteNode, relativeUri, post.getProperties()));
        }
       catch (NotFoundException | IOException e)
        {
         log.warn("While reading properties", e);
        }
      }
    }
   catch (NotFoundException | IOException e)
    {
     log.warn("While reading property group", e);
    }
   log.info(">>>> returning: {}", results);
   return results;
  }
};
origin: it.tidalwave.northernwind/it-tidalwave-northernwind-frontend-components

/*******************************************************************************************************************
 *
 * Finds all the posts.
 *
 ******************************************************************************************************************/
@Nonnull
private List<Content> findAllPosts (final @Nonnull ResourceProperties siteNodeProperties)
 throws NotFoundException, IOException
 {
  final List<Content> allPosts = new ArrayList<>();
  for (final String relativePath : siteNodeProperties.getProperty(PROPERTY_CONTENTS))
   {
    final Content postsFolder = site.find(Content).withRelativePath(relativePath).result();
    allPosts.addAll(postsFolder.findChildren().results());
   }
  log.debug(">>>> all posts: {}", allPosts.size());
  return allPosts;
 }
origin: it.tidalwave.northernwind/it-tidalwave-northernwind-core-default

  @Override @Nonnull
  public ResourceProperties getContentProperties()
   {
    if (contentHolder.get() == null) // FIXME: should never occur
     {
      log.warn("NO CONTENT IN CONTEXT");
//            Thread.dumpStack(); // FIXME
      return modelFactory.createProperties().build();
     }

    return contentHolder.get().getProperties();
   }

origin: it.tidalwave.northernwind/it-tidalwave-northernwind-frontend-components

/*******************************************************************************************************************
 *
 *
 ******************************************************************************************************************/
@Nonnull
private Content findPostByExposedUri (final List<Content> allPosts, final @Nonnull ResourcePath exposedUri)
 throws NotFoundException, IOException
 {
  for (final Content post : allPosts)
   {
    try
     {
      if (exposedUri.equals(post.getExposedUri()))
       {
        return post;
       }
     }
    catch (NotFoundException e)
     {
      log.warn("{}", e.toString());
     }
    catch (IOException e)
     {
      log.warn("", e);
     }
   }
  throw new NotFoundException("Blog post with exposedUri=" + exposedUri.asString());
 }
origin: it.tidalwave.northernwind.rca/it-tidalwave-northernwind-rca-ui-content-explorer

 /* visible for testing */ void onOpenSite (final @ListensTo @Nonnull OpenSiteEvent event)
  {
   log.debug("onOpenSite({})", event);
   final ResourceFile root = event.getFileSystem().findFileByPath(ROOT_DOCUMENT_PATH);
   final Content rootContent = modelFactory.createContent().withFolder(root).build();
   presentation.populate(rootContent.as(Presentable).createPresentationModel());
   presentation.expandFirstLevel();
   messageBus.publish(emptySelectionEvent());
  }
}
origin: it.tidalwave.northernwind/it-tidalwave-northernwind-frontend-components

 @Override
 public int compare (final @Nonnull Content post1, final @Nonnull Content post2)
  {
   final DateTime dateTime1 = post1.getProperties().getDateTimeProperty(DATE_KEYS, TIME0);
   final DateTime dateTime2 = post2.getProperties().getDateTimeProperty(DATE_KEYS, TIME0);
   return dateTime2.compareTo(dateTime1);
  }
};
origin: it.tidalwave.northernwind/it-tidalwave-northernwind-core-default

@Override @Nonnull
protected String filter (final @Nonnull Matcher matcher)
 throws NotFoundException, IOException
 {
  final String relativePath = matcher.group(1);
  final String contentRelativePath = matcher.group(2);
  final String language = matcher.group(4);
  final Site site = siteProvider.get().getSite();
  final SiteNode siteNode = site.find(SiteNode.class).withRelativePath(relativePath).result();
  final Content content = site.find(Content.class).withRelativePath(contentRelativePath).result();
  final ResourcePath path = siteNode.getRelativeUri().appendedWith(content.getExposedUri());
  final String link = site.createLink(path);
  return ((language == null) || (postProcessor == null)) ? link : postProcessor.postProcess(link, language);
 }
origin: it.tidalwave.northernwind/it-tidalwave-northernwind-frontend-components

/*******************************************************************************************************************
 *
 * Adds to {@code destinationPosts} all the {@code sourcePosts} that matches the selected {@code category}; all
 * posts if the category is empty.
 *
 * @param  sourcePosts          the source posts
 * @param  destinationPosts     the destination posts
 * @param  category             the category
 *
 ******************************************************************************************************************/
private void filterByCategory (final @Nonnull List<Content> sourcePosts,
                final @Nonnull List<Content> destinationPosts,
                final @Nonnull String category)
 {
  for (final Content post : sourcePosts)
   {
    try
     {
      if (category.equals("")
        || category.equals(post.getProperties().getProperty(PROPERTY_CATEGORY, "---")))
       {
        destinationPosts.add(post);
       }
     }
    catch (IOException e2)
     {
      log.warn("", e2);
     }
   }
 }
origin: it.tidalwave.northernwind/it-tidalwave-northernwind-core-default

@Override @Nonnull
protected List<? extends Content> computeResults()
 {
  try
   {
    final Content content = mock(Content.class);
    if (relativePath.equals("/"))
     {
      when(content.getExposedUri()).thenReturn(new ResourcePath());
     }
    else
     {
      when(content.getExposedUri()).thenReturn(new ResourcePath("EXPOSED-" + relativePath.substring(1)
                                       .replace('/', '-')
                                       .replace(' ', '-')));
     }
    return Arrays.asList(content);
   }
  catch (NotFoundException e)
   {
    throw new RuntimeException(e);
   }
  catch (IOException e)
   {
    throw new RuntimeException(e);
   }
 }
origin: it.tidalwave.northernwind/it-tidalwave-northernwind-frontend-components

/*******************************************************************************************************************
 *
 * Adds to {@code destinationPosts} all the {@code sourcePosts} that matches the selected {@code tag}; all
 * posts if the category is empty.
 *
 * @param  sourcePosts          the source posts
 * @param  destinationPosts     the destination posts
 * @param  tag                  the tag
 *
 ******************************************************************************************************************/
private void filterByTag (final @Nonnull List<Content> sourcePosts,
             final @Nonnull List<Content> destinationPosts,
             final @Nonnull String tag)
 {
  for (final Content post : sourcePosts)
   {
    try
     {
      final List<String> tags = Arrays.asList(post.getProperties().getProperty(PROPERTY_TAGS, "").split(","));
      if (tags.contains(tag))
       {
        destinationPosts.add(post);
       }
     }
    catch (IOException e2)
     {
      log.warn("", e2);
     }
   }
 }
origin: it.tidalwave.northernwind/it-tidalwave-northernwind-frontend-components

builder.append(script.getProperties().getProperty(PROPERTY_TEMPLATE));
origin: it.tidalwave.northernwind/it-tidalwave-northernwind-frontend-components

 /*******************************************************************************************************************
  *
  * Returns the template.
  *
  ******************************************************************************************************************/
 @Nonnull
 private String getTemplate (final @Nonnull ResourceProperties viewProperties)
  throws IOException
  {
   try
    {
     final String templateRelativePath = viewProperties.getProperty(PROPERTY_WRAPPER_TEMPLATE_RESOURCE);
     final Content content = site.find(Content).withRelativePath(templateRelativePath).result();
     final ResourceProperties templateProperties = content.getProperties();
     return templateProperties.getProperty(PROPERTY_TEMPLATE, "$content$");
    }
   catch (NotFoundException e)
    {
     return "$content$";
    }
  }
}
origin: it.tidalwave.northernwind/it-tidalwave-northernwind-frontend-components

for (final String tag : post.getProperties().getProperty(PROPERTY_TAGS).split(","))
origin: it.tidalwave.northernwind/it-tidalwave-northernwind-frontend-components

htmlBuilder.append(content.getProperties().getProperty(PROPERTY_FULL_TEXT)).append("\n");
htmlBuilder.append(content.getProperties().getProperty(PROPERTY_TEMPLATE)).append("\n");
origin: it.tidalwave.northernwind/it-tidalwave-northernwind-frontend-components

/*******************************************************************************************************************
 *
 * .
 *
 ******************************************************************************************************************/
private void setCustomTemplate (final @Nonnull ResourceProperties viewProperties)
 throws IOException
 {
  try
   {
    final String templateRelativePath = viewProperties.getProperty(PROPERTY_TEMPLATE_PATH);
    final Content template = site.find(Content).withRelativePath(templateRelativePath).result();
    view.setTemplate(template.getProperties().getProperty(PROPERTY_TEMPLATE));
   }
  catch (NotFoundException e)
   {
    log.warn("Cannot find custom template, using default ({})", e.toString());
   }
 }
origin: it.tidalwave.northernwind.rca/it-tidalwave-northernwind-rca-ui-content-editor

/*******************************************************************************************************************
 *
 ******************************************************************************************************************/
@BeforeMethod
public void setup()
 {
  ContextManager.Locator.set(null);
  context = (ClassPathXmlApplicationContext)helper.createSpringContext();
  underTest = context.getBean(DefaultContentEditorPresentationControl.class);
  embeddedServer = context.getBean(EmbeddedServer.class);
  presentation = context.getBean(ContentEditorPresentation.class);
  content = mock(Content.class);
  properties = mock(ResourceProperties.class);
  presentable = mock(Presentable.class);
  pm = mock(PresentationModel.class);
  propertyBinder = mock(PropertyBinder.class);
  when(embeddedServer.putDocument(anyString(), any(Document.class))).thenReturn(registeredUrl);
  when(content.getProperties()).thenReturn(properties);
  when(presentable.createPresentationModel(anyVararg())).thenReturn(pm);
  when(properties.as(eq(Presentable))).thenReturn(presentable);
  when(properties.as(eq(PropertyBinder))).thenReturn(propertyBinder);
  document = new Document().withContent("proxy for: full text")
               .withMimeType("text/html");
  when(propertyBinder.createBoundDocument(any(Key.class), any(PropertyBinder.UpdateCallback.class)))
            .thenAnswer(invocation -> document);
  underTest.initialize();
 }
origin: it.tidalwave.northernwind/it-tidalwave-northernwind-frontend-components

final ResourceProperties contentProperties = content.getProperties();
appendTitle(contentProperties, htmlFragmentBuilder, "h" + titleLevel++);
appendText(contentProperties, htmlFragmentBuilder);
origin: it.tidalwave.northernwind/it-tidalwave-northernwind-frontend-components

/*******************************************************************************************************************
 *
 * {@inheritDoc}
 *
 ******************************************************************************************************************/
@Nonnull
protected String loadTemplate (final @Nonnull GalleryAdapterContext context, final @Nonnull String templateName)
 throws IOException
 {
  try
   {
    final SiteNode siteNode = context.getSiteNode();
    final GalleryView view = context.getView();
    final Site site = context.getSite();
    final ResourceProperties viewProperties = siteNode.getPropertyGroup(view.getId());
    final String templateRelativePath = viewProperties.getProperty(new Key<String>(templateName + "Path"));
    final Content template = site.find(Content).withRelativePath(templateRelativePath).result();
    return template.getProperties().getProperty(PROPERTY_TEMPLATE);
   }
  catch (NotFoundException e)
   {
    return loadDefaultTemplate(templateName + ".txt");
   }
 }

origin: it.tidalwave.northernwind/it-tidalwave-northernwind-frontend-components

post.getProperties().getProperty(PROPERTY_TITLE); // Skip folders used for categories - this throws exception
origin: it.tidalwave.northernwind/it-tidalwave-northernwind-frontend-components

 @PostConstruct
 /* package */ void initialize()
  throws IOException
  {
   try
    {
     // First search the template in a path, which could be useful for retrieving from a library; if not
     // found, a property with the contents is searched.
     final ResourceProperties viewProperties = siteNode.getPropertyGroup(view.getId());
     final String templateRelativePath = viewProperties.getProperty(PROPERTY_TEMPLATE_PATH);
     final Content template = site.find(Content.class).withRelativePath(templateRelativePath).result();
     view.setTemplate(template.getProperties().getProperty(PROPERTY_TEMPLATE));
    }
   catch (NotFoundException e)
    {
     // ok, use the default template
    }
   final ResourceProperties viewProperties = siteNode.getPropertyGroup(view.getId());
   view.setClassName(viewProperties.getProperty(PROPERTY_CLASS, "nw-" + view.getId()));
  }
}
it.tidalwave.northernwind.core.modelContent

Most used methods

  • getExposedUri
  • getProperties
  • as
  • findChildren

Popular in Java

  • Reading from database using SQL prepared statement
  • getOriginalFilename (MultipartFile)
    Return the original filename in the client's filesystem.This may contain path information depending
  • requestLocationUpdates (LocationManager)
  • setRequestProperty (URLConnection)
  • Kernel (java.awt.image)
  • HashMap (java.util)
    HashMap is an implementation of Map. All optional operations are supported.All elements are permitte
  • NoSuchElementException (java.util)
    Thrown when trying to retrieve an element past the end of an Enumeration or Iterator.
  • CountDownLatch (java.util.concurrent)
    A synchronization aid that allows one or more threads to wait until a set of operations being perfor
  • JButton (javax.swing)
  • XPath (javax.xml.xpath)
    XPath provides access to the XPath evaluation environment and expressions. Evaluation of XPath Expr
  • Best plugins for Eclipse
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now