/**
 * OpenCPS is the open source Core Public Services software
 * Copyright (C) 2016-present OpenCPS community
 * 
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU Affero General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * any later version.
 * 
 * This program 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 Affero General Public License for more details.
 * You should have received a copy of the GNU Affero General Public License
 * along with this program. If not, see <http://www.gnu.org/licenses/>
 */

package org.opencps.backend.util;


/**
 * @author khoavd
 *
 */
public class BookingDateGenerator {

}

@@ -798,73 +798,1292 @@
 l;%0A%0A
-%0A/**%0A * @author khoavd%0A *%0A */%0Apublic class BookingDateGenerator %7B%0A
+import java.util.Calendar;%0Aimport java.util.Date;%0A%0Aimport com.liferay.portal.kernel.util.GetterUtil;%0Aimport com.liferay.portal.kernel.util.StringPool;%0Aimport com.liferay.portal.kernel.util.StringUtil;%0A%0A%0A/**%0A * @author khoavd%0A *%0A */%0Apublic class BookingDateGenerator %7B%0A%09%0A%09/**%0A%09 * @param receiveDate%0A%09 * @param pattern%0A%09 * @return%0A%09 */%0A%09public static Date dateGenerator(Date receiveDate, String pattern) %7B%0A%09%09%0A%09%09Calendar cal = Calendar.getInstance();%0A%09%09%0A%09%09cal.setTime(receiveDate);%0A%09%09%0A%09%09String %5B%5D splitPattern = StringUtil.split(pattern, StringPool.SPACE);%0A%09%09%0A%09%09int bookingDays = 0;%0A%09%09int bookingHour = 0;%0A%09%09int bookingMinutes = 0;%0A%09%09%0A%09%09if (splitPattern.length == 2) %7B%0A%09%09%0A%09%09%09bookingDays = GetterUtil.getInteger(splitPattern%5B0%5D,0);%0A%09%09%09%0A%09%09%09String %5B%5D splitHour = StringUtil.split(splitPattern%5B1%5D, StringPool.COLON);%0A%09%09%09%0A%09%09%09if (splitHour.length == 2) %7B%0A%09%09%09%09bookingHour = GetterUtil.getInteger(splitHour%5B0%5D);%0A%09%09%09%09bookingMinutes = GetterUtil.getInteger(splitHour%5B1%5D);%0A%09%09%09%7D%0A%09%09%7D%0A%09%09%0A%09%09cal.add(Calendar.DATE, bookingDays);%0A%09%09cal.add(Calendar.HOUR, bookingHour);%0A%09%09cal.add(Calendar.MINUTE, bookingMinutes);%0A%09%09%0A%09%09return cal.getTime();%0A%09%09%0A%09%7D%0A%09%0A%09public static void main(String%5B%5D args) %7B%0A%0A%09    Date bookingDate = dateGenerator(new Date(), %22+29 7:33%22);%0A%09    %0A%09    System.out.println(bookingDate);%0A    %7D%0A%09
 %0A%7D%0A

Add BookingDate Function