001/*
002 *  Copyright 2021 Anyware Services
003 *
004 *  Licensed under the Apache License, Version 2.0 (the "License");
005 *  you may not use this file except in compliance with the License.
006 *  You may obtain a copy of the License at
007 *
008 *      http://www.apache.org/licenses/LICENSE-2.0
009 *
010 *  Unless required by applicable law or agreed to in writing, software
011 *  distributed under the License is distributed on an "AS IS" BASIS,
012 *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013 *  See the License for the specific language governing permissions and
014 *  limitations under the License.
015 */
016package org.ametys.plugins.odfsync.cdmfr;
017
018import org.slf4j.Logger;
019import org.w3c.dom.Document;
020
021import org.ametys.plugins.contentio.synchronize.SynchronizableContentsCollection;
022
023/**
024 * Context of imported content for CDM-fr
025 */
026public final class ImportCDMFrContext
027{
028    /** The Synchronizable content collection */
029    private SynchronizableContentsCollection _scc;
030    
031    /** The document that is being imported */
032    private Document _document;
033    
034    /** The language of the imported contents */
035    private String _lang;
036    
037    /** The catalog which will contain the imported contents */
038    private String _catalog;
039    
040    /** The logger */
041    private Logger _logger;
042    
043    /**
044     * Creates a CDM-fr context from the given one
045     * @param context the context to copy
046     */
047    public ImportCDMFrContext(ImportCDMFrContext context)
048    {
049        this(context.getSCC(), context.getDocument(), context.getLang(), context.getCatalog(), context.getLogger());
050    }
051
052    /**
053     * Creates a CDM-fr context
054     * @param scc The synchronizable content collection
055     * @param document the document that is being imported
056     * @param lang the language of the imported content
057     * @param catalog the catalog which will contain the imported content
058     * @param logger the logger
059     */
060    public ImportCDMFrContext(SynchronizableContentsCollection scc, Document document, String lang, String catalog, Logger logger)
061    {
062        _scc = scc;
063        _document = document;
064        _lang = lang;
065        _catalog = catalog;
066        _logger = logger;
067    }
068    
069    /**
070     * Retrieves the synchronizable content collection
071     * @return the synchronizable content collection
072     */
073    public SynchronizableContentsCollection getSCC()
074    {
075        return _scc;
076    }
077
078    /**
079     * Retrieves the document that is being imported
080     * @return the document that is being imported
081     */
082    public Document getDocument()
083    {
084        return _document;
085    }
086    
087    /**
088     * Set the language of the content to import
089     * @param lang the language of the content to import
090     */
091    public void setLang(String lang)
092    {
093        _lang = lang;
094    }
095
096    /**
097     * Retrieves the language of the imported content
098     * @return the language of the imported content
099     */
100    public String getLang()
101    {
102        return _lang;
103    }
104
105    /**
106     * Retrieves the catalog which will contain the imported content
107     * @return the catalog which will contain the imported content
108     */
109    public String getCatalog()
110    {
111        return _catalog;
112    }
113    
114    /**
115     * Retrieves the logger
116     * @return the logger
117     */
118    public Logger getLogger()
119    {
120        return _logger;
121    }
122}