01: /*
02: * Copyright 2001-2006 C:1 Financial Services GmbH
03: *
04: * This software is free software; you can redistribute it and/or
05: * modify it under the terms of the GNU Lesser General Public
06: * License Version 2.1, as published by the Free Software Foundation.
07: *
08: * This software is distributed in the hope that it will be useful,
09: * but WITHOUT ANY WARRANTY; without even the implied warranty of
10: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11: * Lesser General Public License for more details.
12: *
13: * You should have received a copy of the GNU Lesser General Public
14: * License along with this library; if not, write to the Free Software
15: * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA
16: */
17:
18: package de.finix.contelligent.action.system;
19:
20: import de.finix.contelligent.*;
21: import de.finix.contelligent.logging.LoggingService;
22: import de.finix.contelligent.core.RelationsManagerImpl;
23:
24: /**
25: * This {@link Action} invokes {@link RelationsManagerImpl#updateRelations} with
26: * the component specified by parameter {@link #PARAMETER_PATH PATH}. Use PATH
27: * '/' to scan the whole component tree.
28: */
29: public class UpdateRelationsAction extends SystemAction {
30: final static org.apache.log4j.Logger log = LoggingService
31: .getLogger(UpdateRelationsAction.class);
32:
33: /**
34: * This parameter describes the {@link ComponentPath path} of the
35: * {@link Component} from which an XML description should be generated.
36: */
37: final static public String PARAMETER_PATH = "PATH";
38:
39: /**
40: * This method does the work for this {@link Action}, see the class
41: * description for further information.
42: *
43: * @param callData
44: * a <code>CallData</code> value
45: * @return a <code>String</code> value
46: * @see RelationsManagerImpl#updateRelations
47: */
48: protected String doPerform(CallData callData,
49: SystemActionResult response) throws Exception {
50: checkUserAgent(callData);
51: ComponentPath path = new ComponentPath(
52: ((String[]) getParameter(PARAMETER_PATH, callData))[0]);
53: log.debug("'" + this + "' - trying to resolve component '"
54: + path + "' ...");
55: RelationsManagerImpl relationsManager = (RelationsManagerImpl) ctx
56: .getSystem().getRelationsManager();
57: Component component = ctx.getCallManager().getComponent(path,
58: callData, false); // don't
59: // follow
60: // links
61: relationsManager.updateRelations(component, callData, true);
62: log.debug("'" + this
63: + "' - ... succesfully wrote relations of tree '"
64: + path + "'!");
65: response.setState(SystemActionResult.OK);
66: setResult(RESULT_KEY, response, callData);
67: return ROUTING_OK;
68: }
69:
70: }
|