
com.mindoo.domino.jna.utils.NotesBusyTimeUtils Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of domino-jna Show documentation
Show all versions of domino-jna Show documentation
Java project to access the HCL Domino C API using Java Native Access (JNA)
package com.mindoo.domino.jna.utils;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Collections;
import java.util.EnumSet;
import java.util.List;
import com.mindoo.domino.jna.NotesScheduleContainer;
import com.mindoo.domino.jna.NotesTimeDate;
import com.mindoo.domino.jna.constants.ScheduleOptions;
import com.mindoo.domino.jna.errors.NotesErrorUtils;
import com.mindoo.domino.jna.gc.NotesGC;
import com.mindoo.domino.jna.internal.Handle;
import com.mindoo.domino.jna.internal.ItemDecoder;
import com.mindoo.domino.jna.internal.Mem32;
import com.mindoo.domino.jna.internal.Mem64;
import com.mindoo.domino.jna.internal.NotesNativeAPI32;
import com.mindoo.domino.jna.internal.NotesNativeAPI64;
import com.mindoo.domino.jna.internal.structs.NotesTimeDatePairStruct;
import com.mindoo.domino.jna.internal.structs.NotesTimeDateStruct;
import com.mindoo.domino.jna.internal.structs.NotesUniversalNoteIdStruct;
import com.sun.jna.Memory;
import com.sun.jna.Pointer;
import com.sun.jna.ptr.IntByReference;
import com.sun.jna.ptr.LongByReference;
import com.sun.jna.ptr.ShortByReference;
/**
* Utility class to access the busytime information collected by the Domino server
*
* @author Karsten Lehmann
*/
public class NotesBusyTimeUtils {
/**
* This routine searches the schedule database (locally or on a specified server) for free time periods
* common to a specified list of people.
*
* @param apptUnid This is the UNID of an appointment to ignore for the purposes of calculating free time. This is useful when you need to move an appointment to a time which overlaps it. Can be null
* @param apptOrigDate This is the date of the original date of the appointment to ignore for free time calculations. Note that the only reason that this is here is for compatibility with Organizer 2.x gateway.
* @param findFirstFit If this value is equal to TRUE then this routine will return just the first free time interval that fits the duration. The size of this interval will equal to duration.
* @param from specifies the start of the range over which the free time search should be performed. In typical scheduling applications, this might be a range of 1 day or 5 days
* @param until specifies the end of the range over which the free time search should be performed. In typical scheduling applications, this might be a range of 1 day or 5 days
* @param duration How much free time you are looking for, in minutes (max 65535).
* @param names list of distinguished names whose schedule should be searched, either in abbreviated or canonical format
* @return timedate pairs indicating runs of free time
*/
public static List freeTimeSearch(String apptUnid, NotesTimeDate apptOrigDate,
boolean findFirstFit, NotesTimeDate from, NotesTimeDate until, int duration, List names) {
NotesUniversalNoteIdStruct unidStruct = apptUnid==null ? null : NotesUniversalNoteIdStruct.fromString(apptUnid);
NotesTimeDateStruct apptOrigDateStruct = apptOrigDate==null ? null : NotesTimeDateStruct.newInstance(apptOrigDate.getInnards());
if (from==null)
throw new IllegalArgumentException("from date cannot be null");
if (until==null)
throw new IllegalArgumentException("until date cannot be null");
NotesTimeDatePairStruct intervalPair = NotesTimeDatePairStruct.newInstance();
intervalPair.Lower = NotesTimeDateStruct.newInstance(from.getInnards());
intervalPair.Upper = NotesTimeDateStruct.newInstance(until.getInnards());
intervalPair.write();
if (duration > 65535) {
throw new IllegalArgumentException("Duration can only have a short value ("+duration+">65535)");
}
List namesCanonical = new ArrayList();
for (String currName : names) {
namesCanonical.add(NotesNamingUtils.toCanonicalName(currName));
}
short result;
List
© 2015 - 2025 Weber Informatics LLC | Privacy Policy