mirror of
https://github.com/klmp200/PQT_Gestionnaire_vente_stock.git
synced 2024-12-22 23:41:09 +00:00
Module Client : correction d'un bug faisant que le compte utilisateur n'était pas ajouté au message, provoquant le rejet systématique des requêtes
This commit is contained in:
parent
c6de9e87a8
commit
5217b6f782
@ -26,6 +26,8 @@ public class ClientBackEndModuleManager {
|
||||
statService = new StatService(queryExecutor);
|
||||
networkService = new NetworkService(queryExecutor, connectionService);
|
||||
|
||||
queryExecutor.setAccountService(accountService);
|
||||
|
||||
networkService.addListener(new INetworkServiceListener() {
|
||||
@Override
|
||||
public void onPQTPingSuccessEvent(String host, Integer port) {
|
||||
|
@ -1,5 +1,6 @@
|
||||
package com.pqt.client.module.query;
|
||||
|
||||
import com.pqt.client.module.account.AccountService;
|
||||
import com.pqt.client.module.connection.ConnectionService;
|
||||
import com.pqt.client.module.connection.listeners.IConnectionListener;
|
||||
import com.pqt.client.module.query.exceptions.HeaderNotFoundException;
|
||||
@ -29,6 +30,10 @@ public class QueryExecutor {
|
||||
this.messageFactory = new QueryMessageFactory(messageToolFactory);
|
||||
}
|
||||
|
||||
public void setAccountService(AccountService accountService){
|
||||
messageFactory.setAccountService(accountService);
|
||||
}
|
||||
|
||||
public void executeSaleQuery(Sale sale, INoItemMessageCallback callback) {
|
||||
sendMessage(messageFactory.newSaleMessage(sale), callback, MessageType.ACK_SALE);
|
||||
}
|
||||
|
@ -1,5 +1,6 @@
|
||||
package com.pqt.client.module.query;
|
||||
|
||||
import com.pqt.client.module.account.AccountService;
|
||||
import com.pqt.core.communication.IMessageToolFactory;
|
||||
import com.pqt.core.entities.messages.Message;
|
||||
import com.pqt.core.entities.messages.MessageType;
|
||||
@ -15,9 +16,15 @@ import java.util.Map;
|
||||
class QueryMessageFactory {
|
||||
|
||||
private final IMessageToolFactory messageToolFactory;
|
||||
private AccountService accountService;
|
||||
|
||||
QueryMessageFactory(IMessageToolFactory messageToolFactory) {
|
||||
this.messageToolFactory = messageToolFactory;
|
||||
accountService = null;
|
||||
}
|
||||
|
||||
void setAccountService(AccountService accountService){
|
||||
this.accountService = accountService;
|
||||
}
|
||||
|
||||
Message newSaleMessage(Sale sale) {
|
||||
@ -60,8 +67,10 @@ class QueryMessageFactory {
|
||||
}
|
||||
|
||||
private Message newSimpleMessage(MessageType type, Map<String, String> fields){
|
||||
return new Message(type, null, null, null, null, fields);
|
||||
}
|
||||
//TODO add emitter
|
||||
Account account = accountService!=null?accountService.getCurrentAccount():null;
|
||||
return new Message(type, null, null, account, null, fields);
|
||||
}
|
||||
|
||||
private Message newSimpleMessage(MessageType type){
|
||||
return newSimpleMessage(type, null);
|
||||
|
Loading…
Reference in New Issue
Block a user