Skip to content

Commit

Permalink
SYNCT-30: Changed the audit save method
Browse files Browse the repository at this point in the history
  • Loading branch information
areklalo committed Dec 18, 2017
1 parent 33671fe commit 68b17a1
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 20 deletions.
Expand Up @@ -52,24 +52,7 @@ public Long getCountOfMessages() {
}

public AuditMessage saveItem(AuditMessage auditMessage) {
Session session = sessionFactory.getHibernateSessionFactory().openSession();
Transaction tx = null;
try {
tx = session.beginTransaction();
session.saveOrUpdate(auditMessage);
tx.commit();
}
catch (Exception ex) {
if (tx != null) {
tx.rollback();
}
throw ex;
}
finally {
if (session != null) {
session.close();
}
}
getSession().saveOrUpdate(auditMessage);
return auditMessage;
}

Expand Down
Expand Up @@ -46,10 +46,14 @@ public AuditMessage retryMessage(AuditMessage message) throws APIException {

private AuditMessage retryPush(AuditMessage message) {
String parentAddress = configuration.getSyncConfiguration().getGeneral().getParentFeedLocation();
parentAddress = SyncUtils.getBaseUrl(parentAddress);

Map<String, String> map = new HashMap<>();
map.put(message.getLinkType(), message.getUsedResourceUrl());
message = syncPushService.readDataAndPushToParent(message.getResourceName(), map, parentAddress, message.getAction());
return message;

AuditMessage newMesssage = syncPushService.readDataAndPushToParent(message.getResourceName(), map, parentAddress, message.getAction());
syncAuditService.setNextAudit(message, newMesssage);
return newMesssage;
}

private AuditMessage retryPull(AuditMessage message) {
Expand Down

0 comments on commit 68b17a1

Please sign in to comment.