private void updateActivationStatus(Node node, String userName) throws RepositoryException { if (NodeUtil.isNodeType(node, NodeTypes.Activatable.NAME)) { NodeTypes.Activatable.update(node, userName, false); } }
/** * Sets the date of modification to current Calendar and uses {@link info.magnolia.context.MgnlContext} to set the name of the user. * It should not be necessary to call this method explicitly as all Magnolia treated node instances are self updating the property defined by mixin. * * @see info.magnolia.jcr.wrapper.MgnlPropertySettingContentDecorator for more details. */ public static void update(Node node) throws RepositoryException { update(node, getCurrentCalendar()); }
public static void visit(Node node, NodeVisitor visitor, Predicate predicate) throws RepositoryException { // TODO should it really visit the start node even if it doesn't match the filter? visitor.visit(node); for (Node child : getNodes(node, predicate)) { visit(child, visitor, predicate); } if (visitor instanceof PostNodeVisitor) { ((PostNodeVisitor) visitor).postVisit(node); } }
public static String getBinaryPath(Node node) { if (node == null) { return null; } return NodeUtil.getPathIfPossible(node) + "/" + PropertyUtil.getString(node, "fileName"); }
/** * Return the String representing the node property value. * If the Node did not contain such a Property or if the Node is null, * then return <b>null</b>. */ public static String getString(Node node, String name) { return getString(node, name, null); }
/** * Creates a node under the specified parent and relative path, then returns it. Should the node already exist, the * method will simply return it. */ public static Node createPath(Node parent, String relPath, String primaryNodeTypeName) throws RepositoryException, PathNotFoundException, AccessDeniedException { return createPath(parent, relPath, primaryNodeTypeName, false); }
@Override public boolean evaluateTyped(Node node) { try { return NodeUtil.isNodeType(node, Area.NAME) || NodeUtil.isNodeType(node, Component.NAME); } catch (RepositoryException e) { return false; } } };
/** * Return the template id associated with this content. */ public String metaDataTemplate(Node content) { try { return NodeTypes.Renderable.getTemplate(content); } catch (RepositoryException e) { return null; } }
/** * Compares the page template configuration with the prototype configuration and removes the redundancies. */ private void compareWithProto(Node pageTemplate) throws RepositoryException { currentPageTemplate = pageTemplate; NodeUtil.visit(pageTemplate, pageTemplateVisitor); }
/** * Return the equivalent contentMap for the provided node object. * Useful for converting a node for use in templates - or for methods that expect a contentMap. */ public ContentMap asContentMap(Node content) { return content == null ? null : new ContentMap(content); }
public static void createSubnodes(Node root, InputStream propertiesStream) throws IOException, RepositoryException { final PropertiesImportExport importer = new PropertiesImportExport() { @Override protected void setIdentifier(Node c, String valueStr) { ((MockNode) c).setIdentifier(valueStr); } }; importer.createNodes(root, propertiesStream); }
/** * Sets the date of modification. * It should not be necessary to call this method explicitly as all Magnolia treated node instances are self updating the property defined by mixin. * * @see info.magnolia.jcr.wrapper.MgnlPropertySettingContentDecorator for more details. */ public static void update(Node node, Calendar lastModified) throws RepositoryException { update(node, getCurrentUserName(), lastModified); }
/** * Sets the current date as the node's creation date and uses {@link info.magnolia.context.MgnlContext} to set the name of the creating * user. Used with nodes having the <code>mgnl:created</code> mixin. */ public static void set(Node node) throws RepositoryException { set(node, getCurrentUserName(), getCurrentCalendar()); }
/** * Return the Calendar representing the node property value. * If the Node did not contain such a Property, * then return <b>null</b>. */ public static Calendar getDate(Node node, String name) { return getDate(node, name, null); }
/** * @deprecated since 5.5.3, use {@link info.magnolia.jcr.util.NodeUtil#getAbsolutePath(String, String)} */ public static String getAbsolutePath(String path, String label) { return NodeUtil.getAbsolutePath(path, label); }
public String getLink() { try { return "/" + PropertyUtil.getString(content, "category") + "/" + PropertyUtil.getString(content, "subCategory") + NodeUtil.getPathIfPossible(siteRoot); } catch (NullPointerException e) { log.error("No content rss link found"); return ""; } } }
@Override public String getCoverage() { return PropertyUtil.getString(this.assetNode, COVERAGE, ""); }
@Override public String getDescription() { return PropertyUtil.getString(this.assetNode, AssetNodeTypes.Asset.DESCRIPTION, ""); }
@Override public String getPublisher() { return PropertyUtil.getString(this.assetNode, PUBLISHER, ""); }