Search in sources :

Example 1 with org.haiku.haikudepotserver.dataobjects.auto._UserUsageConditionsAgreement

use of org.haiku.haikudepotserver.dataobjects.auto._UserUsageConditionsAgreement in project haikudepotserver by haiku.

the class UserServiceImpl method isUserCurrentlyAgreeingToCurrentUserUsageConditions.

@Override
public boolean isUserCurrentlyAgreeingToCurrentUserUsageConditions(User user) {
    ObjectContext context = user.getObjectContext();
    String code = UserUsageConditions.getLatest(context).getCode();
    return user.tryGetUserUsageConditionsAgreement().filter(_UserUsageConditionsAgreement::getActive).filter(uuca -> uuca.getUserUsageConditions().getCode().equals(code)).isPresent();
}
Also used : ObjectContext(org.apache.cayenne.ObjectContext) Logger(org.slf4j.Logger) UserUsageConditions(org.haiku.haikudepotserver.dataobjects.UserUsageConditions) LoggerFactory(org.slf4j.LoggerFactory) Strings(com.google.common.base.Strings) org.haiku.haikudepotserver.dataobjects.auto._UserUsageConditionsAgreement(org.haiku.haikudepotserver.dataobjects.auto._UserUsageConditionsAgreement) List(java.util.List) Service(org.springframework.stereotype.Service) UserSearchSpecification(org.haiku.haikudepotserver.user.model.UserSearchSpecification) Preconditions(com.google.common.base.Preconditions) ObjectSelect(org.apache.cayenne.query.ObjectSelect) User(org.haiku.haikudepotserver.dataobjects.User) UserService(org.haiku.haikudepotserver.user.model.UserService) LikeHelper(org.haiku.haikudepotserver.support.LikeHelper) ObjectContext(org.apache.cayenne.ObjectContext) org.haiku.haikudepotserver.dataobjects.auto._UserUsageConditionsAgreement(org.haiku.haikudepotserver.dataobjects.auto._UserUsageConditionsAgreement)

Aggregations

Preconditions (com.google.common.base.Preconditions)1 Strings (com.google.common.base.Strings)1 List (java.util.List)1 ObjectContext (org.apache.cayenne.ObjectContext)1 ObjectSelect (org.apache.cayenne.query.ObjectSelect)1 User (org.haiku.haikudepotserver.dataobjects.User)1 UserUsageConditions (org.haiku.haikudepotserver.dataobjects.UserUsageConditions)1 org.haiku.haikudepotserver.dataobjects.auto._UserUsageConditionsAgreement (org.haiku.haikudepotserver.dataobjects.auto._UserUsageConditionsAgreement)1 LikeHelper (org.haiku.haikudepotserver.support.LikeHelper)1 UserSearchSpecification (org.haiku.haikudepotserver.user.model.UserSearchSpecification)1 UserService (org.haiku.haikudepotserver.user.model.UserService)1 Logger (org.slf4j.Logger)1 LoggerFactory (org.slf4j.LoggerFactory)1 Service (org.springframework.stereotype.Service)1