Example #1
0
 private void checkIsPersonalTimesheetsTypeOfWorkHours(TypeOfWorkHours type) {
   Configuration configuration = configurationDAO.getConfiguration();
   if (configuration.getPersonalTimesheetsTypeOfWorkHours().getId().equals(type.getId())) {
     throw ValidationException.invalidValueException(
         "Cannot delete the type of work hours. It is configured as type of work hours for personal timesheets.",
         type);
   }
 }
Example #2
0
 private void checkHasHourCost(TypeOfWorkHours type) {
   List hoursCost =
       getSession().createCriteria(HourCost.class).add(Restrictions.eq("type", type)).list();
   if (!hoursCost.isEmpty()) {
     throw ValidationException.invalidValueException(
         "Cannot delete type of work hours. It is being used at this moment in some cost category.",
         type);
   }
 }
Example #3
0
 private void checkIsJiraConnectorTypeOfWorkHours(TypeOfWorkHours type) {
   Connector connector = connectorDAO.findUniqueByName(PredefinedConnectors.JIRA.getName());
   if (connector != null) {
     String name =
         connector.getPropertiesAsMap().get(PredefinedConnectorProperties.JIRA_HOURS_TYPE);
     if (name.equals(type.getName())) {
       throw ValidationException.invalidValueException(
           "Cannot delete the type of work hours. It is configured as type of work hours for JIRA connector.",
           type);
     }
   }
 }
Example #4
0
 private void checkHasWorkReportLine(TypeOfWorkHours type) {
   List workReportLines =
       getSession()
           .createCriteria(WorkReportLine.class)
           .add(Restrictions.eq("typeOfWorkHours", type))
           .list();
   if (!workReportLines.isEmpty()) {
     throw ValidationException.invalidValueException(
         "Cannot delete type of work hours. It is being used at this moment in some timesheet line.",
         type);
   }
 }