01: /* Copyright 2004, 2005, 2006 Acegi Technology Pty Limited
02: *
03: * Licensed under the Apache License, Version 2.0 (the "License");
04: * you may not use this file except in compliance with the License.
05: * You may obtain a copy of the License at
06: *
07: * http://www.apache.org/licenses/LICENSE-2.0
08: *
09: * Unless required by applicable law or agreed to in writing, software
10: * distributed under the License is distributed on an "AS IS" BASIS,
11: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12: * See the License for the specific language governing permissions and
13: * limitations under the License.
14: */
15: package org.acegisecurity.vote;
16:
17: import org.acegisecurity.context.SecurityContextHolder;
18:
19: import org.apache.log4j.Logger;
20:
21: import java.util.List;
22: import java.util.Vector;
23:
24: /**
25: * For label unit tests.
26: *
27: * @author Greg Turnquist
28: * @version $Id: SampleServiceImpl.java 1750 2006-11-14 22:07:36Z benalex $
29: */
30: public class SampleServiceImpl implements SampleService {
31: //~ Instance fields ================================================================================================
32:
33: Logger logger = Logger.getLogger(SampleServiceImpl.class);
34:
35: //~ Methods ========================================================================================================
36:
37: public void doSomethingOnThis(SampleBlockOfData block1,
38: SampleBlockOfData block2) {
39: if (logger.isDebugEnabled()) {
40: logger.debug("You made it! Your context is "
41: + SecurityContextHolder.getContext()
42: .getAuthentication());
43: }
44:
45: if (logger.isDebugEnabled()) {
46: logger.debug("Block1 is " + block1);
47: }
48:
49: if (logger.isDebugEnabled()) {
50: logger.debug("Block2 is " + block2);
51: }
52: }
53:
54: public List getTheSampleData() {
55: if (logger.isDebugEnabled()) {
56: logger.debug(SecurityContextHolder.getContext()
57: .getAuthentication().getName()
58: + " is requesting some sample data.");
59: }
60:
61: List dataList = new Vector();
62: SampleBlockOfData block;
63:
64: block = new SampleBlockOfData();
65: block.setId("001");
66: block.setSomeData(SampleBlockOfData.DATA_LABEL_BLUE);
67: dataList.add(block);
68:
69: block = new SampleBlockOfData();
70: block.setId("002");
71: block.setSomeData(SampleBlockOfData.DATA_LABEL_ORANGE);
72: dataList.add(block);
73:
74: block = new SampleBlockOfData();
75: block.setId("003");
76: block.setSomeData(SampleBlockOfData.DATA_LABEL_SHARED);
77: dataList.add(block);
78:
79: return dataList;
80: }
81: }
|