Package org.pentaho.platform.engine.services.actionsequence

Examples of org.pentaho.platform.engine.services.actionsequence.ActionResource


        String templateName = null;
        String messagesBaseFilename = null;

        if (repository.resourceExists(fullPath)) {
            final ActionResource resource = new ActionResource("", IActionSequenceResource.SOLUTION_FILE_RESOURCE, "text/xml", fullPath);
            final String dashboardMetadata = repository.getResourceAsString(resource, ISolutionRepository.ACTION_EXECUTE);
            final Document doc = DocumentHelper.parseText(dashboardMetadata);
            templateName = XmlDom4JHelper.getNodeText("/cdf/template", doc, "");

            // Get message file base name if any
View Full Code Here


        } else {
            template = "-" + template;
        }

        final ISolutionRepository repository = PentahoSystem.get(ISolutionRepository.class, userSession);
        final ActionResource resource;

        String fullTemplatePath = null;

        if (templateName != null) {
            if (templateName.startsWith("/") || templateName.startsWith("\\")) { //$NON-NLS-1$ //$NON-NLS-2$
                fullTemplatePath = templateName;
            } else {
                fullTemplatePath = ActionInfo.buildSolutionPath(solution, path, templateName);
            }
        }

        if (fullTemplatePath != null && repository.resourceExists(fullTemplatePath)) {
            resource = new ActionResource("", IActionSequenceResource.SOLUTION_FILE_RESOURCE, "text/xml", //$NON-NLS-1$ //$NON-NLS-2$
                    fullTemplatePath);
        } else {
            resource = new ActionResource("", IActionSequenceResource.SOLUTION_FILE_RESOURCE, "text/xml", //$NON-NLS-1$ //$NON-NLS-2$
                    "system/" + PLUGIN_NAME + "/default-dashboard-template.html"); //$NON-NLS-1$ //$NON-NLS-2$
        }

        // Check for access permissions
        if (repository.getSolutionFile(resource, ISolutionRepository.ACTION_EXECUTE) == null) {
            out.write("Access Denied".getBytes(ENCODING));
            return;
        }

        String intro = ""; //$NON-NLS-1$
        String footer = ""; //$NON-NLS-1$

        final String dashboardTemplate = "template-dashboard" + template + ".html"; //$NON-NLS-1$

        final IUITemplater templater = PentahoSystem.get(IUITemplater.class, userSession);
        ArrayList<String> i18nTagsList = new ArrayList<String>();
        if (templater != null) {
           
          String solutionPath = "system/" + PLUGIN_NAME + "/" + dashboardTemplate;
            if(!repository.resourceExists(solutionPath))
            {//then try in solution
              solutionPath = SOLUTION_DIR + "/templates/" + dashboardTemplate;
            }
             
            final ActionResource templateResource = new ActionResource("", IActionSequenceResource.SOLUTION_FILE_RESOURCE, "text/xml", solutionPath); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
            String templateContent = repository.getResourceAsString(templateResource, ISolutionRepository.ACTION_EXECUTE);
            // Process i18n on dashboard outer template
            templateContent = updateUserLanguageKey(templateContent);
            templateContent = processi18nTags(templateContent, i18nTagsList);
            // Process i18n on dashboard outer template - end
View Full Code Here

TOP

Related Classes of org.pentaho.platform.engine.services.actionsequence.ActionResource

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.