001/* 002 * Copyright 2019 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.odfsync.cdmfr; 017 018import java.util.List; 019import java.util.Map; 020import java.util.Set; 021 022import org.apache.avalon.framework.configuration.Configuration; 023import org.apache.avalon.framework.configuration.ConfigurationException; 024import org.apache.avalon.framework.service.ServiceException; 025import org.apache.avalon.framework.service.ServiceManager; 026import org.slf4j.Logger; 027 028import org.ametys.cms.repository.Content; 029import org.ametys.cms.repository.ModifiableDefaultContent; 030import org.ametys.plugins.contentio.synchronize.AbstractSynchronizableContentsCollection; 031import org.ametys.plugins.odfsync.cdmfr.components.ImportCDMFrComponent; 032import org.ametys.plugins.repository.AmetysObjectIterable; 033 034/** 035 * Abstract class to import CDMFr contents 036 */ 037public abstract class AbstractCDMFrSynchronizableContentsCollection extends AbstractSynchronizableContentsCollection 038{ 039 /** The import CDMFr component */ 040 protected ImportCDMFrComponent _importCDMFrComponent; 041 042 @Override 043 public void service(ServiceManager manager) throws ServiceException 044 { 045 super.service(manager); 046 _importCDMFrComponent = (ImportCDMFrComponent) manager.lookup(ImportCDMFrComponent.ROLE); 047 } 048 049 @Override 050 public String getIdField() 051 { 052 return _importCDMFrComponent.getIdField(); 053 } 054 055 public Set<String> getLocalAndExternalFields(Map<String, Object> additionalParameters) 056 { 057 return _importCDMFrComponent.getLocalAndExternalFields(additionalParameters); 058 } 059 060 public Set<String> getExternalOnlyFields(Map<String, Object> additionalParameters) 061 { 062 return Set.of(); 063 } 064 065 @Override 066 protected void configureDataSource(Configuration configuration) throws ConfigurationException 067 { 068 // Do Nothing 069 } 070 071 @Override 072 protected void configureSearchModel() 073 { 074 // Do Nothing 075 } 076 077 @Override 078 public void synchronizeContent(ModifiableDefaultContent content, Logger logger) throws Exception 079 { 080 throw new UnsupportedOperationException("synchronizeContent() method is not supported for AbstractCDMFrSynchronizableContentsCollection."); 081 } 082 083 @Override 084 public ModifiableDefaultContent getContent(String lang, String idValue) 085 { 086 throw new UnsupportedOperationException("getContent() method is not supported for AbstractCDMFrSynchronizableContentsCollection."); 087 } 088 089 @Override 090 public Map<String, Map<String, Object>> search(Map<String, Object> parameters, int offset, int limit, List<Object> sort, Logger logger) 091 { 092 throw new UnsupportedOperationException("search() method is not supported for AbstractCDMFrSynchronizableContentsCollection."); 093 } 094 095 @Override 096 public void updateSyncInformations(ModifiableDefaultContent content, String syncCode, Logger logger) throws Exception 097 { 098 throw new UnsupportedOperationException("updateSyncInformations() method is not supported for AbstractCDMFrSynchronizableContentsCollection."); 099 } 100 101 @Override 102 public int getTotalCount(Map<String, Object> parameters, Logger logger) 103 { 104 throw new UnsupportedOperationException("getTotalCount() method is not supported for AbstractCDMFrSynchronizableContentsCollection."); 105 } 106 107 @Override 108 protected List<Content> _getContentsToRemove(AmetysObjectIterable<ModifiableDefaultContent> contents) 109 { 110 throw new UnsupportedOperationException("_getContentsToRemove() method is not supported for AbstractCDMFrSynchronizableContentsCollection."); 111 } 112 113 @Override 114 protected List<ModifiableDefaultContent> _internalPopulate(Logger logger) 115 { 116 throw new UnsupportedOperationException("_internalPopulate() method is not supported for AbstractCDMFrSynchronizableContentsCollection."); 117 } 118}