Formatted the code.

Signed-off-by: Gaurav <gaurav.sahay@in.bosch.com>
This commit is contained in:
Gaurav
2016-08-08 13:30:16 +02:00
parent 1afd98e157
commit 8fa2a60a71
3 changed files with 42 additions and 45 deletions

View File

@@ -20,7 +20,9 @@ public class TargetUpdatedEvent extends AbstractBaseEntityEvent<Target> {
/** /**
* Constructor * Constructor
* @param baseEntity Target entity *
* @param baseEntity
* Target entity
*/ */
public TargetUpdatedEvent(final Target baseEntity) { public TargetUpdatedEvent(final Target baseEntity) {
super(baseEntity); super(baseEntity);

View File

@@ -27,11 +27,13 @@ public class DescriptorEventDetails {
/** /**
* Constructor * Constructor
* @param actionType Action type *
* @param descriptorEvent Descriptor Event * @param actionType
* Action type
* @param descriptorEvent
* Descriptor Event
*/ */
public DescriptorEventDetails(final ActionType actionType, public DescriptorEventDetails(final ActionType actionType, final DescriptorEvent descriptorEvent) {
final DescriptorEvent descriptorEvent) {
this.descriptorEvent = descriptorEvent; this.descriptorEvent = descriptorEvent;
this.actiontype = actionType; this.actiontype = actionType;
} }

View File

@@ -19,15 +19,15 @@ import org.eclipse.persistence.queries.UpdateObjectQuery;
import org.eclipse.persistence.sessions.changesets.DirectToFieldChangeRecord; import org.eclipse.persistence.sessions.changesets.DirectToFieldChangeRecord;
/** /**
*Helper class to get the change set for the property changes in the Entity. * Helper class to get the change set for the property changes in the Entity.
* *
* @param <T> * @param <T>
*/ */
public class EntityPropertyChangeHelper<T extends TenantAwareBaseEntity> { public class EntityPropertyChangeHelper<T extends TenantAwareBaseEntity> {
/** /**
* To get the map of entity property change set * To get the map of entity property change set
*
* @param clazz * @param clazz
* @param event * @param event
* @return the map of the changeSet * @return the map of the changeSet
@@ -35,19 +35,12 @@ public class EntityPropertyChangeHelper<T extends TenantAwareBaseEntity> {
public static <T extends TenantAwareBaseEntity> Map<String, AbstractPropertyChangeEvent<T>.Values> getChangeSet( public static <T extends TenantAwareBaseEntity> Map<String, AbstractPropertyChangeEvent<T>.Values> getChangeSet(
final Class<T> clazz, final DescriptorEvent event) { final Class<T> clazz, final DescriptorEvent event) {
final T rolloutGroup = clazz.cast(event.getObject()); final T rolloutGroup = clazz.cast(event.getObject());
final ObjectChangeSet changeSet = ((UpdateObjectQuery) event.getQuery()) final ObjectChangeSet changeSet = ((UpdateObjectQuery) event.getQuery()).getObjectChangeSet();
.getObjectChangeSet(); return changeSet.getChanges().stream().filter(record -> record instanceof DirectToFieldChangeRecord)
return changeSet
.getChanges()
.stream()
.filter(record -> record instanceof DirectToFieldChangeRecord)
.map(record -> (DirectToFieldChangeRecord) record) .map(record -> (DirectToFieldChangeRecord) record)
.collect( .collect(Collectors.toMap(record -> record.getAttribute(),
Collectors.toMap( record -> new AbstractPropertyChangeEvent<T>(rolloutGroup, null).new Values(
record -> record.getAttribute(), record.getOldValue(), record.getNewValue())));
record -> new AbstractPropertyChangeEvent<T>(
rolloutGroup, null).new Values(record
.getOldValue(), record.getNewValue())));
} }
} }