Example usage for org.joda.time LocalDate now

List of usage examples for org.joda.time LocalDate now

Introduction

In this page you can find the example usage for org.joda.time LocalDate now.

Prototype

public static LocalDate now() 

Source Link

Document

Obtains a LocalDate set to the current system millisecond time using ISOChronology in the default time zone.

Usage

From source file:org.kuali.kpme.tklm.time.util.TkContext.java

License:Educational Community License

public static boolean isTargetSynchronous() {
    boolean isSynchronous = false;

    List<Assignment> assignments = HrServiceLocator.getAssignmentService()
            .getAssignments(getTargetPrincipalId(), LocalDate.now());

    for (Assignment assignment : assignments) {
        TimeCollectionRule tcr = TkServiceLocator.getTimeCollectionRuleService()
                .getTimeCollectionRule(assignment.getDept(), assignment.getWorkArea(), LocalDate.now());
        if (tcr == null || tcr.isClockUserFl()) {
            isSynchronous = true;//  w  w w .  ja  v  a 2  s.c  o m
            break;
        }
    }

    return isSynchronous;
}

From source file:org.kuali.kpme.tklm.time.web.TimeAction.java

License:Educational Community License

@Override
public ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest request,
        HttpServletResponse response) throws Exception {
    //boolean synch = TKUser.isSynchronous();
    String principalId = HrContext.getTargetPrincipalId();
    if (HrContext.isSystemAdmin()) {
        return new ActionRedirect("/portal.do");
    }//from  w w w.  j  a  v a 2 s  .c  o  m
    PrincipalHRAttributes phra = HrServiceLocator.getPrincipalHRAttributeService()
            .getPrincipalCalendar(principalId, LocalDate.now());
    if (phra == null) {
        return new ActionRedirect("/PersonInfo.do");
    }
    Job job = HrServiceLocator.getJobService().getPrimaryJob(principalId, LocalDate.now());
    boolean activeAssignments = false;
    if (job != null) {
        String flsa = job.getFlsaStatus();
        List<Assignment> assignments = HrServiceLocator.getAssignmentService()
                .getActiveAssignmentsForJob(principalId, job.getJobNumber(), LocalDate.now());
        for (Assignment asmnt : assignments) {
            if (asmnt.isActive()) {
                if (job.getFlsaStatus().equals(HrConstants.FLSA_STATUS_NON_EXEMPT)) {
                    TimeCollectionRule tcr = TkServiceLocator.getTimeCollectionRuleService()
                            .getTimeCollectionRule(asmnt.getJob().getDept(), asmnt.getWorkArea(),
                                    LocalDate.now());
                    if (tcr.isClockUserFl()) {
                        return new ActionRedirect("/Clock.do");
                    } else {
                        return new ActionRedirect("/TimeDetail.do");
                    }
                } else {
                    if (job.isEligibleForLeave()) {
                        return new ActionRedirect("/LeaveCalendar.do");
                    }
                }
            }
        }
    }

    return new ActionRedirect("/PersonInfo.do");
}

From source file:org.libreplan.business.users.daos.UserCoachDAO.java

License:Open Source License

@Override
public List<User> findApprenticeOf(User user) {
    return findApprenticeOf(user, LocalDate.now());
}

From source file:org.libreplan.business.users.daos.UserCoachDAO.java

License:Open Source License

@Override
public UserCoach findByUser(User user) {
    return findByUser(user, LocalDate.now());
}

From source file:org.libreplan.business.users.daos.UserDepartmentDAO.java

License:Open Source License

@Override
public List<User> findDepartmentMembers(Department dept) {
    return findDepartmentMembers(dept, LocalDate.now());
}

From source file:org.libreplan.business.users.daos.UserDepartmentDAO.java

License:Open Source License

@Override
@SuppressWarnings("unchecked")
public List<User> findDepartmentMembers(Department dept, LocalDate date) {
    Session session = getSession();//from  www.  j  a v  a 2 s.c o m
    if (date == null)
        date = LocalDate.now();

    Criteria c = session.createCriteria(UserDepartment.class).add(Restrictions.eq("dept", dept))
            .add(Restrictions.or(Restrictions.isNull("fromDate"), Restrictions.le("fromDate", date)))
            .add(Restrictions.or(Restrictions.isNull("toDate"), Restrictions.ge("toDate", date)))
            .addOrder(Order.desc("fromDate"));
    List<UserDepartment> uhs = c.list();
    List<User> result = new ArrayList<User>();
    for (UserDepartment uh : uhs) {
        result.add(uh.getUser());
    }

    return result;
}

From source file:org.libreplan.business.users.daos.UserDepartmentDAO.java

License:Open Source License

@Override
public List<UserDepartment> findUserDepartments(Department dept) {
    return findUserDepartments(dept, LocalDate.now());
}

From source file:org.libreplan.business.users.daos.UserDepartmentDAO.java

License:Open Source License

@Override
public List<UserDepartment> findUserDepartments(Department dept, LocalDate date) {
    Session session = getSession();//from www .  j  a  v a2 s  .c o m
    if (date == null)
        date = LocalDate.now();

    Criteria c = session.createCriteria(UserDepartment.class).add(Restrictions.eq("dept", dept))
            .add(Restrictions.or(Restrictions.isNull("fromDate"), Restrictions.le("fromDate", date)))
            .add(Restrictions.or(Restrictions.isNull("toDate"), Restrictions.ge("toDate", date)))
            .addOrder(Order.desc("fromDate"));
    return c.list();
}

From source file:org.libreplan.business.users.daos.UserDepartmentDAO.java

License:Open Source License

@Override
public UserDepartment findByUser(User user) {
    return findByUser(user, LocalDate.now());
}

From source file:org.libreplan.business.users.daos.UserLevelDAO.java

License:Open Source License

@Override
public UserLevel findByUser(User user) {
    return findByUser(user, LocalDate.now());
}