@Override
    public void actionCommit() {

        List<Throwable> errors = new ArrayList<Throwable>();

        try {
            if (!Boolean.valueOf(getParamEditall()).booleanValue()) {
                // fill the values
                Iterator<CmsUserAddInfoBean> it = m_addInfoList.iterator();
                while (it.hasNext()) {
                    CmsUserAddInfoBean infoBean = it.next();
                    if (infoBean.getValue() == null) {
                        m_user.deleteAdditionalInfo(infoBean.getName());
                    } else {
                        m_user.setAdditionalInfo(
                            infoBean.getName(),
                            CmsDataTypeUtil.parse(infoBean.getValue(), infoBean.getType()));
                    }
                }
            } else {
                Map<String, Object> readOnly = new HashMap<String, Object>();
                Iterator<Entry<String, Object>> itEntries = m_user.getAdditionalInfo().entrySet().iterator();
                while (itEntries.hasNext()) {
                    Entry<String, Object> entry = itEntries.next();
                    if (!CmsDataTypeUtil.isParseable(entry.getValue().getClass())) {
                        String key = entry.getKey().toString();
                        if (!entry.getValue().getClass().equals(String.class)) {
                            key += "@" + entry.getValue().getClass().getName();
                        }
                        if (m_addInfoReadOnly.containsKey(key)) {
                            readOnly.put(entry.getKey(), entry.getValue());
                        }
                    }
                }
                m_user.setAdditionalInfo(readOnly);
                itEntries = m_addInfoEditable.entrySet().iterator();
                while (itEntries.hasNext()) {
                    Entry<String, Object> entry = itEntries.next();
                    String key = entry.getKey();
                    int pos = key.indexOf("@");
                    if (pos < 0) {
                        m_user.setAdditionalInfo(key, entry.getValue());
                        continue;
                    }
                    String className = key.substring(pos + 1);
                    key = key.substring(0, pos);
                    Class<?> clazz;
                    try {
                        // try the class name
                        clazz = Class.forName(className);
                    } catch (Throwable e) {
                        try {
                            // try the class in the java.lang package
                            clazz = Class.forName(Integer.class.getPackage().getName() + "." + className);
                        } catch (Throwable e1) {
                            clazz = String.class;
                        }
                    }
                    m_user.setAdditionalInfo(key, CmsDataTypeUtil.parse((String)entry.getValue(), clazz));
                }
            }

            // write the edited user
            getCms().writeUser(m_user);
        } catch (Throwable t) {
            errors.add(t);
        }

        if (errors.isEmpty()) {
            if (getCurrentToolPath().endsWith("/orgunit/users/edit/addinfo/all")) {
                // set closelink
                Map<String, String[]> argMap = new HashMap<String, String[]>();
                argMap.put(A_CmsEditUserDialog.PARAM_USERID, new String[] {m_user.getId().toString()});
                argMap.put("oufqn", new String[] {m_user.getOuFqn()});
                setParamCloseLink(
                    CmsToolManager.linkForToolPath(
                        getJsp(),
                        getCurrentToolPath().substring(
                            0,
                            getCurrentToolPath().indexOf("/orgunit/users/edit/addinfo/all")) + "/orgunit/users/edit/",
                        argMap));
            }
        }

        // set the list of errors to display when saving failed
        setCommitErrors(errors);
    }
@ Override public void actionCommit ( ) { List < Throwable > errors = new ArrayList < Throwable > ( ) ; try { if ( ! Boolean . valueOf ( getParamEditall ( ) ) . booleanValue ( ) ) { Iterator < CmsUserAddInfoBean > it = m_addInfoList . iterator ( ) ; while ( it . hasNext ( ) ) { CmsUserAddInfoBean infoBean = it . next ( ) ; if ( infoBean . getValue ( ) == null ) { m_user . deleteAdditionalInfo ( infoBean . getName ( ) ) ; } else { m_user . setAdditionalInfo ( infoBean . getName ( ) , CmsDataTypeUtil . parse ( infoBean . getValue ( ) , infoBean . getType ( ) ) ) ; } } } else { Map < String , Object > readOnly = new HashMap < String , Object > ( ) ; Iterator < Entry < String , Object > > itEntries = m_user . getAdditionalInfo ( ) . entrySet ( ) . iterator ( ) ; while ( itEntries . hasNext ( ) ) { Entry < String , Object > entry = itEntries . next ( ) ; if ( ! CmsDataTypeUtil . isParseable ( entry . getValue ( ) . getClass ( ) ) ) { String key = entry . getKey ( ) . toString ( ) ; if ( ! entry . getValue ( ) . getClass ( ) . equals ( String . class ) ) { key += "@" + entry . getValue ( ) . getClass ( ) . getName ( ) ; } if ( m_addInfoReadOnly . containsKey ( key ) ) { readOnly . put ( entry . getKey ( ) , entry . getValue ( ) ) ; } } } m_user . setAdditionalInfo ( readOnly ) ; itEntries = m_addInfoEditable . entrySet ( ) . iterator ( ) ; while ( itEntries . hasNext ( ) ) { Entry < String , Object > entry = itEntries . next ( ) ; String key = entry . getKey ( ) ; int pos = key . indexOf ( "@" ) ; if ( pos < 0 ) { m_user . setAdditionalInfo ( key , entry . getValue ( ) ) ; continue ; } String className = key . substring ( pos + 1 ) ; key = key . substring ( 0 , pos ) ; Class < ? > clazz ; try { clazz = Class . forName ( className ) ; } catch ( Throwable e ) { try { clazz = Class . forName ( Integer . class . getPackage ( ) . getName ( ) + "." + className ) ; } catch ( Throwable e1 ) { clazz = String . class ; } } m_user . setAdditionalInfo ( key , CmsDataTypeUtil . parse ( ( String ) entry . getValue ( ) , clazz ) ) ; } } getCms ( ) . writeUser ( m_user ) ; } catch ( Throwable t ) { errors . add ( t ) ; } if ( errors . isEmpty ( ) ) { if ( getCurrentToolPath ( ) . endsWith ( "/orgunit/users/edit/addinfo/all" ) ) { Map < String , String [ ] > argMap = new HashMap < String , String [ ] > ( ) ; argMap . put ( A_CmsEditUserDialog . PARAM_USERID , new String [ ] { m_user . getId ( ) . toString ( ) } ) ; argMap . put ( "oufqn" , new String [ ] { m_user . getOuFqn ( ) } ) ; setParamCloseLink ( CmsToolManager . linkForToolPath ( getJsp ( ) , getCurrentToolPath ( ) . substring ( 0 , getCurrentToolPath ( ) . indexOf ( "/orgunit/users/edit/addinfo/all" ) ) + "/orgunit/users/edit/" , argMap ) ) ; } } setCommitErrors ( errors ) ; }
Commits the edited user to the db.<p>