01: /*
02: * Copyright 2001 Sun Microsystems, Inc. All rights reserved.
03: * PROPRIETARY/CONFIDENTIAL. Use of this product is subject to license terms.
04: */
05: package com.sun.portal.desktop.taglib.providerContext;
06:
07: import javax.servlet.jsp.JspException;
08:
09: import java.util.List;
10:
11: import com.sun.portal.providers.Provider;
12: import com.sun.portal.providers.context.ProviderContext;
13: import com.sun.portal.providers.context.ProviderContextException;
14:
15: import com.sun.portal.desktop.taglib.DesktopTaglibException;
16:
17: public class GetIntegerPropertyTag extends
18: BaseProviderContextTagSupport {
19: private String m_key = null;
20: private List m_pflist = null;
21:
22: public void setKey(String key) throws DesktopTaglibException {
23: m_key = resolveParameter(key).toString();
24: }
25:
26: public void setPfList(String pflist) throws DesktopTaglibException {
27: if (!isContextVariable(pflist)) {
28: throw new DesktopTaglibException(
29: DesktopTaglibException.INVALID_PARAMETER, pflist);
30: }
31: try {
32: m_pflist = (List) resolveParameter(pflist);
33: } catch (ClassCastException cce) {
34: throw new DesktopTaglibException(
35: DesktopTaglibException.INVALID_PARAMETER, pflist);
36: }
37: }
38:
39: public int doStartTag() throws JspException {
40: ProviderContext pc = getCurrentProviderContext();
41: int prop = 0;
42: Provider p = getCurrentObj();
43: try {
44: if (m_pflist == null) {
45: prop = pc.getIntegerProperty(p.getName(), m_key);
46: } else {
47: prop = pc.getIntegerProperty(p.getName(), m_key,
48: m_pflist);
49: }
50: } catch (ProviderContextException pce) {
51: throw new DesktopTaglibException(pce);
52: }
53:
54: processResult(new Integer(prop));
55: return SKIP_BODY;
56: }
57: }
|