Package com.peusoft.ptcollect.core.err

Examples of com.peusoft.ptcollect.core.err.PTException


    public GenericDao getDao(Class<? extends AbstractDomainObject> clazz) {
        GenericDao dao = daoMap.get(clazz);
        if (dao != null) {
            return dao;
        } else {
            throw new PTException(ErrorCode.ERR_PERSISTENCE_DAO_NOT_SUPPORTED,
                    messageHelper.getErrorMessage(ErrorCode.ERR_PERSISTENCE_DAO_NOT_SUPPORTED,
                    new Object[]{null},
                    "Not supported domain object class."));
        }
    }
View Full Code Here


            String msg = messageHelper.getErrorMessage(
                    ErrorCode.ERR_WRONG_PARAMETER,
                    new Object[]{"from", from},
                    "from must be set.");
            LOGGER.error(msg);
            throw new PTException(
                    ErrorCode.ERR_WRONG_PARAMETER,
                    msg);
        }
        if (till == null) {
            String msg = messageHelper.getErrorMessage(
                    ErrorCode.ERR_WRONG_PARAMETER,
                    new Object[]{"till", till},
                    "till must be set.");
            LOGGER.error(msg);
            throw new PTException(
                    ErrorCode.ERR_WRONG_PARAMETER,
                    msg);
        }
        if (writer == null) {
            LOGGER.error("writer can't be null");
            throw new PTException(
                    ErrorCode.ERR_WRONG_PARAMETER,
                    messageHelper.getErrorMessage(
                    ErrorCode.ERR_WRONG_PARAMETER,
                    "writer can't be null."));
        }
View Full Code Here

            String msg = messageHelper.getErrorMessage(
                    ErrorCode.ERR_WRONG_PARAMETER,
                    new Object[]{"year", new Integer(year)},
                    "year is wrong");
            LOGGER.error(msg);
            throw new PTException(
                    ErrorCode.ERR_WRONG_PARAMETER,
                    msg);
        }
        if (week < 0 || week > 60) {
            String msg = messageHelper.getErrorMessage(
                    ErrorCode.ERR_WRONG_PARAMETER,
                    new Object[]{"week", new Integer(week)},
                    "week is wrong");
            LOGGER.error(msg);
            throw new PTException(
                    ErrorCode.ERR_WRONG_PARAMETER,
                    msg);
        }
        Calendar from = Calendar.getInstance();
        from.set(Calendar.YEAR, year);
View Full Code Here

        try {
            ve.init();
        } catch (Exception e) {
            String msg = messageHelper.getErrorMessage(ErrorCode.ERR_VELOCITY, "Can't init Velocity.");
            LOGGER.error(msg, e);
            throw new PTException(ErrorCode.ERR_VELOCITY, msg, e);
        }
        VelocityContext vc = new VelocityContext();
        vc.put("reportContext", reportContext);
        try {
            Template templ = ve.getTemplate(templateName);
            templ.merge(vc, writer);
        } catch (Exception e) {
            String msg = messageHelper.getErrorMessage(ErrorCode.ERR_VELOCITY, "Can't merge template.");
            LOGGER.error(msg, e);
            throw new PTException(ErrorCode.ERR_VELOCITY, msg, e);
        }
    }
View Full Code Here

     * @throws PTException if the parameter value is wrong
     */
    protected Calendar[] createPeriodForYear(int year) {
        Calendar cal = Calendar.getInstance();
        if (wrongYear(year, cal)) {
            throw new PTException(
                    ErrorCode.ERR_WRONG_PARAMETER,
                    messageHelper.getErrorMessage(
                    ErrorCode.ERR_WRONG_PARAMETER,
                    new Object[]{"year", Integer.valueOf(year)},
                    "year has not allowed value."));
View Full Code Here

     * @throws PTException if the parameter value is wrong
     */
    protected Calendar[] createPeriodForMonth(int month, int year) {
        Calendar cal = Calendar.getInstance();
        if (wrongYear(year, cal)) {
            throw new PTException(
                    ErrorCode.ERR_WRONG_PARAMETER,
                    messageHelper.getErrorMessage(
                    ErrorCode.ERR_WRONG_PARAMETER,
                    new Object[]{"year", Integer.valueOf(year)},
                    "year has not allowed value."));
        }
        cal.set(Calendar.YEAR, year);
        if (wrongMonth(month, cal)) {
            throw new PTException(
                    ErrorCode.ERR_WRONG_PARAMETER,
                    messageHelper.getErrorMessage(
                    ErrorCode.ERR_WRONG_PARAMETER,
                    new Object[]{"month", Integer.valueOf(month)},
                    "month has not allowed value."));
View Full Code Here

     * @throws PTException if the parameter value is wrong
     */
    protected Calendar[] createPeriodForWeek(int week, int year) {
        Calendar cal = Calendar.getInstance();
        if (wrongYear(year, cal)) {
            throw new PTException(
                    ErrorCode.ERR_WRONG_PARAMETER,
                    messageHelper.getErrorMessage(
                    ErrorCode.ERR_WRONG_PARAMETER,
                    new Object[]{"year", Integer.valueOf(year)},
                    "year has not allowed value."));
        }
        cal.set(Calendar.YEAR, year);
        if (wrongWeekOfYear(week, cal)) {
            throw new PTException(
                    ErrorCode.ERR_WRONG_PARAMETER,
                    messageHelper.getErrorMessage(
                    ErrorCode.ERR_WRONG_PARAMETER,
                    new Object[]{"week", Integer.valueOf(week)},
                    "week has not allowed value."));
View Full Code Here

    @Override
    public List<WorkDay> getWorkDaysForPeriod(Calendar begin, Calendar end, User user) {

        if (begin == null) {
            throw new PTException(
                    ErrorCode.ERR_WRONG_PARAMETER,
                    messageHelper.getErrorMessage(
                    ErrorCode.ERR_WRONG_PARAMETER,
                    new Object[]{"begin", begin},
                    "begin of the parameter is null."));
        }
        if (end == null || end.before(begin)) {
            throw new PTException(
                    ErrorCode.ERR_WRONG_PARAMETER,
                    messageHelper.getErrorMessage(
                    ErrorCode.ERR_WRONG_PARAMETER,
                    new Object[]{"end", end},
                    "end of the parameter is null or period's end is before the period's begin."));
        }
        if (user == null) {
            throw new PTException(
                    ErrorCode.ERR_WRONG_PARAMETER,
                    messageHelper.getErrorMessage(
                    ErrorCode.ERR_WRONG_PARAMETER,
                    new Object[]{"user", user},
                    "user of the parameter is null."));
View Full Code Here

    @Override
    public List<WorkDayTimeRecord> getWorkTimeRecordsForPeriod(Calendar begin, Calendar end, Project project, User user) {

        if (begin == null) {
            throw new PTException(
                    ErrorCode.ERR_WRONG_PARAMETER,
                    messageHelper.getErrorMessage(
                    ErrorCode.ERR_WRONG_PARAMETER,
                    new Object[]{"begin", begin},
                    "begin of the parameter is null."));
        }
        if (end == null) {
            throw new PTException(
                    ErrorCode.ERR_WRONG_PARAMETER,
                    messageHelper.getErrorMessage(
                    ErrorCode.ERR_WRONG_PARAMETER,
                    new Object[]{"end", end},
                    "end of the parameter is null."));
        }
        if (user == null) {
            throw new PTException(
                    ErrorCode.ERR_WRONG_PARAMETER,
                    messageHelper.getErrorMessage(
                    ErrorCode.ERR_WRONG_PARAMETER,
                    new Object[]{"user", user},
                    "user of the parameter is null."));
View Full Code Here

    }

    @Override
    public void changePassword(User user, String newPwd) throws PTException {
        if (user == null) {
            throw new PTException(
                    ErrorCode.ERR_WRONG_PARAMETER,
                    messageHelper.getErrorMessage(
                    ErrorCode.ERR_WRONG_PARAMETER,
                    new Object[]{"user", user},
                    "one of the parameter is null."));
        }
        if (newPwd == null) {
            throw new PTException(
                    ErrorCode.ERR_WRONG_PARAMETER,
                    messageHelper.getErrorMessage(
                    ErrorCode.ERR_WRONG_PARAMETER,
                    new Object[]{"newPwd", newPwd},
                    "one of the parameter is null."));
View Full Code Here

TOP

Related Classes of com.peusoft.ptcollect.core.err.PTException

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.