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; 021 022import org.fcrepo.config.ServerManagedPropsMode; 023import org.fcrepo.kernel.api.RdfStream; 024import org.fcrepo.kernel.api.Transaction; 025import org.fcrepo.kernel.api.identifiers.FedoraId; 026import org.fcrepo.kernel.api.operations.CreateRdfSourceOperation; 027import org.fcrepo.kernel.api.operations.CreateRdfSourceOperationBuilder; 028 029/** 030 * Builder for operations to create rdf sources 031 * 032 * @author bbpennel 033 */ 034public class CreateRdfSourceOperationBuilderImpl extends AbstractRdfSourceOperationBuilder implements 035 CreateRdfSourceOperationBuilder { 036 037 private FedoraId parentId; 038 039 private boolean archivalGroup = false; 040 /** 041 * Constructor. 042 * 043 * @param transaction the transaction 044 * @param resourceId the internal identifier. 045 * @param interactionModel interaction model 046 * @param serverManagedPropsMode server managed props mode 047 */ 048 public CreateRdfSourceOperationBuilderImpl(final Transaction transaction, final FedoraId resourceId, 049 final String interactionModel, 050 final ServerManagedPropsMode serverManagedPropsMode) { 051 super(transaction, resourceId, interactionModel, serverManagedPropsMode); 052 } 053 054 @Override 055 public CreateRdfSourceOperation build() { 056 final var operation = new CreateRdfSourceOperationImpl(transaction, resourceId, interactionModel, tripleStream); 057 operation.setParentId(parentId); 058 operation.setUserPrincipal(userPrincipal); 059 operation.setCreatedBy(createdBy); 060 operation.setCreatedDate(createdDate); 061 operation.setLastModifiedBy(lastModifiedBy); 062 operation.setLastModifiedDate(lastModifiedDate); 063 operation.setArchivalGroup(archivalGroup); 064 return operation; 065 } 066 067 @Override 068 public CreateRdfSourceOperationBuilder userPrincipal(final String userPrincipal) { 069 super.userPrincipal(userPrincipal); 070 return this; 071 } 072 073 @Override 074 public CreateRdfSourceOperationBuilder triples(final RdfStream triples) { 075 super.triples(triples); 076 return this; 077 } 078 079 @Override 080 public CreateRdfSourceOperationBuilder parentId(final FedoraId parentId) { 081 this.parentId = parentId; 082 return this; 083 } 084 085 @Override 086 public CreateRdfSourceOperationBuilder relaxedProperties(final Model model) { 087 super.relaxedProperties(model); 088 return this; 089 } 090 091 @Override 092 public CreateRdfSourceOperationBuilder archivalGroup(final boolean flag) { 093 this.archivalGroup = flag; 094 return this; 095 } 096 097}