Package org.eurekastreams.server.domain.gadgetspec

Examples of org.eurekastreams.server.domain.gadgetspec.UserPrefDTO


                                    // issues with GWT making wierd javascript
                                    for (int i = 0; i < metadata.getUserPrefs().size(); i++)
                                    {
                                        if (metadata.getUserPrefs().get(i).getClass() == UserPrefDTO.class)
                                        {
                                            UserPrefDTO userPref = metadata.getUserPrefs().get(i);
                                            if (!userPref.getDataType().equals(UserPrefDTO.DataType.HIDDEN))
                                            {
                                                foundSetting = true;
                                                break;
                                            }
                                            gadgetData.getGadgetUserPref();
View Full Code Here


        final List<GadgetMetaDataDTO> metaData = new ArrayList<GadgetMetaDataDTO>();
        metaData.add(meta);

        final Long updateFrequency = 0L;

        final UserPrefDTO userPref = new UserPrefDTO();
        final UserPrefDTO userPref2 = new UserPrefDTO();

        userPref.setName("updateFrequency");
        userPref.setDefaultValue(updateFrequency.toString());

        userPref2.setName("objectType");
        userPref2.setDefaultValue("BOOKMARK");

        final List<UserPrefDTO> preferences = new LinkedList();
        preferences.add(userPref);
        preferences.add(userPref2);
        meta.setUserPrefs(preferences);
View Full Code Here

        final List<GadgetMetaDataDTO> metaData = new ArrayList<GadgetMetaDataDTO>();
        metaData.add(meta);

        final String invalidValue = "NOT VALID VALUE";

        final UserPrefDTO userPref = new UserPrefDTO();
        final UserPrefDTO userPref2 = new UserPrefDTO();

        userPref.setName("updateFrequency");
        userPref.setDefaultValue(invalidValue);

        userPref2.setName("objectType");
        userPref2.setDefaultValue(invalidValue);

        final List<UserPrefDTO> preferences = new LinkedList();
        preferences.add(userPref);
        preferences.add(userPref2);
        meta.setUserPrefs(preferences);
View Full Code Here

            currentGadget.setAuthor(gadgetJSON.containsKey("author") ? gadgetJSON.getString("author") : "");
            currentGadget.setDescription(gadgetJSON.containsKey("description") ? gadgetJSON.getString("description")
                    : "");
            JSONObject gadgetUserPrefsJSON = gadgetJSON.getJSONObject("userPrefs");
            List<UserPrefDTO> userPrefs = new ArrayList<UserPrefDTO>();
            UserPrefDTO currentUserPref;
            JSONObject currentUserPrefJSON;
            String currentUserPrefKey;
            for (Object userPrefKey : gadgetUserPrefsJSON.keySet())
            {
                currentUserPrefKey = (String) userPrefKey;
                currentUserPrefJSON = gadgetUserPrefsJSON.getJSONObject(currentUserPrefKey);
                currentUserPref = new UserPrefDTO();
                currentUserPref.setName(currentUserPrefKey);
                currentUserPref.setDisplayName(currentUserPrefJSON.getString("displayName"));
                currentUserPref.setDataType(currentUserPrefJSON.getString("type"));
                currentUserPref.setDefaultValue(currentUserPrefJSON.getString("default"));
                if (currentUserPref.getDataType().name() == DataType.ENUM.name())
                {
                    // Unordered easy access map of enum values.
                    Map<String, String> enumValues = new HashMap<String, String>();
                    String enumKey;
                    String userPrefEnumValue;
                    // parse enum values here
                    for (Object enumKeyObject : currentUserPrefJSON.getJSONObject("enumValues").keySet())
                    {
                        enumKey = (String) enumKeyObject;
                        userPrefEnumValue = (String) currentUserPrefJSON.getJSONObject("enumValues").get(enumKey);
                        enumValues.put(enumKey, userPrefEnumValue);
                    }
                    currentUserPref.setEnumValues(enumValues);

                    // Ordered enum values for creating preferences.
                    List<EnumValuePairDTO> orderedEnumValues = new LinkedList<EnumValuePairDTO>();
                    JSONArray orderedEnumValuesJson = currentUserPrefJSON.getJSONArray("orderedEnumValues");
                    JSONObject currentOrderedEnumValueJson;
                    for (int arrayIndex = 0; arrayIndex < orderedEnumValuesJson.size(); arrayIndex++)
                    {
                        currentOrderedEnumValueJson = orderedEnumValuesJson.getJSONObject(arrayIndex);
                        orderedEnumValues.add(new EnumValuePairDTO(currentOrderedEnumValueJson.getString("value"),
                                currentOrderedEnumValueJson.getString("displayValue")));
                    }
                    currentUserPref.setOrderedEnumValues(orderedEnumValues);
                }

                if (currentUserPrefJSON.containsKey("required"))
                {
                    currentUserPref.setRequired(currentUserPrefJSON.getString("required"));
                }
                userPrefs.add(currentUserPref);
            }
            currentGadget.setUserPrefs(userPrefs);
            currentGadgetMetaData.add(currentGadget);
View Full Code Here

                List<UserPrefDTO> userPrefs = new ArrayList<UserPrefDTO>();
                String[] keys = getUserPrefsKeys(metadata, i);
                for (int k = 0; k < keys.length; k++)
                {
                    UserPrefDTO userPref = new UserPrefDTO();
                    userPref.setDisplayName(getUserPrefDisplayName(metadata, i, keys[k]));
                    userPref.setDataType(getUserPrefType(metadata, i, keys[k]).toUpperCase());
                    userPrefs.add(userPref);
                }
                gMetaData.setUserPrefs(userPrefs);

                List<String> features = new ArrayList<String>();
View Full Code Here

TOP

Related Classes of org.eurekastreams.server.domain.gadgetspec.UserPrefDTO

Copyright © 2018 www.massapicom. 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.