当前位置: 首页>>代码示例>>Java>>正文


Java ActionExecutionException类代码示例

本文整理汇总了Java中info.magnolia.ui.api.action.ActionExecutionException的典型用法代码示例。如果您正苦于以下问题:Java ActionExecutionException类的具体用法?Java ActionExecutionException怎么用?Java ActionExecutionException使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


ActionExecutionException类属于info.magnolia.ui.api.action包,在下文中一共展示了ActionExecutionException类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: execute

import info.magnolia.ui.api.action.ActionExecutionException; //导入依赖的package包/类
@Override
public void execute() throws ActionExecutionException {
    // First Validate
    validator.showValidation(true);

    if (!validator.isValid()) {
        LOGGER.info("Validation error(s) occurred. No save performed.");
        return;
    }

    final JcrNodeAdapter itemChanged = (JcrNodeAdapter) item;

    try {
        final Node node = itemChanged.applyChanges();
        node.getSession().save();
    } catch (final RepositoryException e) {
        throw new ActionExecutionException(e);
    }

    callback.onSuccess(getDefinition().getName());
}
 
开发者ID:tricode,项目名称:magnolia-blog,代码行数:22,代码来源:SaveInitialActivationDateDialogAction.java

示例2: execute

import info.magnolia.ui.api.action.ActionExecutionException; //导入依赖的package包/类
@Override
public void execute() throws ActionExecutionException {
    super.execute();
    try {
        Node node = (Node) ((JcrItemAdapter) item).getJcrItem();
        // need to mark page as modified manually? Why? I'd love to know too.
        NodeTypes.LastModified.update(node);
        node.getSession().save();

        JcrItemId itemIdOfChangedItem = JcrItemUtil.getItemId(templatingFunctions.page(node));
        eventBus.fireEvent(new ContentChangedEvent(itemIdOfChangedItem));
        uiContext.openNotification(MessageStyleTypeEnum.INFO, true, "It would seem you decided to change type of the component! In case you realize that being bad idea, you can always change it back.");
    } catch (RepositoryException e) {
        log.error("It would seem we were not able to obtain id of parent item of node {}", ((JcrItemAdapter) item).getJcrItem());
    }
}
 
开发者ID:rah003,项目名称:neat-tweaks,代码行数:17,代码来源:SaveAndRefreshGenericCommitDialogAction.java

示例3: execute

import info.magnolia.ui.api.action.ActionExecutionException; //导入依赖的package包/类
@Override
public void execute() throws ActionExecutionException {

    // open subapp
    Location location;
    try {
        location = new QueryableBrowserLocation("neatconfiguration", "referenceBrowser", item.getJcrItem().getPath());
        eventBus.fireEvent(new LocationChangedEvent(location));
        // open selected node in new subwindow
        ContentChangedEvent cce = new ContentChangedEvent(item.getItemId(), true);
        eventBus.fireEvent(cce);
    } catch (RepositoryException e) {
        log.error("Ooops, while opening selected node in subapp failed to retrieve path for item {} with {} ", item, e.getMessage(), e);
    }

}
 
开发者ID:rah003,项目名称:neat-tweaks,代码行数:17,代码来源:ShowUsagesAction.java

示例4: execute

import info.magnolia.ui.api.action.ActionExecutionException; //导入依赖的package包/类
@Override
public void execute() throws ActionExecutionException {
    // First Validate
    validator.showValidation(true);
    if (validator.isValid()) {
        try {
            final Node node = item.applyChanges();
            // Set the Node name.
            setNodeName(node, item);
            // WTF was whomever at JR dev team thinking?
            for (Property prop : in((Iterator<Property>) node.getProperties())) {
                if (prop.getType() == PropertyType.STRING && StringUtils.isEmpty(prop.getValue().getString())) {
                    prop.remove();
                }
            }
            node.getSession().save();
        } catch (final RepositoryException e) {
            throw new ActionExecutionException(e);
        }
        callback.onSuccess(getDefinition().getName());
    } else {
        log.info("Validation error(s) occurred. No save performed.");
    }
}
 
开发者ID:rah003,项目名称:neat-tweaks,代码行数:25,代码来源:SaveTemplateFormAction.java

示例5: execute

import info.magnolia.ui.api.action.ActionExecutionException; //导入依赖的package包/类
@Override
public void execute() throws ActionExecutionException {

    // open subapp
    Location location;
    try {
        location = new RerootBrowserLocation("neatconfiguration", "helperBrowser", item.getJcrItem().getPath(), module.isShowSubtreeOnlyInHelper());
        eventBus.fireEvent(new LocationChangedEvent(location));
        // open selected node in new subwindow
        ContentChangedEvent cce = new ContentChangedEvent(item.getItemId(), true);
        eventBus.fireEvent(cce);
    } catch (RepositoryException e) {
        log.error("Ooops, while opening selected node in subapp failed to retrieve path for item {} with {} ", item, e.getMessage(), e);
    }

}
 
开发者ID:rah003,项目名称:neat-tweaks,代码行数:17,代码来源:OpenSelectedInNewWindowAction.java

示例6: execute

import info.magnolia.ui.api.action.ActionExecutionException; //导入依赖的package包/类
@Override
public void execute() throws ActionExecutionException {
    super.execute();
    try {
        Node node = (Node) item.getJcrItem();
        NodeUtil.orderAfter((Node) JcrItemUtil.getJcrItem(changedId), node.getName());
        // need to mark page as modified manually? Why? I'd love to know too.
        NodeTypes.LastModified.update(node);
        node.getSession().save();

        JcrItemId itemIdOfChangedItem = JcrItemUtil.getItemId(templatingFunctions.page(node));
        eventBus.fireEvent(new ContentChangedEvent(itemIdOfChangedItem));
        uiContext.openNotification(MessageStyleTypeEnum.INFO, true, "The item your grace requested have been duplicated! How may I serve my lord further?");
    } catch (RepositoryException e) {
        log.error("It would seem we were not able to obtain id of parent item of node {}", item.getJcrItem());
    }
}
 
开发者ID:rah003,项目名称:neat-tweaks,代码行数:18,代码来源:DuplicatePageComponentAction.java

示例7: execute

import info.magnolia.ui.api.action.ActionExecutionException; //导入依赖的package包/类
@Override
public void execute() throws ActionExecutionException {
    super.execute();
    // First Validate
    validator.showValidation(true);
    if (validator.isValid()) {
        try {
            Node node = (Node) item.getJcrItem();
            // need to mark page as modified manually? Why? I'd love to know too.
            NodeTypes.LastModified.update(node);
            node.getSession().save();

            JcrItemId itemIdOfChangedItem = JcrItemUtil.getItemId(templatingFunctions.page(node));
            eventBus.fireEvent(new ContentChangedEvent(itemIdOfChangedItem));
            uiContext.openNotification(MessageStyleTypeEnum.INFO, true, "In case you didn't manage to set component type right, you can always try again ... and again");
        } catch (RepositoryException e) {
            log.error("It would seem we were not able to obtain id of parent item of node {}", item.getJcrItem());
        }

    } else {
        log.debug("Validation error(s) occurred. No save performed.");
    }
}
 
开发者ID:rah003,项目名称:neat-tweaks,代码行数:24,代码来源:SaveAndRefreshPageAction.java

示例8: execute

import info.magnolia.ui.api.action.ActionExecutionException; //导入依赖的package包/类
@Override
public void execute() throws ActionExecutionException {
    // First Validate
    validator.showValidation(true);
    if (validator.isValid()) {
        try {
            final Node node = item.applyChanges();
            // Set the Node name.
            setNodeName(node, item);
            // WTF was whomever at JR dev team thinking?
            for (Property prop : in((Iterator<Property>) node.getProperties())) {
                if (prop.getType() == PropertyType.STRING && StringUtils.isEmpty(prop.getValue().getString())) {
                    prop.remove();
                }
            }
            setProperty(node, "required", item);
            setProperty(node, "type", item);

            node.getSession().save();
        } catch (final RepositoryException e) {
            throw new ActionExecutionException(e);
        }
        callback.onSuccess(getDefinition().getName());
    } else {
        log.info("Validation error(s) occurred. No save performed.");
    }
}
 
开发者ID:rah003,项目名称:neat-tweaks,代码行数:28,代码来源:SaveFieldFormAction.java

示例9: execute

import info.magnolia.ui.api.action.ActionExecutionException; //导入依赖的package包/类
@Override
public void execute() throws ActionExecutionException {
    String path = StringUtils.defaultIfEmpty(definition.getPath(), "/modules/neat-tweaks-developers/apps/neatconfiguration/subApps/browser/actionbar/sections/folders/groups/bookmarksActions/items");
    BrowserLocation location = new BrowserLocation("neatconfiguration", "browser", path + ":treeview:");
    eventBus.fireEvent(new LocationChangedEvent(location));
    // open selected node
    try {
        ContentChangedEvent cce = new ContentChangedEvent(JcrItemUtil.getItemId(RepositoryConstants.CONFIG, path), true);
        eventBus.fireEvent(cce);
    } catch (RepositoryException e) {
        log.error("Ooops, failed to retrieve node at path {} and open it while executing open bookmark action with {}", path, e.getMessage(), e);
    }
}
 
开发者ID:rah003,项目名称:neat-tweaks,代码行数:14,代码来源:OpenBookmarkAction.java

示例10: execute

import info.magnolia.ui.api.action.ActionExecutionException; //导入依赖的package包/类
@Override
public void execute() throws ActionExecutionException {
    // First Validate
    validator.showValidation(true);
    if (validator.isValid()) {
        try {
            final Node node = item.applyChanges();
            // Set the Node name.
            setNodeName(node, item);
            // WTF was whomever at JR dev team thinking?
            for (Property prop : in((Iterator<Property>) node.getProperties())) {
                if (prop.getType() == PropertyType.STRING && StringUtils.isEmpty(prop.getValue().getString())) {
                    prop.remove();
                }
            }
            Node actions = node.addNode("actions", NodeTypes.ContentNode.NAME);
            setAction(node, actions, "commit", "info.magnolia.ui.form.action.SaveFormActionDefinition");
            setAction(node, actions, "cancel", "info.magnolia.ui.form.action.CancelFormActionDefinition");

            Node tabs = node.addNode("form", NodeTypes.ContentNode.NAME).addNode("tabs", NodeTypes.ContentNode.NAME);
            for (Node n : in((Iterator<Node>) node.getNodes("tabs*"))) {
                if (n.hasProperty("field")) {
                    String name = n.getProperty("field").getString();

                    Node tab = tabs.addNode(Path.getUniqueLabel(tabs, Path.getValidatedLabel(name)), NodeTypes.ContentNode.NAME);
                    tab.setProperty("label", StringUtils.capitalize(name));
                    tab.addNode("fields", NodeTypes.ContentNode.NAME);
                }
                n.remove();
            }
            node.getSession().save();
        } catch (final RepositoryException e) {
            throw new ActionExecutionException(e);
        }
        callback.onSuccess(getDefinition().getName());
    } else {
        log.info("Validation error(s) occurred. No save performed.");
    }
}
 
开发者ID:rah003,项目名称:neat-tweaks,代码行数:40,代码来源:SaveDialogFormAction.java

示例11: ExportMultipleAction

import info.magnolia.ui.api.action.ActionExecutionException; //导入依赖的package包/类
@Inject
public ExportMultipleAction(Definition definition, List<JcrItemAdapter> items, CommandsManager commandsManager, UiContext uiContext, SimpleTranslator i18n) throws ActionExecutionException {
    super(definition, items.get(0), commandsManager, uiContext, i18n);
    // export action doesn't expose init for setting all items so we got to work around
    // by getting pointer to a list of items in AbstractCommandAction
    List<JcrItemAdapter> list = getItems();
    // first item would be already in the list, clear it out
    list.clear();
    // and adding all items to that list manually.
    list.addAll(items);
    // and pray that noone ever changes ACA to return copy of item list instead
}
 
开发者ID:rah003,项目名称:neat-tweaks,代码行数:13,代码来源:ExportMultipleAction.java

示例12: execute

import info.magnolia.ui.api.action.ActionExecutionException; //导入依赖的package包/类
@Override
public void execute() throws ActionExecutionException {
    LOGGER.debug("Execute preview action ...");
    Node node = _nodeItemToEdit.getJcrItem();
    String link = _vanityUrlService.createImageLink(node);
    if (isNotEmpty(link)) {
        Location location = new DefaultLocation(LOCATION_TYPE_APP, getDefinition().getAppName(), getDefinition().getSubAppId(), link);
        _locationController.goTo(location);
    }
}
 
开发者ID:aperto,项目名称:magnolia-vanity-url,代码行数:11,代码来源:QrCodeViewAction.java

示例13: execute

import info.magnolia.ui.api.action.ActionExecutionException; //导入依赖的package包/类
@Override
public void execute() throws ActionExecutionException {
    super.execute();
    if (validator.isValid()) {
        savePreviewImage();
    }
    super.execute();
}
 
开发者ID:aperto,项目名称:magnolia-vanity-url,代码行数:9,代码来源:VanityUrlSaveFormAction.java

示例14: execute

import info.magnolia.ui.api.action.ActionExecutionException; //导入依赖的package包/类
@Override
public void execute() throws ActionExecutionException {
    LOGGER.debug("Execute preview action ...");
    Node node = _nodeItemToEdit.getJcrItem();
    if (node != null) {
        String link = _vanityUrlService.createPreviewUrl(node);
        Location location = new DefaultLocation(LOCATION_TYPE_APP, getDefinition().getAppName(), getDefinition().getSubAppId(), link);
        _locationController.goTo(location);
    }
}
 
开发者ID:aperto,项目名称:magnolia-vanity-url,代码行数:11,代码来源:PreviewAction.java

示例15: execute

import info.magnolia.ui.api.action.ActionExecutionException; //导入依赖的package包/类
@Override
public void execute() throws ActionExecutionException {
    // First Validate
    validator.showValidation(true);
    if (validator.isValid()) {

        // we support only JCR item adapters
        if (!(item instanceof JcrItemAdapter)) {
            return;
        }

        // don't save if no value changes occurred on adapter
        if (!((JcrItemAdapter) item).hasChangedProperties()) {
            return;
        }

        if (item instanceof AbstractJcrNodeAdapter) {
            // Saving JCR Node, getting updated node first
            AbstractJcrNodeAdapter nodeAdapter = (AbstractJcrNodeAdapter) item;
            try {
                Node node = nodeAdapter.getJcrItem();

                Context originalCtx = MgnlContext.getInstance();
                InputStream inputStream = null;
                MgnlGroovyConsoleContext groovyCtx = null;
                try {

                    groovyCtx = new MgnlGroovyConsoleContext(originalCtx);
                    groovyCtx.put("appName", item.getItemProperty("appName").getValue());
                    String[] pathArray = StringUtils.split(node.getPath(), "/");
                    if (pathArray.length < 2) {
                        throw new ActionExecutionException("Can't create app on selected path: " + node.getPath());
                    }
                    groovyCtx.put("appLocation", pathArray[1]);

                    groovyCtx.put("appGroup", item.getItemProperty("appGroup").getValue());
                    groovyCtx.put("appIcon", StringUtils.defaultIfBlank((String) item.getItemProperty("appIcon").getValue(), "icon-items"));
                    groovyCtx.put("appRepository", StringUtils.defaultIfBlank((String) item.getItemProperty("appRepository").getValue(), "magnolia"));
                    groovyCtx.put("appFolderSupport", item.getItemProperty("appFolderSupport").getValue());

                    MgnlContext.setInstance(groovyCtx);
                    MgnlGroovyConsole console = new MgnlGroovyConsole(new Binding());

                    String inputFile = "/neat-tweaks-developers/appCreationScript.groovy";
                    // First Check
                    URL inFile = ClasspathResourcesUtil.getResource(inputFile);
                    if (inFile == null) {
                        throw new ActionExecutionException("Can't find resource file at " + inputFile);
                    }
                    // Get Input Stream
                    inputStream = ClasspathResourcesUtil.getResource(inputFile).openStream();
                    if (inputStream == null) {
                        throw new ActionExecutionException("Can't find resource file at " + inFile.getFile());
                    }

                    Writer writer = new StringWriter();

                    Object result = console.evaluate(inputStream, console.generateScriptName(), writer);

                    StringBuilder sb = new StringBuilder().append(writer.toString()).append("\n").append(result);
                    uiContext.openNotification(MessageStyleTypeEnum.INFO, true, sb.toString());

                } finally {
                    // close jcr sessions
                    groovyCtx.release();
                    // close files
                    IOUtils.closeQuietly(inputStream);
                    // restore context
                    MgnlContext.setInstance(originalCtx);
                }
            } catch (RepositoryException | IOException e) {
                log.error("Could not save changes to node", e);
            }
            callback.onSuccess(getDefinition().getName());
        } else if (item instanceof JcrPropertyAdapter) {
            super.execute();
        }
    } else {
        log.debug("Validation error(s) occurred. No save performed.");
    }
}
 
开发者ID:rah003,项目名称:neat-tweaks,代码行数:82,代码来源:CreateAppAction.java


注:本文中的info.magnolia.ui.api.action.ActionExecutionException类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。