001    package railo.runtime.search;
002    
003    
004    public class AddionalAttrs {
005    
006    
007    
008            private static ThreadLocal addAttrs=new ThreadLocal();
009            private int contextBytes;
010            private String contextHighlightBegin;
011            private int contextPassages;
012            private String contextHighlightEnd;
013            private int startrow=1;
014            private int maxrows=-1;
015            private boolean hasRowHandling;
016            
017            public AddionalAttrs(int contextBytes, int contextPassages,String contextHighlightBegin, String contextHighlightEnd) {
018                    this.contextBytes=contextBytes;
019                    this.contextPassages=contextPassages;
020                    this.contextHighlightBegin=contextHighlightBegin;
021                    this.contextHighlightEnd=contextHighlightEnd;
022            }
023            
024            public static AddionalAttrs getAddionlAttrs(){
025                    AddionalAttrs aa = (AddionalAttrs) addAttrs.get();
026                    if(aa==null)aa=new AddionalAttrs(300,0,"<b>","</b>");
027                    return aa;
028            }
029            public static void setAddionalAttrs(AddionalAttrs aa){
030                    addAttrs.set(aa);
031            }
032            
033            public static void setAddionalAttrs(int contextBytes, int contextPassages, String contextHighlightBegin, String contextHighlightEnd) {
034                    setAddionalAttrs(new AddionalAttrs(contextBytes,contextPassages,contextHighlightBegin,contextHighlightEnd));
035            }
036    
037            public static void removeAddionalAttrs(){
038                    addAttrs.set(null);
039            }
040            
041    
042            /**
043             * @return the contextBytes
044             */
045            public int getContextBytes() {
046                    return contextBytes;
047            }
048    
049            /**
050             * @return the contextHighlightBegin
051             */
052            public String getContextHighlightBegin() {
053                    return contextHighlightBegin;
054            }
055    
056            /**
057             * @return the contextPassages
058             */
059            public int getContextPassages() {
060                    return contextPassages;
061            }
062    
063            /**
064             * @return the contextHighlightEnd
065             */
066            public String getContextHighlightEnd() {
067                    return contextHighlightEnd;
068            }
069    
070            /**
071             * @return the startrow
072             */
073            public int getStartrow() {
074                    return startrow;
075            }
076    
077            /**
078             * @param startrow the startrow to set
079             */
080            public void setStartrow(int startrow) {
081                    this.startrow = startrow;
082            }
083    
084            /**
085             * @return the maxrows
086             */
087            public int getMaxrows() {
088                    return maxrows;
089            }
090    
091            /**
092             * @param maxrows the maxrows to set
093             */
094            public void setMaxrows(int maxrows) {
095                    this.maxrows = maxrows;
096            }
097    
098            public boolean hasRowHandling() {
099                    return hasRowHandling;
100            }
101            public void setHasRowHandling(boolean hasRowHandling) {
102                    this.hasRowHandling= hasRowHandling;
103            }
104    }