diff --git a/opensrp-gizi/src/main/java/org/smartregister/gizi/giziIbu/IbuDateSort.java b/opensrp-gizi/src/main/java/org/smartregister/gizi/giziIbu/IbuDateSort.java deleted file mode 100644 index 650346d..0000000 --- a/opensrp-gizi/src/main/java/org/smartregister/gizi/giziIbu/IbuDateSort.java +++ /dev/null @@ -1,72 +0,0 @@ -package org.smartregister.gizi.giziIbu; - -import org.smartregister.commonregistry.CommonPersonObjectClient; -import org.smartregister.view.contract.SmartRegisterClient; -import org.smartregister.view.contract.SmartRegisterClients; -import org.smartregister.view.dialog.SortOption; - -import java.text.DateFormat; -import java.text.SimpleDateFormat; -import java.util.Collections; -import java.util.Comparator; -import java.util.Date; - -/** - * Created by Iq on 30/03/16. - */ -public class IbuDateSort implements SortOption { - String field; - ByColumnAndByDetails byColumnAndByDetails; - - public enum ByColumnAndByDetails{ - byColumn,byDetails; - } - - public IbuDateSort() { - - } - - @Override - public String name() { - return "Due Status"; - } - - @Override - public SmartRegisterClients sort(SmartRegisterClients allClients) { - Collections.sort(allClients, commoncomparator); - return allClients; - } - - Comparator commoncomparator = new Comparator() { - @Override - public int compare(SmartRegisterClient oneClient, SmartRegisterClient anotherClient2) { - CommonPersonObjectClient commonPersonObjectClient = (CommonPersonObjectClient)oneClient; - CommonPersonObjectClient commonPersonObjectClient2 = (CommonPersonObjectClient)anotherClient2; - switch (byColumnAndByDetails){ - case byColumn: - try { - DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd"); - Date date1 = dateFormat.parse(commonPersonObjectClient.getColumnmaps().get(field)); - Date date2 = dateFormat.parse(commonPersonObjectClient2.getColumnmaps().get(field)); - - return date1.compareTo(date2); - }catch (Exception e){ - break; - } - - - case byDetails: - try { - DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd"); - Date date1 = dateFormat.parse(commonPersonObjectClient.getDetails().get(field)); - Date date2 = dateFormat.parse(commonPersonObjectClient2.getDetails().get(field)); - return date1.compareTo(date2); - }catch (Exception e){ - break; - } - - } - return 0; - } - }; -} diff --git a/opensrp-gizi/src/main/java/org/smartregister/gizi/giziIbu/IbuSearchOption.java b/opensrp-gizi/src/main/java/org/smartregister/gizi/giziIbu/IbuSearchOption.java deleted file mode 100644 index b65a341..0000000 --- a/opensrp-gizi/src/main/java/org/smartregister/gizi/giziIbu/IbuSearchOption.java +++ /dev/null @@ -1,36 +0,0 @@ -package org.smartregister.gizi.giziIbu; - -import org.smartregister.Context; -import org.smartregister.commonregistry.CommonPersonObjectClient; -import org.smartregister.gizi.R; -import org.smartregister.view.contract.SmartRegisterClient; -import org.smartregister.view.dialog.FilterOption; - -public class IbuSearchOption implements FilterOption { - private final String criteria; - - public IbuSearchOption(String criteria) { - this.criteria = criteria; - } - - @Override - public String name() { - return Context.getInstance().applicationContext().getResources().getString(R.string.hh_search_hint); - } - - @Override - public boolean filter(SmartRegisterClient client) { - boolean result = false; - CommonPersonObjectClient currentclient = (CommonPersonObjectClient) client; -// AllCommonsRepository allElcoRepository = new AllCommonsRepository("elco"); - if(!result) { - if(currentclient.getDetails().get("namaLengkap") != null) { - if (currentclient.getDetails().get("namaLengkap").toLowerCase().contains(criteria.toLowerCase())) { - result = true; - } - } - } - - return result; - } -} diff --git a/opensrp-gizi/src/main/java/org/smartregister/gizi/giziIbu/KICommonObjectFilterOption.java b/opensrp-gizi/src/main/java/org/smartregister/gizi/giziIbu/KICommonObjectFilterOption.java deleted file mode 100644 index f7c093a..0000000 --- a/opensrp-gizi/src/main/java/org/smartregister/gizi/giziIbu/KICommonObjectFilterOption.java +++ /dev/null @@ -1,41 +0,0 @@ -package org.smartregister.gizi.giziIbu; - -import org.apache.commons.lang3.StringUtils; -import org.smartregister.cursoradapter.CursorFilterOption; -import org.smartregister.view.contract.SmartRegisterClient; - -public class KICommonObjectFilterOption implements CursorFilterOption { - public final String criteria; - public final String fieldname; - private final String filterOptionName; - private final String tablename; - - @Override - public String filter() { - if(StringUtils.isNotBlank(fieldname) && !fieldname.equals("location_name")){ - return " AND " + tablename+ ".base_entity_id IN (SELECT DISTINCT base_entity_id FROM ec_details WHERE key MATCH '"+fieldname+"' INTERSECT SELECT DISTINCT base_entity_id FROM ec_details WHERE value MATCH '"+criteria+"' ) "; - } else{ - return " AND " + tablename+ ".base_entity_id IN (SELECT DISTINCT base_entity_id FROM ec_details WHERE value MATCH '"+criteria+"' ) "; - } - } - - - - public KICommonObjectFilterOption(String criteria, String fieldname, String filteroptionname, String tablename) { - this.criteria = criteria; - this.fieldname = fieldname; - this.filterOptionName = filteroptionname; - this.tablename = tablename; - } - - @Override - public String name() { - return filterOptionName; - } - - @Override - public boolean filter(SmartRegisterClient client) { - - return false; - } -}