Skip to content

Commit

Permalink
Merged in james_radiologics/container-service/rad-1.7.4 (pull request N…
Browse files Browse the repository at this point in the history
…rgXnat#8)

CIRRUS-316: rollback event history update in container service
  • Loading branch information
James Dickson authored and RadiologicsA committed Jan 30, 2019
2 parents 050e09e + b4632f1 commit 81e4535
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 28 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -802,7 +802,7 @@ public static ContainerHistory fromSystem(final String status,
.entityType("system")
.entityId(null)
.timeRecorded(new Date())
.externalTimestamp(Long.toString(System.nanoTime()))
.externalTimestamp(null)
.build();
}

Expand All @@ -812,7 +812,7 @@ public static ContainerHistory fromUserAction(final String status, final String
.entityType("user")
.entityId(username)
.timeRecorded(new Date())
.externalTimestamp(Long.toString(System.nanoTime()))
.externalTimestamp(null)
.message(null)
.build();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -529,26 +529,8 @@ public boolean isItemInHistory(final ContainerEntityHistory historyItem) {

historyItem.setContainerEntity(this);

boolean match=false;
Collections.sort(history);
for (ContainerEntityHistory hist : history) {
log.debug("isItemInHistory items {} {} {}",hist.getContainerEntity().getId(),hist.getStatus(),hist.getTimeRecorded());
}
if(history.size()>0){
ContainerEntityHistory latest=history.get(0);
match= StringUtils.equals(latest.getStatus(),historyItem.getStatus());
if(log.isDebugEnabled()){
log.debug("isItemInHistory skip {} {} {} {} {} {} {}",
match,
historyItem.getContainerEntity().getId(),
latest.getContainerEntity().getId(),
historyItem.getStatus(),
latest.getStatus(),
historyItem.getTimeRecorded(),
latest.getTimeRecorded());
}
}
return match;
return this.history.contains(historyItem);

}


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
@Slf4j
@Entity
@Audited
public class ContainerEntityHistory implements Comparable<ContainerEntityHistory>{
public class ContainerEntityHistory {
private long id;
@JsonIgnore private ContainerEntity containerEntity;
private String status;
Expand Down Expand Up @@ -192,9 +192,4 @@ public String toString() {
.add("exitCode", exitCode)
.toString();
}

@Override
public int compareTo(ContainerEntityHistory o) {
return o.timeRecorded.compareTo(this.timeRecorded);
}
}

0 comments on commit 81e4535

Please sign in to comment.