001/* 002 * Copyright 2016 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.contentio.synchronize; 017 018import java.util.Map; 019import java.util.Set; 020 021import org.slf4j.Logger; 022 023import org.ametys.plugins.repository.RepositoryConstants; 024import org.ametys.runtime.i18n.I18nizableText; 025 026/** 027 * This interface represents a synchronizable collection of contents 028 * 029 */ 030public interface SynchronizableContentsCollection 031{ 032 /** The name for the metadata indicating the ids of the collections */ 033 public static final String COLLECTION_ID_PROPERTY = RepositoryConstants.NAMESPACE_PREFIX_INTERNAL + ":scc"; 034 035 /** 036 * Get the id of synchronizable collection. 037 * @return the id 038 */ 039 String getId(); 040 041 /** 042 * Get the label of synchronizable collection 043 * @return the label 044 */ 045 I18nizableText getLabel(); 046 047 /** 048 * Get the type of content handled by this collection 049 * @return the type of content 050 */ 051 String getContentType(); 052 053 /** 054 * Get the id of controller responsible of synchronization of this collection 055 * @return The id of controller 056 */ 057 String getSynchronizeCollectionModelId(); 058 059 /** 060 * Get the untyped values of parameters for controller 061 * @return the untyped values 062 */ 063 Map<String, Object> getParameterValues(); 064 065 /** 066 * When returns true, a content created by a previous synchro will be removed if it does not exist anymore during the current synchro. 067 * @return true if a content created by a previous synchro has to be removed if it does not exist anymore during the current synchro. 068 */ 069 boolean removalSync(); 070 071 /** 072 * Get the name of the workflow to use for the synchronized contents 073 * @return the name of the workflow to use for the synchronized contents 074 */ 075 String getWorkflowName(); 076 077 /** 078 * Get the id of the initial action of the workflow 079 * @return The id of the initial action of the workflow 080 */ 081 int getInitialActionId(); 082 083 /** 084 * Get the id of the validate action of the workflow 085 * @return The id of the validate action of the workflow 086 */ 087 int getValidateActionId(); 088 089 /** 090 * Get the prefix to use for the creation of contents 091 * @return The prefix to use for the creation of contents 092 */ 093 String getContentPrefix(); 094 095 /** 096 * True to validate the contents after import 097 * @return True to validate the contents after import 098 */ 099 boolean validateAfterImport(); 100 101 /** 102 * If an exception occurs during synchronization, an error report mail will be sent to those email addresses (separated by new lines) 103 * @return The email addresses to send an error report if an exception occurs during synchronization (separated by new lines) 104 */ 105 String getReportMails(); 106 107 /** 108 * Gets the id of the {@link SynchronizingContentOperator} extension to use during synchronization 109 * @return the id of the {@link SynchronizingContentOperator} extension to use during synchronization 110 */ 111 String getSynchronizingContentOperator(); 112 113 /** 114 * Get the path of boolean metadata for restricted content. 115 * If true, the content will be visible only for connected users. 116 * @return the path to the metadata. Can be null. 117 */ 118 String getRestrictedField(); 119 120 /** 121 * Get the path of metadata holding the unique identifier 122 * @return the path to the metadata. Can be null. 123 */ 124 String getIdField(); 125 126 /** 127 * Get the path of tri-state fields (with local and external values) 128 * @return the synchronized fields 129 */ 130 Set<String> getLocalAndExternalFields (); 131 132 /** 133 * Get the path of field that are valued externally only. 134 * @return the external fields 135 */ 136 Set<String> getExternalOnlyFields (); 137 138 /** 139 * Populates contents 140 * @param logger The logger 141 */ 142 public void populate(Logger logger); 143}