Package pl.net.bluesoft.rnd.processtool.dao

Examples of pl.net.bluesoft.rnd.processtool.dao.UserDataDAO


    @Override
    public List<UserData> findUsersByExample(final UserData userData) {
        return withContext(new ReturningProcessToolContextCallback<List<UserData>>() {
            @Override
            public List<UserData> processWithContext(ProcessToolContext ctx) {
                UserDataDAO dao = ctx.getUserDataDAO();
                DetachedCriteria criteria = dao.getDetachedCriteria().add(Example.create(userData)).addOrder(Order.asc("login"));
                return ctx.getUserDataDAO().findByCriteria(criteria);
            }
        });
    }
View Full Code Here


    @Override
    public List<UserData> findUsersByLogins(final Collection<String> logins) {
        return withContext(new ReturningProcessToolContextCallback<List<UserData>>() {
            @Override
            public List<UserData> processWithContext(ProcessToolContext ctx) {
                UserDataDAO dao = ctx.getUserDataDAO();
                DetachedCriteria criteria = dao.getDetachedCriteria().add(Restrictions.in("login", logins))
                        .addOrder(Order.asc("login"));
                return dao.findByCriteria(criteria);
            }
        });
    }
View Full Code Here

    @Override
    public List<UserData> findUsersByEmails(final Collection<String> emails) {
        return withContext(new ReturningProcessToolContextCallback<List<UserData>>() {
            @Override
            public List<UserData> processWithContext(ProcessToolContext ctx) {
                UserDataDAO dao = ctx.getUserDataDAO();
                DetachedCriteria criteria = dao.getDetachedCriteria().add(Restrictions.in("email", emails))
                        .addOrder(Order.asc("login"));
                return dao.findByCriteria(criteria);
            }
        });
    }
View Full Code Here

    @Override
    public List<UserData> findUsersByIds(final Collection<Long> ids) {
        return withContext(new ReturningProcessToolContextCallback<List<UserData>>() {
            @Override
            public List<UserData> processWithContext(ProcessToolContext ctx) {
                UserDataDAO dao = ctx.getUserDataDAO();
                DetachedCriteria criteria = dao.getDetachedCriteria().add(Restrictions.in("id", ids))
                        .addOrder(Order.asc("login"));
                return dao.findByCriteria(criteria);
            }
        });
    }
View Full Code Here

    @Override
    public List<UserData> findUsersByAttribute(final String key, final String... values) {
        return withContext(new ReturningProcessToolContextCallback<List<UserData>>() {
            @Override
            public List<UserData> processWithContext(ProcessToolContext ctx) {
                UserDataDAO dao = ctx.getUserDataDAO();
                DetachedCriteria criteria = dao.getDetachedCriteria()
                        .setResultTransformer(CriteriaSpecification.DISTINCT_ROOT_ENTITY)
                        .addOrder(Order.asc("login"))
                        .createCriteria("attributes")
                        .add(Restrictions.eq("key", key));
                if(values.length == 1)
                  criteria.add(Restrictions.eq("value", values[0]));
                else
                  criteria.add(Restrictions.in("value", values));
                return dao.findByCriteria(criteria);
            }
        });
    }
View Full Code Here

    @Override
    public List<UserData> findUsersContainingAttributes(final String... key) {
        return withContext(new ReturningProcessToolContextCallback<List<UserData>>() {
            @Override
            public List<UserData> processWithContext(ProcessToolContext ctx) {
                UserDataDAO dao = ctx.getUserDataDAO();
                DetachedCriteria criteria = dao.getDetachedCriteria()
                        .setResultTransformer(CriteriaSpecification.DISTINCT_ROOT_ENTITY)
                        .addOrder(Order.asc("login"))
                        .createCriteria("attributes")
                        .add(Restrictions.in("key", key));
                return dao.findByCriteria(criteria);
            }
        });
    }
View Full Code Here

    @Override
    public List<UserData> findUsersByAttributes(final Map<String, String> attributeValues) {
        return withContext(new ReturningProcessToolContextCallback<List<UserData>>() {
            @Override
            public List<UserData> processWithContext(ProcessToolContext ctx) {
                UserDataDAO dao = ctx.getUserDataDAO();
                DetachedCriteria criteria = configureAttributesJoinCriteria(dao.getDetachedCriteria(), attributeValues);
                return dao.findByCriteria(criteria);
            }
        });
    }
View Full Code Here

    @Override
    public List<UserData> findUsersByCriteria(final Criterion... criteria) {
        return withContext(new ReturningProcessToolContextCallback<List<UserData>>() {
            @Override
            public List<UserData> processWithContext(ProcessToolContext ctx) {
                UserDataDAO dao = ctx.getUserDataDAO();
                DetachedCriteria detachedCriteria = dao.getDetachedCriteria();
                for (Criterion c : criteria) {
                    detachedCriteria.add(c);
                }
                return dao.findByCriteria(detachedCriteria);
            }
        });
    }
View Full Code Here

    @Override
    public List<UserData> findUsersByCriteria(final CriteriaConfigurer configurer) {
        return withContext(new ReturningProcessToolContextCallback<List<UserData>>() {
            @Override
            public List<UserData> processWithContext(ProcessToolContext ctx) {
                UserDataDAO dao = ctx.getUserDataDAO();
                DetachedCriteria detachedCriteria = dao.getDetachedCriteria();
                configurer.configure(detachedCriteria);
                return dao.findByCriteria(detachedCriteria);
            }
        });
    }
View Full Code Here

            }
        });
    }

    protected UserData updateUserInternal(ProcessToolContext ctx, UserData user) {
        UserDataDAO dao = ctx.getUserDataDAO();
        UserData base = dao.loadOrCreateUserByLogin(user);
        UserData merged = UserConverterUtils.mergeUsers(base, user);
        dao.saveOrUpdate(merged);
        return merged;
    }
View Full Code Here

TOP

Related Classes of pl.net.bluesoft.rnd.processtool.dao.UserDataDAO

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.