1 package org.sapia.magnet.domain; 2 3 import org.sapia.magnet.render.MagnetContext; 6 import org.sapia.magnet.render.RenderingException; 7 8 9 20 public class Profile extends AbstractObjectHandler { 21 22 static Parameters EMPTY_PARAMETERS = new Parameters(); 23 24 28 29 private String _theName; 30 31 32 private Parameters _theParameters = EMPTY_PARAMETERS; 33 34 38 41 public Profile() { 42 } 43 44 48 53 public String getName() { 54 return _theName; 55 } 56 57 62 public Parameters getParameters() { 63 return _theParameters; 64 } 65 66 70 75 public void setName(String aName) { 76 _theName = aName; 77 } 78 79 84 public void setParameters(Parameters aParameters) { 85 _theParameters = aParameters; 86 } 87 88 92 98 public void render(MagnetContext aContext) throws RenderingException { 99 MagnetContext aSubContext = new MagnetContext(aContext); 100 101 try { 103 if (_theParameters != null) { 104 _theParameters.render(aSubContext); 105 } 106 } catch (RenderingException re) { 107 StringBuffer aBuffer = new StringBuffer (); 108 aBuffer.append("Unable to render the parameters of the profile "). 109 append(_theName); 110 throw new RenderingException(aBuffer.toString(), re); 111 } 112 113 try { 115 super.renderHandlerDefs(aContext); 116 } catch (RenderingException re) { 117 StringBuffer aBuffer = new StringBuffer (); 118 aBuffer.append("Unable to render the handler defs of the profile "). 119 append(_theName); 120 throw new RenderingException(aBuffer.toString(), re); 121 } 122 123 try { 125 super.render(aSubContext); 126 } catch (RenderingException re) { 127 StringBuffer aBuffer = new StringBuffer (); 128 aBuffer.append("Unable to render an object of the profile "). 129 append(_theName); 130 throw new RenderingException(aBuffer.toString(), re); 131 } 132 } 133 134 139 public String toString() { 140 StringBuffer aBuffer = new StringBuffer (super.toString()); 141 aBuffer.append("[name=").append(_theName). 142 append(" parameters=").append(_theParameters). 143 append("]"); 144 145 return aBuffer.toString(); 146 } 147 } 148 | Popular Tags |