Search in sources :

Example 1 with PageBodyImpl

use of org.olat.modules.portfolio.model.PageBodyImpl in project OpenOLAT by OpenOLAT.

the class PageDAO method createAndPersistPageBody.

public PageBody createAndPersistPageBody() {
    PageBodyImpl body = new PageBodyImpl();
    body.setCreationDate(new Date());
    body.setLastModified(body.getCreationDate());
    dbInstance.getCurrentEntityManager().persist(body);
    return body;
}
Also used : PageBodyImpl(org.olat.modules.portfolio.model.PageBodyImpl) Date(java.util.Date)

Example 2 with PageBodyImpl

use of org.olat.modules.portfolio.model.PageBodyImpl in project openolat by klemens.

the class PageDAO method moveUpPart.

public void moveUpPart(PageBody body, PagePart part) {
    body.getParts().size();
    int index = body.getParts().indexOf(part);
    if (index > 0) {
        PagePart reloadedPart = body.getParts().remove(index);
        body.getParts().add(index - 1, reloadedPart);
    } else if (index < 0) {
        body.getParts().add(0, part);
    }
    ((PageBodyImpl) body).setLastModified(new Date());
    dbInstance.getCurrentEntityManager().merge(body);
}
Also used : PagePart(org.olat.modules.portfolio.PagePart) PageBodyImpl(org.olat.modules.portfolio.model.PageBodyImpl) Date(java.util.Date)

Example 3 with PageBodyImpl

use of org.olat.modules.portfolio.model.PageBodyImpl in project openolat by klemens.

the class PageDAO method removePart.

public void removePart(PageBody body, PagePart part) {
    PagePart aPart = dbInstance.getCurrentEntityManager().getReference(part.getClass(), part.getKey());
    body.getParts().size();
    body.getParts().remove(aPart);
    dbInstance.getCurrentEntityManager().remove(aPart);
    ((PageBodyImpl) body).setLastModified(new Date());
    dbInstance.getCurrentEntityManager().merge(body);
}
Also used : PagePart(org.olat.modules.portfolio.PagePart) PageBodyImpl(org.olat.modules.portfolio.model.PageBodyImpl) Date(java.util.Date)

Example 4 with PageBodyImpl

use of org.olat.modules.portfolio.model.PageBodyImpl in project OpenOLAT by OpenOLAT.

the class PageDAO method removePart.

public void removePart(PageBody body, PagePart part) {
    PagePart aPart = dbInstance.getCurrentEntityManager().getReference(part.getClass(), part.getKey());
    body.getParts().size();
    body.getParts().remove(aPart);
    dbInstance.getCurrentEntityManager().remove(aPart);
    ((PageBodyImpl) body).setLastModified(new Date());
    dbInstance.getCurrentEntityManager().merge(body);
}
Also used : PagePart(org.olat.modules.portfolio.PagePart) PageBodyImpl(org.olat.modules.portfolio.model.PageBodyImpl) Date(java.util.Date)

Example 5 with PageBodyImpl

use of org.olat.modules.portfolio.model.PageBodyImpl in project OpenOLAT by OpenOLAT.

the class PageDAO method moveUpPart.

public void moveUpPart(PageBody body, PagePart part) {
    body.getParts().size();
    int index = body.getParts().indexOf(part);
    if (index > 0) {
        PagePart reloadedPart = body.getParts().remove(index);
        body.getParts().add(index - 1, reloadedPart);
    } else if (index < 0) {
        body.getParts().add(0, part);
    }
    ((PageBodyImpl) body).setLastModified(new Date());
    dbInstance.getCurrentEntityManager().merge(body);
}
Also used : PagePart(org.olat.modules.portfolio.PagePart) PageBodyImpl(org.olat.modules.portfolio.model.PageBodyImpl) Date(java.util.Date)

Aggregations

Date (java.util.Date)8 PageBodyImpl (org.olat.modules.portfolio.model.PageBodyImpl)8 PagePart (org.olat.modules.portfolio.PagePart)6