Mercurial > lada > lada-server
diff src/main/java/de/intevation/lada/rest/StatusService.java @ 595:746e03da9fad
Use timestamp locker in REST services.
author | Raimund Renkert <raimund.renkert@intevation.de> |
---|---|
date | Wed, 25 Mar 2015 16:20:01 +0100 |
parents | a04658486ede |
children | ddab1ecb2898 |
line wrap: on
line diff
--- a/src/main/java/de/intevation/lada/rest/StatusService.java Wed Mar 25 16:18:34 2015 +0100 +++ b/src/main/java/de/intevation/lada/rest/StatusService.java Wed Mar 25 16:20:01 2015 +0100 @@ -23,6 +23,9 @@ import javax.ws.rs.core.MultivaluedMap; import javax.ws.rs.core.UriInfo; +import de.intevation.lada.lock.LockConfig; +import de.intevation.lada.lock.LockType; +import de.intevation.lada.lock.ObjectLocker; import de.intevation.lada.model.land.LStatus; import de.intevation.lada.util.annotation.AuthorizationConfig; import de.intevation.lada.util.annotation.RepositoryConfig; @@ -43,6 +46,10 @@ @RepositoryConfig(type=RepositoryType.RW) private Repository defaultRepo; + @Inject + @LockConfig(type=LockType.TIMESTAMP) + private ObjectLocker lock; + /* The authorization module.*/ @Inject @AuthorizationConfig(type=AuthorizationType.OPEN_ID) @@ -137,6 +144,9 @@ ) { return new Response(false, 699, null); } + if (lock.isLocked(status)) { + return new Response(false, 697, null); + } Response response = defaultRepo.update(status, "land"); Response updated = defaultRepo.getById( LStatus.class, @@ -169,6 +179,9 @@ ) { return new Response(false, 699, null); } + if (lock.isLocked(obj)) { + return new Response(false, 697, null); + } /* Delete the object*/ return defaultRepo.delete(obj, "land"); }