aboutsummaryrefslogtreecommitdiff
path: root/juick-crosspost/src/main/java/com/juick
diff options
context:
space:
mode:
authorGravatar Alexander Alexeev2016-11-14 04:20:14 +0700
committerGravatar Alexander Alexeev2016-11-14 04:20:14 +0700
commitaaebdd4913a7e5274018675d12231df8caf227a0 (patch)
treef7d57c21b931d7d29af2eed300cf69a92008a12d /juick-crosspost/src/main/java/com/juick
parentd785972dd9801ac2a3c8301b05bc2d38bd56b221 (diff)
crosspost service used
Diffstat (limited to 'juick-crosspost/src/main/java/com/juick')
-rw-r--r--juick-crosspost/src/main/java/com/juick/components/Crosspost.java17
-rw-r--r--juick-crosspost/src/main/java/com/juick/components/configuration/CrosspostAppConfiguration.java5
2 files changed, 11 insertions, 11 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;
}
diff --git a/juick-crosspost/src/main/java/com/juick/components/configuration/CrosspostAppConfiguration.java b/juick-crosspost/src/main/java/com/juick/components/configuration/CrosspostAppConfiguration.java
index a7787b26..603130b3 100644
--- a/juick-crosspost/src/main/java/com/juick/components/configuration/CrosspostAppConfiguration.java
+++ b/juick-crosspost/src/main/java/com/juick/components/configuration/CrosspostAppConfiguration.java
@@ -2,6 +2,7 @@ package com.juick.components.configuration;
import com.juick.components.Crosspost;
import com.juick.configuration.DataConfiguration;
+import com.juick.service.CrosspostService;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Import;
@@ -23,11 +24,11 @@ public class CrosspostAppConfiguration {
@Inject
private Environment env;
@Inject
- private JdbcTemplate jdbcTemplate;
+ private CrosspostService crosspostService;
@Bean
public Crosspost crosspost() {
- return new Crosspost(env, service(), jdbcTemplate);
+ return new Crosspost(env, service(), crosspostService);
}
@Bean