@Override public Collection<CustomerBrokerNegotiation> getSales(final NegotiationStatus status) throws CantGetSaleNegotiationException { try { HashSet<CustomerBrokerNegotiation> sales = new HashSet<>(); for (CustomerBrokerNegotiation sale : saleNegotiationManager.getNegotiationsByBroker(identity)) { if (sale.getStatus() == status) sales.add(sale); } return sales; } catch (CantGetListSaleNegotiationsException e) { throw new CantGetSaleNegotiationException( CantGetSaleNegotiationException.DEFAULT_MESSAGE, e, "", ""); } }
@Override public CustomerBrokerNegotiation getSale(final UUID negotiationId) throws CantGetSaleNegotiationException { try { for (CustomerBrokerNegotiation sale : saleNegotiationManager.getNegotiationsByBroker(identity)) { if (sale.getNegotiationId().equals(negotiationId)) return sale; } throw new CantGetSaleNegotiationException( CantGetSaleNegotiationException.DEFAULT_MESSAGE, null, "Negotiation ID: " + negotiationId.toString(), "NegotiationId not Found"); } catch (CantGetListSaleNegotiationsException e) { throw new CantGetSaleNegotiationException( CantGetSaleNegotiationException.DEFAULT_MESSAGE, e, "", ""); } }