Search in sources :

Example 1 with OLATResourceImpl

use of org.olat.resource.OLATResourceImpl in project OpenOLAT by OpenOLAT.

the class ReferenceManager method addReference.

/**
 * Add a new reference. The meaning of source and target is
 * such as the source references the target.
 *
 * @param source
 * @param target
 * @param userdata
 */
public void addReference(OLATResourceable source, OLATResourceable target, String userdata) {
    OLATResourceImpl sourceImpl = (OLATResourceImpl) olatResourceManager.findResourceable(source);
    OLATResourceImpl targetImpl = (OLATResourceImpl) olatResourceManager.findResourceable(target);
    ReferenceImpl ref = new ReferenceImpl();
    ref.setSource(sourceImpl);
    ref.setTarget(targetImpl);
    ref.setUserdata(userdata);
    ref.setCreationDate(new Date());
    dbInstance.getCurrentEntityManager().persist(ref);
}
Also used : OLATResourceImpl(org.olat.resource.OLATResourceImpl) Date(java.util.Date)

Example 2 with OLATResourceImpl

use of org.olat.resource.OLATResourceImpl in project openolat by klemens.

the class ReferenceManager method addReference.

/**
 * Add a new reference. The meaning of source and target is
 * such as the source references the target.
 *
 * @param source
 * @param target
 * @param userdata
 */
public void addReference(OLATResourceable source, OLATResourceable target, String userdata) {
    OLATResourceImpl sourceImpl = (OLATResourceImpl) olatResourceManager.findResourceable(source);
    OLATResourceImpl targetImpl = (OLATResourceImpl) olatResourceManager.findResourceable(target);
    ReferenceImpl ref = new ReferenceImpl();
    ref.setSource(sourceImpl);
    ref.setTarget(targetImpl);
    ref.setUserdata(userdata);
    ref.setCreationDate(new Date());
    dbInstance.getCurrentEntityManager().persist(ref);
}
Also used : OLATResourceImpl(org.olat.resource.OLATResourceImpl) Date(java.util.Date)

Aggregations

Date (java.util.Date)2 OLATResourceImpl (org.olat.resource.OLATResourceImpl)2