if(!ep.isAuthenticated()) {
ep.authenticate(true);
}
try {
// ConnectionsService svc = new ConnectionsService(ep,"/profiles/atom/profileService.do");
ConnectionsService svc = new ConnectionsService(ep);
HandlerXml xml = new HandlerXml();
Document doc = (Document)svc.get("/profiles/atom/profileService.do",xml).getData();
XmlNavigator nav = new XmlNavigator(doc);
lcid = nav.get("service/workspace/collection/userid").stringValue(".");
privateData = true;
} catch(Exception e) {
e.printStackTrace();
}
}
// // This is obsolete - the call above is better as it handle servers where email access is disabled
// // Try from the current user identity (might be the email)
// if(lcid==null) {
// lcid = ep.getUserIdentity();
// privateData = true;
// }
if(StringUtil.isNotEmpty(lcid)) {
ConnectionsService svc = new ConnectionsService(ep);
String key = lcid.indexOf('@')>=0 ? "email" : "userid";
Map<String, String> p = Collections.singletonMap(key, lcid);
HandlerXml xml = new HandlerXml();
Document doc = (Document)svc.get("/profiles/atom/profile.do",p,xml).getData();
XmlNavigator nav = new XmlNavigator(doc);
ProfilesData data = new ProfilesData();
DataNavigator entry = nav.get("feed/entry/content/div/span/div");
data.privateData = privateData;
data.lcname = nav.get("feed/entry/contributor/name").stringValue(".");