Skip to content

Commit 5fa272f

Browse files
workin on #161
1 parent 1c0b38a commit 5fa272f

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

59 files changed

+232
-244
lines changed

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ When creating a new issue, try following [necolas's guidelines][issue-guidelines
7575

7676
### Support
7777

78-
Let me know if you are using Twitterwall. I may get around to creating a showcase page listing user sites.
78+
Let me know if you are using Twitterwall. I may get around to creating a showcase pageContent listing user sites.
7979

8080
[Contact me][av-site] if you have questions about Twitterwall, or just like to say something about it.
8181
If you _really really_ like it and want to support the author, I will be glad to

src/main/java/org/woehlke/twitterwall/frontend/controller/common/GlobalExceptionHandler.java renamed to src/main/java/org/woehlke/twitterwall/frontend/controller/GlobalExceptionHandler.java

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package org.woehlke.twitterwall.frontend.controller.common;
1+
package org.woehlke.twitterwall.frontend.controller;
22

33
import org.slf4j.Logger;
44
import org.slf4j.LoggerFactory;
@@ -9,6 +9,8 @@
99
import org.springframework.web.bind.annotation.ExceptionHandler;
1010
import org.springframework.web.bind.annotation.ResponseStatus;
1111
import org.springframework.web.servlet.ModelAndView;
12+
import org.woehlke.twitterwall.frontend.controller.common.ControllerHelper;
13+
import org.woehlke.twitterwall.frontend.controller.common.Symbols;
1214

1315
import javax.servlet.http.HttpServletRequest;
1416

src/main/java/org/woehlke/twitterwall/frontend/controller/HashTagController.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
import org.woehlke.twitterwall.frontend.controller.common.HashTagsOverviewHelper;
1818
import org.woehlke.twitterwall.frontend.controller.common.Symbols;
1919
import org.woehlke.twitterwall.frontend.controller.common.ControllerHelper;
20-
import org.woehlke.twitterwall.frontend.model.HashTagOverview;
20+
import org.woehlke.twitterwall.oodm.entities.transients.HashTagOverview;
2121
import org.woehlke.twitterwall.oodm.entities.Tweet;
2222
import org.woehlke.twitterwall.oodm.entities.User;
2323
import org.woehlke.twitterwall.oodm.entities.HashTag;

src/main/java/org/woehlke/twitterwall/frontend/controller/common/HashTagsOverviewHelper.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
package org.woehlke.twitterwall.frontend.controller.common;
22

3-
import org.woehlke.twitterwall.frontend.model.HashTagOverview;
3+
import org.woehlke.twitterwall.oodm.entities.transients.HashTagOverview;
44

55
public interface HashTagsOverviewHelper {
66

src/main/java/org/woehlke/twitterwall/frontend/controller/common/Symbols.java

+6-4
Original file line numberDiff line numberDiff line change
@@ -9,18 +9,20 @@ public enum Symbols {
99
IMPRINT("<i class=\"fa fa-university\" aria-hidden=\"true\"></i>"),
1010
PROFILE("<i class=\"fa fa-users\" aria-hidden=\"true\"></i>"),
1111
HOME("<span class=\"glyphicon glyphicon-home\" aria-hidden=\"true\"></span>"),
12-
USER_ALL("<i class=\"fa fa-user\" aria-hidden=\"true\"></i>"),
12+
USER_ALL("<i class=\"fa fa-users\" aria-hidden=\"true\"></i>"),
1313
USER_TWEETS("<i class=\"fa fa-users\" aria-hidden=\"true\"></i>"),
1414
USER_NOT_YET_FRIENDS("<i class=\"fa fa-plus-square\" aria-hidden=\"true\"></i>"),
15-
GET_TEST_DATA("<i class=\"fa fa-cubes\" aria-hidden=\"true\"></i>\n"),
15+
GET_TEST_DATA("<i class=\"fa fa-cubes\" aria-hidden=\"true\"></i>"),
1616
EXCEPTION("<i class=\"fa fa-bolt\" aria-hidden=\"true\"></i>"),
1717
LEAF("<i class=\"fa fa-leaf\" aria-hidden=\"true\"></i>"),
1818
DATABASE("<i class=\"fa fa-database\" aria-hidden=\"true\"></i>"),
19-
USER_NOT_YET_ON_LIST("<i class=\"fa fa-handshake-o\" aria-hidden=\"true\"></i>\n"),
19+
USER_NOT_YET_ON_LIST("<i class=\"fa fa-handshake-o\" aria-hidden=\"true\"></i>"),
2020
USER_FRIENDS("<i class=\"fa fa-users\" aria-hidden=\"true\"></i>"),
2121
USER_FOLLOWER("<i class=\"fa fa-users\" aria-hidden=\"true\"></i>"),
2222
TASK("<i class=\"fa fa-check-square\" aria-hidden=\"true\"></i>"),
23-
TASK_HISTORY("<i class=\"fa fa-check-square-o\" aria-hidden=\"true\"></i>");
23+
TASK_HISTORY("<i class=\"fa fa-check-square-o\" aria-hidden=\"true\"></i>"),
24+
USER_NOTYETFIRENDS("<i class=\"fa fa-plus-square\" aria-hidden=\"true\"></i>"),
25+
HASHTAG_USER("<i class=\"fa fa-hashtag\" aria-hidden=\"true\"></i>");
2426

2527
Symbols(String html){
2628
this.html=html;

src/main/java/org/woehlke/twitterwall/frontend/controller/common/UrlPaths.java

-48
This file was deleted.

src/main/java/org/woehlke/twitterwall/frontend/controller/common/impl/ControllerHelperImpl.java

+23-23
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
import org.woehlke.twitterwall.conf.properties.TwitterProperties;
1212
import org.woehlke.twitterwall.conf.properties.FrontendProperties;
1313
import org.woehlke.twitterwall.frontend.controller.common.ControllerHelper;
14-
import org.woehlke.twitterwall.frontend.model.Page;
14+
import org.woehlke.twitterwall.oodm.entities.transients.PageContent;
1515

1616
/**
1717
* Created by tw on 18.07.17.
@@ -20,42 +20,42 @@
2020
@Transactional(propagation = Propagation.REQUIRES_NEW, readOnly = false)
2121
public class ControllerHelperImpl implements ControllerHelper {
2222

23-
private Page setupPage(Page page, String title, String subtitle, String symbol) {
24-
page.setTitle(title);
25-
page.setSubtitle(subtitle);
26-
page.setSymbol(symbol);
27-
page.setMenuAppName(frontendProperties.getMenuAppName());
28-
page.setTwitterSearchTerm(twitterProperties.getSearchQuery());
29-
page.setInfoWebpage(frontendProperties.getInfoWebpage());
30-
page.setTheme(frontendProperties.getTheme());
31-
page.setContextTest(frontendProperties.getContextTest());
32-
page.setHistoryBack(true);
23+
private PageContent setupPage(PageContent pageContent, String title, String subtitle, String symbol) {
24+
pageContent.setTitle(title);
25+
pageContent.setSubtitle(subtitle);
26+
pageContent.setSymbol(symbol);
27+
pageContent.setMenuAppName(frontendProperties.getMenuAppName());
28+
pageContent.setTwitterSearchTerm(twitterProperties.getSearchQuery());
29+
pageContent.setInfoWebpage(frontendProperties.getInfoWebpage());
30+
pageContent.setTheme(frontendProperties.getTheme());
31+
pageContent.setContextTest(frontendProperties.getContextTest());
32+
pageContent.setHistoryBack(true);
3333
if(!frontendProperties.getIdGoogleAnalytics().isEmpty()){
3434
String html = GOOGLE_ANALYTICS_SCRIPT_HTML;
3535
html = html.replace("###GOOGLE_ANALYTICS_ID###", frontendProperties.getIdGoogleAnalytics());
36-
page.setGoogleAnalyticScriptHtml(html);
36+
pageContent.setGoogleAnalyticScriptHtml(html);
3737
} else {
38-
page.setGoogleAnalyticScriptHtml("");
38+
pageContent.setGoogleAnalyticScriptHtml("");
3939
}
4040
log.info("--------------------------------------------------------------------");
41-
log.info("setupPage = "+page.toString());
41+
log.info("setupPage = "+ pageContent.toString());
4242
log.info("--------------------------------------------------------------------");
43-
return page;
43+
return pageContent;
4444
}
4545

4646
public ModelAndView setupPage(ModelAndView mav, String title, String subtitle, String symbol) {
47-
Page page = new Page();
48-
page = setupPage(page, title, subtitle, symbol);
49-
log.info("page: "+page.toString());
50-
mav.addObject("page", page);
47+
PageContent pageContent = new PageContent();
48+
pageContent = setupPage(pageContent, title, subtitle, symbol);
49+
log.info("pageContent: "+ pageContent.toString());
50+
mav.addObject("pageContent", pageContent);
5151
return mav;
5252
}
5353

5454
public Model setupPage(Model model, String title, String subtitle, String symbol) {
55-
Page page = new Page();
56-
page = setupPage(page, title, subtitle, symbol);
57-
log.info("page: "+page.toString());
58-
model.addAttribute("page", page);
55+
PageContent pageContent = new PageContent();
56+
pageContent = setupPage(pageContent, title, subtitle, symbol);
57+
log.info("pageContent: "+ pageContent.toString());
58+
model.addAttribute("pageContent", pageContent);
5959
return model;
6060
}
6161

src/main/java/org/woehlke/twitterwall/frontend/controller/common/impl/HashTagsOverviewHelperImpl.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@
99
import org.springframework.stereotype.Component;
1010
import org.woehlke.twitterwall.conf.properties.FrontendProperties;
1111
import org.woehlke.twitterwall.frontend.controller.common.HashTagsOverviewHelper;
12-
import org.woehlke.twitterwall.frontend.model.HashTagCounted;
13-
import org.woehlke.twitterwall.frontend.model.HashTagOverview;
12+
import org.woehlke.twitterwall.oodm.entities.transients.HashTagCounted;
13+
import org.woehlke.twitterwall.oodm.entities.transients.HashTagOverview;
1414
import org.woehlke.twitterwall.oodm.entities.HashTag;
1515
import org.woehlke.twitterwall.oodm.entities.Tweet;
1616
import org.woehlke.twitterwall.oodm.entities.User;

src/main/java/org/woehlke/twitterwall/frontend/rest/TaskResource.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
import org.springframework.web.bind.annotation.*;
99
import org.woehlke.twitterwall.conf.properties.FrontendProperties;
1010
import org.woehlke.twitterwall.frontend.controller.common.ControllerHelper;
11-
import org.woehlke.twitterwall.frontend.model.TaskResourceModel;
11+
import org.woehlke.twitterwall.oodm.entities.transients.TaskResourceModel;
1212
import org.woehlke.twitterwall.oodm.entities.Task;
1313
import org.woehlke.twitterwall.oodm.entities.TaskHistory;
1414
import org.woehlke.twitterwall.oodm.service.TaskHistoryService;

src/main/java/org/woehlke/twitterwall/oodm/entities/HashTag.java

+7
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@
88
import org.woehlke.twitterwall.oodm.entities.parts.HashTagText;
99

1010
import javax.persistence.*;
11+
import javax.validation.Valid;
12+
import javax.validation.constraints.AssertTrue;
13+
import javax.validation.constraints.NotNull;
1114
import java.util.HashMap;
1215
import java.util.Map;
1316

@@ -36,6 +39,8 @@ public class HashTag extends AbstractDomainObject<HashTag> implements DomainObje
3639
@GeneratedValue(strategy = GenerationType.AUTO)
3740
protected Long id;
3841

42+
@Valid
43+
@NotNull
3944
@Embedded
4045
private HashTagText hashTagText;
4146

@@ -69,6 +74,8 @@ public void setId(Long id) {
6974
this.id = id;
7075
}
7176

77+
@AssertTrue
78+
@Transient
7279
@Override
7380
public boolean isValid() {
7481
if(this.hashTagText == null){

src/main/java/org/woehlke/twitterwall/oodm/entities/Media.java

+6
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
import org.woehlke.twitterwall.oodm.entities.parts.UrlField;
1212

1313
import javax.persistence.*;
14+
import javax.validation.Valid;
1415
import javax.validation.constraints.NotNull;
1516
import java.util.HashMap;
1617
import java.util.Map;
@@ -52,21 +53,26 @@ public class Media extends AbstractDomainObject<Media> implements DomainObjectEn
5253
@Column(name="id_twitter", nullable = false)
5354
private Long idTwitter;
5455

56+
@URL
5557
@NotNull
5658
@Column(name = "media_http",length=4096, nullable = false)
5759
private String mediaHttp = "";
5860

61+
@URL
5962
@NotNull
6063
@Column(name = "media_https",length=4096, nullable = false)
6164
private String mediaHttps = "";
6265

66+
@Valid
67+
@NotNull
6368
@Embedded
6469
private UrlField url;
6570

6671
@NotNull
6772
@Column(length=4096, nullable = false)
6873
private String display = "";
6974

75+
@URL
7076
@NotNull
7177
@Column(length=4096, nullable = false)
7278
private String expanded = "";

src/main/java/org/woehlke/twitterwall/oodm/entities/Mention.java

+1
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ public class Mention extends AbstractDomainObject<Mention> implements DomainObje
5555
private Long idTwitter;
5656

5757
@Valid
58+
@NotNull
5859
@Embedded
5960
private ScreenName screenName;
6061

src/main/java/org/woehlke/twitterwall/oodm/entities/TickerSymbol.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
@NamedQueries({
3030
@NamedQuery(
3131
name="TickerSymbol.findByUniqueId",
32-
query="select t from TickerSymbol t where t.url=:url and t.tickerSymbol=:tickerSymbol"
32+
query="select t from TickerSymbol t where t.url.url=:url and t.tickerSymbol=:tickerSymbol"
3333
)
3434
})
3535
@EntityListeners(TickerSymbolListener.class)
@@ -94,7 +94,7 @@ public boolean isValid() {
9494
@Override
9595
public Map<String,Object> getParametersForFindByUniqueId(){
9696
Map<String,Object> parameters = new HashMap<>();
97-
parameters.put("url",this.url);
97+
parameters.put("url",this.url.getUrl());
9898
parameters.put("tickerSymbol",this.tickerSymbol);
9999
return parameters;
100100
}

src/main/java/org/woehlke/twitterwall/oodm/entities/Url.java

+2
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010

1111
import javax.persistence.*;
1212
import javax.validation.Valid;
13+
import javax.validation.constraints.AssertTrue;
1314
import javax.validation.constraints.NotNull;
1415
import java.util.HashMap;
1516
import java.util.Map;
@@ -97,6 +98,7 @@ public boolean isRawUrlsFromDescription() {
9798
return (this.display.compareTo(UNDEFINED)==0)&&(this.expanded.compareTo(UNDEFINED)==0);
9899
}
99100

101+
@AssertTrue
100102
@Transient
101103
@Override
102104
public boolean isValid() {

src/main/java/org/woehlke/twitterwall/oodm/entities/User.java

+13
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111

1212
import javax.persistence.*;
1313
import javax.validation.Valid;
14+
import javax.validation.constraints.AssertTrue;
1415
import javax.validation.constraints.NotNull;
1516
import java.util.Date;
1617
import java.util.HashMap;
@@ -118,6 +119,8 @@ public class User extends AbstractDomainObject<User> implements DomainObjectWith
118119
@Column(name="id_twitter",nullable = false)
119120
private Long idTwitter;
120121

122+
@Valid
123+
@NotNull
121124
@Embedded
122125
private ScreenName screenName;
123126

@@ -352,6 +355,7 @@ public String getQueryNameForFindByUniqueId(){
352355
return "User.findByUniqueId";
353356
}
354357

358+
@AssertTrue
355359
@Transient
356360
@Override
357361
public boolean isValid() {
@@ -364,6 +368,15 @@ public boolean isValid() {
364368
if(this.screenName == null){
365369
return false;
366370
}
371+
if(!this.screenName.isValid()){
372+
return false;
373+
}
374+
if(this.url==null){
375+
return false;
376+
}
377+
if(!this.url.isValid()){
378+
return false;
379+
}
367380
return true;
368381
}
369382

src/main/java/org/woehlke/twitterwall/frontend/model/HashTagCounted.java renamed to src/main/java/org/woehlke/twitterwall/oodm/entities/transients/HashTagCounted.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package org.woehlke.twitterwall.frontend.model;
1+
package org.woehlke.twitterwall.oodm.entities.transients;
22

33
import java.io.Serializable;
44

src/main/java/org/woehlke/twitterwall/frontend/model/HashTagOverview.java renamed to src/main/java/org/woehlke/twitterwall/oodm/entities/transients/HashTagOverview.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package org.woehlke.twitterwall.frontend.model;
1+
package org.woehlke.twitterwall.oodm.entities.transients;
22

33
import java.io.Serializable;
44
import java.util.ArrayList;

src/main/java/org/woehlke/twitterwall/frontend/model/Page.java renamed to src/main/java/org/woehlke/twitterwall/oodm/entities/transients/PageContent.java

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
package org.woehlke.twitterwall.frontend.model;
1+
package org.woehlke.twitterwall.oodm.entities.transients;
22

33
import java.io.Serializable;
44

55
/**
66
* Created by tw on 13.06.17.
77
*/
8-
public class Page implements Serializable {
8+
public class PageContent implements Serializable {
99

1010
private String title;
1111
private String subtitle;
@@ -81,7 +81,7 @@ public boolean isHistoryBack() {
8181
public void setHistoryBack(boolean historyBack) {
8282
this.historyBack = historyBack;
8383
}
84-
84+
8585
public String getTheme() {
8686
return theme;
8787
}
@@ -100,7 +100,7 @@ public void setContextTest(boolean contextTest) {
100100

101101
@Override
102102
public String toString() {
103-
return "Page{" +
103+
return "PageContent{" +
104104
"title='" + title + '\'' +
105105
", subtitle='" + subtitle + '\'' +
106106
", menuAppName='" + menuAppName + '\'' +

0 commit comments

Comments
 (0)