Skip to content

Commit

Permalink
Merge pull request #91 from tagbangers/develop
Browse files Browse the repository at this point in the history
1.0.0.M16
  • Loading branch information
ogawa-takeshi authored Aug 24, 2017
2 parents 4882877 + 1f883dd commit fffd276
Show file tree
Hide file tree
Showing 183 changed files with 5,706 additions and 1,735 deletions.
6 changes: 3 additions & 3 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-dependencies</artifactId>
<version>1.5.4.RELEASE</version>
<version>1.5.6.RELEASE</version>
</parent>
<groupId>org.wallride</groupId>
<artifactId>wallride</artifactId>
<version>1.0.0.M15</version>
<version>1.0.0.M16</version>
<packaging>pom</packaging>
<name>WallRide</name>
<description>CMS for developers of principles</description>
Expand Down Expand Up @@ -80,7 +80,7 @@
<dependency>
<groupId>org.wallride</groupId>
<artifactId>wallride-core</artifactId>
<version>1.0.0.M15</version>
<version>1.0.0.M16</version>
</dependency>

<!-- Spring -->
Expand Down
14 changes: 13 additions & 1 deletion wallride-bootstrap/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<groupId>org.wallride</groupId>
<artifactId>wallride-parent</artifactId>
<version>1.0.0.M15</version>
<version>1.0.0.M16</version>
<relativePath>../wallride-parent/pom.xml</relativePath>
</parent>
<artifactId>wallride-bootstrap</artifactId>
Expand All @@ -23,6 +23,18 @@
<start-class>org.wallride.bootstrap.Bootstrap</start-class>
</properties>

<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<executable>true</executable>
</configuration>
</plugin>
</plugins>
</build>

<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
Expand Down
8 changes: 4 additions & 4 deletions wallride-core/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<groupId>org.wallride</groupId>
<artifactId>wallride</artifactId>
<version>1.0.0.M15</version>
<version>1.0.0.M16</version>
<relativePath>../pom.xml</relativePath>
</parent>
<artifactId>wallride-core</artifactId>
Expand Down Expand Up @@ -258,9 +258,9 @@

<!-- Commons -->
<dependency>
<groupId>commons-httpclient</groupId>
<artifactId>commons-httpclient</artifactId>
<version>3.1</version>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId>
<version>4.5.3</version>
<exclusions>
<exclusion>
<artifactId>commons-logging</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
import org.springframework.context.annotation.Configuration;
import org.springframework.core.env.Environment;
import org.thymeleaf.dialect.IDialect;
import org.thymeleaf.extras.java8time.dialect.Java8TimeDialect;
import org.thymeleaf.spring4.SpringTemplateEngine;
import org.thymeleaf.spring4.templateresolver.SpringResourceTemplateResolver;
import org.thymeleaf.templateresolver.ITemplateResolver;
Expand Down Expand Up @@ -76,6 +77,7 @@ public SpringTemplateEngine emailTemplateEngine() {

Set<IDialect> dialects = new HashSet<>();
dialects.add(wallRideThymeleafDialect);
dialects.add(new Java8TimeDialect());
engine.setAdditionalDialects(dialects);
return engine;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,16 +20,14 @@
import org.apache.commons.lang.builder.ToStringStyle;
import org.springframework.context.i18n.LocaleContextHolder;
import org.springframework.util.CollectionUtils;
import org.springframework.util.MultiValueMap;
import org.springframework.util.StringUtils;
import org.wallride.domain.CustomField;
import org.wallride.domain.Post;

import java.io.Serializable;
import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import java.util.Map;

public class ArticleSearchRequest implements Serializable {

Expand All @@ -40,7 +38,7 @@ public class ArticleSearchRequest implements Serializable {
private Collection<String> categoryCodes;
private Collection<Long> tagIds;
private Collection<String> tagNames;
private Map<String, Object> customFields;
private MultiValueMap<String, Object> customFields;
private Long authorId;
private Post.Status status;
private String language;
Expand Down Expand Up @@ -200,15 +198,15 @@ public ArticleSearchRequest withTagNames(Collection<String> tags) {
return this;
}

public Map<String, Object> getCustomFields() {
public MultiValueMap<String, Object> getCustomFields() {
return customFields;
}

public void setCustomFields(Map<String, Object> customFields) {
public void setCustomFields(MultiValueMap<String, Object> customFields) {
this.customFields = customFields;
}

public ArticleSearchRequest withCustomFields(Map<String, Object> customFields) {
public ArticleSearchRequest withCustomFields(MultiValueMap<String, Object> customFields) {
this.customFields = customFields;
return this;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,17 +18,16 @@

import org.apache.commons.lang.builder.ToStringBuilder;
import org.apache.commons.lang.builder.ToStringStyle;
import org.apache.commons.logging.Log;
import org.springframework.context.i18n.LocaleContextHolder;
import org.springframework.util.CollectionUtils;
import org.springframework.util.MultiValueMap;
import org.springframework.util.StringUtils;
import org.wallride.domain.BlogLanguage;
import org.wallride.domain.Post;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Map;

@SuppressWarnings("serial")
public class PageSearchRequest implements Serializable {
Expand All @@ -38,7 +37,7 @@ public class PageSearchRequest implements Serializable {
private Collection<String> tagNames;
private Collection<Long> categoryIds;
private Collection<String> categoryCodes;
private Map<String, Object> customFields;
private MultiValueMap<String, Object> customFields;
private Long authorId;
private Post.Status status;
private String language;
Expand Down Expand Up @@ -177,15 +176,15 @@ public PageSearchRequest withCategoryCodes(Collection<String> categoryCodes) {
}
return this;
}
public Map<String, Object> getCustomFields() {
public MultiValueMap<String, Object> getCustomFields() {
return customFields;
}

public void setCustomFields(Map<String, Object> customFields) {
public void setCustomFields(MultiValueMap<String, Object> customFields) {
this.customFields = customFields;
}

public PageSearchRequest withCustomFields(Map<String, Object> customFields) {
public PageSearchRequest withCustomFields(MultiValueMap<String, Object> customFields) {
this.customFields = customFields;
return this;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ private FullTextQuery buildFullTextQuery(ArticleSearchRequest request, Pageable

BooleanJunction<BooleanJunction> subJunction = qb.bool();
for (String key : request.getCustomFields().keySet()) {
List<Object> values = (List<Object>)request.getCustomFields().get(key);
List<Object> values = request.getCustomFields().get(key);
CustomField target = customFieldMap.get(key);
BooleanJunction<BooleanJunction> customFieldJunction = qb.bool();
switch (target.getFieldType()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ private FullTextQuery buildFullTextQuery(PageSearchRequest request, Pageable pag

BooleanJunction<BooleanJunction> subJunction = qb.bool();
for (String key : request.getCustomFields().keySet()) {
List<Object> values = (List<Object>)request.getCustomFields().get(key);
List<Object> values = request.getCustomFields().get(key);
CustomField target = customFieldMap.get(key);
BooleanJunction<BooleanJunction> customFieldJunction = qb.bool();
switch (target.getFieldType()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@

import org.apache.commons.lang.builder.EqualsBuilder;
import org.apache.commons.lang.builder.HashCodeBuilder;
import org.springframework.util.LinkedMultiValueMap;
import org.springframework.util.MultiValueMap;
import org.springframework.util.StringUtils;
import org.wallride.domain.Post;
import org.wallride.model.ArticleSearchRequest;
Expand All @@ -26,8 +28,6 @@
import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
import java.util.Map;

@SuppressWarnings("serial")
public class ArticleSearchForm implements Serializable {
Expand All @@ -38,7 +38,7 @@ public class ArticleSearchForm implements Serializable {
private Collection<Long> categoryIds = new ArrayList<>();
private Collection<String> categoryCodes = new ArrayList<>();
private Collection<String> tagNames = new ArrayList<>();
private Map<String, Object> customFields = new HashMap<>();
private MultiValueMap<String, Object> customFields = new LinkedMultiValueMap<>();
private Long authorId;
private String language;

Expand Down Expand Up @@ -90,11 +90,11 @@ public void setTagNames(Collection<String> tagNames) {
this.tagNames = tagNames;
}

public Map<String, Object> getCustomFields() {
public MultiValueMap<String, Object> getCustomFields() {
return customFields;
}

public void setCustomFields(Map<String, Object> customFields) {
public void setCustomFields(MultiValueMap<String, Object> customFields) {
this.customFields = customFields;
}

Expand Down
13 changes: 13 additions & 0 deletions wallride-core/src/main/java/org/wallride/web/support/Articles.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@
package org.wallride.web.support;

import org.springframework.data.domain.Page;
import org.springframework.util.LinkedMultiValueMap;
import org.springframework.util.MultiValueMap;
import org.thymeleaf.context.IExpressionContext;
import org.wallride.domain.Article;
import org.wallride.domain.Post;
Expand Down Expand Up @@ -54,6 +56,7 @@ class Condition {
private Collection<Long> categoryIds;
private Collection<String> categoryCodes;
private Collection<String> tagNames;
private MultiValueMap<String, Object> customFields;
private Long authorId;
private Post.Status status = Post.Status.PUBLISHED;
// private LocalDateTime dateFrom;
Expand Down Expand Up @@ -96,6 +99,15 @@ public Condition tag(String... names) {
return this;
}

public Condition customField(String key, Object... values) {
MultiValueMap<String, Object> customFields = new LinkedMultiValueMap<>();
for (Object value : values) {
customFields.add(key, value);
}
this.customFields = customFields;
return this;
}

public Condition author(Long id) {
this.authorId = id;
return this;
Expand All @@ -108,6 +120,7 @@ private ArticleSearchRequest buildArticleSearchRequest() {
.withCategoryIds(this.categoryIds)
.withCategoryCodes(this.categoryCodes)
.withTagNames(this.tagNames)
.withCustomFields(this.customFields)
.withAuthorId(this.authorId);
return request;
}
Expand Down
19 changes: 19 additions & 0 deletions wallride-core/src/main/java/org/wallride/web/support/Pages.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@

package org.wallride.web.support;

import org.springframework.util.LinkedMultiValueMap;
import org.springframework.util.MultiValueMap;
import org.thymeleaf.context.IExpressionContext;
import org.wallride.domain.Page;
import org.wallride.domain.Post;
Expand Down Expand Up @@ -77,12 +79,14 @@ public Condition condition() {
}

class Condition {

private int size = 1;
private String keyword;
private Collection<Long> categoryIds;
private Collection<String> categoryCodes;
private Collection<Long> tagIds;
private Collection<String> tagNames;
private MultiValueMap<String, Object> customFields;
private Long authorId;
private Post.Status status = Post.Status.PUBLISHED;

Expand Down Expand Up @@ -132,13 +136,28 @@ public Condition tag(Long... ids) {
return this;
}

public Condition customField(String key, Object... values) {
MultiValueMap<String, Object> customFields = new LinkedMultiValueMap<>();
for (Object value : values) {
customFields.add(key, value);
}
this.customFields = customFields;
return this;
}

public Condition author(Long id) {
this.authorId = id;
return this;
}

private PageSearchRequest buildPageSearchRequest() {
PageSearchRequest request = new PageSearchRequest(context.getLocale().getLanguage())
.withKeyword(this.keyword)
.withCategoryIds(this.categoryIds)
.withCategoryCodes(this.categoryCodes)
.withTagIds(this.tagIds)
.withTagNames(this.tagNames)
.withCustomFields(this.customFields)
.withAuthorId(this.authorId)
.withStatus(this.status);
return request;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
"css/plugins/special_characters.min.css",
"css/plugins/table.min.css",
"css/plugins/video.min.css",
"css/third_party/spell_checker.min.css",
"js/froala_editor.min.js",
"js/froala_editor.pkgd.min.js",
"js/plugins/align.min.js",
Expand Down Expand Up @@ -73,7 +74,9 @@
"js/plugins/table.min.js",
"js/plugins/url.min.js",
"js/plugins/video.min.js",
"js/plugins/word_paste.min.js"
"js/plugins/word_paste.min.js",
"js/third_party/image_aviary.min.js",
"js/third_party/spell_checker.min.js"
],
"ignore": [
"html",
Expand Down
Loading

0 comments on commit fffd276

Please sign in to comment.