Search in sources :

Example 1 with MimetypeEntity

use of org.alfresco.repo.domain.mimetype.MimetypeEntity in project alfresco-repository by Alfresco.

the class MimetypeDAOImpl method updateMimetypeEntity.

@Override
protected int updateMimetypeEntity(Long id, String newMimetype) {
    MimetypeEntity mimetypeEntity = getMimetypeEntity(id);
    if (mimetypeEntity == null) {
        throw new DataIntegrityViolationException("Cannot update mimetype as ID doesn't exist: " + id);
    }
    mimetypeEntity.incrementVersion();
    mimetypeEntity.setMimetype(newMimetype);
    return template.update(UPDATE_MIMETYPE, mimetypeEntity);
}
Also used : MimetypeEntity(org.alfresco.repo.domain.mimetype.MimetypeEntity) DataIntegrityViolationException(org.springframework.dao.DataIntegrityViolationException)

Example 2 with MimetypeEntity

use of org.alfresco.repo.domain.mimetype.MimetypeEntity in project alfresco-repository by Alfresco.

the class MimetypeDAOImpl method createMimetypeEntity.

@Override
protected MimetypeEntity createMimetypeEntity(String mimetype) {
    MimetypeEntity mimetypeEntity = new MimetypeEntity();
    mimetypeEntity.setVersion(MimetypeEntity.CONST_LONG_ZERO);
    mimetypeEntity.setMimetype(mimetype == null ? null : mimetype.toLowerCase());
    template.insert(INSERT_MIMETYPE, mimetypeEntity);
    // Done
    return mimetypeEntity;
}
Also used : MimetypeEntity(org.alfresco.repo.domain.mimetype.MimetypeEntity)

Example 3 with MimetypeEntity

use of org.alfresco.repo.domain.mimetype.MimetypeEntity in project alfresco-repository by Alfresco.

the class MimetypeDAOImpl method getMimetypeEntity.

@Override
protected MimetypeEntity getMimetypeEntity(String mimetype) {
    MimetypeEntity mimetypeEntity = new MimetypeEntity();
    mimetypeEntity.setMimetype(mimetype == null ? null : mimetype.toLowerCase());
    mimetypeEntity = template.selectOne(SELECT_MIMETYPE_BY_KEY, mimetypeEntity);
    // Could be null
    return mimetypeEntity;
}
Also used : MimetypeEntity(org.alfresco.repo.domain.mimetype.MimetypeEntity)

Example 4 with MimetypeEntity

use of org.alfresco.repo.domain.mimetype.MimetypeEntity in project alfresco-repository by Alfresco.

the class MimetypeDAOImpl method getMimetypeEntity.

@Override
protected MimetypeEntity getMimetypeEntity(Long id) {
    MimetypeEntity mimetypeEntity = new MimetypeEntity();
    mimetypeEntity.setId(id);
    mimetypeEntity = template.selectOne(SELECT_MIMETYPE_BY_ID, mimetypeEntity);
    // Done
    return mimetypeEntity;
}
Also used : MimetypeEntity(org.alfresco.repo.domain.mimetype.MimetypeEntity)

Aggregations

MimetypeEntity (org.alfresco.repo.domain.mimetype.MimetypeEntity)4 DataIntegrityViolationException (org.springframework.dao.DataIntegrityViolationException)1