Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
solo
Project overview
Project overview
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Administrator
solo
Commits
4524cf3c
Commit
4524cf3c
authored
Nov 23, 2016
by
D
Committed by
GitHub
Nov 23, 2016
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #12222 from b3log/1.8.0-dev
1.8.0 dev
parents
6d5abec9
fcad963f
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
14 deletions
+11
-14
src/main/java/org/b3log/solo/repository/impl/TagRepositoryImpl.java
...ava/org/b3log/solo/repository/impl/TagRepositoryImpl.java
+11
-14
No files found.
src/main/java/org/b3log/solo/repository/impl/TagRepositoryImpl.java
View file @
4524cf3c
...
...
@@ -15,7 +15,6 @@
*/
package
org
.
b3log
.
solo
.
repository
.
impl
;
import
java.text.Collator
;
import
java.util.ArrayList
;
import
java.util.Collections
;
...
...
@@ -38,18 +37,21 @@ import org.json.JSONArray;
import
org.json.JSONException
;
import
org.json.JSONObject
;
/**
* Tag repository.
*
* @author <a href="http://88250.b3log.org">Liang Ding</a>
* @version 1.
0.1.1, Nov 29, 2011
* @version 1.
1.1.1, Nov 23, 2016
* @since 0.3.1
*/
@Repository
public
class
TagRepositoryImpl
extends
AbstractRepository
implements
TagRepository
{
private
final
static
Comparator
<
Object
>
CHINA_COMPARE
=
Collator
.
getInstance
(
java
.
util
.
Locale
.
CHINA
);
/**
* Tag-Article relation repository.
*/
@Inject
private
TagArticleRepository
tagArticleRepository
;
/**
* Public constructor.
...
...
@@ -58,12 +60,6 @@ public class TagRepositoryImpl extends AbstractRepository implements TagReposito
super
(
Tag
.
TAG
);
}
/**
* Tag-Article relation repository.
*/
@Inject
private
TagArticleRepository
tagArticleRepository
;
@Override
public
JSONObject
getByTitle
(
final
String
tagTitle
)
throws
RepositoryException
{
final
Query
query
=
new
Query
().
setFilter
(
new
PropertyFilter
(
Tag
.
TAG_TITLE
,
FilterOperator
.
EQUAL
,
tagTitle
)).
setPageCount
(
1
);
...
...
@@ -117,13 +113,14 @@ public class TagRepositoryImpl extends AbstractRepository implements TagReposito
this
.
tagArticleRepository
=
tagArticleRepository
;
}
private
void
sortJSONTagList
(
List
<
JSONObject
>
tagJoList
)
{
private
void
sortJSONTagList
(
final
List
<
JSONObject
>
tagJoList
)
throws
RepositoryException
{
Collections
.
sort
(
tagJoList
,
new
Comparator
<
JSONObject
>()
{
@Override
public
int
compare
(
JSONObject
o1
,
JSONObject
o2
)
{
public
int
compare
(
final
JSONObject
o1
,
final
JSONObject
o2
)
{
try
{
return
CHINA_COMPARE
.
compare
(
o1
.
getString
(
"tagTitle"
),
o2
.
getString
(
"tagTitle"
));
}
catch
(
JSONException
e
)
{
return
Collator
.
getInstance
(
java
.
util
.
Locale
.
CHINA
)
.
compare
(
o1
.
getString
(
Tag
.
TAG_TITLE
),
o2
.
getString
(
Tag
.
TAG_TITLE
));
}
catch
(
final
JSONException
e
)
{
throw
new
RuntimeException
(
e
);
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment