Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
X
xwiki-platform
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Package Registry
Model registry
Operate
Terraform modules
Analyze
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
XWiki
xwiki-platform
Commits
f050e52f
Unverified
Commit
f050e52f
authored
3 weeks ago
by
Thomas Mortagne
Browse files
Options
Downloads
Patches
Plain Diff
XWIKI-22907: The update object property REST endpoint is modifying the cached document
parent
18aa48cf
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
xwiki-platform-core/xwiki-platform-rest/xwiki-platform-rest-server/src/main/java/org/xwiki/rest/internal/resources/objects/ObjectPropertyResourceImpl.java
+13
-10
13 additions, 10 deletions
...nternal/resources/objects/ObjectPropertyResourceImpl.java
with
13 additions
and
10 deletions
xwiki-platform-core/xwiki-platform-rest/xwiki-platform-rest-server/src/main/java/org/xwiki/rest/internal/resources/objects/ObjectPropertyResourceImpl.java
+
13
−
10
View file @
f050e52f
...
...
@@ -19,6 +19,7 @@
*/
package
org.xwiki.rest.internal.resources.objects
;
import
javax.inject.Inject
;
import
javax.inject.Named
;
import
javax.ws.rs.WebApplicationException
;
import
javax.ws.rs.core.Response
;
...
...
@@ -26,9 +27,9 @@
import
org.xwiki.component.annotation.Component
;
import
org.xwiki.rest.Relations
;
import
org.xwiki.rest.XWikiResource
;
import
org.xwiki.rest.XWikiRestException
;
import
org.xwiki.rest.internal.DomainObjectFactory
;
import
org.xwiki.rest.internal.ModelFactory
;
import
org.xwiki.rest.internal.Utils
;
import
org.xwiki.rest.model.jaxb.Link
;
import
org.xwiki.rest.model.jaxb.Object
;
...
...
@@ -39,14 +40,18 @@
import
com.xpn.xwiki.XWikiException
;
import
com.xpn.xwiki.api.Document
;
import
com.xpn.xwiki.doc.XWikiDocument
;
import
com.xpn.xwiki.objects.BaseObject
;
/**
* @version $Id$
*/
@Component
@Named
(
"org.xwiki.rest.internal.resources.objects.ObjectPropertyResourceImpl"
)
public
class
ObjectPropertyResourceImpl
extends
XWiki
Resource
implements
ObjectPropertyResource
public
class
ObjectPropertyResourceImpl
extends
BaseObjects
Resource
implements
ObjectPropertyResource
{
@Inject
private
ModelFactory
factory
;
@Override
public
Property
getObjectProperty
(
String
wikiName
,
String
spaceName
,
String
pageName
,
String
className
,
Integer
objectNumber
,
String
propertyName
,
Boolean
withPrettyNames
)
throws
XWikiRestException
...
...
@@ -103,21 +108,19 @@ public Response updateObjectProperty(String wikiName, String spaceName, String p
throw
new
WebApplicationException
(
Status
.
UNAUTHORIZED
);
}
XWikiDocument
xwikiDocument
=
Utils
.
getXWiki
(
componentManager
)
.
getDocument
(
doc
.
getDocumentReference
(),
Utils
.
getXWikiContext
(
componentManager
));
com
.
xpn
.
xwiki
.
api
.
Object
xwikiObject
=
doc
.
getObject
(
className
,
objectNumber
);
com
.
xpn
.
xwiki
.
objects
.
BaseObject
baseObject
=
xwikiDocument
.
getObject
(
className
,
objectNumber
);
if
(
baseObject
==
null
)
{
if
(
xwikiObject
==
null
)
{
throw
new
WebApplicationException
(
Status
.
NOT_FOUND
);
}
base
Object
.
set
(
propertyName
,
property
.
getValue
()
,
Utils
.
getXWikiContext
(
componentManager
)
);
xwiki
Object
.
set
(
propertyName
,
property
.
getValue
());
doc
.
save
(
""
,
Boolean
.
TRUE
.
equals
(
minorRevision
));
baseObject
=
xwikiDocument
.
get
Object
(
className
,
o
bjectNumber
);
Object
object
=
DomainObjectFactory
.
createObject
(
objectFactory
,
uriInfo
.
getBaseUri
(),
Utils
.
getXWikiContext
(
componentManager
),
doc
,
baseObject
,
false
,
Utils
.
getXWikiApi
(
componentManager
)
,
false
);
BaseObject
baseObject
=
getBase
Object
(
doc
,
className
,
xwikiO
bject
.
get
Number
()
);
Object
object
=
this
.
factory
.
toRestObject
(
this
.
uriInfo
.
getBaseUri
(),
doc
,
baseObject
,
false
,
false
);
for
(
Property
p
:
object
.
getProperties
())
{
if
(
p
.
getName
().
equals
(
propertyName
))
{
...
...
This diff is collapsed.
Click to expand it.
Git Mirror User
@gitmirror
mentioned in commit
5d7dc3d3
·
3 weeks ago
mentioned in commit
5d7dc3d3
mentioned in commit 5d7dc3d32e7d3a2ebb0a4bf0001c63d0fcae81f4
Toggle commit list
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment