Package org.corrib.s3b.sscf.tools.sscf2js

Examples of org.corrib.s3b.sscf.tools.sscf2js.DirectoryNode


     
      hasContent = sfr.hasContent();
   
      nc.setType("siocForum");
     
      DirectoryNode dn = new DirectoryNode();
      dn.setId(sfr.getStringURI());
      dn.setLevel(level);
     
      if(sfr.getName()!=null&&!"".equals(sfr.getName()))
        dn.setLabel("Forum: "+sfr.getName());
      else if(sfr.getTitle()!=null&&!"".equals(sfr.getTitle()))
        dn.setLabel("Forum: "+sfr.getTitle());
      else dn.setLabel("Forum: "+sfr.getStringURI());
      dn.setOwn(isOwner);
      //TODO - get owner from this tags
      //dn.setOwnerMbox((owner != null) ? (owner.getMbox().toString()) : "");
      //dn.setOwnerName((owner != null) ? (owner.getName()) : "");
      dn.setOwnerMbox("");
      dn.setOwnerName("");
      dn.setRemovable(!hasContent);
      dn.setLinkedIn(parentIsOwner&!isOwner);
     
      //check if user select this directory - we can get id or whole uri.
      if(selectedUri!=null&&!"".equals(selectedUri.trim())&&selectedUri.length()>=40)
      {
        if(resource.getStringURI().equals(selectedUri)||
            resource.getStringURI().endsWith(selectedUri.substring(selectedUri.length()-40,selectedUri.length())))
        {
          dn.setSelected(true);
          dn.setOpened(false);
        }
        else dn.setSelected(false);
      }
     
      dn.setStandalone(standalone);
      nc.setContent(dn);

    }
    else if (resource instanceof SiocSiteResource) {
      SiocSiteResource ssr = SiocSiteResource.getInstance(resource.getStringURI());
     
      hasContent = ssr.hasContent();

      nc.setType("siocSite");
   
      DirectoryNode dn = new DirectoryNode();
      dn.setId(resource.getResource().toString());
      dn.setLevel(level);
      dn.setLabel("Site: "+ssr.getTitle());
      dn.setOwn(isOwner);
      //TODO - get owner from this tags
      //dn.setOwnerMbox((owner != null) ? (owner.getMbox().toString()) : "");
      //dn.setOwnerName((owner != null) ? (owner.getName()) : "");
      dn.setOwnerMbox("");
      dn.setOwnerName("");   
      dn.setRemovable(!hasContent);
      dn.setLinkedIn(parentIsOwner&!isOwner);
     
      //check if user select this directory - we can get id or whole uri.
      if(selectedUri!=null&&!"".equals(selectedUri.trim())&&selectedUri.length()>=40)
      {
        if(resource.getStringURI().equals(selectedUri)||
            resource.getStringURI().endsWith(selectedUri.substring(selectedUri.length()-40,selectedUri.length())))
        {
          dn.setSelected(true);
          dn.setOpened(false);
        }
        else dn.setSelected(false);
      }
     
      dn.setStandalone(standalone);
      nc.setContent(dn);
    }
   
    //add created nodes to the buffer
    nc.toJSON(buffer);
View Full Code Here


          {
            isDyn = false;
            nc.setDyn(isDyn);
          }
         
          DirectoryNode dn = new DirectoryNode();
          dn.setId(resource.getResource().toString());
         
          dn.setLevel(level);
         
          String label = resource.getStringURI();
          if(label.length()>9)
            label = label.substring(0,label.length()-9);
          dn.setLabel(label+" bookmarks");
               
          dn.setOwn(isOwner);
          dn.setOwnerMbox((issuer != null) ? (issuer.getId()) : "");
          dn.setOwnerName((issuer != null) ? (issuer.getName()) : "");
          dn.setRemovable(!hasContent);
          dn.setLinkedIn(parentIsOwner&!isOwner);
         
          dn.setOpened(onPath);
         
          dn.setStandalone(standalone);
          nc.setContent(dn);
        }
        //normal directory
        else if(isDir&&!isSuggested)
        {
          nc.setType("directory");
          DirectoryNode dn = new DirectoryNode();
          dn.setId(resource.getResource().toString());
         
          dn.setLevel(level);
         
          if(resource.getLabel().contains("\"")||resource.getLabel().contains("'"))
          {
            dn.setLabel("bleble "+resource.getLabel().replace("\"", "\\\"").replace("'","\\'"));
          }
          else if(resource.getLabel().trim().equals(""))
          {
            dn.setLabel(resource.getStringURI());
          }
          else
          {
            dn.setLabel(resource.getLabel());
          }
               
          dn.setOwn(isOwner);
          dn.setOwnerMbox((issuer != null) ? (issuer.getId()) : "");
          dn.setOwnerName((issuer != null) ? (issuer.getName()) : "");
          dn.setRemovable(!hasContent);
          dn.setLinkedIn(parentIsOwner&!isOwner);
         
          dn.setOpened(onPath);
         
          //check if user select this directory - we can get id or whole uri.
          if(isSelected)
          {
            dn.setSelected(true);
            dn.setOpened(false);
          }
          else dn.setSelected(false);
         
         
          dn.setStandalone(standalone);
          nc.setContent(dn);
        }
        //suggested directory
        else if(isDir&&isSuggested)
        {
View Full Code Here

        //set dynamic load
        nc.setDyn(true);

        //Web bookmark
        nc.setType("directory");
        DirectoryNode dn = new DirectoryNode();

        dn.setId(wbr.getResource().toString());

        dn.setLabel((wbr.getLabel()!=null&&!"".equals(wbr.getLabel())) ? escapeForJs(wbr.getLabel()) : wbr.getStringURI().toString() );

        int level = 3;
        dn.setLevel(level);
        dn.setOwn(true)
        dn.setStandalone(false);
        nc.setContent(dn);

        //add created nodes to the buffer
       
        jsonArray.add(nc.toJSONObject());
View Full Code Here

TOP

Related Classes of org.corrib.s3b.sscf.tools.sscf2js.DirectoryNode

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.