more xmlrpc datatypes

This commit is contained in:
Peter Hormanns 2011-10-28 14:08:18 +00:00
parent 5c3215619e
commit 03ee391a7f
14 changed files with 148 additions and 116 deletions

View File

@ -28,13 +28,13 @@ public abstract class AbstractRemote implements IRemote {
protected abstract Class<? extends AbstractEntity> getEntityClass(); 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); 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 { Map<String, String> whereParams) throws HSAdminException {
String user = runAsUser; String user = runAsUser;
Transaction transaction = new Transaction(user); Transaction transaction = new Transaction(user);
@ -47,9 +47,9 @@ public abstract class AbstractRemote implements IRemote {
if (list == null) { if (list == null) {
throw new HSAdminException("result list is null, runtime-error?"); 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) { for (AbstractEntity e : list) {
HashMap<String, String> entry = new HashMap<String, String>(); HashMap<String, Object> entry = new HashMap<String, Object>();
entity2map(e, entry); entity2map(e, entry);
if (e.isReadAllowedFor(unixUser)) { if (e.isReadAllowedFor(unixUser)) {
result.add(entry); result.add(entry);
@ -68,8 +68,8 @@ public abstract class AbstractRemote implements IRemote {
} }
} }
public Map<String, String> add(String runAsUser, String ticket, public Map<String, Object> add(String runAsUser, String ticket,
Map<String, String> setParams) throws HSAdminException { Map<String, Object> setParams) throws HSAdminException {
String user = runAsUser; String user = runAsUser;
Transaction transaction = new Transaction(user); Transaction transaction = new Transaction(user);
try { try {
@ -82,7 +82,7 @@ public abstract class AbstractRemote implements IRemote {
transaction.beginTransaction(); transaction.beginTransaction();
AbstractEntity insertedEntity = module.add(entity); AbstractEntity insertedEntity = module.add(entity);
transaction.commitTransaction(); transaction.commitTransaction();
HashMap<String, String> entry = new HashMap<String, String>(); HashMap<String, Object> entry = new HashMap<String, Object>();
entity2map(insertedEntity, entry); entity2map(insertedEntity, entry);
return entry; return entry;
} else { } else {
@ -131,8 +131,8 @@ public abstract class AbstractRemote implements IRemote {
} }
} }
public List<Map<String, String>> update(String runAsUser, String ticket, public List<Map<String, Object>> update(String runAsUser, String ticket,
Map<String, String> setParams, Map<String, String> whereParams) Map<String, Object> setParams, Map<String, String> whereParams)
throws HSAdminException { throws HSAdminException {
String user = runAsUser; String user = runAsUser;
Transaction transaction = new Transaction(user); Transaction transaction = new Transaction(user);
@ -140,7 +140,7 @@ public abstract class AbstractRemote implements IRemote {
if (authentication.login(user, ticket)) { if (authentication.login(user, ticket)) {
ModuleInterface module = new GenericModuleImpl(transaction); ModuleInterface module = new GenericModuleImpl(transaction);
UnixUser unixUser = transaction.getLoginUser(); 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); String queryCondition = buildQueryCondition(whereParams);
if (queryCondition == null || queryCondition.length() == 0) { if (queryCondition == null || queryCondition.length() == 0) {
throw new HSAdminException( throw new HSAdminException(
@ -154,7 +154,7 @@ public abstract class AbstractRemote implements IRemote {
transaction.detach(update); transaction.detach(update);
map2entity(setParams, update); map2entity(setParams, update);
update = module.update(update); update = module.update(update);
HashMap<String, String> entry = new HashMap<String, String>(); HashMap<String, Object> entry = new HashMap<String, Object>();
entity2map(update, entry); entity2map(update, entry);
result.add(entry); result.add(entry);
} else { } else {

View File

@ -23,7 +23,7 @@ public class CustomerRemote extends AbstractRemote {
@Override @Override
protected void entity2map(AbstractEntity entity, protected void entity2map(AbstractEntity entity,
Map<String, String> resultMap) { Map<String, Object> resultMap) {
Customer cust = (Customer) entity; Customer cust = (Customer) entity;
resultMap.put("id", Long.toString(cust.getId())); resultMap.put("id", Long.toString(cust.getId()));
resultMap.put("membercode", cust.getName()); resultMap.put("membercode", cust.getName());
@ -83,26 +83,26 @@ public class CustomerRemote extends AbstractRemote {
} }
@Override @Override
protected void map2entity(Map<String, String> setParams, protected void map2entity(Map<String, Object> setParams,
AbstractEntity entity) { AbstractEntity entity) {
Customer cust = (Customer) entity; Customer cust = (Customer) entity;
String idStr = setParams.get("id"); String idStr = (String) setParams.get("id");
if (assertNotNull(idStr)) { if (assertNotNull(idStr)) {
cust.setId(Long.parseLong(idStr)); cust.setId(Long.parseLong(idStr));
} }
String memberCode = setParams.get("membercode"); String memberCode = (String) setParams.get("membercode");
if (assertNotNull(memberCode)) { if (assertNotNull(memberCode)) {
cust.setName(memberCode); cust.setName(memberCode);
} }
String password = setParams.get("password"); String password = (String) setParams.get("password");
if (assertNotNull(password)) { if (assertNotNull(password)) {
cust.setPassword(password); cust.setPassword(password);
} }
String memberNo = setParams.get("memberno"); String memberNo = (String) setParams.get("memberno");
if (assertNotNull(memberNo)) { if (assertNotNull(memberNo)) {
cust.setMemberNo(Integer.parseInt(memberNo)); cust.setMemberNo(Integer.parseInt(memberNo));
} }
String memberSince = setParams.get("membersince"); String memberSince = (String) setParams.get("membersince");
if (assertNotNull(memberSince)) { if (assertNotNull(memberSince)) {
try { try {
cust.setMemberSince(df.parse(memberSince)); cust.setMemberSince(df.parse(memberSince));
@ -110,7 +110,7 @@ public class CustomerRemote extends AbstractRemote {
// don't care // don't care
} }
} }
String memberUntil = setParams.get("memberuntil"); String memberUntil = (String) setParams.get("memberuntil");
if (assertNotNull(memberUntil)) { if (assertNotNull(memberUntil)) {
try { try {
cust.setMemberUntil(df.parse(memberUntil)); cust.setMemberUntil(df.parse(memberUntil));
@ -118,11 +118,11 @@ public class CustomerRemote extends AbstractRemote {
// don't care // don't care
} }
} }
String memberRole = setParams.get("memberrole"); String memberRole = (String) setParams.get("memberrole");
if (assertNotNull(memberRole)) { if (assertNotNull(memberRole)) {
cust.setMemberRole(memberRole); cust.setMemberRole(memberRole);
} }
String authorContract = setParams.get("authorcontract"); String authorContract = (String) setParams.get("authorcontract");
if (assertNotNull(authorContract)) { if (assertNotNull(authorContract)) {
try { try {
cust.setAuthorContract(df.parse(authorContract)); cust.setAuthorContract(df.parse(authorContract));
@ -130,7 +130,7 @@ public class CustomerRemote extends AbstractRemote {
// don't care // don't care
} }
} }
String nonDiscContract = setParams.get("nondisccontract"); String nonDiscContract = (String) setParams.get("nondisccontract");
if (assertNotNull(nonDiscContract)) { if (assertNotNull(nonDiscContract)) {
try { try {
cust.setNonDiscContract(df.parse(nonDiscContract)); cust.setNonDiscContract(df.parse(nonDiscContract));
@ -138,7 +138,7 @@ public class CustomerRemote extends AbstractRemote {
// don't care // don't care
} }
} }
String sharesUpdated = setParams.get("sharesupdated"); String sharesUpdated = (String) setParams.get("sharesupdated");
if (assertNotNull(sharesUpdated)) { if (assertNotNull(sharesUpdated)) {
try { try {
cust.setSharesUpdated(df.parse(sharesUpdated)); cust.setSharesUpdated(df.parse(sharesUpdated));
@ -146,11 +146,11 @@ public class CustomerRemote extends AbstractRemote {
// don't care // don't care
} }
} }
String sharesSigned = setParams.get("sharessigned"); String sharesSigned = (String) setParams.get("sharessigned");
if (assertNotNull(sharesSigned)) { if (assertNotNull(sharesSigned)) {
cust.setId(Integer.parseInt(sharesSigned)); cust.setId(Integer.parseInt(sharesSigned));
} }
String uidVat = setParams.get("uidvat"); String uidVat = (String) setParams.get("uidvat");
if (assertNotNull(uidVat)) { if (assertNotNull(uidVat)) {
cust.setUidVAT(uidVat); cust.setUidVAT(uidVat);
} }
@ -160,34 +160,34 @@ public class CustomerRemote extends AbstractRemote {
bank.setCustomer(cust); bank.setCustomer(cust);
cust.setBankAccount(bank); cust.setBankAccount(bank);
} }
String autoDebitGA = setParams.get("autodebit_ga"); String autoDebitGA = (String) setParams.get("autodebit_ga");
if (assertNotNull(autoDebitGA)) { if (assertNotNull(autoDebitGA)) {
autoDebitGA = autoDebitGA.toUpperCase(); autoDebitGA = autoDebitGA.toUpperCase();
bank.setAutoDebitGA(new Boolean(autoDebitGA.startsWith("T") || autoDebitGA.startsWith("Y"))); 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)) { if (assertNotNull(autoDebitAR)) {
autoDebitAR = autoDebitAR.toUpperCase(); autoDebitAR = autoDebitAR.toUpperCase();
bank.setAutoDebitAR(new Boolean(autoDebitAR.startsWith("T") || autoDebitAR.startsWith("Y"))); 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)) { if (assertNotNull(autoDebitOP)) {
autoDebitOP = autoDebitOP.toUpperCase(); autoDebitOP = autoDebitOP.toUpperCase();
bank.setAutoDebitOP(new Boolean(autoDebitOP.startsWith("T") || autoDebitOP.startsWith("Y"))); 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)) { if (assertNotNull(bankCustomer)) {
bank.setBankCustomer(bankCustomer); bank.setBankCustomer(bankCustomer);
} }
String bankAccount = setParams.get("bank_account"); String bankAccount = (String) setParams.get("bank_account");
if (assertNotNull(bankAccount)) { if (assertNotNull(bankAccount)) {
bank.setBankAccount(bankAccount); bank.setBankAccount(bankAccount);
} }
String bankCode = setParams.get("bank_code"); String bankCode = (String) setParams.get("bank_code");
if (assertNotNull(bankCode)) { if (assertNotNull(bankCode)) {
bank.setBankCode(bankCode); bank.setBankCode(bankCode);
} }
String bankName = setParams.get("bank_name"); String bankName = (String) setParams.get("bank_name");
if (assertNotNull(bankName)) { if (assertNotNull(bankName)) {
bank.setBankName(bankName); bank.setBankName(bankName);
} }
@ -199,63 +199,63 @@ public class CustomerRemote extends AbstractRemote {
} else { } else {
c = contacts.iterator().next(); c = contacts.iterator().next();
} }
String salut = setParams.get("contact_salut"); String salut = (String) setParams.get("contact_salut");
if (assertNotNull(salut)) { if (assertNotNull(salut)) {
c.setSalut(salut); c.setSalut(salut);
} }
String title = setParams.get("contact_title"); String title = (String) setParams.get("contact_title");
if (assertNotNull(title)) { if (assertNotNull(title)) {
c.setTitle(title); c.setTitle(title);
} }
String firstName = setParams.get("contact_firstname"); String firstName = (String) setParams.get("contact_firstname");
if (assertNotNull(firstName)) { if (assertNotNull(firstName)) {
c.setFirstName(firstName); c.setFirstName(firstName);
} }
String lastName = setParams.get("contact_lastname"); String lastName = (String) setParams.get("contact_lastname");
if (assertNotNull(lastName)) { if (assertNotNull(lastName)) {
c.setLastName(lastName); c.setLastName(lastName);
} }
String firma = setParams.get("contact_firma"); String firma = (String) setParams.get("contact_firma");
if (assertNotNull(firma)) { if (assertNotNull(firma)) {
c.setLastName(firma); c.setLastName(firma);
} }
String co = setParams.get("contact_co"); String co = (String) setParams.get("contact_co");
if (assertNotNull(co)) { if (assertNotNull(co)) {
c.setCo(co); c.setCo(co);
} }
String street = setParams.get("contact_street"); String street = (String) setParams.get("contact_street");
if (assertNotNull(street)) { if (assertNotNull(street)) {
c.setStreet(street); c.setStreet(street);
} }
String zipCode = setParams.get("contact_zipcode"); String zipCode = (String) setParams.get("contact_zipcode");
if (assertNotNull(zipCode)) { if (assertNotNull(zipCode)) {
c.setZipCode(zipCode); c.setZipCode(zipCode);
} }
String city = setParams.get("contact_city"); String city = (String) setParams.get("contact_city");
if (assertNotNull(city)) { if (assertNotNull(city)) {
c.setCity(city); c.setCity(city);
} }
String country = setParams.get("contact_country"); String country = (String) setParams.get("contact_country");
if (assertNotNull(country)) { if (assertNotNull(country)) {
c.setCountry(country); c.setCountry(country);
} }
String phonePrivate = setParams.get("contact_phone_private"); String phonePrivate = (String) setParams.get("contact_phone_private");
if (assertNotNull(phonePrivate)) { if (assertNotNull(phonePrivate)) {
c.setPhonePrivate(phonePrivate); c.setPhonePrivate(phonePrivate);
} }
String phoneOffice = setParams.get("contact_phone_office"); String phoneOffice = (String) setParams.get("contact_phone_office");
if (assertNotNull(phoneOffice)) { if (assertNotNull(phoneOffice)) {
c.setPhoneOffice(phoneOffice); c.setPhoneOffice(phoneOffice);
} }
String phoneMobile = setParams.get("contact_phone_mobile"); String phoneMobile = (String) setParams.get("contact_phone_mobile");
if (assertNotNull(phoneMobile)) { if (assertNotNull(phoneMobile)) {
c.setPhoneMobile(phoneMobile); c.setPhoneMobile(phoneMobile);
} }
String fax = setParams.get("contact_fax"); String fax = (String) setParams.get("contact_fax");
if (assertNotNull(fax)) { if (assertNotNull(fax)) {
c.setFax(fax); c.setFax(fax);
} }
String eMail = setParams.get("contact_email"); String eMail = (String) setParams.get("contact_email");
if (assertNotNull(eMail)) { if (assertNotNull(eMail)) {
c.setEmail(eMail); c.setEmail(eMail);
} }

View File

@ -19,7 +19,7 @@ public class DomainRemote extends AbstractRemote {
} }
@Override @Override
protected void entity2map(AbstractEntity entity, Map<String, String> resultMap) { protected void entity2map(AbstractEntity entity, Map<String, Object> resultMap) {
Domain dom = (Domain) entity; Domain dom = (Domain) entity;
String id = Long.toString(dom.getId()); String id = Long.toString(dom.getId());
resultMap.put("id", id); resultMap.put("id", id);
@ -39,10 +39,10 @@ public class DomainRemote extends AbstractRemote {
} }
@Override @Override
protected void map2entity(Map<String, String> setParams, AbstractEntity entity) { protected void map2entity(Map<String, Object> setParams, AbstractEntity entity) {
Domain dom = (Domain) entity; Domain dom = (Domain) entity;
String name = setParams.get("name"); String name = (String) setParams.get("name");
String user = setParams.get("user"); String user = (String) setParams.get("user");
if (assertNotNull(name)) { if (assertNotNull(name)) {
dom.setName(name); dom.setName(name);
} }

View File

@ -1,5 +1,6 @@
package de.hsadmin.remote; package de.hsadmin.remote;
import java.util.List;
import java.util.Map; import java.util.Map;
import de.hsadmin.core.model.AbstractEntity; import de.hsadmin.core.model.AbstractEntity;
@ -9,7 +10,7 @@ import de.hsadmin.mods.email.EMailAddress;
public class EMailAddressRemote extends AbstractRemote { public class EMailAddressRemote extends AbstractRemote {
@Override @Override
protected void entity2map(AbstractEntity entity, Map<String, String> map) { protected void entity2map(AbstractEntity entity, Map<String, Object> map) {
EMailAddress adr = (EMailAddress) entity; EMailAddress adr = (EMailAddress) entity;
long id = adr.getId(); long id = adr.getId();
String domain = adr.getDomain().getName(); String domain = adr.getDomain().getName();
@ -32,21 +33,36 @@ public class EMailAddressRemote extends AbstractRemote {
} }
@Override @Override
protected void map2entity(Map<String, String> map, AbstractEntity entity) { protected void map2entity(Map<String, Object> map, AbstractEntity entity) {
EMailAddress adr = (EMailAddress) entity; EMailAddress adr = (EMailAddress) entity;
String localpart = map.get("localpart"); String localpart = (String) map.get("localpart");
if (assertNotNull(localpart)) { if (assertNotNull(localpart)) {
adr.setLocalpart(localpart); adr.setLocalpart(localpart);
} }
String subdomain = map.get("subdomain"); String subdomain = (String) map.get("subdomain");
if (assertNotNull(subdomain)) { if (assertNotNull(subdomain)) {
adr.setSubdomain(subdomain); adr.setSubdomain(subdomain);
} }
String target = map.get("target"); Object l = map.get("target");
if (assertNotNull(target)) { if (l instanceof String) {
adr.setTarget(target); 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)) { if (assertNotNull(domain)) {
Domain dom = new Domain(); Domain dom = new Domain();
dom.setName(domain); dom.setName(domain);

View File

@ -1,5 +1,6 @@
package de.hsadmin.remote; package de.hsadmin.remote;
import java.util.List;
import java.util.Map; import java.util.Map;
import de.hsadmin.core.model.AbstractEntity; import de.hsadmin.core.model.AbstractEntity;
@ -8,7 +9,7 @@ import de.hsadmin.mods.email.EMailAlias;
public class EMailAliasRemote extends AbstractRemote { public class EMailAliasRemote extends AbstractRemote {
@Override @Override
protected void entity2map(AbstractEntity entity, Map<String, String> map) { protected void entity2map(AbstractEntity entity, Map<String, Object> map) {
EMailAlias alias = (EMailAlias) entity; EMailAlias alias = (EMailAlias) entity;
String id = Long.toString(alias.getId()); String id = Long.toString(alias.getId());
String name = alias.getName(); String name = alias.getName();
@ -26,15 +27,30 @@ public class EMailAliasRemote extends AbstractRemote {
} }
@Override @Override
protected void map2entity(Map<String, String> map, AbstractEntity entity) { protected void map2entity(Map<String, Object> map, AbstractEntity entity) {
EMailAlias alias = (EMailAlias) entity; EMailAlias alias = (EMailAlias) entity;
String name = map.get("name"); String name = (String) map.get("name");
String target = map.get("target");
if (assertNotNull(name)) { if (assertNotNull(name)) {
alias.setName(name); alias.setName(name);
} }
if (assertNotNull(target)) { Object l = map.get("target");
alias.setTarget(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());
} }
} }

View File

@ -7,16 +7,16 @@ import de.hsadmin.core.model.HSAdminException;
public interface IRemote { public interface IRemote {
public abstract List<Map<String, String>> search( public abstract List<Map<String, Object>> search(
String runAsUser, String runAsUser,
String ticket, String ticket,
Map<String, String> whereParams Map<String, String> whereParams
) throws HSAdminException; ) throws HSAdminException;
public abstract Map<String, String> add( public abstract Map<String, Object> add(
String runAsUser, String runAsUser,
String ticket, String ticket,
Map<String, String> setParams Map<String, Object> setParams
) throws HSAdminException; ) throws HSAdminException;
public abstract void delete( public abstract void delete(
@ -25,10 +25,10 @@ public interface IRemote {
Map<String, String> whereParams Map<String, String> whereParams
) throws HSAdminException; ) throws HSAdminException;
public abstract List<Map<String, String>> update( public abstract List<Map<String, Object>> update(
String runAsUser, String runAsUser,
String ticket, String ticket,
Map<String, String> setParams, Map<String, Object> setParams,
Map<String, String> whereParams Map<String, String> whereParams
) throws HSAdminException; ) throws HSAdminException;

View File

@ -8,7 +8,7 @@ import de.hsadmin.mods.db.MySqlDatabase;
public class MysqlDbRemote extends AbstractRemote { public class MysqlDbRemote extends AbstractRemote {
@Override @Override
protected void entity2map(AbstractEntity entity, Map<String, String> map) { protected void entity2map(AbstractEntity entity, Map<String, Object> map) {
MySqlDatabase db = (MySqlDatabase) entity; MySqlDatabase db = (MySqlDatabase) entity;
String id = Long.toString(db.getId()); String id = Long.toString(db.getId());
String name = db.getName(); String name = db.getName();
@ -32,12 +32,12 @@ public class MysqlDbRemote extends AbstractRemote {
} }
@Override @Override
protected void map2entity(Map<String, String> map, AbstractEntity entity) { protected void map2entity(Map<String, Object> map, AbstractEntity entity) {
MySqlDatabase db = (MySqlDatabase) entity; MySqlDatabase db = (MySqlDatabase) entity;
db.setInstance("mysql"); db.setInstance("mysql");
String name = map.get("name"); String name = (String) map.get("name");
String owner = map.get("owner"); String owner = (String) map.get("owner");
String encoding = map.get("encoding"); String encoding = (String) map.get("encoding");
if (assertNotNull(name)) { if (assertNotNull(name)) {
db.setName(name); db.setName(name);
} }

View File

@ -8,7 +8,7 @@ import de.hsadmin.mods.db.MySqlUser;
public class MysqlUserRemote extends AbstractRemote { public class MysqlUserRemote extends AbstractRemote {
@Override @Override
protected void entity2map(AbstractEntity entity, Map<String, String> map) { protected void entity2map(AbstractEntity entity, Map<String, Object> map) {
MySqlUser user = (MySqlUser) entity; MySqlUser user = (MySqlUser) entity;
String id = Long.toString(user.getId()); String id = Long.toString(user.getId());
String name = user.getName(); String name = user.getName();
@ -28,11 +28,11 @@ public class MysqlUserRemote extends AbstractRemote {
} }
@Override @Override
protected void map2entity(Map<String, String> map, AbstractEntity entity) { protected void map2entity(Map<String, Object> map, AbstractEntity entity) {
MySqlUser user = (MySqlUser) entity; MySqlUser user = (MySqlUser) entity;
user.setInstance("mysql"); user.setInstance("mysql");
String name = map.get("name"); String name = (String) map.get("name");
String password = map.get("password"); String password = (String) map.get("password");
if (assertNotNull(name)) { if (assertNotNull(name)) {
user.setName(name); user.setName(name);
} }

View File

@ -21,7 +21,7 @@ public class PacRemote extends AbstractRemote {
private static final DateFormat df = SimpleDateFormat.getDateInstance(DateFormat.SHORT); private static final DateFormat df = SimpleDateFormat.getDateInstance(DateFormat.SHORT);
@Override @Override
protected void entity2map(AbstractEntity entity, Map<String, String> resultMap) { protected void entity2map(AbstractEntity entity, Map<String, Object> resultMap) {
Pac pac = (Pac) entity; Pac pac = (Pac) entity;
resultMap.put("name", pac.getName()); resultMap.put("name", pac.getName());
resultMap.put("id", Long.toString(pac.getId())); resultMap.put("id", Long.toString(pac.getId()));
@ -59,10 +59,10 @@ public class PacRemote extends AbstractRemote {
} }
@Override @Override
protected void map2entity(Map<String, String> setParams, AbstractEntity entity) { protected void map2entity(Map<String, Object> setParams, AbstractEntity entity) {
Pac pac = (Pac) entity; Pac pac = (Pac) entity;
BasePac basePac = pac.getBasepac(); BasePac basePac = pac.getBasepac();
String basePacName = setParams.get("basepac"); String basePacName = (String) setParams.get("basepac");
if ((basePac == null || basePac.getName() == null) && assertNotNull(basePacName)) { if ((basePac == null || basePac.getName() == null) && assertNotNull(basePacName)) {
basePac = new BasePac(); basePac = new BasePac();
basePac.setName(basePacName); basePac.setName(basePacName);
@ -70,26 +70,26 @@ public class PacRemote extends AbstractRemote {
} }
pac.setCreated(new Date()); pac.setCreated(new Date());
INetAddress curINetAddr = pac.getCurINetAddr(); INetAddress curINetAddr = pac.getCurINetAddr();
String inetAddrString = setParams.get("curinetaddr"); String inetAddrString = (String) setParams.get("curinetaddr");
if ((curINetAddr == null || curINetAddr.getInetAddr() == null) && assertNotNull(inetAddrString)) { if ((curINetAddr == null || curINetAddr.getInetAddr() == null) && assertNotNull(inetAddrString)) {
curINetAddr = new INetAddress(inetAddrString); curINetAddr = new INetAddress(inetAddrString);
pac.setCurINetAddr(curINetAddr); pac.setCurINetAddr(curINetAddr);
} }
Customer customer = pac.getCustomer(); Customer customer = pac.getCustomer();
String memberCode = setParams.get("customer"); String memberCode = (String) setParams.get("customer");
if (customer == null && assertNotNull(memberCode)) { if (customer == null && assertNotNull(memberCode)) {
customer = new Customer(); customer = new Customer();
customer.setName(memberCode); customer.setName(memberCode);
pac.setCustomer(customer); pac.setCustomer(customer);
} }
Hive hive = pac.getHive(); Hive hive = pac.getHive();
String hiveName = setParams.get("hive"); String hiveName = (String) setParams.get("hive");
if ((hive == null || hive.getName() == null) && assertNotNull(hiveName)) { if ((hive == null || hive.getName() == null) && assertNotNull(hiveName)) {
hive = new Hive(); hive = new Hive();
hive.setName(hiveName); hive.setName(hiveName);
pac.setHive(hive); pac.setHive(hive);
} }
pac.setName(setParams.get("name")); pac.setName((String) setParams.get("name"));
} }
@Override @Override

View File

@ -8,7 +8,7 @@ import de.hsadmin.mods.db.PgSqlDatabase;
public class PgsqlDbRemote extends AbstractRemote { public class PgsqlDbRemote extends AbstractRemote {
@Override @Override
protected void entity2map(AbstractEntity entity, Map<String, String> map) { protected void entity2map(AbstractEntity entity, Map<String, Object> map) {
PgSqlDatabase db = (PgSqlDatabase) entity; PgSqlDatabase db = (PgSqlDatabase) entity;
String id = Long.toString(db.getId()); String id = Long.toString(db.getId());
String name = db.getName(); String name = db.getName();
@ -32,12 +32,12 @@ public class PgsqlDbRemote extends AbstractRemote {
} }
@Override @Override
protected void map2entity(Map<String, String> map, AbstractEntity entity) { protected void map2entity(Map<String, Object> map, AbstractEntity entity) {
PgSqlDatabase db = (PgSqlDatabase) entity; PgSqlDatabase db = (PgSqlDatabase) entity;
db.setInstance("pgsql"); db.setInstance("pgsql");
String name = map.get("name"); String name = (String) map.get("name");
String owner = map.get("owner"); String owner = (String) map.get("owner");
String encoding = map.get("encoding"); String encoding = (String) map.get("encoding");
if (assertNotNull(name)) { if (assertNotNull(name)) {
db.setName(name); db.setName(name);
} }

View File

@ -8,7 +8,7 @@ import de.hsadmin.mods.db.PgSqlUser;
public class PgsqlUserRemote extends AbstractRemote { public class PgsqlUserRemote extends AbstractRemote {
@Override @Override
protected void entity2map(AbstractEntity entity, Map<String, String> map) { protected void entity2map(AbstractEntity entity, Map<String, Object> map) {
PgSqlUser user = (PgSqlUser) entity; PgSqlUser user = (PgSqlUser) entity;
String id = Long.toString(user.getId()); String id = Long.toString(user.getId());
String name = user.getName(); String name = user.getName();
@ -28,11 +28,11 @@ public class PgsqlUserRemote extends AbstractRemote {
} }
@Override @Override
protected void map2entity(Map<String, String> map, AbstractEntity entity) { protected void map2entity(Map<String, Object> map, AbstractEntity entity) {
PgSqlUser user = (PgSqlUser) entity; PgSqlUser user = (PgSqlUser) entity;
user.setInstance("pgsql"); user.setInstance("pgsql");
String name = map.get("name"); String name = (String) map.get("name");
String password = map.get("password"); String password = (String) map.get("password");
if (assertNotNull(name)) { if (assertNotNull(name)) {
user.setName(name); user.setName(name);
} }

View File

@ -20,7 +20,7 @@ public class QueueTaskRemote extends AbstractRemote {
} }
@Override @Override
protected void entity2map(AbstractEntity entity, Map<String, String> resultMap) { protected void entity2map(AbstractEntity entity, Map<String, Object> resultMap) {
QueueTask task = (QueueTask) entity; QueueTask task = (QueueTask) entity;
resultMap.put("id", Long.toString(task.getId())); resultMap.put("id", Long.toString(task.getId()));
QueueTaskStatus status = task.getStatus(); QueueTaskStatus status = task.getStatus();
@ -41,7 +41,7 @@ public class QueueTaskRemote extends AbstractRemote {
} }
@Override @Override
protected void map2entity(Map<String, String> setParams, AbstractEntity entity) { protected void map2entity(Map<String, Object> setParams, AbstractEntity entity) {
// never used // never used
} }

View File

@ -24,7 +24,7 @@ public class RoleRemote implements IRemote {
} }
@Override @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 { Map<String, String> whereParams) throws HSAdminException {
String user = runAsUser; String user = runAsUser;
Transaction transaction = new Transaction(user); Transaction transaction = new Transaction(user);
@ -54,8 +54,8 @@ public class RoleRemote implements IRemote {
role = "DOM_ADMIN"; role = "DOM_ADMIN";
} }
} }
List<Map<String, String>> result = new ArrayList<Map<String,String>>(); List<Map<String, Object>> result = new ArrayList<Map<String,Object>>();
Map<String, String> record = new HashMap<String, String>(); Map<String, Object> record = new HashMap<String, Object>();
record.put("role", role); record.put("role", role);
result.add(record); result.add(record);
transaction.close(); transaction.close();
@ -67,14 +67,14 @@ public class RoleRemote implements IRemote {
} }
@Override @Override
public Map<String, String> add(String runAsUser, String ticket, public Map<String, Object> add(String runAsUser, String ticket,
Map<String, String> setParams) throws HSAdminException { Map<String, Object> setParams) throws HSAdminException {
throw new HSAdminException("not implemented"); throw new HSAdminException("not implemented");
} }
@Override @Override
public List<Map<String, String>> update(String runAsUser, String ticket, public List<Map<String, Object>> update(String runAsUser, String ticket,
Map<String, String> setParams, Map<String, String> whereParams) Map<String, Object> setParams, Map<String, String> whereParams)
throws HSAdminException { throws HSAdminException {
throw new HSAdminException("not implemented"); throw new HSAdminException("not implemented");
} }

View File

@ -13,7 +13,7 @@ public class UnixUserRemote extends AbstractRemote {
} }
@Override @Override
protected void entity2map(AbstractEntity entity, Map<String, String> map) { protected void entity2map(AbstractEntity entity, Map<String, Object> map) {
UnixUser user = (UnixUser) entity; UnixUser user = (UnixUser) entity;
map.put("id", Long.toString(user.getId())); map.put("id", Long.toString(user.getId()));
map.put("name", user.getName()); map.put("name", user.getName());
@ -33,41 +33,41 @@ public class UnixUserRemote extends AbstractRemote {
} }
@Override @Override
protected void map2entity(Map<String, String> map, AbstractEntity entity) { protected void map2entity(Map<String, Object> map, AbstractEntity entity) {
UnixUser user = (UnixUser) entity; UnixUser user = (UnixUser) entity;
String id = map.get("id"); String id = (String) map.get("id");
if (assertNotNull(id)) { if (assertNotNull(id)) {
user.setId(Long.parseLong(id)); user.setId(Long.parseLong(id));
} }
String name = map.get("name"); String name = (String) map.get("name");
if (assertNotNull(name)) { if (assertNotNull(name)) {
user.setName(name); user.setName(name);
} }
String password = map.get("password"); String password = (String) map.get("password");
if (assertNotNull(password)) { if (assertNotNull(password)) {
user.setPassword(password); user.setPassword(password);
} }
String comment = map.get("comment"); String comment = (String) map.get("comment");
if (assertNotNull(comment)) { if (assertNotNull(comment)) {
user.setComment(comment); user.setComment(comment);
} }
String userid = map.get("userid"); String userid = (String) map.get("userid");
if (assertNotNull(userid)) { if (assertNotNull(userid)) {
user.setUserId(Long.parseLong(userid)); user.setUserId(Long.parseLong(userid));
} }
String shell = map.get("shell"); String shell = (String) map.get("shell");
if (assertNotNull(shell)) { if (assertNotNull(shell)) {
user.setShell(shell); user.setShell(shell);
} }
String homedir = map.get("homedir"); String homedir = (String) map.get("homedir");
if (assertNotNull(homedir)) { if (assertNotNull(homedir)) {
user.setHomedir(homedir); user.setHomedir(homedir);
} }
String quota = map.get("quota_softlimit"); String quota = (String) map.get("quota_softlimit");
if (assertNotNull(quota)) { if (assertNotNull(quota)) {
user.setQuotaSoftlimit(Integer.parseInt(quota)); user.setQuotaSoftlimit(Integer.parseInt(quota));
} }
String quotaLimit = map.get("quota_hardlimit"); String quotaLimit = (String) map.get("quota_hardlimit");
if (assertNotNull(quotaLimit)) { if (assertNotNull(quotaLimit)) {
user.setQuotaHardlimit(Integer.parseInt(quotaLimit)); user.setQuotaHardlimit(Integer.parseInt(quotaLimit));
} }