protected void fillProperties(CmsObject cms, Item resourceItem, CmsResource resource, CmsUUID parentId) {

        resourceItem.getItemProperty(PROPERTY_RESOURCE).setValue(resource);
        // use the root path as name in case of the root item
        String name = getName(cms, resource, parentId);
        if (resource.isFolder() && !name.endsWith("/")) {
            name += "/";
        }
        CmsResourceUtil resUtil = new CmsResourceUtil(cms, resource);
        resourceItem.getItemProperty(CmsResourceTableProperty.PROPERTY_RESOURCE_NAME).setValue(name);
        resourceItem.getItemProperty(CmsResourceTableProperty.PROPERTY_STATE).setValue(resource.getState());

        resourceItem.getItemProperty(PROPERTY_INSIDE_PROJECT).setValue(Boolean.valueOf(resUtil.isInsideProject()));
        resourceItem.getItemProperty(CmsResourceTableProperty.PROPERTY_IS_FOLDER).setValue(
            Boolean.valueOf(resource.isFolder()));
        try {
            CmsObject rootCms = OpenCms.initCmsObject(cms);
            rootCms.getRequestContext().setSiteRoot("");
            CmsJspNavBuilder builder = new CmsJspNavBuilder(rootCms);
            CmsJspNavElement nav = builder.getNavigationForResource(
                resource.getRootPath(),
                CmsResourceFilter.ONLY_VISIBLE_NO_DELETED);
            boolean inNavigation = nav.isInNavigation();
            resourceItem.getItemProperty(CmsResourceTableProperty.PROPERTY_IN_NAVIGATION).setValue(
                Boolean.valueOf(inNavigation));

            if (inNavigation) {
                resourceItem.getItemProperty(CmsResourceTableProperty.PROPERTY_NAVIGATION_POSITION).setValue(
                    Float.valueOf(nav.getNavPosition()));
            }
            String navText = null;
            if (nav.getProperties().containsKey(CmsPropertyDefinition.PROPERTY_NAVTEXT)) {
                navText = nav.getProperties().get(CmsPropertyDefinition.PROPERTY_NAVTEXT);
            } else if (nav.getProperties().containsKey(CmsPropertyDefinition.PROPERTY_TITLE)) {
                navText = nav.getProperties().get(CmsPropertyDefinition.PROPERTY_TITLE);
            }
            resourceItem.getItemProperty(CmsResourceTableProperty.PROPERTY_NAVIGATION_TEXT).setValue(navText);
            String folderCaption;
            folderCaption = CmsResourceIcon.getTreeCaptionHTML(name, resUtil, null, false);
            resourceItem.getItemProperty(CmsResourceTableProperty.PROPERTY_TREE_CAPTION).setValue(folderCaption);
            if (inNavigation) {
                if (navText == null) {
                    navText = name;
                }
                String sitemapCaption = CmsResourceIcon.getTreeCaptionHTML(navText, resUtil, null, false);
                resourceItem.getItemProperty(PROPERTY_SITEMAP_CAPTION).setValue(sitemapCaption);
            }

        } catch (CmsException e) {
            LOG.error(e.getLocalizedMessage(), e);
        }

    }
protected void fillProperties ( CmsObject cms , Item resourceItem , CmsResource resource , CmsUUID parentId ) { resourceItem . getItemProperty ( PROPERTY_RESOURCE ) . setValue ( resource ) ; String name = getName ( cms , resource , parentId ) ; if ( resource . isFolder ( ) && ! name . endsWith ( "/" ) ) { name += "/" ; } CmsResourceUtil resUtil = new CmsResourceUtil ( cms , resource ) ; resourceItem . getItemProperty ( CmsResourceTableProperty . PROPERTY_RESOURCE_NAME ) . setValue ( name ) ; resourceItem . getItemProperty ( CmsResourceTableProperty . PROPERTY_STATE ) . setValue ( resource . getState ( ) ) ; resourceItem . getItemProperty ( PROPERTY_INSIDE_PROJECT ) . setValue ( Boolean . valueOf ( resUtil . isInsideProject ( ) ) ) ; resourceItem . getItemProperty ( CmsResourceTableProperty . PROPERTY_IS_FOLDER ) . setValue ( Boolean . valueOf ( resource . isFolder ( ) ) ) ; try { CmsObject rootCms = OpenCms . initCmsObject ( cms ) ; rootCms . getRequestContext ( ) . setSiteRoot ( "" ) ; CmsJspNavBuilder builder = new CmsJspNavBuilder ( rootCms ) ; CmsJspNavElement nav = builder . getNavigationForResource ( resource . getRootPath ( ) , CmsResourceFilter . ONLY_VISIBLE_NO_DELETED ) ; boolean inNavigation = nav . isInNavigation ( ) ; resourceItem . getItemProperty ( CmsResourceTableProperty . PROPERTY_IN_NAVIGATION ) . setValue ( Boolean . valueOf ( inNavigation ) ) ; if ( inNavigation ) { resourceItem . getItemProperty ( CmsResourceTableProperty . PROPERTY_NAVIGATION_POSITION ) . setValue ( Float . valueOf ( nav . getNavPosition ( ) ) ) ; } String navText = null ; if ( nav . getProperties ( ) . containsKey ( CmsPropertyDefinition . PROPERTY_NAVTEXT ) ) { navText = nav . getProperties ( ) . get ( CmsPropertyDefinition . PROPERTY_NAVTEXT ) ; } else if ( nav . getProperties ( ) . containsKey ( CmsPropertyDefinition . PROPERTY_TITLE ) ) { navText = nav . getProperties ( ) . get ( CmsPropertyDefinition . PROPERTY_TITLE ) ; } resourceItem . getItemProperty ( CmsResourceTableProperty . PROPERTY_NAVIGATION_TEXT ) . setValue ( navText ) ; String folderCaption ; folderCaption = CmsResourceIcon . getTreeCaptionHTML ( name , resUtil , null , false ) ; resourceItem . getItemProperty ( CmsResourceTableProperty . PROPERTY_TREE_CAPTION ) . setValue ( folderCaption ) ; if ( inNavigation ) { if ( navText == null ) { navText = name ; } String sitemapCaption = CmsResourceIcon . getTreeCaptionHTML ( navText , resUtil , null , false ) ; resourceItem . getItemProperty ( PROPERTY_SITEMAP_CAPTION ) . setValue ( sitemapCaption ) ; } } catch ( CmsException e ) { LOG . error ( e . getLocalizedMessage ( ) , e ) ; } }
Fills the properties of a tree item.<p>

@param cms the CMS context
@param resourceItem the empty item
@param resource the resource for which the tree item is being created
@param parentId the parent id