Small refactor
This commit is contained in:
parent
a8fa0312d1
commit
c50cae7f6c
|
@ -57,9 +57,7 @@ public class LockManager {
|
||||||
this.createOrUpdate(new Lock().fromDataModel(lock), principal);
|
this.createOrUpdate(new Lock().fromDataModel(lock), principal);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (this.forceUnlock(targetId) > 0){
|
return this.forceUnlock(targetId) > 0;
|
||||||
return true;
|
|
||||||
}
|
|
||||||
} else if (availableLocks > 1) {
|
} else if (availableLocks > 1) {
|
||||||
this.forceUnlock(targetId);
|
this.forceUnlock(targetId);
|
||||||
return this.isLocked(targetId, principal);
|
return this.isLocked(targetId, principal);
|
||||||
|
@ -71,7 +69,7 @@ public class LockManager {
|
||||||
LockCriteria criteria = new LockCriteria();
|
LockCriteria criteria = new LockCriteria();
|
||||||
criteria.setTarget(UUID.fromString(targetId));
|
criteria.setTarget(UUID.fromString(targetId));
|
||||||
Long availableLocks = this.apiContext.getOperationsContext().getDatabaseRepository().getLockDao().getWithCriteria(criteria).count();
|
Long availableLocks = this.apiContext.getOperationsContext().getDatabaseRepository().getLockDao().getWithCriteria(criteria).count();
|
||||||
Long deletedLocks = 0L;
|
long deletedLocks = 0L;
|
||||||
if (availableLocks > 0) {
|
if (availableLocks > 0) {
|
||||||
List<eu.eudat.data.entities.Lock> locks = this.apiContext.getOperationsContext().getDatabaseRepository().getLockDao().getWithCriteria(criteria).toList();
|
List<eu.eudat.data.entities.Lock> locks = this.apiContext.getOperationsContext().getDatabaseRepository().getLockDao().getWithCriteria(criteria).toList();
|
||||||
for (eu.eudat.data.entities.Lock lock : locks) {
|
for (eu.eudat.data.entities.Lock lock : locks) {
|
||||||
|
|
Loading…
Reference in New Issue