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.web.cache.service; 017 018import java.util.Arrays; 019import java.util.HashSet; 020import java.util.List; 021import java.util.Set; 022 023import org.ametys.plugins.explorer.ObservationConstants; 024import org.ametys.web.cache.pageelement.AbstractSimplePageElementCachePolicy; 025import org.ametys.web.cache.pageelement.PageElementCachePolicy; 026 027/** 028 * {@link PageElementCachePolicy} for services based on explorer resources 029 */ 030public class ExplorerResourcesServiceCachePolicy extends AbstractSimplePageElementCachePolicy 031{ 032 private static final Set<String> _TYPES = new HashSet<>(); 033 static 034 { 035 _TYPES.add("SERVICE:org.ametys.web.service.AttachmentsService"); 036 _TYPES.add("SERVICE:org.ametys.web.service.ExplorerFolderService"); 037 } 038 039 @Override 040 public Set<String> getPageElementTypes() 041 { 042 return _TYPES; 043 } 044 045 @Override 046 protected List<String> _getRemovingCacheEventIds(String workspace) 047 { 048 return Arrays.asList(ObservationConstants.EVENT_RESOURCE_RENAMED, 049 ObservationConstants.EVENT_RESOURCE_CREATED, 050 ObservationConstants.EVENT_RESOURCE_DELETED, 051 ObservationConstants.EVENT_RESOURCE_MOVED, 052 ObservationConstants.EVENT_RESOURCE_UPDATED, 053 ObservationConstants.EVENT_COLLECTION_RENAMED, 054 ObservationConstants.EVENT_COLLECTION_MOVED, 055 ObservationConstants.EVENT_COLLECTION_COPIED, 056 ObservationConstants.EVENT_COLLECTION_DELETED); 057 } 058 059 060 061}