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.List;
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 attribute holding the catalog */
034    public static final String CATALOG = "catalog";
035    
036    /** The attribute holding the code */
037    public static final String CODE = "code";
038    
039    /** The attribute holding the publishable state */
040    public static final String PUBLISHABLE = "publishable";
041    
042    /** The attribute holding the repeater of educational booklets */
043    public static final String EDUCATIONAL_BOOKLETS = "educational-booklets";
044    
045    /** Constants for attribute 'orgUnits' */
046    public static final String ORG_UNITS_REFERENCES = "orgUnit";
047    
048    /** Constants for shared property */
049    public static final String SHARED_PROPERTY = "isShared";
050    
051    /**
052     * Get the catalog of this content
053     * @return the name of catalog or null if not set
054     */
055    public String getCatalog();
056    
057    /**
058     * Set the catalog
059     * @param name the name of catalog to set
060     * @throws AmetysRepositoryException if an error occurred
061     */
062    public void setCatalog(String name) throws AmetysRepositoryException;
063    
064    /**
065     * Get the CDM-fr of the {@link ProgramItem}
066     * @return the CDM-fr code
067     */
068    public String getCode();
069    
070    /**
071     * Set the CDM-fr code
072     * @param code the CDM-fr to set
073     * @throws AmetysRepositoryException if an error occurs
074     */
075    public void setCode(String code) throws AmetysRepositoryException;
076    
077    /**
078     * <code>true</code> if the {@link ProgramItem} is publishable
079     * @return <code>true</code> if the {@link ProgramItem} is publishable
080     */
081    public boolean isPublishable();
082    
083    /**
084     * Set publishable to <code>true</code> to make the {@link ProgramItem} publishable
085     * @param isPublishable <code>true</code> to make the {@link ProgramItem} publishable
086     */
087    public void setPublishable(boolean isPublishable);
088    
089    /**
090     * Return the list of orgUnits binded to this program 
091     * @return a list of uuid
092    */
093    public List<String> getOrgUnits();
094    
095    
096 // --------------------------------------------------------------------------------------//
097    // ORGUNITS
098    // --------------------------------------------------------------------------------------//
099
100//    /**
101//     * Return the list of orgUnits binded to this program 
102//     * @return a list of uuid
103//     */
104//    public List<String> getOrgUnits()
105//    {
106//        try
107//        {
108//            return ContentDataHelper.getContentIdsListFromMultipleContentData(this, ORG_UNITS_REFERENCES);
109//        }
110//        catch (UndefinedItemPathException e)
111//        {
112//            return Collections.EMPTY_LIST; // this attribute is not part of model
113//        }
114//    }
115}