Search in sources :

Example 1 with ParserType

use of org.hisp.dhis.sms.parse.ParserType in project dhis2-core by dhis2.

the class HibernateSMSCommandStore method getSMSCommand.

@Override
public SMSCommand getSMSCommand(String commandName, ParserType parserType) {
    CriteriaBuilder builder = getCriteriaBuilder();
    List<SMSCommand> list = getList(builder, newJpaParameters().addPredicate(root -> builder.equal(root.get("parserType"), parserType)).addPredicate(root -> JpaQueryUtils.stringPredicateIgnoreCase(builder, root.get("name"), commandName, JpaQueryUtils.StringSearchMode.ANYWHERE)));
    if (list != null && !list.isEmpty()) {
        return list.get(0);
    }
    return null;
}
Also used : CriteriaBuilder(javax.persistence.criteria.CriteriaBuilder) DataSet(org.hisp.dhis.dataset.DataSet) JpaQueryUtils(org.hisp.dhis.query.JpaQueryUtils) SessionFactory(org.hibernate.SessionFactory) JdbcTemplate(org.springframework.jdbc.core.JdbcTemplate) List(java.util.List) HibernateIdentifiableObjectStore(org.hisp.dhis.common.hibernate.HibernateIdentifiableObjectStore) CurrentUserService(org.hisp.dhis.user.CurrentUserService) CriteriaBuilder(javax.persistence.criteria.CriteriaBuilder) Query(org.hibernate.query.Query) AclService(org.hisp.dhis.security.acl.AclService) ApplicationEventPublisher(org.springframework.context.ApplicationEventPublisher) Repository(org.springframework.stereotype.Repository) SMSCommand(org.hisp.dhis.sms.command.SMSCommand) ParserType(org.hisp.dhis.sms.parse.ParserType) SMSCommand(org.hisp.dhis.sms.command.SMSCommand)

Aggregations

List (java.util.List)1 CriteriaBuilder (javax.persistence.criteria.CriteriaBuilder)1 SessionFactory (org.hibernate.SessionFactory)1 Query (org.hibernate.query.Query)1 HibernateIdentifiableObjectStore (org.hisp.dhis.common.hibernate.HibernateIdentifiableObjectStore)1 DataSet (org.hisp.dhis.dataset.DataSet)1 JpaQueryUtils (org.hisp.dhis.query.JpaQueryUtils)1 AclService (org.hisp.dhis.security.acl.AclService)1 SMSCommand (org.hisp.dhis.sms.command.SMSCommand)1 ParserType (org.hisp.dhis.sms.parse.ParserType)1 CurrentUserService (org.hisp.dhis.user.CurrentUserService)1 ApplicationEventPublisher (org.springframework.context.ApplicationEventPublisher)1 JdbcTemplate (org.springframework.jdbc.core.JdbcTemplate)1 Repository (org.springframework.stereotype.Repository)1