diff --git a/src/cli/java/org/commcare/util/screen/EntityScreenContext.java b/src/cli/java/org/commcare/util/screen/EntityScreenContext.java index c6b50b99e..4a8f5735d 100644 --- a/src/cli/java/org/commcare/util/screen/EntityScreenContext.java +++ b/src/cli/java/org/commcare/util/screen/EntityScreenContext.java @@ -3,7 +3,7 @@ /** * Holds essential meta data associated with the entity screen */ -public class EntityScreenContext { +public class EntityScreenContext extends ScreenContext{ private final int mOffSet; private final String mSearchText; private final int mSortIndex; @@ -21,6 +21,7 @@ public class EntityScreenContext { public EntityScreenContext(int offset, String searchText, int sortIndex, int casesPerPage, String[] selectedValues, String detailSelection, boolean isFuzzySearch) { + super(true); mOffSet = offset; mSearchText = searchText; mSortIndex = sortIndex; @@ -31,6 +32,11 @@ public EntityScreenContext(int offset, String searchText, int sortIndex, int cas } public EntityScreenContext() { + this(true); + } + + public EntityScreenContext(boolean respectRelevancy) { + super(respectRelevancy); mOffSet = 0; mSearchText = null; mSortIndex = 0; diff --git a/src/cli/java/org/commcare/util/screen/MenuScreen.java b/src/cli/java/org/commcare/util/screen/MenuScreen.java index 9ac439cf4..c43115d5a 100644 --- a/src/cli/java/org/commcare/util/screen/MenuScreen.java +++ b/src/cli/java/org/commcare/util/screen/MenuScreen.java @@ -59,6 +59,20 @@ public boolean handleAutoMenuAdvance(SessionWrapper sessionWrapper, boolean resp return false; } + /** + * Checks whether a menu with given menuId exists and is a visible option on menu screen + * @param menuId id of the menu we want to check visiblility for + * @return true if menu exists and is visible, false otherwise + */ + public boolean isMenuVisible(String menuId) { + for (MenuDisplayable menuDisplayable : getMenuDisplayables()) { + if(menuDisplayable.getCommandID().contentEquals(menuId)){ + return true; + } + } + return false; + } + class ScreenLogger implements LoggerInterface { @Override diff --git a/src/cli/java/org/commcare/util/screen/ScreenContext.java b/src/cli/java/org/commcare/util/screen/ScreenContext.java new file mode 100644 index 000000000..0a1c3b2ea --- /dev/null +++ b/src/cli/java/org/commcare/util/screen/ScreenContext.java @@ -0,0 +1,13 @@ +package org.commcare.util.screen; +public class ScreenContext { + + private boolean respectRelevancy; + + public ScreenContext(boolean respectRelevancy) { + this.respectRelevancy = respectRelevancy; + } + + public boolean isRespectRelevancy() { + return respectRelevancy; + } +}