Skip to content

Commit 2e59f2e

Browse files
Merge pull request #136 from phasenraum2010/milestone-1.0.13
Milestone 1.0.13
2 parents f69b976 + c5ee31e commit 2e59f2e

File tree

89 files changed

+1355
-1628
lines changed

Some content is hidden

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

89 files changed

+1355
-1628
lines changed

src/main/java/org/woehlke/twitterwall/conf/DataSourceConf.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,15 @@
55
import org.springframework.context.annotation.Bean;
66
import org.springframework.context.annotation.Configuration;
77
import org.springframework.context.annotation.Primary;
8+
import org.springframework.data.jpa.repository.config.EnableJpaRepositories;
89

910
import javax.sql.DataSource;
1011

1112
/**
1213
* Created by tw on 19.06.17.
1314
*/
1415
@Configuration
16+
@EnableJpaRepositories("org.woehlke.twitterwall.oodm.repositories")
1517
public class DataSourceConf {
1618

1719
@Bean

src/main/java/org/woehlke/twitterwall/frontend/controller/DomainController.java renamed to src/main/java/org/woehlke/twitterwall/frontend/controller/ApplicationController.java

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
*/
1616
@Controller
1717
@RequestMapping(path="/application")
18-
public class DomainController {
18+
public class ApplicationController {
1919

2020
@RequestMapping(path="/domain/count")
2121
public String domainCount(Model model) {
@@ -30,10 +30,25 @@ public String domainCount(Model model) {
3030
return "application/domain/count";
3131
}
3232

33+
@RequestMapping(path="/management")
34+
public String dmanagementPage(Model model) {
35+
String msg = "/application/domain/count: ";
36+
controllerHelper.logEnv();
37+
String title = "Application Management";
38+
String subtitle = twitterProperties.getSearchQuery();
39+
String symbol = Symbols.DATABASE.toString();
40+
model = controllerHelper.setupPage(model,title,subtitle,symbol);
41+
//CountedEntities countedEntities =this.countedEntitiesService.countAll();
42+
//model.addAttribute("countedEntities", countedEntities);
43+
44+
return "application/management";
45+
}
46+
47+
3348
private final CountedEntitiesService countedEntitiesService;
3449

3550
@Autowired
36-
public DomainController(CountedEntitiesService countedEntitiesService, ControllerHelper controllerHelper, TwitterProperties twitterProperties) {
51+
public ApplicationController(CountedEntitiesService countedEntitiesService, ControllerHelper controllerHelper, TwitterProperties twitterProperties) {
3752
this.countedEntitiesService = countedEntitiesService;
3853
this.controllerHelper = controllerHelper;
3954
this.twitterProperties = twitterProperties;
Lines changed: 32 additions & 104 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,15 @@
11
package org.woehlke.twitterwall.oodm.entities;
22

33
import org.hibernate.validator.constraints.SafeHtml;
4-
import org.woehlke.twitterwall.oodm.entities.parts.AbstractTwitterObject;
4+
import org.woehlke.twitterwall.oodm.entities.parts.AbstractDomainObject;
55
import org.woehlke.twitterwall.oodm.entities.common.DomainObject;
6-
import org.woehlke.twitterwall.oodm.entities.parts.TaskInfo;
76
import org.woehlke.twitterwall.oodm.entities.common.DomainObjectWithTask;
87
import org.woehlke.twitterwall.oodm.entities.listener.HashTagListener;
98

109
import javax.persistence.*;
11-
import javax.validation.constraints.NotNull;
1210
import java.util.regex.Matcher;
1311
import java.util.regex.Pattern;
1412

15-
import static javax.persistence.CascadeType.DETACH;
16-
import static javax.persistence.CascadeType.REFRESH;
17-
import static javax.persistence.FetchType.EAGER;
18-
1913
/**
2014
* Created by tw on 10.06.17.
2115
*/
@@ -26,46 +20,32 @@
2620
@UniqueConstraint(name="unique_hashtag",columnNames = {"text"})
2721
}
2822
)
23+
@NamedQueries({
24+
@NamedQuery(
25+
name="HashTag.findByUniqueId",
26+
query="select t from HashTag t where t.text=:text"
27+
)
28+
})
2929
@EntityListeners(HashTagListener.class)
30-
public class HashTag extends AbstractTwitterObject<HashTag> implements DomainObject<HashTag>,DomainObjectWithTask<HashTag> {
30+
public class HashTag extends AbstractDomainObject<HashTag> implements DomainObject<HashTag>,DomainObjectWithTask<HashTag> {
3131

3232
private static final long serialVersionUID = 1L;
3333

3434
@Id
3535
@GeneratedValue(strategy = GenerationType.AUTO)
3636
protected Long id;
3737

38-
@NotNull
39-
@Embedded
40-
private TaskInfo taskInfo = new TaskInfo();
41-
42-
@NotNull
43-
@JoinColumn(name = "fk_user_created_by")
44-
@ManyToOne(cascade = { REFRESH, DETACH }, fetch = EAGER,optional = false)
45-
private Task createdBy;
46-
47-
@JoinColumn(name = "fk_user_updated_by")
48-
@ManyToOne(cascade = { REFRESH ,DETACH}, fetch = EAGER,optional = true)
49-
private Task updatedBy;
50-
5138
@SafeHtml
5239
@Column(name="text", nullable = false,length=4096)
5340
private String text = "";
5441

5542
public HashTag(Task createdBy, Task updatedBy, String text) {
56-
this.createdBy = createdBy;
57-
this.updatedBy = updatedBy;
43+
super(createdBy,updatedBy);
5844
this.text = text;
5945
}
6046

61-
public HashTag(String text, Task task) {
62-
this.text = text;
63-
this.createdBy = task;
64-
this.updatedBy = task;
65-
this.taskInfo.setTaskInfoFromTask(task);
66-
}
67-
6847
private HashTag() {
48+
super();
6949
}
7050

7151
public final static String HASHTAG_TEXT_PATTERN = "[öÖäÄüÜßa-zA-Z0-9_]{1,139}";
@@ -91,6 +71,11 @@ public void setId(Long id) {
9171
this.id = id;
9272
}
9373

74+
@Override
75+
public String getUniqueId() {
76+
return text;
77+
}
78+
9479

9580
public String getText() {
9681
return this.text;
@@ -104,95 +89,38 @@ public void setText(String text) {
10489
this.text = text;
10590
}
10691

107-
public TaskInfo getTaskInfo() {
108-
return taskInfo;
109-
}
110-
111-
public void setTaskInfo(TaskInfo taskInfo) {
112-
this.taskInfo = taskInfo;
113-
}
114-
115-
public Task getCreatedBy() {
116-
return createdBy;
117-
}
118-
119-
public void setCreatedBy(Task createdBy) {
120-
taskInfo.setTaskInfoFromTask(createdBy);
121-
this.createdBy = createdBy;
122-
}
123-
124-
public Task getUpdatedBy() {
125-
return updatedBy;
92+
@Override
93+
public String toString() {
94+
return "HashTag{" +
95+
" id=" + id +
96+
", text='" + text + '\'' +
97+
super.toString() +
98+
" }\n";
12699
}
127100

128-
public void setUpdatedBy(Task updatedBy) {
129-
taskInfo.setTaskInfoFromTask(updatedBy);
130-
this.updatedBy = updatedBy;
101+
@Override
102+
public boolean isValid() {
103+
if((text == null)||(text.isEmpty())){
104+
return false;
105+
}
106+
return true;
131107
}
132108

133109
@Override
134110
public boolean equals(Object o) {
135111
if (this == o) return true;
136112
if (!(o instanceof HashTag)) return false;
137-
if (!super.equals(o)) return false;
138113

139114
HashTag hashTag = (HashTag) o;
140115

141-
return text != null ? text.equals(hashTag.text) : hashTag.text == null;
116+
if (getId() != null ? !getId().equals(hashTag.getId()) : hashTag.getId() != null) return false;
117+
return getText() != null ? getText().equals(hashTag.getText()) : hashTag.getText() == null;
142118
}
143119

144120
@Override
145121
public int hashCode() {
146-
int result = super.hashCode();
147-
result = 31 * result + (text != null ? text.hashCode() : 0);
122+
int result = getId() != null ? getId().hashCode() : 0;
123+
result = 31 * result + (getText() != null ? getText().hashCode() : 0);
148124
return result;
149125
}
150-
151-
@Override
152-
public int compareTo(HashTag other) {
153-
return text.compareTo(other.getText());
154-
}
155-
156-
private String toStringCreatedBy(){
157-
if(createdBy==null){
158-
return " null ";
159-
} else {
160-
return createdBy.toString();
161-
}
162-
}
163-
164-
private String toStringUpdatedBy(){
165-
if(updatedBy==null){
166-
return " null ";
167-
} else {
168-
return updatedBy.toString();
169-
}
170-
}
171-
172-
private String toStringTaskInfo(){
173-
if(taskInfo==null){
174-
return " null ";
175-
} else {
176-
return taskInfo.toString();
177-
}
178-
}
179-
180-
@Override
181-
public String toString() {
182-
return "HashTag{" +
183-
" id=" + id +
184-
", text='" + text + '\'' +
185-
",\n createdBy="+ toStringCreatedBy() +
186-
",\n updatedBy=" + toStringUpdatedBy() +
187-
",\n taskInfo="+ toStringTaskInfo() +
188-
" }\n";
189-
}
190-
191-
@Override
192-
public boolean isValid() {
193-
if((text == null)||(text.isEmpty())){
194-
return false;
195-
}
196-
return true;
197-
}
198126
}

0 commit comments

Comments
 (0)