use of de.janrufmonitor.repository.mapping.DefaultOutlookMapping in project janrufmonitor by tbrandt77.
the class OutlookContactProxy method getCallerListFromSingleContact.
private ICallerList getCallerListFromSingleContact(Dispatch contact) throws ComFailException {
ICallerList callers = getRuntime().getCallerFactory().createCallerList();
try {
Properties config = this.getRuntime().getConfigManagerFactory().getConfigManager().getProperties(NAMESPACE);
if (config.getProperty("split", "true").equalsIgnoreCase("true")) {
ICaller privateCaller = createPrivateCaller(contact);
ICaller businessCaller = createBusinessCaller(contact);
if (privateCaller == null && businessCaller != null) {
callers.add(businessCaller);
}
if (privateCaller != null && businessCaller == null) {
callers.add(privateCaller);
}
if (privateCaller != null && businessCaller != null) {
if (((IMultiPhoneCaller) businessCaller).getPhonenumbers().size() == 1) {
// only one entry available
IPhonenumber pn = (IPhonenumber) ((IMultiPhoneCaller) businessCaller).getPhonenumbers().get(0);
IAttribute numbertype = businessCaller.getAttribute(IOutlookNumberMapping.MAPPING_ATTTRIBUTE_ID + pn.getTelephoneNumber());
if (numbertype != null && numbertype.getValue().equalsIgnoreCase(OutlookContactConst.MobileTelephoneNumber)) {
this.m_logger.info("Bussiness caller will be dropped. Only mobile number available, but still in private contact: " + businessCaller);
businessCaller = null;
}
}
if (((IMultiPhoneCaller) privateCaller).getPhonenumbers().size() == 1 && businessCaller != null) {
// only one entry available
IPhonenumber pn = (IPhonenumber) ((IMultiPhoneCaller) privateCaller).getPhonenumbers().get(0);
IAttribute numbertype = privateCaller.getAttribute(IOutlookNumberMapping.MAPPING_ATTTRIBUTE_ID + pn.getTelephoneNumber());
if (numbertype != null && numbertype.getValue().equalsIgnoreCase(OutlookContactConst.MobileTelephoneNumber)) {
this.m_logger.info("Private caller will be dropped. Only mobile number available, but still in business contact: " + privateCaller);
privateCaller = null;
}
}
if (privateCaller != null) {
callers.add(privateCaller);
}
if (businessCaller != null) {
callers.add(businessCaller);
}
}
} else {
ICaller c = OutlookMappingManager.getInstance().mapToJamCaller(contact, new DefaultOutlookMapping());
if (c != null)
callers.add(c);
}
updateProxyDatabase(callers);
} catch (ComFailException ex) {
this.m_logger.warning("1 item (e.g. distribution list) was ignored on loading.");
if (ex.toString().indexOf("Can't get object clsid from progid") > -1) {
this.m_logger.log(Level.SEVERE, ex.toString(), ex);
PropagationFactory.getInstance().fire(new Message(Message.ERROR, getNamespace(), "olstarterror", ex));
} else
this.m_logger.warning(ex.toString() + ", " + ex.getMessage());
} catch (Exception ex) {
this.m_logger.warning(ex.getMessage() + ", " + ex.toString());
} finally {
// added 2006/02/05: clean outlook references
if (contact != null)
contact.safeRelease();
}
return callers;
}
use of de.janrufmonitor.repository.mapping.DefaultOutlookMapping in project janrufmonitor by tbrandt77.
the class OutlookContactProxy method setContactData.
private void setContactData(Dispatch contact, ICaller c, boolean business) {
IOutlookMapping om = null;
if (business)
om = new BussinessOutlookMapping();
else
om = new PrivateOutlookMapping();
Properties config = this.getRuntime().getConfigManagerFactory().getConfigManager().getProperties(NAMESPACE);
if (config.getProperty("split", "true").equalsIgnoreCase("false")) {
om = new DefaultOutlookMapping();
PropagationFactory.getInstance().fire(new Message(Message.WARNING, getNamespace(), "olstore", new Exception("No split option selected.")));
}
OutlookMappingManager.getInstance().mapToOutlookCaller(contact, c, om);
}
Aggregations