package za.co.adminonline.dmi;

import com.isomorphic.datasource.DSRequest;
import com.isomorphic.datasource.DSResponse;
import com.isomorphic.rpc.RPCManager;

import java.util.HashMap;
import java.util.Map;

/**
 * Example DMI class to use as an example
 */
public class TemplateDBQueueDMI extends BaseDMI {

    public DSResponse add(DSRequest dsRequest) throws Exception {

        if (dsRequest.getDataSourceName().equals("t1_db_queue")) {

            String c2 = (String)dsRequest.getFieldValue("c2");

            if (c2.contains("3")) {
                throw new Exception("This is an error message");
            }

            DSResponse dsResponse = dsRequest.execute();

            return dsResponse;
        }
        return null;
    }

}
