use of de.janrufmonitor.framework.ICallerList in project janrufmonitor by tbrandt77.
the class HttpCallerManager method setCaller.
public void setCaller(ICaller caller) {
ICallerList cl = this.getRuntime().getCallerFactory().createCallerList();
cl.add(caller);
this.setCaller(cl);
}
use of de.janrufmonitor.framework.ICallerList in project janrufmonitor by tbrandt77.
the class HttpCallerManager method getCallers.
public ICallerList getCallers(IFilter[] filters, ISearchTerm[] searchTerms) {
if (!this.isConnected()) {
this.m_logger.warning("Client is not yet connected with the server.");
return this.getRuntime().getCallerFactory().createCallerList();
}
IRequester r = this.getRequester(new CallerListGetHandler(this.getCallerManager(), filters, searchTerms));
IHttpResponse resp = r.request();
String xml = this.getXmlContent(resp);
this.handleRequester(resp, r);
ICallerList l = XMLSerializer.toCallerList(xml);
if (l != null) {
this.addCallerManagerAttribute(l);
return l;
}
this.m_logger.warning("Callerlist from remote host was empty.");
return this.getRuntime().getCallerFactory().createCallerList();
}
use of de.janrufmonitor.framework.ICallerList in project janrufmonitor by tbrandt77.
the class HttpCallerManager method updateCaller.
public void updateCaller(ICaller caller) {
ICallerList cl = this.getRuntime().getCallerFactory().createCallerList();
cl.add(caller);
if (!this.isConnected()) {
this.m_logger.warning("Client is not yet connected with the server.");
return;
}
IRequester r = null;
IHttpResponse resp = null;
r = this.getRequester(new CallerListUpdateHandler(cl, this.getCallerManager()));
resp = r.request();
this.handleRequester(resp, r);
ImageCache.getInstance().remove(caller.getPhoneNumber().getTelephoneNumber());
}
use of de.janrufmonitor.framework.ICallerList in project janrufmonitor by tbrandt77.
the class OutlookTransformer method createBusinessCallerList.
private ICallerList createBusinessCallerList(Dispatch contact) throws ComFailException {
ICallerList callerList = getRuntime().getCallerFactory().createCallerList();
IAttributeMap m = getRuntime().getCallerFactory().createAttributeMap();
IAttribute attribute = createAttribute(IJAMConst.ATTRIBUTE_NAME_FIRSTNAME, Dispatch.get(contact, "Firstname").toString().trim());
if (attribute != null)
m.add(attribute);
attribute = createAttribute(IJAMConst.ATTRIBUTE_NAME_LASTNAME, Dispatch.get(contact, "Lastname").toString().trim());
if (attribute != null)
m.add(attribute);
if (m.size() == 0) {
attribute = createAttribute(IJAMConst.ATTRIBUTE_NAME_FIRSTNAME, Dispatch.get(contact, "CompanyName").toString().trim());
if (attribute != null)
m.add(attribute);
} else {
attribute = createAttribute(IJAMConst.ATTRIBUTE_NAME_ADDITIONAL, Dispatch.get(contact, "CompanyName").toString().trim());
if (attribute != null)
m.add(attribute);
}
// check if business caller exists
if (m.size() > 0) {
m.addAll(createBusinessAddressAttributes(contact));
List phones = new ArrayList(businessPhones.length);
IPhonenumber phone = getRuntime().getCallerFactory().createPhonenumber(false);
String number = null;
for (int i = 0; i < businessPhones.length; i++) {
number = Dispatch.get(contact, businessPhones[i]).toString().trim();
if (number != null && number.length() > 0) {
if (this.m_logger.isLoggable(Level.INFO)) {
this.m_logger.info("OutlookTransformer raw number: " + number);
}
phone = PhonenumberAnalyzer.getInstance(getRuntime()).toIdentifiedPhonenumber(number);
if (this.m_logger.isLoggable(Level.INFO)) {
this.m_logger.info("OutlookTransformer identified number: " + phone);
}
if (phone != null) {
if (phone.getTelephoneNumber().trim().length() > 0 && !phone.isClired()) {
m.add(getNumberTypeAttribute(businessPhones[i], phone.getTelephoneNumber()));
phones.add(phone);
}
}
}
}
if (phones.size() > 0) {
ICaller outlookCaller = getRuntime().getCallerFactory().createCaller(null, phones, m);
// outlookCaller.setAttributes(m);
outlookCaller.setUUID(outlookCaller.getName().getLastname() + "_" + outlookCaller.getName().getFirstname() + "_" + outlookCaller.getPhoneNumber().getTelephoneNumber());
this.setPictureAttribute(outlookCaller, contact);
IAttribute cm = getRuntime().getCallerFactory().createAttribute(IJAMConst.ATTRIBUTE_NAME_CALLERMANAGER, ID);
outlookCaller.setAttribute(cm);
this.m_logger.fine("Created Outlook contact: " + outlookCaller.toString());
callerList.add(outlookCaller);
}
}
return callerList;
}
use of de.janrufmonitor.framework.ICallerList in project janrufmonitor by tbrandt77.
the class OutlookTransformer method createPrivateCallerList.
private ICallerList createPrivateCallerList(Dispatch contact) throws ComFailException {
ICallerList callerList = getRuntime().getCallerFactory().createCallerList();
IAttributeMap m = getRuntime().getCallerFactory().createAttributeMap();
IAttribute attribute = createAttribute(IJAMConst.ATTRIBUTE_NAME_FIRSTNAME, Dispatch.get(contact, "Firstname").toString().trim());
if (attribute != null)
m.add(attribute);
attribute = createAttribute(IJAMConst.ATTRIBUTE_NAME_LASTNAME, Dispatch.get(contact, "Lastname").toString().trim());
if (attribute != null)
m.add(attribute);
// check if private caller exists
if (m.size() > 0) {
m.addAll(createPrivateAddressAttributes(contact));
List phones = new ArrayList(businessPhones.length);
IPhonenumber phone = getRuntime().getCallerFactory().createPhonenumber(false);
String number = null;
for (int i = 0; i < privatePhones.length; i++) {
number = Dispatch.get(contact, privatePhones[i]).toString().trim();
if (number != null && number.length() > 0) {
if (this.m_logger.isLoggable(Level.INFO)) {
this.m_logger.info("OutlookTransformer raw number: " + number);
}
phone = PhonenumberAnalyzer.getInstance(getRuntime()).toIdentifiedPhonenumber(number);
if (this.m_logger.isLoggable(Level.INFO)) {
this.m_logger.info("OutlookTransformer identified number: " + phone);
}
if (phone != null) {
if (phone.getTelephoneNumber().trim().length() > 0 && !phone.isClired()) {
m.add(getNumberTypeAttribute(privatePhones[i], phone.getTelephoneNumber()));
phones.add(phone);
}
}
}
}
if (phones.size() > 0) {
ICaller outlookCaller = getRuntime().getCallerFactory().createCaller(null, phones, m);
outlookCaller.setUUID(outlookCaller.getName().getLastname() + "_" + outlookCaller.getName().getFirstname() + "_" + outlookCaller.getPhoneNumber().getTelephoneNumber());
this.setPictureAttribute(outlookCaller, contact);
IAttribute cm = getRuntime().getCallerFactory().createAttribute(IJAMConst.ATTRIBUTE_NAME_CALLERMANAGER, ID);
outlookCaller.setAttribute(cm);
this.m_logger.fine("Created Outlook contact: " + outlookCaller.toString());
callerList.add(outlookCaller);
}
}
return callerList;
}
Aggregations