예제 #1
0
 public void setStartDate(Date time) {
   try {
     _rentalApi.setStartDate(time);
   } catch (NoPermissionException e) {
     // TODO Auto-generated catch block
     e.printStackTrace();
   }
   _rental = _rentalApi.getRental();
   updateMessages();
 }
예제 #2
0
 public void loadExemplar(int exemplarId) {
   try {
     _rentalApi.setMediumExemplar(exemplarId);
     _rental = _rentalApi.getRental();
     updateMessages();
   } catch (NoPermissionException e) {
     // TODO Auto-generated catch block
     e.printStackTrace();
   }
 }
예제 #3
0
 public void loadCustomer(int cardId) {
   try {
     _rentalApi.setCustomer(cardId);
     _rental = _rentalApi.getRental();
     updateMessages();
   } catch (NoPermissionException e) {
     // TODO Auto-generated catch block
     e.printStackTrace();
   }
 }
예제 #4
0
 public void initialize() throws InvalidOperationException {
   try {
     _rentalApi = EjbContext.getInstance().getFactory().createRentalApi();
     _rentalApi.newRental();
     _rental = _rentalApi.getRental();
   } catch (NoPermissionException e) {
     e.printStackTrace();
   } catch (Exception e) {
     e.printStackTrace();
     throw new InvalidOperationException("Could not establish connection to server:", e);
   }
 }
예제 #5
0
  public boolean store() {
    try {
      return _rentalApi.store();
    } catch (NoPermissionException e) {
      // TODO Auto-generated catch block
      e.printStackTrace();
    }

    return false;
  }
예제 #6
0
  private void updateMessages() {
    java.util.List<ValidationMessage> remoteList = _rentalApi.getValidationMessages();

    _warningMessages = new ArrayList<ValidationMessage>();
    _errorMessages = new ArrayList<ValidationMessage>();

    for (ValidationMessage validationMessage : remoteList) {
      if (validationMessage.getStatus() == ValidationMessageStatus.Warning) {
        _warningMessages.add(validationMessage);
      } else if (validationMessage.getStatus() == ValidationMessageStatus.Error) {
        _errorMessages.add(validationMessage);
      }
    }
  }