当前位置: 首页>>代码示例>>Java>>正文


Java CalScale类代码示例

本文整理汇总了Java中net.fortuna.ical4j.model.property.CalScale的典型用法代码示例。如果您正苦于以下问题:Java CalScale类的具体用法?Java CalScale怎么用?Java CalScale使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


CalScale类属于net.fortuna.ical4j.model.property包,在下文中一共展示了CalScale类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: icalResponse

import net.fortuna.ical4j.model.property.CalScale; //导入依赖的package包/类
private GetEventsResponse icalResponse(Page<EventEntity> eventPage) {
    Calendar calendar = new Calendar();
    calendar.getProperties().add(new ProdId("-//PutPut//iCal4j 1.0//EN"));
    calendar.getProperties().add(Version.VERSION_2_0);
    calendar.getProperties().add(CalScale.GREGORIAN);
    
    eventPage
            .getContent()
            .stream()
            .forEach(event -> {
                TimeZoneRegistry registry = TimeZoneRegistryFactory.getInstance().createRegistry();
                net.fortuna.ical4j.model.TimeZone timezone = registry.getTimeZone(event.getTimezone());
                
                VEvent vEvent = createVEvent(event, timezone);
                
                vEvent.getProperties().add(new Uid(event.getId()));
                vEvent.getProperties().add(new Description(event.getDescription()));
                vEvent.getProperties().add(new Location(event.getLocation()));
                vEvent.getProperties().add(timezone.getVTimeZone().getTimeZoneId());
                
                calendar.getComponents().add(vEvent);
            });
    
    return GetEventsResponse.withCalendarOK(calendar.toString());
}
 
开发者ID:adrobisch,项目名称:putput,代码行数:26,代码来源:EventsResource.java

示例2: parseAppointmenttoCalendar

import net.fortuna.ical4j.model.property.CalScale; //导入依赖的package包/类
/**
 * Methods to parse Appointment to iCalendar according RFC 2445
 *
 * @param appointment to be converted to iCalendar
 * @return iCalendar representation of the Appointment
 */
public Calendar parseAppointmenttoCalendar(Appointment appointment) {
	String tzid = parseTimeZone(null, appointment.getOwner()).getID();

	TimeZoneRegistry registry = TimeZoneRegistryFactory.getInstance().createRegistry();

	net.fortuna.ical4j.model.TimeZone timeZone = registry.getTimeZone(tzid);
	if (timeZone == null) {
		throw new NoSuchElementException("Unable to get time zone by id provided: " + tzid);
	}

	Calendar icsCalendar = new Calendar();
	icsCalendar.getProperties().add(new ProdId("-//Events Calendar//Apache Openmeetings//EN"));
	icsCalendar.getProperties().add(Version.VERSION_2_0);
	icsCalendar.getProperties().add(CalScale.GREGORIAN);
	icsCalendar.getComponents().add(timeZone.getVTimeZone());

	DateTime start = new DateTime(appointment.getStart()), end = new DateTime(appointment.getEnd());

	VEvent meeting = new VEvent(start, end, appointment.getTitle());
	meeting = addVEventpropsfromAppointment(appointment, meeting);
	icsCalendar.getComponents().add(meeting);

	return icsCalendar;
}
 
开发者ID:apache,项目名称:openmeetings,代码行数:31,代码来源:IcalUtils.java

示例3: parseAppointmentstoCalendar

import net.fortuna.ical4j.model.property.CalScale; //导入依赖的package包/类
/**
 * Parses a List of Appointments into a VCALENDAR component.
 *
 * @param appointments List of Appointments for the Calendar
 * @param ownerId      Owner of the Appointments
 * @return VCALENDAR representation of the Appointments
 */
public Calendar parseAppointmentstoCalendar(List<Appointment> appointments, Long ownerId) {
	String tzid = parseTimeZone(null, userDao.get(ownerId)).getID();

	TimeZoneRegistry registry = TimeZoneRegistryFactory.getInstance().createRegistry();

	net.fortuna.ical4j.model.TimeZone timeZone = registry.getTimeZone(tzid);
	if (timeZone == null) {
		throw new NoSuchElementException("Unable to get time zone by id provided: " + tzid);
	}

	Calendar icsCalendar = new Calendar();
	icsCalendar.getProperties().add(new ProdId(PROD_ID));
	icsCalendar.getProperties().add(Version.VERSION_2_0);
	icsCalendar.getProperties().add(CalScale.GREGORIAN);
	icsCalendar.getComponents().add(timeZone.getVTimeZone());

	for (Appointment appointment : appointments) {
		DateTime start = new DateTime(appointment.getStart()), end = new DateTime(appointment.getEnd());

		VEvent meeting = new VEvent(start, end, appointment.getTitle());
		meeting = addVEventpropsfromAppointment(appointment, meeting);
		icsCalendar.getComponents().add(meeting);
	}
	return icsCalendar;
}
 
开发者ID:apache,项目名称:openmeetings,代码行数:33,代码来源:IcalUtils.java

示例4: testGeneratingCalendar

import net.fortuna.ical4j.model.property.CalScale; //导入依赖的package包/类
/**
 * Ensure we can get a ical4j Calendar from the generated event.
 */
@Test
public void testGeneratingCalendar() {
	
	//generate new event
	CalendarEvent event = generateEvent();
	
	//create vevent
	net.fortuna.ical4j.model.component.VEvent vevent = service.createEvent(event);
	
	//create calendar from vevent
	net.fortuna.ical4j.model.Calendar calendar = service.createCalendar(Collections.singletonList(vevent));
	
	log.debug("testGeneratingCalendar");
	log.debug("######################");
	log.debug("{}", calendar);
	
	Assert.assertNotNull(calendar);
	
	//check attributes of the ical4j calendar are what we expect and match those in the event
	Assert.assertEquals(Version.VERSION_2_0, calendar.getVersion());
	Assert.assertEquals(CalScale.GREGORIAN, calendar.getCalendarScale());
	
}
 
开发者ID:sakaiproject,项目名称:sakai,代码行数:27,代码来源:ExternalCalendaringServiceTest.java

示例5: generateCalendar

import net.fortuna.ical4j.model.property.CalScale; //导入依赖的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;
	}
}
 
开发者ID:trackplus,项目名称:Genji,代码行数:27,代码来源:ICalendarSynchronizeAction.java

示例6: createCalendar

import net.fortuna.ical4j.model.property.CalScale; //导入依赖的package包/类
public static Calendar createCalendar(List<EventBean> events) {

        final String prodIdCompany = Unit.getInstitutionName().getContent();
        Calendar calendar = new Calendar();
        calendar.getProperties().add(new ProdId("-//" + prodIdCompany + "//" + PROD_ID_APPLICATION + "//PT"));
        calendar.getProperties().add(Version.VERSION_2_0);
        calendar.getProperties().add(CalScale.GREGORIAN);

        VTimeZone tz = TIMEZONE.getVTimeZone();
        calendar.getComponents().add(tz);

        for (EventBean eventBean : events) {
            calendar.getComponents().add(convertEventBean(eventBean));
        }
        return calendar;

    }
 
开发者ID:FenixEdu,项目名称:fenixedu-academic,代码行数:18,代码来源:CalendarFactory.java

示例7: IcalHandler

import net.fortuna.ical4j.model.property.CalScale; //导入依赖的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);
}
 
开发者ID:apache,项目名称:openmeetings,代码行数:16,代码来源:IcalHandler.java

示例8: setupCalendar

import net.fortuna.ical4j.model.property.CalScale; //导入依赖的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;
}
 
开发者ID:sakaiproject,项目名称:sakai,代码行数:19,代码来源:ExternalCalendaringServiceImpl.java

示例9: testGeneratingCalendarWithMultipleVEvents

import net.fortuna.ical4j.model.property.CalScale; //导入依赖的package包/类
/**
 * Ensure we can get a ical4j Calendar from the list of vevents.
 */
@Test
public void testGeneratingCalendarWithMultipleVEvents() {
			
	//create list of vevents
	List<net.fortuna.ical4j.model.component.VEvent> vevents = new ArrayList<net.fortuna.ical4j.model.component.VEvent>();

	for(int i=0;i<10;i++) {
		vevents.add(service.createEvent(generateEvent()));
	}
	
	//create calendar from vevent
	net.fortuna.ical4j.model.Calendar calendar = service.createCalendar(vevents);
	
	log.debug("testGeneratingCalendarWithMultipleVEvents");
	log.debug("#########################################");
	log.debug("{}", calendar);
	
	Assert.assertNotNull(calendar);
	
	//check attributes of the ical4j calendar are what we expect and match those in the event
	Assert.assertEquals(Version.VERSION_2_0, calendar.getVersion());
	Assert.assertEquals(CalScale.GREGORIAN, calendar.getCalendarScale());
	
	//TODO check count of vevents
	
}
 
开发者ID:sakaiproject,项目名称:sakai,代码行数:30,代码来源:ExternalCalendaringServiceTest.java

示例10: getFreeBusyCalendar

import net.fortuna.ical4j.model.property.CalScale; //导入依赖的package包/类
/**
 * Obfuscates the specified calendar by removing unnecessary properties and replacing text fields with specified
 * text.
 * 
 * @param original
 *            calendar to be obfuscated
 * @param productId
 *            productId to be set for the copy calendar.
 * @param freeBusyText
 * @return obfuscated calendar.
 */
public static Calendar getFreeBusyCalendar(Calendar original, String productId, String freeBusyText) {
    // Make a copy of the original calendar
    Calendar copy = new Calendar();
    copy.getProperties().add(new ProdId(productId));
    copy.getProperties().add(Version.VERSION_2_0);
    copy.getProperties().add(CalScale.GREGORIAN);
    copy.getProperties().add(new XProperty(FREE_BUSY_X_PROPERTY, Boolean.TRUE.toString()));

    ComponentList<CalendarComponent> events = original.getComponents(Component.VEVENT);
    for (Component event : events) {
        copy.getComponents().add(getFreeBusyEvent((VEvent) event, freeBusyText));
    }
    return copy;
}
 
开发者ID:1and1,项目名称:cosmo,代码行数:26,代码来源:FreeBusyUtil.java

示例11: getCalendarFromCollection

import net.fortuna.ical4j.model.property.CalScale; //导入依赖的package包/类
/**
 * @param collectionItem
 * @return
 */
private Calendar getCalendarFromCollection(DavRequest req, CollectionItem collectionItem) {
    Calendar result = new Calendar();

    if (productId == null) {
        synchronized (this) {
            if (productId == null) {
                Environment environment = WebApplicationContextUtils
                        .findWebApplicationContext(req.getServletContext()).getEnvironment();
                productId = environment.getProperty(PRODUCT_ID_KEY);
            }
        }
    }

    result.getProperties().add(new ProdId(productId));
    result.getProperties().add(Version.VERSION_2_0);
    result.getProperties().add(CalScale.GREGORIAN);

    for (Item item : collectionItem.getChildren()) {
        if (!NoteItem.class.isInstance(item)) {
            continue;
        }
        for (Stamp s : item.getStamps()) {
            if (BaseEventStamp.class.isInstance(s)) {
                BaseEventStamp baseEventStamp = BaseEventStamp.class.cast(s);
                result.getComponents().add(baseEventStamp.getEvent());
            }
        }
    }
    return result;
}
 
开发者ID:1and1,项目名称:cosmo,代码行数:35,代码来源:CalendarCollectionProvider.java

示例12: buildCalendar

import net.fortuna.ical4j.model.property.CalScale; //导入依赖的package包/类
private Calendar buildCalendar(final OlatCalendar olatCalendar) {
    final Calendar calendar = new Calendar();
    // add standard propeties
    calendar.getProperties().add(new ProdId("-//Ben Fortuna//iCal4j 1.0//EN"));
    calendar.getProperties().add(Version.VERSION_2_0);
    calendar.getProperties().add(CalScale.GREGORIAN);
    for (final Iterator<CalendarEntry> iter = olatCalendar.getAllCalendarEntries().iterator(); iter.hasNext();) {
        final CalendarEntry kEvent = iter.next();
        final VEvent vEvent = getVEvent(kEvent);
        calendar.getComponents().add(vEvent);
    }
    return calendar;
}
 
开发者ID:huihoo,项目名称:olat,代码行数:14,代码来源:CalendarDaoICalFileImpl.java

示例13: getCalDavCalendar

import net.fortuna.ical4j.model.property.CalScale; //导入依赖的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;
}
 
开发者ID:digitalfondue,项目名称:lavagna,代码行数:36,代码来源:CalendarService.java

示例14: makeCalendar

import net.fortuna.ical4j.model.property.CalScale; //导入依赖的package包/类
protected static Calendar makeCalendar(GenericValue workEffort, Map<String, Object> context) throws GenericEntityException {
    String iCalData = null;
    GenericValue iCalValue = workEffort.getRelatedOne("WorkEffortIcalData", false);
    if (iCalValue != null) {
        iCalData = iCalValue.getString("icalData");
    }
    boolean newCalendar = true;
    Calendar calendar = null;
    if (iCalData == null) {
        Debug.logVerbose("iCalendar Data not found, creating new Calendar", module);
        calendar = new Calendar();
    } else {
        Debug.logVerbose("iCalendar Data found, using saved Calendar", module);
        StringReader reader = new StringReader(iCalData);
        CalendarBuilder builder = new CalendarBuilder();
        try {
            calendar = builder.build(reader);
            newCalendar = false;
        } catch (Exception e) {
            Debug.logError(e, "Error while parsing saved iCalendar, creating new iCalendar: ", module);
            calendar = new Calendar();
        }
    }
    PropertyList propList = calendar.getProperties();
    replaceProperty(propList, prodId);
    replaceProperty(propList, new XProperty(workEffortIdXPropName, workEffort.getString("workEffortId")));
    if (newCalendar) {
        propList.add(Version.VERSION_2_0);
        propList.add(CalScale.GREGORIAN);
        // TODO: Get time zone from publish properties value
        java.util.TimeZone tz = java.util.TimeZone.getDefault();
        TimeZoneRegistry registry = TimeZoneRegistryFactory.getInstance().createRegistry();
        net.fortuna.ical4j.model.TimeZone timezone = registry.getTimeZone(tz.getID());
        calendar.getComponents().add(timezone.getVTimeZone());
    }
    return calendar;
}
 
开发者ID:jamesyong,项目名称:o3erp,代码行数:38,代码来源:ICalConverter.java

示例15: newCalendar

import net.fortuna.ical4j.model.property.CalScale; //导入依赖的package包/类
public static Calendar newCalendar() {
	final Calendar cal = new Calendar();
	cal.getProperties().add(new ProdId(PRODUCT_ID));
	cal.getProperties().add(Version.VERSION_2_0);
	cal.getProperties().add(CalScale.GREGORIAN);
	return cal;
}
 
开发者ID:axelor,项目名称:axelor-business-suite,代码行数:8,代码来源:ICalendarService.java


注:本文中的net.fortuna.ical4j.model.property.CalScale类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。