Package info.magnolia.cms.core

Examples of info.magnolia.cms.core.Content


    {
    }

    public Object getValue(String name, Object obj)
    {
        Content job = (Content) obj;

        if (name.equals("title"))
        {
            return StringUtils.isNotBlank(job.getName()) ? job.getName() : "no name given";
        }
        else if (name.toLowerCase().endsWith("time"))
        {
            Long timeInMillis = NodeDataUtil.getLong(job, name, 0);
            if (timeInMillis == 0)
View Full Code Here


                    continue;
                Iterator commandIter = collection.iterator();
                Set<String> commands = new HashSet<String>();
                while (commandIter.hasNext())
                {
                    Content content = (Content) commandIter.next();
                    commands.add(content.getName());
                }
                retVal.put(catalog, commands);
            }
            catch (RepositoryException e)
            {
View Full Code Here

        }
    }

    public void removeJobDefinition(String uuid) throws RepositoryException, ItemNotFoundException
    {
        Content jobNode = ContentUtil.getContentByUUID(ContentRepository.CONFIG, uuid);
        if (jobNode == null)
        {
            String msg = "could not find node to remove with uuid " + uuid;
            log.error(msg);
            throw new ItemNotFoundException(msg);
        }
        try
        {
            Content parent = jobNode.getParent();
            log.info("Trying to delete job {}...", jobNode.getName());
            jobNode.delete();
            parent.save();
            log.info("Job deleted successfully");
        }
        catch (RepositoryException e)
        {
            log.error(e.getMessage());
View Full Code Here

        {
            HierarchyManager hm = MgnlContext.getSystemContext().getHierarchyManager(ContentRepository.CONFIG);

            try
            {
                Content root = hm.getContent(SchedulerConsts.ROOT_PATH_FOR_JOBS);
                Content jobNode = ContentUtil.getOrCreateContent(root, definition.getName(), ItemType.CONTENTNODE);
                NodeDataUtil.getOrCreateAndSet(jobNode, "active", definition.isActive());
                if (StringUtils.isNotBlank(definition.getCatalog()))
                    NodeDataUtil.getOrCreateAndSet(jobNode, "catalog", definition.getCatalog());
                if (StringUtils.isNotBlank(definition.getCommand()))
                    NodeDataUtil.getOrCreateAndSet(jobNode, "command", definition.getCommand());
                if (StringUtils.isNotBlank(definition.getGroovyScript()))
                    NodeDataUtil.getOrCreateAndSet(jobNode, "groovyScript", definition.getGroovyScript());
                NodeDataUtil.getOrCreateAndSet(jobNode, "cron", definition.getCron());

                if (definition.getStartTime() != 0)
                    NodeDataUtil.getOrCreateAndSet(jobNode, "startTime", definition.getStartTime());

                if (definition.getEndTime() != 0)
                    NodeDataUtil.getOrCreateAndSet(jobNode, "endTime", definition.getEndTime());

                if (definition.getLastFireTime() != 0)
                    NodeDataUtil.getOrCreateAndSet(jobNode, "lastFireTime", definition.getLastFireTime());

                if (definition.getNextFireTime() != 0
                    && (definition.getEndTime() == 0 || (definition.getEndTime() != 0 && definition.getNextFireTime() < definition
                        .getEndTime())))
                    NodeDataUtil.getOrCreateAndSet(jobNode, "nextFireTime", definition.getNextFireTime());

                NodeDataUtil.getOrCreateAndSet(jobNode, "terminatedWithError", definition.isTerminatedWithError());

                if (StringUtils.isNotBlank(definition.getDescription()))
                    NodeDataUtil.getOrCreateAndSet(jobNode, "description", definition.getDescription());

                if (definition.getParams() != null && !definition.getParams().isEmpty())
                {
                    Content paramNode = ContentUtil.getOrCreateContent(jobNode, "params", ItemType.CONTENTNODE);
                    Iterator children = paramNode.getNodeDataCollection().iterator();
                    while (children.hasNext())
                    {
                        NodeData node = (NodeData) children.next();
                        log.debug("deleting node {}", node.getHandle());
                        node.delete();
View Full Code Here

    }

    public JobDefinition getJobDefinitionByName(String jobName) throws RepositoryException
    {
        HierarchyManager hm = MgnlContext.getSystemContext().getHierarchyManager(ContentRepository.CONFIG);
        Content root = hm.getContent(SchedulerConsts.ROOT_PATH_FOR_JOBS);

        Content jobNode = ContentUtil.getOrCreateContent(root, jobName, ItemType.CONTENTNODE);
        try
        {
            JobDefinition retVal = (JobDefinition) Content2BeanUtil.toBean(jobNode, true, JobDefinition.class);
            if (retVal != null)
                return retVal;
View Full Code Here

        }
    }

    public JobDefinition getJobDefinitionByUUID(String uuid) throws RepositoryException
    {
        Content jobNode = ContentUtil.getContentByUUID(ContentRepository.CONFIG, uuid);
        try
        {
            JobDefinition retVal = (JobDefinition) Content2BeanUtil.toBean(jobNode, true, JobDefinition.class);
            if (retVal != null)
                return retVal;
View Full Code Here

    protected List<Node> getModifiedChildren(Arguments arguments, Element element, String attributeName)

    {
        AggregationState aggregationState = MgnlContext.getAggregationState();

        Content activePage = aggregationState.getMainContent();

        boolean isAdmin = ServerConfiguration.getInstance().isAdmin()
                && !aggregationState.isPreviewMode()
                && activePage != null
                && NodeUtil.isGranted(activePage.getJCRNode(), Permission.SET);

        if (!isAdmin) {
            return element.getChildren();
        }
View Full Code Here

                    repoPath = resourceName.substring(WEB_INF_CLASSES.length());
            } else {
                repoPath = resourceName;
            }

            Content template = (Content)templateLoader.findTemplateSource(repoPath);
            if(template != null){
                Value value = template.getNodeData("text").getValue();
                return value.getStream();
            }
        } catch (Exception e) {
            log.error("Error reading template from repository",e);
        }
View Full Code Here

TOP

Related Classes of info.magnolia.cms.core.Content

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.