1 17 18 package org.jahia.data.containers; 19 20 21 import java.util.Vector ; 22 23 import org.jahia.exceptions.JahiaException; 24 import org.jahia.registries.*; 25 import org.jahia.services.version.EntryLoadRequest; 26 import java.io.Serializable ; 27 import java.util.BitSet ; 28 29 30 31 42 public class ContainerFilterByLoadRequest implements Serializable , ContainerFilterInterface{ 43 44 private static org.apache.log4j.Logger logger = 45 org.apache.log4j.Logger.getLogger(ContainerFilterByCategories.class); 46 47 private EntryLoadRequest entryLoadRequest = EntryLoadRequest.CURRENT; 48 49 private ContainerFilters containerFilters = null; 50 51 57 public ContainerFilterByLoadRequest(EntryLoadRequest entryLoadRequest){ 58 59 if ( entryLoadRequest != null ){ 60 this.entryLoadRequest = entryLoadRequest; 61 } 62 } 63 64 72 public BitSet doFilter(int ctnListID) 73 throws JahiaException 74 { 75 BitSet result = null; 76 77 result = doFiltering(ctnListID); 78 79 return result; 80 } 81 82 89 private BitSet doFiltering(int ctnListID) 90 throws JahiaException 91 { 92 BitSet result = new BitSet (); 93 Vector ids = ServicesRegistry.getInstance().getJahiaContainersService() 94 .getctnidsInList(ctnListID,this.entryLoadRequest); 95 int size = ids.size(); 96 for (int i=0; i<size; i++){ 97 Integer I = (Integer )ids.get(i); 98 result.set(I.intValue()); 99 } 100 return result; 101 } 102 103 110 public String getSelect(int ctnListID) 111 { 112 return ctnListID + "_" + this.entryLoadRequest.toString(); 113 } 114 115 122 public void setContainerFilters(ContainerFilters containerFilters){ 123 this.containerFilters = containerFilters; 124 } 125 126 144 public BitSet doFilterBySite(int siteId, String containerDefinitionName, int listId) 145 throws JahiaException 146 { 147 148 BitSet result = null; 149 result = doFilteringBySite(siteId, containerDefinitionName); 150 return result; 151 } 152 153 161 private BitSet doFilteringBySite(int siteId, 162 String containerDefinitionName) 163 throws JahiaException 164 { 165 BitSet result = new BitSet (); 166 Vector ids = ServicesRegistry.getInstance().getJahiaContainersService() 167 .getCtnIds(this.entryLoadRequest); 168 int size = ids.size(); 169 for (int i=0; i<size; i++){ 170 Integer I = (Integer )ids.get(i); 171 result.set(I.intValue()); 172 } 173 return result; 174 } 175 176 188 public String getSelectBySiteID(int siteId, String containerDefinitionName) 189 { 190 return siteId + "_" + containerDefinitionName + "_" 192 + this.entryLoadRequest.toString(); 193 } 194 195 } 196 | Popular Tags |