Skip to content

Commit

Permalink
IView.invalidateRowById
Browse files Browse the repository at this point in the history
  • Loading branch information
teosarca committed Sep 7, 2017
1 parent aa0eac4 commit fb7e2a7
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 2 deletions.
7 changes: 6 additions & 1 deletion src/main/java/de/metas/ui/web/view/DefaultView.java
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,12 @@ public void invalidateAll()
{
// TODO recreate defaultSelection, clear selectionsByOrderBys etc
cache_rowsById.clear();

}

@Override
public void invalidateRowById(final DocumentId rowId)
{
cache_rowsById.remove(rowId);
}

private final void assertNotClosed()
Expand Down
18 changes: 17 additions & 1 deletion src/main/java/de/metas/ui/web/view/IView.java
Original file line number Diff line number Diff line change
Expand Up @@ -86,10 +86,26 @@ default boolean isIncludedView()
boolean isQueryLimitHit();

/**
* NOTE: don't call this directly it shall be called by API.
* Invalidate ALL view rows.
*
* NOTE: this method is NOT sending websocket notifications
*/
void invalidateAll();

/**
* Invalidate given row by ID.
*
* If there is no custom implementation then this method will invalidate all by default.
*
* NOTE: this method is NOT sending websocket notifications
*
* @param rowId
*/
default void invalidateRowById(final DocumentId rowId)
{
invalidateAll();
}

ViewResult getPage(int firstRow, int pageLength, List<DocumentQueryOrderBy> orderBys);

default ViewResult getPageWithRowIdsOnly(final int firstRow, final int pageLength, final List<DocumentQueryOrderBy> orderBys)
Expand Down

0 comments on commit fb7e2a7

Please sign in to comment.