HSAdmin Backend Domains, E-Mail, Datenbanken
Peter Hormanns
2014-12-08 1efa34bd6269c5bd9399dc2ad871f6a284d06358
remove deprecated cli client connector from source tree
1 files added
6 files modified
8 files deleted
1317 ■■■■■ changed files
hsarback/src/de/hsadmin/cliClientConnector/ArgumentParser.java 357 ●●●●● patch | view | raw | blame | history
hsarback/src/de/hsadmin/cliClientConnector/BusinessException.java 15 ●●●●● patch | view | raw | blame | history
hsarback/src/de/hsadmin/cliClientConnector/CLIClientConnectorServlet.java 497 ●●●●● patch | view | raw | blame | history
hsarback/src/de/hsadmin/cliClientConnector/ModuleModel.java 19 ●●●●● patch | view | raw | blame | history
hsarback/src/de/hsadmin/cliClientConnector/OidsNotFoundException.java 25 ●●●●● patch | view | raw | blame | history
hsarback/src/de/hsadmin/cliClientConnector/TechnicalException.java 59 ●●●●● patch | view | raw | blame | history
hsarback/src/de/hsadmin/cliClientConnector/VersionModel.java 14 ●●●●● patch | view | raw | blame | history
hsarback/src/de/hsadmin/core/model/TechnicalException.java 20 ●●●●● patch | view | raw | blame | history
hsarback/src/de/hsadmin/core/model/Transaction.java 1 ●●●● patch | view | raw | blame | history
hsarback/src/de/hsadmin/core/qserv/QueueStatusReceiverServlet.java 2 ●●● patch | view | raw | blame | history
hsarback/src/de/hsadmin/core/util/ReflectionUtil.java 2 ●●● patch | view | raw | blame | history
hsarback/src/de/hsadmin/remote/AbstractRemote.java 68 ●●●● patch | view | raw | blame | history
hsarback/src/de/hsadmin/remote/CustomerRemote.java 200 ●●●●● patch | view | raw | blame | history
hsarback/src/de/hsadmin/remote/DomainRemote.java 36 ●●●● patch | view | raw | blame | history
hsarback/src/de/hsadmin/remote/GenericAbstractRemote.java 2 ●●● patch | view | raw | blame | history
hsarback/src/de/hsadmin/cliClientConnector/ArgumentParser.java
File was deleted
hsarback/src/de/hsadmin/cliClientConnector/BusinessException.java
File was deleted
hsarback/src/de/hsadmin/cliClientConnector/CLIClientConnectorServlet.java
File was deleted
hsarback/src/de/hsadmin/cliClientConnector/ModuleModel.java
File was deleted
hsarback/src/de/hsadmin/cliClientConnector/OidsNotFoundException.java
File was deleted
hsarback/src/de/hsadmin/cliClientConnector/TechnicalException.java
File was deleted
hsarback/src/de/hsadmin/cliClientConnector/VersionModel.java
File was deleted
hsarback/src/de/hsadmin/core/model/TechnicalException.java
New file
@@ -0,0 +1,20 @@
package de.hsadmin.core.model;
public class TechnicalException extends RuntimeException {
    private static final long serialVersionUID = 1L;
    public TechnicalException(String message, Throwable e) {
        super(message, e);
    }
    public TechnicalException(String message) {
        super(message);
    }
    public TechnicalException(Throwable e) {
        super(e);
    }
}
hsarback/src/de/hsadmin/core/model/Transaction.java
@@ -17,7 +17,6 @@
import org.apache.openjpa.persistence.OpenJPAEntityManager;
import de.hsadmin.cliClientConnector.TechnicalException;
import de.hsadmin.core.qserv.QueueClient;
import de.hsadmin.core.qserv.QueueTask;
import de.hsadmin.core.util.Config;
hsarback/src/de/hsadmin/core/qserv/QueueStatusReceiverServlet.java
@@ -23,7 +23,7 @@
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import de.hsadmin.cliClientConnector.TechnicalException;
import de.hsadmin.core.model.TechnicalException;
import de.hsadmin.core.model.Transaction;
import de.hsadmin.core.util.Config;
hsarback/src/de/hsadmin/core/util/ReflectionUtil.java
@@ -8,9 +8,9 @@
import java.util.Set;
import java.util.TreeSet;
import de.hsadmin.cliClientConnector.TechnicalException;
import de.hsadmin.core.model.AbstractEntity;
import de.hsadmin.core.model.AnnFieldIO;
import de.hsadmin.core.model.TechnicalException;
public class ReflectionUtil {
hsarback/src/de/hsadmin/remote/AbstractRemote.java
@@ -34,20 +34,20 @@
    public List<Map<String, Object>> search(String runAsUser, String ticket,
            Map<String, String> whereParams) throws HSAdminException {
        String user = runAsUser;
        Transaction transaction = new Transaction(user);
        final String user = runAsUser;
        final Transaction transaction = new Transaction(user);
        try {
            if (transaction.login(user, ticket)) {
                ModuleInterface module = new GenericModuleImpl(transaction);
                UnixUser unixUser = transaction.getLoginUser();
                List<AbstractEntity> list = module.search(getEntityClass(),
                final ModuleInterface module = new GenericModuleImpl(transaction);
                final UnixUser unixUser = transaction.getLoginUser();
                final List<AbstractEntity> list = module.search(getEntityClass(),
                        buildQueryCondition(whereParams), null);
                if (list == null) {
                    throw new HSAdminException("result list is null, runtime-error?");
                }
                ArrayList<Map<String, Object>> result = new ArrayList<Map<String, Object>>();
                final ArrayList<Map<String, Object>> result = new ArrayList<Map<String, Object>>();
                for (AbstractEntity e : list) {
                    HashMap<String, Object> entry = new HashMap<String, Object>();
                    final HashMap<String, Object> entry = new HashMap<String, Object>();
                    entity2map(transaction, e, entry);
                    if (e.isReadAllowedFor(unixUser)) {
                        result.add(entry);
@@ -68,20 +68,20 @@
    public Map<String, Object> add(String runAsUser, String ticket,
            Map<String, Object> setParams) throws HSAdminException {
        String user = runAsUser;
        Transaction transaction = new Transaction(user);
        final String user = runAsUser;
        final Transaction transaction = new Transaction(user);
        try {
            if (transaction.login(user, ticket)) {
                ModuleInterface module = new GenericModuleImpl(transaction);
                Constructor<? extends AbstractEntity> constructor =
                final ModuleInterface module = new GenericModuleImpl(transaction);
                final Constructor<? extends AbstractEntity> constructor =
                    getEntityClass().getConstructor();
                AbstractEntity entity = constructor.newInstance();
                final AbstractEntity entity = constructor.newInstance();
                module.initialize(entity);
                map2entity(transaction, setParams, entity);
                transaction.beginTransaction();
                AbstractEntity insertedEntity = module.add(entity);
                final AbstractEntity insertedEntity = module.add(entity);
                transaction.commitTransaction();
                HashMap<String, Object> entry = new HashMap<String, Object>();
                final HashMap<String, Object> entry = new HashMap<String, Object>();
                entity2map(transaction, insertedEntity, entry);
                return entry;
            } else {
@@ -96,18 +96,18 @@
    public void delete(String runAsUser, String ticket,
            Map<String, String> whereParams) throws HSAdminException {
        String user = runAsUser;
        Transaction transaction = new Transaction(user);
        final String user = runAsUser;
        final Transaction transaction = new Transaction(user);
        try {
            if (transaction.login(user, ticket)) {
                ModuleInterface module = new GenericModuleImpl(transaction);
                UnixUser unixUser = transaction.getLoginUser();
                String queryCondition = buildQueryCondition(whereParams);
                final ModuleInterface module = new GenericModuleImpl(transaction);
                final UnixUser unixUser = transaction.getLoginUser();
                final String queryCondition = buildQueryCondition(whereParams);
                if (queryCondition == null || queryCondition.length() == 0) {
                    throw new HSAdminException(
                            "better safe than sorry: no where parameter found");
                }
                List<AbstractEntity> list = module.search(getEntityClass(),
                final List<AbstractEntity> list = module.search(getEntityClass(),
                        queryCondition, null);
                transaction.beginTransaction();
                for (AbstractEntity e : list) {
@@ -133,19 +133,19 @@
    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);
        final String user = runAsUser;
        final Transaction transaction = new Transaction(user);
        try {
            if (transaction.login(user, ticket)) {
                ModuleInterface module = new GenericModuleImpl(transaction);
                UnixUser unixUser = transaction.getLoginUser();
                ArrayList<Map<String, Object>> result = new ArrayList<Map<String, Object>>();
                String queryCondition = buildQueryCondition(whereParams);
                final ModuleInterface module = new GenericModuleImpl(transaction);
                final UnixUser unixUser = transaction.getLoginUser();
                final ArrayList<Map<String, Object>> result = new ArrayList<Map<String, Object>>();
                final String queryCondition = buildQueryCondition(whereParams);
                if (queryCondition == null || queryCondition.length() == 0) {
                    throw new HSAdminException(
                            "better safe than sorry: no where parameter found");
                }
                List<AbstractEntity> list = module.search(getEntityClass(),
                final List<AbstractEntity> list = module.search(getEntityClass(),
                        queryCondition, getOrderBy());
                transaction.beginTransaction();
                for (AbstractEntity update : list) {
@@ -153,7 +153,7 @@
                        transaction.detach(update);
                        map2entity(transaction, setParams, update);
                        update = module.update(update);
                        HashMap<String, Object> entry = new HashMap<String, Object>();
                        final HashMap<String, Object> entry = new HashMap<String, Object>();
                        entity2map(transaction, update, entry);
                        result.add(entry);
                    } else {
@@ -188,7 +188,7 @@
    protected void replaceKey(Map<String, String> whereParams, String shortKey, String regularKey) {
        if (whereParams.containsKey(shortKey)) {
            String value = whereParams.get(shortKey);
            final String value = whereParams.get(shortKey);
            whereParams.remove(shortKey);
            whereParams.put(regularKey, value);
        }
@@ -200,18 +200,18 @@
    private String buildQueryCondition(Map<String, String> whereParams) {
        regularizeKeys(whereParams);
        StringBuffer cond = new StringBuffer();
        Iterator<String> keyIterator = whereParams.keySet().iterator();
        final StringBuffer cond = new StringBuffer();
        final Iterator<String> keyIterator = whereParams.keySet().iterator();
        while (keyIterator.hasNext()) {
            if (cond.length() > 0) {
                cond.append(" AND ");
            }
            String field = keyIterator.next();
            String value = whereParams.get(field).replaceAll("'", "\'");
            final String field = keyIterator.next();
            final String value = whereParams.get(field).replaceAll("'", "\'");
            cond.append("obj.");
            cond.append(field);
            cond.append(" = ");
            boolean numeric = "id".equals(field);
            final boolean numeric = "id".equals(field);
            if (!numeric) cond.append("'");
            cond.append(value);
            if (!numeric) cond.append("'");
hsarback/src/de/hsadmin/remote/CustomerRemote.java
File was deleted
hsarback/src/de/hsadmin/remote/DomainRemote.java
@@ -23,25 +23,25 @@
    @Override
    protected void entity2map(Transaction tx, AbstractEntity entity, Map<String, Object> resultMap) {
        Domain dom = (Domain) entity;
        String id = Long.toString(dom.getId());
        final Domain dom = (Domain) entity;
        final String id = Long.toString(dom.getId());
        resultMap.put("id", id);
        String name = dom.getName();
        final String name = dom.getName();
        resultMap.put("name", name);
        String user = dom.getUser().getName();
        final String user = dom.getUser().getName();
        resultMap.put("user", user);
        String hive = dom.getHiveName();
        final String hive = dom.getHiveName();
        resultMap.put("hive", hive);
        String pac = dom.getUser().getPac().getName();
        final String pac = dom.getUser().getPac().getName();
        resultMap.put("pac", pac);
        Date sDate = dom.getSince();
        final Date sDate = dom.getSince();
        if (assertNotNull(sDate)) {
            String since = TextUtil.format(sDate);
            final String since = TextUtil.format(sDate);
            resultMap.put("since", since);
        }
        List<String> domainOptionsList = new ArrayList<String>();
        final List<String> domainOptionsList = new ArrayList<String>();
        resultMap.put("domainoptions", domainOptionsList);
        Set<DomainOption> domainOptions = dom.getDomainoptions();
        final Set<DomainOption> domainOptions = dom.getDomainoptions();
        if (domainOptions != null) {
            for (DomainOption opt : domainOptions) {
                domainOptionsList.add(opt.getName());
@@ -51,23 +51,23 @@
    @Override
    protected void map2entity(Transaction tx, Map<String, Object> setParams, AbstractEntity entity) {
        Domain dom = (Domain) entity;
        String name = (String) setParams.get("name");
        String user = (String) setParams.get("user");
        final Domain dom = (Domain) entity;
        final String name = (String) setParams.get("name");
        final String user = (String) setParams.get("user");
        if (assertNotNull(name)) {
            dom.setName(name);
        }
        if (assertNotNull(user)) {
            UnixUser u = new UnixUser();
            final UnixUser u = new UnixUser();
            u.setName(user);
            dom.setUser(u);
        }
        Object domOptsObj = setParams.get("domainoptions");
        final Object domOptsObj = setParams.get("domainoptions");
        if (domOptsObj != null && domOptsObj instanceof Object[]) {
            Set<DomainOption> domainOptionsSet = new HashSet<DomainOption>();
            Object[] domOptions = (Object[]) domOptsObj;
            final Set<DomainOption> domainOptionsSet = new HashSet<DomainOption>();
            final Object[] domOptions = (Object[]) domOptsObj;
            for (int i=0; i<domOptions.length; i++) {
                DomainOption domainOption = new DomainOption();
                final DomainOption domainOption = new DomainOption();
                domainOption.setName((String)domOptions[i]);
                domainOptionsSet.add(domainOption);
            }
hsarback/src/de/hsadmin/remote/GenericAbstractRemote.java
@@ -5,11 +5,11 @@
import java.util.Set;
import java.util.regex.Pattern;
import de.hsadmin.cliClientConnector.TechnicalException;
import de.hsadmin.core.model.AbstractEntity;
import de.hsadmin.core.model.AnnFieldIO;
import de.hsadmin.core.model.HSAdminException;
import de.hsadmin.core.model.ReadWriteAccess;
import de.hsadmin.core.model.TechnicalException;
import de.hsadmin.core.model.Transaction;
import de.hsadmin.core.util.ReflectionUtil;