本文整理汇总了Java中net.fortuna.ical4j.model.property.Method类的典型用法代码示例。如果您正苦于以下问题:Java Method类的具体用法?Java Method怎么用?Java Method使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Method类属于net.fortuna.ical4j.model.property包,在下文中一共展示了Method类的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: generateCalendar
import net.fortuna.ical4j.model.property.Method; //导入依赖的package包/类
/**
* Generates a Calendar Object
* @param user
* @param project
* @return Calendar of the user
* null if the calendar has not got events
* @throws TooManyItemsToLoadException
*/
private Calendar generateCalendar(TPersonBean user, String project) throws IOException, TooManyItemsToLoadException {
Calendar calendar = new Calendar();
calendar.getProperties().add(new ProdId("Calendar of Projects: "+ project));
calendar.getProperties().add(Version.VERSION_2_0);
calendar.getProperties().add(CalScale.GREGORIAN);
calendar.getProperties().add(Method.PUBLISH);
List<TWorkItemBean> workItemList = obtainIssues(user, project);
if (workItemList!=null&&workItemList.size()!=0){
addEventsFromWorkItemList(workItemList, calendar, user.getLocale());
return calendar;
}
else {
return calendar;
}
}
示例2: IcalHandler
import net.fortuna.ical4j.model.property.Method; //导入依赖的package包/类
/**
* Constructor
*
* @param method
* (@see IcalHandler) constants
*/
public IcalHandler(Method method) {
log.debug("Icalhandler method type : " + method);
icsCalendar = new Calendar();
icsCalendar.getProperties().add(new ProdId("-//Events Calendar//iCal4j 1.0//EN"));
icsCalendar.getProperties().add(Version.VERSION_2_0);
icsCalendar.getProperties().add(CalScale.GREGORIAN);
icsCalendar.getProperties().add(method);
}
示例3: setupCalendar
import net.fortuna.ical4j.model.property.Method; //导入依赖的package包/类
/**
* Helper method to setup the standard parts of the calendar
* @return
*/
private Calendar setupCalendar(String method) {
String serverName = sakaiProxy.getServerName();
//setup calendar
Calendar calendar = new Calendar();
calendar.getProperties().add(new ProdId("-//"+serverName+"//Sakai External Calendaring Service//EN"));
calendar.getProperties().add(Version.VERSION_2_0);
calendar.getProperties().add(CalScale.GREGORIAN);
if (method != null) {
calendar.getProperties().add(new Method(method));
}
return calendar;
}
示例4: processPostRequest
import net.fortuna.ical4j.model.property.Method; //导入依赖的package包/类
private void processPostRequest(Calendar calendar, ScheduleMultiResponse ms) {
if (!Method.REQUEST.equals(calendar.getMethod())) {
return;
}
processPostFreeBusyRequest(calendar, ms);
}
示例5: createSimpleContentItem
import net.fortuna.ical4j.model.property.Method; //导入依赖的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;
}
示例6: getCalDavCalendar
import net.fortuna.ical4j.model.property.Method; //导入依赖的package包/类
public Calendar getCalDavCalendar(String userToken) throws URISyntaxException, ParseException {
UserWithPermission user;
try {
user = findUserFromCalendarToken(userToken);
} catch (EmptyResultDataAccessException ex) {
throw new SecurityException("Invalid token");
}
if (userRepository.isCalendarFeedDisabled(user)) {
throw new SecurityException("Calendar feed disabled");
}
final Calendar calendar = new Calendar();
calendar.getProperties().add(new ProdId("-//Lavagna//iCal4j 1.0//EN"));
calendar.getProperties().add(Version.VERSION_2_0);
calendar.getProperties().add(CalScale.GREGORIAN);
calendar.getProperties().add(Method.PUBLISH);
final List<VEvent> events = new ArrayList<>();
final String applicationUrl = StringUtils
.appendIfMissing(configurationRepository.getValue(Key.BASE_APPLICATION_URL), "/");
final CalendarEventHandler handler = new CalendarVEventHandler(applicationUrl, cardDataService, userRepository,
events);
// Milestones
addMilestoneEvents(handler, user);
// Cards
addCardEvents(handler, user);
calendar.getComponents().addAll(events);
return calendar;
}
示例7: simpleInvitionIcalLink
import net.fortuna.ical4j.model.property.Method; //导入依赖的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: main
import net.fortuna.ical4j.model.property.Method; //导入依赖的package包/类
public static void main (final String... args)
throws Exception
{
final String ical = "BEGIN:VCALENDAR\n" +
"PRODID:-//ACME/DesktopCalendar//EN\n" +
"METHOD:REQUEST\n" +
"X-LIC-NOTE: #I1. Reschedules C1\n" +
"VERSION:2.0\n" +
"BEGIN:VEVENT\n" +
"ORGANIZER:Mailto:[email protected]\n" +
"ATTENDEE;ROLE=CHAIR;PARTSTAT=ACCEPTED;CN=BIG A:Mailto:[email protected]\n" +
"ATTENDEE;RSVP=TRUE;CUTYPE=INDIVIDUAL;CN=B:Mailto:[email protected]\n" +
"ATTENDEE;RSVP=TRUE;CUTYPE=INDIVIDUAL;CN=C:Mailto:[email protected]\n" +
"ATTENDEE;RSVP=TRUE;CUTYPE=INDIVIDUAL;CN=Hal:Mailto:[email protected]\n" +
"ATTENDEE;RSVP=FALSE;CUTYPE=ROOM:[email protected]\n" +
"ATTENDEE;ROLE=NON-PARTICIPANT;RSVP=FALSE:Mailto:[email protected]\n" +
"DTSTAMP:19970611T190000Z\n" +
"DTSTART:19970701T200000Z\n" +
"DTEND:19970701T2000000Z\n" +
"SUMMARY:Conference\n" +
"UID:[email protected]\n" +
"SEQUENCE:2\n" +
"STATUS:CONFIRMED\n" +
"END:VEVENT\n" +
"END:VCALENDAR";
final SimpleDateFormat dateFormat = new SimpleDateFormat();
final CalendarBuilder calendarBuilder = new CalendarBuilder();
final Calendar calendar = calendarBuilder.build(new StringReader(ical));
final Method method = calendar.getMethod();
System.out.println(method.getValue()); // REQUEST, e.g.
System.out.println(method == Method.REQUEST);
for (final Component component : (List<Component>)calendar.getComponents())
{
System.out.println(component.getName()); // VEVENT, e.g.
if (component instanceof VEvent)
{
final VEvent vevent = (VEvent) component;
System.out.println(vevent.getSummary());
System.out.println(vevent.getDescription());
System.out.println(dateFormat.format(vevent.getStartDate().getDate()));
}
for (final Property property : (List<Property>) component.getProperties(Property.ATTENDEE))
{
final Attendee attendee = (Attendee) property;
System.out.println(attendee.getCalAddress().getSchemeSpecificPart());
System.out.println(attendee.getParameter(Parameter.CN));
System.out.println(attendee.getName());
System.out.println(attendee.getValue());
}
}
System.out.println("END");
System.exit(0);
}
示例9: sendMail
import net.fortuna.ical4j.model.property.Method; //导入依赖的package包/类
@Transactional
public void sendMail(Event event, String email) throws AxelorException, MessagingException, IOException, ClassNotFoundException, InstantiationException, IllegalAccessException, ValidationException, ParseException, ICalendarException{
EmailAddress emailAddress = Beans.get(EmailAddressRepository.class).all().filter("self.address = ?1", email).fetchOne();
User user = Beans.get(UserRepository.class).all().filter("self.partner.emailAddress.address = ?1", email).fetchOne();
CrmConfig crmConfig = Beans.get(CrmConfigService.class).getCrmConfig(user.getActiveCompany());
if(crmConfig.getSendMail() == true) {
if(emailAddress == null){
emailAddress = new EmailAddress(email);
}
Template guestAddedTemplate = crmConfig.getMeetingGuestAddedTemplate();
Message message = new Message();
if(guestAddedTemplate == null){
if(message.getFromEmailAddress() == null){
message.setFromEmailAddress(user.getPartner().getEmailAddress());
}
message.addToEmailAddressSetItem(emailAddress);
message.setSubject(event.getSubject());
message.setMailAccount(Beans.get(MailAccountService.class).getDefaultMailAccount());
}
else{
message = Beans.get(TemplateMessageService.class).generateMessage(event, guestAddedTemplate);
if(message.getFromEmailAddress() == null){
message.setFromEmailAddress(user.getPartner().getEmailAddress());
}
message.addToEmailAddressSetItem(emailAddress);
}
if(event.getUid() != null){
CalendarService calendarService = Beans.get(CalendarService.class);
Calendar cal = calendarService.getCalendar(event.getUid(), event.getCalendarCrm());
cal.getProperties().add(Method.REQUEST);
File file = calendarService.export(cal);
Path filePath = file.toPath();
MetaFile metaFile = new MetaFile();
metaFile.setFileName( file.getName() );
metaFile.setFileType( Files.probeContentType( filePath ) );
metaFile.setFileSize( Files.size( filePath ) );
metaFile.setFilePath( file.getName() );
Set<MetaFile> fileSet = new HashSet<MetaFile>();
fileSet.add(metaFile);
Beans.get(MessageRepository.class).save(message);
Beans.get(MessageService.class).attachMetaFiles(message, fileSet);
}
message = Beans.get(MessageService.class).sendByEmail(message);
}
}