Skip to content

Commit 5b7c680

Browse files
committed
work in progres
1 parent 0fa818e commit 5b7c680

37 files changed

+579
-430
lines changed

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,4 +34,4 @@ setenv.cmd
3434
/src/main/java/org/woehlke/simpleworklist/task/x.txt
3535
/src/main/java/org/woehlke/simpleworklist/context/x.txt
3636
/src/main/java/org/woehlke/simpleworklist/error/x.txt
37-
/src/main/java/org/woehlke/simpleworklist/search/x.txt
37+
/src/main/java/org/woehlke/simpleworklist/searchRequest/x.txt

etc/serialversions/classpath.txt

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

etc/serialversions/getserialversionid.cmd

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,13 +35,13 @@ serialver org.woehlke.simpleworklist.breadcrumb.Breadcrumb >> ..\..\etc\serialv
3535
serialver org.woehlke.simpleworklist.user.login.LoginForm >> ..\..\etc\serialversions.txt
3636
serialver org.woehlke.simpleworklist.context.NewContextForm >> ..\..\etc\serialversions.txt
3737
serialver org.woehlke.simpleworklist.user.messages.User2UserMessageFormBean >> ..\..\etc\serialversions.txt
38-
serialver org.woehlke.simpleworklist.search.SearchResult >> ..\..\etc\serialversions.txt
38+
serialver org.woehlke.simpleworklist.searchRequest.SearchResult >> ..\..\etc\serialversions.txt
3939
serialver org.woehlke.simpleworklist.user.account.UserAccountForm >> ..\..\etc\serialversions.txt
4040
serialver org.woehlke.simpleworklist.context.UserChangeDefaultContextForm >> ..\..\etc\serialversions.txt
4141
serialver org.woehlke.simpleworklist.language.UserChangeLanguageForm >> ..\..\etc\serialversions.txt
4242
serialver org.woehlke.simpleworklist.user.selfservice.UserChangeNameForm >> ..\..\etc\serialversions.txt
4343
serialver org.woehlke.simpleworklist.user.selfservice.UserChangePasswordForm >> ..\..\etc\serialversions.txt
44-
@rem serialver org.woehlke.simpleworklist.user.UserDetailsBean >> ..\..\etc\serialversions.txt
44+
@rem serialver org.woehlke.simpleworklist.user.account.UserDetailsBean >> ..\..\etc\serialversions.txt
4545
serialver org.woehlke.simpleworklist.user.register.UserRegistrationForm >> ..\..\etc\serialversions.txt
4646
serialver org.woehlke.simpleworklist.session.UserSessionBean >> ..\..\etc\serialversions.txt
4747
cd ..\..

etc/serialversions/getserialversionid.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ serialver org.woehlke.simpleworklist.context.UserChangeDefaultContextForm >> $SE
5353
serialver org.woehlke.simpleworklist.language.UserChangeLanguageForm >> $SERIALVERSIONS_FILE
5454
serialver org.woehlke.simpleworklist.user.selfservice.UserChangeNameForm >> $SERIALVERSIONS_FILE
5555
serialver org.woehlke.simpleworklist.user.selfservice.UserChangePasswordForm >> $SERIALVERSIONS_FILE
56-
#serialver org.woehlke.simpleworklist.user.UserDetailsBean >> $SERIALVERSIONS_FILE
56+
#serialver org.woehlke.simpleworklist.user.account.UserDetailsBean >> $SERIALVERSIONS_FILE
5757
serialver org.woehlke.simpleworklist.user.register.UserRegistrationForm >> $SERIALVERSIONS_FILE
5858
serialver org.woehlke.simpleworklist.user.UserSessionBean >> $SERIALVERSIONS_FILE
5959
cd $PROJECT_PATH

etc/serialversions/serialversions.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ org.woehlke.simpleworklist.breadcrumb.Breadcrumb: private static final long s
1818
org.woehlke.simpleworklist.user.login.LoginForm: private static final long serialVersionUID = 5936886560348238355L;
1919
org.woehlke.simpleworklist.context.NewContextForm: private static final long serialVersionUID = -937143305653156981L;
2020
org.woehlke.simpleworklist.user.messages.User2UserMessageFormBean: private static final long serialVersionUID = 1576610181966480168L;
21-
org.woehlke.simpleworklist.search.SearchResult: private static final long serialVersionUID = 1682809351146047764L;
21+
org.woehlke.simpleworklist.searchRequest.SearchResult: private static final long serialVersionUID = 1682809351146047764L;
2222
org.woehlke.simpleworklist.user.account.UserAccountForm: private static final long serialVersionUID = 9180383385243540190L;
2323
org.woehlke.simpleworklist.context.UserChangeDefaultContextForm: private static final long serialVersionUID = -8592295563275083292L;
2424
org.woehlke.simpleworklist.language.UserChangeLanguageForm: private static final long serialVersionUID = 2201123162578113187L;

run.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,8 @@ function testing() {
4949
}
5050

5151
function run() {
52-
runHerokuLocal
53-
#runDev
52+
#runHerokuLocal
53+
runDev
5454
}
5555

5656
function main() {

src/main/java/org/woehlke/simpleworklist/common/AbstractController.java

Lines changed: 29 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@
2727
import java.util.List;
2828
import java.util.Locale;
2929

30+
import static java.util.Locale.GERMAN;
31+
3032
/**
3133
* Created by tw on 14.02.16.
3234
*/
@@ -60,17 +62,23 @@ public abstract class AbstractController {
6062
@Autowired
6163
protected BreadcrumbService breadcrumbService;
6264

65+
//TODO: rename allCategories to allProjects
6366
@ModelAttribute("allCategories")
64-
public final List<Project> getAllCategories(@ModelAttribute("userSession") UserSessionBean userSession,
65-
BindingResult result, Model model) {
67+
public final List<Project> getAllCategories(
68+
@ModelAttribute("userSession") UserSessionBean userSession,
69+
BindingResult result, //TODO: remove
70+
Model model //TODO: remove
71+
) {
6672
Context context = this.getContext(userSession);
6773
return projectService.findAllProjectsByContext(context);
6874
}
6975

76+
//TODO: rename rootCategories to rootProjects
7077
@ModelAttribute("rootCategories")
7178
public final List<Project> getRootCategories(
72-
@ModelAttribute("userSession") UserSessionBean userSession,
73-
BindingResult result, Model model
79+
@ModelAttribute("userSession") UserSessionBean userSession,
80+
BindingResult result, //TODO: remove
81+
Model model //TODO: remove
7482
) {
7583
Context context = this.getContext(userSession);
7684
return projectService.findRootProjectsByContext(context);
@@ -108,10 +116,18 @@ public final List<TaskState> getTaskStates(){
108116
}
109117

110118
@ModelAttribute("context")
111-
public final String getCurrentArea(@ModelAttribute("userSession") UserSessionBean userSession,
112-
Locale locale){
113-
Context context = this.getContext(userSession);
114-
if(locale == Locale.GERMAN){
119+
public final String getCurrentContext(
120+
@ModelAttribute("userSession") UserSessionBean userSession,
121+
@ModelAttribute("userSession") Locale locale
122+
){
123+
if(userSession == null){
124+
userSession = new UserSessionBean();
125+
}
126+
if(locale == null){
127+
locale = Locale.ENGLISH;
128+
}
129+
Context context = getContext(userSession);
130+
if(locale == GERMAN){
115131
return context.getNameDe();
116132
} else {
117133
return context.getNameEn();
@@ -123,21 +139,17 @@ public final boolean refreshMessagePage(){
123139
return false;
124140
}
125141

126-
protected UserAccount getUser(){
142+
protected UserAccount getUser() {
127143
return this.userAccountLoginSuccessService.retrieveCurrentUser();
128144
}
129145

130146
protected Context getContext(UserSessionBean userSession){
131147
UserAccount thisUser = this.getUser();
132148
long defaultContextId = thisUser.getDefaultContext().getId();
133-
if(userSession == null){
134-
userSession = new UserSessionBean(defaultContextId);
135-
}
136-
long contextId = userSession.getContextId();
137-
if(contextId == 0){
138-
userSession.setContextId(defaultContextId);
139-
}
140-
return contextService.findByIdAndUserAccount(contextId, thisUser);
149+
Context context = contextService.findByIdAndUserAccount(defaultContextId, thisUser);
150+
userSession.setLastContextId(context.getId());
151+
userSession.setUserAccountid(thisUser.getId());
152+
return context;
141153
}
142154

143155
}

src/main/java/org/woehlke/simpleworklist/common/AuditModel.java

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,11 @@
1111
import java.util.Date;
1212
import java.util.Objects;
1313

14-
;
1514
@MappedSuperclass
1615
@EntityListeners(AuditingEntityListener.class)
1716
@JsonIgnoreProperties(
18-
value = {"rowCreatedAt", "rowUpdatedAt"},
19-
allowGetters = true
17+
value = {"rowCreatedAt", "rowUpdatedAt"},
18+
allowGetters = true
2019
)
2120
public class AuditModel implements Serializable {
2221

@@ -25,14 +24,14 @@ public class AuditModel implements Serializable {
2524
@Column(name="uuid", nullable = false)
2625
protected String uuid;
2726

27+
@CreatedDate
2828
@Temporal(TemporalType.TIMESTAMP)
2929
@Column(name = "row_created_at", nullable = false, updatable = false)
30-
@CreatedDate
3130
protected Date rowCreatedAt;
3231

32+
@LastModifiedDate
3333
@Temporal(TemporalType.TIMESTAMP)
3434
@Column(name = "row_updated_at", nullable = false)
35-
@LastModifiedDate
3635
protected Date rowUpdatedAt;
3736

3837
public String getUuid() {

src/main/java/org/woehlke/simpleworklist/context/Context.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,8 @@
3838
@Getter
3939
@Setter
4040
@NoArgsConstructor
41-
@EqualsAndHashCode
42-
@ToString
41+
@EqualsAndHashCode(callSuper = true)
42+
@ToString(callSuper = true)
4343
public class Context extends AuditModel implements Serializable, ComparableById<Context> {
4444

4545
private static final long serialVersionUID = -5035732370606951871L;

src/main/java/org/woehlke/simpleworklist/context/ContextController.java

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,16 +29,18 @@ public ContextController(ContextService contextService) {
2929

3030
@RequestMapping(path = "/choose/{newContextId}", method = RequestMethod.GET)
3131
public String switchContxt(
32-
@PathVariable("newContextId") Context setContext,
32+
@PathVariable("newContextId") Context newContext,
3333
@ModelAttribute("userSession") UserSessionBean userSession,
3434
Model model
3535
){
3636
log.info("switchContxt");
37-
Context isContext = super.getContext(userSession);
38-
if (setContext != null) {
39-
userSession.setContextId(setContext.getId());
37+
Context oldContext = super.getContext(userSession);
38+
if (newContext != null) {
39+
userSession.setLastContextId(newContext.getId());
40+
} else {
41+
userSession.setLastContextId(oldContext.getId());
4042
}
41-
model.addAttribute("userSession",userSession);
43+
model.addAttribute("userSession", userSession);
4244
return "redirect:/taskstate/inbox";
4345
}
4446
}

0 commit comments

Comments
 (0)