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 static org.fcrepo.kernel.api.RdfLexicon.NON_RDF_SOURCE;
021
022import java.io.InputStream;
023import java.net.URI;
024
025import org.fcrepo.kernel.api.identifiers.FedoraId;
026import org.fcrepo.kernel.api.operations.CreateResourceOperation;
027
028/**
029 * Operation for creating a new non-rdf source
030 *
031 * @author bbpennel
032 */
033public class CreateNonRdfSourceOperation extends AbstractNonRdfSourceOperation implements CreateResourceOperation {
034
035    private FedoraId parentId;
036
037    /**
038     * Constructor for external content.
039     *
040     * @param rescId the internal identifier.
041     * @param externalContentURI the URI of the external content.
042     * @param externalHandling the type of external content handling (REDIRECT, PROXY)
043     */
044    protected CreateNonRdfSourceOperation(final FedoraId rescId, final URI externalContentURI,
045                                          final String externalHandling) {
046        super(rescId, externalContentURI, externalHandling);
047    }
048
049    /**
050     * Constructor for internal binaries.
051     *
052     * @param rescId the internal identifier.
053     * @param content the stream of the content.
054     */
055    protected CreateNonRdfSourceOperation(final FedoraId rescId, final InputStream content) {
056        super(rescId, content);
057    }
058
059    @Override
060    public String getInteractionModel() {
061        return NON_RDF_SOURCE.toString();
062    }
063
064    @Override
065    public boolean isArchivalGroup() {
066        return false;
067    }
068
069    @Override
070    public FedoraId getParentId() {
071        return parentId;
072    }
073
074    /**
075     * @param parentId the parentId to set
076     */
077    public void setParentId(final FedoraId parentId) {
078        this.parentId = parentId;
079    }
080
081}