Package com.scooterframework.web.route

Examples of com.scooterframework.web.route.Resource


     *
     * @param resourceName     name of the resource
     * @return resource
     */
    public static Resource resource(String resourceName) {
        Resource resource = MatchMaker.getInstance().getResource(resourceName);
        if (resource == null) {
            //throw new IllegalArgumentException("\"" + resourceName + "\"" +
            //            " is not defined as a resource.");
            resource = new Resource(resourceName, true);
        }
        return resource;
    }
View Full Code Here


     *
     * @param model     model name
     * @return resource
     */
    public static Resource resourceForModel(String model) {
        Resource resource = MatchMaker.getInstance().getResourceForModel(model);
        if (resource == null) {
            //throw new IllegalArgumentException("\"" + model + "\"" +
            //            " is not defined as a model name for a resource.");
            resource = new Resource(model, true);
        }
        return resource;
    }
View Full Code Here

    }
   
    private static String _resourceRecordPath(String resourceName, String resourceId, Map<String, String> fieldValues) {
      if (M.isEmpty(resourceId)) return "";
     
        Resource resource = resource(resourceName);
        String path = "";
        if (resource.isSingle()) {
            path = resource.getScreenURL(fieldValues);
        }
        else {
            path = resource.getScreenURL(fieldValues) + "/" + resourceId;
        }
        return path;
    }
View Full Code Here

    public static String editResourceRecordPath(String resourceName, String resourceId) {
        return _editResourceRecordPath(resourceRecordPath(resourceName, resourceId));
    }
   
    private static String _formForAddResource(String pathTOResource, String resourceName) {
        Resource resource = resource(resourceName);
        String name = "add_" + resource.getModel();
        String id = name;
        StringBuilder sb = new StringBuilder();
        sb.append("<form action=\"").append(W.getURL(pathTOResource));
        sb.append("\" class=\"").append(name).append("\" id=\"").append(id).append("\" method=\"POST\">");
        return sb.toString();
View Full Code Here

    public static String formForEditResourceRecord(String resourceName, RESTified record) {
        return formForEditResourceRecord(resourceName, getRestfulId(record));
    }
   
    private static String _formForEditResourceRecord(String pathToResourceId, String resourceName, String resourceId) {
        Resource resource = resource(resourceName);
        String name = "edit_" + resource.getModel();
        String id = name + "_" + resourceId;
        StringBuilder sb = new StringBuilder();
        sb.append("<form action=\"").append(W.getURL(pathToResourceId));
        sb.append("\" class=\"").append(name).append("\" id=\"").append(id).append("\" method=\"POST\">").append("\n");
        sb.append("<div style=\"margin:0;padding:0\"><input name=\"");
View Full Code Here

    }
   
   
   
    private static Resource _parentResource(String parentResourceName) {
        Resource resource = MatchMaker.getInstance().getResource(parentResourceName);
        if (resource == null) {
            resource = new Resource(parentResourceName, true);
        }
        return resource;
    }
View Full Code Here

TOP

Related Classes of com.scooterframework.web.route.Resource

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.