Exemplo n.º 1
0
  private void executeCommand(
      CreateEntity command,
      CreateResult result,
      Authentication authentication,
      AsyncCallback<CreateResult> callback) {
    if (ProjectDTO.ENTITY_NAME.equals(command.getEntityName())) {
      exception(command, callback != null);

    } else if (PersonalEventDTO.ENTITY_NAME.equals(command.getEntityName())) {
      insertPersonalEvent(command, callback);

    } else if (ProjectReportDTO.ENTITY_NAME.equals(command.getEntityName())) {
      exception(command, callback != null);

    } else if (ReminderDTO.ENTITY_NAME.equals(command.getEntityName())) {
      if (result != null) {
        reminderAsyncDAO.saveOrUpdate((ReminderDTO) result.getEntity());
      } else {
        insertReminder(command, authentication, callback);
      }

    } else if (MonitoredPointDTO.ENTITY_NAME.equals(command.getEntityName())) {
      if (result != null) {
        monitoredPointAsyncDAO.saveOrUpdate((MonitoredPointDTO) result.getEntity());
      } else {
        insertMonitoredPoint(command, authentication, callback);
      }

    } else {
      exception(command, callback != null);
    }
  }
Exemplo n.º 2
0
 private void exception(CreateEntity command, boolean throwException)
     throws UnavailableCommandException {
   if (throwException) {
     throw new UnavailableCommandException(
         "Creation of type '" + command.getEntityName() + "' is not supported yet.");
   }
 }