Package org.foafrealm.manage

Examples of org.foafrealm.manage.Person


   
   
    if(results!=null) {
      for(QueryRow qr:results) {
 
        Person person = PersonFactory.findPerson(qr.getValue(results.getVariables().get(0)).toString());
        if (person == null) {
          person = PersonFactory.createPerson(qr.getValue(results.getVariables().get(0)).toString(), null, false);
        }
       
        boolean isOnList = false;
        for (Person p : authors) {
          if (person.getMbox().toString().equals(p.getMbox())) {
            isOnList = true;
            //System.out.println("bedzie break");
            break;
          }
        }
        // if current author is not on the list yet, add it
        if (isOnList == false) {
         
          try
          {
            QueryResultTable results2 = model.querySelect(RdfQuery.RDF_GET_PERSON_INFO.toString( person.getMbox().toString()),"SPARQL");
           
            if (results2 != null) {
              for(QueryRow qr2 : results2) {
           
                try {
                  if (qr2.getLiteralValue(results2.getVariables().get(1)) != null) {
                    //System.out.println("..."+results2.getValue(0, 1).toString());
                    person.setName(qr2.getLiteralValue(results2.getVariables().get(1)));
                  }
                } catch(Exception e) {/* ignore */}
                try {
                  if (qr2.getLiteralValue(results2.getVariables().get(2)) != null) {
                    person.setGivenname(qr2.getLiteralValue(results2.getVariables().get(2)));
                  }
                } catch(Exception e) {/* ignore */}
                try {
                  if (qr2.getLiteralValue(results2.getVariables().get(3)) != null) {
                    person.setFamily_name(qr2.getLiteralValue(results2.getVariables().get(3)));
                  }
                } catch(Exception e) {/* ignore */}
              }
            }
            authors.add(person);
 
View Full Code Here


        */
         
        tempModel.addStatement(stmt.getSubject(),model.createURI(FOAF.maker.toString()),stmt.getObject());
        tempModel.addStatement(stmt.getObject().asURI(), RDF.type, model.createURI(FOAF.Person.toString()));
       
        Person tmpPerson = null;
        for (Person p : authors) {
          if (!addedAuthors.contains(p) && stmt.getObject().toString().equals(p.getMbox().toString())) {
            tmpPerson = p;
            break;
          }
        }
       
        //System.out.println(s.getObject().toString());
        if (tmpPerson != null) {
          tempModel.addStatement(stmt.getObject().asURI(),model.createURI(FOAF.mbox.toString()),tmpPerson.getMbox().toString());
         
          if (tmpPerson.getName() != null && !"".equals(tmpPerson.getName()) && !"nullnull".equals(tmpPerson.getName())) {
            tempModel.addStatement(stmt.getObject().asURI(),model.createURI(FOAF.name.toString()),tmpPerson.getName());
          }
          if (tmpPerson.getGivenname() != null && !"".equals(tmpPerson.getGivenname())) {
            tempModel.addStatement(stmt.getObject().asURI(),model.createURI(FOAF.givenname.toString()),tmpPerson.getGivenname());
          }
          if (tmpPerson.getFamily_name() != null && !"".equals(tmpPerson.getFamily_name())) {
            tempModel.addStatement(stmt.getObject().asURI(),model.createURI(FOAF.family_name.toString()),tmpPerson.getFamily_name());
          }
          addedAuthors.add(tmpPerson);
        }
      }
     
View Full Code Here

      //Get name and description
      dd.setName(xsscf.getLabel());
      dd.setDescription(xsscf.getComment());
      XResource xfr = xsscf.getIssuedBy();
      if(xfr instanceof Person) {
        Person tmp = (Person)xfr;
        dd.setOwner(tmp.getName());
      }
     
      //list of avaliable taxonomies
      Map<String,String> taxonomies = new HashMap<String,String>();
     
View Full Code Here

      }
    }
    //this is the case when new friend is added to the tree.
    else if(initialLevel==0&&root==null)
    {
      Person person = PersonFactory.findPerson(resource.getStringURI());
      bookmarksTreePerson(person, viewer, buffer, depth, session, null, initialLevel, true, standalone, serviceAddr,selectedUri);
    }
   
    //remove last before returning to the page.
    if(buffer!=null&&buffer.length()!=0)
View Full Code Here

      Person viewer, StringBuilder buffer, Integer depth,
      HttpSession session,Iterator<? extends XResource> it,int _level,
      boolean parentIsOwner,boolean standalone,boolean inOwn,
      String selectedUri,Set<List<String>> pathsToUri) {

    Person owner = null;
    boolean isOwner = false;
    int level = _level;
    boolean onPath = false;
    boolean isDyn = false;
   
View Full Code Here

      HttpSession session, Iterator<? extends XResource> it,int _level,
      boolean parentIsOwner,boolean standalone,
      boolean isSuggested,boolean inOwn,String serviceAddr,String selectedUri,
      Set<List<String>> pathsToUri) {
   
    Person issuer = null;
    int level = _level;
    XResource xfr = resource.getIssuedBy();
    if(xfr instanceof Person)
      issuer = (Person)xfr;
   
    boolean isDir = resource.isDirectory();
    boolean isOwner = false;
    boolean hasContent = resource.hasContent();
    boolean reachable = checkCredit(viewer, resource);
    boolean isDyn = false;
    boolean isDiu = false; //is del.icio.us main directory
    boolean onPath = false;
   
    if(!isOwner&&resource.checkIsImportRootDir())  //TODO: resource.getStringURI().startsWith("http://del.icio.us/"))
    {
      isDyn = true;
      isDiu = true;
    }
   
    if(issuer!=null) isOwner = viewer.equals(issuer);
    if(isOwner==false&&resource.getIssuedBy()!=null) {
      if(resource.getIssuedBy() instanceof SscfTagger) {
        SscfTagger st =(SscfTagger)(resource.getIssuedBy());
        isOwner = st.isConnectedWithPerson(viewer);
        if(isOwner) issuer = viewer;
        else {issuer = st.getConnectedPerson();}
      }
    }
     
    if(hasContent==false) hasContent = resource.hasSuggestedContent();
   
    if(reachable)
    {
      level++;
     
      NodeContainer nc = new NodeContainer();
     
      //** selected link/filtering **
      Set<List<String>> newPathsToUri = pathsToUri;
     
      if(pathsToUri!=null)
      {
        //check if node is on one of the paths in pathsToUri - if yes cut off this path
        for(List<String> path:pathsToUri)
        {
          if(!path.isEmpty())
            if(path.get(0).equals(resource.getStringURI()))
            {
              onPath = true;
              break;
            }
        }
       
        //if the current node is on some path - rewrite the list, and remove current node from it.
        if(onPath)
        {
          newPathsToUri = new HashSet<List<String>>();
          for(List<String> path:pathsToUri)
          {
            if(!path.isEmpty())
              if(path.get(0).equals(resource.getStringURI()))
              {
                path.remove(0);
              }
           
            if(!path.isEmpty())
            {
              newPathsToUri.add(path);
            }
          }
        }
      } 
     
      //need to think some more wise way to tell when script should stop go deeper
      //FIXME: del.icio.us would be always dynamic!
      if(level>=maxAbsoluteLevel&&hasContent&&!onPath) {
        isDyn = true;
      }
      nc.setDyn(isDyn);
     
      //special case for filtering and user's own directory. there is no need to generate elements
      //that has been already generated.
      //maxAbsoluteLevel==0 means that there is filtering mode enabled
      boolean isSelected = false;
      if(selectedUri!=null&&!"".equals(selectedUri.trim())) {
        isSelected = (resource.getStringURI().equals(selectedUri));
        if(!isSelected&&selectedUri.length()>40)
          isSelected = resource.getStringURI().endsWith(selectedUri.substring(selectedUri.length()-40,selectedUri.length()));
      }
     
      if(maxAbsoluteLevel!=0||onPath||isSelected||!isOwner)
      {
        if(isDiu)
        {
          nc.setType("diuDirectory");
         
          if(onPath)
          {
            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)
        {
          nc.setType("sugDirectory");
          SugDirectoryNode sdn = new SugDirectoryNode();
          sdn.setId(resource.getResource().toString());
          sdn.setLevel(level);
          sdn.setLabel(resource.getLabel());
          sdn.setOwnerMbox((issuer != null) ? (issuer.getId()) : "");
          sdn.setOwnerName((issuer != null) ? (issuer.getName()) : "");
         
          sdn.setOpened(onPath);
         
          //check if user select this directory - we can get id or whole uri.
          if(isSelected)
View Full Code Here

       
        String labelOfFeed = null;
        //in case we have top-level - user feed
        if(feed.getUserid().endsWith(feed.getDirid()))
        {
          Person p = PersonFactory.findPerson(feed.getDirid());
          if(p!=null) {
            labelOfFeed = p.getName();
          }
        }
        else {
          XfoafSscfResource xfsr = XfoafSscfResource.getXfoafSscfResource(feed.getDirid());
          labelOfFeed = xfsr.getLabel();
View Full Code Here

  public void processRequest(HttpServletRequest req, HttpServletResponse resp) throws IOException, ServletException {

    String resource = req.getParameter("resource");
    String user = req.getParameter("user");
   
    Person person = PersonFactory.getPersonIfExists(user, null);
   
    UserRecommendationPrefs[] urpTable = RecommendationUtils.getUserRecommendationPrefs(person);
    RecommendationPlugin[] wholeResult = new AbstractRecommendationPlugin[urpTable.length];
    Set<Recommendation> overallRecommendation = new TreeSet<Recommendation>(new RecommendationComparator<Recommendation>());
    int overallLimit = 0;
View Full Code Here

    processRequest(req, resp);
  }

  public void processRequest(HttpServletRequest req, HttpServletResponse resp) throws IOException, ServletException {
   
    Person person = FoafManageHelper.getFMHInstance().getLoggedPerson(req);
     
    //first case - getting to RecommendationsPrefs site from outside (we have to fill the form appropriately)
    if(req.getParameter("changed") == null) {
       
      UserRecommendationPrefs[] urp = RecommendationUtils.getUserRecommendationPrefs(person);
View Full Code Here

  {
    //lets get all hidden nodes from the db
    StringBuilder sb = new StringBuilder();
   
    //1. prepare person
    Person personObj = PersonFactory.findPerson(person);
   
    //2. fill sb with paths to bookmarks
    SscfHelper2.getInstance().treeBookmarks(null, sb, personObj,
      new Integer(8), personObj, /*standalone*/true, req.getSession(),-1,
      false,false,serviceAddr,null,uri);
View Full Code Here

TOP

Related Classes of org.foafrealm.manage.Person

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.