本文整理汇总了Java中net.fortuna.ical4j.model.property.Organizer类的典型用法代码示例。如果您正苦于以下问题:Java Organizer类的具体用法?Java Organizer怎么用?Java Organizer使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Organizer类属于net.fortuna.ical4j.model.property包,在下文中一共展示了Organizer类的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: findOrCreateUser
import net.fortuna.ical4j.model.property.Organizer; //导入依赖的package包/类
protected ICalendarUser findOrCreateUser(Property source) {
URI addr = null;
if (source instanceof Organizer) {
addr = ((Organizer) source).getCalAddress();
}
if (source instanceof Attendee) {
addr = ((Attendee) source).getCalAddress();
}
if (addr == null) {
return null;
}
String email = mailto(addr.toString(), true);
ICalendarUserRepository repo = Beans.get(ICalendarUserRepository.class);
ICalendarUser user = repo.findByEmail(email);
if (user == null) {
user = new ICalendarUser();
user.setEmail(email);
}
if (source.getParameter(Parameter.CN) != null) {
user.setName(source.getParameter(Parameter.CN).getValue());
}
return user;
}
示例2: updateUser
import net.fortuna.ical4j.model.property.Organizer; //导入依赖的package包/类
public <T extends Property> T updateUser(T target, ICalendarUser user) {
if (user == null || user.getEmail() == null) {
return null;
}
String email = mailto(user.getEmail(), false);
String name = user.getName();
if (target instanceof Organizer) {
((Organizer) target).setCalAddress(createUri(email));
}
if (target instanceof Attendee) {
((Attendee) target).setCalAddress(createUri(email));
}
if (name != null) {
target.getParameters().add(new Cn(name));
}
return target;
}
示例3: createEvent
import net.fortuna.ical4j.model.property.Organizer; //导入依赖的package包/类
private static VEvent createEvent(Date startDate, Date endDate, String title, Integer itemID, String description, Integer responsibleID, VTimeZone tz) throws SocketException {
VEvent issueEvent = new VEvent(new Date(startDate.getTime()), new Date(endDate.getTime()), title);
// add timezone info..
issueEvent.getProperties().add(tz.getTimeZoneId());
// add description
issueEvent.getProperties().add(new Description(description));
// TODO: more adds
// generate unique identifier..
UidGenerator ug = new UidGenerator(itemID.toString());
issueEvent.getProperties().add(ug.generateUid());
//add organizer to method=PUBLISH for Outlook
try {
TPersonBean personBean = LookupContainer.getPersonBean(responsibleID);
if (personBean!=null) {
String email = personBean.getEmail();
if (email!=null) {
URI mailToURI = new URI("MAILTO", email, null);
issueEvent.getProperties().add(new Organizer(mailToURI));
}
}
} catch (URISyntaxException e) {
// TODO Auto-generated catch block
LOGGER.error(ExceptionUtils.getStackTrace(e));
}
return issueEvent;
}
示例4: createSimpleContentItem
import net.fortuna.ical4j.model.property.Organizer; //导入依赖的package包/类
/**
* Creates a simple item which will be checked with simpleCheckCallExpectedHandler.
*
* @param user
* @return
* @throws URISyntaxException
*/
private ContentItem createSimpleContentItem(User user) throws URISyntaxException {
//call service
ContentItem contentItem = testHelper.makeDummyContent(user);
HibEventStamp eventStamp = new HibEventStamp();
VEvent vEvent = new VEvent();
vEvent.getProperties().add(Method.REQUEST);
vEvent.getProperties().add(Version.VERSION_2_0);
Attendee dev1 = new Attendee(URI.create("MAILTO:" + ATTENDEE_1));
dev1.getParameters().add(Role.REQ_PARTICIPANT);
dev1.getParameters().add(PartStat.NEEDS_ACTION);
dev1.getParameters().add(Rsvp.TRUE);
vEvent.getProperties().add(dev1);
Organizer organizer = new Organizer("MAILTO:" + ORGANIZER);
vEvent.getProperties().add(organizer);
vEvent.getProperties().add(Status.VEVENT_CONFIRMED);
vEvent.getProperties().add(Transp.OPAQUE);
Calendar calendar = new Calendar();
calendar.getComponents().add(vEvent);
eventStamp.setEventCalendar(calendar);
contentItem.addStamp(eventStamp);
return contentItem;
}
示例5: createTestEvent
import net.fortuna.ical4j.model.property.Organizer; //导入依赖的package包/类
private void createTestEvent(LocalCalendar calendar) {
try {
TimeZone tzVienna = DateUtils.tzRegistry.getTimeZone("Europe/Vienna");
Event event = new Event();
event.uid = "[email protected]";
event.summary = "Sample event";
event.description = "Sample event with date/time";
event.location = "Sample location";
event.dtStart = new DtStart("20150501T120000", tzVienna);
event.dtEnd = new DtEnd("20150501T130000", tzVienna);
event.organizer = new Organizer(new URI("mailto:[email protected]"));
event.rRule = new RRule("FREQ=DAILY;COUNT=10");
event.forPublic = false;
event.status = Status.VEVENT_CONFIRMED;
// set an alarm one day, two hours, three minutes and four seconds before begin of event
event.alarms.add(new VAlarm(new Dur(-1, -2, -3, -4)));
// add two attendees
event.attendees.add(new Attendee(new URI("mailto:[email protected]")));
event.attendees.add(new Attendee(new URI("mailto:[email protected]")));
// add exception with alarm and attendee
Event exception = new Event();
exception.recurrenceId = new RecurrenceId("20150502T120000", tzVienna);
exception.summary = "Exception for sample event";
exception.dtStart = new DtStart("20150502T140000", tzVienna);
exception.dtEnd = new DtEnd("20150502T150000", tzVienna);
exception.alarms.add(new VAlarm(new Dur(-2, -3, -4, -5)));
exception.attendees.add(new Attendee(new URI("mailto:[email protected]")));
event.exceptions.add(exception);
// add EXDATE
event.exDates.add(new ExDate(new DateList("20150502T120000", Value.DATE_TIME, tzVienna)));
// add to calendar
Uri uri = new LocalEvent(calendar, event, null, null).add();
showMessage("Event created: " + uri);
showEvents(calendar);
} catch (Exception e) {
e.printStackTrace();
showMessage(e.toString());
}
}
示例6: createOrganizer
import net.fortuna.ical4j.model.property.Organizer; //导入依赖的package包/类
protected static Organizer createOrganizer(GenericValue partyValue, Map<String, Object> context) {
Organizer organizer = new Organizer();
loadPartyAssignment(organizer, partyValue, context);
return organizer;
}
示例7: simpleInvitionIcalLink
import net.fortuna.ical4j.model.property.Organizer; //导入依赖的package包/类
public void simpleInvitionIcalLink() {
// Create a TimeZone
TimeZoneRegistry registry = TimeZoneRegistryFactory.getInstance().createRegistry();
TimeZone timezone = registry.getTimeZone("America/Mexico_City");
VTimeZone tz = timezone.getVTimeZone();
// Start Date is on: April 1, 2008, 9:00 am
java.util.Calendar startDate = new GregorianCalendar();
startDate.setTimeZone(timezone);
startDate.set(java.util.Calendar.MONTH, java.util.Calendar.APRIL);
startDate.set(java.util.Calendar.DAY_OF_MONTH, 1);
startDate.set(java.util.Calendar.YEAR, 2008);
startDate.set(java.util.Calendar.HOUR_OF_DAY, 9);
startDate.set(java.util.Calendar.MINUTE, 0);
startDate.set(java.util.Calendar.SECOND, 0);
// End Date is on: April 1, 2008, 13:00
java.util.Calendar endDate = new GregorianCalendar();
endDate.setTimeZone(timezone);
endDate.set(java.util.Calendar.MONTH, java.util.Calendar.APRIL);
endDate.set(java.util.Calendar.DAY_OF_MONTH, 1);
endDate.set(java.util.Calendar.YEAR, 2008);
endDate.set(java.util.Calendar.HOUR_OF_DAY, 13);
endDate.set(java.util.Calendar.MINUTE, 0);
endDate.set(java.util.Calendar.SECOND, 0);
// Create the event
String eventName = "Progress Meeting";
DateTime start = new DateTime(startDate.getTime());
DateTime end = new DateTime(endDate.getTime());
VEvent meeting = new VEvent(start, end, eventName);
// add timezone info..
meeting.getProperties().add(tz.getTimeZoneId());
// generate unique identifier..
Uid uid = new Uid(UUID.randomUUID().toString());
meeting.getProperties().add(uid);
// add attendees..
Attendee dev1 = new Attendee(URI.create("mailto:[email protected]"));
dev1.getParameters().add(Role.REQ_PARTICIPANT);
dev1.getParameters().add(new Cn("Developer 1"));
meeting.getProperties().add(dev1);
Attendee dev2 = new Attendee(URI.create("mailto:[email protected]"));
dev2.getParameters().add(Role.OPT_PARTICIPANT);
dev2.getParameters().add(new Cn("Developer 2"));
meeting.getProperties().add(dev2);
// Create a calendar
net.fortuna.ical4j.model.Calendar icsCalendar = new net.fortuna.ical4j.model.Calendar();
icsCalendar.getProperties().add(
new ProdId("-//Events Calendar//iCal4j 1.0//EN"));
icsCalendar.getProperties().add(CalScale.GREGORIAN);
icsCalendar.getProperties().add(Version.VERSION_2_0);
// Add the event and print
icsCalendar.getComponents().add(meeting);
Organizer orger = new Organizer(URI.create("[email protected]"));
orger.getParameters().add(new Cn("Sebastian Wagner"));
meeting.getProperties().add(orger);
icsCalendar.getProperties().add(Method.REQUEST);
log.debug(icsCalendar.toString());
ByteArrayOutputStream bout = new ByteArrayOutputStream();
CalendarOutputter outputter = new CalendarOutputter();
try {
outputter.output(icsCalendar, bout);
iCalMimeBody = bout.toByteArray();
sendIcalMessage();
} catch (Exception e) {
log.error("Error", e);
}
}
示例8: createEvent
import net.fortuna.ical4j.model.property.Organizer; //导入依赖的package包/类
/**
* {@inheritDoc}
*/
public VEvent createEvent(CalendarEvent event, Set<User> attendees, boolean timeIsLocal) {
if(!isIcsEnabled()) {
log.debug("ExternalCalendaringService is disabled. Enable via calendar.ics.generation.enabled=true in sakai.properties");
return null;
}
VTimeZone tz = getTimeZone(timeIsLocal);
//start and end date
DateTime start = new DateTime(getStartDate(event.getRange()).getTime());
DateTime end = new DateTime(getEndDate(event.getRange()).getTime());
//create event incl title/summary
VEvent vevent = new VEvent(start, end, event.getDisplayName());
//add timezone
vevent.getProperties().add(tz.getTimeZoneId());
//add uid to event
//could come from the vevent_uuid field in the calendar event, otherwise from event ID.
String uuid = null;
if(StringUtils.isNotBlank(event.getField("vevent_uuid"))) {
uuid = event.getField("vevent_uuid");
} else {
uuid = event.getId();
}
vevent.getProperties().add(new Uid(uuid));
//add sequence to event
//will come from the vevent_sequnece field in the calendar event, otherwise skip it
String sequence = null;
if(StringUtils.isNotBlank(event.getField("vevent_sequence"))) {
sequence = event.getField("vevent_sequence");
vevent.getProperties().add(new Sequence(sequence));
}
//add description to event
vevent.getProperties().add(new Description(event.getDescription()));
//add location to event
vevent.getProperties().add(new Location(event.getLocation()));
//add organiser to event
if(StringUtils.isNotBlank(event.getCreator())) {
String creatorEmail = sakaiProxy.getUserEmail(event.getCreator());
URI mailURI = createMailURI(creatorEmail);
Cn commonName = new Cn(sakaiProxy.getUserDisplayName(event.getCreator()));
Organizer organizer = new Organizer(mailURI);
organizer.getParameters().add(commonName);
vevent.getProperties().add(organizer);
}
//add attendees to event with 'required participant' role
vevent = addAttendeesToEvent(vevent, attendees);
//add URL to event, if present
String url = null;
if(StringUtils.isNotBlank(event.getField("vevent_url"))) {
url = event.getField("vevent_url");
Url u = new Url();
try {
u.setValue(url);
vevent.getProperties().add(u);
} catch (URISyntaxException e) {
//it doesnt matter, ignore it
}
}
if(log.isDebugEnabled()){
log.debug("VEvent:" + vevent);
}
return vevent;
}
示例9: findOrCreateUser
import net.fortuna.ical4j.model.property.Organizer; //导入依赖的package包/类
protected ICalendarUser findOrCreateUser(Property source, Event event) {
URI addr = null;
if (source instanceof Organizer) {
addr = ((Organizer) source).getCalAddress();
}
if (source instanceof Attendee) {
addr = ((Attendee) source).getCalAddress();
}
if (addr == null) {
return null;
}
String email = mailto(addr.toString(), true);
ICalendarUserRepository repo = Beans.get(ICalendarUserRepository.class);
ICalendarUser user = null;
if (source instanceof Organizer) {
user = repo.all().filter("self.email = ?1", email).fetchOne();
}
else{
user = repo.all().filter("self.email = ?1 AND self.event.id = ?2", email, event.getId()).fetchOne();
}
if (user == null) {
user = new ICalendarUser();
user.setEmail(email);
user.setName(email);
EmailAddress emailAddress = Beans.get(EmailAddressRepository.class).findByAddress(email);
if(emailAddress != null && emailAddress.getPartner() != null && emailAddress.getPartner().getUser() != null){
user.setUser(emailAddress.getPartner().getUser());
}
}
if (source.getParameter(Parameter.CN) != null) {
user.setName(source.getParameter(Parameter.CN).getValue());
}
if(source.getParameter(Parameter.PARTSTAT) != null){
String role = source.getParameter(Parameter.PARTSTAT).getValue();
if(role.equals("TENTATIVE")){
user.setStatusSelect(ICalendarUserRepository.STATUS_MAYBE);
}
else if(role.equals("ACCEPTED")){
user.setStatusSelect(ICalendarUserRepository.STATUS_YES);
}
else if(role.equals("DECLINED")){
user.setStatusSelect(ICalendarUserRepository.STATUS_NO);
}
}
return user;
}