001/*
002 * Licensed to DuraSpace under one or more contributor license agreements.
003 * See the NOTICE file distributed with this work for additional information
004 * regarding copyright ownership.
005 *
006 * DuraSpace licenses this file to you under the Apache License,
007 * Version 2.0 (the "License"); you may not use this file except in
008 * compliance with the License.  You may obtain a copy of the License at
009 *
010 *     http://www.apache.org/licenses/LICENSE-2.0
011 *
012 * Unless required by applicable law or agreed to in writing, software
013 * distributed under the License is distributed on an "AS IS" BASIS,
014 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
015 * See the License for the specific language governing permissions and
016 * limitations under the License.
017 */
018package org.fcrepo.kernel.impl.operations;
019
020import org.apache.jena.rdf.model.Model;
021import org.fcrepo.kernel.api.RdfStream;
022import org.fcrepo.kernel.api.identifiers.FedoraId;
023import org.fcrepo.kernel.api.operations.CreateRdfSourceOperation;
024import org.fcrepo.kernel.api.operations.CreateRdfSourceOperationBuilder;
025
026/**
027 * Builder for operations to create rdf sources
028 *
029 * @author bbpennel
030 */
031public class CreateRdfSourceOperationBuilderImpl extends AbstractRdfSourceOperationBuilder implements
032        CreateRdfSourceOperationBuilder {
033
034    private FedoraId parentId;
035
036    private boolean archivalGroup = false;
037    /**
038     * Constructor.
039     *
040     * @param resourceId the internal identifier.
041     * @param interactionModel interaction model
042     */
043    public CreateRdfSourceOperationBuilderImpl(final FedoraId resourceId, final String interactionModel) {
044        super(resourceId, interactionModel);
045    }
046
047    @Override
048    public CreateRdfSourceOperation build() {
049        final var operation = new CreateRdfSourceOperationImpl(resourceId, interactionModel, tripleStream);
050        operation.setParentId(parentId);
051        operation.setUserPrincipal(userPrincipal);
052        operation.setCreatedBy(createdBy);
053        operation.setCreatedDate(createdDate);
054        operation.setLastModifiedBy(lastModifiedBy);
055        operation.setLastModifiedDate(lastModifiedDate);
056        operation.setArchivalGroup(archivalGroup);
057        return operation;
058    }
059
060    @Override
061    public CreateRdfSourceOperationBuilder userPrincipal(final String userPrincipal) {
062        super.userPrincipal(userPrincipal);
063        return this;
064    }
065
066    @Override
067    public CreateRdfSourceOperationBuilder triples(final RdfStream triples) {
068        super.triples(triples);
069        return this;
070    }
071
072    @Override
073    public CreateRdfSourceOperationBuilder parentId(final FedoraId parentId) {
074        this.parentId = parentId;
075        return this;
076    }
077
078    @Override
079    public CreateRdfSourceOperationBuilder relaxedProperties(final Model model) {
080        super.relaxedProperties(model);
081        return this;
082    }
083
084    @Override
085    public CreateRdfSourceOperationBuilder archivalGroup(final boolean flag) {
086        this.archivalGroup = flag;
087        return this;
088    }
089
090}