private static void decorateContentNode( final DocumentReader docReader, final DocumentWriter docWriter) { if (!docReader.getMixinTypeNames().contains(FEDORA_BINARY)) { LOGGER.trace("Adding mixin: {}, to {}", FEDORA_BINARY, docReader.getDocumentId()); docWriter.addMixinType(FEDORA_BINARY); } if (null == docReader.getProperty(CONTENT_DIGEST)) { final BinaryValue binaryValue = getBinaryValue(docReader); final String dsChecksum = binaryValue.getHexHash(); final String dsURI = asURI("SHA-1", dsChecksum).toString(); LOGGER.trace( "Adding {} property of {} to {}", CONTENT_DIGEST, dsURI, docReader.getDocumentId()); docWriter.addProperty(CONTENT_DIGEST, dsURI); } if (null == docReader.getProperty(CONTENT_SIZE)) { final BinaryValue binaryValue = getBinaryValue(docReader); final long binarySize = binaryValue.getSize(); LOGGER.trace( "Adding {} property of {} to {}", CONTENT_SIZE, binarySize, docReader.getDocumentId()); docWriter.addProperty(CONTENT_SIZE, binarySize); } LOGGER.debug("Decorated data property at path: {}", docReader.getDocumentId()); }
private void saveProperties(final DocumentReader docReader) { LOGGER.trace("Persisting properties for {}", docReader.getDocumentId()); final Map<Name, Property> properties = docReader.getProperties(); final ExtraProperties extraProperties = extraPropertiesFor(docReader.getDocumentId(), true); extraProperties .addAll(properties) .except(JCR_PRIMARY_TYPE, JCR_CREATED, JCR_LASTMODIFIED, JCR_DATA); extraProperties.save(); }
private static void decorateDatastreamNode( final DocumentReader docReader, final DocumentWriter docWriter) { if (!docReader.getMixinTypeNames().contains(FEDORA_DATASTREAM)) { LOGGER.trace("Adding mixin: {}, to {}", FEDORA_DATASTREAM, docReader.getDocumentId()); docWriter.addMixinType(FEDORA_DATASTREAM); } }