Search in sources :

Example 1 with LockInfo

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);
    }
}
Also used : LockInfo(com.haulmont.cuba.core.global.LockInfo)

Example 2 with 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);
}
Also used : Server(com.haulmont.cuba.core.entity.Server) LockInfo(com.haulmont.cuba.core.global.LockInfo) Test(org.junit.Test)

Example 3 with 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);
        }
    }
}
Also used : LockInfo(com.haulmont.cuba.core.global.LockInfo)

Aggregations

LockInfo (com.haulmont.cuba.core.global.LockInfo)3 Server (com.haulmont.cuba.core.entity.Server)1 Test (org.junit.Test)1