Examples of Community


Examples of cross.reputation.model.Community

    }   
  }
 
  static private void SetAccountsInEntity(Entity entity, String userName, Collection<String> accounts) {
    for(String accountName : accounts) {
      Community community = getCommunityByAccountName(accountName);
      if(community == null)
        continue;
      EntityIdentifier id = entity.getIdentificatorInCommunities().get(community);
      if(id == null) {
        System.out.println("New account:"+entity.getUniqueIdentificator()+","+
            community.getName()+","+userName+","+accountName);
        entity.addIdentificatorInCommunities(community,
          new EntityIdentifier(userName, accountName));
      } else if(id.getUrl() == null) {
        System.out.println("Update account:"+entity.getUniqueIdentificator()+","+
            community.getName()+","+userName+","+accountName);
        id.setUrl(accountName);
      }
    }
  }
View Full Code Here

Examples of cross.reputation.model.Community

    for(Entity entity : GlobalModel.getEntities().values()) {
      Map<Community,EntityIdentifier> usuario = entity.getIdentificatorInCommunities();
      //In this form of iteration, we dont search accounts in the new accounts found or
      //  accounts updated that have already been iterated
      for(Object object : usuario.keySet().toArray()) {
        Community community = (Community) object;
        Set<String> accounts = new HashSet<String>();       
        String userName = usuario.get(community).getName();
        //System.out.println(userName+":"+community);
        String url = usuario.get(community).getUrl();
        try {
          if(url != null) {
            accounts.add(url);
            Set<String> userAccounts = Scrapper.MoreUserAccountsByURL(url);
            if(userAccounts != null) {
              accounts.addAll(userAccounts);
            }
          } else {
            List<String> userAccounts = Scrapper.UserAccounts(userName,
                community.getDomainName(), true);
            if(userAccounts != null) {
              accounts.addAll(userAccounts);
            }
          }         
        } catch (Exception e) {
          e.printStackTrace();
          ModelException.throwException(ModelException.GET_MORE_ACCOUNTS,
            "Error to get more accounts for entity:"+
            entity.getUniqueIdentificator()+" with community: "+
            community.getName()+" and user:"+userName+" from"+url);         
        }
        if(accounts != null) {
          SetAccountsInEntity(entity, userName, accounts);
        }
      }     
View Full Code Here

Examples of cross.reputation.model.Community

  }
 
  static private void SetAccountsInEntity(Entity entity,
      String userName, Collection<String> accounts) throws Exception {
    for(String accountName : accounts) {
      Community community = getCommunityByAccountName(accountName);
      if(community == null)
        continue;
      EntityIdentifier id = entity.getIdentificatorInCommunities().get(community);
      if(id == null) {
        ModelException.sendMessage(ModelException.INFO,
            "New account:"+entity.getUniqueIdentificator()+","+
            community.getName()+","+userName+","+accountName);
        entity.addIdentificatorInCommunities(community,
          new EntityIdentifier(userName, accountName));
      } else if(id.getUrl() == null) {
        ModelException.sendMessage(ModelException.INFO,"Update account:"
            +entity.getUniqueIdentificator()+","+
            community.getName()+","+userName+","+accountName);
        id.setUrl(accountName);
      }
    }
  }
View Full Code Here

Examples of cross.reputation.model.Community

    */
  }
 
  public Map<String, Entity> importOverEntitiesToCommunity(String communityName,
      Set<String> entityNames) throws Exception {
    Community community = GlobalModel.getCommunities().get(communityName);
    if(community == null) {
      ModelException.sendMessage(ModelException.ERROR, "Community to import" +
          " is not set in the parsed semantic model");
      return null;
    }
    if(community.getReputationModel() == null) {
      ModelException.sendMessage(ModelException.ERROR, "ReputationModel from " +
          "Community(resource:"+community.getResource()+") must be set to" +
          " import reputations");
      return null;
    }
    //Find importationUnit
    Map<ReputationImporterBehaviour, Set<ImportationUnit>> importationUnits =
        findImportationUnits(community.getReputationModel());
    //TODO: ver que existe al menos un importationUnit in todo el MAP!!
    //Set<MetricMapping> metricMappings = findMetricMappings(
    //    community.getReputationModel());
    Map<String, Entity> entities = new HashMap<String, Entity>();
    for(String entityName : entityNames) {
View Full Code Here

Examples of cross.reputation.model.Community

 
  public void importOverEntitiesToCommunity(
      URI commmunityURI, Set<String> entityNames) throws Exception {
    Resource communityResource = ResourceFactory.createResource(
        commmunityURI.toString());
    Community community = (Community) reputationParser.getResourceFromCache(
        communityResource, Community.class);
    if(community == null) {
      community = reputationParser.getCommunity(
          reputationParser.getModel(), communityResource);
    }
View Full Code Here

Examples of cross.reputation.model.Community

   
    //Set All Model
    ConfigureModel.buildCrossReputationGlobalModel();
   
    //Set the destination community to import the other community reputations
    Community destinationCommunity = GlobalModel.getCommunities().get("semanticWiki");
   
    //Set user accounts from file generated by the mediawiki python bot
    /*try {
      setUserAccountsFromJSON(lastFileName);
      //setUserAccountsFromFile(lastFileName);
    } catch (IOException e) {
      System.out.println("Error: ioexception at reading file:"+lastFileName
          +"\n "+e.getMessage());
      return;
    } catch (JSONException e) {
          System.out.println("The file could have a not JSON format.");
          e.printStackTrace();
          return;
    }*/
   
    //Set user accounts from Foaf RDF file
    FoafParser foaf = new FoafParser();
    //foaf.foafAgent("dir/foafSample.rdf");
    foaf.foafAgent("http://localhost/foafSample2.rdf");
   
    //Add all entities configured to all metrics in the destination community
    for(Entity entity : GlobalModel.getEntities().values()) {
      destinationCommunity.addEntityToAllMetrics(entity);
    }   
   
    //Set that all rest communities and theirs metrics are valid to the importation
    List<CommunityMetricToImport> metricsToImport = ConfigureModel.
      buildMetricsFromAllCommunitiesToAllMetrics(destinationCommunity);
View Full Code Here

Examples of edu.uga.galileo.voci.bo.Community

  {
    VociBusinessObject vbo = null;

    if (type == ContentType.COMMUNITY)
    {
      Community community = new Community();
      community.setCommunityId(-1);
      community.setProjectId(projectId);
      community.setActive(active);
      vbo = community;
    }
    if (type == ContentType.COLLECTION)
    {
      Collection collection = new Collection();
View Full Code Here

Examples of models.Community

            List<Community> communities = new ArrayList<Community>();

            if(jsonNode.size()>0) {
                for(JsonNode comm : jsonNode) {
                    Community community = Community.parseCommunityFromJSON(comm);
                    communities.add(community);
                }
            }

            String endpoint = conn.getURL().toString();
View Full Code Here

Examples of models.Community

    public static Result show(Long id) {
        Logger.info("SHOW");
        RestResponse response = Community.findByID(id);
        if(response.modelObject instanceof Community) {
            Community community = (Community) response.modelObject;
            User user = new User();
            user = user.getUserFromSession(session());

            String flash = flash("success");
            return ok(views.html.community.detail.render(user, community, "Single Community", response.jsonString, response.endpoint, flash));
View Full Code Here

Examples of models.Community

        user = user.getUserFromSession(session());
        Form<Community> communityForm = form(Community.class);

        RestResponse response = Community.findByID(id);
        if(response.modelObject instanceof Community) {
            Community community = (Community) response.modelObject;
            communityForm = communityForm.fill(community);
            return ok(views.html.community.edit.render(user, communityForm, "Edit Community", response.jsonString, response.endpoint));
        } else {
            return internalServerError();
        }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.