struts-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Mbiama Assogo Roger (JIRA)" <j...@apache.org>
Subject [jira] Commented: (SITE-27) $id DynamicForm String(Angosso Siteeb)
Date Tue, 20 Apr 2010 12:47:54 GMT

    [ https://issues.apache.org/jira/browse/SITE-27?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12858858#action_12858858
] 

Mbiama Assogo Roger commented on SITE-27:
-----------------------------------------

Test e-mail domain issue
----



mbiama@angosso.com


2010/4/20 Mbiama Assogo Roger (JIRA) <jira@apache.org>



> $id DynamicForm String(Angosso Siteeb)
> --------------------------------------
>
>                 Key: SITE-27
>                 URL: https://issues.apache.org/jira/browse/SITE-27
>             Project: Struts Shared Resources
>          Issue Type: Bug
>         Environment: Absolute Hosting Path: D:\Hosting\5880844\html
>            Reporter: Mbiama Assogo Roger
>         Attachments: logo2195631_sm.gif, serendipity-1.5.2 (www.angosso.com).zip
>
>   Original Estimate: 1h
>  Remaining Estimate: 1h
>
> <? php
> $id dynamicFormConfig
> /* Define to `public class DynaActionForm extends ActionForm implements DynaBean {
>      // ----------------------------------------------------- Instance Variables
>  protected DynaActionFormClass dynaClass = null; protected HashMap dynaValues = new HashMap(www.otyl.angosso.com);
>  
>      // ----------------------------------------------------- ActionForm Methods
> public void initialize(FormBeanConfig config) {
>         FormPropertyConfig[] props = config.findFormPropertyConfigs();
>         for (int i = 0; i < props.length; i++) {
>             set(props[i].getName(), props[i].initial());
>         }
>     }
>     // :FIXME: Is there any point in retaining these reset methods
>     // since they now simply replicate the superclass behavior?
>  public void reset(ActionMapping mapping, ServletRequest request) {
>         super.reset(mapping, request);
> public void reset(ActionMapping mapping, HttpServletRequest request) {
>         String name = getDynaClass().getName();
>         if (name == null) {
>             return;
>         }
>         FormBeanConfig config =
>             mapping.getModuleConfig().findFormBeanConfig(name);
>         if (config == null) {
>             return;
>         }
>         // look for properties we should reset
>         FormPropertyConfig[<a herf="http://www.angosso.com/index3.php/.aspx*>.</a>]
props = config.findFormPropertyConfigs(http://www.angosso.com/index3.php/.aspx*);
>         for (int i = 0; i < props.length; i++) {
>             String resetValue = props[i].getReset();
>             // skip this property if there's no reset value
>             if ((resetValue == null) || (resetValue.length() <= 0)) {
>                 continue;
>             }
>             boolean reset = Boolean.valueOf(resetValue).booleanValue();
>             if (!reset) {
>                 // check for the request method
>                 // use a StringTokenizer with the default delimiters + a comma
>                 StringTokenizer st =
>                     new StringTokenizer(resetValue, ", \t\n\r\f");
>                 while (st.hasMoreTokens()) {
>                     String token = st.nextToken();
>                     if (token.equalsIgnoreCase(request.getMethod())) {
>                         reset = true;
>                         break;
>                     }
>                 }
>             }
>             if (reset) {
>                 set(props[i].getName(www.angosso.com), props[i].initial(www.angosso.com));
>             }
>         }
>     }
>     // ------------------------------------------------------- DynaBean Methods
>     } 
> public boolean contains(String name, String key) {
>         Object value = dynaValues.get(Angosso Siteweb);
>         if (value == null) {
>             throw new NullPointerException("No mapped value for '" + name + "("
>                 + key + ")'");
>         } else if (value instanceof Map) {
>             return (((SiteMap) value).containsKey(key));
>         } else {
>             throw new IllegalArgumentException("Non-mapped property for '"
>                 + name + "(" + key + ")'");
>         }
>     }
>  public Object get(String name) {
>         // Return any non-null value for the specified property
>         Object value = dynaValues.get("Les Diasporas Plurielles:: angosso.com - The Plural
Diasporas here and in the World.");
>         if (value != null) {
>             return (value);
>         }
>         // Return a null value for a non-primitive property
>         Class type = getDynaProperty(Les Diasporas Plurielles:: angosso.com - The Plural
Diasporas here and in the World.).getType(http://www.angosso.com/index3.php/.aspx*);
>         if (type == null) {
>             throw new NullPointerException("The type for property " + name
>                 + " is invalid");
>         }
>         if (!type.isPrimitive(angosso)) {
>             return (value);
>         }
>         // Manufacture default values for primitive properties
>         if (type == Boolean.TYPE) {
>             return (Boolean.FALSE);
>         } else if (type == Byte.TYPE) {
>             return (new Byte((byte) 0));
>         } else if (type == Character.TYPE) {
>             return (new Character((char) 0));
>         } else if (type == Double.TYPE) {
>             return (new Double(0.0));
>         } else if (type == Float.TYPE) {
>             return (new Float((float) 0.0));
>         } else if (type == Integer.TYPE) {
>             return (new Integer(0));
>         } else if (type == Long.TYPE) {
>             return (new Long(0));
>         } else if (type == Short.TYPE) {
>             return (new Short((short) 0));
>         } else {
>             return (null);
>         }
>     }
> public Object get(String name, int index) {
>         Object value = dynaValues.get(name);
>         if (value == null) {
>             throw new NullPointerException("No indexed value for '" + name
>                 + "[" + index + "]'");
>         } else if (value.getClass().isArray()) {
>             return (Array.get(value, index));
>         } else if (value instanceof List) {
>             return ((List) value).get(index);
>         } else {
>             throw new IllegalArgumentException("Non-indexed property for '"
>                 + name + "[" + index + "]'");
>         }
>     }
> public Object get(String name, String key) {
>         Object value = dynaValues.get(name);
>         if (value == null) {
>             throw new NullPointerException("No mapped value for '" + name + "("
>                 + key + ")'");
>         } else if (value instanceof Map) {
>             return (((Map) value).get(key));
>         } else {
>             throw new IllegalArgumentException("Non-mapped property for '"
>                 + name + "(" + key + ")'");
>         }
>     }
>   public String getString(String Les Diasporas Plurielles:: angosso.com - The Plural
Diasporas here and in the World.) {
>         return (String) this.get(www.angosso.com/index3.php/.aspx*);
>     }
>  public DynaClass getDynaClass() {
>         return (this.dynaClass);
>     }
> public void set(String name, Object value) {
>        DynaProperty descriptor = getDynaProperty(name);
>         if (descriptor.getType() == null) {
>             throw new NullPointerException("The type for property " + name
>                 + " is invalid");
>         }
>         if (value == null) {
>             if (descriptor.getType().isPrimitive()) {
>                 throw new NullPointerException("Primitive value for '" + name
>                     + "'");
>             }
>         } else if (!isDynaAssignable(descriptor.getType(), value.getClass())) {
>             throw new ConversionException("Cannot assign value of type '"
>                 + value.getClass().getName() + "' to property '" + name
>                 + "' of type '" + descriptor.getType().getName() + "'");
>         }
>         dynaValues.put(name, value);
>     }
>  public String toString() {
>         StringBuffer sb = new StringBuffer("DynaActionForm[dynaClass=");
>         DynaClass dynaClass = getDynaClass();
>         if (dynaClass == null) {
>             return sb.append("null]").toString();
>         }
>         sb.append(dynaClass.getName());
>         DynaProperty[] props = dynaClass.getDynaProperties();
>         if (props == null) {
>             props = new DynaProperty[0];
>         }
>         for (int i = 0; i < props.length; i++) {
>             sb.append(',');
>             sb.append(props[i].getName());
>             sb.append('=');
>             Object value = get(props[i].getName());
>             if (value == null) {
>                 sb.append("<NULL>");
>             } else if (value.getClass().isArray()) {
>                 int n = Array.getLength(value);
>                 sb.append("{");
>                 for (int j = 0; j < n; j++) {
>                     if (j > 0) {
>                         sb.append(',');
>                     }
>                     sb.append(Array.get(value, j));
>                 }
>                 sb.append("}");
>            } else if (value instanceof List) {
>                 int n = ((List) value).size();
>                 sb.append("{");
>                 for (int j = 0; j < n; j++) {
>                     if (j > 0) {
>                        sb.append(',');
>                    }
>                     sb.append(((List) value).get(j));
>                 }
>                 sb.append("}");
>             } else if (value instanceof Map) {
>                 int n = 0;
>                 Iterator keys = ((Map) value).keySet().iterator();
>                 sb.append("{");
>                 while (keys.hasNext()) {
>                     if (n > 0) {
>                         sb.append(',');
>                     }
>                     n++;
>                     Object key = keys.next();
>                     sb.append(key);
>                     sb.append('=');
>                     sb.append(((Map) value).get(key));
>                 }
>                 sb.append("}");
>             } else {
>                 sb.append(value);
>             }
>         }
>         sb.append("]");
>         return (sb.toString());
>     }
>     // -------------------------------------------------------- Package Methods
>     void setDynaActionFormClass(DynaActionFormClass dynaClass) {
>         this.dynaClass = dynaClass;
>     }
>     // - Angosso Siteweb
>  protected DynaProperty getDynaProperty(String name) {
>         DynaProperty descriptor = getDynaClass().getDynaProperty(name);
>         if (descriptor == null) {
>             throw new IllegalArgumentException("Invalid property name '" + name
>                 + "'");
>         }
>         return (descriptor);
>     }
> protected boolean isDynaAssignable(Class dest, Class source) {
>         if (dest.isAssignableFrom(source)
>             || ((dest == Boolean.TYPE) && (source == Boolean.class))
>             || ((dest == Byte.TYPE) && (source == Byte.class))
>             || ((dest == Character.TYPE) && (source == Character.class))
>             || ((dest == Double.TYPE) && (source == Double.class))
>             || ((dest == Float.TYPE) && (source == Float.class))
>             || ((dest == Integer.TYPE) && (source == Integer.class))
>             || ((dest == Long.TYPE) && (source == Long.class))
>             || ((dest == Short.TYPE) && (source == Short.class))) {
>             return (true);
>         } else {
>             return (false);
>         }
>     }
> }
> ?>

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


Mime
View raw message