Search in sources :

Example 1 with SubstanceStudyDetailsProcessor

use of ambit2.db.substance.study.SubstanceStudyDetailsProcessor in project ambit-mirror by ideaconsult.

the class SubstanceExportResource method createJSONReporter.

@Override
protected IProcessor<Q, Representation> createJSONReporter(String filenamePrefix) {
    String jsonpcallback = getParams().getFirstValue("jsonp");
    if (jsonpcallback == null)
        jsonpcallback = getParams().getFirstValue("callback");
    String command = "results";
    try {
        if (Boolean.parseBoolean(getParams().getFirstValue("array").toString()))
            command = null;
    } catch (Exception x) {
    }
    ProcessorsChain chain = new ProcessorsChain<>();
    chain.add(new SubstanceStudyDetailsProcessor());
    getCompositionProcessors(chain);
    SubstanceRecordAnnotationProcessor annotator = null;
    try {
        annotator = new SubstanceRecordAnnotationProcessor(new File(((AmbitFreeMarkerApplication) getApplication()).getProperties().getMapFolder()), false);
    } catch (Exception x) {
        Logger.getGlobal().log(Level.WARNING, x.getMessage());
        annotator = null;
    }
    return new OutputWriterConvertor<SubstanceRecord, Q>((QueryAbstractReporter<SubstanceRecord, Q, Writer>) new Substance2BucketJsonReporter(command, chain, jsonmode, summaryMeasurement, dbTag, annotator), jsonpcallback == null ? MediaType.APPLICATION_JSON : MediaType.APPLICATION_JAVASCRIPT, filenamePrefix);
}
Also used : ProcessorsChain(net.idea.modbcum.i.processors.ProcessorsChain) OutputWriterConvertor(net.idea.restnet.db.convertors.OutputWriterConvertor) SubstanceStudyDetailsProcessor(ambit2.db.substance.study.SubstanceStudyDetailsProcessor) SubstanceRecordAnnotationProcessor(ambit2.base.ro.SubstanceRecordAnnotationProcessor) SubstanceRecord(ambit2.base.data.SubstanceRecord) AmbitFreeMarkerApplication(ambit2.rest.AmbitFreeMarkerApplication) File(java.io.File) AmbitException(net.idea.modbcum.i.exceptions.AmbitException) ResourceException(org.restlet.resource.ResourceException) Writer(java.io.Writer)

Example 2 with SubstanceStudyDetailsProcessor

use of ambit2.db.substance.study.SubstanceStudyDetailsProcessor in project ambit-mirror by ideaconsult.

the class SubstanceRDFReporter method init.

/*
	 * public SubstanceRDFReporter(String base, MediaType mediaType) {
	 * super(null, mediaType, null); this.base = base; init(); }
	 */
protected void init() {
    SubstanceStudyDetailsProcessor paReader = new SubstanceStudyDetailsProcessor();
    getProcessors().clear();
    getProcessors().add(paReader);
    getProcessors().add(new DefaultAmbitProcessor<SubstanceRecord, SubstanceRecord>() {

        @Override
        public SubstanceRecord process(SubstanceRecord target) throws Exception {
            processItem(target);
            return target;
        }
    });
}
Also used : SubstanceStudyDetailsProcessor(ambit2.db.substance.study.SubstanceStudyDetailsProcessor) SubstanceRecord(ambit2.base.data.SubstanceRecord)

Example 3 with SubstanceStudyDetailsProcessor

use of ambit2.db.substance.study.SubstanceStudyDetailsProcessor in project ambit-mirror by ideaconsult.

the class SubstanceBundleStAXReporter method initProcessors.

protected void initProcessors() {
    SubstanceStudyDetailsProcessor paReader = new SubstanceStudyDetailsProcessor();
    getProcessors().clear();
    getProcessors().add(paReader);
    getProcessors().add(new DefaultAmbitProcessor<SubstanceRecord, SubstanceRecord>() {

        @Override
        public SubstanceRecord process(SubstanceRecord target) throws Exception {
            processItem(target);
            return target;
        }
    });
}
Also used : SubstanceStudyDetailsProcessor(ambit2.db.substance.study.SubstanceStudyDetailsProcessor) SubstanceRecord(ambit2.base.data.SubstanceRecord)

Aggregations

SubstanceRecord (ambit2.base.data.SubstanceRecord)3 SubstanceStudyDetailsProcessor (ambit2.db.substance.study.SubstanceStudyDetailsProcessor)3 SubstanceRecordAnnotationProcessor (ambit2.base.ro.SubstanceRecordAnnotationProcessor)1 AmbitFreeMarkerApplication (ambit2.rest.AmbitFreeMarkerApplication)1 File (java.io.File)1 Writer (java.io.Writer)1 AmbitException (net.idea.modbcum.i.exceptions.AmbitException)1 ProcessorsChain (net.idea.modbcum.i.processors.ProcessorsChain)1 OutputWriterConvertor (net.idea.restnet.db.convertors.OutputWriterConvertor)1 ResourceException (org.restlet.resource.ResourceException)1