Skip to content
This repository was archived by the owner on Apr 22, 2025. It is now read-only.

Commit 5b6d365

Browse files
author
hainguyen
committed
Prepare for the next release
1 parent 518643d commit 5b6d365

22 files changed

Lines changed: 365 additions & 251 deletions

File tree

mycollab-app-community/src/main/txt/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ Version 5.0.6
5757
**Bug Fixes**
5858

5959
* Display the error message when user upgrade MyCollab failed due to the file permission
60+
* Did not display detail error message when validate form but the empty string
6061

6162
Version 5.0.5.1
6263
-----------------------------

mycollab-caching/src/main/java/com/esofthead/mycollab/cache/CacheUtils.java

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,7 @@ public static String constructParamsKey(Object[] args) {
3737
}
3838

3939
public static Class<?> getEnclosingServiceInterface(Class<?> serviceClass) {
40-
Class<?> cls = ClassUtils.getInterfaceInstanceOf(serviceClass,
41-
IService.class);
42-
40+
Class<?> cls = ClassUtils.getInterfaceInstanceOf(serviceClass, IService.class);
4341
return cls;
4442
}
4543

@@ -59,7 +57,6 @@ public static void cleanCaches(Integer accountId, Class<?>... classes) {
5957
}
6058

6159
public static boolean isInBlackList(Class<?> cls) {
62-
return (cls != null)
63-
&& (cls.getAnnotation(IgnoreCacheClass.class) != null);
60+
return (cls != null) && (cls.getAnnotation(IgnoreCacheClass.class) != null);
6461
}
6562
}

mycollab-core/src/main/java/com/esofthead/mycollab/core/MyCollabVersion.java

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
import java.util.regex.Pattern;
2121

2222
/**
23-
*
23+
*
2424
* @author MyCollab Ltd.
2525
* @since 4.4.0
2626
*
@@ -50,13 +50,17 @@ public static boolean isEditionNewer(String testFW) {
5050
}
5151

5252
static boolean isEditionNewer(String testFW, String baseFW) {
53-
int[] testVer = getVersionNumbers(testFW);
54-
int[] baseVer = getVersionNumbers(baseFW);
53+
try {
54+
int[] testVer = getVersionNumbers(testFW);
55+
int[] baseVer = getVersionNumbers(baseFW);
5556

56-
for (int i = 0; i < testVer.length; i++)
57-
if (testVer[i] != baseVer[i])
58-
return testVer[i] > baseVer[i];
57+
for (int i = 0; i < testVer.length; i++)
58+
if (testVer[i] != baseVer[i])
59+
return testVer[i] > baseVer[i];
5960

60-
return false;
61+
return false;
62+
} catch (IllegalArgumentException e) {
63+
return false;
64+
}
6165
}
6266
}

mycollab-migration/src/main/java/com/esofthead/mycollab/db/migration/DbMigrationRunner.java

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,8 @@
3535
import javax.annotation.PostConstruct;
3636
import javax.sql.DataSource;
3737

38+
import com.esofthead.mycollab.configuration.SiteConfiguration;
39+
import com.esofthead.mycollab.core.DeploymentMode;
3840
import org.flywaydb.core.Flyway;
3941
import org.slf4j.Logger;
4042
import org.slf4j.LoggerFactory;
@@ -51,8 +53,7 @@
5153
@Component("dbMigration")
5254
@DependsOn("appContextUtil")
5355
public class DbMigrationRunner {
54-
private static final Logger LOG = LoggerFactory
55-
.getLogger(DbMigrationRunner.class);
56+
private static final Logger LOG = LoggerFactory.getLogger(DbMigrationRunner.class);
5657

5758
@Autowired
5859
private DataSource dataSource;
@@ -64,6 +65,12 @@ public void migrate() {
6465
flyway.setBaselineOnMigrate(true);
6566
flyway.setDataSource(dataSource);
6667
flyway.setValidateOnMigrate(false);
68+
if (SiteConfiguration.getDeploymentMode() == DeploymentMode.site) {
69+
flyway.setLocations("db/migration", "db/migration2");
70+
} else {
71+
flyway.setLocations("db/migration");
72+
}
73+
6774
flyway.migrate();
6875
} catch (Exception e) {
6976
LOG.error("Error while migrate database", e);

mycollab-parent-community/pom.xml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
<mysqlVersion>5.1.35</mysqlVersion>
2323
<camelVersion>2.15.2</camelVersion>
2424
<junitVersion>4.12</junitVersion>
25+
<restVersion>3.0.9.Final</restVersion>
2526
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
2627
<project.inceptionYear>2011</project.inceptionYear>
2728
<sonar.language>java</sonar.language>
@@ -303,6 +304,11 @@
303304
</dependencies>
304305
<build>
305306
<plugins>
307+
<plugin>
308+
<groupId>org.codehaus.mojo</groupId>
309+
<artifactId>versions-maven-plugin</artifactId>
310+
<version>2.1</version>
311+
</plugin>
306312
<plugin>
307313
<groupId>org.apache.maven.plugins</groupId>
308314
<artifactId>maven-compiler-plugin</artifactId>
@@ -314,12 +320,6 @@
314320
</configuration>
315321
</plugin>
316322

317-
<plugin>
318-
<groupId>org.codehaus.mojo</groupId>
319-
<artifactId>versions-maven-plugin</artifactId>
320-
<version>2.1</version>
321-
</plugin>
322-
323323
<plugin>
324324
<groupId>net.alchim31.maven</groupId>
325325
<artifactId>scala-maven-plugin</artifactId>

mycollab-services/pom.xml

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@
7171
<dependency>
7272
<groupId>org.hibernate</groupId>
7373
<artifactId>hibernate-validator</artifactId>
74-
<version>5.1.2.Final</version>
74+
<version>5.1.3.Final</version>
7575
</dependency>
7676

7777
<dependency>
@@ -89,7 +89,13 @@
8989
<dependency>
9090
<groupId>org.jboss.resteasy</groupId>
9191
<artifactId>jaxrs-api</artifactId>
92-
<version>3.0.9.Final</version>
92+
<version>${restVersion}</version>
93+
</dependency>
94+
95+
<dependency>
96+
<groupId>org.jboss.resteasy</groupId>
97+
<artifactId>resteasy-jaxrs</artifactId>
98+
<version>${restVersion}</version>
9399
</dependency>
94100

95101
</dependencies>

mycollab-services/src/main/java/com/esofthead/mycollab/form/view/builder/type/DynaForm.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
*
2929
*/
3030
public class DynaForm {
31-
private List<DynaSection> sections = new ArrayList<DynaSection>();
31+
private List<DynaSection> sections = new ArrayList<>();
3232

3333
public int getSectionCount() {
3434
return sections.size();

mycollab-services/src/main/java/com/esofthead/mycollab/spring/MyBatisConfiguration.java

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
*/
1717
package com.esofthead.mycollab.spring;
1818

19+
import java.io.FileNotFoundException;
1920
import java.io.IOException;
2021
import java.util.ArrayList;
2122

@@ -73,7 +74,8 @@ public SqlSessionFactory sqlSessionFactory() throws Exception {
7374
"classpath:sqlMap/project/*Mapper.xml",
7475
"classpath:sqlMap/project/*MapperExt.xml",
7576
"classpath:sqlMap/tracker/*Mapper.xml",
76-
"classpath:sqlMap/tracker/*MapperExt.xml"));
77+
"classpath:sqlMap/tracker/*MapperExt.xml",
78+
"classpath:sqlMap/support/*Mapper.xml"));
7779

7880
return sqlSessionFactory.getObject();
7981
}
@@ -83,20 +85,20 @@ public SqlSessionTemplate sqlMapClient() throws Exception {
8385
return new SqlSessionTemplate(sqlSessionFactory());
8486
}
8587

86-
private Resource[] buildMapperResources(String resourcePath)
87-
throws IOException {
88-
ResourcePatternResolver patternResolver = new PathMatchingResourcePatternResolver();
89-
Resource[] mappingLocations = patternResolver
90-
.getResources(resourcePath);
91-
return mappingLocations;
88+
private Resource[] buildMapperResources(String resourcePath) throws IOException {
89+
try {
90+
ResourcePatternResolver patternResolver = new PathMatchingResourcePatternResolver();
91+
Resource[] mappingLocations = patternResolver.getResources(resourcePath);
92+
return mappingLocations;
93+
} catch (FileNotFoundException e) {
94+
return new Resource[0];
95+
}
9296
}
9397

94-
private Resource[] buildBatchMapperResources(String... resourcesPath)
95-
throws IOException {
98+
private Resource[] buildBatchMapperResources(String... resourcesPath) throws IOException {
9699
ArrayList<Resource> resources = new ArrayList<>();
97100
for (String resourcePath : resourcesPath) {
98-
CollectionUtils.addAll(resources,
99-
buildMapperResources(resourcePath));
101+
CollectionUtils.addAll(resources, buildMapperResources(resourcePath));
100102
}
101103
return resources.toArray(new Resource[0]);
102104
}

mycollab-services/src/main/java/com/esofthead/mycollab/support/domain/TestimonialForm.java

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,31 +16,39 @@
1616
*/
1717
package com.esofthead.mycollab.support.domain;
1818

19+
import org.hibernate.validator.constraints.Length;
20+
21+
import javax.validation.constraints.NotNull;
1922
import javax.ws.rs.FormParam;
20-
import javax.ws.rs.client.ClientBuilder;
2123

2224
/**
2325
* @author MyCollab Ltd
2426
* @since 5.0.6
2527
*/
2628
public class TestimonialForm {
27-
ClientBuilder a;
2829
@FormParam("displayname")
30+
@NotNull(message = "Name must be not null")
31+
@Length(max=100, message="Field value is too long")
2932
private String displayname;
3033

3134
@FormParam("jobrole")
35+
@Length(max=100, message="Field value is too long")
3236
private String jobrole;
3337

3438
@FormParam("company")
39+
@Length(max=100, message="Field value is too long")
3540
private String company;
3641

3742
@FormParam("website")
43+
@Length(max=100, message="Field value is too long")
3844
private String website;
3945

4046
@FormParam("testimonial")
47+
@NotNull(message = "Testimonial must be not null")
4148
private String testimonial;
4249

4350
@FormParam("email")
51+
@NotNull(message = "Email must be not null")
4452
private String email;
4553

4654
public String getDisplayname() {

mycollab-ui/src/main/java/com/esofthead/mycollab/vaadin/ui/AbstractBeanFieldGroupEditFieldFactory.java

Lines changed: 38 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,22 @@
1414
* You should have received a copy of the GNU General Public License
1515
* along with mycollab-ui. If not, see <http://www.gnu.org/licenses/>.
1616
*/
17+
/**
18+
* This file is part of mycollab-ui.
19+
* <p>
20+
* mycollab-ui is free software: you can redistribute it and/or modify
21+
* it under the terms of the GNU General Public License as published by
22+
* the Free Software Foundation, either version 3 of the License, or
23+
* (at your option) any later version.
24+
* <p>
25+
* mycollab-ui is distributed in the hope that it will be useful,
26+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
27+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
28+
* GNU General Public License for more details.
29+
* <p>
30+
* You should have received a copy of the GNU General Public License
31+
* along with mycollab-ui. If not, see <http://www.gnu.org/licenses/>.
32+
*/
1733
package com.esofthead.mycollab.vaadin.ui;
1834

1935
import com.esofthead.mycollab.core.MyCollabException;
@@ -33,6 +49,7 @@
3349
import javax.validation.Path;
3450
import javax.validation.Validator;
3551
import java.lang.annotation.Annotation;
52+
import java.util.Map;
3653
import java.util.Set;
3754

3855
/**
@@ -112,15 +129,25 @@ public void commit() {
112129
attachForm.setValid(true);
113130
} catch (CommitException e) {
114131
attachForm.setValid(false);
115-
NotificationUtil.showErrorNotification(e.getCause().getMessage());
132+
Map<Field<?>, com.vaadin.data.Validator.InvalidValueException> invalidFields = e.getInvalidFields();
133+
if (invalidFields != null && invalidFields.size() > 0) {
134+
StringBuilder errorMsg = new StringBuilder();
135+
for (Field<?> field : invalidFields.keySet()) {
136+
com.vaadin.data.Validator.InvalidValueException invalidEx = invalidFields.get(field);
137+
errorMsg.append(invalidEx.getHtmlMessage()).append("<br/>");
138+
field.addStyleName("errorField");
139+
}
140+
NotificationUtil.showErrorNotification(errorMsg.toString());
141+
} else {
142+
NotificationUtil.showErrorNotification(e.getCause().getMessage());
143+
}
116144
} catch (Exception e) {
117145
throw new MyCollabException(e);
118146
}
119147
}
120148

121149
@Override
122-
public void preCommit(FieldGroup.CommitEvent commitEvent)
123-
throws CommitException {
150+
public void preCommit(FieldGroup.CommitEvent commitEvent) throws CommitException {
124151
for (Object propertyId : fieldGroup.getBoundPropertyIds()) {
125152
fieldGroup.getField(propertyId).removeStyleName("errorField");
126153
}
@@ -151,27 +178,20 @@ public void postCommit(FieldGroup.CommitEvent commitEvent)
151178
if (violations.size() > 0) {
152179
StringBuilder errorMsg = new StringBuilder();
153180

154-
for (@SuppressWarnings("rawtypes")
155-
ConstraintViolation violation : violations) {
181+
for (ConstraintViolation violation : violations) {
156182
errorMsg.append(violation.getMessage()).append("<br/>");
157183
Path propertyPath = violation.getPropertyPath();
158-
if (propertyPath != null
159-
&& !propertyPath.toString().equals("")) {
184+
if (propertyPath != null && !propertyPath.toString().equals("")) {
160185
fieldGroup.getField(propertyPath.toString())
161186
.addStyleName("errorField");
162187
} else {
163-
Annotation validateAnno = violation
164-
.getConstraintDescriptor().getAnnotation();
188+
Annotation validateAnno = violation.getConstraintDescriptor().getAnnotation();
165189
if (validateAnno instanceof DateComparision) {
166-
String firstDateField = ((DateComparision) validateAnno)
167-
.firstDateField();
168-
String lastDateField = ((DateComparision) validateAnno)
169-
.lastDateField();
170-
171-
fieldGroup.getField(firstDateField).addStyleName(
172-
"errorField");
173-
fieldGroup.getField(lastDateField).addStyleName(
174-
"errorField");
190+
String firstDateField = ((DateComparision) validateAnno).firstDateField();
191+
String lastDateField = ((DateComparision) validateAnno).lastDateField();
192+
193+
fieldGroup.getField(firstDateField).addStyleName("errorField");
194+
fieldGroup.getField(lastDateField).addStyleName("errorField");
175195
}
176196
}
177197

0 commit comments

Comments
 (0)