more xmlrpc datatypes
This commit is contained in:
parent
5c3215619e
commit
03ee391a7f
@ -28,13 +28,13 @@ public abstract class AbstractRemote implements IRemote {
|
||||
|
||||
protected abstract Class<? extends AbstractEntity> getEntityClass();
|
||||
|
||||
protected abstract void entity2map(AbstractEntity entity, Map<String, String> resultMap);
|
||||
protected abstract void entity2map(AbstractEntity entity, Map<String, Object> resultMap);
|
||||
|
||||
protected abstract void map2entity(Map<String, String> setParams, AbstractEntity entity);
|
||||
protected abstract void map2entity(Map<String, Object> setParams, AbstractEntity entity);
|
||||
|
||||
protected abstract void regularizeKeys(Map<String, String> whereParams);
|
||||
|
||||
public List<Map<String, String>> search(String runAsUser, String ticket,
|
||||
public List<Map<String, Object>> search(String runAsUser, String ticket,
|
||||
Map<String, String> whereParams) throws HSAdminException {
|
||||
String user = runAsUser;
|
||||
Transaction transaction = new Transaction(user);
|
||||
@ -47,9 +47,9 @@ public abstract class AbstractRemote implements IRemote {
|
||||
if (list == null) {
|
||||
throw new HSAdminException("result list is null, runtime-error?");
|
||||
}
|
||||
ArrayList<Map<String, String>> result = new ArrayList<Map<String, String>>();
|
||||
ArrayList<Map<String, Object>> result = new ArrayList<Map<String, Object>>();
|
||||
for (AbstractEntity e : list) {
|
||||
HashMap<String, String> entry = new HashMap<String, String>();
|
||||
HashMap<String, Object> entry = new HashMap<String, Object>();
|
||||
entity2map(e, entry);
|
||||
if (e.isReadAllowedFor(unixUser)) {
|
||||
result.add(entry);
|
||||
@ -68,8 +68,8 @@ public abstract class AbstractRemote implements IRemote {
|
||||
}
|
||||
}
|
||||
|
||||
public Map<String, String> add(String runAsUser, String ticket,
|
||||
Map<String, String> setParams) throws HSAdminException {
|
||||
public Map<String, Object> add(String runAsUser, String ticket,
|
||||
Map<String, Object> setParams) throws HSAdminException {
|
||||
String user = runAsUser;
|
||||
Transaction transaction = new Transaction(user);
|
||||
try {
|
||||
@ -82,7 +82,7 @@ public abstract class AbstractRemote implements IRemote {
|
||||
transaction.beginTransaction();
|
||||
AbstractEntity insertedEntity = module.add(entity);
|
||||
transaction.commitTransaction();
|
||||
HashMap<String, String> entry = new HashMap<String, String>();
|
||||
HashMap<String, Object> entry = new HashMap<String, Object>();
|
||||
entity2map(insertedEntity, entry);
|
||||
return entry;
|
||||
} else {
|
||||
@ -131,8 +131,8 @@ public abstract class AbstractRemote implements IRemote {
|
||||
}
|
||||
}
|
||||
|
||||
public List<Map<String, String>> update(String runAsUser, String ticket,
|
||||
Map<String, String> setParams, Map<String, String> whereParams)
|
||||
public List<Map<String, Object>> update(String runAsUser, String ticket,
|
||||
Map<String, Object> setParams, Map<String, String> whereParams)
|
||||
throws HSAdminException {
|
||||
String user = runAsUser;
|
||||
Transaction transaction = new Transaction(user);
|
||||
@ -140,7 +140,7 @@ public abstract class AbstractRemote implements IRemote {
|
||||
if (authentication.login(user, ticket)) {
|
||||
ModuleInterface module = new GenericModuleImpl(transaction);
|
||||
UnixUser unixUser = transaction.getLoginUser();
|
||||
ArrayList<Map<String, String>> result = new ArrayList<Map<String, String>>();
|
||||
ArrayList<Map<String, Object>> result = new ArrayList<Map<String, Object>>();
|
||||
String queryCondition = buildQueryCondition(whereParams);
|
||||
if (queryCondition == null || queryCondition.length() == 0) {
|
||||
throw new HSAdminException(
|
||||
@ -154,7 +154,7 @@ public abstract class AbstractRemote implements IRemote {
|
||||
transaction.detach(update);
|
||||
map2entity(setParams, update);
|
||||
update = module.update(update);
|
||||
HashMap<String, String> entry = new HashMap<String, String>();
|
||||
HashMap<String, Object> entry = new HashMap<String, Object>();
|
||||
entity2map(update, entry);
|
||||
result.add(entry);
|
||||
} else {
|
||||
|
@ -23,7 +23,7 @@ public class CustomerRemote extends AbstractRemote {
|
||||
|
||||
@Override
|
||||
protected void entity2map(AbstractEntity entity,
|
||||
Map<String, String> resultMap) {
|
||||
Map<String, Object> resultMap) {
|
||||
Customer cust = (Customer) entity;
|
||||
resultMap.put("id", Long.toString(cust.getId()));
|
||||
resultMap.put("membercode", cust.getName());
|
||||
@ -83,26 +83,26 @@ public class CustomerRemote extends AbstractRemote {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void map2entity(Map<String, String> setParams,
|
||||
protected void map2entity(Map<String, Object> setParams,
|
||||
AbstractEntity entity) {
|
||||
Customer cust = (Customer) entity;
|
||||
String idStr = setParams.get("id");
|
||||
String idStr = (String) setParams.get("id");
|
||||
if (assertNotNull(idStr)) {
|
||||
cust.setId(Long.parseLong(idStr));
|
||||
}
|
||||
String memberCode = setParams.get("membercode");
|
||||
String memberCode = (String) setParams.get("membercode");
|
||||
if (assertNotNull(memberCode)) {
|
||||
cust.setName(memberCode);
|
||||
}
|
||||
String password = setParams.get("password");
|
||||
String password = (String) setParams.get("password");
|
||||
if (assertNotNull(password)) {
|
||||
cust.setPassword(password);
|
||||
}
|
||||
String memberNo = setParams.get("memberno");
|
||||
String memberNo = (String) setParams.get("memberno");
|
||||
if (assertNotNull(memberNo)) {
|
||||
cust.setMemberNo(Integer.parseInt(memberNo));
|
||||
}
|
||||
String memberSince = setParams.get("membersince");
|
||||
String memberSince = (String) setParams.get("membersince");
|
||||
if (assertNotNull(memberSince)) {
|
||||
try {
|
||||
cust.setMemberSince(df.parse(memberSince));
|
||||
@ -110,7 +110,7 @@ public class CustomerRemote extends AbstractRemote {
|
||||
// don't care
|
||||
}
|
||||
}
|
||||
String memberUntil = setParams.get("memberuntil");
|
||||
String memberUntil = (String) setParams.get("memberuntil");
|
||||
if (assertNotNull(memberUntil)) {
|
||||
try {
|
||||
cust.setMemberUntil(df.parse(memberUntil));
|
||||
@ -118,11 +118,11 @@ public class CustomerRemote extends AbstractRemote {
|
||||
// don't care
|
||||
}
|
||||
}
|
||||
String memberRole = setParams.get("memberrole");
|
||||
String memberRole = (String) setParams.get("memberrole");
|
||||
if (assertNotNull(memberRole)) {
|
||||
cust.setMemberRole(memberRole);
|
||||
}
|
||||
String authorContract = setParams.get("authorcontract");
|
||||
String authorContract = (String) setParams.get("authorcontract");
|
||||
if (assertNotNull(authorContract)) {
|
||||
try {
|
||||
cust.setAuthorContract(df.parse(authorContract));
|
||||
@ -130,7 +130,7 @@ public class CustomerRemote extends AbstractRemote {
|
||||
// don't care
|
||||
}
|
||||
}
|
||||
String nonDiscContract = setParams.get("nondisccontract");
|
||||
String nonDiscContract = (String) setParams.get("nondisccontract");
|
||||
if (assertNotNull(nonDiscContract)) {
|
||||
try {
|
||||
cust.setNonDiscContract(df.parse(nonDiscContract));
|
||||
@ -138,7 +138,7 @@ public class CustomerRemote extends AbstractRemote {
|
||||
// don't care
|
||||
}
|
||||
}
|
||||
String sharesUpdated = setParams.get("sharesupdated");
|
||||
String sharesUpdated = (String) setParams.get("sharesupdated");
|
||||
if (assertNotNull(sharesUpdated)) {
|
||||
try {
|
||||
cust.setSharesUpdated(df.parse(sharesUpdated));
|
||||
@ -146,11 +146,11 @@ public class CustomerRemote extends AbstractRemote {
|
||||
// don't care
|
||||
}
|
||||
}
|
||||
String sharesSigned = setParams.get("sharessigned");
|
||||
String sharesSigned = (String) setParams.get("sharessigned");
|
||||
if (assertNotNull(sharesSigned)) {
|
||||
cust.setId(Integer.parseInt(sharesSigned));
|
||||
}
|
||||
String uidVat = setParams.get("uidvat");
|
||||
String uidVat = (String) setParams.get("uidvat");
|
||||
if (assertNotNull(uidVat)) {
|
||||
cust.setUidVAT(uidVat);
|
||||
}
|
||||
@ -160,34 +160,34 @@ public class CustomerRemote extends AbstractRemote {
|
||||
bank.setCustomer(cust);
|
||||
cust.setBankAccount(bank);
|
||||
}
|
||||
String autoDebitGA = setParams.get("autodebit_ga");
|
||||
String autoDebitGA = (String) setParams.get("autodebit_ga");
|
||||
if (assertNotNull(autoDebitGA)) {
|
||||
autoDebitGA = autoDebitGA.toUpperCase();
|
||||
bank.setAutoDebitGA(new Boolean(autoDebitGA.startsWith("T") || autoDebitGA.startsWith("Y")));
|
||||
}
|
||||
String autoDebitAR = setParams.get("autodebit_ar");
|
||||
String autoDebitAR = (String) setParams.get("autodebit_ar");
|
||||
if (assertNotNull(autoDebitAR)) {
|
||||
autoDebitAR = autoDebitAR.toUpperCase();
|
||||
bank.setAutoDebitAR(new Boolean(autoDebitAR.startsWith("T") || autoDebitAR.startsWith("Y")));
|
||||
}
|
||||
String autoDebitOP = setParams.get("autodebit_op");
|
||||
String autoDebitOP = (String) setParams.get("autodebit_op");
|
||||
if (assertNotNull(autoDebitOP)) {
|
||||
autoDebitOP = autoDebitOP.toUpperCase();
|
||||
bank.setAutoDebitOP(new Boolean(autoDebitOP.startsWith("T") || autoDebitOP.startsWith("Y")));
|
||||
}
|
||||
String bankCustomer = setParams.get("bank_customer");
|
||||
String bankCustomer = (String) setParams.get("bank_customer");
|
||||
if (assertNotNull(bankCustomer)) {
|
||||
bank.setBankCustomer(bankCustomer);
|
||||
}
|
||||
String bankAccount = setParams.get("bank_account");
|
||||
String bankAccount = (String) setParams.get("bank_account");
|
||||
if (assertNotNull(bankAccount)) {
|
||||
bank.setBankAccount(bankAccount);
|
||||
}
|
||||
String bankCode = setParams.get("bank_code");
|
||||
String bankCode = (String) setParams.get("bank_code");
|
||||
if (assertNotNull(bankCode)) {
|
||||
bank.setBankCode(bankCode);
|
||||
}
|
||||
String bankName = setParams.get("bank_name");
|
||||
String bankName = (String) setParams.get("bank_name");
|
||||
if (assertNotNull(bankName)) {
|
||||
bank.setBankName(bankName);
|
||||
}
|
||||
@ -199,63 +199,63 @@ public class CustomerRemote extends AbstractRemote {
|
||||
} else {
|
||||
c = contacts.iterator().next();
|
||||
}
|
||||
String salut = setParams.get("contact_salut");
|
||||
String salut = (String) setParams.get("contact_salut");
|
||||
if (assertNotNull(salut)) {
|
||||
c.setSalut(salut);
|
||||
}
|
||||
String title = setParams.get("contact_title");
|
||||
String title = (String) setParams.get("contact_title");
|
||||
if (assertNotNull(title)) {
|
||||
c.setTitle(title);
|
||||
}
|
||||
String firstName = setParams.get("contact_firstname");
|
||||
String firstName = (String) setParams.get("contact_firstname");
|
||||
if (assertNotNull(firstName)) {
|
||||
c.setFirstName(firstName);
|
||||
}
|
||||
String lastName = setParams.get("contact_lastname");
|
||||
String lastName = (String) setParams.get("contact_lastname");
|
||||
if (assertNotNull(lastName)) {
|
||||
c.setLastName(lastName);
|
||||
}
|
||||
String firma = setParams.get("contact_firma");
|
||||
String firma = (String) setParams.get("contact_firma");
|
||||
if (assertNotNull(firma)) {
|
||||
c.setLastName(firma);
|
||||
}
|
||||
String co = setParams.get("contact_co");
|
||||
String co = (String) setParams.get("contact_co");
|
||||
if (assertNotNull(co)) {
|
||||
c.setCo(co);
|
||||
}
|
||||
String street = setParams.get("contact_street");
|
||||
String street = (String) setParams.get("contact_street");
|
||||
if (assertNotNull(street)) {
|
||||
c.setStreet(street);
|
||||
}
|
||||
String zipCode = setParams.get("contact_zipcode");
|
||||
String zipCode = (String) setParams.get("contact_zipcode");
|
||||
if (assertNotNull(zipCode)) {
|
||||
c.setZipCode(zipCode);
|
||||
}
|
||||
String city = setParams.get("contact_city");
|
||||
String city = (String) setParams.get("contact_city");
|
||||
if (assertNotNull(city)) {
|
||||
c.setCity(city);
|
||||
}
|
||||
String country = setParams.get("contact_country");
|
||||
String country = (String) setParams.get("contact_country");
|
||||
if (assertNotNull(country)) {
|
||||
c.setCountry(country);
|
||||
}
|
||||
String phonePrivate = setParams.get("contact_phone_private");
|
||||
String phonePrivate = (String) setParams.get("contact_phone_private");
|
||||
if (assertNotNull(phonePrivate)) {
|
||||
c.setPhonePrivate(phonePrivate);
|
||||
}
|
||||
String phoneOffice = setParams.get("contact_phone_office");
|
||||
String phoneOffice = (String) setParams.get("contact_phone_office");
|
||||
if (assertNotNull(phoneOffice)) {
|
||||
c.setPhoneOffice(phoneOffice);
|
||||
}
|
||||
String phoneMobile = setParams.get("contact_phone_mobile");
|
||||
String phoneMobile = (String) setParams.get("contact_phone_mobile");
|
||||
if (assertNotNull(phoneMobile)) {
|
||||
c.setPhoneMobile(phoneMobile);
|
||||
}
|
||||
String fax = setParams.get("contact_fax");
|
||||
String fax = (String) setParams.get("contact_fax");
|
||||
if (assertNotNull(fax)) {
|
||||
c.setFax(fax);
|
||||
}
|
||||
String eMail = setParams.get("contact_email");
|
||||
String eMail = (String) setParams.get("contact_email");
|
||||
if (assertNotNull(eMail)) {
|
||||
c.setEmail(eMail);
|
||||
}
|
||||
|
@ -19,7 +19,7 @@ public class DomainRemote extends AbstractRemote {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void entity2map(AbstractEntity entity, Map<String, String> resultMap) {
|
||||
protected void entity2map(AbstractEntity entity, Map<String, Object> resultMap) {
|
||||
Domain dom = (Domain) entity;
|
||||
String id = Long.toString(dom.getId());
|
||||
resultMap.put("id", id);
|
||||
@ -39,10 +39,10 @@ public class DomainRemote extends AbstractRemote {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void map2entity(Map<String, String> setParams, AbstractEntity entity) {
|
||||
protected void map2entity(Map<String, Object> setParams, AbstractEntity entity) {
|
||||
Domain dom = (Domain) entity;
|
||||
String name = setParams.get("name");
|
||||
String user = setParams.get("user");
|
||||
String name = (String) setParams.get("name");
|
||||
String user = (String) setParams.get("user");
|
||||
if (assertNotNull(name)) {
|
||||
dom.setName(name);
|
||||
}
|
||||
|
@ -1,5 +1,6 @@
|
||||
package de.hsadmin.remote;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import de.hsadmin.core.model.AbstractEntity;
|
||||
@ -9,7 +10,7 @@ import de.hsadmin.mods.email.EMailAddress;
|
||||
public class EMailAddressRemote extends AbstractRemote {
|
||||
|
||||
@Override
|
||||
protected void entity2map(AbstractEntity entity, Map<String, String> map) {
|
||||
protected void entity2map(AbstractEntity entity, Map<String, Object> map) {
|
||||
EMailAddress adr = (EMailAddress) entity;
|
||||
long id = adr.getId();
|
||||
String domain = adr.getDomain().getName();
|
||||
@ -32,21 +33,36 @@ public class EMailAddressRemote extends AbstractRemote {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void map2entity(Map<String, String> map, AbstractEntity entity) {
|
||||
protected void map2entity(Map<String, Object> map, AbstractEntity entity) {
|
||||
EMailAddress adr = (EMailAddress) entity;
|
||||
String localpart = map.get("localpart");
|
||||
String localpart = (String) map.get("localpart");
|
||||
if (assertNotNull(localpart)) {
|
||||
adr.setLocalpart(localpart);
|
||||
}
|
||||
String subdomain = map.get("subdomain");
|
||||
String subdomain = (String) map.get("subdomain");
|
||||
if (assertNotNull(subdomain)) {
|
||||
adr.setSubdomain(subdomain);
|
||||
}
|
||||
String target = map.get("target");
|
||||
if (assertNotNull(target)) {
|
||||
adr.setTarget(target);
|
||||
Object l = map.get("target");
|
||||
if (l instanceof String) {
|
||||
String target = (String) l;
|
||||
if (assertNotNull(target)) {
|
||||
adr.setTarget(target);
|
||||
}
|
||||
}
|
||||
String domain = map.get("domain");
|
||||
if (l instanceof List<?>) {
|
||||
StringBuffer tBuff = new StringBuffer();
|
||||
for (Object o : (List<?>) l) {
|
||||
if (o instanceof String) {
|
||||
if (tBuff.length() > 0) {
|
||||
tBuff.append(',');
|
||||
}
|
||||
tBuff.append((String) o);
|
||||
}
|
||||
}
|
||||
adr.setTarget(tBuff.toString());
|
||||
}
|
||||
String domain = (String) map.get("domain");
|
||||
if (assertNotNull(domain)) {
|
||||
Domain dom = new Domain();
|
||||
dom.setName(domain);
|
||||
|
@ -1,5 +1,6 @@
|
||||
package de.hsadmin.remote;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import de.hsadmin.core.model.AbstractEntity;
|
||||
@ -8,7 +9,7 @@ import de.hsadmin.mods.email.EMailAlias;
|
||||
public class EMailAliasRemote extends AbstractRemote {
|
||||
|
||||
@Override
|
||||
protected void entity2map(AbstractEntity entity, Map<String, String> map) {
|
||||
protected void entity2map(AbstractEntity entity, Map<String, Object> map) {
|
||||
EMailAlias alias = (EMailAlias) entity;
|
||||
String id = Long.toString(alias.getId());
|
||||
String name = alias.getName();
|
||||
@ -26,15 +27,30 @@ public class EMailAliasRemote extends AbstractRemote {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void map2entity(Map<String, String> map, AbstractEntity entity) {
|
||||
protected void map2entity(Map<String, Object> map, AbstractEntity entity) {
|
||||
EMailAlias alias = (EMailAlias) entity;
|
||||
String name = map.get("name");
|
||||
String target = map.get("target");
|
||||
String name = (String) map.get("name");
|
||||
if (assertNotNull(name)) {
|
||||
alias.setName(name);
|
||||
}
|
||||
if (assertNotNull(target)) {
|
||||
alias.setTarget(target);
|
||||
Object l = map.get("target");
|
||||
if (l instanceof String) {
|
||||
String target = (String) l;
|
||||
if (assertNotNull(target)) {
|
||||
alias.setTarget(target);
|
||||
}
|
||||
}
|
||||
if (l instanceof List<?>) {
|
||||
StringBuffer tBuff = new StringBuffer();
|
||||
for (Object o : (List<?>) l) {
|
||||
if (o instanceof String) {
|
||||
if (tBuff.length() > 0) {
|
||||
tBuff.append(',');
|
||||
}
|
||||
tBuff.append((String) o);
|
||||
}
|
||||
}
|
||||
alias.setTarget(tBuff.toString());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -7,16 +7,16 @@ import de.hsadmin.core.model.HSAdminException;
|
||||
|
||||
public interface IRemote {
|
||||
|
||||
public abstract List<Map<String, String>> search(
|
||||
public abstract List<Map<String, Object>> search(
|
||||
String runAsUser,
|
||||
String ticket,
|
||||
Map<String, String> whereParams
|
||||
) throws HSAdminException;
|
||||
|
||||
public abstract Map<String, String> add(
|
||||
public abstract Map<String, Object> add(
|
||||
String runAsUser,
|
||||
String ticket,
|
||||
Map<String, String> setParams
|
||||
Map<String, Object> setParams
|
||||
) throws HSAdminException;
|
||||
|
||||
public abstract void delete(
|
||||
@ -25,10 +25,10 @@ public interface IRemote {
|
||||
Map<String, String> whereParams
|
||||
) throws HSAdminException;
|
||||
|
||||
public abstract List<Map<String, String>> update(
|
||||
public abstract List<Map<String, Object>> update(
|
||||
String runAsUser,
|
||||
String ticket,
|
||||
Map<String, String> setParams,
|
||||
Map<String, Object> setParams,
|
||||
Map<String, String> whereParams
|
||||
) throws HSAdminException;
|
||||
|
||||
|
@ -8,7 +8,7 @@ import de.hsadmin.mods.db.MySqlDatabase;
|
||||
public class MysqlDbRemote extends AbstractRemote {
|
||||
|
||||
@Override
|
||||
protected void entity2map(AbstractEntity entity, Map<String, String> map) {
|
||||
protected void entity2map(AbstractEntity entity, Map<String, Object> map) {
|
||||
MySqlDatabase db = (MySqlDatabase) entity;
|
||||
String id = Long.toString(db.getId());
|
||||
String name = db.getName();
|
||||
@ -32,12 +32,12 @@ public class MysqlDbRemote extends AbstractRemote {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void map2entity(Map<String, String> map, AbstractEntity entity) {
|
||||
protected void map2entity(Map<String, Object> map, AbstractEntity entity) {
|
||||
MySqlDatabase db = (MySqlDatabase) entity;
|
||||
db.setInstance("mysql");
|
||||
String name = map.get("name");
|
||||
String owner = map.get("owner");
|
||||
String encoding = map.get("encoding");
|
||||
String name = (String) map.get("name");
|
||||
String owner = (String) map.get("owner");
|
||||
String encoding = (String) map.get("encoding");
|
||||
if (assertNotNull(name)) {
|
||||
db.setName(name);
|
||||
}
|
||||
|
@ -8,7 +8,7 @@ import de.hsadmin.mods.db.MySqlUser;
|
||||
public class MysqlUserRemote extends AbstractRemote {
|
||||
|
||||
@Override
|
||||
protected void entity2map(AbstractEntity entity, Map<String, String> map) {
|
||||
protected void entity2map(AbstractEntity entity, Map<String, Object> map) {
|
||||
MySqlUser user = (MySqlUser) entity;
|
||||
String id = Long.toString(user.getId());
|
||||
String name = user.getName();
|
||||
@ -28,11 +28,11 @@ public class MysqlUserRemote extends AbstractRemote {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void map2entity(Map<String, String> map, AbstractEntity entity) {
|
||||
protected void map2entity(Map<String, Object> map, AbstractEntity entity) {
|
||||
MySqlUser user = (MySqlUser) entity;
|
||||
user.setInstance("mysql");
|
||||
String name = map.get("name");
|
||||
String password = map.get("password");
|
||||
String name = (String) map.get("name");
|
||||
String password = (String) map.get("password");
|
||||
if (assertNotNull(name)) {
|
||||
user.setName(name);
|
||||
}
|
||||
|
@ -21,7 +21,7 @@ public class PacRemote extends AbstractRemote {
|
||||
private static final DateFormat df = SimpleDateFormat.getDateInstance(DateFormat.SHORT);
|
||||
|
||||
@Override
|
||||
protected void entity2map(AbstractEntity entity, Map<String, String> resultMap) {
|
||||
protected void entity2map(AbstractEntity entity, Map<String, Object> resultMap) {
|
||||
Pac pac = (Pac) entity;
|
||||
resultMap.put("name", pac.getName());
|
||||
resultMap.put("id", Long.toString(pac.getId()));
|
||||
@ -59,10 +59,10 @@ public class PacRemote extends AbstractRemote {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void map2entity(Map<String, String> setParams, AbstractEntity entity) {
|
||||
protected void map2entity(Map<String, Object> setParams, AbstractEntity entity) {
|
||||
Pac pac = (Pac) entity;
|
||||
BasePac basePac = pac.getBasepac();
|
||||
String basePacName = setParams.get("basepac");
|
||||
String basePacName = (String) setParams.get("basepac");
|
||||
if ((basePac == null || basePac.getName() == null) && assertNotNull(basePacName)) {
|
||||
basePac = new BasePac();
|
||||
basePac.setName(basePacName);
|
||||
@ -70,26 +70,26 @@ public class PacRemote extends AbstractRemote {
|
||||
}
|
||||
pac.setCreated(new Date());
|
||||
INetAddress curINetAddr = pac.getCurINetAddr();
|
||||
String inetAddrString = setParams.get("curinetaddr");
|
||||
String inetAddrString = (String) setParams.get("curinetaddr");
|
||||
if ((curINetAddr == null || curINetAddr.getInetAddr() == null) && assertNotNull(inetAddrString)) {
|
||||
curINetAddr = new INetAddress(inetAddrString);
|
||||
pac.setCurINetAddr(curINetAddr);
|
||||
}
|
||||
Customer customer = pac.getCustomer();
|
||||
String memberCode = setParams.get("customer");
|
||||
String memberCode = (String) setParams.get("customer");
|
||||
if (customer == null && assertNotNull(memberCode)) {
|
||||
customer = new Customer();
|
||||
customer.setName(memberCode);
|
||||
pac.setCustomer(customer);
|
||||
}
|
||||
Hive hive = pac.getHive();
|
||||
String hiveName = setParams.get("hive");
|
||||
String hiveName = (String) setParams.get("hive");
|
||||
if ((hive == null || hive.getName() == null) && assertNotNull(hiveName)) {
|
||||
hive = new Hive();
|
||||
hive.setName(hiveName);
|
||||
pac.setHive(hive);
|
||||
}
|
||||
pac.setName(setParams.get("name"));
|
||||
pac.setName((String) setParams.get("name"));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -8,7 +8,7 @@ import de.hsadmin.mods.db.PgSqlDatabase;
|
||||
public class PgsqlDbRemote extends AbstractRemote {
|
||||
|
||||
@Override
|
||||
protected void entity2map(AbstractEntity entity, Map<String, String> map) {
|
||||
protected void entity2map(AbstractEntity entity, Map<String, Object> map) {
|
||||
PgSqlDatabase db = (PgSqlDatabase) entity;
|
||||
String id = Long.toString(db.getId());
|
||||
String name = db.getName();
|
||||
@ -32,12 +32,12 @@ public class PgsqlDbRemote extends AbstractRemote {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void map2entity(Map<String, String> map, AbstractEntity entity) {
|
||||
protected void map2entity(Map<String, Object> map, AbstractEntity entity) {
|
||||
PgSqlDatabase db = (PgSqlDatabase) entity;
|
||||
db.setInstance("pgsql");
|
||||
String name = map.get("name");
|
||||
String owner = map.get("owner");
|
||||
String encoding = map.get("encoding");
|
||||
String name = (String) map.get("name");
|
||||
String owner = (String) map.get("owner");
|
||||
String encoding = (String) map.get("encoding");
|
||||
if (assertNotNull(name)) {
|
||||
db.setName(name);
|
||||
}
|
||||
|
@ -8,7 +8,7 @@ import de.hsadmin.mods.db.PgSqlUser;
|
||||
public class PgsqlUserRemote extends AbstractRemote {
|
||||
|
||||
@Override
|
||||
protected void entity2map(AbstractEntity entity, Map<String, String> map) {
|
||||
protected void entity2map(AbstractEntity entity, Map<String, Object> map) {
|
||||
PgSqlUser user = (PgSqlUser) entity;
|
||||
String id = Long.toString(user.getId());
|
||||
String name = user.getName();
|
||||
@ -28,11 +28,11 @@ public class PgsqlUserRemote extends AbstractRemote {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void map2entity(Map<String, String> map, AbstractEntity entity) {
|
||||
protected void map2entity(Map<String, Object> map, AbstractEntity entity) {
|
||||
PgSqlUser user = (PgSqlUser) entity;
|
||||
user.setInstance("pgsql");
|
||||
String name = map.get("name");
|
||||
String password = map.get("password");
|
||||
String name = (String) map.get("name");
|
||||
String password = (String) map.get("password");
|
||||
if (assertNotNull(name)) {
|
||||
user.setName(name);
|
||||
}
|
||||
|
@ -20,7 +20,7 @@ public class QueueTaskRemote extends AbstractRemote {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void entity2map(AbstractEntity entity, Map<String, String> resultMap) {
|
||||
protected void entity2map(AbstractEntity entity, Map<String, Object> resultMap) {
|
||||
QueueTask task = (QueueTask) entity;
|
||||
resultMap.put("id", Long.toString(task.getId()));
|
||||
QueueTaskStatus status = task.getStatus();
|
||||
@ -41,7 +41,7 @@ public class QueueTaskRemote extends AbstractRemote {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void map2entity(Map<String, String> setParams, AbstractEntity entity) {
|
||||
protected void map2entity(Map<String, Object> setParams, AbstractEntity entity) {
|
||||
// never used
|
||||
}
|
||||
|
||||
|
@ -24,7 +24,7 @@ public class RoleRemote implements IRemote {
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Map<String, String>> search(String runAsUser, String ticket,
|
||||
public List<Map<String, Object>> search(String runAsUser, String ticket,
|
||||
Map<String, String> whereParams) throws HSAdminException {
|
||||
String user = runAsUser;
|
||||
Transaction transaction = new Transaction(user);
|
||||
@ -54,8 +54,8 @@ public class RoleRemote implements IRemote {
|
||||
role = "DOM_ADMIN";
|
||||
}
|
||||
}
|
||||
List<Map<String, String>> result = new ArrayList<Map<String,String>>();
|
||||
Map<String, String> record = new HashMap<String, String>();
|
||||
List<Map<String, Object>> result = new ArrayList<Map<String,Object>>();
|
||||
Map<String, Object> record = new HashMap<String, Object>();
|
||||
record.put("role", role);
|
||||
result.add(record);
|
||||
transaction.close();
|
||||
@ -67,14 +67,14 @@ public class RoleRemote implements IRemote {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, String> add(String runAsUser, String ticket,
|
||||
Map<String, String> setParams) throws HSAdminException {
|
||||
public Map<String, Object> add(String runAsUser, String ticket,
|
||||
Map<String, Object> setParams) throws HSAdminException {
|
||||
throw new HSAdminException("not implemented");
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Map<String, String>> update(String runAsUser, String ticket,
|
||||
Map<String, String> setParams, Map<String, String> whereParams)
|
||||
public List<Map<String, Object>> update(String runAsUser, String ticket,
|
||||
Map<String, Object> setParams, Map<String, String> whereParams)
|
||||
throws HSAdminException {
|
||||
throw new HSAdminException("not implemented");
|
||||
}
|
||||
|
@ -13,7 +13,7 @@ public class UnixUserRemote extends AbstractRemote {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void entity2map(AbstractEntity entity, Map<String, String> map) {
|
||||
protected void entity2map(AbstractEntity entity, Map<String, Object> map) {
|
||||
UnixUser user = (UnixUser) entity;
|
||||
map.put("id", Long.toString(user.getId()));
|
||||
map.put("name", user.getName());
|
||||
@ -33,41 +33,41 @@ public class UnixUserRemote extends AbstractRemote {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void map2entity(Map<String, String> map, AbstractEntity entity) {
|
||||
protected void map2entity(Map<String, Object> map, AbstractEntity entity) {
|
||||
UnixUser user = (UnixUser) entity;
|
||||
String id = map.get("id");
|
||||
String id = (String) map.get("id");
|
||||
if (assertNotNull(id)) {
|
||||
user.setId(Long.parseLong(id));
|
||||
}
|
||||
String name = map.get("name");
|
||||
String name = (String) map.get("name");
|
||||
if (assertNotNull(name)) {
|
||||
user.setName(name);
|
||||
}
|
||||
String password = map.get("password");
|
||||
String password = (String) map.get("password");
|
||||
if (assertNotNull(password)) {
|
||||
user.setPassword(password);
|
||||
}
|
||||
String comment = map.get("comment");
|
||||
String comment = (String) map.get("comment");
|
||||
if (assertNotNull(comment)) {
|
||||
user.setComment(comment);
|
||||
}
|
||||
String userid = map.get("userid");
|
||||
String userid = (String) map.get("userid");
|
||||
if (assertNotNull(userid)) {
|
||||
user.setUserId(Long.parseLong(userid));
|
||||
}
|
||||
String shell = map.get("shell");
|
||||
String shell = (String) map.get("shell");
|
||||
if (assertNotNull(shell)) {
|
||||
user.setShell(shell);
|
||||
}
|
||||
String homedir = map.get("homedir");
|
||||
String homedir = (String) map.get("homedir");
|
||||
if (assertNotNull(homedir)) {
|
||||
user.setHomedir(homedir);
|
||||
}
|
||||
String quota = map.get("quota_softlimit");
|
||||
String quota = (String) map.get("quota_softlimit");
|
||||
if (assertNotNull(quota)) {
|
||||
user.setQuotaSoftlimit(Integer.parseInt(quota));
|
||||
}
|
||||
String quotaLimit = map.get("quota_hardlimit");
|
||||
String quotaLimit = (String) map.get("quota_hardlimit");
|
||||
if (assertNotNull(quotaLimit)) {
|
||||
user.setQuotaHardlimit(Integer.parseInt(quotaLimit));
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user