001/* 002 * The contents of this file are subject to the license and copyright 003 * detailed in the LICENSE and NOTICE files at the root of the source 004 * tree. 005 */ 006package org.fcrepo.kernel.impl.operations; 007 008import org.apache.jena.rdf.model.Model; 009import org.fcrepo.config.ServerManagedPropsMode; 010import org.fcrepo.kernel.api.Transaction; 011import org.fcrepo.kernel.api.identifiers.FedoraId; 012import org.fcrepo.kernel.api.operations.UpdateNonRdfSourceHeadersOperation; 013import org.fcrepo.kernel.api.operations.UpdateNonRdfSourceHeadersOperationBuilder; 014 015import java.net.URI; 016import java.util.Collection; 017 018/** 019 * Builder for an operation for updating headers of non-rdf sources 020 * 021 * @author mikejritter 022 * @author bbpennel 023 */ 024public class UpdateNonRdfSourceHeadersOperationBuilderImpl extends AbstractRelaxableResourceOperationBuilder 025 implements UpdateNonRdfSourceHeadersOperationBuilder { 026 027 private String mimeType; 028 029 private String filename; 030 031 /** 032 * Constructor 033 * 034 * @param transaction the transaction 035 * @param resourceId the fedora identifier 036 * @param serverManagedPropsMode server managed properties mode 037 */ 038 public UpdateNonRdfSourceHeadersOperationBuilderImpl(final Transaction transaction, 039 final FedoraId resourceId, 040 final ServerManagedPropsMode serverManagedPropsMode) { 041 super(transaction, resourceId, serverManagedPropsMode); 042 } 043 044 @Override 045 public UpdateNonRdfSourceHeadersOperationBuilder mimeType(final String mimetype) { 046 this.mimeType = mimetype; 047 return this; 048 } 049 050 @Override 051 public UpdateNonRdfSourceHeadersOperationBuilder filename(final String filename) { 052 this.filename = filename; 053 return this; 054 } 055 056 @Override 057 public UpdateNonRdfSourceHeadersOperationBuilder contentDigests(final Collection<URI> digests) { 058 throw new UnsupportedOperationException("Not supported for update header operations"); 059 } 060 061 @Override 062 public UpdateNonRdfSourceHeadersOperationBuilder contentSize(final long size) { 063 throw new UnsupportedOperationException("Not supported for update header operations"); 064 } 065 066 @Override 067 public UpdateNonRdfSourceHeadersOperationBuilder userPrincipal(final String userPrincipal) { 068 super.userPrincipal(userPrincipal); 069 return this; 070 } 071 072 @Override 073 public UpdateNonRdfSourceHeadersOperationBuilder relaxedProperties(final Model model) { 074 super.relaxedProperties(model); 075 return this; 076 } 077 078 @Override 079 public UpdateNonRdfSourceHeadersOperation build() { 080 final var operation = new UpdateNonRdfSourceHeadersOperationImpl(transaction, rescId.asBaseId()); 081 operation.setUserPrincipal(userPrincipal); 082 operation.setCreatedBy(createdBy); 083 operation.setCreatedDate(createdDate); 084 operation.setLastModifiedBy(lastModifiedBy); 085 operation.setLastModifiedDate(lastModifiedDate); 086 operation.setFilename(filename); 087 operation.setMimeType(mimeType); 088 return operation; 089 } 090}