Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
A
apollo
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
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
openSource
apollo
Commits
6a80f254
Commit
6a80f254
authored
Jul 08, 2016
by
lepdou
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
重构 item update api
parent
81dc3b9c
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
9 additions
and
7 deletions
+9
-7
ItemController.java
...mework/apollo/adminservice/controller/ItemController.java
+5
-3
AdminServiceAPI.java
...om/ctrip/framework/apollo/portal/api/AdminServiceAPI.java
+3
-3
ConfigService.java
.../ctrip/framework/apollo/portal/service/ConfigService.java
+1
-1
No files found.
apollo-adminservice/src/main/java/com/ctrip/framework/apollo/adminservice/controller/ItemController.java
View file @
6a80f254
...
...
@@ -74,16 +74,18 @@ public class ItemController {
}
@PreAcquireNamespaceLock
@RequestMapping
(
path
=
"/apps/{appId}/clusters/{clusterName}/namespaces/{namespaceName}/items"
,
method
=
RequestMethod
.
PUT
)
@RequestMapping
(
path
=
"/apps/{appId}/clusters/{clusterName}/namespaces/{namespaceName}/items
/{itemId}
"
,
method
=
RequestMethod
.
PUT
)
public
ItemDTO
update
(
@PathVariable
(
"appId"
)
String
appId
,
@PathVariable
(
"clusterName"
)
String
clusterName
,
@PathVariable
(
"namespaceName"
)
String
namespaceName
,
@RequestBody
ItemDTO
itemDTO
)
{
@PathVariable
(
"namespaceName"
)
String
namespaceName
,
@PathVariable
(
"itemId"
)
long
itemId
,
@RequestBody
ItemDTO
itemDTO
)
{
Item
entity
=
BeanUtils
.
transfrom
(
Item
.
class
,
itemDTO
);
ConfigChangeContentBuilder
builder
=
new
ConfigChangeContentBuilder
();
Item
managedEntity
=
itemService
.
findOne
(
appId
,
clusterName
,
namespaceName
,
entity
.
getKey
()
);
Item
managedEntity
=
itemService
.
findOne
(
itemId
);
if
(
managedEntity
==
null
)
{
throw
new
BadRequestException
(
"item not exist"
);
}
...
...
apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/api/AdminServiceAPI.java
View file @
6a80f254
...
...
@@ -107,9 +107,9 @@ public class AdminServiceAPI {
changeSets
,
Void
.
class
,
getAdminServiceHost
(
env
),
appId
,
clusterName
,
namespace
);
}
public
void
updateItem
(
String
appId
,
Env
env
,
String
clusterName
,
String
namespace
,
ItemDTO
item
)
{
restTemplate
.
put
(
"{host}/apps/{appId}/clusters/{clusterName}/namespaces/{namespaceName}/items"
,
item
,
getAdminServiceHost
(
env
),
appId
,
clusterName
,
namespace
);
public
void
updateItem
(
String
appId
,
Env
env
,
String
clusterName
,
String
namespace
,
long
itemId
,
ItemDTO
item
)
{
restTemplate
.
put
(
"{host}/apps/{appId}/clusters/{clusterName}/namespaces/{namespaceName}/items
/{itemId}
"
,
item
,
getAdminServiceHost
(
env
),
appId
,
clusterName
,
namespace
,
itemId
);
}
...
...
apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/service/ConfigService.java
View file @
6a80f254
...
...
@@ -100,7 +100,7 @@ public class ConfigService {
public
void
updateItem
(
String
appId
,
Env
env
,
String
clusterName
,
String
namespaceName
,
ItemDTO
item
)
{
String
username
=
userInfoHolder
.
getUser
().
getUserId
();
item
.
setDataChangeLastModifiedBy
(
username
);
itemAPI
.
updateItem
(
appId
,
env
,
clusterName
,
namespaceName
,
item
);
itemAPI
.
updateItem
(
appId
,
env
,
clusterName
,
namespaceName
,
item
.
getId
(),
item
);
}
public
void
deleteItem
(
Env
env
,
long
itemId
)
{
...
...
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