Search in sources :

Example 1 with ModuleException

use of com.qcadoo.plugin.api.ModuleException in project qcadoo by qcadoo.

the class ReportTemplateModule method enable.

@Override
public void enable() {
    try {
        JasperReport reportTemplate = JasperCompileManager.compileReport(templateFile.getInputStream());
        reportTemplateService.addTemplate(pluginIdentifier, templateName, reportTemplate);
    } catch (Exception e) {
        throw new ModuleException(pluginIdentifier, "report-template", e);
    }
}
Also used : JasperReport(net.sf.jasperreports.engine.JasperReport) ModuleException(com.qcadoo.plugin.api.ModuleException) ModuleException(com.qcadoo.plugin.api.ModuleException)

Example 2 with ModuleException

use of com.qcadoo.plugin.api.ModuleException in project qcadoo by qcadoo.

the class ViewGridColumnModule method getGrid.

private GridComponentPattern getGrid() {
    InternalViewDefinition viewDefinition = viewDefinitionService.getWithoutSession(extendsViewPlugin, extendsViewName);
    if (viewDefinition == null) {
        throw new ModuleException(pluginIdentifier, "view", "reference to view which not exists");
    }
    ComponentPattern component = viewDefinition.getComponentByReference(extendsComponentName);
    if (component == null) {
        throw new ModuleException(pluginIdentifier, "view", "reference to component which not exists in " + extendsViewPlugin + "/" + extendsViewName);
    }
    if (!(component instanceof GridComponentPattern)) {
        throw new ModuleException(pluginIdentifier, "view", "component '" + extendsComponentName + "' in " + extendsViewPlugin + "/" + extendsViewName + " is not a grid");
    }
    return (GridComponentPattern) component;
}
Also used : GridComponentPattern(com.qcadoo.view.internal.components.grid.GridComponentPattern) InternalViewDefinition(com.qcadoo.view.internal.api.InternalViewDefinition) ComponentPattern(com.qcadoo.view.internal.api.ComponentPattern) GridComponentPattern(com.qcadoo.view.internal.components.grid.GridComponentPattern) ModuleException(com.qcadoo.plugin.api.ModuleException)

Example 3 with ModuleException

use of com.qcadoo.plugin.api.ModuleException in project qcadoo by qcadoo.

the class MenuModule method multiTenantEnable.

@Override
public void multiTenantEnable() {
    try {
        menuService.addView(menuItemDefinition);
        menuService.createItem(menuItemDefinition);
    } catch (Exception e) {
        throw new ModuleException(menuItemDefinition.getPluginIdentifier(), factoryIdentifier, e);
    }
}
Also used : ModuleException(com.qcadoo.plugin.api.ModuleException) ModuleException(com.qcadoo.plugin.api.ModuleException)

Example 4 with ModuleException

use of com.qcadoo.plugin.api.ModuleException in project qcadoo by qcadoo.

the class ViewModule method enable.

@Override
public void enable() {
    try {
        InternalViewDefinition viewDefinition = viewDefinitionParser.parseViewXml(xmlFile, pluginIdentifier);
        viewDefinitionService.save(viewDefinition);
    } catch (Exception e) {
        throw new ModuleException(pluginIdentifier, "view", e);
    }
}
Also used : InternalViewDefinition(com.qcadoo.view.internal.api.InternalViewDefinition) ModuleException(com.qcadoo.plugin.api.ModuleException) ModuleException(com.qcadoo.plugin.api.ModuleException)

Example 5 with ModuleException

use of com.qcadoo.plugin.api.ModuleException in project qcadoo by qcadoo.

the class ViewRibbonModule method enable.

@Override
public void enable() {
    addedGroups = new HashMap<WindowComponentPattern, RibbonGroupsPack>();
    InternalViewDefinition viewDefinition = viewDefinitionService.getWithoutSession(viewExtension.getPluginName(), viewExtension.getViewName());
    if (viewDefinition == null) {
        throw new ModuleException(pluginIdentifier, "view", "reference to view which not exists");
    }
    try {
        for (Node groupNode : viewDefinitionParser.geElementChildren(viewExtension.getExtesionNode())) {
            try {
                InternalRibbonGroup group = viewDefinitionParser.parseRibbonGroup(groupNode, viewDefinition);
                group.setExtensionPluginIdentifier(pluginIdentifier);
                RibbonGroupsPack groupsPack = new SingleRibbonGroupPack(group);
                WindowComponentPattern window = viewDefinition.getRootWindow();
                window.getRibbon().addGroupsPack(groupsPack);
                addedGroups.put(window, groupsPack);
            } catch (ViewDefinitionParserNodeException e) {
                throw ViewDefinitionParserException.forFileAndNode(fileName, e);
            }
        }
    } catch (Exception e) {
        throw new ModuleException(pluginIdentifier, "view-ribbon-group", e);
    }
}
Also used : WindowComponentPattern(com.qcadoo.view.internal.components.window.WindowComponentPattern) InternalViewDefinition(com.qcadoo.view.internal.api.InternalViewDefinition) Node(org.w3c.dom.Node) SingleRibbonGroupPack(com.qcadoo.view.internal.ribbon.model.SingleRibbonGroupPack) ViewDefinitionParserNodeException(com.qcadoo.view.internal.xml.ViewDefinitionParserNodeException) RibbonGroupsPack(com.qcadoo.view.internal.ribbon.model.RibbonGroupsPack) ModuleException(com.qcadoo.plugin.api.ModuleException) InternalRibbonGroup(com.qcadoo.view.internal.ribbon.model.InternalRibbonGroup) ViewDefinitionParserNodeException(com.qcadoo.view.internal.xml.ViewDefinitionParserNodeException) IOException(java.io.IOException) ModuleException(com.qcadoo.plugin.api.ModuleException) ViewDefinitionParserException(com.qcadoo.view.internal.xml.ViewDefinitionParserException)

Aggregations

ModuleException (com.qcadoo.plugin.api.ModuleException)6 InternalViewDefinition (com.qcadoo.view.internal.api.InternalViewDefinition)4 ComponentPattern (com.qcadoo.view.internal.api.ComponentPattern)2 WindowComponentPattern (com.qcadoo.view.internal.components.window.WindowComponentPattern)2 ViewDefinitionParserException (com.qcadoo.view.internal.xml.ViewDefinitionParserException)2 ViewDefinitionParserNodeException (com.qcadoo.view.internal.xml.ViewDefinitionParserNodeException)2 IOException (java.io.IOException)2 Node (org.w3c.dom.Node)2 ComponentDefinition (com.qcadoo.view.internal.ComponentDefinition)1 GridComponentPattern (com.qcadoo.view.internal.components.grid.GridComponentPattern)1 WindowTabComponentPattern (com.qcadoo.view.internal.components.window.WindowTabComponentPattern)1 InternalRibbonGroup (com.qcadoo.view.internal.ribbon.model.InternalRibbonGroup)1 RibbonGroupsPack (com.qcadoo.view.internal.ribbon.model.RibbonGroupsPack)1 SingleRibbonGroupPack (com.qcadoo.view.internal.ribbon.model.SingleRibbonGroupPack)1 JasperReport (net.sf.jasperreports.engine.JasperReport)1