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 unique Ametys code of the {@link ProgramItem} 066 * @return the unique Ametys code 067 */ 068 public String getCode(); 069 070 /** 071 * Set the Ametys code 072 * @param code the Ametys to set 073 * @throws AmetysRepositoryException if an error occurs 074 */ 075 public void setCode(String code) throws AmetysRepositoryException; 076 077 /** 078 * Get the code to display 079 * @return the code to display 080 */ 081 public String getDisplayCode(); 082 083 /** 084 * <code>true</code> if the {@link ProgramItem} is publishable 085 * @return <code>true</code> if the {@link ProgramItem} is publishable 086 */ 087 public boolean isPublishable(); 088 089 /** 090 * Set publishable to <code>true</code> to make the {@link ProgramItem} publishable 091 * @param isPublishable <code>true</code> to make the {@link ProgramItem} publishable 092 */ 093 public void setPublishable(boolean isPublishable); 094 095 /** 096 * Return the list of orgUnits binded to this program 097 * @return a list of uuid 098 */ 099 public List<String> getOrgUnits(); 100 101 102 // --------------------------------------------------------------------------------------// 103 // ORGUNITS 104 // --------------------------------------------------------------------------------------// 105 106// /** 107// * Return the list of orgUnits binded to this program 108// * @return a list of uuid 109// */ 110// public List<String> getOrgUnits() 111// { 112// try 113// { 114// return ContentDataHelper.getContentIdsListFromMultipleContentData(this, ORG_UNITS_REFERENCES); 115// } 116// catch (UndefinedItemPathException e) 117// { 118// return Collections.EMPTY_LIST; // this attribute is not part of model 119// } 120// } 121}