01: /* Copyright 2002 The JA-SIG Collaborative. All rights reserved.
02: * See license distributed with this file and
03: * available online at http://www.uportal.org/license.html
04: */
05:
06: package org.jasig.portal.layout;
07:
08: import org.w3c.dom.Document;
09: import org.jasig.portal.UserProfile;
10: import org.jasig.portal.security.IPerson;
11: import java.util.Random;
12:
13: /**
14: * A mock of IUserLayoutStore interface that works with a single user layout
15: * DOM document.
16: *
17: * @author Peter Kharchenko {@link <a href="mailto:pkharchenko@interactivebusiness.com"">pkharchenko@interactivebusiness.com"</a>}
18: * @version 1.0
19: */
20: public class SingleDocumentUserLayoutStoreMock extends
21: UserLayoutStoreMock {
22: private static final Random rnd = new Random();
23: Document userLayout = null;
24:
25: public SingleDocumentUserLayoutStoreMock(Document doc) {
26: this .userLayout = doc;
27: }
28:
29: public Document getUserLayout(
30: org.jasig.portal.security.IPerson person,
31: UserProfile profile) throws Exception {
32: return this .userLayout;
33: }
34:
35: public void setUserLayout(org.jasig.portal.security.IPerson person,
36: UserProfile profile, org.w3c.dom.Document layoutXML,
37: boolean channelsAdded) throws Exception {
38: this .userLayout = layoutXML;
39: }
40:
41: public String generateNewChannelSubscribeId(IPerson person)
42: throws Exception {
43: return new String("rid" + Integer.toString(rnd.nextInt()));
44: }
45:
46: public String generateNewFolderId(IPerson person) throws Exception {
47: return new String("rid" + Integer.toString(rnd.nextInt()));
48: }
49: }
|