Package uk.gov.nationalarchives.droid.profile.referencedata

Examples of uk.gov.nationalarchives.droid.profile.referencedata.Format


            node.setZeroIdentifications();
        } else {
            for (IdentificationResult result : results.getResults()) {
                node.getMetaData().setIdentificationMethod(result.getMethod());
                //log.debug(String.format("Handling ID puid[%s]; uri[%s]", result.getPuid(), results.getUri()));
                Format format = resultHandlerDao.loadFormat(result.getPuid());
                node.addFormatIdentification(format);
            }
        }
       
        progressMonitor.stopJob(node);
View Full Code Here


            node.setZeroIdentifications();
        } else {
            for (IdentificationResult result : results.getResults()) {
                node.getMetaData().setIdentificationMethod(result.getMethod());
                //log.debug(String.format("Handling ID puid[%s]; uri[%s]", result.getPuid(), results.getUri()));
                Format format = loadFormat(result.getPuid());
                node.addFormatIdentification(format);
            }
        }
        progressMonitor.stopJob(node);
        batchNode(node);
View Full Code Here

        @Override
        public void startElement(String uri, String localName, String qName,
                Attributes attributes) {

            if ("FileFormat".equals(qName)) {
                Format format = new Format();
                format.setPuid(notNull(attributes.getValue("PUID")));
                format.setName(notNull(attributes.getValue("Name")));
                format.setMimeType(notNull(attributes.getValue("MIMEType")));
                format.setVersion(notNull(attributes.getValue("Version")));
                callback.onFormat(format);
            }
        }
View Full Code Here

    @Test
    public void testWriteOneNode() {
        when(config.getBooleanProperty(DroidGlobalProperty.CSV_EXPORT_ROW_PER_FORMAT)).thenReturn(false);
       
        List<ProfileResourceNode> nodes = new ArrayList<ProfileResourceNode>();
        Format id = buildFormat(1);
        ProfileResourceNode node = buildProfileResourceNode(1, 1001L);
        node.addFormatIdentification(id);
        nodes.add(node);
        itemWriter.setOptions(ExportOptions.ONE_ROW_PER_FORMAT);
        itemWriter.write(nodes);
View Full Code Here

    public void testWriteNodeWithNullFormat() {
        when(config.getBooleanProperty(DroidGlobalProperty.CSV_EXPORT_ROW_PER_FORMAT)).thenReturn(false);
       
        List<ProfileResourceNode> nodes = new ArrayList<ProfileResourceNode>();
       
        Format id = Format.NULL;
        ProfileResourceNode node = buildProfileResourceNode(1, 1001L);
        node.addFormatIdentification(id);
       
        nodes.add(node);
        itemWriter.setOptions(ExportOptions.ONE_ROW_PER_FORMAT);
View Full Code Here

    public void testWriteOneNodeWithNullSize() {
        when(config.getBooleanProperty(DroidGlobalProperty.CSV_EXPORT_ROW_PER_FORMAT)).thenReturn(false);
       
        List<ProfileResourceNode> nodes = new ArrayList<ProfileResourceNode>();
       
        Format id = buildFormat(1);
        ProfileResourceNode node = buildProfileResourceNode(1, null);
        node.addFormatIdentification(id);
       
        nodes.add(node);
        itemWriter.write(nodes);
View Full Code Here

    public void testWriteOneNodeWithTwoFormatsWithOneRowPerFile() {
        when(config.getBooleanProperty(DroidGlobalProperty.CSV_EXPORT_ROW_PER_FORMAT)).thenReturn(false);
       
        List<ProfileResourceNode> nodes = new ArrayList<ProfileResourceNode>();
       
        Format id1 = buildFormat(1);
        Format id2 = buildFormat(2);
       
        ProfileResourceNode node = buildProfileResourceNode(1, 1000L);
        node.addFormatIdentification(id1);
        node.addFormatIdentification(id2);
View Full Code Here

    public void testWriteOneNodeWithTwoFormatsWithOneRowPerFormat() {
        when(config.getBooleanProperty(DroidGlobalProperty.CSV_EXPORT_ROW_PER_FORMAT)).thenReturn(true);
       
        List<ProfileResourceNode> nodes = new ArrayList<ProfileResourceNode>();
       
        Format id1 = buildFormat(1);
        Format id2 = buildFormat(2);
       
        ProfileResourceNode node = buildProfileResourceNode(1, 1000L);
        node.addFormatIdentification(id1);
        node.addFormatIdentification(id2);
View Full Code Here

        List<ProfileResourceNode> nodes = new ArrayList<ProfileResourceNode>();
       
        for (int i = 1; i <= 10; i++) {
            ProfileResourceNode node = buildProfileResourceNode(i, (long) i);
            Format id = buildFormat(i);
            node.addFormatIdentification(id);
            nodes.add(node);
        }
       
        itemWriter.write(nodes);
View Full Code Here

        return node;
    }
   
   
    private static Format buildFormat(int i) {
        Format format = new Format();
        format.setPuid("fmt/" + i);
        format.setMimeType("text/plain");
        format.setName("Plain Text");
        format.setVersion("1.0");
       
        return format;
    }
View Full Code Here

TOP

Related Classes of uk.gov.nationalarchives.droid.profile.referencedata.Format

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.