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.tags.inputdata; 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.AbstractACLPageElementCachePolicy; 025import org.ametys.web.cache.pageelement.PageElementCachePolicy; 026 027/** 028 * {@link PageElementCachePolicy} for the {@link FilteredContentsInputData}.<br> 029 */ 030public class FilteredContentsInputDataCachePolicy extends AbstractACLPageElementCachePolicy 031{ 032 033 @Override 034 public Set<String> getPageElementTypes() 035 { 036 return Collections.singleton(FilteredContentsInputData.class.getName()); 037 } 038 039 @Override 040 protected List<String> _getRemovingCacheEventIds(String workspace) 041 { 042 if ("default".equals(workspace)) 043 { 044 return Arrays.asList(org.ametys.cms.ObservationConstants.EVENT_CONTENT_ADDED, 045 org.ametys.cms.ObservationConstants.EVENT_CONTENT_MODIFIED, 046 org.ametys.cms.ObservationConstants.EVENT_CONTENT_DELETED, 047 org.ametys.cms.ObservationConstants.EVENT_CONTENT_TAGGED, 048 org.ametys.cms.ObservationConstants.EVENT_TAG_ADDED, 049 org.ametys.cms.ObservationConstants.EVENT_TAG_DELETED, 050 ObservationConstants.EVENT_PAGE_CHANGED, 051 org.ametys.core.ObservationConstants.EVENT_ACL_UPDATED, 052 ObservationConstants.EVENT_PAGE_MOVED, 053 ObservationConstants.EVENT_PAGE_DELETED, 054 ObservationConstants.EVENT_ZONEITEM_DELETED, 055 ObservationConstants.EVENT_ZONEITEM_MODIFIED); 056 } 057 else if ("live".equals(workspace)) 058 { 059 return Arrays.asList(org.ametys.cms.ObservationConstants.EVENT_CONTENT_ADDED, 060 org.ametys.cms.ObservationConstants.EVENT_CONTENT_VALIDATED, 061 org.ametys.cms.ObservationConstants.EVENT_CONTENT_DELETED, 062 org.ametys.cms.ObservationConstants.EVENT_CONTENT_TAGGED, 063 ObservationConstants.EVENT_CONTENT_UNPUBLISHED, 064 org.ametys.cms.ObservationConstants.EVENT_TAG_ADDED, 065 org.ametys.cms.ObservationConstants.EVENT_TAG_DELETED, 066 ObservationConstants.EVENT_PAGE_CHANGED, 067 org.ametys.core.ObservationConstants.EVENT_ACL_UPDATED, 068 ObservationConstants.EVENT_PAGE_MOVED, 069 ObservationConstants.EVENT_PAGE_DELETED, 070 ObservationConstants.EVENT_ZONEITEM_DELETED, 071 ObservationConstants.EVENT_ZONEITEM_MODIFIED); 072 } 073 074 return Collections.emptyList(); 075 } 076 077}