Package org.projectforge.core

Examples of org.projectforge.core.UserException


      sval = parameters.get(PARAMETER_ADDRESS_ID);
      final Integer addressId = sval.isEmpty() ? null : sval.toInteger();
      sval = parameters.get(PARAMETER_ADDRESS_CAMPAIGN_ID);
      final Integer addressCampaignId = sval.isEmpty() || "null".equals(sval.toString()) ? null : sval.toInteger();
      if (addressId == null || addressCampaignId == null) {
        throw new UserException("plugins.marketing.addressCampaignValue.error.addressOrCampaignNotGiven");
      }
      final AddressDO address = addressDao.getById(addressId);
      final AddressCampaignDO addressCampaign = addressCampaignDao.getById(addressCampaignId);
      if (address == null || addressCampaign == null) {
        throw new UserException("plugins.marketing.addressCampaignValue.error.addressOrCampaignNotGiven");
      }
      AddressCampaignValueDO data = addressCampaignValueDao.get(addressId, addressCampaignId);
      if (data == null) {
        data = new AddressCampaignValueDO();
        data.setAddress(address);
View Full Code Here


    storage.setFilename(filename);
    final BuchungssatzExcelImporter imp = new BuchungssatzExcelImporter(storage, kontoDao, kost1Dao, kost2Dao, actionLog);
    try {
      imp.doImport(is);
    } catch (final ExcelImportException ex) {
      throw new UserException("common.import.excel.error", ex.getMessage(), ex.getRow(), ex.getColumnname());
    }
    return storage;
      }
View Full Code Here

    checkLoggeinUserRight(accessChecker);
    Validate.notNull(storage.getSheets());
    final ImportedSheet< ? > sheet = storage.getNamedSheet(sheetName);
    Validate.notNull(sheet);
    if (sheet.getStatus() != ImportStatus.RECONCILED) {
      throw new UserException("common.import.action.commit.error.notReconciled");
    }
    int no = -1;
    if (storage.getId() == Type.KONTENPLAN) {
      no = commitKontenplan((ImportedSheet<KontoDO>) sheet);
    } else {
View Full Code Here

      if (year == 0) {
        year = date.getYear();
      } else if (year != date.getYear()) {
        final String msg = "Not supported: Buchungssätze innerhalb eines Excel-Sheets liegen in verschiedenen Jahren: Im Blatt '" + sheet.getSheetName() + "', in Zeile " + (i + 2);
        actionLog.logError(msg);
        throw new UserException(msg);
      }
      if (date.getMonth() > month) {
        final String msg = "Buchungssätze können nicht in die Zukunft für den aktuellen Monat '"
            + KostFormatter.formatBuchungsmonat(year, date.getMonth())
            + " gebucht werden! "
View Full Code Here

          }
        }
      }
    } catch (final Exception ex) {
      log.error(ex.getMessage(), ex);
      throw new UserException(PFUserContext.getLocalizedString("finance.datev.import.error.titleRowMissed"));
    }
  }
View Full Code Here

      final TimesheetDO ts = list.get(0);
      if (throwException == true) {
        log.info("Time sheet collision detected of time sheet " + timesheet + " with existing time sheet " + ts);
        final String startTime = DateHelper.formatIsoTimestamp(ts.getStartTime());
        final String stopTime = DateHelper.formatIsoTimestamp(ts.getStopTime());
        throw new UserException("timesheet.error.timeperiodOverlapDetection", new MessageParam(ts.getId()), new MessageParam(startTime),
            new MessageParam(stopTime));
      }
      return true;
    }
    return false;
View Full Code Here

  {
    if (obj.getId() == null) {
      List list = getHibernateTemplate().find("from EmployeeSalaryDO s where s.year = ? and s.month = ? and s.employee.id = ?",
          new Object[] { obj.getYear(), obj.getMonth(), obj.getEmployeeId()});
      if (CollectionUtils.isNotEmpty(list) == true) {
        throw new UserException("fibu.employee.salary.error.salaryAlreadyExist");
      }
    } else {
      List list = getHibernateTemplate().find("from EmployeeSalaryDO s where s.year = ? and s.month = ? and s.employee.id = ? and id <> ?",
          new Object[] { obj.getYear(), obj.getMonth(), obj.getEmployeeId(), obj.getId()});
      if (CollectionUtils.isNotEmpty(list) == true) {
        throw new UserException("fibu.employee.salary.error.salaryAlreadyExist");
      }
    }
  }
View Full Code Here

    for (final MenuEntry menuEntry : menuEntries) {
      buildElement(root.addElement("item"), menuEntry);
    }
    final String xml = document.asXML();
    if (xml.length() > UserXmlPreferencesDO.MAX_SERIALIZED_LENGTH) {
      throw new UserException("menu.favorite.maxSizeExceeded");
    }
    UserPreferencesHelper.putEntry(USER_PREF_FAVORITES_MENU_ENTRIES_KEY, xml, true);
    UserPreferencesHelper.putEntry(USER_PREF_FAVORITES_MENU_KEY, this, false);
    if (log.isDebugEnabled() == true) {
      log.debug("Favorites menu stored: " + xml);
View Full Code Here

  @SuppressWarnings("unchecked")
  @Override
  protected void onSaveOrModify(final AuftragDO obj)
  {
    if (obj.getNummer() == null) {
      throw new UserException("validation.required.valueNotPresent", new MessageParam("fibu.auftrag.nummer", MessageParamType.I18N_KEY));
    }
    if (obj.getId() == null) {
      // Neuer Auftrag/Angebot
      final Integer next = getNextNumber(obj);
      if (next.intValue() != obj.getNummer().intValue()) {
        throw new UserException("fibu.auftrag.error.nummerIstNichtFortlaufend");
      }
    } else {
      final List<RechnungDO> list = getHibernateTemplate().find("from AuftragDO r where r.nummer = ? and r.id <> ?",
          new Object[] { obj.getNummer(), obj.getId()});
      if (list != null && list.size() > 0) {
        throw new UserException("fibu.auftrag.error.nummerBereitsVergeben");
      }
    }
    if (CollectionUtils.isEmpty(obj.getPositionen()) == true) {
      throw new UserException("fibu.auftrag.error.auftragHatKeinePositionen");
    }
    final int size = obj.getPositionen().size();
    for (int i = size - 1; i > 0; i--) {
      // Don't remove first position, remove only the last empty positions.
      final AuftragsPositionDO position = obj.getPositionen().get(i);
View Full Code Here

  @Override
  protected void onSaveOrModify(final RechnungDO obj)
  {
    if (obj.getTyp() == RechnungTyp.GUTSCHRIFTSANZEIGE_DURCH_KUNDEN) {
      if (obj.getNummer() != null) {
        throw new UserException("fibu.rechnung.error.gutschriftsanzeigeDarfKeineRechnungsnummerHaben");
      }
    } else {
      if (obj.getNummer() == null) {
        throw new UserException("validation.required.valueNotPresent", new MessageParam("fibu.rechnung.nummer", MessageParamType.I18N_KEY));
      }
      if (obj.getId() == null) {
        // Neue Rechnung
        final Integer next = getNextNumber(obj);
        if (next.intValue() != obj.getNummer().intValue()) {
          throw new UserException("fibu.rechnung.error.rechnungsNummerIstNichtFortlaufend");
        }
      } else {
        final List<RechnungDO> list = getHibernateTemplate().find("from RechnungDO r where r.nummer = ? and r.id <> ?",
            new Object[] { obj.getNummer(), obj.getId()});
        if (list != null && list.size() > 0) {
          throw new UserException("fibu.rechnung.error.rechnungsNummerBereitsVergeben");
        }
      }
    }
    if (obj.getZahlBetrag() != null) {
      obj.setZahlBetrag(obj.getZahlBetrag().setScale(2, RoundingMode.HALF_UP));
    }
    obj.recalculate();
    if (CollectionUtils.isEmpty(obj.getPositionen()) == true) {
      throw new UserException("fibu.rechnung.error.rechnungHatKeinePositionen");
    }
    final int size = obj.getPositionen().size();
    for (int i = size - 1; i > 0; i--) {
      // Don't remove first position, remove only the last empty positions.
      final RechnungsPositionDO position = obj.getPositionen().get(i);
View Full Code Here

TOP

Related Classes of org.projectforge.core.UserException

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.