Search in sources :

Example 51 with IAttribute

use of de.janrufmonitor.framework.IAttribute in project janrufmonitor by tbrandt77.

the class CallActive method renderAsImage.

public Image renderAsImage() {
    if (this.m_o != null) {
        if (this.m_o instanceof ICall) {
            ICall call = (ICall) this.m_o;
            IAttribute isCallActive = call.getAttribute(IJAMConst.ATTRIBUTE_NAME_CALL_ACTIVE_INDICATOR);
            if (isCallActive != null && isCallActive.getValue().equalsIgnoreCase(IJAMConst.ATTRIBUTE_VALUE_YES)) {
                IAttribute att = call.getAttribute(IJAMConst.ATTRIBUTE_NAME_CALLSTATUS);
                if (att != null && att.getValue().equalsIgnoreCase(IJAMConst.ATTRIBUTE_VALUE_ACCEPTED)) {
                    return SWTImageManager.getInstance(PIMRuntime.getInstance()).get(IJAMConst.IMAGE_KEY_CALL_IN_ACTIVE_PNG);
                }
                if (att != null && att.getValue().equalsIgnoreCase(IJAMConst.ATTRIBUTE_VALUE_OUTGOING)) {
                    return SWTImageManager.getInstance(PIMRuntime.getInstance()).get(IJAMConst.IMAGE_KEY_CALL_OUT_ACTIVE_PNG);
                }
            }
            if (isCallActive != null && isCallActive.getValue().equalsIgnoreCase(IJAMConst.ATTRIBUTE_VALUE_NO)) {
                IAttribute att = call.getAttribute(IJAMConst.ATTRIBUTE_NAME_CALL_DURATION);
                if (att != null && att.getValue().length() > 0) {
                    try {
                        long duration_in_sec = Long.parseLong(att.getValue());
                        long start = call.getDate().getTime() / 1000;
                        long now = new java.util.Date().getTime() / 1000;
                        long passedTime = now - (start + duration_in_sec);
                        if (passedTime < 300) {
                            return SWTImageManager.getInstance(PIMRuntime.getInstance()).get(IJAMConst.IMAGE_KEY_CALL_END_5MIN_PNG);
                        }
                    } catch (Exception e) {
                    }
                }
            }
        }
    }
    return null;
}
Also used : ICall(de.janrufmonitor.framework.ICall) IAttribute(de.janrufmonitor.framework.IAttribute)

Example 52 with IAttribute

use of de.janrufmonitor.framework.IAttribute in project janrufmonitor by tbrandt77.

the class BChannel method renderAsImage.

public Image renderAsImage() {
    if (this.m_o != null) {
        if (this.m_o instanceof ICall) {
            ICall call = (ICall) this.m_o;
            IAttribute att = call.getAttribute(IJAMConst.ATTRIBUTE_NAME_BCHANNEL);
            if (att != null) {
                if (att.getValue().equalsIgnoreCase(IJAMConst.ATTRIBUTE_VALUE_B1))
                    return SWTImageManager.getInstance(PIMRuntime.getInstance()).get(IJAMConst.IMAGE_KEY_B1_JPG);
                if (att.getValue().equalsIgnoreCase(IJAMConst.ATTRIBUTE_VALUE_B2))
                    return SWTImageManager.getInstance(PIMRuntime.getInstance()).get(IJAMConst.IMAGE_KEY_B2_JPG);
            }
        }
    }
    return null;
}
Also used : ICall(de.janrufmonitor.framework.ICall) IAttribute(de.janrufmonitor.framework.IAttribute)

Example 53 with IAttribute

use of de.janrufmonitor.framework.IAttribute in project janrufmonitor by tbrandt77.

the class CallDuration method getDuration.

private String getDuration(ICall call) {
    IAttribute ring = call.getAttribute(IJAMConst.ATTRIBUTE_NAME_CALL_DURATION);
    if (ring != null) {
        try {
            int duration = Integer.parseInt(ring.getValue()) / 60;
            StringBuffer sb = new StringBuffer(64);
            if ((duration / 60) > 0) {
                sb.append((duration / 60));
                sb.append(" h ");
            }
            sb.append((duration % 60));
            sb.append(" min ");
            return sb.toString();
        } catch (Exception e) {
        }
    }
    return "";
}
Also used : IAttribute(de.janrufmonitor.framework.IAttribute)

Example 54 with IAttribute

use of de.janrufmonitor.framework.IAttribute in project janrufmonitor by tbrandt77.

the class Status method renderAsImageID.

public String renderAsImageID() {
    if (this.m_o != null) {
        if (this.m_o instanceof ICall) {
            ICall call = (ICall) this.m_o;
            IAttribute att = call.getAttribute(IJAMConst.ATTRIBUTE_NAME_CALLSTATUS);
            if (att != null && att.getValue().equalsIgnoreCase(IJAMConst.ATTRIBUTE_VALUE_REJECTED)) {
                return IJAMConst.IMAGE_KEY_REJECTED_GIF;
            }
            // att = call.getAttribute(IJAMConst.ATTRIBUTE_NAME_CALLSTATUS);
            if (att != null && att.getValue().equalsIgnoreCase(IJAMConst.ATTRIBUTE_VALUE_ACCEPTED)) {
                return IJAMConst.IMAGE_KEY_ACCEPTED_GIF;
            }
            // att = call.getAttribute(IJAMConst.ATTRIBUTE_NAME_CALLSTATUS);
            if (att != null && att.getValue().equalsIgnoreCase(IJAMConst.ATTRIBUTE_VALUE_OUTGOING)) {
                return IJAMConst.IMAGE_KEY_OUTGOING_GIF;
            }
            if (att != null && att.getValue().equalsIgnoreCase(IJAMConst.ATTRIBUTE_VALUE_MISSED)) {
                return IJAMConst.IMAGE_KEY_AWAY_GIF;
            }
            /**
             *				// 2008/11/08: work-a-round for showing old status fields
             *				att = call.getAttribute(IJAMConst.ATTRIBUTE_NAME_REJECTED);
             *				if (att != null && att.getValue().equalsIgnoreCase(IJAMConst.ATTRIBUTE_VALUE_YES)) {
             *					return IJAMConst.IMAGE_KEY_REJECTED_GIF;
             *				}
             *				att = call.getAttribute(IJAMConst.ATTRIBUTE_NAME_ACCEPTED);
             *				if (att != null && att.getValue().equalsIgnoreCase(IJAMConst.ATTRIBUTE_VALUE_YES)) {
             *					return IJAMConst.IMAGE_KEY_ACCEPTED_GIF;
             *				}
             *				att = call.getAttribute(IJAMConst.ATTRIBUTE_NAME_OUTGOING);
             *				if (att != null && att.getValue().equalsIgnoreCase(IJAMConst.ATTRIBUTE_VALUE_YES)) {
             *					return IJAMConst.IMAGE_KEY_OUTGOING_GIF;
             *				}
             */
            return IJAMConst.IMAGE_KEY_AWAY_GIF;
        }
    }
    return "";
}
Also used : ICall(de.janrufmonitor.framework.ICall) IAttribute(de.janrufmonitor.framework.IAttribute)

Example 55 with IAttribute

use of de.janrufmonitor.framework.IAttribute in project janrufmonitor by tbrandt77.

the class ImageHandler method getImagePath.

public String getImagePath(ICaller caller) {
    IImageProvider provider = null;
    String imagePath = null;
    IAttribute cm_att = caller.getAttribute(IJAMConst.ATTRIBUTE_NAME_CALLERMANAGER);
    if (cm_att != null && cm_att.getValue().length() > 0) {
        provider = (IImageProvider) this.m_providers.get(cm_att.getValue());
        if (provider != null) {
            if (this.m_logger.isLoggable(Level.INFO))
                this.m_logger.info("Using IImageProvider <" + provider.getID() + "> for getting image path.");
            imagePath = provider.getImagePath(caller);
            boolean isForceImage = Boolean.parseBoolean(System.getProperty(IJAMConst.SYSTEM_UI_FORCEIMAGE, "false"));
            if (isForceImage) {
                if (imagePath != null && imagePath.length() > 0)
                    return imagePath;
            } else {
                return ((imagePath != null && imagePath.length() > 0) ? imagePath : "");
            }
        }
    }
    return getImagePathDefault(caller);
}
Also used : IImageProvider(de.janrufmonitor.util.io.IImageProvider) IAttribute(de.janrufmonitor.framework.IAttribute)

Aggregations

IAttribute (de.janrufmonitor.framework.IAttribute)111 ICaller (de.janrufmonitor.framework.ICaller)44 IAttributeMap (de.janrufmonitor.framework.IAttributeMap)40 IPhonenumber (de.janrufmonitor.framework.IPhonenumber)39 List (java.util.List)34 ICallerList (de.janrufmonitor.framework.ICallerList)31 ArrayList (java.util.ArrayList)29 Iterator (java.util.Iterator)25 ICall (de.janrufmonitor.framework.ICall)19 IMultiPhoneCaller (de.janrufmonitor.framework.IMultiPhoneCaller)15 SQLException (java.sql.SQLException)15 File (java.io.File)14 AttributeFilter (de.janrufmonitor.repository.filter.AttributeFilter)12 IOException (java.io.IOException)12 Message (de.janrufmonitor.exception.Message)11 ComFailException (com.jacob.com.ComFailException)10 Date (java.util.Date)10 IMsn (de.janrufmonitor.framework.IMsn)9 Dispatch (com.jacob.com.Dispatch)8 UUID (de.janrufmonitor.util.uuid.UUID)8