- 001
- 002
- 003
- 004
- 005
- 006
- 007
- 008
- 009
- 010
- 011
- 012
- 013
- 014
- 015
- 016
- 017
- 018
- 019
- 020
- 021
- 022
- 023
- 024
- 025
- 026
- 027
- 028
- 029
- 030
- 031
- 032
- 033
- 034
- 035
- 036
- 037
- 038
- 039
- 040
- 041
- 042
- 043
- 044
- 045
- 046
- 047
- 048
- 049
- 050
- 051
- 052
- 053
- 054
- 055
- 056
- 057
- 058
- 059
- 060
- 061
- 062
- 063
- 064
- 065
- 066
- 067
- 068
- 069
- 070
- 071
- 072
- 073
- 074
- 075
- 076
- 077
- 078
- 079
- 080
- 081
- 082
- 083
- 084
- 085
- 086
- 087
- 088
- 089
- 090
- 091
- 092
- 093
- 094
- 095
- 096
- 097
- 098
- 099
- 100
if (filter != null)
for (FilterItem item : filter.getItems()) {
if (StringUtils.isBlank(item.getProperty()) || StringUtils.isBlank(item.getValue())) {
log.warn("Skipping wrong filter: {}", PrintHelper.objectToString(item));
continue;
}
String property = item.getProperty().trim();
String value = item.getValue().trim();
if (property.equals(USER_ACCESS_LEVEL)) {
this.accessLevelType = Integer.valueOf(value);
paramsMap.put("user_access_level_type.id", ":" + USER_ACCESS_LEVEL);
valuesMap.put(USER_ACCESS_LEVEL, this.accessLevelType);
} if (property.equals(USER_TYPE)) {
this.userType = Integer.valueOf(value);
paramsMap.put("user_type.id", ":" + USER_TYPE);
valuesMap.put(USER_TYPE, this.userType);
} if (property.equals(FEDERAL_DISTRICT_ID)) {
this.federalDistrictId = Integer.valueOf(value);
paramsMap.put("user_org_detail.federal_district_fkey", ":" + FEDERAL_DISTRICT_ID);
valuesMap.put(FEDERAL_DISTRICT_ID, this.federalDistrictId);
} if (property.equals(CONSTITUENT_ENTITY_ID)) {
this.constituentEntityId = Integer.valueOf(value);
paramsMap.put("user_org_detail.constituent_entity_fkey", ":" + CONSTITUENT_ENTITY_ID);
valuesMap.put(CONSTITUENT_ENTITY_ID, this.constituentEntityId);
} if (property.equals(FORESTRY_ID)) {
this.forestryId = value;
paramsMap.put("user_org_detail.forestry_fkey", ":" + FORESTRY_ID);
valuesMap.put(FORESTRY_ID, this.forestryId);
} if (property.equals(USER_ROLE_ID)) {
this.userRoleId = value;
paramsMap.put("user_role.role_fkey", ":" + USER_ROLE_ID);
valuesMap.put(USER_ROLE_ID, this.userRoleId);
} if (property.equals(USER_LOGIN)) {
this.userLogin = value;
paramsMap.put("usr.login", ":" + USER_LOGIN);
valuesMap.put(USER_LOGIN, "%" + this.userLogin + "%");
} if (property.equals(USER_NAME)) {
this.userName = value;
String[] query = this.userName.split(" ");
String[] fnamePlaceholders = {};
String[] lnamePlaceholders = {};
String[] mnamePlaceholders = {};
for (int i = 0; i < query.length; i++) {
String fname = ":first_name_" + i;
fnamePlaceholders = ArrayUtils.add(fnamePlaceholders, fname);
String lname = ":last_name_" + i;
lnamePlaceholders = ArrayUtils.add(lnamePlaceholders, lname);
String mname = ":middle_name_" + i;
mnamePlaceholders = ArrayUtils.add(mnamePlaceholders, mname);
valuesMap.put("first_name_" + i, "%" + query[i] + "%");
valuesMap.put("last_name_" + i, "%" + query[i] + "%");
valuesMap.put("middle_name_" + i, "%" + query[i] + "%");
}
userParams.put("usr.first_name", fnamePlaceholders);
userParams.put("usr.last_name", lnamePlaceholders);
userParams.put("usr.middle_name", mnamePlaceholders);
} if (property.equals(USER_STATUS)) {
this.userStatus = value;
paramsMap.put("usr.status", ":" + USER_STATUS);
valuesMap.put(USER_STATUS, this.userStatus);
} if (property.equals(PARTY_NAME)) {
this.partyName = value;
String[] query = value.split(" ");
String[] fnamePlaceholders = {};
String[] lnamePlaceholders = {};
String[] mnamePlaceholders = {};
for (int i = 0; i < query.length; i++) {
String fname = ":person_first_name_" + i;
fnamePlaceholders = ArrayUtils.add(fnamePlaceholders, fname);
String lname = ":person_last_name_" + i;
lnamePlaceholders = ArrayUtils.add(lnamePlaceholders, lname);
String mname = ":person_mid_name_" + i;
mnamePlaceholders = ArrayUtils.add(mnamePlaceholders, mname);
valuesMap.put("person_first_name_" + i, "%" + query[i] + "%");
valuesMap.put("person_last_name_" + i, "%" + query[i] + "%");
valuesMap.put("person_mid_name_" + i, "%" + query[i] + "%");
}
partyParams.put("party.person_first_name", fnamePlaceholders);
partyParams.put("party.person_last_name", lnamePlaceholders);
partyParams.put("party.person_mid_name", mnamePlaceholders);
partyParams.put("party.party_name", new String[]{":party_name"});
valuesMap.put("party_name", "%" + this.partyName + "%");
} if (property.equals(PARTY_INN)) {
this.partyInn = value;
paramsMap.put("party.inn", ":" + PARTY_INN);
valuesMap.put(PARTY_INN, this.partyInn);
} if (property.equals(USER_IS_MASTER)) {
this.userIsMaster = Boolean.valueOf(value);
paramsMap.put("user_org_detail.organization_master", ":" + USER_IS_MASTER);
pushistayapodmyshka 02.06.2015 20:54 # 0