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.plugins.workspaces.project.modules; 017 018import java.util.Set; 019 020import org.ametys.plugins.explorer.resources.ModifiableResourceCollection; 021import org.ametys.plugins.repository.AmetysObjectIterable; 022import org.ametys.plugins.workspaces.project.objects.Project; 023import org.ametys.runtime.i18n.I18nizableText; 024import org.ametys.web.repository.page.Page; 025import org.ametys.web.repository.sitemap.Sitemap; 026 027/** 028 * Manager for the Workspaces modules 029 */ 030public interface WorkspaceModule 031{ 032 /** 033 * Get the module Id 034 * @return The module ID 035 */ 036 String getId(); 037 038 /** 039 * Get the module title 040 * @return The title 041 */ 042 I18nizableText getModuleTitle(); 043 044 /** 045 * Get the module name 046 * @return the module name 047 */ 048 String getModuleName(); 049 050 /** 051 * Activate the module for the project, creating the module pages 052 * @param project The project 053 */ 054 void activateModule(Project project); 055 /** 056 * Initialize the sitemap for the module 057 * @param sitemap The sitemap 058 */ 059 void initializeSitemap(Sitemap sitemap); 060 061 /** 062 * Delete all data related to the module in the project, and the module pages 063 * @param project The project 064 */ 065 void deactivateModule(Project project); 066 067 /** 068 * Get the set of allowed event type for the module 069 * @return The set of allowed event types 070 */ 071 Set<String> getAllowedEventTypes(); 072 073 /** 074 * Get the module root node for the given project 075 * @param project The project containing the module 076 * @param create True to create the node if it does not exists 077 * @return The root node, or null if it does not exists and was not created 078 */ 079 ModifiableResourceCollection getModuleRoot(Project project, boolean create); 080 081 /** 082 * Retrieves the pages of the module 083 * @param project The project 084 * @param language the sitemap language or <code>null</code> for all sitemap languages. 085 * @return the pages iterator 086 */ 087 AmetysObjectIterable<Page> getModulePages(Project project, String language); 088 089 090}