Skip to content

Commit

Permalink
[#7]
Browse files Browse the repository at this point in the history
WIP
updated DSL
updated processor
still needs more testing
  • Loading branch information
scalding committed Dec 18, 2013
1 parent 0141f2a commit ebc5b14
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 2 deletions.
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ version=0.1-SNAPSHOT

spring.version=3.2.4.RELEASE
spring.batch.version=2.2.1.RELEASE
open.registry.version=0.9.2.1
open.registry.version=0.9.2.2-SNAPSHOT
slf4j.version=1.6.1
groovy.version=2.1.5
gradle.version=1.8
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,8 @@ class DatabaseViewSorConfigurationFactoryBean implements FactoryBean<Map<String,
'urls': UrlsDatabaseViewSorConfiguration,
'addresses': AddressesDatabaseViewSorConfiguration,
'leaves': LeavesDatabaseViewSorConfiguration,
'phones': PhonesDatabaseViewSorConfiguration
'phones': PhonesDatabaseViewSorConfiguration,
'localAttribute': LocalAttributeDatabaseViewSorConfiguration
]
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ class DatabaseViewSorPersonActionProcessor extends PersonActionProcessor impleme
def doneAddresses = [] as Set
def doneLeaves = [] as Set
def donePhones = [] as Set
def doneRoleLocalAttributes = [] as Set
item.rows.each { row ->
// do name
if (!doneNames.containsKey(getFieldValue(sorConfiguration.personConfiguration.namesConfiguration.keyField, row))) {
Expand Down Expand Up @@ -216,6 +217,20 @@ class DatabaseViewSorPersonActionProcessor extends PersonActionProcessor impleme
})
}
}

// do role local attributes for roles
if (sorConfiguration.personConfiguration.rolesConfiguration?.localAttributeConfigurations) {
sorConfiguration.personConfiguration.rolesConfiguration.localAttributeConfigurations.each { LocalAttributeDatabaseViewSorConfiguration localAttributeDatabaseViewSorConfiguration ->
def type = getFieldValue(localAttributeDatabaseViewSorConfiguration.type, row)
def roleKey = getFieldValue(sorConfiguration.personConfiguration.rolesConfiguration.keyField, row)
def key = [roleKey, type]
if (!doneRoleLocalAttributes.contains(key)) {
SorRole role = doneRoles[roleKey]
role.sorLocalAttributes[type] = getFieldValue(localAttributeDatabaseViewSorConfiguration.value, row)
doneRoleLocalAttributes << key
}
}
}
}
item.sorPerson.names.retainAll(doneNames.values())
item.sorPerson.sorLocalAttributes.keySet().retainAll(doneLocalAttributes)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@ class SorRolesConfiguration {
def leavesConfiguration
def phonesConfiguration
def urlsConfiguration

def localAttributeConfigurations = [] as Set
}

class SorLocalAttributeConfiguration {
Expand Down

0 comments on commit ebc5b14

Please sign in to comment.