Package gr.ekt.bte.core

Examples of gr.ekt.bte.core.RecordSet


     */
    @Override
    public RecordSet getRecords() throws MalformedSourceException
    {

        RecordSet recordSet = new RecordSet();

        try
        {
            InputStream inputStream = new FileInputStream(new File(filename));

            DocumentBuilderFactory factory = DocumentBuilderFactory
                    .newInstance();
            factory.setValidating(false);
            factory.setIgnoringComments(true);
            factory.setIgnoringElementContentWhitespace(true);

            DocumentBuilder db = factory.newDocumentBuilder();
            Document inDoc = db.parse(inputStream);

            Element xmlRoot = inDoc.getDocumentElement();

            // There is no element to represent an record, so we can not process
            // multi records at once.
            Record record = CiNiiUtils.convertCiNiiDomToRecord(xmlRoot);
            if (record != null)
            {
                recordSet.addRecord(convertFields(record));
            }
        }
        catch (FileNotFoundException e)
        {
            log.error(e.getMessage(), e);
View Full Code Here


    public RecordSet getRecords(DataLoadingSpec spec)
            throws MalformedSourceException
    {
        if (spec.getOffset() > 0)
        {
            return new RecordSet();
        }

        return getRecords();
    }
View Full Code Here

     */
    @Override
    public RecordSet getRecords() throws MalformedSourceException
    {

        RecordSet recordSet = new RecordSet();

        try
        {
            InputStream inputStream = new FileInputStream(new File(filename));

            DocumentBuilderFactory factory = DocumentBuilderFactory
                    .newInstance();
            factory.setValidating(false);
            factory.setIgnoringComments(true);
            factory.setIgnoringElementContentWhitespace(true);

            DocumentBuilder builder = factory.newDocumentBuilder();
            Document inDoc = builder.parse(inputStream);

            Element xmlRoot = inDoc.getDocumentElement();
            List<Element> pubArticles = XMLUtils.getElementList(xmlRoot,
                    "PubmedArticle");

            for (Element xmlArticle : pubArticles)
            {
                Record record = null;
                try
                {
                    record = PubmedUtils.convertPubmedDomToRecord(xmlArticle);
                    recordSet.addRecord(convertFields(record));
                }
                catch (Exception e)
                {
                    throw new RuntimeException(e.getMessage(), e);
                }
View Full Code Here

    public RecordSet getRecords(DataLoadingSpec spec)
            throws MalformedSourceException
    {
        if (spec.getOffset() > 0)
        {
            return new RecordSet();
        }
        return getRecords();
    }
View Full Code Here

     */
    @Override
    public RecordSet getRecords() throws MalformedSourceException
    {

        RecordSet recordSet = new RecordSet();

        // KSTA:ToDo: Support timeout (problematic) providers
        // List<String> timeoutProviders = new ArrayList<String>();
        for (String providerName : filterProviders().keySet())
        {
            DataLoader provider = dataloadersMap.get(providerName);
            RecordSet subRecordSet = provider.getRecords();
            recordSet.addAll(subRecordSet);
            // Add in each record the provider name... a new provider doesn't
            // need to know about it!
            for (Record record : subRecordSet.getRecords())
            {
                if (record.isMutable())
                {
                    record.makeMutable().addValue(
                            SubmissionLookupService.PROVIDER_NAME_FIELD,
View Full Code Here

    public RecordSet getRecords(DataLoadingSpec loadingSpec)
            throws MalformedSourceException
    {

        if (loadingSpec.getOffset() > 0) // Identify the end of loading
            return new RecordSet();

        return getRecords();
    }
View Full Code Here

    {
        if (dtoList == null)
        {
            throw new MalformedSourceException("dtoList not initialized");
        }
        RecordSet ret = new RecordSet();

        for (ItemSubmissionLookupDTO dto : dtoList)
        {
            Record rec = dto.getTotalPublication(providers);
            ret.addRecord(rec);
        }

        log.info("BTE DataLoader finished. Items loaded: "
                + ret.getRecords().size());

        // Printing debug message
        String totalString = "";
        for (Record record : ret.getRecords())
        {
            totalString += SubmissionLookupUtils.getPrintableString(record)
                    + "\n";
        }
        log.debug("Records loaded:\n" + totalString);
View Full Code Here

    public RecordSet getRecords(DataLoadingSpec spec)
            throws MalformedSourceException
    {
        if (spec.getOffset() > 0)
        {
            return new RecordSet();
        }

        return getRecords();
    }
View Full Code Here

    // BTE Data Loader interface methods
    @Override
    public RecordSet getRecords() throws MalformedSourceException
    {

        RecordSet recordSet = new RecordSet();

        List<Record> results = null;

        try
        {
            if (getIdentifiers() != null)
            { // Search by identifiers
                results = getByIdentifier(null, getIdentifiers());
            }
            else
            {
                String title = getSearchTerms().get("title") != null ? getSearchTerms()
                        .get("title").iterator().next()
                        : null;
                String authors = getSearchTerms().get("authors") != null ? getSearchTerms()
                        .get("authors").iterator().next()
                        : null;
                String year = getSearchTerms().get("year") != null ? getSearchTerms()
                        .get("year").iterator().next()
                        : null;
                int yearInt = Integer.parseInt(year);
                results = search(null, title, authors, yearInt);
            }
        }
        catch (HttpException e)
        {
            e.printStackTrace();
        }
        catch (IOException e)
        {
            e.printStackTrace();
        }

        if (results != null)
        {
            for (Record record : results)
            {
                recordSet.addRecord(record);
            }
        }

        return recordSet;
    }
View Full Code Here

     */
    @Override
    public RecordSet getRecords() throws MalformedSourceException
    {

        RecordSet recordSet = new RecordSet();

        try
        {
            InputStream inputStream = new FileInputStream(new File(filename));

            DocumentBuilderFactory factory = DocumentBuilderFactory
                    .newInstance();
            factory.setValidating(false);
            factory.setIgnoringComments(true);
            factory.setIgnoringElementContentWhitespace(true);

            DocumentBuilder db = factory.newDocumentBuilder();
            Document inDoc = db.parse(inputStream);

            Element xmlRoot = inDoc.getDocumentElement();
            List<Element> dataRoots = XMLUtils.getElementList(xmlRoot, "entry");

            for (Element dataRoot : dataRoots)
            {
                Record record = ArxivUtils.convertArxixDomToRecord(dataRoot);
                if (record != null)
                {
                    recordSet.addRecord(convertFields(record));
                }
            }
        }
        catch (FileNotFoundException e)
        {
View Full Code Here

TOP

Related Classes of gr.ekt.bte.core.RecordSet

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.