// GET LIST NEW NEGOTIATION TRANSACTION PENDING TO CONFIRM public List<CustomerBrokerClose> getPendingToConfirmtNegotiation() throws CantGetNegotiationTransactionListException { try { List<CustomerBrokerClose> getTransactions = new ArrayList<>(); List<DatabaseTableRecord> record; DatabaseTable table = this.database.getTable( CustomerBrokerCloseNegotiationTransactionDatabaseConstants .CUSTOMER_BROKER_CLOSE_TABLE_NAME); if (table == null) throw new CantGetUserDeveloperIdentitiesException( "Cant check if customer broker update exists", "Customer Broker New Negotiation Transaction", ""); table.addStringFilter( CustomerBrokerCloseNegotiationTransactionDatabaseConstants .CUSTOMER_BROKER_CLOSE_STATUS_COLUMN_NAME, NegotiationTransactionStatus.PENDING_SUBMIT_CONFIRM.getCode(), DatabaseFilterType.EQUAL); table.loadToMemory(); record = table.getRecords(); if (record.isEmpty()) return getTransactions; for (DatabaseTableRecord records : record) { getTransactions.add(getCustomerBrokerCloseFromRecord(records)); } return getTransactions; } catch (CantLoadTableToMemoryException em) { throw new CantGetNegotiationTransactionListException( em.getMessage(), em, "Customer Broker Update Negotiation Transaction not return register", "Cant load " + CustomerBrokerCloseNegotiationTransactionDatabaseConstants .CUSTOMER_BROKER_CLOSE_TABLE_NAME + " table in memory."); } catch (Exception e) { throw new CantGetNegotiationTransactionListException( e.getMessage(), FermatException.wrapException(e), "Customer Broker Update Negotiation Transaction not return register", "unknown failure."); } }
// CREATE SEND NEW NEGOTIATION TRANSACTION public void createCustomerBrokerCloseNegotiationTransaction( UUID transactionId, Negotiation negotiation, NegotiationType negotiationType, NegotiationTransactionStatus statusTransaction) throws CantRegisterCustomerBrokerCloseNegotiationTransactionException { Date time = new Date(); long timestamp = time.getTime(); String negotiationXML = XMLParser.parseObject(negotiation); try { DatabaseTable table = this.database.getTable( CustomerBrokerCloseNegotiationTransactionDatabaseConstants .CUSTOMER_BROKER_CLOSE_TABLE_NAME); DatabaseTableRecord record = table.getEmptyRecord(); record.setUUIDValue( CustomerBrokerCloseNegotiationTransactionDatabaseConstants .CUSTOMER_BROKER_CLOSE_TRANSACTION_ID_COLUMN_NAME, transactionId); record.setUUIDValue( CustomerBrokerCloseNegotiationTransactionDatabaseConstants .CUSTOMER_BROKER_CLOSE_NEGOTIATION_ID_COLUMN_NAME, negotiation.getNegotiationId()); record.setStringValue( CustomerBrokerCloseNegotiationTransactionDatabaseConstants .CUSTOMER_BROKER_CLOSE_PUBLIC_KEY_BROKER_COLUMN_NAME, negotiation.getBrokerPublicKey()); record.setStringValue( CustomerBrokerCloseNegotiationTransactionDatabaseConstants .CUSTOMER_BROKER_CLOSE_PUBLIC_KEY_CUSTOMER_COLUMN_NAME, negotiation.getCustomerPublicKey()); record.setStringValue( CustomerBrokerCloseNegotiationTransactionDatabaseConstants .CUSTOMER_BROKER_CLOSE_STATUS_COLUMN_NAME, statusTransaction.getCode()); record.setStringValue( CustomerBrokerCloseNegotiationTransactionDatabaseConstants .CUSTOMER_BROKER_CLOSE_NEGOTIATION_TYPE_COLUMN_NAME, negotiationType.getCode()); record.setStringValue( CustomerBrokerCloseNegotiationTransactionDatabaseConstants .CUSTOMER_BROKER_CLOSE_NEGOTIATION_XML_COLUMN_NAME, negotiationXML); record.setLongValue( CustomerBrokerCloseNegotiationTransactionDatabaseConstants .CUSTOMER_BROKER_CLOSE_TIMESTAMP_COLUMN_NAME, timestamp); table.insertRecord(record); if (statusTransaction.getCode() == NegotiationTransactionStatus.PENDING_SUBMIT_CONFIRM.getCode()) { System.out.print( "\n\n**** 22) MOCK NEGOTIATION TRANSACTION - CUSTOMER BROKER CLOSE - DAO. CONFIRM negotiationType: " + negotiationType.getCode() + " transactionId: " + transactionId + " ****\n"); } else { System.out.print( "\n\n**** 4) MOCK NEGOTIATION TRANSACTION - CUSTOMER BROKER CLOSE - DAO. NEGOTIATION negotiationType: " + negotiationType.getCode() + "transactionId: " + transactionId + " ****\n"); } } catch (CantInsertRecordException e) { throw new CantRegisterCustomerBrokerCloseNegotiationTransactionException( e.getMessage(), e, "customer broker close Negotiation Transaction", "Cant create new customer broker close Negotiation Transaction, insert database problems."); } catch (Exception e) { throw new CantRegisterCustomerBrokerCloseNegotiationTransactionException( e.getMessage(), FermatException.wrapException(e), "customer broker close Negotiation Transaction", "Cant create new customer broker close Negotiation Transaction, unknown failure."); } }