- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
- 25
- 26
- 27
- 28
- 29
- 30
- 31
- 32
- 33
- 34
- 35
- 36
- 37
- 38
- 39
- 40
- 41
- 42
- 43
- 44
- 45
- 46
- 47
- 48
- 49
- 50
- 51
- 52
- 53
- 54
- 55
- 56
- 57
- 58
- 59
- 60
- 61
- 62
- 63
- 64
- 65
- 66
public static int count(String s) {
int res = 0;
for (int i = 0; i < s.length(); i++) {
if(s.charAt(i) == '1') res++;
}
return res;
}
public List<VDictLiability> get(String currency_id, String usedTrailer, Date actualDate, String contract_class_id, String product_id, String risk_object_type_id) {
for(int i = 0;i<5;i++){
int j = 0;
while(j < 32) {
if(count(Integer.toBinaryString(j)) == i) {
String s = Integer.toBinaryString(j);
while (s.length() != 5) {
s = "0" + s;
}
List<VDictLiability> result = get(currency_id, usedTrailer, actualDate, contract_class_id, product_id, risk_object_type_id, s);
if(result.size() > 0) return result;
}
j++;
}
}
return Collections.EMPTY_LIST;
}
public List<VDictLiability> get(String currency_id, String usedTrailer, Date actualDate, String contract_class_id, String product_id, String risk_object_type_id, String mask) {
String territoryCode = App.config.getCurrentBrunchCode().substring(1, 3);
...
HashMap<Double, VDictLiability> map = new HashMap<Double, VDictLiability>();
for (VDictLiability liabilityRow : get()) {
if(!territoryType.equals(liabilityRow.getterritory_type_id()) && !(mask.charAt(4) == '1' && liabilityRow.getterritory_type_id() == null)){
continue;
}
if(actualDate != null && !CompareUtil.isInside(liabilityRow.getstart_date(), liabilityRow.getend_date(), actualDate)){
continue;
}
if(((risk_object_type_id != null && !CompareUtil.isEquals(liabilityRow.getrisk_object_type_id(), risk_object_type_id)) && !(mask.charAt(0) == '1' && liabilityRow.getrisk_object_type_id() == null))){
continue;
}
if(((product_id != null && !CompareUtil.isEquals(liabilityRow.getproduct_id(), product_id)) && !(mask.charAt(1) == '1' && liabilityRow.getproduct_id() == null))){
continue;
}
if(((contract_class_id != null && !CompareUtil.isEquals(liabilityRow.getcontract_class_id(), contract_class_id)) && !(mask.charAt(2) == '1' && liabilityRow.getcontract_class_id() == null))){
continue;
}
if((liabilityRow.getcurrency_id() != null & !CompareUtil.isEquals(liabilityRow.getcurrency_id(), currency_id)) && !(mask.charAt(3) == '1' && liabilityRow.getcurrency_id() == null)){
continue;
}
if(liabilityRow.getis_used_trailer() != SQLUtils.NULL_INTEGER_VALUE & !CompareUtil.isEquals(""+liabilityRow.getis_used_trailer(), usedTrailer)){
continue;
}
map.put(liabilityRow.getvalue(), liabilityRow);
}
ArrayList<VDictLiability> result = new ArrayList<VDictLiability>();
result.addAll(map.values());
...
return result;
}
public List<VDictLiability> get(String currency_id, boolean usedTrailer, Date actualDate, String contract_class_id, String product_id, String risk_object_type_id) {
return get(currency_id, usedTrailer?"1":"0", actualDate, contract_class_id, product_id, risk_object_type_id);
}