private List parseRequestMods()

in src/main/java/org/apache/directory/fortress/web/panel/AuditModDetailPanel.java [217:262]


        private List<RequestMod> parseRequestMods( List<String> mods )
        {
            List<RequestMod> results = new ArrayList<>();
            if ( CollectionUtils.isNotEmpty( mods ) )
            {
                Mod mod = ( Mod ) detailForm.getModelObject();
                if ( mod != null && CollectionUtils.isNotEmpty( mod.getReqMod() ) )
                {
                    int ctr = 1;
                    for ( String szMod : mod.getReqMod() )
                    {
                        int indx = szMod.indexOf( ':' );
                        if ( indx != -1 )
                        {
                            String szName = szMod.substring( 0, indx );
                            String szValue = "";
                            // ensure value not blank:
                            if ( szMod.length() > indx + MOD_OFFSET && !szName.equalsIgnoreCase( GlobalIds.JPEGPHOTO ) )
                            {
                                szValue = szMod.substring( indx + MOD_OFFSET );
                            }
                            RequestMod requestMod = new RequestMod( ctr++, szName, szValue );
                            char type = szMod.charAt( indx + 1 );
                            if ( type == '=' )
                            {
                                requestMod.setType( RequestMod.TYPE.UPDATE );
                            }
                            else if ( type == '+' )
                            {
                                requestMod.setType( RequestMod.TYPE.ADD );
                            }
                            else if ( type == '-' )
                            {
                                requestMod.setType( RequestMod.TYPE.DELETE );
                            }
                            else
                            {
                                requestMod.setType( RequestMod.TYPE.UNKNOWN );
                            }
                            results.add( requestMod );
                        }
                    }
                }
            }
            return results;
        }