use of com.haulmont.cuba.core.global.LockInfo in project cuba by cuba-platform.
the class LockBrowser method refresh.
public void refresh() {
locksDs.clear();
List<LockInfo> locks = service.getCurrentLocks();
for (LockInfo lockInfo : locks) {
locksDs.includeItem(lockInfo);
}
}
use of com.haulmont.cuba.core.global.LockInfo in project cuba by cuba-platform.
the class LockManagerTest method testLock.
@Test
public void testLock() throws Exception {
Server entity = new Server();
LockInfo lockInfo = lockManager.lock(entity);
assertNull(lockInfo);
lockInfo = lockManager.lock(entity);
assertNotNull(lockInfo);
lockManager.unlock(entity);
lockInfo = lockManager.getLockInfo("sys$Server", entity.getId().toString());
assertNull(lockInfo);
}
use of com.haulmont.cuba.core.global.LockInfo in project cuba by cuba-platform.
the class LockBrowser method unlock.
public void unlock() {
LockInfo lockInfo = table.getSingleSelected();
if (lockInfo != null) {
service.unlock(lockInfo.getEntityName(), lockInfo.getEntityId());
refresh();
if (lockInfo.getEntityId() != null) {
showNotification(formatMessage("hasBeenUnlockedWithId", lockInfo.getEntityName(), lockInfo.getEntityId()), NotificationType.HUMANIZED);
} else {
showNotification(formatMessage("hasBeenUnlockedWithoutId", lockInfo.getEntityName()), NotificationType.HUMANIZED);
}
}
}