/** * Update the metadata field in the database. * * @param context dspace context * @throws SQLException * @throws AuthorizeException * @throws NonUniqueMetadataException * @throws IOException */ public void update(Context context) throws SQLException, AuthorizeException, NonUniqueMetadataException, IOException { // Check authorisation: Only admins may update the metadata registry if (!AuthorizeManager.isAdmin(context)) { throw new AuthorizeException("Only administrators may modiffy the Dublin Core registry"); } // Check to see if the schema ID was altered. If is was then we will // query to ensure that there is not already a duplicate name field. if (row.getIntColumn("metadata_schema_id") != schemaID) { if (MetadataField.hasElement(context, schemaID, element, qualifier)) { throw new NonUniqueMetadataException("Duplcate field name found in target schema"); } } // Ensure the element and qualifier are unique within a given schema. if (!unique(context, schemaID, element, qualifier)) { throw new NonUniqueMetadataException("Please make " + element + "." + qualifier); } row.setColumn("metadata_schema_id", schemaID); row.setColumn("element", element); row.setColumn("qualifier", qualifier); row.setColumn("scope_note", scopeNote); DatabaseManager.update(context, row); decache(); log.info( LogManager.getHeader( context, "update_metadatafieldregistry", "metadata_field_id=" + getFieldID() + "element=" + getElement() + "qualifier=" + getQualifier())); }