From 0be76b6c234dcb3e0921cb875ac1aeba95593f35 Mon Sep 17 00:00:00 2001
From: Peter Hormanns <peter.hormanns@jalin.de>
Date: Wed, 23 Dec 2015 16:52:28 +0100
Subject: [PATCH] some property names are overwritten in api

---
 hsarback/src/de/hsadmin/mods/user/UnixUser.java    |    4 ++--
 hsarback/src/de/hsadmin/core/model/AnnFieldIO.java |    1 +
 hsarback/src/de/hsadmin/remote/PropertyRemote.java |    4 ++++
 3 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/hsarback/src/de/hsadmin/core/model/AnnFieldIO.java b/hsarback/src/de/hsadmin/core/model/AnnFieldIO.java
index 105eaee..4486fae 100644
--- a/hsarback/src/de/hsadmin/core/model/AnnFieldIO.java
+++ b/hsarback/src/de/hsadmin/core/model/AnnFieldIO.java
@@ -13,4 +13,5 @@
 	Class<?> referTo() default Void.class;
 	Class<? extends DefaultSelectableValues> selectableValues() default DefaultSelectableValues.class;
 	String[] referredProps() default { };
+	String overwriteName() default "";
 }
diff --git a/hsarback/src/de/hsadmin/mods/user/UnixUser.java b/hsarback/src/de/hsadmin/mods/user/UnixUser.java
index ed876d3..f89b809 100644
--- a/hsarback/src/de/hsadmin/mods/user/UnixUser.java
+++ b/hsarback/src/de/hsadmin/mods/user/UnixUser.java
@@ -69,11 +69,11 @@
 	@Column(name = "locked", columnDefinition = "boolean")
 	private boolean locked;
 
-	@AnnFieldIO(validation="[0-9]*", rw=ReadWriteAccess.READWRITE)
+	@AnnFieldIO(validation="[0-9]*", rw=ReadWriteAccess.READWRITE, overwriteName="quota_softlimit")
 	@Column(name = "quota_softlimit", columnDefinition = "integer")
 	private Integer quotaSoftlimit;
 
-	@AnnFieldIO(validation="[0-9]*", rw=ReadWriteAccess.READWRITE)
+	@AnnFieldIO(validation="[0-9]*", rw=ReadWriteAccess.READWRITE, overwriteName="quota_hardlimit")
 	@Column(name = "quota_hardlimit", columnDefinition = "integer")
 	private Integer quotaHardlimit;
 
diff --git a/hsarback/src/de/hsadmin/remote/PropertyRemote.java b/hsarback/src/de/hsadmin/remote/PropertyRemote.java
index a4d7595..6553d8a 100644
--- a/hsarback/src/de/hsadmin/remote/PropertyRemote.java
+++ b/hsarback/src/de/hsadmin/remote/PropertyRemote.java
@@ -40,6 +40,10 @@
 							if (fieldIO != null) {
 								HashMap<String, Object> propertyProperties = new HashMap<String, Object>();
 								String fieldName = f.getName();
+								String overwrite = fieldIO.overwriteName();
+								if (overwrite != null && !overwrite.isEmpty()) {
+									fieldName = overwrite;
+								}
 								propertyProperties.put("module", (String) moduleKey);
 								propertyProperties.put("name", fieldName);
 								propertyProperties.put("searchable", "equals");

--
Gitblit v1.9.0-SNAPSHOT