use of de.janrufmonitor.framework.IAttribute in project janrufmonitor by tbrandt77.
the class EabFileCallerExporter method doExport.
public boolean doExport() {
File db = new File(m_filename);
try {
Properties addressbook = new Properties();
FileOutputStream fo = new FileOutputStream(db);
ICaller c = null;
addressbook.setProperty("total", Integer.toString(this.m_callerList.size()));
for (int i = 0; i < this.m_callerList.size(); i++) {
c = this.m_callerList.get(i);
if (c instanceof IMultiPhoneCaller) {
List phones = ((IMultiPhoneCaller) c).getPhonenumbers();
addressbook.setProperty((i + 1) + ".phonecount", Integer.toString(phones.size()));
for (int a = 0, b = phones.size(); a < b; a++) {
addressbook.setProperty((i + 1) + ".intarea." + a, ((IPhonenumber) phones.get(a)).getIntAreaCode());
addressbook.setProperty((i + 1) + ".area." + a, ((IPhonenumber) phones.get(a)).getAreaCode());
addressbook.setProperty((i + 1) + ".phone." + a, ((IPhonenumber) phones.get(a)).getCallNumber());
}
} else {
addressbook.setProperty((i + 1) + ".intarea", c.getPhoneNumber().getIntAreaCode());
addressbook.setProperty((i + 1) + ".area", c.getPhoneNumber().getAreaCode());
addressbook.setProperty((i + 1) + ".phone", c.getPhoneNumber().getCallNumber());
}
IAttributeMap attributes = c.getAttributes();
Iterator iter = attributes.iterator();
IAttribute a = null;
while (iter.hasNext()) {
a = (IAttribute) iter.next();
addressbook.setProperty((i + 1) + "." + a.getName(), a.getValue());
}
}
addressbook.store(fo, "");
fo.close();
} catch (FileNotFoundException ex) {
this.m_logger.severe("File not found: " + m_filename);
return false;
} catch (IOException ex) {
this.m_logger.severe("IOException on file " + m_filename);
return false;
}
return true;
}
use of de.janrufmonitor.framework.IAttribute in project janrufmonitor by tbrandt77.
the class OldDatFileCallImporter method parseState.
private IAttribute parseState(String state) {
IAttribute att = PIMRuntime.getInstance().getCallFactory().createAttribute("", "");
if (state.equalsIgnoreCase("1")) {
att.setName(IJAMConst.ATTRIBUTE_NAME_CALLSTATUS);
att.setValue(IJAMConst.ATTRIBUTE_VALUE_REJECTED);
} else if (state.equalsIgnoreCase("2")) {
att.setName(IJAMConst.ATTRIBUTE_NAME_CALLSTATUS);
att.setValue(IJAMConst.ATTRIBUTE_VALUE_ACCEPTED);
} else {
att.setName(IJAMConst.ATTRIBUTE_NAME_CALLSTATUS);
att.setValue(IJAMConst.ATTRIBUTE_VALUE_MISSED);
}
return att;
}
use of de.janrufmonitor.framework.IAttribute in project janrufmonitor by tbrandt77.
the class MultiPhoneCaller method clone.
public Object clone() throws CloneNotSupportedException {
Name cloneName = new Name(this.getName().getFirstname(), this.getName().getLastname(), this.getName().getAdditional());
List clonePhones = new ArrayList(m_phones.size());
Phonenumber pn = null;
for (int i = 0, j = m_phones.size(); i < j; i++) {
pn = new Phonenumber(((IPhonenumber) m_phones.get(i)).getTelephoneNumber());
pn.setAreaCode(((IPhonenumber) m_phones.get(i)).getAreaCode());
pn.setCallNumber(((IPhonenumber) m_phones.get(i)).getCallNumber());
pn.setIntAreaCode(((IPhonenumber) m_phones.get(i)).getIntAreaCode());
pn.setClired(((IPhonenumber) m_phones.get(i)).isClired());
clonePhones.add(pn);
}
AttributeMap cloneAttribs = new AttributeMap(this.getAttributes().size());
Iterator i = this.getAttributes().iterator();
IAttribute att = null;
while (i.hasNext()) {
att = (IAttribute) i.next();
Attribute cloneAttrib = new Attribute(att.getName(), att.getValue());
cloneAttribs.add(cloneAttrib);
}
if (clonePhones.size() == 0)
clonePhones.add(this.getPhoneNumber());
MultiPhoneCaller cloneCaller = new MultiPhoneCaller(this.getUUID(), cloneName, clonePhones, cloneAttribs);
if (clonePhones.size() > 0)
cloneCaller.setPhoneNumber((IPhonenumber) clonePhones.get(0));
return cloneCaller;
}
use of de.janrufmonitor.framework.IAttribute in project janrufmonitor by tbrandt77.
the class DatFileCallImporter method migrateStatus.
private void migrateStatus(ICall c) {
if (c.getAttribute(IJAMConst.ATTRIBUTE_NAME_CALLSTATUS) != null)
return;
IAttribute a = c.getAttribute(IJAMConst.ATTRIBUTE_VALUE_ACCEPTED);
if (a != null) {
c.getAttributes().remove(a);
a.setName(IJAMConst.ATTRIBUTE_NAME_CALLSTATUS);
a.setValue((a.getValue().equals(IJAMConst.ATTRIBUTE_VALUE_YES) ? IJAMConst.ATTRIBUTE_VALUE_ACCEPTED : IJAMConst.ATTRIBUTE_VALUE_MISSED));
c.setAttribute(a);
return;
}
a = c.getAttribute(IJAMConst.ATTRIBUTE_VALUE_REJECTED);
if (a != null) {
c.getAttributes().remove(a);
a.setName(IJAMConst.ATTRIBUTE_NAME_CALLSTATUS);
a.setValue((a.getValue().equals(IJAMConst.ATTRIBUTE_VALUE_YES) ? IJAMConst.ATTRIBUTE_VALUE_REJECTED : IJAMConst.ATTRIBUTE_VALUE_MISSED));
c.setAttribute(a);
return;
}
a = c.getAttribute(IJAMConst.ATTRIBUTE_VALUE_OUTGOING);
if (a != null) {
c.getAttributes().remove(a);
a.setName(IJAMConst.ATTRIBUTE_NAME_CALLSTATUS);
a.setValue((a.getValue().equals(IJAMConst.ATTRIBUTE_VALUE_YES) ? IJAMConst.ATTRIBUTE_VALUE_OUTGOING : IJAMConst.ATTRIBUTE_VALUE_MISSED));
c.setAttribute(a);
return;
}
c.setAttribute(PIMRuntime.getInstance().getCallFactory().createAttribute(IJAMConst.ATTRIBUTE_NAME_CALLSTATUS, IJAMConst.ATTRIBUTE_VALUE_MISSED));
}
use of de.janrufmonitor.framework.IAttribute in project janrufmonitor by tbrandt77.
the class Call method clone.
public Object clone() throws CloneNotSupportedException {
Caller cloneCaller = (Caller) ((Caller) this.m_caller).clone();
String cloneUuid = this.m_uuid;
Date cloneDate = this.m_date;
AttributeMap cloneAttribs = new AttributeMap();
Iterator i = this.m_attributeMap.iterator();
IAttribute att = null;
while (i.hasNext()) {
att = (IAttribute) i.next();
Attribute cloneAttrib = new Attribute(att.getName(), att.getValue());
cloneAttribs.add(cloneAttrib);
}
Cip cloneCip = new Cip(this.m_cip.getCIP(), this.m_cip.getAdditional());
Msn cloneMsn = new Msn(this.m_msn.getMSN(), this.m_msn.getAdditional());
return new Call(cloneUuid, cloneCaller, cloneMsn, cloneCip, cloneDate, cloneAttribs);
}
Aggregations