KontoDao.javaPaquetage : org.projectforge.business.fibu
Classes : KontoDao
Étend : BaseDao
Méthodes (5) : afterInsertOrModify, getKonto, newInstance, getKontoCache, onInsertOrModify
Champs (2) : USER_RIGHT_ID, kontoCache
Importations : 8 paquetages
package org.projectforge.business.fibu;
import kotlin.Pair;
import org.jetbrains.annotations.NotNull;
import org.projectforge.business.user.UserRightId;
import org.projectforge.common.i18n.UserException;
import org.projectforge.framework.access.OperationType;
import org.projectforge.framework.persistence.api.BaseDao;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@Service
public class KontoDao extends BaseDao<KontoDO> {
public static final UserRightId USER_RIGHT_ID = UserRightId.FIBU_ACCOUNTS;
@Autowired
private KontoCache kontoCache;
public KontoDao() {
super(KontoDO.class);
userRightId = USER_RIGHT_ID;
}
@Override
public void afterInsertOrModify(@NotNull final KontoDO obj, final OperationType operationType) {
getKontoCache().refresh();
}
public KontoDO getKonto(final Integer kontonummer) {
if (kontonummer == null) {
return null;
}
return persistenceService.selectNamedSingleResult(
KontoDO.FIND_BY_NUMMER,
KontoDO.class,
new Pair<>("nummer", kontonummer));
}
@NotNull
@Override
public KontoDO newInstance() {
return new KontoDO();
}
/**
* @return le kontoCache
*/
public KontoCache getKontoCache() {
return kontoCache;
}
@Override
public void onInsertOrModify(final KontoDO obj, final OperationType operationType) {
if (obj.getNummer() != null && obj.getNummer() > 0) {
KontoDO existingAccount = getKonto(obj.getNummer());
// Cas d'insertion
if (existingAccount != null && (obj.getId() == null || !obj.getId().equals(existingAccount.getId()))) {
throw new UserException("fibu.konto.validate.duplicate");
}
}
}
}
868d6abb7 2025 -> 2026 63081666f En-têtes des fichiers source : 2024 -> 2025. 5989b32fd BaseDao : mécanisme de onChangeLister refactorisé. 1b50060c3 BaseDao : renommé : get -> find, save -> insert, getList -> select, load -> select 3aeda5ef5 Gros changement : tous les save|update|...InTrans renommés (InTrans supprimé). PfPesistenceContext comme paramètre n'est plus nécessaire (ThreadLocal est utilisé à la place). (tous les tests de tous les paquetages : OK).