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