use of org.oasis_open.docs.ws_calendar.ns.soap.ResourceDescriptionType in project bw-caldav by Bedework.
the class CaldavCalNode method generateCalWsProperty.
@Override
public boolean generateCalWsProperty(final List<GetPropertiesBasePropertyType> props, final QName tag, final WebdavNsIntf intf, final boolean allProp) throws WebdavException {
try {
if (tag.equals(CalWSSoapTags.childCollection)) {
for (WebdavNsNode child : intf.getChildren(this, null)) {
CaldavBwNode cn = (CaldavBwNode) child;
ChildCollectionType cc = new ChildCollectionType();
cc.setHref(cn.getUrlValue());
List<Object> rtypes = cc.getCalendarCollectionOrCollection();
if (!cn.isCollection()) {
continue;
}
rtypes.add(new CollectionType());
if (cn.isCalendarCollection()) {
rtypes.add(new CalendarCollectionType());
}
props.add(cc);
}
return true;
}
if (tag.equals(CalWSSoapTags.lastModifiedDateTime)) {
String val = col.getLastmod();
if (val == null) {
return true;
}
LastModifiedDateTimeType lmdt = new LastModifiedDateTimeType();
lmdt.setDateTime(XcalUtil.fromDtval(val));
props.add(lmdt);
return true;
}
if (tag.equals(CalWSSoapTags.maxAttendeesPerInstance)) {
if (!rootNode) {
return true;
}
Integer val = getSysi().getAuthProperties().getMaxAttendeesPerInstance();
if (val != null) {
props.add(intProp(new MaxAttendeesPerInstanceType(), val));
}
return true;
}
if (tag.equals(CalWSSoapTags.maxDateTime)) {
return true;
}
if (tag.equals(CalWSSoapTags.maxInstances)) {
if (!rootNode) {
return true;
}
Integer val = getSysi().getAuthProperties().getMaxInstances();
if (val != null) {
props.add(intProp(new MaxInstancesType(), val));
}
return true;
}
if (tag.equals(CalWSSoapTags.maxResourceSize)) {
if (!rootNode) {
return true;
}
Integer val = getSysi().getAuthProperties().getMaxUserEntitySize();
if (val != null) {
props.add(intProp(new MaxResourceSizeType(), val));
}
return true;
}
if (tag.equals(CalWSSoapTags.minDateTime)) {
return true;
}
if (tag.equals(CalWSSoapTags.principalHome)) {
if (!rootNode || intf.getAnonymous()) {
return true;
}
SysIntf si = getSysi();
CalPrincipalInfo cinfo = si.getCalPrincipalInfo(si.getPrincipal());
if (cinfo.userHomePath != null) {
props.add(strProp(new PrincipalHomeType(), cinfo.userHomePath));
}
return true;
}
if (tag.equals(CalWSSoapTags.resourceDescription)) {
String s = col.getDescription();
if (s != null) {
props.add(strProp(new ResourceDescriptionType(), s));
}
return true;
}
if (tag.equals(CalWSSoapTags.resourceType)) {
ResourceTypeType rt = new ResourceTypeType();
int calType;
CalDAVCollection<?> c = // deref this
(CalDAVCollection<?>) getCollection(true);
if (c == null) {
// Probably no access -- fake it up as a collection
calType = CalDAVCollection.calTypeCollection;
} else {
calType = c.getCalType();
}
List<Object> rtypes = rt.getCalendarCollectionOrCollectionOrInbox();
rtypes.add(new CollectionType());
if (calType == CalDAVCollection.calTypeInbox) {
rtypes.add(new InboxType());
} else if (calType == CalDAVCollection.calTypeOutbox) {
rtypes.add(new OutboxType());
} else if (calType == CalDAVCollection.calTypeCalendarCollection) {
rtypes.add(new CalendarCollectionType());
}
props.add(rt);
return true;
}
if (tag.equals(CalWSSoapTags.resourceTimezoneId)) {
String tzid = col.getTimezone();
if (tzid != null) {
props.add(strProp(new ResourceTimezoneIdType(), tzid));
}
return true;
}
if (tag.equals(CalWSSoapTags.supportedCalendarComponentSet)) {
SupportedCalendarComponentSetType sccs = new SupportedCalendarComponentSetType();
CalDAVCollection<?> c = // deref this
(CalDAVCollection<?>) getCollection(true);
List<String> comps = c.getSupportedComponents();
if (Util.isEmpty(comps)) {
return false;
}
ObjectFactory of = new ObjectFactory();
for (String s : comps) {
JAXBElement<? extends BaseComponentType> el = null;
switch(s) {
case "VEVENT":
el = of.createVevent(new VeventType());
break;
case "VTODO":
el = of.createVtodo(new VtodoType());
break;
case "VAVAILABILITY":
el = of.createVavailability(new VavailabilityType());
break;
}
if (el != null) {
sccs.getBaseComponent().add(el);
}
}
props.add(sccs);
return true;
}
// Not known - try higher
return super.generateCalWsProperty(props, tag, intf, allProp);
} catch (WebdavException wde) {
throw wde;
} catch (Throwable t) {
throw new WebdavException(t);
}
}
Aggregations