Package pspdash.data

Examples of pspdash.data.SimpleData.format()


            SimpleData d = getSimpleValue(listName);
            if (d instanceof ListData)   return (ListData) d;
            if (d instanceof StringData) return ((StringData) d).asList();
            if (d instanceof SimpleData) {
                ListData result = new ListData();
                result.add(d.format());
            }
            return EMPTY_LIST;
        } else {
            // listName names an environment variable or parameter
            ListData result = new ListData();
View Full Code Here


    private String getString(String name) {
        if (name.startsWith("[")) {
            // listName names a data element
            name = trimDelim(name);
            SimpleData d = getSimpleValue(name);
            return (d == null ? "" : d.format());
        } else if ("_UNIQUE_".equals(name)) {
            return Long.toString(uniqueNumber++);
        } else {
                                // try for an environment variable first.
            Object result = env.get(name);
View Full Code Here

        DataRepository data = getDataRepository();
        String prefix = getPrefix();
        if (prefix == null) prefix = "";
        String dataName = data.createDataName(prefix, name);
        SimpleData d = data.getSimpleValue(dataName);
        return (d == null ? null : d.format());
    }

    /** Display the welcome page */
    protected void showWelcomePage() {
        printRedirect(WELCOME_URL);
View Full Code Here

        String getPassword() {
            String dataName = passwordRecallName();
            SimpleData val = data.getSimpleValue(dataName);
            if (val == null) return null;
            String str = val.format();
            if (NO_PASSWORD.equals(str)) return NO_PASSWORD;
            return Base64.decode(str);
        }

        void setPassword(String password) {
View Full Code Here

        String globalPrefix = MAIN_DATA_PREFIX + taskListName;
        String dataName = data.createDataName(globalPrefix, ID_DATA_NAME);

        SimpleData d = data.getSimpleValue(dataName);
        if (d != null) {
            taskListID = d.format();
        } else {
            // This task list doesn't have a unique ID yet.  Generate one.
            // It should be a value that needs no special handling to
            // appear as an XML attribute.
            int i = Math.abs((new Random()).nextInt());
View Full Code Here

        DataRepository data = getDataRepository();
        String prefix = getPrefix();
        String dataName = DataRepository.createDataName(prefix, DATA_NAME);
        SimpleData d = data.getSimpleValue(dataName);
        String subsetPrefix = null;
        if (d != null) subsetPrefix = d.format();
        if (subsetPrefix == null || subsetPrefix.length() == 0)
            subsetPrefix = DEFAULT_PREFIX;

        out.print("Location: ");
        out.print(TinyWebServer.urlEncodePath(subsetPrefix));
View Full Code Here

        showDefects = (d != null && d.test());
        d = data.getSimpleValue(prefix + "/" + UNITS_NAME);
        if (d == null) {
            unit = "Unit"; units = "Units";
        } else {
            units = d.format();
            int semicolonPos = units.indexOf(';');
            if (semicolonPos > -1) {
                unit  = units.substring(0, semicolonPos);
                units = units.substring(semicolonPos+1);
            } else if (units.endsWith("s")) {
View Full Code Here

    /** get the name of the person who owns the data in the repository */
    protected String getOwner() {
        DataRepository data = getDataRepository();
        SimpleData val = data.getSimpleValue("/Owner");
        if (val == null) return null;
        String result = val.format();
        if ("Enter your name".equals(result))
            return null;
        else
            return result;
    }
View Full Code Here

            if (dataName != null)
                value = data.getSimpleValue(dataName);
        }

        if (value instanceof StringData)
            return value.format();
        else
            return null;
    }

    private static String getIDForDataName(DataRepository data,
View Full Code Here

    private static String getIDForDataName(DataRepository data,
                                              String dataName) {
        SimpleData value = data.getSimpleValue(dataName);
        if (!(value instanceof StringData)) return null;

        String xmlDoc = value.format();

        String pattern = " "+XMLID_ATTR+"='";
        int beg = xmlDoc.indexOf(pattern);
        if (beg == -1) return null;
        beg += pattern.length();
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.