All Downloads are FREE. Search and download functionalities are using the official Maven repository.

net.fortuna.ical4j.extensions.strategy.action.Action Maven / Gradle / Ivy

The newest version!
package net.fortuna.ical4j.extensions.strategy.action;

import net.fortuna.ical4j.extensions.strategy.AbstractStrategy;
import net.fortuna.ical4j.model.component.Participant;
import net.fortuna.ical4j.model.component.VToDo;

import java.time.Instant;
import java.time.temporal.Temporal;
import java.util.function.BiFunction;

import static net.fortuna.ical4j.model.DateTimePropertyModifiers.COMPLETED;
import static net.fortuna.ical4j.model.DateTimePropertyModifiers.DUE;
import static net.fortuna.ical4j.model.DescriptivePropertyModifiers.SUMMARY;

/**
 * This represents an action undertaken by an actor in response to a related component.
 * Actions may be chained together to form a workflow.
 * 

* See: Action */ public class Action extends AbstractStrategy { private Participant participant; private String summary; private Temporal due; private Instant completed; public Action participant(Participant participant) { this.participant = participant; return this; } public Action summary(String summary) { this.summary = summary; return this; } public Action due(Temporal due) { this.due = due; return this; } @Override public VToDo get() { VToDo vToDo = getPrototype().isPresent() ? getPrototype().get().copy() : new VToDo(); // vToDo.with(CONCEPT, ImmutableConcept.ACTION); vToDo.with(SUMMARY, summary); vToDo.with(DUE, due); vToDo.with(COMPLETED, completed); vToDo.with((BiFunction) (c, p) -> { if (p != null) c.add(p); return c; }, participant); return vToDo; } }





© 2015 - 2025 Weber Informatics LLC | Privacy Policy