Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
A
apollo
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
apollo
Commits
99a6f5dd
Commit
99a6f5dd
authored
Dec 27, 2019
by
waters
Committed by
Jason Song
Dec 27, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Refactor/remove redundant else (#2864)
parent
24cc3da1
Changes
25
Show whitespace changes
Inline
Side-by-side
Showing
25 changed files
with
137 additions
and
159 deletions
+137
-159
apollo-adminservice/src/main/java/com/ctrip/framework/apollo/adminservice/controller/ItemController.java
...mework/apollo/adminservice/controller/ItemController.java
+2
-3
apollo-biz/src/main/java/com/ctrip/framework/apollo/biz/service/ItemService.java
...a/com/ctrip/framework/apollo/biz/service/ItemService.java
+2
-4
apollo-biz/src/main/java/com/ctrip/framework/apollo/biz/service/ReleaseService.java
...om/ctrip/framework/apollo/biz/service/ReleaseService.java
+1
-2
apollo-client/src/main/java/com/ctrip/framework/apollo/util/http/HttpUtil.java
...n/java/com/ctrip/framework/apollo/util/http/HttpUtil.java
+2
-3
apollo-common/src/main/java/com/ctrip/framework/apollo/common/datasource/TitanCondition.java
...ip/framework/apollo/common/datasource/TitanCondition.java
+4
-2
apollo-core/src/main/java/com/ctrip/framework/foundation/internals/DefaultProviderManager.java
...ramework/foundation/internals/DefaultProviderManager.java
+3
-4
apollo-core/src/main/java/com/ctrip/framework/foundation/internals/provider/DefaultApplicationProvider.java
...dation/internals/provider/DefaultApplicationProvider.java
+2
-3
apollo-core/src/main/java/com/ctrip/framework/foundation/internals/provider/DefaultNetworkProvider.java
...foundation/internals/provider/DefaultNetworkProvider.java
+3
-3
apollo-core/src/main/java/com/ctrip/framework/foundation/internals/provider/DefaultServerProvider.java
.../foundation/internals/provider/DefaultServerProvider.java
+4
-4
apollo-mockserver/src/main/java/com/ctrip/framework/apollo/mockserver/EmbeddedApollo.java
...com/ctrip/framework/apollo/mockserver/EmbeddedApollo.java
+2
-1
apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/component/RetryableRestTemplate.java
...mework/apollo/portal/component/RetryableRestTemplate.java
+2
-3
apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/component/emailbuilder/GrayPublishEmailBuilder.java
...ortal/component/emailbuilder/GrayPublishEmailBuilder.java
+15
-16
apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/controller/AppController.java
...rip/framework/apollo/portal/controller/AppController.java
+2
-4
apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/controller/ConsumerController.java
...ramework/apollo/portal/controller/ConsumerController.java
+21
-22
apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/controller/ItemController.java
...ip/framework/apollo/portal/controller/ItemController.java
+1
-2
apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/controller/ServerConfigController.java
...work/apollo/portal/controller/ServerConfigController.java
+4
-4
apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/entity/bo/UserInfo.java
...com/ctrip/framework/apollo/portal/entity/bo/UserInfo.java
+1
-2
apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/listener/ConfigPublishListener.java
...amework/apollo/portal/listener/ConfigPublishListener.java
+1
-2
apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/service/ItemService.java
...om/ctrip/framework/apollo/portal/service/ItemService.java
+3
-3
apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/service/ReleaseService.java
...ctrip/framework/apollo/portal/service/ReleaseService.java
+1
-2
apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/spi/configuration/AuthConfiguration.java
...rk/apollo/portal/spi/configuration/AuthConfiguration.java
+8
-8
apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/spi/ldap/ApolloLdapAuthenticationProvider.java
...llo/portal/spi/ldap/ApolloLdapAuthenticationProvider.java
+8
-8
apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/spi/ldap/FilterLdapByGroupUserSearch.java
...k/apollo/portal/spi/ldap/FilterLdapByGroupUserSearch.java
+10
-11
apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/spi/ldap/LdapUserService.java
...rip/framework/apollo/portal/spi/ldap/LdapUserService.java
+34
-41
apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/util/RelativeDateFormat.java
...trip/framework/apollo/portal/util/RelativeDateFormat.java
+1
-2
No files found.
apollo-adminservice/src/main/java/com/ctrip/framework/apollo/adminservice/controller/ItemController.java
View file @
99a6f5dd
...
...
@@ -50,10 +50,9 @@ public class ItemController {
Item
managedEntity
=
itemService
.
findOne
(
appId
,
clusterName
,
namespaceName
,
entity
.
getKey
());
if
(
managedEntity
!=
null
)
{
throw
new
BadRequestException
(
"item already exists"
);
}
else
{
}
entity
=
itemService
.
save
(
entity
);
builder
.
createItem
(
entity
);
}
dto
=
BeanUtils
.
transform
(
ItemDTO
.
class
,
entity
);
Commit
commit
=
new
Commit
();
...
...
apollo-biz/src/main/java/com/ctrip/framework/apollo/biz/service/ItemService.java
View file @
99a6f5dd
...
...
@@ -100,9 +100,8 @@ public class ItemService {
Namespace
namespace
=
namespaceService
.
findOne
(
appId
,
clusterName
,
namespaceName
);
if
(
namespace
!=
null
)
{
return
findItemsWithoutOrdered
(
namespace
.
getId
());
}
else
{
return
Collections
.
emptyList
();
}
return
Collections
.
emptyList
();
}
public
List
<
Item
>
findItemsWithOrdered
(
Long
namespaceId
)
{
...
...
@@ -117,9 +116,8 @@ public class ItemService {
Namespace
namespace
=
namespaceService
.
findOne
(
appId
,
clusterName
,
namespaceName
);
if
(
namespace
!=
null
)
{
return
findItemsWithOrdered
(
namespace
.
getId
());
}
else
{
return
Collections
.
emptyList
();
}
return
Collections
.
emptyList
();
}
public
List
<
Item
>
findItemsModifiedAfterDate
(
long
namespaceId
,
Date
date
)
{
...
...
apollo-biz/src/main/java/com/ctrip/framework/apollo/biz/service/ReleaseService.java
View file @
99a6f5dd
...
...
@@ -242,9 +242,8 @@ public class ReleaseService {
if
(
parentNamespace
!=
null
)
{
return
publishBranchNamespace
(
parentNamespace
,
namespace
,
operateNamespaceItems
,
releaseName
,
releaseComment
,
operator
,
isEmergencyPublish
,
grayDelKeys
);
}
else
{
throw
new
NotFoundException
(
"Parent namespace not found"
);
}
throw
new
NotFoundException
(
"Parent namespace not found"
);
}
private
void
checkLock
(
Namespace
namespace
,
boolean
isEmergencyPublish
,
String
operator
)
{
...
...
apollo-client/src/main/java/com/ctrip/framework/apollo/util/http/HttpUtil.java
View file @
99a6f5dd
...
...
@@ -119,11 +119,10 @@ public class HttpUtil {
// 200 and 304 should not trigger IOException, thus we must throw the original exception out
if
(
statusCode
==
200
||
statusCode
==
304
)
{
throw
ex
;
}
else
{
}
// for status codes like 404, IOException is expected when calling conn.getInputStream()
throw
new
ApolloConfigStatusCodeException
(
statusCode
,
ex
);
}
}
if
(
statusCode
==
200
)
{
return
new
HttpResponse
<>(
statusCode
,
serializeFunction
.
apply
(
response
));
...
...
apollo-common/src/main/java/com/ctrip/framework/apollo/common/datasource/TitanCondition.java
View file @
99a6f5dd
...
...
@@ -12,9 +12,11 @@ public class TitanCondition implements Condition {
public
boolean
matches
(
ConditionContext
context
,
AnnotatedTypeMetadata
metadata
)
{
if
(!
StringUtils
.
isEmpty
(
context
.
getEnvironment
().
getProperty
(
"fat.titan.url"
)))
{
return
true
;
}
else
if
(!
StringUtils
.
isEmpty
(
context
.
getEnvironment
().
getProperty
(
"uat.titan.url"
)))
{
}
if
(!
StringUtils
.
isEmpty
(
context
.
getEnvironment
().
getProperty
(
"uat.titan.url"
)))
{
return
true
;
}
else
if
(!
StringUtils
.
isEmpty
(
context
.
getEnvironment
().
getProperty
(
"pro.titan.url"
)))
{
}
if
(!
StringUtils
.
isEmpty
(
context
.
getEnvironment
().
getProperty
(
"pro.titan.url"
)))
{
return
true
;
}
return
false
;
...
...
apollo-core/src/main/java/com/ctrip/framework/foundation/internals/DefaultProviderManager.java
View file @
99a6f5dd
...
...
@@ -44,12 +44,11 @@ public class DefaultProviderManager implements ProviderManager {
if
(
provider
!=
null
)
{
return
(
T
)
provider
;
}
else
{
}
logger
.
error
(
"No provider [{}] found in DefaultProviderManager, please make sure it is registered in DefaultProviderManager "
,
clazz
.
getName
());
return
(
T
)
NullProviderManager
.
provider
;
}
}
@Override
public
String
getProperty
(
String
name
,
String
defaultValue
)
{
...
...
apollo-core/src/main/java/com/ctrip/framework/foundation/internals/provider/DefaultApplicationProvider.java
View file @
99a6f5dd
...
...
@@ -66,11 +66,10 @@ public class DefaultApplicationProvider implements ApplicationProvider {
if
(
"app.id"
.
equals
(
name
))
{
String
val
=
getAppId
();
return
val
==
null
?
defaultValue
:
val
;
}
else
{
}
String
val
=
m_appProperties
.
getProperty
(
name
,
defaultValue
);
return
val
==
null
?
defaultValue
:
val
;
}
}
@Override
public
Class
<?
extends
Provider
>
getType
()
{
...
...
apollo-core/src/main/java/com/ctrip/framework/foundation/internals/provider/DefaultNetworkProvider.java
View file @
99a6f5dd
...
...
@@ -10,12 +10,12 @@ public class DefaultNetworkProvider implements NetworkProvider {
if
(
"host.address"
.
equalsIgnoreCase
(
name
))
{
String
val
=
getHostAddress
();
return
val
==
null
?
defaultValue
:
val
;
}
else
if
(
"host.name"
.
equalsIgnoreCase
(
name
))
{
}
if
(
"host.name"
.
equalsIgnoreCase
(
name
))
{
String
val
=
getHostName
();
return
val
==
null
?
defaultValue
:
val
;
}
else
{
return
defaultValue
;
}
return
defaultValue
;
}
@Override
...
...
apollo-core/src/main/java/com/ctrip/framework/foundation/internals/provider/DefaultServerProvider.java
View file @
99a6f5dd
...
...
@@ -86,14 +86,14 @@ public class DefaultServerProvider implements ServerProvider {
if
(
"env"
.
equalsIgnoreCase
(
name
))
{
String
val
=
getEnvType
();
return
val
==
null
?
defaultValue
:
val
;
}
else
if
(
"dc"
.
equalsIgnoreCase
(
name
))
{
}
if
(
"dc"
.
equalsIgnoreCase
(
name
))
{
String
val
=
getDataCenter
();
return
val
==
null
?
defaultValue
:
val
;
}
else
{
}
String
val
=
m_serverProperties
.
getProperty
(
name
,
defaultValue
);
return
val
==
null
?
defaultValue
:
val
.
trim
();
}
}
@Override
public
Class
<?
extends
Provider
>
getType
()
{
...
...
apollo-mockserver/src/main/java/com/ctrip/framework/apollo/mockserver/EmbeddedApollo.java
View file @
99a6f5dd
...
...
@@ -64,7 +64,8 @@ public class EmbeddedApollo extends ExternalResource {
if
(
request
.
getPath
().
startsWith
(
"/notifications/v2"
))
{
String
notifications
=
request
.
getRequestUrl
().
queryParameter
(
"notifications"
);
return
new
MockResponse
().
setResponseCode
(
200
).
setBody
(
mockLongPollBody
(
notifications
));
}
else
if
(
request
.
getPath
().
startsWith
(
"/configs"
))
{
}
if
(
request
.
getPath
().
startsWith
(
"/configs"
))
{
List
<
String
>
pathSegments
=
request
.
getRequestUrl
().
pathSegments
();
// appId and cluster might be used in the future
String
appId
=
pathSegments
.
get
(
1
);
...
...
apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/component/RetryableRestTemplate.java
View file @
99a6f5dd
...
...
@@ -219,10 +219,9 @@ public class RetryableRestTemplate {
return
nestedException
instanceof
SocketTimeoutException
||
nestedException
instanceof
HttpHostConnectException
||
nestedException
instanceof
ConnectTimeoutException
;
}
else
{
}
return
nestedException
instanceof
HttpHostConnectException
||
nestedException
instanceof
ConnectTimeoutException
;
}
}
}
apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/component/emailbuilder/GrayPublishEmailBuilder.java
View file @
99a6f5dd
...
...
@@ -56,7 +56,7 @@ public class GrayPublishEmailBuilder extends ConfigPublishEmailBuilder {
if
(
CollectionUtils
.
isEmpty
(
ruleItems
))
{
return
bodyTemplate
.
replaceAll
(
EMAIL_CONTENT_GRAY_RULES_MODULE
,
"<br><h4>无灰度规则</h4>"
);
}
else
{
}
StringBuilder
rulesHtmlBuilder
=
new
StringBuilder
();
for
(
GrayReleaseRuleItemDTO
ruleItem
:
ruleItems
)
{
String
clientAppId
=
ruleItem
.
getClientAppId
();
...
...
@@ -72,7 +72,6 @@ public class GrayPublishEmailBuilder extends ConfigPublishEmailBuilder {
Matcher
.
quoteReplacement
(
rulesHtmlBuilder
.
toString
()));
return
bodyTemplate
.
replaceAll
(
EMAIL_CONTENT_GRAY_RULES_MODULE
,
Matcher
.
quoteReplacement
(
grayRulesModuleContent
));
}
}
}
apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/controller/AppController.java
View file @
99a6f5dd
...
...
@@ -75,9 +75,8 @@ public class AppController {
public
List
<
App
>
findApps
(
@RequestParam
(
value
=
"appIds"
,
required
=
false
)
String
appIds
)
{
if
(
StringUtils
.
isEmpty
(
appIds
))
{
return
appService
.
findAll
();
}
else
{
return
appService
.
findByAppIds
(
Sets
.
newHashSet
(
appIds
.
split
(
","
)));
}
return
appService
.
findByAppIds
(
Sets
.
newHashSet
(
appIds
.
split
(
","
)));
}
@GetMapping
(
"/search/by-appid-or-name"
)
...
...
@@ -85,9 +84,8 @@ public class AppController {
Pageable
pageable
)
{
if
(
StringUtils
.
isEmpty
(
query
))
{
return
appService
.
findAll
(
pageable
);
}
else
{
return
appService
.
searchByAppIdOrAppName
(
query
,
pageable
);
}
return
appService
.
searchByAppIdOrAppName
(
query
,
pageable
);
}
@GetMapping
(
"/by-owner"
)
...
...
apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/controller/ConsumerController.java
View file @
99a6f5dd
...
...
@@ -86,7 +86,7 @@ public class ConsumerController {
}
if
(
Objects
.
equals
(
"AppRole"
,
type
))
{
return
Collections
.
singletonList
(
consumerService
.
assignAppRoleToConsumer
(
token
,
appId
));
}
else
{
}
if
(
StringUtils
.
isEmpty
(
namespaceName
))
{
throw
new
BadRequestException
(
"Params(NamespaceName) can not be empty."
);
}
...
...
@@ -113,7 +113,6 @@ public class ConsumerController {
return
consumerService
.
assignNamespaceRoleToConsumer
(
token
,
appId
,
namespaceName
);
}
}
...
...
apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/controller/ItemController.java
View file @
99a6f5dd
...
...
@@ -194,7 +194,6 @@ public class ItemController {
configService
.
syncItems
(
model
.
getSyncToNamespaces
(),
model
.
getSyncItems
());
return
ResponseEntity
.
status
(
HttpStatus
.
OK
).
build
();
}
else
throw
new
AccessDeniedException
(
String
.
format
(
"You don't have the permission to modify environment: %s"
,
envNoPermission
));
}
...
...
apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/controller/ServerConfigController.java
View file @
99a6f5dd
...
...
@@ -40,12 +40,12 @@ public class ServerConfigController {
serverConfig
.
setDataChangeLastModifiedBy
(
modifiedBy
);
serverConfig
.
setId
(
0L
);
//为空,设置ID 为0,jpa执行新增操作
return
serverConfigRepository
.
save
(
serverConfig
);
}
else
{
//update
}
//update
BeanUtils
.
copyEntityProperties
(
serverConfig
,
storedConfig
);
storedConfig
.
setDataChangeLastModifiedBy
(
modifiedBy
);
return
serverConfigRepository
.
save
(
storedConfig
);
}
}
@PreAuthorize
(
value
=
"@permissionValidator.isSuperAdmin()"
)
@GetMapping
(
"/server/config/{key:.+}"
)
...
...
apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/entity/bo/UserInfo.java
View file @
99a6f5dd
...
...
@@ -48,9 +48,8 @@ public class UserInfo {
UserInfo
anotherUser
=
(
UserInfo
)
o
;
return
userId
.
equals
(
anotherUser
.
userId
);
}
else
{
return
false
;
}
return
false
;
}
}
apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/listener/ConfigPublishListener.java
View file @
99a6f5dd
...
...
@@ -101,9 +101,8 @@ public class ConfigPublishListener {
if
(
publishInfo
.
isRollbackEvent
())
{
return
releaseHistoryService
.
findLatestByPreviousReleaseIdAndOperation
(
env
,
publishInfo
.
getPreviousReleaseId
(),
operation
);
}
else
{
return
releaseHistoryService
.
findLatestByReleaseIdAndOperation
(
env
,
publishInfo
.
getReleaseId
(),
operation
);
}
return
releaseHistoryService
.
findLatestByReleaseIdAndOperation
(
env
,
publishInfo
.
getReleaseId
(),
operation
);
}
...
...
apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/service/ItemService.java
View file @
99a6f5dd
...
...
@@ -239,10 +239,10 @@ public class ItemService {
if
(
sourceComment
==
null
)
{
return
!
StringUtils
.
isEmpty
(
targetComment
);
}
else
if
(
targetComment
!=
null
)
{
}
if
(
targetComment
!=
null
)
{
return
!
sourceComment
.
equals
(
targetComment
);
}
else
{
return
false
;
}
return
false
;
}
}
apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/service/ReleaseService.java
View file @
99a6f5dd
...
...
@@ -126,9 +126,8 @@ public class ReleaseService {
List
<
ReleaseDTO
>
releases
=
findReleaseByIds
(
env
,
releaseIds
);
if
(
CollectionUtils
.
isEmpty
(
releases
))
{
return
null
;
}
else
{
return
releases
.
get
(
0
);
}
return
releases
.
get
(
0
);
}
...
...
apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/spi/configuration/AuthConfiguration.java
View file @
99a6f5dd
...
...
@@ -373,7 +373,8 @@ public class AuthConfiguration {
ldapProperties
.
getSearchFilter
(),
ldapContextSource
);
filterBasedLdapUserSearch
.
setSearchSubtree
(
true
);
return
filterBasedLdapUserSearch
;
}
else
{
}
FilterLdapByGroupUserSearch
filterLdapByGroupUserSearch
=
new
FilterLdapByGroupUserSearch
(
ldapProperties
.
getBase
(),
ldapProperties
.
getSearchFilter
(),
ldapExtendProperties
.
getGroup
().
getGroupBase
(),
ldapContextSource
,
ldapExtendProperties
.
getGroup
().
getGroupSearch
(),
...
...
@@ -382,7 +383,6 @@ public class AuthConfiguration {
filterLdapByGroupUserSearch
.
setSearchSubtree
(
true
);
return
filterLdapByGroupUserSearch
;
}
}
@Bean
public
LdapAuthenticationProvider
ldapAuthProvider
()
{
...
...
apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/spi/ldap/ApolloLdapAuthenticationProvider.java
View file @
99a6f5dd
...
...
@@ -67,10 +67,11 @@ public class ApolloLdapAuthenticationProvider extends LdapAuthenticationProvider
if
(!
StringUtils
.
hasLength
(
username
))
{
throw
new
BadCredentialsException
(
this
.
messages
.
getMessage
(
"LdapAuthenticationProvider.emptyUsername"
,
"Empty Username"
));
}
else
if
(!
StringUtils
.
hasLength
(
password
))
{
}
if
(!
StringUtils
.
hasLength
(
password
))
{
throw
new
BadCredentialsException
(
this
.
messages
.
getMessage
(
"AbstractLdapAuthenticationProvider.emptyPassword"
,
"Empty Password"
));
}
else
{
}
Assert
.
notNull
(
password
,
"Null password was supplied in authentication token"
);
DirContextOperations
userData
=
this
.
doAuthentication
(
userToken
);
String
loginId
=
userData
.
getStringAttribute
(
properties
.
getMapping
().
getLoginId
());
...
...
@@ -78,5 +79,4 @@ public class ApolloLdapAuthenticationProvider extends LdapAuthenticationProvider
this
.
loadUserAuthorities
(
userData
,
loginId
,
(
String
)
authentication
.
getCredentials
()));
return
this
.
createSuccessfulAuthentication
(
userToken
,
user
);
}
}
}
apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/spi/ldap/FilterLdapByGroupUserSearch.java
View file @
99a6f5dd
...
...
@@ -81,7 +81,7 @@ public class FilterLdapByGroupUserSearch extends FilterBasedLdapUserSearch {
}
}
throw
new
UsernameNotFoundException
(
"User "
+
username
+
" not found in directory."
);
}
else
{
}
String
[]
memberUids
=
((
DirContextAdapter
)
ctx
)
.
getStringAttributes
(
groupMembershipAttrName
);
for
(
String
memberUid
:
memberUids
)
{
...
...
@@ -93,7 +93,6 @@ public class FilterLdapByGroupUserSearch extends FilterBasedLdapUserSearch {
return
new
DirContextAdapter
(
ldapRdn
);
}
}
}
throw
new
UsernameNotFoundException
(
"User "
+
username
+
" not found in directory."
);
});
}
...
...
apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/spi/ldap/LdapUserService.java
View file @
99a6f5dd
...
...
@@ -167,12 +167,10 @@ public class LdapUserService implements UserService {
if
(
userIds
!=
null
)
{
if
(
userIds
.
stream
().
anyMatch
(
c
->
c
.
equals
(
tmp
.
getUserId
())))
{
return
tmp
;
}
else
{
}
return
null
;
}
}
else
{
return
tmp
;
}
});
}
...
...
@@ -224,7 +222,7 @@ public class LdapUserService implements UserService {
}
return
userInfos
;
}
else
{
}
List
<
UserInfo
>
userInfos
=
new
ArrayList
<>();
String
[]
memberUids
=
((
DirContextAdapter
)
ctx
)
.
getStringAttributes
(
groupMembershipAttrName
);
...
...
@@ -241,7 +239,6 @@ public class LdapUserService implements UserService {
}
}
return
userInfos
;
}
});
}
...
...
@@ -258,7 +255,7 @@ public class LdapUserService implements UserService {
}
return
-
1
;
})),
ArrayList:
:
new
));
}
else
{
}
ContainerCriteria
criteria
=
ldapQueryCriteria
();
if
(!
Strings
.
isNullOrEmpty
(
keyword
))
{
criteria
.
and
(
query
().
where
(
loginIdAttrName
).
like
(
keyword
+
"*"
).
or
(
userDisplayNameAttrName
)
...
...
@@ -267,7 +264,6 @@ public class LdapUserService implements UserService {
users
=
ldapTemplate
.
search
(
criteria
,
ldapUserInfoMapper
);
return
users
;
}
}
@Override
public
UserInfo
findByUserId
(
String
userId
)
{
...
...
@@ -278,30 +274,27 @@ public class LdapUserService implements UserService {
return
lists
.
get
(
0
);
}
return
null
;
}
else
{
}
return
ldapTemplate
.
searchForObject
(
ldapQueryCriteria
().
and
(
loginIdAttrName
).
is
(
userId
),
ldapUserInfoMapper
);
}
}
@Override
public
List
<
UserInfo
>
findByUserIds
(
List
<
String
>
userIds
)
{
if
(
CollectionUtils
.
isEmpty
(
userIds
))
{
return
Collections
.
emptyList
();
}
else
{
}
List
<
UserInfo
>
userList
=
new
ArrayList
<>();
if
(
StringUtils
.
isNotBlank
(
groupSearch
))
{
List
<
UserInfo
>
userListByGroup
=
searchUserInfoByGroup
(
groupBase
,
groupSearch
,
null
,
userIds
);
userList
.
addAll
(
userListByGroup
);
return
userList
;
}
else
{
}
ContainerCriteria
criteria
=
query
().
where
(
loginIdAttrName
).
is
(
userIds
.
get
(
0
));
userIds
.
stream
().
skip
(
1
).
forEach
(
userId
->
criteria
.
or
(
loginIdAttrName
).
is
(
userId
));
return
ldapTemplate
.
search
(
ldapQueryCriteria
().
and
(
criteria
),
ldapUserInfoMapper
);
}
}
}
}
apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/util/RelativeDateFormat.java
View file @
99a6f5dd
...
...
@@ -53,9 +53,8 @@ public class RelativeDateFormat {
long
months
=
toMonths
(
delta
);
if
(
months
<=
3
)
{
return
(
months
<=
0
?
1
:
months
)
+
ONE_MONTH_AGO
;
}
else
{
return
TIMESTAMP_FORMAT
.
format
(
date
);
}
return
TIMESTAMP_FORMAT
.
format
(
date
);
}
private
static
long
toSeconds
(
long
date
)
{
...
...
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