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 FilteredPagesInputData}.<br> 029 */ 030public class FilteredPagesInputDataCachePolicy extends AbstractACLPageElementCachePolicy 031{ 032 033 @Override 034 public Set<String> getPageElementTypes() 035 { 036 return Collections.singleton(FilteredPagesInputData.class.getName()); 037 } 038 039 @Override 040 protected List<String> _getRemovingCacheEventIds(String workspace) 041 { 042 if ("default".equals(workspace)) 043 { 044 return Arrays.asList(ObservationConstants.EVENT_PAGE_ADDED, 045 ObservationConstants.EVENT_PAGE_UPDATED, 046 org.ametys.core.ObservationConstants.EVENT_ACL_UPDATED, 047 ObservationConstants.EVENT_PAGE_CHANGED, 048 ObservationConstants.EVENT_PAGE_MOVED, 049 ObservationConstants.EVENT_PAGE_DELETED, 050 ObservationConstants.EVENT_PAGE_RENAMED); 051 } 052 else if ("live".equals(workspace)) 053 { 054 return Arrays.asList(org.ametys.cms.ObservationConstants.EVENT_CONTENT_VALIDATED, 055 org.ametys.cms.ObservationConstants.EVENT_CONTENT_UNTAG_LIVE, 056 ObservationConstants.EVENT_PAGE_ADDED, 057 org.ametys.core.ObservationConstants.EVENT_ACL_UPDATED, 058 ObservationConstants.EVENT_PAGE_UPDATED, 059 ObservationConstants.EVENT_PAGE_CHANGED, 060 ObservationConstants.EVENT_PAGE_MOVED, 061 ObservationConstants.EVENT_PAGE_DELETED, 062 ObservationConstants.EVENT_PAGE_RENAMED); 063 } 064 065 return Collections.emptyList(); 066 } 067 068}