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;
009
010import org.fcrepo.config.ServerManagedPropsMode;
011import org.fcrepo.kernel.api.Transaction;
012import org.fcrepo.kernel.api.identifiers.FedoraId;
013import org.fcrepo.kernel.api.operations.RdfSourceOperation;
014
015/**
016 * Builder for operations to update rdf sources
017 *
018 * @author bbpennel
019 * @since 11/2019
020 */
021public class UpdateRdfSourceOperationBuilder extends AbstractRdfSourceOperationBuilder {
022
023    /**
024     * Constructor.
025     *
026     * @param transaction the transaction/
027     * @param resourceId the internal identifier.
028     * @param serverManagedPropsMode server managed properties mode
029     */
030    public UpdateRdfSourceOperationBuilder(final Transaction transaction, final FedoraId resourceId,
031                                           final ServerManagedPropsMode serverManagedPropsMode) {
032        super(transaction, resourceId, null, serverManagedPropsMode);
033    }
034
035    @Override
036    public RdfSourceOperation build() {
037        final var operation = new UpdateRdfSourceOperation(this.transaction, this.rescId, this.tripleStream);
038        operation.setUserPrincipal(userPrincipal);
039        operation.setCreatedBy(createdBy);
040        operation.setCreatedDate(createdDate);
041        operation.setLastModifiedBy(lastModifiedBy);
042        operation.setLastModifiedDate(lastModifiedDate);
043        return operation;
044    }
045
046    @Override
047    public UpdateRdfSourceOperationBuilder relaxedProperties(final Model model) {
048        super.relaxedProperties(model);
049        return this;
050    }
051}