Search in sources :

Example 1 with AdvanceOrderImpl

use of org.olat.resource.accesscontrol.provider.auto.model.AdvanceOrderImpl in project openolat by klemens.

the class AdvanceOrderDAO method create.

AdvanceOrder create(Identity identity, IdentifierKey key, String identifierValue, AccessMethod method) {
    AdvanceOrderImpl advanceOrder = new AdvanceOrderImpl();
    Date creationDate = new Date();
    advanceOrder.setCreationDate(creationDate);
    advanceOrder.setLastModified(creationDate);
    advanceOrder.setIdentity(identity);
    advanceOrder.setIdentifierKey(key);
    advanceOrder.setIdentifierValue(identifierValue);
    advanceOrder.setStatus(Status.PENDING);
    advanceOrder.setStatusModified(creationDate);
    advanceOrder.setMethod(method);
    return advanceOrder;
}
Also used : AdvanceOrderImpl(org.olat.resource.accesscontrol.provider.auto.model.AdvanceOrderImpl) Date(java.util.Date)

Example 2 with AdvanceOrderImpl

use of org.olat.resource.accesscontrol.provider.auto.model.AdvanceOrderImpl in project OpenOLAT by OpenOLAT.

the class AdvanceOrderDAO method create.

AdvanceOrder create(Identity identity, IdentifierKey key, String identifierValue, AccessMethod method) {
    AdvanceOrderImpl advanceOrder = new AdvanceOrderImpl();
    Date creationDate = new Date();
    advanceOrder.setCreationDate(creationDate);
    advanceOrder.setLastModified(creationDate);
    advanceOrder.setIdentity(identity);
    advanceOrder.setIdentifierKey(key);
    advanceOrder.setIdentifierValue(identifierValue);
    advanceOrder.setStatus(Status.PENDING);
    advanceOrder.setStatusModified(creationDate);
    advanceOrder.setMethod(method);
    return advanceOrder;
}
Also used : AdvanceOrderImpl(org.olat.resource.accesscontrol.provider.auto.model.AdvanceOrderImpl) Date(java.util.Date)

Example 3 with AdvanceOrderImpl

use of org.olat.resource.accesscontrol.provider.auto.model.AdvanceOrderImpl in project OpenOLAT by OpenOLAT.

the class AutoAccessManagerImplTest method shouldNotGrantAccessIfAlreadyDone.

@Test
public void shouldNotGrantAccessIfAlreadyDone() {
    Collection<AdvanceOrder> advanceOrders = new ArrayList<>();
    AdvanceOrderImpl doneAdvanceOrder = new AdvanceOrderImpl();
    doneAdvanceOrder.setStatus(Status.DONE);
    doneAdvanceOrder.setIdentifierKey(IdentifierKey.externalId);
    doneAdvanceOrder.setIdentifierValue("abc");
    advanceOrders.add(doneAdvanceOrder);
    sut.grantAccess(advanceOrders);
    verify(identifierHandlerMock, never()).findRepositoryEntries(any(IdentifierKey.class), anyString());
}
Also used : IdentifierKey(org.olat.resource.accesscontrol.provider.auto.IdentifierKey) AdvanceOrder(org.olat.resource.accesscontrol.provider.auto.AdvanceOrder) ArrayList(java.util.ArrayList) AdvanceOrderImpl(org.olat.resource.accesscontrol.provider.auto.model.AdvanceOrderImpl) Test(org.junit.Test)

Example 4 with AdvanceOrderImpl

use of org.olat.resource.accesscontrol.provider.auto.model.AdvanceOrderImpl in project OpenOLAT by OpenOLAT.

the class AutoAccessManagerImplTest method getPendingAdvanceOrders.

private Collection<AdvanceOrder> getPendingAdvanceOrders() {
    Collection<AdvanceOrder> advanceOrders;
    AdvanceOrderImpl ao1 = new AdvanceOrderImpl();
    ao1.setIdentifierKey(IdentifierKey.internalId);
    ao1.setIdentifierValue("abc");
    ao1.setStatus(Status.PENDING);
    ao1.setMethod(accessMethodDummy);
    ao1.setIdentity(IDENTITY);
    AdvanceOrderImpl ao2 = new AdvanceOrderImpl();
    ao2.setIdentifierKey(IdentifierKey.internalId);
    ao2.setIdentifierValue("abc3");
    ao2.setStatus(Status.PENDING);
    ao2.setMethod(accessMethodDummy);
    ao2.setIdentity(IDENTITY);
    advanceOrders = Arrays.asList(ao1, ao2);
    return advanceOrders;
}
Also used : AdvanceOrder(org.olat.resource.accesscontrol.provider.auto.AdvanceOrder) AdvanceOrderImpl(org.olat.resource.accesscontrol.provider.auto.model.AdvanceOrderImpl)

Example 5 with AdvanceOrderImpl

use of org.olat.resource.accesscontrol.provider.auto.model.AdvanceOrderImpl in project openolat by klemens.

the class AutoAccessManagerImplTest method shouldNotGrantAccessIfAlreadyDone.

@Test
public void shouldNotGrantAccessIfAlreadyDone() {
    Collection<AdvanceOrder> advanceOrders = new ArrayList<>();
    AdvanceOrderImpl doneAdvanceOrder = new AdvanceOrderImpl();
    doneAdvanceOrder.setStatus(Status.DONE);
    doneAdvanceOrder.setIdentifierKey(IdentifierKey.externalId);
    doneAdvanceOrder.setIdentifierValue("abc");
    advanceOrders.add(doneAdvanceOrder);
    sut.grantAccess(advanceOrders);
    verify(identifierHandlerMock, never()).findRepositoryEntries(any(IdentifierKey.class), anyString());
}
Also used : IdentifierKey(org.olat.resource.accesscontrol.provider.auto.IdentifierKey) AdvanceOrder(org.olat.resource.accesscontrol.provider.auto.AdvanceOrder) ArrayList(java.util.ArrayList) AdvanceOrderImpl(org.olat.resource.accesscontrol.provider.auto.model.AdvanceOrderImpl) Test(org.junit.Test)

Aggregations

AdvanceOrderImpl (org.olat.resource.accesscontrol.provider.auto.model.AdvanceOrderImpl)6 AdvanceOrder (org.olat.resource.accesscontrol.provider.auto.AdvanceOrder)4 ArrayList (java.util.ArrayList)2 Date (java.util.Date)2 Test (org.junit.Test)2 IdentifierKey (org.olat.resource.accesscontrol.provider.auto.IdentifierKey)2