All Downloads are FREE. Search and download functionalities are using the official Maven repository.

se.skltp.ei.svc.entity.model.EngagementSpecifications Maven / Gradle / Ivy

/**
 * Copyright (c) 2013 Sveriges Kommuner och Landsting (SKL). 
 *
 * This file is part of SKLTP.
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
 */
package se.skltp.ei.svc.entity.model;

import java.util.Date;

import javax.persistence.criteria.CriteriaBuilder;
import javax.persistence.criteria.CriteriaQuery;
import javax.persistence.criteria.Predicate;
import javax.persistence.criteria.Root;

import org.springframework.data.jpa.domain.Specification;

/**
 * 
 * Creates search queries utilizing JPA2 specifications. 

* * Uses static meta model class Engagement_ generated by JPA and maven. * * @author Peter * */ public class EngagementSpecifications { public static Specification isPerson(final String registeredResidentIdentification) { return new Specification() { @Override public Predicate toPredicate(Root root, CriteriaQuery query, CriteriaBuilder cb) { return cb.equal(root.get(Engagement_.registeredResidentIdentification), registeredResidentIdentification); } }; } public static Specification isMostRecent(final Date mostRecent) { return new Specification() { @Override public Predicate toPredicate(Root root, CriteriaQuery query, CriteriaBuilder cb) { return cb.greaterThanOrEqualTo(root.get(Engagement_.mostRecentContent), mostRecent); } }; } public static Specification hasServiceDomain(final String serviceDomain) { return new Specification() { @Override public Predicate toPredicate(Root root, CriteriaQuery query, CriteriaBuilder cb) { return cb.equal(root.get(Engagement_.serviceDomain), serviceDomain); } }; } public static Specification hasCategorization(final String categorization) { return new Specification() { @Override public Predicate toPredicate(Root root, CriteriaQuery query, CriteriaBuilder cb) { return cb.equal(root.get(Engagement_.categorization), categorization); } }; } public static Specification hasLogicalAddress(final String logicalAddress) { return new Specification() { @Override public Predicate toPredicate(Root root, CriteriaQuery query, CriteriaBuilder cb) { return cb.equal(root.get(Engagement_.logicalAddress), logicalAddress); } }; } public static Specification hasBusinessObjectInstanceIdentifier(final String businessObjectInstanceIdentifier) { return new Specification() { @Override public Predicate toPredicate(Root root, CriteriaQuery query, CriteriaBuilder cb) { return cb.equal(root.get(Engagement_.businessObjectInstanceIdentifier), businessObjectInstanceIdentifier); } }; } public static Specification hasClinicalProcessInterestId(final String clinicalProcessInterestId) { return new Specification() { @Override public Predicate toPredicate(Root root, CriteriaQuery query, CriteriaBuilder cb) { return cb.equal(root.get(Engagement_.clinicalProcessInterestId), clinicalProcessInterestId); } }; } public static Specification hasSourceSystem(final String sourceSystem) { return new Specification() { @Override public Predicate toPredicate(Root root, CriteriaQuery query, CriteriaBuilder cb) { return cb.equal(root.get(Engagement_.sourceSystem), sourceSystem); } }; } public static Specification hasDataController(final String dataController) { return new Specification() { @Override public Predicate toPredicate(Root root, CriteriaQuery query, CriteriaBuilder cb) { return cb.equal(root.get(Engagement_.dataController), dataController); } }; } public static Specification hasOwner(final String owner) { return new Specification() { @Override public Predicate toPredicate(Root root, CriteriaQuery query, CriteriaBuilder cb) { return cb.equal(root.get(Engagement_.owner), owner); } }; } }





© 2015 - 2025 Weber Informatics LLC | Privacy Policy