Exemplo n.º 1
0
        public Route getRouteWithDefaultValue()
        {
            Route route = new Route();

            route.setOwnerType ( _default.getOwnerType());
            route.setOwner ( _default.getOwner());
            route.setNs( _default.getNs() );
            route.setController ( _default.getController());
            route.setAction ( _default.getAction());
            route.setQuery ( _default.getQuery());
            route.setId( _default.getId() );
            route.setAppId( _default.getAppId() );
            route.setPage( _default.getPage() );

            route.setItem( "ownertype", route.ownerType );
            route.setItem( "owner", route.owner );
            route.setItem( "namespace", route.ns );
            route.setItem( "controller", route.controller );
            route.setItem( "action", route.action );
            route.setItem( "query", route.query );
            route.setItem( "id", route.id );
            route.setItem( "appId", route.appId );
            route.setItem( "page", route.page );

            return route;
        }
Exemplo n.º 2
0
        private static void setStrongTypeValue(Route result)
        {
            if (result.getItem("controller") != null)
            {
                result.setController(result.getItem("controller"));
            }
            if (result.getItem("action") != null)
            {
                result.setAction(result.getItem("action"));
            }
            if (result.getItem("query") != null)
            {
                result.setQuery(result.getItem("query"));
            }
            if (result.getItem("owner") != null)
            {
                result.setOwner(result.getItem("owner"));
            }
            if (result.getItem("ownertype") != null)
            {
                result.setOwnerType(result.getItem("ownertype"));
            }
            if (result.getItem("id") != null)
            {
                result.setId(cvt.ToLong(result.getItem("id")));
            }
            if (result.getItem("appid") != null)
            {
                result.setAppId(cvt.ToLong(result.getItem("appid")));
            }

            int page = 1;

            if (result.getItem("page") != null)
            {
                int routePage = Requirements.getPageNumber(result.getItem("page"));
                if (routePage > 1)
                {
                    page = routePage;
                }
            }

            result.setItem("page", page);
            result.setPage(page);
            CurrentRequest.setCurrentPage(page);
        }
Exemplo n.º 3
0
        public Route getRouteWithDefaultValue()
        {
            Route route = new Route();

            route.setOwnerType(_default.getOwnerType());
            route.setOwner(_default.getOwner());
            route.setNs(_default.getNs());
            route.setController(_default.getController());
            route.setAction(_default.getAction());
            route.setQuery(_default.getQuery());
            route.setId(_default.getId());
            route.setPage(_default.getPage());

            route.setItem("ownertype", route.ownerType);
            route.setItem("owner", route.owner);
            route.setItem("namespace", route.ns);
            route.setItem("controller", route.controller);
            route.setItem("action", route.action);
            route.setItem("query", route.query);
            route.setItem("id", route.id);
            route.setItem("page", route.page);

            return(route);
        }
Exemplo n.º 4
0
        private static Route parseControllerAndAction( String[] arrPath, String mapController, Route x )
        {
            String action = arrPath[1];
            x.setController( mapController );
            x.setAction( action );

            return x;
        }
Exemplo n.º 5
0
        private static Route parseCAndAId( String[] arrPath, String mapController, Route x )
        {
            String[] arrValue = mapController.Split( '.' );
            String action = arrValue[arrValue.Length - 1];
            String controller = strUtil.TrimEnd( mapController, action ).TrimEnd( '.' );
            x.setController( controller );
            x.setAction( action );
            x.setId( cvt.ToInt( arrPath[1] ) );

            return x;
        }
Exemplo n.º 6
0
        private static Route parseActionId( String[] arrPath, String mapController, Route x )
        {
            String id = arrPath[2];
            if (cvt.IsInt( id ) == false) return null;

            String action = arrPath[1];
            x.setController( mapController );
            x.setAction( action );
            x.setId( cvt.ToInt( arrPath[2] ) );

            return x;
        }
Exemplo n.º 7
0
 private static Route getEqualMap( KeyValuePair<String, String> kv, Route x )
 {
     String[] arr = kv.Value.Split( '.' );
     String action = arr[arr.Length - 1];
     String controller = strUtil.TrimEnd( kv.Value, action ).TrimEnd( '.' );
     x.setController( controller );
     x.setAction( action );
     return x;
 }
Exemplo n.º 8
0
        private static void setDefaultAction( Route route ) {

            if (strUtil.HasText( route.action )) return;

            if (route.id > 0)
                route.setAction( "Show" );
            else
                route.setAction( "Index" );
        }
Exemplo n.º 9
0
        private static void setStrongTypeValue( Route result ) {

            if (result.getItem( "controller" ) != null) result.setController( result.getItem( "controller" ) );
            if (result.getItem( "action" ) != null) result.setAction( result.getItem( "action" ) );
            if (result.getItem( "query" ) != null) result.setQuery( result.getItem( "query" ) );
            if (result.getItem( "owner" ) != null) result.setOwner( result.getItem( "owner" ) );
            if (result.getItem( "ownertype" ) != null) result.setOwnerType( result.getItem( "ownertype" ) );
            if (result.getItem( "id" ) != null) result.setId( cvt.ToLong( result.getItem( "id" ) ) );
            if (result.getItem( "appid" ) != null) result.setAppId( cvt.ToLong( result.getItem( "appid" ) ) );

            int page = 1;
            if (result.getItem( "page" ) != null) {
                int routePage = Requirements.getPageNumber( result.getItem( "page" ) );
                if (routePage > 1) page = routePage;
            }

            result.setItem( "page", page );
            result.setPage( page );
            CurrentRequest.setCurrentPage( page );
        }