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);
}
}
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;
}
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);
}
}
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);
}
}
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);
}
}
Aggregations