use of io.clownfish.clownfish.dbentities.CfContentversion in project Clownfish by rawdog71.
the class CfContentversionDAOImpl method findByContentref.
@Override
public List<CfContentversion> findByContentref(long ref) {
Session session = this.sessionFactory.getCurrentSession();
TypedQuery query = (TypedQuery) session.getNamedQuery("CfContentversion.findByContentref");
query.setParameter("contentref", ref);
List<CfContentversion> CfContentversionlist = query.getResultList();
return CfContentversionlist;
}
use of io.clownfish.clownfish.dbentities.CfContentversion in project Clownfish by rawdog71.
the class CfContentversionDAOImpl method findByPK.
@Override
public CfContentversion findByPK(long ref, long version) {
Session session = this.sessionFactory.getCurrentSession();
TypedQuery query = (TypedQuery) session.getNamedQuery("CfContentversion.findByPK");
query.setParameter("contentref", ref);
query.setParameter("version", version);
CfContentversion cfcontentversion = (CfContentversion) query.getSingleResult();
return cfcontentversion;
}
use of io.clownfish.clownfish.dbentities.CfContentversion in project Clownfish by rawdog71.
the class ContentList method writeVersion.
public void writeVersion(long ref, long version, byte[] content) {
CfContentversionPK contentversionpk = new CfContentversionPK();
contentversionpk.setContentref(ref);
contentversionpk.setVersion(version);
CfContentversion cfcontentversion = new CfContentversion();
cfcontentversion.setCfContentversionPK(contentversionpk);
cfcontentversion.setContent(content);
cfcontentversion.setTstamp(new Date());
cfcontentversion.setCommitedby(BigInteger.valueOf(loginbean.getCfuser().getId()));
cfcontentversionService.create(cfcontentversion);
}
use of io.clownfish.clownfish.dbentities.CfContentversion in project Clownfish by rawdog71.
the class ContentUtil method getVersion.
@Override
public String getVersion(long ref, long version) {
try {
CfContentversion contentversion = cfcontentversionService.findByPK(ref, version);
byte[] decompress = CompressionUtils.decompress(contentversion.getContent());
return new String(decompress, StandardCharsets.UTF_8);
} catch (IOException | DataFormatException ex) {
LOGGER.error(ex.getMessage());
return null;
}
}
use of io.clownfish.clownfish.dbentities.CfContentversion in project Clownfish by rawdog71.
the class CfContentversionDAOImpl method findAll.
@Override
public List<CfContentversion> findAll() {
Session session = this.sessionFactory.getCurrentSession();
TypedQuery query = (TypedQuery) session.getNamedQuery("CfContentversion.findAll");
List<CfContentversion> cfcontentversionlist = query.getResultList();
return cfcontentversionlist;
}
Aggregations