001/*
002 *  Copyright 2017 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.odf;
017
018import java.util.Set;
019
020import org.ametys.odf.cdmfr.CDMEntity;
021import org.ametys.odf.program.Program;
022import org.ametys.plugins.repository.AmetysRepositoryException;
023
024/**
025 * This interface represent a ODF content which is part of a program
026 *
027 */
028public interface ProgramItem extends CDMEntity
029{
030    /** {@link Program} content type */
031    public static final String PROGRAM_ITEM_CONTENT_TYPE = "org.ametys.plugins.odf.Content.programItem";
032    
033    /** The metadata holding the catalog */
034    public static final String METADATA_CATALOG = "catalog";
035    
036    /** The metadata holding the code */
037    public static final String METADATA_CODE = "code";
038    
039    /**
040     * Get the catalog of this content
041     * @return the name of catalog or null if not set
042     */
043    public String getCatalog();
044    
045    /**
046     * Set the catalog
047     * @param name the name of catalog to set
048     * @throws AmetysRepositoryException if an error occurred
049     */
050    public void setCatalog(String name) throws AmetysRepositoryException;
051    
052    /**
053     * Get the CDM-fr of the {@link ProgramItem}
054     * @return the CDM-fr code
055     */
056    public String getCode();
057    
058    /**
059     * Set the CDM-fr code
060     * @param code the CDM-fr to set
061     * @throws AmetysRepositoryException if an error occurs
062     */
063    public void setCode(String code) throws AmetysRepositoryException;
064    
065    /**
066     * Returns the programs holding this program part
067     * @return the root programs
068     */
069    public Set<Program> getRootPrograms();
070}