Example usage for com.liferay.portal.kernel.scheduler SchedulerEngineHelperUtil getCronText

List of usage examples for com.liferay.portal.kernel.scheduler SchedulerEngineHelperUtil getCronText

Introduction

In this page you can find the example usage for com.liferay.portal.kernel.scheduler SchedulerEngineHelperUtil getCronText.

Prototype

public static String getCronText(PortletRequest portletRequest, Calendar calendar, boolean timeZoneSensitive,
            int recurrenceType) 

Source Link

Usage

From source file:com.liferay.exportimport.staging.StagingImpl.java

License:Open Source License

protected ScheduleInformation getScheduleInformation(PortletRequest portletRequest, long targetGroupId,
        boolean remote) {

    ScheduleInformation scheduleInformation = new ScheduleInformation();

    int recurrenceType = ParamUtil.getInteger(portletRequest, "recurrenceType");

    Calendar startCalendar = ExportImportDateUtil.getCalendar(portletRequest, "schedulerStartDate", true);

    String cronText = SchedulerEngineHelperUtil.getCronText(portletRequest, startCalendar, true,
            recurrenceType);//from   www . j  a v a  2 s  . c o  m

    scheduleInformation.setCronText(cronText);

    String destinationName = DestinationNames.LAYOUTS_LOCAL_PUBLISHER;

    if (remote) {
        destinationName = DestinationNames.LAYOUTS_REMOTE_PUBLISHER;
    }

    String groupName = getSchedulerGroupName(destinationName, targetGroupId);

    scheduleInformation.setGroupName(groupName);

    Date schedulerEndDate = null;

    int endDateType = ParamUtil.getInteger(portletRequest, "endDateType");

    if (endDateType == 1) {
        Calendar endCalendar = ExportImportDateUtil.getCalendar(portletRequest, "schedulerEndDate", true);

        schedulerEndDate = endCalendar.getTime();
    }

    scheduleInformation.setSchedulerEndDate(schedulerEndDate);

    scheduleInformation.setStartCalendar(startCalendar);

    return scheduleInformation;
}