From 5a7b4e72d8e5c57bcf5adb61d904c119408d3c0c Mon Sep 17 00:00:00 2001 From: phasenraum2010 Date: Mon, 31 Jul 2017 02:27:13 +0200 Subject: [PATCH] workin on #161 --- .../woehlke/twitterwall/oodm/entities/Tweet.java | 8 +++----- .../twitterwall/oodm/entities/parts/Entities.java | 15 +++++++-------- .../service/impl/DomainServiceWithTaskImpl.java | 4 ---- .../oodm/service/impl/HashTagServiceImpl.java | 2 +- .../oodm/service/impl/MediaServiceImpl.java | 2 +- .../oodm/service/impl/MentionServiceImpl.java | 2 +- .../oodm/service/impl/TaskHistoryServiceImpl.java | 2 +- .../oodm/service/impl/TaskServiceImpl.java | 2 +- .../service/impl/TickerSymbolServiceImpl.java | 2 +- .../oodm/service/impl/TweetServiceImpl.java | 2 +- .../oodm/service/impl/UrlCacheServiceImpl.java | 2 +- .../oodm/service/impl/UrlServiceImpl.java | 2 +- .../oodm/service/impl/UserServiceImpl.java | 2 +- .../persist/impl/CountedEntitiesServiceImpl.java | 2 +- .../persist/impl/CreatePersistentMentionImpl.java | 8 +++----- .../persist/impl/CreatePersistentUrlImpl.java | 10 +--------- .../persist/impl/StoreEntitiesProcessImpl.java | 3 --- .../service/persist/impl/StoreOneTweetImpl.java | 7 ++----- .../persist/impl/StoreOneTweetPerformImpl.java | 7 ++----- ...eTwitterProfileForProxyMentionForUserImpl.java | 8 ++------ .../persist/impl/StoreUserFromMentionImpl.java | 7 ++----- .../impl/StoreUserProfileForScreenNameImpl.java | 14 +++----------- .../impl/StoreUserProfileForUserListImpl.java | 7 ++----- .../persist/impl/StoreUserProfileImpl.java | 7 ++----- src/main/resources/logback.xml | 2 +- 25 files changed, 41 insertions(+), 88 deletions(-) diff --git a/src/main/java/org/woehlke/twitterwall/oodm/entities/Tweet.java b/src/main/java/org/woehlke/twitterwall/oodm/entities/Tweet.java index 10b2e53f..f874c083 100644 --- a/src/main/java/org/woehlke/twitterwall/oodm/entities/Tweet.java +++ b/src/main/java/org/woehlke/twitterwall/oodm/entities/Tweet.java @@ -15,9 +15,7 @@ import java.util.HashMap; import java.util.Map; -import static javax.persistence.CascadeType.DETACH; -import static javax.persistence.CascadeType.REFRESH; -import static javax.persistence.CascadeType.REMOVE; +import static javax.persistence.CascadeType.*; import static javax.persistence.FetchType.EAGER; /** @@ -137,7 +135,7 @@ public class Tweet extends AbstractDomainObject implements DomainObjectWi private Boolean retweeted; @JoinColumn(name="fk_tweet_retweeted") - @ManyToOne(cascade = {DETACH, REFRESH, REMOVE}, fetch = EAGER, optional = true) + @ManyToOne(cascade = {ALL}, fetch = EAGER, optional = true) private Tweet retweetedStatus; @Column(name="favorited") @@ -186,7 +184,7 @@ public class Tweet extends AbstractDomainObject implements DomainObjectWi @Valid @NotNull @JoinColumn(name="fk_user") - @ManyToOne(cascade = {DETACH, REFRESH, REMOVE}, fetch = EAGER, optional = false) + @ManyToOne(cascade = { ALL }, fetch = EAGER, optional = false) private User user; @AssertTrue diff --git a/src/main/java/org/woehlke/twitterwall/oodm/entities/parts/Entities.java b/src/main/java/org/woehlke/twitterwall/oodm/entities/parts/Entities.java index 8b206829..74fafc83 100644 --- a/src/main/java/org/woehlke/twitterwall/oodm/entities/parts/Entities.java +++ b/src/main/java/org/woehlke/twitterwall/oodm/entities/parts/Entities.java @@ -12,9 +12,7 @@ import java.util.List; import java.util.Set; -import static javax.persistence.CascadeType.DETACH; -import static javax.persistence.CascadeType.REFRESH; -import static javax.persistence.CascadeType.REMOVE; +import static javax.persistence.CascadeType.*; import static javax.persistence.FetchType.EAGER; /** @@ -25,23 +23,24 @@ public class Entities extends EntitiesFilter implements DomainObjectEmbededField { @NotNull - @ManyToMany(cascade = { DETACH, REFRESH, REMOVE }, fetch = EAGER) + //@ManyToMany(cascade = { DETACH, REFRESH, REMOVE }, fetch = EAGER) + @ManyToMany(cascade = { ALL }, fetch = EAGER) private Set urls = new LinkedHashSet(); @NotNull - @ManyToMany(cascade = { DETACH, REFRESH, REMOVE }, fetch = EAGER) + @ManyToMany(cascade = { ALL }, fetch = EAGER) private Set hashTags = new LinkedHashSet(); @NotNull - @ManyToMany(cascade = { DETACH, REFRESH, REMOVE }, fetch = EAGER) + @ManyToMany(cascade = { ALL }, fetch = EAGER) private Set mentions = new LinkedHashSet(); @NotNull - @ManyToMany(cascade = { DETACH, REFRESH, REMOVE }, fetch = EAGER) + @ManyToMany(cascade = { ALL }, fetch = EAGER) private Set media = new LinkedHashSet(); @NotNull - @ManyToMany(cascade = { DETACH, REFRESH, REMOVE }, fetch = EAGER) + @ManyToMany(cascade = { ALL }, fetch = EAGER) private Set tickerSymbols = new LinkedHashSet(); public Entities(Set urls, Set hashTags, Set mentions, Set media, Set tickerSymbols) { diff --git a/src/main/java/org/woehlke/twitterwall/oodm/service/impl/DomainServiceWithTaskImpl.java b/src/main/java/org/woehlke/twitterwall/oodm/service/impl/DomainServiceWithTaskImpl.java index e9124042..59328964 100644 --- a/src/main/java/org/woehlke/twitterwall/oodm/service/impl/DomainServiceWithTaskImpl.java +++ b/src/main/java/org/woehlke/twitterwall/oodm/service/impl/DomainServiceWithTaskImpl.java @@ -4,8 +4,6 @@ import org.slf4j.LoggerFactory; import org.springframework.data.domain.Page; import org.springframework.data.domain.Pageable; -import org.springframework.transaction.annotation.Propagation; -import org.springframework.transaction.annotation.Transactional; import org.woehlke.twitterwall.oodm.entities.Task; import org.woehlke.twitterwall.oodm.entities.common.DomainObjectWithTask; import org.woehlke.twitterwall.oodm.repositories.TaskRepository; @@ -13,7 +11,6 @@ import org.woehlke.twitterwall.oodm.service.common.DomainService; -@Transactional(propagation = Propagation.REQUIRED, readOnly = true) public abstract class DomainServiceWithTaskImpl implements DomainService { private static final Logger log = LoggerFactory.getLogger(DomainServiceWithTaskImpl.class); @@ -43,7 +40,6 @@ public long count() { } @Override - @Transactional(propagation = Propagation.REQUIRES_NEW, readOnly = false) public T store(T domainObject, Task task) { String msg = "store "+domainObject.getUniqueId()+" in Task "+task.getUniqueId()+" "; T domainObjectResult = null; diff --git a/src/main/java/org/woehlke/twitterwall/oodm/service/impl/HashTagServiceImpl.java b/src/main/java/org/woehlke/twitterwall/oodm/service/impl/HashTagServiceImpl.java index c431d2eb..28a19bd7 100644 --- a/src/main/java/org/woehlke/twitterwall/oodm/service/impl/HashTagServiceImpl.java +++ b/src/main/java/org/woehlke/twitterwall/oodm/service/impl/HashTagServiceImpl.java @@ -15,7 +15,7 @@ * Created by tw on 12.06.17. */ @Service -@Transactional(propagation = Propagation.REQUIRED, readOnly = true) +@Transactional(propagation = Propagation.REQUIRES_NEW, readOnly = false) public class HashTagServiceImpl extends DomainServiceWithTaskImpl implements HashTagService { private static final Logger log = LoggerFactory.getLogger(HashTagServiceImpl.class); diff --git a/src/main/java/org/woehlke/twitterwall/oodm/service/impl/MediaServiceImpl.java b/src/main/java/org/woehlke/twitterwall/oodm/service/impl/MediaServiceImpl.java index 4bf637a8..22dd5f20 100644 --- a/src/main/java/org/woehlke/twitterwall/oodm/service/impl/MediaServiceImpl.java +++ b/src/main/java/org/woehlke/twitterwall/oodm/service/impl/MediaServiceImpl.java @@ -15,7 +15,7 @@ * Created by tw on 12.06.17. */ @Service -@Transactional(propagation = Propagation.REQUIRED, readOnly = true) +@Transactional(propagation = Propagation.REQUIRES_NEW, readOnly = false) public class MediaServiceImpl extends DomainServiceWithTaskImpl implements MediaService { private static final Logger log = LoggerFactory.getLogger(MediaServiceImpl.class); diff --git a/src/main/java/org/woehlke/twitterwall/oodm/service/impl/MentionServiceImpl.java b/src/main/java/org/woehlke/twitterwall/oodm/service/impl/MentionServiceImpl.java index 43e97bb7..0227bc46 100644 --- a/src/main/java/org/woehlke/twitterwall/oodm/service/impl/MentionServiceImpl.java +++ b/src/main/java/org/woehlke/twitterwall/oodm/service/impl/MentionServiceImpl.java @@ -21,7 +21,7 @@ * Created by tw on 12.06.17. */ @Service -@Transactional(propagation = Propagation.REQUIRED, readOnly = true) +@Transactional(propagation = Propagation.REQUIRES_NEW, readOnly = false) public class MentionServiceImpl extends DomainServiceWithTaskImpl implements MentionService { private static final Logger log = LoggerFactory.getLogger(MentionServiceImpl.class); diff --git a/src/main/java/org/woehlke/twitterwall/oodm/service/impl/TaskHistoryServiceImpl.java b/src/main/java/org/woehlke/twitterwall/oodm/service/impl/TaskHistoryServiceImpl.java index 5d429ad3..1187ca07 100644 --- a/src/main/java/org/woehlke/twitterwall/oodm/service/impl/TaskHistoryServiceImpl.java +++ b/src/main/java/org/woehlke/twitterwall/oodm/service/impl/TaskHistoryServiceImpl.java @@ -17,7 +17,7 @@ * Created by tw on 11.07.17. */ @Service -@Transactional(propagation = Propagation.REQUIRED, readOnly = true) +@Transactional(propagation = Propagation.REQUIRES_NEW, readOnly = false) public class TaskHistoryServiceImpl implements TaskHistoryService { private static final Logger log = LoggerFactory.getLogger(TaskHistoryServiceImpl.class); diff --git a/src/main/java/org/woehlke/twitterwall/oodm/service/impl/TaskServiceImpl.java b/src/main/java/org/woehlke/twitterwall/oodm/service/impl/TaskServiceImpl.java index b8ded8b8..7e5aa4b4 100644 --- a/src/main/java/org/woehlke/twitterwall/oodm/service/impl/TaskServiceImpl.java +++ b/src/main/java/org/woehlke/twitterwall/oodm/service/impl/TaskServiceImpl.java @@ -23,7 +23,7 @@ * Created by tw on 09.07.17. */ @Service -@Transactional(propagation = Propagation.REQUIRED, readOnly = true) +@Transactional(propagation = Propagation.REQUIRES_NEW, readOnly = false) public class TaskServiceImpl implements TaskService { private static final Logger log = LoggerFactory.getLogger(TaskServiceImpl.class); diff --git a/src/main/java/org/woehlke/twitterwall/oodm/service/impl/TickerSymbolServiceImpl.java b/src/main/java/org/woehlke/twitterwall/oodm/service/impl/TickerSymbolServiceImpl.java index 061dffc6..75eb4627 100644 --- a/src/main/java/org/woehlke/twitterwall/oodm/service/impl/TickerSymbolServiceImpl.java +++ b/src/main/java/org/woehlke/twitterwall/oodm/service/impl/TickerSymbolServiceImpl.java @@ -16,7 +16,7 @@ * Created by tw on 12.06.17. */ @Service -@Transactional(propagation = Propagation.REQUIRED, readOnly = true) +@Transactional(propagation = Propagation.REQUIRES_NEW, readOnly = false) public class TickerSymbolServiceImpl extends DomainServiceWithTaskImpl implements TickerSymbolService { private static final Logger log = LoggerFactory.getLogger(TickerSymbolServiceImpl.class); diff --git a/src/main/java/org/woehlke/twitterwall/oodm/service/impl/TweetServiceImpl.java b/src/main/java/org/woehlke/twitterwall/oodm/service/impl/TweetServiceImpl.java index dd5ee88b..6a3e64a9 100644 --- a/src/main/java/org/woehlke/twitterwall/oodm/service/impl/TweetServiceImpl.java +++ b/src/main/java/org/woehlke/twitterwall/oodm/service/impl/TweetServiceImpl.java @@ -21,7 +21,7 @@ * Created by tw on 10.06.17. */ @Service -@Transactional(propagation = Propagation.REQUIRED, readOnly = true) +@Transactional(propagation = Propagation.REQUIRES_NEW, readOnly = false) public class TweetServiceImpl extends DomainServiceWithTaskImpl implements TweetService { private static final Logger log = LoggerFactory.getLogger(TweetServiceImpl.class); diff --git a/src/main/java/org/woehlke/twitterwall/oodm/service/impl/UrlCacheServiceImpl.java b/src/main/java/org/woehlke/twitterwall/oodm/service/impl/UrlCacheServiceImpl.java index 927406e7..ee8d5f38 100644 --- a/src/main/java/org/woehlke/twitterwall/oodm/service/impl/UrlCacheServiceImpl.java +++ b/src/main/java/org/woehlke/twitterwall/oodm/service/impl/UrlCacheServiceImpl.java @@ -16,7 +16,7 @@ * Created by tw on 23.06.17. */ @Service -@Transactional(propagation = Propagation.REQUIRED, readOnly = true) +@Transactional(propagation = Propagation.REQUIRES_NEW, readOnly = false) public class UrlCacheServiceImpl extends DomainServiceWithTaskImpl implements UrlCacheService { private static final Logger log = LoggerFactory.getLogger(TickerSymbolServiceImpl.class); diff --git a/src/main/java/org/woehlke/twitterwall/oodm/service/impl/UrlServiceImpl.java b/src/main/java/org/woehlke/twitterwall/oodm/service/impl/UrlServiceImpl.java index 50e3e487..7100b1d6 100644 --- a/src/main/java/org/woehlke/twitterwall/oodm/service/impl/UrlServiceImpl.java +++ b/src/main/java/org/woehlke/twitterwall/oodm/service/impl/UrlServiceImpl.java @@ -15,7 +15,7 @@ * Created by tw on 12.06.17. */ @Service -@Transactional(propagation = Propagation.REQUIRED, readOnly = true) +@Transactional(propagation = Propagation.REQUIRES_NEW, readOnly = false) public class UrlServiceImpl extends DomainServiceWithTaskImpl implements UrlService { private static final Logger log = LoggerFactory.getLogger(UrlServiceImpl.class); diff --git a/src/main/java/org/woehlke/twitterwall/oodm/service/impl/UserServiceImpl.java b/src/main/java/org/woehlke/twitterwall/oodm/service/impl/UserServiceImpl.java index 31990882..190e68e1 100644 --- a/src/main/java/org/woehlke/twitterwall/oodm/service/impl/UserServiceImpl.java +++ b/src/main/java/org/woehlke/twitterwall/oodm/service/impl/UserServiceImpl.java @@ -21,7 +21,7 @@ * Created by tw on 11.06.17. */ @Service -@Transactional(propagation = Propagation.REQUIRED, readOnly = true) +@Transactional(propagation = Propagation.REQUIRES_NEW, readOnly = false) public class UserServiceImpl extends DomainServiceWithTaskImpl implements UserService { private static final Logger log = LoggerFactory.getLogger(UserServiceImpl.class); diff --git a/src/main/java/org/woehlke/twitterwall/scheduled/service/persist/impl/CountedEntitiesServiceImpl.java b/src/main/java/org/woehlke/twitterwall/scheduled/service/persist/impl/CountedEntitiesServiceImpl.java index e5a96d4f..0c88e84c 100644 --- a/src/main/java/org/woehlke/twitterwall/scheduled/service/persist/impl/CountedEntitiesServiceImpl.java +++ b/src/main/java/org/woehlke/twitterwall/scheduled/service/persist/impl/CountedEntitiesServiceImpl.java @@ -15,7 +15,7 @@ * Created by tw on 09.07.17. */ @Service -@Transactional(propagation = Propagation.REQUIRES_NEW, readOnly = false) +@Transactional(propagation = Propagation.REQUIRES_NEW, readOnly = true) public class CountedEntitiesServiceImpl implements CountedEntitiesService { diff --git a/src/main/java/org/woehlke/twitterwall/scheduled/service/persist/impl/CreatePersistentMentionImpl.java b/src/main/java/org/woehlke/twitterwall/scheduled/service/persist/impl/CreatePersistentMentionImpl.java index b83eab98..61d070db 100644 --- a/src/main/java/org/woehlke/twitterwall/scheduled/service/persist/impl/CreatePersistentMentionImpl.java +++ b/src/main/java/org/woehlke/twitterwall/scheduled/service/persist/impl/CreatePersistentMentionImpl.java @@ -3,9 +3,7 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; -import org.springframework.transaction.annotation.Propagation; -import org.springframework.transaction.annotation.Transactional; +import org.springframework.stereotype.Component; import org.woehlke.twitterwall.oodm.entities.User; import org.woehlke.twitterwall.oodm.entities.Task; import org.woehlke.twitterwall.oodm.entities.Mention; @@ -16,8 +14,8 @@ /** * Created by tw on 14.07.17. */ -@Service -@Transactional(propagation = Propagation.REQUIRES_NEW, readOnly = false) + +@Component public class CreatePersistentMentionImpl implements CreatePersistentMention { /** diff --git a/src/main/java/org/woehlke/twitterwall/scheduled/service/persist/impl/CreatePersistentUrlImpl.java b/src/main/java/org/woehlke/twitterwall/scheduled/service/persist/impl/CreatePersistentUrlImpl.java index 724665e8..b7440348 100644 --- a/src/main/java/org/woehlke/twitterwall/scheduled/service/persist/impl/CreatePersistentUrlImpl.java +++ b/src/main/java/org/woehlke/twitterwall/scheduled/service/persist/impl/CreatePersistentUrlImpl.java @@ -6,8 +6,6 @@ import org.springframework.stereotype.Component; import org.woehlke.twitterwall.oodm.entities.Task; import org.woehlke.twitterwall.oodm.entities.parts.UrlField; -import org.woehlke.twitterwall.oodm.repositories.UrlCacheRepository; -import org.woehlke.twitterwall.oodm.repositories.UrlRepository; import org.woehlke.twitterwall.oodm.service.UrlCacheService; import org.woehlke.twitterwall.oodm.service.UrlService; import org.woehlke.twitterwall.scheduled.service.backend.TwitterUrlService; @@ -120,10 +118,6 @@ public Url createPersistentUrlFor(String url, Task task) { private static final Logger log = LoggerFactory.getLogger(CreatePersistentUrlImpl.class); - //private final UrlRepository urlRepository; - - //private final UrlCacheRepository urlCacheRepository; - private final UrlService urlService; private final UrlCacheService urlCacheService; @@ -131,11 +125,9 @@ public Url createPersistentUrlFor(String url, Task task) { private final TwitterUrlService twitterUrlService; @Autowired - public CreatePersistentUrlImpl(UrlRepository urlRepository, UrlCacheRepository urlCacheRepository, UrlService urlService, UrlCacheService urlCacheService, TwitterUrlService twitterUrlService) { + public CreatePersistentUrlImpl(UrlService urlService, UrlCacheService urlCacheService, TwitterUrlService twitterUrlService) { this.urlService = urlService; this.urlCacheService = urlCacheService; - //this.urlRepository = urlRepository; - //this.urlCacheRepository = urlCacheRepository; this.twitterUrlService = twitterUrlService; } } diff --git a/src/main/java/org/woehlke/twitterwall/scheduled/service/persist/impl/StoreEntitiesProcessImpl.java b/src/main/java/org/woehlke/twitterwall/scheduled/service/persist/impl/StoreEntitiesProcessImpl.java index f59ad42c..7eb3403d 100644 --- a/src/main/java/org/woehlke/twitterwall/scheduled/service/persist/impl/StoreEntitiesProcessImpl.java +++ b/src/main/java/org/woehlke/twitterwall/scheduled/service/persist/impl/StoreEntitiesProcessImpl.java @@ -4,9 +4,6 @@ import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; -import org.springframework.stereotype.Service; -import org.springframework.transaction.annotation.Propagation; -import org.springframework.transaction.annotation.Transactional; import org.woehlke.twitterwall.oodm.entities.*; import org.woehlke.twitterwall.oodm.entities.parts.Entities; import org.woehlke.twitterwall.oodm.service.*; diff --git a/src/main/java/org/woehlke/twitterwall/scheduled/service/persist/impl/StoreOneTweetImpl.java b/src/main/java/org/woehlke/twitterwall/scheduled/service/persist/impl/StoreOneTweetImpl.java index f2dda434..a846a48e 100644 --- a/src/main/java/org/woehlke/twitterwall/scheduled/service/persist/impl/StoreOneTweetImpl.java +++ b/src/main/java/org/woehlke/twitterwall/scheduled/service/persist/impl/StoreOneTweetImpl.java @@ -3,9 +3,7 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; -import org.springframework.transaction.annotation.Propagation; -import org.springframework.transaction.annotation.Transactional; +import org.springframework.stereotype.Component; import org.woehlke.twitterwall.oodm.entities.Tweet; import org.woehlke.twitterwall.oodm.entities.Task; import org.woehlke.twitterwall.scheduled.service.persist.StoreOneTweet; @@ -15,8 +13,7 @@ /** * Created by tw on 09.07.17. */ -@Service -@Transactional(propagation = Propagation.REQUIRES_NEW, readOnly = false) +@Component public class StoreOneTweetImpl implements StoreOneTweet { @Override diff --git a/src/main/java/org/woehlke/twitterwall/scheduled/service/persist/impl/StoreOneTweetPerformImpl.java b/src/main/java/org/woehlke/twitterwall/scheduled/service/persist/impl/StoreOneTweetPerformImpl.java index a3fd46aa..4c196d01 100644 --- a/src/main/java/org/woehlke/twitterwall/scheduled/service/persist/impl/StoreOneTweetPerformImpl.java +++ b/src/main/java/org/woehlke/twitterwall/scheduled/service/persist/impl/StoreOneTweetPerformImpl.java @@ -3,9 +3,7 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; -import org.springframework.transaction.annotation.Propagation; -import org.springframework.transaction.annotation.Transactional; +import org.springframework.stereotype.Component; import org.woehlke.twitterwall.oodm.entities.parts.Entities; import org.woehlke.twitterwall.oodm.entities.Tweet; import org.woehlke.twitterwall.oodm.entities.User; @@ -16,8 +14,7 @@ /** * Created by tw on 09.07.17. */ -@Service -@Transactional(propagation = Propagation.REQUIRES_NEW, readOnly = false) +@Component public class StoreOneTweetPerformImpl implements StoreOneTweetPerform { /** Method because of recursive Method Call in this Method **/ diff --git a/src/main/java/org/woehlke/twitterwall/scheduled/service/persist/impl/StoreTwitterProfileForProxyMentionForUserImpl.java b/src/main/java/org/woehlke/twitterwall/scheduled/service/persist/impl/StoreTwitterProfileForProxyMentionForUserImpl.java index fc5231d9..bea10b79 100644 --- a/src/main/java/org/woehlke/twitterwall/scheduled/service/persist/impl/StoreTwitterProfileForProxyMentionForUserImpl.java +++ b/src/main/java/org/woehlke/twitterwall/scheduled/service/persist/impl/StoreTwitterProfileForProxyMentionForUserImpl.java @@ -4,9 +4,7 @@ import org.slf4j.LoggerFactory; import org.springframework.social.ApiException; import org.springframework.social.twitter.api.TwitterProfile; -import org.springframework.stereotype.Service; -import org.springframework.transaction.annotation.Propagation; -import org.springframework.transaction.annotation.Transactional; +import org.springframework.stereotype.Component; import org.woehlke.twitterwall.oodm.entities.*; import org.woehlke.twitterwall.oodm.entities.parts.CountedEntities; import org.woehlke.twitterwall.oodm.entities.parts.Entities; @@ -24,9 +22,7 @@ /** * Created by tw on 14.07.17. */ - -@Service -@Transactional(propagation = Propagation.REQUIRES_NEW, readOnly = false) +@Component public class StoreTwitterProfileForProxyMentionForUserImpl implements StoreTwitterProfileForProxyMentionForUser { diff --git a/src/main/java/org/woehlke/twitterwall/scheduled/service/persist/impl/StoreUserFromMentionImpl.java b/src/main/java/org/woehlke/twitterwall/scheduled/service/persist/impl/StoreUserFromMentionImpl.java index 748105e2..78b23c89 100644 --- a/src/main/java/org/woehlke/twitterwall/scheduled/service/persist/impl/StoreUserFromMentionImpl.java +++ b/src/main/java/org/woehlke/twitterwall/scheduled/service/persist/impl/StoreUserFromMentionImpl.java @@ -3,9 +3,7 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; -import org.springframework.transaction.annotation.Propagation; -import org.springframework.transaction.annotation.Transactional; +import org.springframework.stereotype.Component; import org.woehlke.twitterwall.oodm.entities.User; import org.woehlke.twitterwall.oodm.entities.Task; import org.woehlke.twitterwall.oodm.entities.Mention; @@ -15,8 +13,7 @@ /** * Created by tw on 11.07.17. */ -@Service -@Transactional(propagation = Propagation.REQUIRES_NEW, readOnly = false) +@Component public class StoreUserFromMentionImpl implements StoreUserFromMention { @Override diff --git a/src/main/java/org/woehlke/twitterwall/scheduled/service/persist/impl/StoreUserProfileForScreenNameImpl.java b/src/main/java/org/woehlke/twitterwall/scheduled/service/persist/impl/StoreUserProfileForScreenNameImpl.java index 8118788a..063f7002 100644 --- a/src/main/java/org/woehlke/twitterwall/scheduled/service/persist/impl/StoreUserProfileForScreenNameImpl.java +++ b/src/main/java/org/woehlke/twitterwall/scheduled/service/persist/impl/StoreUserProfileForScreenNameImpl.java @@ -3,16 +3,12 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.dao.EmptyResultDataAccessException; import org.springframework.social.RateLimitExceededException; import org.springframework.social.twitter.api.TwitterProfile; -import org.springframework.stereotype.Service; -import org.springframework.transaction.annotation.Propagation; -import org.springframework.transaction.annotation.Transactional; +import org.springframework.stereotype.Component; import org.woehlke.twitterwall.oodm.entities.User; import org.woehlke.twitterwall.oodm.entities.Task; import org.woehlke.twitterwall.oodm.service.UserService; -import org.woehlke.twitterwall.oodm.service.TaskService; import org.woehlke.twitterwall.scheduled.service.backend.TwitterApiService; import org.woehlke.twitterwall.scheduled.service.persist.StoreUserProfile; import org.woehlke.twitterwall.scheduled.service.persist.StoreUserProfileForScreenName; @@ -20,8 +16,7 @@ /** * Created by tw on 11.07.17. */ -@Service -@Transactional(propagation = Propagation.REQUIRES_NEW, readOnly = false) +@Component public class StoreUserProfileForScreenNameImpl implements StoreUserProfileForScreenName { @Override @@ -59,14 +54,11 @@ public User storeUserProfileForScreenName(String screenName, Task task){ private final StoreUserProfile storeUserProfile; - private final TaskService taskService; - @Autowired - public StoreUserProfileForScreenNameImpl(UserService userService, TwitterApiService twitterApiService, StoreUserProfile storeUserProfile, TaskService taskService) { + public StoreUserProfileForScreenNameImpl(UserService userService, TwitterApiService twitterApiService, StoreUserProfile storeUserProfile) { this.userService = userService; this.twitterApiService = twitterApiService; this.storeUserProfile = storeUserProfile; - this.taskService = taskService; } } diff --git a/src/main/java/org/woehlke/twitterwall/scheduled/service/persist/impl/StoreUserProfileForUserListImpl.java b/src/main/java/org/woehlke/twitterwall/scheduled/service/persist/impl/StoreUserProfileForUserListImpl.java index 38ba5fa4..176c4fdd 100644 --- a/src/main/java/org/woehlke/twitterwall/scheduled/service/persist/impl/StoreUserProfileForUserListImpl.java +++ b/src/main/java/org/woehlke/twitterwall/scheduled/service/persist/impl/StoreUserProfileForUserListImpl.java @@ -4,9 +4,7 @@ import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.social.twitter.api.TwitterProfile; -import org.springframework.stereotype.Service; -import org.springframework.transaction.annotation.Propagation; -import org.springframework.transaction.annotation.Transactional; +import org.springframework.stereotype.Component; import org.woehlke.twitterwall.oodm.entities.User; import org.woehlke.twitterwall.oodm.entities.Task; import org.woehlke.twitterwall.oodm.entities.Mention; @@ -18,8 +16,7 @@ /** * Created by tw on 09.07.17. */ -@Service -@Transactional(propagation = Propagation.REQUIRES_NEW, readOnly = false) +@Component public class StoreUserProfileForUserListImpl implements StoreUserProfileForUserList { @Override diff --git a/src/main/java/org/woehlke/twitterwall/scheduled/service/persist/impl/StoreUserProfileImpl.java b/src/main/java/org/woehlke/twitterwall/scheduled/service/persist/impl/StoreUserProfileImpl.java index 85898276..731f8f56 100644 --- a/src/main/java/org/woehlke/twitterwall/scheduled/service/persist/impl/StoreUserProfileImpl.java +++ b/src/main/java/org/woehlke/twitterwall/scheduled/service/persist/impl/StoreUserProfileImpl.java @@ -4,9 +4,7 @@ import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.social.twitter.api.TwitterProfile; -import org.springframework.stereotype.Service; -import org.springframework.transaction.annotation.Propagation; -import org.springframework.transaction.annotation.Transactional; +import org.springframework.stereotype.Component; import org.woehlke.twitterwall.oodm.entities.Task; import org.woehlke.twitterwall.oodm.entities.User; import org.woehlke.twitterwall.scheduled.service.persist.StoreUserProcess; @@ -16,8 +14,7 @@ /** * Created by tw on 09.07.17. */ -@Service -@Transactional(propagation = Propagation.REQUIRES_NEW, readOnly = false) +@Component public class StoreUserProfileImpl implements StoreUserProfile { @Override diff --git a/src/main/resources/logback.xml b/src/main/resources/logback.xml index adf435e4..eff8738f 100644 --- a/src/main/resources/logback.xml +++ b/src/main/resources/logback.xml @@ -2,7 +2,7 @@ - +