Package org.apache.roller.pojos

Examples of org.apache.roller.pojos.WeblogCategoryData


        } else {
            cats = category.getWeblogCategories().iterator();
        }
       
        while (cats.hasNext()) {
            WeblogCategoryData possibleMatch = (WeblogCategoryData)cats.next();
            if (possibleMatch.getName().equals(pathArray[0])) {
                if (pathArray.length == 1) {
                    return possibleMatch;
                } else {
                    String[] subpath = new String[pathArray.length - 1];
                    System.arraycopy(pathArray, 1, subpath, 0, subpath.length);
View Full Code Here


        ActionForward forward = mapping.findForward("categories");
        WeblogCategoryFormEx form = (WeblogCategoryFormEx)actionForm;
        RollerRequest rreq = RollerRequest.getRollerRequest(request);
        WeblogManager wmgr = RollerFactory.getRoller().getWeblogManager();

        WeblogCategoryData cd = null;
        if (null != form.getId() && !form.getId().trim().equals(""))
        {
            cd = wmgr.getWeblogCategory(form.getId());
        }
        else
        {
            cd = new WeblogCategoryData();
            String pid = form.getParentId();
            WeblogCategoryData parentCat = wmgr.getWeblogCategory(pid);
            cd.setWebsite(parentCat.getWebsite());
            cd.setParent(parentCat);
        }

        RollerSession rses = RollerSession.getRollerSession(request);
        if (cd.getWebsite().hasUserPermissions(
View Full Code Here

            if(entry != null) {
                weblog = entry.getWebsite();
            }
        } else if (request.getParameter(RequestConstants.WEBLOGCATEGORY_ID) != null) {
            String catId = request.getParameter(RequestConstants.WEBLOGCATEGORY_ID);
            WeblogCategoryData cat = roller.getWeblogManager().getWeblogCategory(catId);
            if(cat != null) {
                weblog = cat.getWebsite();
            }
        } else if (request.getParameter(RequestConstants.FOLDER_ID) != null) {
            String folderId = request.getParameter(RequestConstants.FOLDER_ID);
            FolderData folder = roller.getBookmarkManager().getFolder(folderId);
            if(folder != null) {
View Full Code Here

        doc.add(Field.UnStored(FieldConstants.C_NAME, commentName));

        doc.add(Field.UnStored(FieldConstants.CONSTANT, FieldConstants.CONSTANT_V));

        // index Category
        WeblogCategoryData categorydata = data.getCategory();
        Field category = (categorydata == null)
           ? Field.UnStored(FieldConstants.CATEGORY, "")
           : Field.Text(FieldConstants.CATEGORY, categorydata.getName());
        doc.add(category);

        return doc;
    }
View Full Code Here

        try {
            Hashtable result = new Hashtable();
            WeblogManager weblogMgr = roller.getWeblogManager();
            List cats = weblogMgr.getWeblogCategories(website, false);
            for (Iterator wbcItr = cats.iterator(); wbcItr.hasNext();) {
                WeblogCategoryData category = (WeblogCategoryData) wbcItr.next();
                result.put(category.getPath(),
                        createCategoryStruct(category, userid));
            }
            return result;
        } catch (Exception e) {
            String msg = "ERROR in MetaWeblogAPIHandler.getCategories";
View Full Code Here

                entry.setPubTime(new Timestamp(dateCreated.getTime()));
            }
           
            if ( cat != null ) {
                // Use first category specified by request
                WeblogCategoryData cd =
                        weblogMgr.getWeblogCategoryByPath(entry.getWebsite(), cat);
                entry.setCategory(cd);
            }
           
            // save the entry
View Full Code Here

                entry.setStatus(WeblogEntryData.DRAFT);
            }
           
            // MetaWeblog supports multiple cats, Roller supports one/entry
            // so here we take accept the first category that exists
            WeblogCategoryData rollerCat = null;
            if ( postcontent.get("categories") != null ) {
                Vector cats = (Vector)postcontent.get("categories");
                if (cats != null && cats.size() > 0) {
                    for (int i=0; i<cats.size(); i++) {
                        String cat = (String)cats.get(i);
View Full Code Here

        ActionForward forward = mapping.findForward("categories");
        CategoryDeleteForm form = (CategoryDeleteForm)actionForm;
        WeblogManager wmgr = RollerFactory.getRoller().getWeblogManager();

        String catid = request.getParameter(RequestConstants.WEBLOGCATEGORY_ID);
        WeblogCategoryData catToDelete =
                wmgr.getWeblogCategory(catid);
        RollerSession rses = RollerSession.getRollerSession(request);
        if (rses.isUserAuthorizedToAuthor(catToDelete.getWebsite()))
        {
            String returnId = null;
            if (catToDelete.getParent() != null)
            {
                returnId = catToDelete.getParent().getId();
            }
            if (form.isDelete() == null)
            {
                // Present CategoryDeleteOK? page to user
                RollerRequest rreq = RollerRequest.getRollerRequest(request);
                WeblogCategoryData theCat = wmgr.getWeblogCategory(catid);
                Iterator allCats =
                    wmgr.getWeblogCategories(theCat.getWebsite()).iterator();
                List destCats = new LinkedList();
                while (allCats.hasNext())
                {
                    WeblogCategoryData cat = (WeblogCategoryData)allCats.next();
                    // Allow entries to be moved to any other category except
                    // root and the sub-cats of the category being deleted.
                    if (!cat.getId().equals(catid)
                        && cat.getParent()!=null
                        && !cat.descendentOf(catToDelete))
                    {
                        destCats.add(cat);
                    }                   
                }
                if (destCats.size() > 0)
                {
                    form.setName(theCat.getName());
                    form.setCategoryId(catid);
                    form.setCats(destCats);
                    form.setInUse(Boolean.valueOf(catToDelete.isInUse()));
                    forward = mapping.findForward("CategoryDeleteOK");
                }
                else
                {
                    // Can't delete last category, send 'em back!
                    if (null != returnId)
                    {
                        request.setAttribute(
                                RequestConstants.WEBLOGCATEGORY_ID, returnId);
                    }              
                }
            }
            else if (form.isDelete().booleanValue()) {
               
                // User clicked YES to delete
                // remove cat to delete
                if (form.getMoveToWeblogCategoryId() != null)
                {
                    WeblogCategoryData destCat =
                        wmgr.getWeblogCategory(form.getMoveToWeblogCategoryId());
                    if (rses.isUserAuthorizedToAuthor(destCat.getWebsite()))
                    {
                        wmgr.moveWeblogCategoryContents(catToDelete, destCat);               
                        RollerFactory.getRoller().flush();
                    }
                    else
View Full Code Here

                this.strategy.remove(aFolder);
            }
        }
       
        // remove categories
        WeblogCategoryData rootCat = wmgr.getRootWeblogCategory(website);
        if (null != rootCat) {
            this.strategy.remove(rootCat);
        }
       
    }
View Full Code Here

        perms.setPending(false);
        perms.setPermissionMask(PermissionsData.ADMIN);
        this.strategy.store(perms);
       
        // add default categories
        WeblogCategoryData rootCat = new WeblogCategoryData(
                null,      // id
                newWeblog, // newWeblog
                null,      // parent
                "root",    // name
                "root",    // description
                null );    // image
        this.strategy.store(rootCat);
       
        String cats = RollerConfig.getProperty("newuser.categories");
        WeblogCategoryData firstCat = rootCat;
        if (cats != null) {
            String[] splitcats = cats.split(",");
            for (int i=0; i<splitcats.length; i++) {
                WeblogCategoryData c = new WeblogCategoryData(
                        null,            // id
                        newWeblog,       // newWeblog
                        rootCat,         // parent
                        splitcats[i],    // name
                        splitcats[i],    // description
View Full Code Here

TOP

Related Classes of org.apache.roller.pojos.WeblogCategoryData

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.