-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
https://dev.untill.com/projects/#!691698 Co-authored-by: sda <[email protected]>
- Loading branch information
1 parent
4b4cc31
commit ea2dc50
Showing
5 changed files
with
101 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
# Tables operations handler - ITablesHandler | ||
POS invokes this interface when | ||
- Table is dirty | ||
- Table is clean | ||
Example implementation | ||
```java | ||
public class TablesHandler implements ITablesHandler { | ||
|
||
@Override | ||
public void operation(DriverConfiguration cfg, TableChangedRequest req) { | ||
if (req instanceof TableDirtyChangedRequest) { | ||
return handleTableDirtyChangedRequest(cfg, req); | ||
} else { | ||
throw new IllegalArgumentException("Operation not supported"); | ||
} | ||
} | ||
} | ||
``` |
21 changes: 21 additions & 0 deletions
21
src/main/java/com/untill/driver/interfaces/tables/ITablesHandler.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
package com.untill.driver.interfaces.tables; | ||
|
||
import com.untill.driver.IDriver; | ||
import com.untill.driver.interfaces.IDriverInterface; | ||
import com.untill.driver.params.DriverConfiguration; | ||
|
||
/** | ||
* Tables handler driver interface | ||
* | ||
* @see IDriverInterface | ||
* @see IDriver | ||
*/ | ||
public interface ITablesHandler extends IDriverInterface { | ||
/** | ||
* Handles table operations | ||
* | ||
* @param cfg driver instance configuration | ||
* @param req request details | ||
*/ | ||
void operation(DriverConfiguration cfg, TableChangedRequest req); | ||
} |
38 changes: 38 additions & 0 deletions
38
src/main/java/com/untill/driver/interfaces/tables/TableChangedRequest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
package com.untill.driver.interfaces.tables; | ||
|
||
import com.untill.driver.interfaces.DriverRequest; | ||
|
||
public abstract class TableChangedRequest extends DriverRequest { | ||
/** | ||
* Table number | ||
*/ | ||
private int tableNumber; | ||
/** | ||
* Table part | ||
*/ | ||
private String tablePart; | ||
|
||
public int getTableNumber() { | ||
return tableNumber; | ||
} | ||
|
||
public void setTableNumber(int tableNumber) { | ||
this.tableNumber = tableNumber; | ||
} | ||
|
||
public String getTablePart() { | ||
return tablePart; | ||
} | ||
|
||
public void setTablePart(String tablePart) { | ||
this.tablePart = tablePart; | ||
} | ||
|
||
@Override | ||
public String toString() { | ||
return "TableChangedRequest{" | ||
+ "tableNumber=" + tableNumber | ||
+ ", tablePart='" + tablePart + '\'' | ||
+ "} " + super.toString(); | ||
} | ||
} |
23 changes: 23 additions & 0 deletions
23
src/main/java/com/untill/driver/interfaces/tables/TableDirtyChangedRequest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
package com.untill.driver.interfaces.tables; | ||
|
||
public class TableDirtyChangedRequest extends TableChangedRequest { | ||
/** | ||
* The flag is <tt>true</tt> if the <tt>Sales area</tt> setting <tt>Close tables manually</tt> is checked and everything is paid otherwise <tt>false</tt> | ||
*/ | ||
private boolean dirty; | ||
|
||
public boolean isDirty() { | ||
return dirty; | ||
} | ||
|
||
public void setDirty(boolean dirty) { | ||
this.dirty = dirty; | ||
} | ||
|
||
@Override | ||
public String toString() { | ||
return "TableDirtyChangedRequest{" | ||
+ "dirty=" + dirty | ||
+ "} " + super.toString(); | ||
} | ||
} |