Skip to content

Commit

Permalink
Add order arg to HID#get*By methods
Browse files Browse the repository at this point in the history
  • Loading branch information
dolfinus committed Dec 14, 2019
1 parent 28abfa0 commit 42dead6
Show file tree
Hide file tree
Showing 19 changed files with 62 additions and 61 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ trait Account {
if (params.firmId) {
where.n_firm_id = params.firmId
}
return hid.getTableData(getAccountsTable(), where: where, limit: params.limit)
return hid.getTableData(getAccountsTable(), where: where, order: params.order, limit: params.limit)
}

Map getAccountBy(Map input) {
Expand Down
25 changes: 13 additions & 12 deletions src/org/camunda/latera/bss/connectors/hid/hydra/Address.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,8 @@ trait Address {
operationDate : null,
beginDate : null,
endDate : null,
limit : 0
limit : 0,
order : [c_fl_main: 'desc']
], input)

LinkedHashMap where = [:]
Expand Down Expand Up @@ -181,8 +182,7 @@ trait Address {
String oracleDate = encodeDateStr(params.operationDate)
where[oracleDate] = [between: "d_begin and nvl(d_end, ${oracleDate})"]
}
LinkedHashMap order = [c_fl_main: 'desc']
return hid.getTableData(getObjectAddressesTable(), where: where, order: order, limit: params.limit)
return hid.getTableData(getObjectAddressesTable(), where: where, order: params.order, limit: params.limit)
}

Map getObjAddressBy(Map input) {
Expand Down Expand Up @@ -213,7 +213,8 @@ trait Address {
bindAddrTypeId : getDefaultAddressBindTypeId(),
stateId : getDefaultAddressStateId(),
isMain : null,
limit : 0
limit : 0,
order : [c_fl_main: 'desc']
], input)

LinkedHashMap where = [:]
Expand Down Expand Up @@ -266,8 +267,7 @@ trait Address {
if (params.isMain != null) {
where.c_fl_main = encodeBool(params.isMain)
}
LinkedHashMap order = [c_fl_main: 'desc']
return hid.getTableData(getSubjectAddressesTable(), where: where, order: order, limit: params.limit)
return hid.getTableData(getSubjectAddressesTable(), where: where, order: params.order, limit: params.limit)
}

Map getSubjAddressBy(Map input) {
Expand Down Expand Up @@ -344,7 +344,8 @@ trait Address {
floor : null,
entrance : null,
providerId : getFirmId(),
rem : null
rem : null,
order : [n_address_id: 'desc']
], input)

LinkedHashMap where = [:]
Expand Down Expand Up @@ -388,8 +389,7 @@ trait Address {
if (params.rem) {
where.vc_rem = params.rem
}
LinkedHashMap order = [n_address_id: 'desc']
return hid.getTableData(getMainAddressesTable(), where: where, order: order, limit: params.limit)
return hid.getTableData(getMainAddressesTable(), where: where, order: params.order, limit: params.limit)
}

Map getAddressBy(Map input) {
Expand Down Expand Up @@ -952,7 +952,7 @@ trait Address {
input.remove('subnetAddress')
}
if (input.containsKey('subnetAddresses') && notEmpty(input.subnetAddresses) && isList(input.subnetAddresses)) {
input.subnetAddressIds = getAddressesBy(code: [in: input.subnetAddresses], addrType: 'ADDR_TYPE_Subnet').collect {Map address -> address?.n_address_id}
input.subnetAddressIds = getAddressesBy(code: [in: input.subnetAddresses], addrType: 'ADDR_TYPE_Subnet', order: [n_value: 'asc']).collect {Map address -> address?.n_address_id}
input.remove('subnetAddress')
}
if (input.containsKey('vlan') && notEmpty(input.vlan)) {
Expand Down Expand Up @@ -1110,7 +1110,7 @@ trait Address {
input.remove('subnetAddress')
}
if (input.containsKey('subnetAddresses') && notEmpty(input.subnetAddresses) && isList(input.subnetAddresses)) {
input.subnetAddressIds = getAddressesBy(code: [in: input.subnetAddresses], addrType: 'ADDR_TYPE_Subnet6').collect {Map address -> address?.n_address_id}
input.subnetAddressIds = getAddressesBy(code: [in: input.subnetAddresses], addrType: 'ADDR_TYPE_Subnet6', order: [n_value: 'asc', vc_value: 'asc']).collect {Map address -> address?.n_address_id}
input.remove('subnetAddresses')
}
LinkedHashMap params = mergeParams(defaultParams, input)
Expand Down Expand Up @@ -1224,7 +1224,7 @@ trait Address {
input.remove('telCode')
}
if (input.containsKey('telCodes') && notEmpty(input.telCodes) && isList(input.telCodes)) {
input.telCodeIds = getAddressesBy(code: [in: input.telCodes], addrType: 'ADDR_TYPE_TelCode').collect {Map address -> address?.n_address_id}
input.telCodeIds = getAddressesBy(code: [in: input.telCodes], addrType: 'ADDR_TYPE_TelCode', order: [n_value: 'asc']).collect {Map address -> address?.n_address_id}
input.remove('telCode')
}
LinkedHashMap params = mergeParams(defaultParams, input)
Expand Down Expand Up @@ -1862,6 +1862,7 @@ trait Address {
AND RV.N_PAR_ADDR_ID = V.N_ADDRESS_ID
AND A.N_ADDRESS_ID = ${params.addressId ?: params.vlanId}
AND V.N_ADDR_TYPE_ID = SYS_CONTEXT('CONST', 'ADDR_TYPE_VLAN')
ORDER BY A.N_VALUE ASC
""", true, params.limit)
}
} catch (Exception e){
Expand Down
6 changes: 3 additions & 3 deletions src/org/camunda/latera/bss/connectors/hid/hydra/Bill.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,8 @@ trait Bill {
operationDate : null,
beginDate : null,
endDate : null,
limit : 0
limit : 0,
order : [n_line_no: 'asc']
], input)
LinkedHashMap where = [:]

Expand Down Expand Up @@ -193,8 +194,7 @@ trait Bill {
String oracleDate = encodeDateStr(params.operationDate)
where[oracleDate] = [between: "d_begin and nvl(d_end, ${oracleDate})"]
}
LinkedHashMap order = [n_line_no: 'asc']
return hid.getTableData(getBillLinesTable(), where: where, order: order, limit: params.limit)
return hid.getTableData(getBillLinesTable(), where: where, order: params.order, limit: params.limit)
}

List getBillLines(def docId, Integer limit = 0) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ trait Company {
if (params.stateId) {
where.n_subj_state_id = params.stateId
}
return hid.getTableData(getCompaniesTable(), where: where, limit: params.limit)
return hid.getTableData(getCompaniesTable(), where: where, order: params.order, limit: params.limit)
}

Map getCompanyBy(Map input) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ trait Customer {
if (params.tags) {
where.t_tags = params.tags
}
return hid.getTableData(getCustomersTable(), where: where, limit: params.limit)
return hid.getTableData(getCustomersTable(), where: where, order: params.order, limit: params.limit)
}

Map getCustomerBy(Map input) {
Expand Down Expand Up @@ -411,7 +411,7 @@ trait Customer {
if (params.hashTypeId) {
where.n_hash_type_id = hashTypeId
}
return hid.getTableData(getCustomerNetServicesTable(), where: where, limit: params.limit)
return hid.getTableData(getCustomerNetServicesTable(), where: where, order: params.order, limit: params.limit)
}

Map getCustomerNetServiceAccessBy(Map input) {
Expand Down
14 changes: 7 additions & 7 deletions src/org/camunda/latera/bss/connectors/hid/hydra/Document.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,8 @@ trait Document {
endDate : null,
number : null,
tags : null,
limit : 0
limit : 0,
order : [d_begin: 'desc', vc_doc_no: 'desc']
], input)
LinkedHashMap where = [:]
LinkedHashMap fields = ['*': null]
Expand Down Expand Up @@ -257,8 +258,7 @@ trait Document {
String oracleDate = encodeDateStr(params.operationDate)
where[oracleDate] = [between: "d_begin and nvl(d_end, ${oracleDate})"]
}
LinkedHashMap order = [d_begin: 'desc', vc_doc_no: 'desc']
return hid.getTableData(getDocumentsTable(), where: where, order: order, limit: params.limit)
return hid.getTableData(getDocumentsTable(), where: where, order: params.order, limit: params.limit)
}

Map getDocumentBy(Map input) {
Expand Down Expand Up @@ -407,7 +407,7 @@ trait Document {
if (params.accountId) {
where.n_account_id = params.accountId
}
return hid.getTableData(getDocumentSubjectsTable(), where: where, limit: params.limit)
return hid.getTableData(getDocumentSubjectsTable(), where: where, order: params.order, limit: params.limit)
}

Map getDocumentSubjectBy(Map input) {
Expand Down Expand Up @@ -531,7 +531,7 @@ trait Document {
if (params.isMulti != null) {
where.c_fl_multi = encodeBool(params.isMulti)
}
return hid.getTableData(getDocumentAddParamTypesTable(), where: where, limit: params.limit)
return hid.getTableData(getDocumentAddParamTypesTable(), where: where, order: params.order, limit: params.limit)
}

Map getDocumentAddParamTypeBy(Map input) {
Expand Down Expand Up @@ -600,7 +600,7 @@ trait Document {
if (params.refId) {
where.n_ref_id = params.refId
}
return hid.getTableData(getDocumentAddParamsTable(), where: where, limit: params.limit)
return hid.getTableData(getDocumentAddParamsTable(), where: where, order: params.order, limit: params.limit)
}

Map getDocumentAddParamBy(Map input) {
Expand Down Expand Up @@ -711,7 +711,7 @@ trait Document {
if (params.lineNumber) {
where.n_line_no = params.lineNumber
}
return hid.getTableData(getDocumentBindsTable(), where: where, limit: params.limit)
return hid.getTableData(getDocumentBindsTable(), where: where, order: params.order, limit: params.limit)
}

Map getDocumentBindBy(Map input) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ trait Equipment {
if (params.invNo) {
where.vc_inv_no = params.invNo
}
return hid.getTableData(getObjectsTable(), where: where, limit: params.limit)
return hid.getTableData(getObjectsTable(), where: where, order: params.order, limit: params.limit)
}

Map getObjectBy(Map input) {
Expand Down Expand Up @@ -328,7 +328,7 @@ trait Equipment {
if (params.name) {
where.vc_name = params.name
}
return hid.getTableData(getEquipmentComponentsTable(), where: where, limit: params.limit)
return hid.getTableData(getEquipmentComponentsTable(), where: where, order: params.order, limit: params.limit)
}

Map getEquipmentComponentBy(Map input) {
Expand Down Expand Up @@ -586,7 +586,7 @@ trait Equipment {
if (params.refId) {
where.n_ref_id = params.refId
}
return hid.getTableData(getEquipmentAddParamsTable(), where: where, limit: params.limit)
return hid.getTableData(getEquipmentAddParamsTable(), where: where, order: params.order, limit: params.limit)
}

Map getEquipmentAddParamBy(Map input) {
Expand Down Expand Up @@ -747,7 +747,7 @@ trait Equipment {
if (params.bindComponentId) {
where.n_bind_object_id = params.bindComponentId
}
return hid.getTableData(getEquipmentBindsTable(), where: where, limit: params.limit)
return hid.getTableData(getEquipmentBindsTable(), where: where, order: params.order, limit: params.limit)
}

Map getEquipmentBindBy(Map input) {
Expand Down
8 changes: 4 additions & 4 deletions src/org/camunda/latera/bss/connectors/hid/hydra/Good.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ trait Good {
if (params.isCustomer != null) {
where.c_fl_customer_equipment = encodeBool(params.isCustomer)
}
return hid.getTableData(getGoodsTable(), where: where, limit: params.limit)
return hid.getTableData(getGoodsTable(), where: where, order: params.order, limit: params.limit)
}

Map getGoodBy(Map input) {
Expand Down Expand Up @@ -137,7 +137,7 @@ trait Good {
if (params.isObject != null) {
where.c_fl_object = encodeBool(params.isObject)
}
return hid.getTableData(getGoodAddParamTypesTable(), where: where, limit: params.limit)
return hid.getTableData(getGoodAddParamTypesTable(), where: where, order: params.order, limit: params.limit)
}

Map getGoodAddParamTypeBy(Map input) {
Expand Down Expand Up @@ -204,7 +204,7 @@ trait Good {
if (params.refId) {
where.n_ref_id = params.refId
}
return hid.getTableData(getGoodAddParamsTable(), where: where, limit: params.limit)
return hid.getTableData(getGoodAddParamsTable(), where: where, order: params.order, limit: params.limit)
}

Map getGoodAddParamBy(Map input) {
Expand Down Expand Up @@ -339,7 +339,7 @@ trait Good {
where.c_fl_archived = encodeBool(params.isArchived)
}

return hid.getTableData(getServSchemesTable(), where: where, limit: params.limit)
return hid.getTableData(getServSchemesTable(), where: where, order: params.order, limit: params.limit)
}

Map getServSchemeBy(Map input) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ trait Group {
if (params.stateId) {
where.n_subj_state_id = params.stateId
}
return hid.getTableData(getGroupsTable(), where: where, limit: params.limit)
return hid.getTableData(getGroupsTable(), where: where, order: params.order, limit: params.limit)
}

Map getGroupBy(Map input) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ trait Invoice {
String oracleDate = encodeDateStr(params.operationDate)
where[oracleDate] = [between: "d_begin and nvl(d_end, ${oracleDate})"]
}
return hid.getTableData(getGoodMovesTable(), where: where, limit: params.limit)
return hid.getTableData(getGoodMovesTable(), where: where, order: params.order, limit: params.limit)
}

List getInvoicesBySubscription(def subscriptionId, def stateId = ['not in': [getDocumentStateCanceledId()]], def operationDate = null) {
Expand Down Expand Up @@ -238,7 +238,8 @@ trait Invoice {
operationDate : null,
beginDate : null,
endDate : null,
limit : 0
limit : 0,
order : [n_line_no: 'asc']
], input)
LinkedHashMap where = [:]

Expand Down Expand Up @@ -335,8 +336,7 @@ trait Invoice {
if (params.operationDate) {
where.d_oper = params.operationDate
}
LinkedHashMap order = [n_line_no: 'asc']
return hid.getTableData(getInvoiceLinesTable(), where: where, order: order, limit: params.limit)
return hid.getTableData(getInvoiceLinesTable(), where: where, order: params.order, limit: params.limit)
}

List getInvoiceLines(def docId, Integer limit = 0) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ trait Message {
where.n_lang_id = params.langId
}

List result = hid.getTableData(getMessagesTable(), where: where, limit: params.limit)
List result = hid.getTableData(getMessagesTable(), where: where, order: params.order, limit: params.limit)
if (result) {
result.each { message ->
MessageCache.instance.put(messageCodeWithLang(message.vc_code, message.n_lang_id), message.vc_name)
Expand Down
4 changes: 2 additions & 2 deletions src/org/camunda/latera/bss/connectors/hid/hydra/Param.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ trait Param {
where.vc_rem = params.rem
}

List result = hid.getTableData(getParamsTable(), where: where, limit: params.limit)
List result = hid.getTableData(getParamsTable(), where: where, order: params.order, limit: params.limit)
if (result) {
result.each { Map param ->
ParamCache.instance.put(param.vc_code, param.n_ref_id)
Expand Down Expand Up @@ -234,7 +234,7 @@ trait Param {
where.n_value_id = params.refId
}

return hid.getTableData(getParamValuesTable(), where: where, limit: params.limit)
return hid.getTableData(getParamValuesTable(), where: where, order: params.order, limit: params.limit)
}

Map getParamValueBy(Map input) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ trait Person {
if (params.stateId) {
where.n_subj_state_id = params.stateId
}
return hid.getTableData(getPersonsTable(), where: where, limit: params.limit)
return hid.getTableData(getPersonsTable(), where: where, order: params.order, limit: params.limit)
}

Map getPersonBy(Map input) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,8 @@ trait PriceOrder {
schedDeferTypeId : null,
schedDeferPayDays : null,
unschedDeferPayDays : null,
limit : 0
limit : 0,
order : [d_begin: 'asc']
], input)
LinkedHashMap where = [:]

Expand Down Expand Up @@ -114,8 +115,7 @@ trait PriceOrder {
if (params.unschedDeferPayDays) {
where.n_unsched_defer_pay_days = params.unschedDeferPayDays
}
LinkedHashMap order = [d_begin: 'asc']
return hid.getTableData(getPriceOrdersTable(), where: where, order: order, limit: params.limit)
return hid.getTableData(getPriceOrdersTable(), where: where, order: params.order, limit: params.limit)
}

Map getPriceOrder(def docId) {
Expand Down Expand Up @@ -154,7 +154,8 @@ trait PriceOrder {
providerId : null,
priceParam : null,
userRem : null,
limit : 0
limit : 0,
order : [n_line_no: 'asc']
], input)
LinkedHashMap where = [:]

Expand Down Expand Up @@ -239,8 +240,7 @@ trait PriceOrder {
if (params.userRem) {
where.vc_user_rem = params.userRem
}
LinkedHashMap order = [n_line_no: 'asc']
return hid.getTableData(getPriceLinesTable(), where: where, order: order, limit: params.limit)
return hid.getTableData(getPriceLinesTable(), where: where, order: params.order, limit: params.limit)
}

List getPriceLines(def docId, Integer limit = 0) {
Expand Down
Loading

0 comments on commit 42dead6

Please sign in to comment.