Package org.dspace.app.bulkedit

Examples of org.dspace.app.bulkedit.MetadataImportInvalidHeadingException


                    // Verify that the heading is valid in the metadata registry
                    String[] clean = element.split("\\[");
                    String[] parts = clean[0].split("\\.");

                    if (parts.length < 2) {
                        throw new MetadataImportInvalidHeadingException(element,
                                                                        MetadataImportInvalidHeadingException.ENTRY,
                                                                        columnCounter);
                    }

                    String metadataSchema = parts[0];
                    String metadataElement = parts[1];
                    String metadataQualifier = null;
                    if (parts.length > 2) {
                        metadataQualifier = parts[2];
                    }

                    // Check that the scheme exists
                    MetadataSchema foundSchema = MetadataSchema.find(c, metadataSchema);
                    if (foundSchema == null) {
                        throw new MetadataImportInvalidHeadingException(clean[0],
                                                                        MetadataImportInvalidHeadingException.SCHEMA,
                                                                        columnCounter);
                    }

                    // Check that the metadata element exists in the schema
                    int schemaID = foundSchema.getSchemaID();
                    MetadataField foundField = MetadataField.findByElement(c, schemaID, metadataElement, metadataQualifier);
                    if (foundField == null) {
                        throw new MetadataImportInvalidHeadingException(clean[0],
                                                                        MetadataImportInvalidHeadingException.ELEMENT,
                                                                        columnCounter);
                    }

                    // Store the heading
View Full Code Here


                    part = "";
                }

                // Make sure we register that this column was there
                if (headings.size() < i) {
                    throw new MetadataImportInvalidHeadingException("",
                                                                    MetadataImportInvalidHeadingException.MISSING,
                                                                    i + 1);
                }
                csvLine.add(headings.get(i - 1), null);
                String[] elements = part.split(escapedValueSeparator);
View Full Code Here

TOP

Related Classes of org.dspace.app.bulkedit.MetadataImportInvalidHeadingException

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.