blob: e7658397331dd320be4a479579539696aa1f5a39 [file] [log] [blame]
package org.eclipse.openk.elogbook.viewmodel;
import org.eclipse.openk.elogbook.common.NotificationStatus;
import java.util.ArrayList;
import java.util.List;
/**
* The global search criteria viewmodel.
*/
public class GlobalSearchFilter {
/** The string to search for. */
private String searchString;
/** The responsibility forwarding. */
private String responsibilityForwarding;
/** indicate whether to find notifications with status open */
private Boolean statusOpenSelection;
/** indicate whether to find notifications with status in work */
private Boolean statusInWorkSelection;
/** indicate whether to find notifications with status done */
private Boolean statusDoneSelection;
/** indicate whether to find notifications with status closed */
private Boolean statusClosedSelection;
/** key referring branch */
private Integer fkRefBranch;
/** key referring grid territory */
private Integer fkRefGridTerritory;
/** indicating if fast/classic search */
private Boolean fastSearchSelected;
/**************************************************************************
* Public methods
**************************************************************************/
/**
* Obtain a list of the selected status ids.
*
* @return an array list of Integers representing the selected status ids.
*/
public List<Integer> getSelectedStatusMappedToIds() {
List<Integer> selectedStati = new ArrayList<>();
if (isStatusOpenSelection()) {
selectedStati.add(NotificationStatus.OPEN.id);
}
if (isStatusInWorkSelection()) {
selectedStati.add(NotificationStatus.INPROGRESS.id);
}
if (isStatusDoneSelection()) {
selectedStati.add(NotificationStatus.FINISHED.id);
}
if (isStatusClosedSelection()) {
selectedStati.add(NotificationStatus.CLOSED.id);
}
return selectedStati;
}
public boolean isBranchSelected() {
return fkRefBranch != null && fkRefBranch > 0;
}
public boolean isGridTerritorySelected() {
return fkRefGridTerritory != null && fkRefGridTerritory > 0;
}
/**************************************************************************
* Getters/Setters
**************************************************************************/
public String getSearchString() {
return searchString;
}
public void setSearchString(String searchString) {
this.searchString = searchString;
}
public String getResponsibilityForwarding() {
return responsibilityForwarding;
}
public void setResponsibilityForwarding(String responsibilityForwarding) {
this.responsibilityForwarding = responsibilityForwarding;
}
public Boolean isStatusOpenSelection() {
if (statusOpenSelection == null) {
return false;
}
return statusOpenSelection;
}
public void setStatusOpenSelection(Boolean statusOpenSelection) {
this.statusOpenSelection = statusOpenSelection;
}
public Boolean isStatusInWorkSelection() {
if (statusInWorkSelection == null) {
return false;
}
return statusInWorkSelection;
}
public void setStatusInWorkSelection(Boolean statusInWorkSelection) {
this.statusInWorkSelection = statusInWorkSelection;
}
public Boolean isStatusDoneSelection() {
if (statusDoneSelection == null) {
return false;
}
return statusDoneSelection;
}
public void setStatusDoneSelection(Boolean statusDoneSelection) {
this.statusDoneSelection = statusDoneSelection;
}
public Boolean isStatusClosedSelection() {
if (statusClosedSelection == null) {
return false;
}
return statusClosedSelection;
}
public void setStatusClosedSelection(Boolean statusClosedSelection) {
this.statusClosedSelection = statusClosedSelection;
}
public Integer getFkRefBranch() {
return fkRefBranch;
}
public void setFkRefBranch(Integer fkRefBranch) {
this.fkRefBranch = fkRefBranch;
}
public Integer getFkRefGridTerritory() {
return fkRefGridTerritory;
}
public void setFkRefGridTerritory(Integer fkRefGridTerritory) {
this.fkRefGridTerritory = fkRefGridTerritory;
}
public Boolean isFastSearchSelected() {
if (fastSearchSelected == null) {
return false;
}
return fastSearchSelected;
}
public void setFastSearchSelected(Boolean fastSearchSelected) {
this.fastSearchSelected = fastSearchSelected;
}
}