Package net.fortytwo.twitlogic.persistence.beans

Examples of net.fortytwo.twitlogic.persistence.beans.UserAccount


        if (null != tweet.getText()) {
            post.setContent(tweet.getText());
        }

        if (null != tweet.getUser()) {
            UserAccount userAccount = accountForUser(tweet.getUser());
            post.setHasCreator(userAccount);
        }

        if (null != tweet.getInReplyToTweet()) {
            MicroblogPost p = postForTweet(tweet.getInReplyToTweet());
View Full Code Here


        return agent;
    }

    public UserAccount persist(final User tweetUser) {
        UserAccount userAccount = accountForUser(tweetUser);

        Agent agent = agentForUser(tweetUser, userAccount);

        Set<Thing> equivalentAgents = new HashSet<Thing>();
        String semanticTweetUri
                = "http://semantictweet.com/" + tweetUser.getScreenName() + "#me";
        equivalentAgents.add(
                designate(semanticTweetUri, Thing.class));
        agent.setOwlSameAs(equivalentAgents);

        if (null != tweetUser.getName()) {
            agent.setName(tweetUser.getName());
        }

        if (null != tweetUser.getDescription()) {
            agent.setRdfsComment(tweetUser.getDescription());
        }

        if (null != tweetUser.getLocation()) {
            SpatialThing basedNear = agent.getBasedNear();
            if (null == basedNear) {
                basedNear = spatialThing();
                agent.setBasedNear(basedNear);
            }

            basedNear.setRdfsComment(tweetUser.getLocation());
        }

        if (null != tweetUser.getUrl()
                && TweetSyntax.URL_PATTERN.matcher(tweetUser.getUrl()).matches()) {
            // Note: we can't easily delete an existing homepage (removing its
            // rdf:type statement), as it might be the homepage of another
            // agent.  Therefore, "orphaned" Document resources are possible.

            Document homepage = designate(tweetUser.getUrl(), Document.class);
            agent.setHomepage(homepage);
        }

        if (null != tweetUser.getProfileImageUrl()
                && TweetSyntax.URL_PATTERN.matcher(tweetUser.getProfileImageUrl()).matches()) {
            // Note: we can't easily delete an existing image (removing its
            // rdf:type statement), as it might be the image of another
            // agent.  Therefore, "orphaned" Image resources are possible.

            Image depiction = designate(tweetUser.getProfileImageUrl(), Image.class);
            agent.setDepiction(depiction);
        }

        if (null != tweetUser.getFollowers()) {
            Set<Agent> agents = new HashSet<Agent>();
            for (User u : tweetUser.getFollowers()) {
                UserAccount ua = accountForUser(u);
                Agent ag = agentForUser(u, ua);
                agents.add(ag);
            }

            agent.setKnownBy(agents);
        }

        if (null != tweetUser.getFollowees()) {
            Set<Agent> agents = new HashSet<Agent>();
            for (User u : tweetUser.getFollowees()) {
                UserAccount ua = accountForUser(u);
                Agent ag = agentForUser(u, ua);
                agents.add(ag);
            }

            agent.setKnows(agents);
View Full Code Here

        return designate(uri.getValue(), Thing.class);
    }

    public Agent persist(final net.fortytwo.twitlogic.model.Person tweetPerson) {
        User tweetUser = tweetPerson.getAccount();
        UserAccount userAccount = persist(tweetUser);
        return userAccount.getAccountOf();
    }
View Full Code Here

TOP

Related Classes of net.fortytwo.twitlogic.persistence.beans.UserAccount

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.