Skip to content

Commit ff4bcc7

Browse files
author
jezekp
committed
Merge branch 'master' into Production
2 parents bea8b2b + 86f5890 commit ff4bcc7

File tree

21 files changed

+666
-172
lines changed

21 files changed

+666
-172
lines changed

pom.xml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -787,6 +787,14 @@
787787
<encoding>${project.build.sourceEncoding}</encoding>
788788
</configuration>
789789
</plugin>
790+
<plugin>
791+
<groupId>org.apache.maven.plugins</groupId>
792+
<artifactId>maven-surefire-plugin</artifactId>
793+
<version>2.17</version>
794+
<configuration>
795+
<argLine>-Xmx1024m</argLine>
796+
</configuration>
797+
</plugin>
790798
<plugin>
791799
<groupId>org.mortbay.jetty</groupId>
792800
<artifactId>jetty-maven-plugin</artifactId>

src/main/java/cz/zcu/kiv/eegdatabase/logic/controller/social/OAuthCallbackController.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ public class OAuthCallbackController extends MultiActionController {
5555
private Log log = LogFactory.getLog(getClass());
5656

5757

58-
58+
// XXX This redirect on some hello world jsp..why what is it ? I think its garbage. Remove ???
5959
public ModelAndView oauthcallback(HttpServletRequest request, HttpServletResponse response) {
6060
ModelAndView mav = new ModelAndView("social/oauthcallback");
6161
return mav;

src/main/java/cz/zcu/kiv/eegdatabase/logic/controller/social/SocialConnectionSignUp.java

Lines changed: 8 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -22,15 +22,14 @@
2222
******************************************************************************/
2323
package cz.zcu.kiv.eegdatabase.logic.controller.social;
2424

25-
import cz.zcu.kiv.eegdatabase.data.pojo.Person;
26-
import cz.zcu.kiv.eegdatabase.wui.core.person.PersonService;
25+
import org.apache.commons.logging.Log;
26+
import org.apache.commons.logging.LogFactory;
2727
import org.springframework.social.connect.Connection;
2828
import org.springframework.social.connect.ConnectionSignUp;
2929
import org.springframework.social.connect.UserProfile;
30-
import org.springframework.social.linkedin.api.LinkedIn;
31-
import org.springframework.social.linkedin.api.LinkedInProfileFull;
3230

33-
import javax.inject.Inject;
31+
import cz.zcu.kiv.eegdatabase.data.pojo.Person;
32+
import cz.zcu.kiv.eegdatabase.wui.core.person.PersonService;
3433

3534
/**
3635
* Class for signing in in via social networks. Invoked when no such
@@ -39,34 +38,23 @@
3938
*
4039
*/
4140
public final class SocialConnectionSignUp implements ConnectionSignUp {
41+
42+
protected Log log = LogFactory.getLog(getClass());
4243

4344
private PersonService personService;
44-
private @Inject LinkedIn linkedin;
45-
4645

4746
public SocialConnectionSignUp(PersonService personService) {
4847
this.personService = personService;
4948
}
5049

5150
@Override
5251
public String execute(Connection<?> connection) {
52+
5353
UserProfile profile = connection.fetchUserProfile();
54-
String email = profile.getEmail();
55-
56-
if (email == null) {
57-
LinkedIn ln = (LinkedIn) connection.getApi();
58-
LinkedInProfileFull full = ln.profileOperations().getUserProfileFull();
59-
System.out.println("xxxx " + full.getId());
60-
linkedin.profileOperations().getUserProfile().getId();
61-
62-
}
63-
64-
6554
SocialUser user = new SocialUser(profile.getEmail(),
6655
profile.getFirstName(), profile.getLastName());
67-
6856
Person person = personService.createPerson(user, null);
69-
57+
7058
return person.getUsername();
7159

7260
}

src/main/java/cz/zcu/kiv/eegdatabase/wui/app/EEGDataBaseApplication.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@
3232
import org.apache.wicket.authroles.authorization.strategies.role.annotations.AnnotationsRoleAuthorizationStrategy;
3333
import org.apache.wicket.core.request.mapper.CryptoMapper;
3434
import org.apache.wicket.markup.html.WebPage;
35-
import org.apache.wicket.protocol.http.WebApplication;
3635
import org.apache.wicket.request.Request;
3736
import org.apache.wicket.request.Response;
3837
import org.apache.wicket.settings.IExceptionSettings;
@@ -77,6 +76,7 @@
7776
import cz.zcu.kiv.eegdatabase.wui.ui.articles.ArticlesPage;
7877
import cz.zcu.kiv.eegdatabase.wui.ui.articles.ArticlesSettingsPage;
7978
import cz.zcu.kiv.eegdatabase.wui.ui.articles.ViewArticlePage;
79+
import cz.zcu.kiv.eegdatabase.wui.ui.data.AddDataFilePage;
8080
import cz.zcu.kiv.eegdatabase.wui.ui.data.DataFileDetailPage;
8181
import cz.zcu.kiv.eegdatabase.wui.ui.experiments.ExperimentFormPage;
8282
import cz.zcu.kiv.eegdatabase.wui.ui.experiments.ExperimentsDetailPage;
@@ -252,6 +252,7 @@ private void mountPages() {
252252
mountPage("experiments-detail", ExperimentsDetailPage.class);
253253
mountPage("experiments-form", ExperimentFormPage.class);
254254
mountPage("experiments-download", ExperimentsDownloadPage.class);
255+
mountPage("experiments-add-file", AddDataFilePage.class);
255256
mountPage("file-detail", DataFileDetailPage.class);
256257

257258
mountPage("groups-list", ListResearchGroupsPage.class);

src/main/java/cz/zcu/kiv/eegdatabase/wui/core/person/PersonServiceImpl.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,15 +33,20 @@
3333
import cz.zcu.kiv.eegdatabase.logic.controller.social.SocialUser;
3434
import cz.zcu.kiv.eegdatabase.logic.util.ControllerUtils;
3535
import cz.zcu.kiv.eegdatabase.wui.app.session.EEGDataBaseSession;
36+
3637
import org.apache.commons.logging.Log;
38+
3739
import cz.zcu.kiv.eegdatabase.wui.core.license.LicenseFacade;
40+
3841
import org.apache.commons.logging.LogFactory;
3942
import org.springframework.beans.factory.annotation.Required;
4043
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
4144
import org.springframework.transaction.annotation.Transactional;
4245

4346
import java.sql.Timestamp;
4447
import java.text.ParseException;
48+
import java.util.Calendar;
49+
import java.util.Date;
4550
import java.util.List;
4651
import java.util.Map;
4752

@@ -116,6 +121,10 @@ public Person createPerson(SocialUser userFb, Integer educationLevelId) {
116121
person.setGivenname(userFb.getFirstName());
117122
person.setSurname(userFb.getLastName());
118123
person.setGender('M');
124+
125+
Calendar cal = Calendar.getInstance();
126+
cal.set(1970, 1, 1);
127+
person.setDateOfBirth(new Timestamp(cal.getTimeInMillis()));
119128

120129
person.setLaterality(DEFAULT_LATERALITY);
121130
person.setEducationLevel(educationLevelId == null ? null : educationLevelDao.read(educationLevelId));
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
<!--
2+
This file is part of the EEG-database project
3+
4+
==========================================
5+
6+
Copyright (C) 2013 by University of West Bohemia (http://www.zcu.cz/en/)
7+
8+
***********************************************************************************************************************
9+
10+
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
11+
the License. You may obtain a copy of the License at
12+
13+
http://www.apache.org/licenses/LICENSE-2.0
14+
15+
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on
16+
an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
17+
specific language governing permissions and limitations under the License.
18+
19+
***********************************************************************************************************************
20+
21+
AddDataFilePage.html, 2014/06/12 00:01 Jakub Rinkes
22+
-->
23+
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
24+
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:wicket="http://wicket.apache.org/dtds.data/wicket-xhtml1.4-strict.dtd" xml:lang="en" lang="en">
25+
<body>
26+
<wicket:extend>
27+
<div class="leftMenu" wicket:id="leftMenu"></div>
28+
29+
<div class="mainContentWithMenu">
30+
31+
<h1>
32+
<wicket:message key="pageTitle.addDataFile"></wicket:message>
33+
</h1>
34+
35+
<form class="standardInputForm" wicket:id="uploadForm">
36+
<fieldset>
37+
<div class="itemBox">
38+
<label for="file"> <wicket:message key="label.dataFile"></wicket:message></label>
39+
<span wicket:id="fileFeedback"></span>
40+
<br />
41+
<div wicket:id="file"></div>
42+
</div>
43+
44+
<div class="itemBox">
45+
<input type="submit" wicket:id="submit" class="submitButton lightButtonLink" />
46+
</div>
47+
</fieldset>
48+
</form>
49+
</div>
50+
</wicket:extend>
51+
</body>
52+
</html>
Lines changed: 145 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,145 @@
1+
/*******************************************************************************
2+
* This file is part of the EEG-database project
3+
*
4+
* ==========================================
5+
*
6+
* Copyright (C) 2013 by University of West Bohemia (http://www.zcu.cz/en/)
7+
*
8+
* ***********************************************************************************************************************
9+
*
10+
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
11+
* the License. You may obtain a copy of the License at
12+
*
13+
* http://www.apache.org/licenses/LICENSE-2.0
14+
*
15+
* Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on
16+
* an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
17+
* specific language governing permissions and limitations under the License.
18+
*
19+
* ***********************************************************************************************************************
20+
*
21+
* AddDataFilePage.java, 2014/06/12 00:01 Jakub Rinkes
22+
******************************************************************************/
23+
package cz.zcu.kiv.eegdatabase.wui.ui.data;
24+
25+
import java.util.ArrayList;
26+
import java.util.List;
27+
28+
import org.apache.commons.logging.Log;
29+
import org.apache.commons.logging.LogFactory;
30+
import org.apache.wicket.RestartResponseAtInterceptPageException;
31+
import org.apache.wicket.ajax.AjaxRequestTarget;
32+
import org.apache.wicket.ajax.markup.html.form.AjaxButton;
33+
import org.apache.wicket.authroles.authorization.strategies.role.annotations.AuthorizeInstantiation;
34+
import org.apache.wicket.feedback.ComponentFeedbackMessageFilter;
35+
import org.apache.wicket.markup.html.form.Form;
36+
import org.apache.wicket.markup.html.form.upload.FileUpload;
37+
import org.apache.wicket.markup.html.form.upload.MultiFileUploadField;
38+
import org.apache.wicket.markup.html.panel.FeedbackPanel;
39+
import org.apache.wicket.model.IModel;
40+
import org.apache.wicket.model.util.ListModel;
41+
import org.apache.wicket.request.mapper.parameter.PageParameters;
42+
import org.apache.wicket.spring.injection.annot.SpringBean;
43+
import org.apache.wicket.util.string.StringValue;
44+
45+
import cz.zcu.kiv.eegdatabase.data.pojo.DataFile;
46+
import cz.zcu.kiv.eegdatabase.data.pojo.Experiment;
47+
import cz.zcu.kiv.eegdatabase.wui.components.menu.button.ButtonPageMenu;
48+
import cz.zcu.kiv.eegdatabase.wui.components.page.MenuPage;
49+
import cz.zcu.kiv.eegdatabase.wui.components.utils.PageParametersUtils;
50+
import cz.zcu.kiv.eegdatabase.wui.components.utils.ResourceUtils;
51+
import cz.zcu.kiv.eegdatabase.wui.core.experiments.ExperimentsFacade;
52+
import cz.zcu.kiv.eegdatabase.wui.core.file.FileFacade;
53+
import cz.zcu.kiv.eegdatabase.wui.ui.experiments.ExperimentsDetailPage;
54+
import cz.zcu.kiv.eegdatabase.wui.ui.experiments.ExperimentsPageLeftMenu;
55+
import cz.zcu.kiv.eegdatabase.wui.ui.experiments.ListExperimentsPage;
56+
57+
@AuthorizeInstantiation(value = { "ROLE_USER", "ROLE_EXPERIMENTER", "ROLE_ADMIN" })
58+
public class AddDataFilePage extends MenuPage {
59+
60+
private static final long serialVersionUID = -1065232841030454856L;
61+
protected Log log = LogFactory.getLog(getClass());
62+
63+
@SpringBean
64+
private ExperimentsFacade facade;
65+
66+
@SpringBean
67+
private FileFacade fileFacade;
68+
69+
private MultiFileUploadField fileUploadField;
70+
private IModel<List<FileUpload>> model;
71+
72+
public AddDataFilePage(PageParameters parameters) {
73+
74+
StringValue stringValue = parameters.get(DEFAULT_PARAM_ID);
75+
if (stringValue.isNull() || stringValue.isEmpty()) {
76+
throw new RestartResponseAtInterceptPageException(ListExperimentsPage.class);
77+
}
78+
79+
int experimentId = stringValue.toInt();
80+
81+
setPageTitle(ResourceUtils.getModel("pageTitle.addDataFile"));
82+
add(new ButtonPageMenu("leftMenu", ExperimentsPageLeftMenu.values()));
83+
84+
setupComponents(experimentId);
85+
}
86+
87+
private void setupComponents(final int experimentId) {
88+
89+
final Experiment experiment = facade.read(experimentId);
90+
model = new ListModel<FileUpload>(new ArrayList<FileUpload>());
91+
fileUploadField = new MultiFileUploadField("file", model);
92+
93+
Form<List<FileUpload>> uploadForm = new Form<List<FileUpload>>("uploadForm");
94+
95+
ComponentFeedbackMessageFilter fileFilter = new ComponentFeedbackMessageFilter(fileUploadField);
96+
final FeedbackPanel fileFeedback = new FeedbackPanel("fileFeedback", fileFilter);
97+
fileFeedback.setOutputMarkupId(true);
98+
99+
uploadForm.add(fileUploadField);
100+
uploadForm.add(fileFeedback);
101+
102+
AjaxButton submit = new AjaxButton("submit", ResourceUtils.getModel("button.addDataFile")) {
103+
104+
private static final long serialVersionUID = 1L;
105+
106+
@Override
107+
protected void onError(AjaxRequestTarget target, Form<?> form) {
108+
target.add(fileFeedback);
109+
target.add(getFeedback());
110+
}
111+
112+
@Override
113+
protected void onSubmit(AjaxRequestTarget target, Form<?> form) {
114+
115+
try {
116+
117+
List<FileUpload> fileUploadList = model.getObject();
118+
if (!fileUploadList.isEmpty()) {
119+
for (FileUpload fileUpload : fileUploadList) {
120+
121+
DataFile file = new DataFile();
122+
file.setMimetype(fileUpload.getContentType());
123+
file.setFilename(fileUpload.getClientFileName());
124+
file.setFileContentStream(fileUpload.getInputStream());
125+
file.setExperiment(experiment);
126+
fileFacade.create(file);
127+
}
128+
}
129+
130+
setResponsePage(ExperimentsDetailPage.class,
131+
PageParametersUtils.getDefaultPageParameters(experimentId));
132+
}
133+
catch (Exception ex) {
134+
error(ResourceUtils.getString("error.file.add.error"));
135+
log.error(ex.getMessage(), ex);
136+
target.add(getFeedback());
137+
target.add(fileFeedback);
138+
}
139+
}
140+
};
141+
uploadForm.add(submit);
142+
add(uploadForm);
143+
}
144+
145+
}

src/main/java/cz/zcu/kiv/eegdatabase/wui/ui/experiments/ExperimentsDetailPage.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@
5555
import cz.zcu.kiv.eegdatabase.wui.core.Gender;
5656
import cz.zcu.kiv.eegdatabase.wui.core.experiments.ExperimentsFacade;
5757
import cz.zcu.kiv.eegdatabase.wui.core.security.SecurityFacade;
58+
import cz.zcu.kiv.eegdatabase.wui.ui.data.AddDataFilePage;
5859
import cz.zcu.kiv.eegdatabase.wui.ui.data.DataFileDetailPage;
5960
import cz.zcu.kiv.eegdatabase.wui.ui.experiments.canvas.ExperimentSignalViewCanvasPanel;
6061
import cz.zcu.kiv.eegdatabase.wui.ui.people.PersonDetailPage;
@@ -114,7 +115,7 @@ private void setupComponents(int experimentId) {
114115
// TODO action box pages
115116
boolean coexperiment = security.userIsOwnerOrCoexperimenter(experimentId);
116117
BookmarkablePageLink<Void> addParameterLink = new BookmarkablePageLink<Void>("addParameterLink", UnderConstructPage.class, PageParametersUtils.getDefaultPageParameters(experimentId));
117-
BookmarkablePageLink<Void> addFileLink = new BookmarkablePageLink<Void>("addFileLink", UnderConstructPage.class, PageParametersUtils.getDefaultPageParameters(experimentId));
118+
BookmarkablePageLink<Void> addFileLink = new BookmarkablePageLink<Void>("addFileLink", AddDataFilePage.class, PageParametersUtils.getDefaultPageParameters(experimentId));
118119
BookmarkablePageLink<Void> editExpLink = new BookmarkablePageLink<Void>("editExpLink", ExperimentFormPage.class, PageParametersUtils.getDefaultPageParameters(experimentId));
119120
BookmarkablePageLink<Void> downloadExpLink = new BookmarkablePageLink<Void>("downloadExpLink", ExperimentsDownloadPage.class, PageParametersUtils.getDefaultPageParameters(experimentId));
120121
add(addParameterLink.setVisibilityAllowed(coexperiment), addFileLink.setVisibilityAllowed(coexperiment), editExpLink.setVisibilityAllowed(coexperiment), downloadExpLink);

src/main/java/cz/zcu/kiv/eegdatabase/wui/ui/experiments/components/ExperimentPackagePanel.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -223,8 +223,9 @@ protected void onConfigure() {
223223

224224
cont.add(ddc);
225225
cont.add(licenseBuyLink);
226-
227226

227+
// XXX HIDE LICENSE DROP DOWN CHOICE FOR NOW. FIX EXCEPTION !!!
228+
cont.setVisibilityAllowed(false);
228229
}
229230

230231

src/main/java/cz/zcu/kiv/eegdatabase/wui/ui/scenarios/ScenariosPageLeftMenu.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,8 @@ public enum ScenariosPageLeftMenu implements IButtonPageMenu {
4747
ListScenariosPage.MY_SCENARIOS_PARAM)),
4848

4949
SEARCH_SCENARIOS(UnderConstructPage.class, "menuItem.searchScenario", null),
50-
ADD_SCENARIOS(ScenarioFormPage.class, "menuItem.addScenario", null),
51-
ADD_SCENARIOS_SCHEMA(ScenarioSchemaFormPage.class, "menuItem.addScenarioSchema", null), ;
50+
ADD_SCENARIOS(ScenarioFormPage.class, "menuItem.addScenario", null),;
51+
// ADD_SCENARIOS_SCHEMA(ScenarioSchemaFormPage.class, "menuItem.addScenarioSchema", null), ;
5252

5353
private Class<? extends MenuPage> pageClass;
5454
private String pageTitleKey;

0 commit comments

Comments
 (0)