|
|||||||||||||||||||
| Source file | Conditionals | Statements | Methods | TOTAL | |||||||||||||||
| ProfileRule.java | 0% | 0% | 0% | 0% |
|
||||||||||||||
| 1 |
/*
|
|
| 2 |
* EJTools, the Enterprise Java Tools
|
|
| 3 |
*
|
|
| 4 |
* Distributable under LGPL license.
|
|
| 5 |
* See terms of license at www.gnu.org.
|
|
| 6 |
*/
|
|
| 7 |
package org.ejtools.util.service;
|
|
| 8 |
|
|
| 9 |
import java.util.Map;
|
|
| 10 |
|
|
| 11 |
import org.ejtools.util.state.DefaultRule;
|
|
| 12 |
import org.xml.sax.Attributes;
|
|
| 13 |
|
|
| 14 |
/**
|
|
| 15 |
* @author Laurent Etiemble
|
|
| 16 |
* @version $Revision: 1.2 $
|
|
| 17 |
*/
|
|
| 18 |
public class ProfileRule extends DefaultRule |
|
| 19 |
{
|
|
| 20 |
/**
|
|
| 21 |
* Description of the Method
|
|
| 22 |
*
|
|
| 23 |
* @param context Description of the Parameter
|
|
| 24 |
*/
|
|
| 25 | 0 |
public void loadEnter(Map context) |
| 26 |
{
|
|
| 27 | 0 |
ProfileHolder holder = (ProfileHolder) context.get("HOLDER");
|
| 28 | 0 |
Profile profile = new Profile();
|
| 29 | 0 |
holder.setProfile(profile); |
| 30 | 0 |
context.put("PROFILE", profile);
|
| 31 |
} |
|
| 32 |
|
|
| 33 |
|
|
| 34 |
/**
|
|
| 35 |
* Description of the Class
|
|
| 36 |
*
|
|
| 37 |
* @author letiembl
|
|
| 38 |
* @version $Revision: 1.2 $
|
|
| 39 |
*/
|
|
| 40 |
public static class ProfilePropertyRule extends DefaultRule |
|
| 41 |
{
|
|
| 42 |
/** Description of the Field */
|
|
| 43 |
private String key;
|
|
| 44 |
|
|
| 45 |
|
|
| 46 |
/**
|
|
| 47 |
* Description of the Method
|
|
| 48 |
*
|
|
| 49 |
* @param context Description of the Parameter
|
|
| 50 |
*/
|
|
| 51 | 0 |
public void loadBody(Map context) |
| 52 |
{
|
|
| 53 | 0 |
Profile profile = (Profile) context.get("PROFILE");
|
| 54 | 0 |
String text = (String) context.get("TEXT");
|
| 55 | 0 |
profile.put(this.key, text);
|
| 56 |
} |
|
| 57 |
|
|
| 58 |
|
|
| 59 |
/**
|
|
| 60 |
* Description of the Method
|
|
| 61 |
*
|
|
| 62 |
* @param context Description of the Parameter
|
|
| 63 |
*/
|
|
| 64 | 0 |
public void loadEnter(Map context) |
| 65 |
{
|
|
| 66 | 0 |
Attributes attrs = (Attributes) context.get("ATTRIBUTES");
|
| 67 | 0 |
this.key = attrs.getValue("key"); |
| 68 |
} |
|
| 69 |
|
|
| 70 |
|
|
| 71 |
/**
|
|
| 72 |
* Description of the Method
|
|
| 73 |
*
|
|
| 74 |
* @param context Description of the Parameter
|
|
| 75 |
*/
|
|
| 76 | 0 |
public void loadExit(Map context) |
| 77 |
{
|
|
| 78 | 0 |
Profile profile = (Profile) context.get("PROFILE");
|
| 79 | 0 |
String text = profile.getProperty(this.key);
|
| 80 | 0 |
if (text == null) |
| 81 |
{
|
|
| 82 | 0 |
profile.setProperty(this.key, ""); |
| 83 |
} |
|
| 84 |
} |
|
| 85 |
} |
|
| 86 |
} |
|
| 87 |
|
|
||||||||||