use of org.bedework.calfacade.BwFilterDef in project bw-calendar-engine by Bedework.
the class FilterRule method end.
public void end(String ns, String name) throws Exception {
BwFilterDef entity = (BwFilterDef) pop();
globals.counts[globals.filters]++;
try {
if (globals.rintf != null) {
trace("About to restore filter " + entity);
globals.rintf.restoreFilter(entity);
}
} catch (Throwable t) {
throw new Exception(t);
}
}
use of org.bedework.calfacade.BwFilterDef in project bw-calendar-engine by Bedework.
the class Filters method get.
@Override
public GetFilterDefResponse get(final String name) {
final GetFilterDefResponse gfdr = new GetFilterDefResponse();
try {
final BwFilterDef fdef = getCal().getFilterDef(name, getEntityOwner(getPrincipal()));
if (fdef == null) {
gfdr.setStatus(Response.Status.notFound);
} else {
gfdr.setStatus(Response.Status.ok);
gfdr.setFilterDef(fdef);
}
} catch (final CalFacadeException cfe) {
gfdr.setStatus(Response.Status.failed);
gfdr.setMessage(cfe.getLocalizedMessage());
}
return gfdr;
}
use of org.bedework.calfacade.BwFilterDef in project bw-calendar-engine by Bedework.
the class CalintfImpl method save.
/* ====================================================================
* filter defs
* ==================================================================== */
@Override
public void save(final BwFilterDef val, final BwPrincipal owner) throws CalFacadeException {
final BwFilterDef fd = filterDefs.fetch(val.getName(), owner);
if (fd != null) {
throw new CalFacadeException(CalFacadeException.duplicateFilter, val.getName());
}
entityDao.save(val);
}
use of org.bedework.calfacade.BwFilterDef in project bw-calendar-engine by Bedework.
the class CalintfImpl method deleteFilterDef.
@Override
public void deleteFilterDef(final String name, final BwPrincipal owner) throws CalFacadeException {
final BwFilterDef fd = filterDefs.fetch(name, owner);
if (fd == null) {
throw new CalFacadeException(CalFacadeException.unknownFilter, name);
}
entityDao.delete(fd);
}
use of org.bedework.calfacade.BwFilterDef in project bw-calendar-engine by Bedework.
the class BwStringRule method end.
@Override
public void end(final String ns, final String name) throws Exception {
if (name.equals("bwstring")) {
// 3.5 onwards we wrapped with a tag. Do nothing
return;
}
BwString entity = (BwString) pop();
if (top() instanceof BwRequestStatus) {
BwRequestStatus rs = (BwRequestStatus) top();
rs.setDescription(entity);
return;
}
if (top() instanceof BwCategory) {
BwCategory cat = (BwCategory) top();
if (name.equals("keyword")) {
cat.setWord(entity);
} else if (name.equals("desc")) {
cat.setDescription(entity);
} else {
unknownTag(name);
}
return;
}
if (top() instanceof BwContact) {
BwContact ent = (BwContact) top();
if (name.equals("value")) {
ent.setCn(entity);
} else {
unknownTag(name);
}
return;
}
if (top() instanceof BwLocation) {
BwLocation loc = (BwLocation) top();
if (name.equals("addr")) {
loc.setAddress(entity);
} else if (name.equals("subaddr")) {
loc.setSubaddress(entity);
} else {
unknownTag(name);
}
return;
}
if (top() instanceof BwFilterDef) {
BwFilterDef f = (BwFilterDef) top();
if (name.equals("display-name")) {
f.addDisplayName(entity);
} else if (name.equals("subaddr")) {
f.addDescription(new BwLongString(entity.getLang(), entity.getValue()));
} else {
unknownTag(name);
}
return;
}
if (top() instanceof BwAlarm) {
BwAlarm a = (BwAlarm) top();
if (name.equals("description")) {
a.addDescription(entity);
if (entity.getLang() != null) {
a.addXproperty(new BwXproperty(entity.getLang(), null, entity.getValue()));
} else {
a.addDescription(entity);
}
return;
}
if (name.equals("summary")) {
a.addSummary(entity);
} else {
unknownTag(name);
}
return;
}
EventInfo ei = (EventInfo) top();
BwEvent e = ei.getEvent();
if (e instanceof BwEventProxy) {
e = ((BwEventProxy) e).getRef();
}
if (name.equals("comment")) {
e.addComment(entity);
} else if (name.equals("description")) {
e.addDescription(new BwLongString(entity.getLang(), entity.getValue()));
} else if (name.equals("resource")) {
e.addResource(entity);
} else if (name.equals("summary")) {
e.addSummary(entity);
} else {
unknownTag(name);
}
}
Aggregations