Example usage for org.jfree.util Log error

List of usage examples for org.jfree.util Log error

Introduction

In this page you can find the example usage for org.jfree.util Log error.

Prototype

public static void error(final Object message, final Exception e) 

Source Link

Document

A convenience method for logging an 'error' message.

Usage

From source file:org.nuclos.client.main.MainController.java

private void addReportActions(List<GenericAction> genericActions) {
    try {//w  w w . j a va  2s. c  o  m
        for (final MasterDataVO mdReport : CollectionUtils.sorted(
                MasterDataDelegate.getInstance().getMasterData(NuclosEntity.REPORTEXECUTION.getEntityName(),
                        ReportExecutionSearchStrategy.MAIN_CONDITITION),
                new Comparator<MasterDataVO>() {
                    @Override
                    public int compare(MasterDataVO o1, MasterDataVO o2) {
                        return LangUtils.compareComparables(o1.getField("name", String.class),
                                o2.getField("name", String.class));
                    }
                })) {
            Action action = new AbstractAction(mdReport.getField("name", String.class),
                    MainFrame.resizeAndCacheIcon(NuclosResourceCache.getNuclosResourceIcon(
                            "org.nuclos.client.resource.icon.glyphish.185-printer.png"), 16)) {
                @Override
                public void actionPerformed(ActionEvent e) {
                    ReportExecutionCollectController.execReport(Main.getInstance().getMainFrame(),
                            NuclosEntity.REPORTEXECUTION.getEntityName(), mdReport);
                }
            };
            if (genericActions != null) {
                WorkspaceDescription.Action wa = new WorkspaceDescription.Action();
                wa.setAction(GENERIC_REPORT_ACTION);
                wa.putStringParameter("report", mdReport.getField("name", String.class));
                genericActions
                        .add(new GenericAction(wa,
                                new ActionWithMenuPath(new String[] { getSpringLocaleDelegate().getMessage(
                                        "nuclos.entity.reportExecution.label", "Reporting ausfhren") },
                                        action)));
            }
        }
    } catch (Exception e) {
        Log.error(e.getMessage(), e);
    }
}

From source file:org.pentaho.agilebi.spoon.publish.PublisherHelper.java

/**
 * //from   w w w .  j a va2  s . com
 * @param workspace
 * @param publishingFile
 * @param treeDepth
 * @param databaseMeta
 * @param fullPathtoFile
 * @param checkDatasources
 * @param setShowModel
 * @param showFolders
 * @param showCurrentFolder
 * @param serverPathTemplate
 * @param extension
 * @param databaseName
 * @return
 * @throws ModelerException
 */
public static String publishAnalysis(ModelerWorkspace workspace, String publishingFile, int treeDepth,
        DatabaseMeta databaseMeta, String fullPathtoFile, boolean checkDatasources, boolean setShowModel,
        boolean showFolders, boolean showCurrentFolder, String serverPathTemplate, String extension,
        String databaseName) throws ModelerException {
    try {

        if (StringUtils.isEmpty(publishingFile)) {
            SpoonFactory.getInstance().messageBox(
                    BaseMessages.getString(ModelerWorkspace.class, "ModelServerPublish.Publish.UnsavedModel"), //$NON-NLS-1$
                    "Dialog Error", false, Const.ERROR); //$NON-NLS-1$
            throw new ModelerException(
                    BaseMessages.getString(ModelerWorkspace.class, "ModelServerPublish.Publish.UnsavedModel"));
        }

        ModelServerPublish publisher = new ModelServerPublish();
        publisher.setModel(workspace);
        Spoon spoon = ((Spoon) SpoonFactory.getInstance());
        try {
            XulDialogPublish publishDialog = new XulDialogPublish(spoon.getShell());
            publishDialog.setFolderTreeDepth(treeDepth);
            publishDialog.setDatabaseMeta(databaseMeta);

            publishDialog.setFilename(publishingFile);
            publishDialog.setCheckDatasources(checkDatasources);
            publishDialog.setPathTemplate(serverPathTemplate);
            publishDialog.setPath(cachedPath);
            publishDialog.setSelectedServer(cachedServer);
            publishDialog.setModelName(workspace.getModelName());
            if (showFolders)
                publishDialog.showFileGroupBoxFolder();
            else
                publishDialog.hideFileGroupBoxFolder();
            try {
                publishDialog.showDialog();
            } catch (Exception e) {
                e.printStackTrace();
            }
            if (publishDialog.isAccepted()) {
                // now try to publish
                String selectedPath = publishDialog.getPath();
                if (selectedPath != null) {
                    cachedPath = selectedPath;
                } else {
                    selectedPath = cachedPath;
                }
                // we always publish to {solution}/resources/metadata
                BiServerConnection biServerConnection = publishDialog.getBiServerConnection();
                publisher.setBiServerConnection(biServerConnection);
                cachedServer = biServerConnection;
                boolean publishDatasource = publishDialog.isPublishDataSource();
                String repositoryPath = null;
                if (serverPathTemplate != null) {
                    String selectedSolution = null;
                    if (selectedPath.indexOf(RepositoryFile.SEPARATOR) != -1) { //$NON-NLS-1$
                        selectedSolution = selectedPath.substring(0,
                                selectedPath.indexOf(RepositoryFile.SEPARATOR)); //$NON-NLS-1$   
                    } else {
                        selectedSolution = selectedPath;
                    }
                    repositoryPath = serverPathTemplate.replace("{path}", selectedSolution); //$NON-NLS-1$
                }
                if (publishingFile.endsWith(XMI_EXT)) { //$NON-NLS-1$
                    selectedPath = repositoryPath;
                }

                String filename = publishDialog.getFilename();

                try {
                    //need to create and store the XMI file in /tmp first
                    String tempXmiFilename = workspace.getModel().getName() + XMI_EXT;
                    File tempXmi = createTempFile(workspace.getFileName(), tempXmiFilename);
                    File tempF = createTempFile(fullPathtoFile, filename);

                    replaceAttributeValue("report", "catalog", workspace.getModelName(), //$NON-NLS-1$//$NON-NLS-2$
                            tempXmi.getAbsolutePath());
                    replaceAttributeValue("report", "catalog", workspace.getModelName(), //$NON-NLS-1$//$NON-NLS-2$
                            tempF.getAbsolutePath());

                    publisher.publishToServer(workspace.getModelName() + MONDRIAN_XML, databaseName,
                            workspace.getModelName(), repositoryPath, selectedPath, publishDatasource, true,
                            publishDialog.isExistentDatasource(), true, tempF.getAbsolutePath());

                } catch (Exception ex) {
                    Log.error(ex.getLocalizedMessage(), ex);
                    throw new ModelerException(ex);
                }
            }
        } catch (XulException e) {
            Log.error(e.getLocalizedMessage(), e);
            SpoonFactory.getInstance().messageBox("Could not create dialog: " + e.getLocalizedMessage(), //$NON-NLS-1$
                    "Dialog Error", //$NON-NLS-1$
                    false, Const.ERROR);
        }
    } catch (Exception e) {
        Log.error(e.getLocalizedMessage(), e);
        SpoonFactory.getInstance().messageBox(
                BaseMessages.getString(PublisherHelper.class, "PublisherHelper.PublishError"),
                BaseMessages.getString(PublisherHelper.class, "PublisherHelper.PublishErrorTitle"), false,
                Const.ERROR);
        throw new ModelerException(e);
    }
    return fullPathtoFile;
}

From source file:org.pentaho.agilebi.spoon.publish.PublisherHelper.java

public static String publish(ModelerWorkspace workspace, String publishingFile, int treeDepth,
        DatabaseMeta databaseMeta, String filename, boolean checkDatasources, boolean setShowModel,
        boolean showFolders, boolean showCurrentFolder, boolean isExistentDatasource, String serverPathTemplate,
        String extension, String databaseName) throws ModelerException {
    try {//w ww  . j  a va2  s. c  o  m

        if (StringUtils.isEmpty(publishingFile)) {
            SpoonFactory.getInstance().messageBox(
                    BaseMessages.getString(ModelerWorkspace.class, "ModelServerPublish.Publish.UnsavedModel"),
                    "Dialog Error", false, Const.ERROR); //$NON-NLS-1$
            throw new ModelerException(
                    BaseMessages.getString(ModelerWorkspace.class, "ModelServerPublish.Publish.UnsavedModel"));
        }

        ModelServerPublish publisher = new ModelServerPublish();
        publisher.setModel(workspace);
        Spoon spoon = ((Spoon) SpoonFactory.getInstance());
        try {
            XulDialogPublish publishDialog = new XulDialogPublish(spoon.getShell());
            publishDialog.setDatabaseMeta(databaseMeta);
            publishDialog.setFilename(filename);
            publishDialog.setCheckDatasources(checkDatasources);
            publishDialog.setSelectedServer(cachedServer);
            if (showFolders)
                publishDialog.showFileGroupBoxFolder();
            else
                publishDialog.hideFileGroupBoxFolder();
            try {

                publishDialog.showDialog();
            } catch (Exception e) {
                e.printStackTrace();
            }
            if (publishDialog.isAccepted()) {
                // now try to publisher.setModelerHelperInstance()
                String selectedPath = publishDialog.getPath();
                cachedPath = selectedPath;
                // we always publish to {solution}/resources/metadata
                BiServerConnection biServerConnection = publishDialog.getBiServerConnection();
                cachedServer = biServerConnection;
                publisher.setBiServerConnection(biServerConnection);
                boolean publishDatasource = publishDialog.isPublishDataSource();
                String repositoryPath = "/";
                if (serverPathTemplate != null) {
                    String selectedSolution = null;
                    if (selectedPath != null && selectedPath.indexOf("/") != -1) { //$NON-NLS-1$
                        selectedSolution = selectedPath.substring(0, selectedPath.indexOf("/")); //$NON-NLS-1$   
                    } else {
                        if (selectedPath != null)
                            selectedSolution = selectedPath;
                    }
                    if (selectedSolution != null)
                        repositoryPath = serverPathTemplate.replace("{path}", selectedSolution); //$NON-NLS-1$
                }
                if (publishingFile.endsWith(XMI_EXT)) { //$NON-NLS-1$
                    selectedPath = repositoryPath;
                }

                filename = publishDialog.getFilename();
                String tempFilename = filename + extension;

                File tempF = createTempFile(publishingFile, tempFilename);

                replaceAttributeValue("report", "catalog", workspace.getModelName(), tempF.getAbsolutePath()); //$NON-NLS-1$ //$NON-NLS-2$

                publisher.publishToServer(workspace.getModelName() + MONDRIAN_XML, databaseName,
                        workspace.getModelName(), repositoryPath, selectedPath, publishDatasource, true,
                        publishDialog.isExistentDatasource(), false, tempF.getAbsolutePath());

            }

        } catch (XulException e) {
            Log.error(e.getLocalizedMessage(), e);
            SpoonFactory.getInstance().messageBox("Could not create dialog: " + e.getLocalizedMessage(), //$NON-NLS-1$
                    "Dialog Error", //$NON-NLS-1$
                    false, Const.ERROR);
        }
    } catch (Exception e) {
        Log.error(e.getLocalizedMessage(), e);
        SpoonFactory.getInstance().messageBox(
                BaseMessages.getString(PublisherHelper.class, "PublisherHelper.PublishError"),
                BaseMessages.getString(PublisherHelper.class, "PublisherHelper.PublishErrorTitle"), false,
                Const.ERROR);
        throw new ModelerException(e);
    }
    return filename;
}

From source file:us.mn.state.health.lims.reports.action.implementation.ExportProjectByDate.java

public void setRequestParameters(BaseActionForm dynaForm) {
    try {/*w ww.  ja  v  a  2s .  co  m*/
        PropertyUtils.setProperty(dynaForm, "reportName", getReportNameForParameterPage());
        PropertyUtils.setProperty(dynaForm, "useLowerDateRange", Boolean.TRUE);
        PropertyUtils.setProperty(dynaForm, "useUpperDateRange", Boolean.TRUE);
        PropertyUtils.setProperty(dynaForm, "useProjectCode", Boolean.TRUE);
        PropertyUtils.setProperty(dynaForm, "projectCodeList", getProjectList());
    } catch (Exception e) {
        Log.error("Error in ExportProjectByDate.setRequestParemeters: ", e);
    }
}

From source file:us.mn.state.health.lims.reports.action.implementation.ExportProjectByDate.java

/**
 * creating the list for generation to the report
 *//*from w  ww .  j ava  2s . c om*/
private void createReportItems() {
    try {
        csvColumnBuilder = getColumnBuilder(projectStr);
        csvColumnBuilder.buildDataSource();
    } catch (Exception e) {
        Log.error("Error in " + this.getClass().getSimpleName() + ".createReportItems: ", e);
        add1LineErrorMessage("report.error.message.general.error");
    }
}

From source file:us.mn.state.health.lims.reports.action.implementation.HaitiExportReport.java

public void setRequestParameters(BaseActionForm dynaForm) {
    try {/*  w w w  . j a  v a 2 s . com*/
        PropertyUtils.setProperty(dynaForm, "reportName", getReportNameForParameterPage());
        PropertyUtils.setProperty(dynaForm, "useLowerDateRange", Boolean.TRUE);
        PropertyUtils.setProperty(dynaForm, "useUpperDateRange", Boolean.TRUE);
    } catch (Exception e) {
        Log.error("Error in " + this.getClass().getSimpleName() + ".setRequestParemeters: ", e);
    }
}

From source file:us.mn.state.health.lims.reports.action.implementation.HaitiExportReport.java

/**
 * creating the list for generation to the report, putting results in resultSet
 */// w w w  .  j av a 2  s .  c  o m
private void createReportItems() {
    try {
        // we have to round up everything via hibernate first, since many of our DAO methods close the connection
        ResourceTranslator.DictionaryTranslator.getInstance();
        ResourceTranslator.GenderTranslator.getInstance();

        csvColumnBuilder = new HaitiColumnBuilder(dateRange);
        csvColumnBuilder.buildDataSource();
    } catch (Exception e) {
        Log.error("Error in " + this.getClass().getSimpleName() + ".createReportItems: ", e);
        e.printStackTrace();
        add1LineErrorMessage("report.error.message.general.error");
    }
}

From source file:us.mn.state.health.lims.reports.action.implementation.RetroCIFollowupRequiredByLocation.java

/**
 * @see us.mn.state.health.lims.reports.action.implementation.IReportParameterSetter#setRequestParameters(us.mn.state.health.lims.common.action.BaseActionForm)
 */// w  w w  .  j av  a2 s.  c o  m
@Override
public void setRequestParameters(BaseActionForm dynaForm) {
    try {
        PropertyUtils.setProperty(dynaForm, "reportName", getReportNameForParameterPage());
        PropertyUtils.setProperty(dynaForm, "useLowerDateRange", Boolean.TRUE);
        PropertyUtils.setProperty(dynaForm, "useUpperDateRange", Boolean.TRUE);
    } catch (Exception e) {
        Log.error("Error in FollowupRequired_ByLocation.setRequestParemeters: ", e);
        // throw e;
    }
}