Search in sources :

Example 1 with FSDISOMsg

use of org.jpos.iso.FSDISOMsg in project jPOS by jpos.

the class FSDProtectedLogListener method log.

public synchronized LogEvent log(LogEvent ev) {
    synchronized (ev.getPayLoad()) {
        final List<Object> payLoad = ev.getPayLoad();
        int size = payLoad.size();
        for (int i = 0; i < size; i++) {
            Object obj = payLoad.get(i);
            if (obj instanceof FSDISOMsg) {
                FSDISOMsg m = (FSDISOMsg) ((FSDISOMsg) obj).clone();
                try {
                    checkTruncated(m);
                    checkProtected(m);
                    checkHidden(m);
                } catch (ISOException e) {
                    ev.addMessage(e);
                }
                payLoad.set(i, m);
            }
        }
    }
    return ev;
}
Also used : ISOException(org.jpos.iso.ISOException) FSDISOMsg(org.jpos.iso.FSDISOMsg)

Example 2 with FSDISOMsg

use of org.jpos.iso.FSDISOMsg in project jPOS by jpos.

the class FSDMsgTestCase method testFSDISOMsgClone.

public void testFSDISOMsgClone() throws Exception {
    FSDMsg m0 = new FSDMsg(SCHEMA_DIR_URL + "msgDS-");
    m0.set("alphavardata", "ABCDE");
    FSDISOMsg iso0 = new FSDISOMsg(m0);
    FSDISOMsg iso1 = (FSDISOMsg) iso0.clone();
    FSDMsg m1 = iso1.getFSDMsg();
    m1.set("alphavardata", "12345");
    assertEquals("Original alphavardata", "ABCDE", m0.get("alphavardata"));
    assertEquals("Cloned alphavardata", "12345", m1.get("alphavardata"));
}
Also used : FSDISOMsg(org.jpos.iso.FSDISOMsg)

Example 3 with FSDISOMsg

use of org.jpos.iso.FSDISOMsg in project jPOS by jpos.

the class FSDChannel method createMsg.

@Override
public ISOMsg createMsg() {
    FSDMsg fsdmsg = new FSDMsg(schema);
    fsdmsg.setCharset(charset);
    return new FSDISOMsg(fsdmsg);
}
Also used : FSDISOMsg(org.jpos.iso.FSDISOMsg) FSDMsg(org.jpos.util.FSDMsg)

Example 4 with FSDISOMsg

use of org.jpos.iso.FSDISOMsg in project jPOS by jpos.

the class FSDMsgTestCase method testFSDISOMsgPartialCloneAndMerge.

public void testFSDISOMsgPartialCloneAndMerge() throws Exception {
    FSDMsg m0 = new FSDMsg(SCHEMA_DIR_URL + "msgiso-");
    m0.set("0", "0800");
    m0.set("11", "000001");
    m0.set("41", "29110001");
    m0.set("70", "301");
    FSDISOMsg iso0 = new FSDISOMsg(m0);
    FSDISOMsg iso1 = (FSDISOMsg) iso0.clone(new int[] { 0, 11, 70 });
    FSDMsg m1 = iso1.getFSDMsg();
    assertEquals("m0.0", "0800", m0.get("0"));
    assertEquals("m1.0", "0800", m1.get("0"));
    m1.set("0", "0810");
    assertEquals("m0.0", "0800", m0.get("0"));
    assertEquals("m1.0", "0810", m1.get("0"));
    assertNull("m1.41 should be null", m1.get("41"));
    iso1.merge(iso0);
    assertEquals("m1.41", "29110001", m1.get("41"));
}
Also used : FSDISOMsg(org.jpos.iso.FSDISOMsg)

Example 5 with FSDISOMsg

use of org.jpos.iso.FSDISOMsg in project jPOS by jpos.

the class FSDChannel method send.

@Override
public void send(ISOMsg m) throws IOException, ISOException {
    if (m instanceof FSDISOMsg) {
        FSDMsg fsd = ((FSDISOMsg) m).getFSDMsg();
        fsd.setCharset(charset);
    }
    super.send(m);
}
Also used : FSDISOMsg(org.jpos.iso.FSDISOMsg) FSDMsg(org.jpos.util.FSDMsg)

Aggregations

FSDISOMsg (org.jpos.iso.FSDISOMsg)5 FSDMsg (org.jpos.util.FSDMsg)2 ISOException (org.jpos.iso.ISOException)1