diff options
Diffstat (limited to 'juick-crosspost/src/main/java/com/juick/components/Crosspost.java')
-rw-r--r-- | juick-crosspost/src/main/java/com/juick/components/Crosspost.java | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/juick-crosspost/src/main/java/com/juick/components/Crosspost.java b/juick-crosspost/src/main/java/com/juick/components/Crosspost.java index 905816fd..c82fc542 100644 --- a/juick-crosspost/src/main/java/com/juick/components/Crosspost.java +++ b/juick-crosspost/src/main/java/com/juick/components/Crosspost.java @@ -17,7 +17,7 @@ */ package com.juick.components; -import com.juick.server.CrosspostQueries; +import com.juick.service.CrosspostService; import com.juick.util.ThreadHelper; import com.juick.xmpp.JID; import com.juick.xmpp.Message; @@ -32,7 +32,6 @@ import org.slf4j.LoggerFactory; import org.springframework.beans.factory.DisposableBean; import org.springframework.beans.factory.InitializingBean; import org.springframework.core.env.Environment; -import org.springframework.jdbc.core.JdbcTemplate; import org.springframework.util.Assert; import javax.crypto.Mac; @@ -56,7 +55,7 @@ public class Crosspost implements InitializingBean, DisposableBean, Stream.Strea private static Logger logger = LoggerFactory.getLogger(Crosspost.class); - private final JdbcTemplate jdbc; + private final CrosspostService crosspostService; private final ExecutorService service; private Stream xmpp; @@ -66,13 +65,13 @@ public class Crosspost implements InitializingBean, DisposableBean, Stream.Strea private final String password; private final int port; - public Crosspost(final Environment env, final ExecutorService service, final JdbcTemplate jdbc) { + public Crosspost(final Environment env, final ExecutorService service, final CrosspostService crosspostService) { Assert.notNull(env); Assert.notNull(service); - Assert.notNull(jdbc); + Assert.notNull(crosspostService); this.service = service; - this.jdbc = jdbc; + this.crosspostService = crosspostService; twitter_consumer_key = env.getProperty("twitter_consumer_key", ""); twitter_consumer_secret = env.getProperty("twitter_consumer_secret", ""); @@ -140,7 +139,7 @@ public class Crosspost implements InitializingBean, DisposableBean, Stream.Strea } public boolean facebookPost(final com.juick.Message jmsg) { - String token = CrosspostQueries.getFacebookToken(jdbc, jmsg.getUser().getUID()).orElse(""); + String token = crosspostService.getFacebookToken(jmsg.getUser().getUID()).orElse(""); if (token.isEmpty()) { return false; } @@ -182,7 +181,7 @@ public class Crosspost implements InitializingBean, DisposableBean, Stream.Strea } public boolean vkontaktePost(final com.juick.Message jmsg) { - Pair<String, String> tokens = CrosspostQueries.getVKTokens(jdbc, jmsg.getUser().getUID()).orElse(Pair.of("", "")); + Pair<String, String> tokens = crosspostService.getVkTokens(jmsg.getUser().getUID()).orElse(Pair.of("", "")); if (tokens.getLeft().isEmpty() || tokens.getRight().isEmpty()) { return false; } @@ -219,7 +218,7 @@ public class Crosspost implements InitializingBean, DisposableBean, Stream.Strea } public boolean twitterPost(final com.juick.Message jmsg) { - Pair<String, String> tokens = CrosspostQueries.getTwitterTokens(jdbc, jmsg.getUser().getUID()).orElse(Pair.of("", "")); + Pair<String, String> tokens = crosspostService.getTwitterTokens(jmsg.getUser().getUID()).orElse(Pair.of("", "")); if (tokens.getLeft().isEmpty() || tokens.getRight().isEmpty()) { return false; } |