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
2915ec7f
Commit
2915ec7f
authored
Nov 23, 2015
by
Liang Ding
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
#12042
移除 Preference 类
parent
645b162f
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
19 additions
and
63 deletions
+19
-63
src/main/java/org/b3log/solo/model/Preference.java
src/main/java/org/b3log/solo/model/Preference.java
+0
-41
src/main/java/org/b3log/solo/processor/console/PreferenceConsole.java
...a/org/b3log/solo/processor/console/PreferenceConsole.java
+5
-5
src/main/java/org/b3log/solo/repository/impl/PreferenceRepositoryImpl.java
.../b3log/solo/repository/impl/PreferenceRepositoryImpl.java
+11
-14
src/main/java/org/b3log/solo/service/UpgradeService.java
src/main/java/org/b3log/solo/service/UpgradeService.java
+3
-3
No files found.
src/main/java/org/b3log/solo/model/Preference.java
deleted
100644 → 0
View file @
645b162f
/*
* Copyright (c) 2010-2015, b3log.org
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package
org
.
b3log
.
solo
.
model
;
/**
* This class defines all comment model relevant keys.
*
* @author <a href="http://88250.b3log.org">Liang Ding</a>
* @version 1.3.0.11, Nov 23, 2015
* @since 0.3.1
* @deprecated this class will be removed in 1.3.0, see issue
* <a href="https://github.com/b3log/solo/issues/12042">#12042</a>
* for more details
*/
public
final
class
Preference
{
/**
* Preference.
*/
public
static
final
String
PREFERENCE
=
"preference"
;
/**
* Private default constructor.
*/
private
Preference
()
{
}
}
src/main/java/org/b3log/solo/processor/console/PreferenceConsole.java
View file @
2915ec7f
...
@@ -31,7 +31,6 @@ import org.b3log.latke.servlet.annotation.RequestProcessor;
...
@@ -31,7 +31,6 @@ import org.b3log.latke.servlet.annotation.RequestProcessor;
import
org.b3log.latke.servlet.renderer.JSONRenderer
;
import
org.b3log.latke.servlet.renderer.JSONRenderer
;
import
org.b3log.latke.util.Requests
;
import
org.b3log.latke.util.Requests
;
import
org.b3log.solo.model.Option
;
import
org.b3log.solo.model.Option
;
import
org.b3log.solo.model.Preference
;
import
org.b3log.solo.model.Sign
;
import
org.b3log.solo.model.Sign
;
import
org.b3log.solo.service.OptionMgmtService
;
import
org.b3log.solo.service.OptionMgmtService
;
import
org.b3log.solo.service.OptionQueryService
;
import
org.b3log.solo.service.OptionQueryService
;
...
@@ -243,7 +242,8 @@ public class PreferenceConsole {
...
@@ -243,7 +242,8 @@ public class PreferenceConsole {
final
JSONArray
signs
=
new
JSONArray
();
final
JSONArray
signs
=
new
JSONArray
();
final
JSONArray
allSigns
=
// includes the empty sign(id=0)
final
JSONArray
allSigns
=
// includes the empty sign(id=0)
new
JSONArray
(
preference
.
getString
(
Option
.
ID_C_SIGNS
));
new
JSONArray
(
preference
.
getString
(
Option
.
ID_C_SIGNS
));
for
(
int
i
=
1
;
i
<
allSigns
.
length
();
i
++)
{
// excludes the empty sign
for
(
int
i
=
1
;
i
<
allSigns
.
length
();
i
++)
{
// excludes the empty sign
...
@@ -353,7 +353,7 @@ public class PreferenceConsole {
...
@@ -353,7 +353,7 @@ public class PreferenceConsole {
final
JSONObject
ret
=
new
JSONObject
();
final
JSONObject
ret
=
new
JSONObject
();
renderer
.
setJSONObject
(
ret
);
renderer
.
setJSONObject
(
ret
);
ret
.
put
(
Preference
.
PREFERENCE
,
preference
);
ret
.
put
(
Option
.
CATEGORY_C_
PREFERENCE
,
preference
);
ret
.
put
(
Keys
.
STATUS_CODE
,
true
);
ret
.
put
(
Keys
.
STATUS_CODE
,
true
);
}
catch
(
final
Exception
e
)
{
}
catch
(
final
Exception
e
)
{
LOGGER
.
log
(
Level
.
ERROR
,
e
.
getMessage
(),
e
);
LOGGER
.
log
(
Level
.
ERROR
,
e
.
getMessage
(),
e
);
...
@@ -424,7 +424,7 @@ public class PreferenceConsole {
...
@@ -424,7 +424,7 @@ public class PreferenceConsole {
try
{
try
{
final
JSONObject
requestJSONObject
=
Requests
.
parseRequestJSONObject
(
request
,
response
);
final
JSONObject
requestJSONObject
=
Requests
.
parseRequestJSONObject
(
request
,
response
);
final
JSONObject
preference
=
requestJSONObject
.
getJSONObject
(
Preference
.
PREFERENCE
);
final
JSONObject
preference
=
requestJSONObject
.
getJSONObject
(
Option
.
CATEGORY_C_
PREFERENCE
);
final
JSONObject
ret
=
new
JSONObject
();
final
JSONObject
ret
=
new
JSONObject
();
...
@@ -433,7 +433,7 @@ public class PreferenceConsole {
...
@@ -433,7 +433,7 @@ public class PreferenceConsole {
if
(
isInvalid
(
preference
,
ret
))
{
if
(
isInvalid
(
preference
,
ret
))
{
return
;
return
;
}
}
preferenceMgmtService
.
updatePreference
(
preference
);
preferenceMgmtService
.
updatePreference
(
preference
);
ret
.
put
(
Keys
.
STATUS_CODE
,
true
);
ret
.
put
(
Keys
.
STATUS_CODE
,
true
);
...
...
src/main/java/org/b3log/solo/repository/impl/PreferenceRepositoryImpl.java
View file @
2915ec7f
...
@@ -15,22 +15,21 @@
...
@@ -15,22 +15,21 @@
*/
*/
package
org
.
b3log
.
solo
.
repository
.
impl
;
package
org
.
b3log
.
solo
.
repository
.
impl
;
import
org.b3log.latke.repository.AbstractRepository
;
import
org.b3log.latke.repository.AbstractRepository
;
import
org.b3log.latke.repository.RepositoryException
;
import
org.b3log.latke.repository.RepositoryException
;
import
org.b3log.latke.repository.annotation.Repository
;
import
org.b3log.latke.repository.annotation.Repository
;
import
org.b3log.solo.model.
Preference
;
import
org.b3log.solo.model.
Option
;
import
org.b3log.solo.repository.PreferenceRepository
;
import
org.b3log.solo.repository.PreferenceRepository
;
import
org.json.JSONObject
;
import
org.json.JSONObject
;
/**
/**
* Preference repository.
* Preference repository.
*
*
* @author <a href="http://88250.b3log.org">Liang Ding</a>
* @author <a href="http://88250.b3log.org">Liang Ding</a>
* @version 1.0.0.
3, Feb 28, 2012
* @version 1.0.0.
4, Nov 23, 2015
* @since 0.3.1
* @since 0.3.1
* @deprecated this class will be removed in 1.3.0, see issue <a href="https://github.com/b3log/solo/issues/12042">#12042</a>
* @deprecated this class will be removed in 1.3.0, see issue
* <a href="https://github.com/b3log/solo/issues/12042">#12042</a>
* for more details
* for more details
*/
*/
@Repository
@Repository
...
@@ -40,16 +39,15 @@ public class PreferenceRepositoryImpl extends AbstractRepository implements Pref
...
@@ -40,16 +39,15 @@ public class PreferenceRepositoryImpl extends AbstractRepository implements Pref
* Public constructor.
* Public constructor.
*/
*/
public
PreferenceRepositoryImpl
()
{
public
PreferenceRepositoryImpl
()
{
super
(
Preference
.
PREFERENCE
);
super
(
Option
.
CATEGORY_C_
PREFERENCE
);
}
}
/**
/**
* {@inheritDoc}
* {@inheritDoc}
*
*
* <p>
* <p>
* Bypasses {@linkplain org.b3log.latke.repository.Repositories validation}
* Bypasses {@linkplain org.b3log.latke.repository.Repositories validation} against the repository structure, adds
* against the repository structure, adds the specified json object as
* the specified json object as preference directly.
* preference directly.
* </p>
* </p>
*/
*/
@Override
@Override
...
@@ -59,11 +57,10 @@ public class PreferenceRepositoryImpl extends AbstractRepository implements Pref
...
@@ -59,11 +57,10 @@ public class PreferenceRepositoryImpl extends AbstractRepository implements Pref
/**
/**
* {@inheritDoc}
* {@inheritDoc}
*
*
* <p>
* <p>
* Bypasses {@linkplain org.b3log.latke.repository.Repositories validation}
* Bypasses {@linkplain org.b3log.latke.repository.Repositories validation} against the repository structure, adds
* against the repository structure, adds the specified json object as
* the specified json object as preference directly.
* preference directly.
* </p>
* </p>
*/
*/
@Override
@Override
...
...
src/main/java/org/b3log/solo/service/UpgradeService.java
View file @
2915ec7f
...
@@ -121,7 +121,7 @@ public class UpgradeService {
...
@@ -121,7 +121,7 @@ public class UpgradeService {
*/
*/
public
void
upgrade
()
{
public
void
upgrade
()
{
try
{
try
{
final
JSONObject
preference
=
preferenceRepository
.
get
(
Preference
.
PREFERENCE
);
final
JSONObject
preference
=
preferenceRepository
.
get
(
Option
.
CATEGORY_C_
PREFERENCE
);
if
(
null
==
preference
)
{
if
(
null
==
preference
)
{
return
;
return
;
}
}
...
@@ -180,7 +180,7 @@ public class UpgradeService {
...
@@ -180,7 +180,7 @@ public class UpgradeService {
upgradeUsers
();
upgradeUsers
();
// Upgrades preference model
// Upgrades preference model
final
JSONObject
preference
=
preferenceRepository
.
get
(
Preference
.
PREFERENCE
);
final
JSONObject
preference
=
preferenceRepository
.
get
(
Option
.
CATEGORY_C_
PREFERENCE
);
final
String
adminEmail
=
preference
.
optString
(
Option
.
ID_C_ADMIN_EMAIL
);
final
String
adminEmail
=
preference
.
optString
(
Option
.
ID_C_ADMIN_EMAIL
);
final
JSONObject
adminEmailOpt
=
new
JSONObject
();
final
JSONObject
adminEmailOpt
=
new
JSONObject
();
...
@@ -434,7 +434,7 @@ public class UpgradeService {
...
@@ -434,7 +434,7 @@ public class UpgradeService {
optionRepository
.
add
(
allowRegisterOpt
);
optionRepository
.
add
(
allowRegisterOpt
);
preference
.
put
(
Option
.
ID_C_VERSION
,
TO_VER
);
preference
.
put
(
Option
.
ID_C_VERSION
,
TO_VER
);
preferenceRepository
.
update
(
Preference
.
PREFERENCE
,
preference
);
preferenceRepository
.
update
(
Option
.
CATEGORY_C_
PREFERENCE
,
preference
);
transaction
.
commit
();
transaction
.
commit
();
...
...
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