001/* 002 * Copyright 2012 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.web.cache.zoneitem; 017 018import java.util.Arrays; 019import java.util.Collections; 020import java.util.List; 021import java.util.Set; 022 023import org.ametys.web.ObservationConstants; 024import org.ametys.web.cache.pageelement.AbstractSimplePageElementCachePolicy; 025 026/** 027 * Zone item cache policy for contents. 028 */ 029public class ContentZoneItemCachePolicy extends AbstractSimplePageElementCachePolicy 030{ 031 @Override 032 public Set<String> getPageElementTypes() 033 { 034 return Collections.singleton("CONTENT"); 035 } 036 037 @Override 038 protected List<String> _getRemovingCacheEventIds(String workspace) 039 { 040 // remove content from cache when pages are moved or deleted, 041 // as the content may contains links to these pages. 042 // Also remove from cache when resources or resource collections are 043 // moved, deleted or renamed, as the content may to theses resources. 044 return Arrays.asList(ObservationConstants.EVENT_PAGE_DELETED, 045 ObservationConstants.EVENT_PAGE_MOVED, 046 org.ametys.plugins.explorer.ObservationConstants.EVENT_RESOURCE_RENAMED, 047 org.ametys.plugins.explorer.ObservationConstants.EVENT_RESOURCE_DELETED, 048 org.ametys.plugins.explorer.ObservationConstants.EVENT_RESOURCE_MOVED, 049 org.ametys.plugins.explorer.ObservationConstants.EVENT_COLLECTION_RENAMED, 050 org.ametys.plugins.explorer.ObservationConstants.EVENT_COLLECTION_MOVED, 051 org.ametys.plugins.explorer.ObservationConstants.EVENT_COLLECTION_DELETED); 052 } 053}