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.cms.content.indexing.solr; 017 018import java.util.HashSet; 019import java.util.Set; 020 021import org.ametys.runtime.plugin.component.AbstractThreadSafeComponentExtensionPoint; 022 023/** 024 * Used by the SoldContentRightIndexer this point allow to have different parent behavior 025 */ 026public class SolrContentRightIndexerExtensionPoint extends AbstractThreadSafeComponentExtensionPoint<SolrContentRightIndexerExtension> 027{ 028 /** The avalon role */ 029 public static final String ROLE = SolrContentRightIndexerExtensionPoint.class.getName(); 030 031 /** 032 * Get the parents of the given context 033 * @param context A context to test 034 * @return The set of parents or null 035 */ 036 public Set<Object> getParents(Object context) 037 { 038 Set<Object> parents = new HashSet<>(); 039 040 for (String extensionId : getExtensionsIds()) 041 { 042 SolrContentRightIndexerExtension solrContentRightIndexerExtension = getExtension(extensionId); 043 Set<Object> extensionParents = solrContentRightIndexerExtension.getParents(context); 044 if (extensionParents != null) 045 { 046 parents.addAll(extensionParents); 047 } 048 } 049 050 return parents; 051 } 052}