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

@@ -16,14 +16,16 @@ import org.eclipse.hawkbit.repository.model.Target;
*/ */
public class TargetUpdatedEvent extends AbstractBaseEntityEvent<Target> { public class TargetUpdatedEvent extends AbstractBaseEntityEvent<Target> {
private static final long serialVersionUID = 5665118668865832477L; private static final long serialVersionUID = 5665118668865832477L;
/** /**
* Constructor * Constructor
* @param baseEntity Target entity *
*/ * @param baseEntity
public TargetUpdatedEvent(final Target baseEntity) { * Target entity
super(baseEntity); */
} public TargetUpdatedEvent(final Target baseEntity) {
super(baseEntity);
}
} }

View File

@@ -17,31 +17,33 @@ import org.eclipse.persistence.descriptors.DescriptorEvent;
*/ */
public class DescriptorEventDetails { public class DescriptorEventDetails {
enum ActionType { enum ActionType {
CREATE, UPDATE; CREATE, UPDATE;
} }
private final DescriptorEvent descriptorEvent; private final DescriptorEvent descriptorEvent;
private final ActionType actiontype; private final ActionType actiontype;
/** /**
* Constructor * Constructor
* @param actionType Action type *
* @param descriptorEvent Descriptor Event * @param actionType
*/ * Action type
public DescriptorEventDetails(final ActionType actionType, * @param descriptorEvent
final DescriptorEvent descriptorEvent) { * Descriptor Event
this.descriptorEvent = descriptorEvent; */
this.actiontype = actionType; public DescriptorEventDetails(final ActionType actionType, final DescriptorEvent descriptorEvent) {
} this.descriptorEvent = descriptorEvent;
this.actiontype = actionType;
}
public DescriptorEvent getDescriptorEvent() { public DescriptorEvent getDescriptorEvent() {
return descriptorEvent; return descriptorEvent;
} }
public ActionType getActiontype() { public ActionType getActiontype() {
return actiontype; return 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())));
} }
} }