| | |
| | | |
| | | 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); |
| | |
| | | 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); |
| | |
| | | } |
| | | } |
| | | |
| | | 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 { |
| | |
| | | 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 { |
| | |
| | | } |
| | | } |
| | | |
| | | 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); |
| | |
| | | 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( |
| | |
| | | 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 { |
| | |
| | | |
| | | @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()); |
| | |
| | | } |
| | | |
| | | @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)); |
| | |
| | | // don't care |
| | | } |
| | | } |
| | | String memberUntil = setParams.get("memberuntil"); |
| | | String memberUntil = (String) setParams.get("memberuntil"); |
| | | if (assertNotNull(memberUntil)) { |
| | | try { |
| | | cust.setMemberUntil(df.parse(memberUntil)); |
| | |
| | | // 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)); |
| | |
| | | // don't care |
| | | } |
| | | } |
| | | String nonDiscContract = setParams.get("nondisccontract"); |
| | | String nonDiscContract = (String) setParams.get("nondisccontract"); |
| | | if (assertNotNull(nonDiscContract)) { |
| | | try { |
| | | cust.setNonDiscContract(df.parse(nonDiscContract)); |
| | |
| | | // don't care |
| | | } |
| | | } |
| | | String sharesUpdated = setParams.get("sharesupdated"); |
| | | String sharesUpdated = (String) setParams.get("sharesupdated"); |
| | | if (assertNotNull(sharesUpdated)) { |
| | | try { |
| | | cust.setSharesUpdated(df.parse(sharesUpdated)); |
| | |
| | | // 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); |
| | | } |
| | |
| | | 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); |
| | | } |
| | |
| | | } 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); |
| | | } |
| | |
| | | } |
| | | |
| | | @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); |
| | |
| | | } |
| | | |
| | | @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); |
| | | } |
| | |
| | | package de.hsadmin.remote; |
| | | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | import de.hsadmin.core.model.AbstractEntity; |
| | |
| | | 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(); |
| | |
| | | } |
| | | |
| | | @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); |
| | |
| | | package de.hsadmin.remote; |
| | | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | import de.hsadmin.core.model.AbstractEntity; |
| | |
| | | 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(); |
| | |
| | | } |
| | | |
| | | @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()); |
| | | } |
| | | } |
| | | |
| | |
| | | |
| | | 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( |
| | |
| | | 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; |
| | | |
| | |
| | | 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(); |
| | |
| | | } |
| | | |
| | | @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); |
| | | } |
| | |
| | | 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(); |
| | |
| | | } |
| | | |
| | | @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); |
| | | } |
| | |
| | | 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())); |
| | |
| | | } |
| | | |
| | | @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); |
| | |
| | | } |
| | | 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 |
| | |
| | | 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(); |
| | |
| | | } |
| | | |
| | | @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); |
| | | } |
| | |
| | | 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(); |
| | |
| | | } |
| | | |
| | | @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); |
| | | } |
| | |
| | | } |
| | | |
| | | @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(); |
| | |
| | | } |
| | | |
| | | @Override |
| | | protected void map2entity(Map<String, String> setParams, AbstractEntity entity) { |
| | | protected void map2entity(Map<String, Object> setParams, AbstractEntity entity) { |
| | | // never used |
| | | } |
| | | |
| | |
| | | } |
| | | |
| | | @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); |
| | |
| | | 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(); |
| | |
| | | } |
| | | |
| | | @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"); |
| | | } |
| | |
| | | } |
| | | |
| | | @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()); |
| | |
| | | } |
| | | |
| | | @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)); |
| | | } |