@@ -0,0 +1,1698 @@
+package org.datacite.mds.tools;%0A%0Aimport java.util.List;%0Aimport java.util.Set;%0A%0Aimport javax.persistence.EntityManager;%0Aimport javax.persistence.PersistenceContext;%0Aimport javax.validation.Validator;%0A%0Aimport org.datacite.mds.domain.Dataset;%0Aimport org.datacite.mds.domain.Metadata;%0Aimport org.datacite.mds.service.SchemaService;%0Aimport org.datacite.mds.util.ValidationUtils;%0Aimport org.springframework.beans.factory.annotation.Autowired;%0Aimport org.springframework.stereotype.Component;%0Aimport org.springframework.transaction.annotation.Transactional;%0A%0A@Component%0Apublic class MetadataChecker extends AbstractTool %7B%0A%0A    @PersistenceContext%0A    EntityManager entityManager;%0A    %0A    @Autowired%0A    SchemaService schemaService;%0A    %0A    @Autowired%0A    Validator validator;%0A    %0A    @Override%0A    @Transactional%0A    public void run(String%5B%5D args) %7B%0A        List%3CDataset%3E datasets = Dataset.findAllDatasets();%0A        for (Dataset dataset : datasets) %7B%0A            Metadata metadata = Metadata.findLatestMetadatasByDataset(dataset);%0A            checkMetadata(metadata);%0A        %7D%0A    %7D%0A    %0A    private void checkMetadata(Metadata metadata) %7B%0A        if (metadata == null) %0A            return;%0A        %0A        String doi = metadata.getDataset().getDoi();%0A        byte%5B%5D xml = metadata.getXml();%0A%0A        String schemaLocation = schemaService.getSchemaLocation(xml);%0A        Set violations = validator.validate(metadata);%0A        %0A        String violationMsg = ValidationUtils.collateViolationMessages(violations);%0A        System.out.println(doi + %22%5Ct%22 + schemaLocation + %22%5Ct%22 + violationMsg);%0A    %7D%0A    %0A    public static void main(String%5B%5D args) throws Exception %7B%0A        initAndRun(args);%0A    %7D%0A%0A%7D%0A

add tool to check all metadata