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