IPropertyTree *CEspBinding::ensureNavLink(IPropertyTree &folder, const char *name, const char *path, const char *tooltip, const char *menuname, const char *navPath, unsigned relPosition, bool force) { StringBuffer xpath; xpath.appendf("Link[@name=\"%s\"]", name); bool addNew = true; IPropertyTree *ret = folder.queryPropTree(xpath.str()); if (ret) { bool forced = ret->getPropBool("@force"); if (forced || !force) return ret; addNew = false; } if (addNew) ret=createPTree("Link"); ret->setProp("@name", name); ret->setProp("@tooltip", tooltip); ret->setProp("@path", path); ret->setProp("@menu", menuname); ret->setProp("@navPath", navPath); ret->setPropInt("@relPosition", relPosition); ret->setPropBool("@force", force); if (addNew) folder.addPropTree("Link", ret); return ret; }
IPropertyTree *CEspBinding::addNavException(IPropertyTree &folder, const char *message/*=NULL*/, int code/*=0*/, const char *source/*=NULL*/) { IPropertyTree *ret = folder.addPropTree("Exception", createPTree()); ret->addProp("@message", message ? message : "Unknown exception"); ret->setPropInt("@code", code); ret->setProp("@source", source); return ret; }
bool doSingleSwapNode(const char *oldip,const char *newip,unsigned nodenum,IPropertyTree *info,const char *timechecked) { if (doSwap(oldip,newip)) { if (info) { StringBuffer times(timechecked); if (times.length()==0) { CDateTime dt; dt.setNow(); dt.getString(times); } // TBD tie up with bad node in auto? IPropertyTree *swap = info->addPropTree("Swap",createPTree("Swap")); swap->setProp("@inNetAddress",newip); swap->setProp("@outNetAddress",oldip); swap->setProp("@time",times.str()); if (UINT_MAX != nodenum) swap->setPropInt("@rank",nodenum-1); } return true; } return false; }
void setExpiryTime(IPropertyTree & properties, unsigned expireDays) { properties.setPropInt("@expireDays", expireDays); }