view flys-client/src/main/java/de/intevation/flys/client/server/ModuleServiceImpl.java @ 3524:2c306a3dacef

Use xml namespace for XPath query to get the accout name attribute. flys-client/trunk@5323 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Bjoern Ricks <bjoern.ricks@intevation.de>
date Fri, 31 Aug 2012 08:29:07 +0000
parents f9ef72f4c6d5
children 72d2ec6a471e
line wrap: on
line source
package de.intevation.flys.client.server;

import java.util.ArrayList;
import java.util.List;

import org.apache.log4j.Logger;

import de.intevation.flys.client.client.FLYSConstants;
import de.intevation.flys.client.client.services.ModuleService;
import de.intevation.flys.client.server.auth.User;
import de.intevation.flys.client.shared.model.DefaultModule;
import de.intevation.flys.client.shared.model.Module;

public class ModuleServiceImpl
extends      RemoteServiceServlet
implements   ModuleService
{
    private static final Logger logger =
        Logger.getLogger(ModuleServiceImpl.class);

    /** Constant value for the WINFO plugin.*/
    public static final String FIELD_PLUGIN_WINFO = "winfo";

    /** Constant value for the MINFO plugin.*/
    public static final String FIELD_PLUGIN_MINFO = "minfo";

    /** Constant value for the MAP plugin.*/
    public static final String FIELD_PLUGIN_MAP   = "new_map";

    /** Constant value for the CHART plugin.*/
    public static final String FIELD_PLUGIN_CHART = "new_chart";

    /** Constant value for the FIX plugin.*/
    public static final String FIELD_PLUGIN_FIX   = "fixanalysis";

    @Override
    public Module[] list(String locale) {
        User user = this.getUser();

        //TODO load modules from artifactserver
        Module[] available = {
            new DefaultModule(FIELD_PLUGIN_WINFO, "WINFO"),
            new DefaultModule(FIELD_PLUGIN_MINFO, "MINFO"),
            new DefaultModule(FIELD_PLUGIN_CHART, "Neues Diargamm"),
            new DefaultModule(FIELD_PLUGIN_FIX,   "Fixierungsanalyse"),
            new DefaultModule(FIELD_PLUGIN_MAP,   "Neue Karte"),
        };

        List<Module> modules = new ArrayList<Module>(available.length);
        for(Module module : available) {
            if (user == null || user.canUseFeature("module:" + module.getName())) {
                modules.add(module);
            }
        }
        return modules.toArray(new Module[modules.size()]);
    }
}

// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 tw=80 :

http://dive4elements.wald.intevation.org