
org.bedework.calfacade.ScheduleResult Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of bw-calendar-facade Show documentation
Show all versions of bw-calendar-facade Show documentation
Common calendar classes and code for bedework
The newest version!
/* ********************************************************************
Licensed to Jasig under one or more contributor license
agreements. See the NOTICE file distributed with this work
for additional information regarding copyright ownership.
Jasig licenses this file to you under the Apache License,
Version 2.0 (the "License"); you may not use this file
except in compliance with the License. You may obtain a
copy of the License at:
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on
an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
*/
package org.bedework.calfacade;
import org.bedework.util.calendar.ScheduleStates;
import org.bedework.base.ToString;
import org.bedework.base.response.Response;
import java.util.HashMap;
import java.util.Map;
import java.util.Set;
import java.util.TreeSet;
/** Result for a call to a scheduling method
*
* @author douglm
*/
public class ScheduleResult extends Response {
/** Result for a single recipient.
*/
public static class ScheduleRecipientResult
implements ScheduleStates, Comparable {
/** */
public String recipient;
private int status = scheduleUnprocessed;
/** Set if this is the result of a freebusy request. */
public BwEvent freeBusy;
@Override
public int compareTo(final ScheduleRecipientResult that) {
return recipient.compareTo(that.recipient);
}
@Override
public String toString() {
final ToString ts = new ToString(this);
ts.append("recipient", recipient);
ts.append("status", status);
return ts.toString();
}
/**
* @param val - the value
*/
public void setStatus(final int val) {
status = val;
}
/**
* @return scheduling status
*/
public int getStatus() {
return status;
}
}
/** True if an event had a previously seen sequence and dtstamp.
* recipient results will be set but no action taken.
*/
public boolean ignored;
/** Flagged by incremented sequence or dtstamp in event. */
public boolean reschedule;
/** Flagged by same sequence and dtstamp in event. */
public boolean update;
/** Set of ScheduleRecipientResult */
public Map recipientResults =
new HashMap<>();
/** Recipients external to the system. */
public Set externalRcs = new TreeSet<>();
public void addRecipientResult(final ScheduleRecipientResult srr) {
recipientResults.put(srr.recipient, srr);
}
@Override
public String toString() {
final ToString ts = new ToString(this);
super.toStringSegment(ts);
ts.append("ignored", ignored)
.append("reschedule", reschedule)
.append("ignored", ignored);
if ((recipientResults != null) && !recipientResults.isEmpty()) {
for (final ScheduleRecipientResult srr: recipientResults.values()) {
ts.append(srr);
}
}
return ts.toString();
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy