Examples of GadgetUserPrefActionRequest


Examples of org.eurekastreams.server.action.request.start.GadgetUserPrefActionRequest

    @Test
    public void testPerformAction() throws Exception
    {
        final String userPrefsJson = "{'userPref1':'value1','userPref2':'value2'}";
        final GadgetUserPrefDTO testPrefs1 = context.mock(GadgetUserPrefDTO.class);
        final GadgetUserPrefActionRequest requestParam = new GadgetUserPrefActionRequest(new Long(1L), userPrefsJson);
        context.checking(new Expectations()
        {
            {
                oneOf(mapper).execute(with(any(GadgetUserPrefRequest.class)));
                will(returnValue(testPrefs1));
View Full Code Here

Examples of org.eurekastreams.server.action.request.start.GadgetUserPrefActionRequest

    @Test
    public void testExecute() throws Exception
    {
        final String userPrefsJson = "{'userPref1':'value1','userPref2':'value2'}";
        final String userPrefsJsonNewValue = "{'userPref1':'value1','userPref2':'value2222'}";
        final GadgetUserPrefActionRequest requestParam = new GadgetUserPrefActionRequest(new Long(1L),
                userPrefsJsonNewValue);

        context.checking(new Expectations()
        {
            {
View Full Code Here

Examples of org.eurekastreams.server.action.request.start.GadgetUserPrefActionRequest

     */
    @Test
    public void testExecuteNoChanges() throws Exception
    {
        final String userPrefsJson = "{'userPref1':'value1','userPref2':'value2'}";
        final GadgetUserPrefActionRequest requestParam = new GadgetUserPrefActionRequest(new Long(1L), userPrefsJson);

        context.checking(new Expectations()
        {
            {
                allowing(actionContext).getParams();
View Full Code Here

Examples of org.eurekastreams.server.action.request.start.GadgetUserPrefActionRequest

     *             if JSON is invalid.
     */
    @Override
    public void validate(final ActionContext inActionContext) throws ValidationException
    {
        GadgetUserPrefActionRequest currentRequest = (GadgetUserPrefActionRequest) inActionContext.getParams();

        if (currentRequest.getGadgetUserPref().length() > 0)
        {
            try
            {
                JSONObject.fromObject(currentRequest.getGadgetUserPref());
            }
            catch (JSONException jex)
            {
                throw new ValidationException("Gadget User Prefs must be valid JSON format.");
            }
View Full Code Here

Examples of org.eurekastreams.server.action.request.start.GadgetUserPrefActionRequest

     * @return Serializable GadgetUserPref DTO object.
     */
    @Override
    public Serializable execute(final ActionContext inActionContext)
    {
        GadgetUserPrefActionRequest request = (GadgetUserPrefActionRequest) inActionContext.getParams();
        String userPrefs;
        try
        {
            GadgetUserPrefDTO currentPrefs = mapper.execute(new GadgetUserPrefRequest(request.getGadgetId(), request
                    .getGadgetUserPref()));
            userPrefs = currentPrefs.getJsonUserPref();
        }
        catch (NoResultException nex)
        {
View Full Code Here

Examples of org.eurekastreams.server.action.request.start.GadgetUserPrefActionRequest

     * @return gadget user preferences.
     */
    @Override
    public String execute(final ActionContext inActionContext)
    {
        GadgetUserPrefActionRequest currentRequest = (GadgetUserPrefActionRequest) inActionContext.getParams();

        // No unescaping/decoding required

        logger.debug("Updating user prefs for gadget: " + currentRequest.getGadgetId() + " with: "
                + currentRequest.getGadgetUserPref());

        Gadget currentGadgetInstance = findGadgetByIdMapper.execute(new FindByIdRequest("Gadget", currentRequest
                .getGadgetId()));

        String oldVal = currentGadgetInstance.getGadgetUserPref();
        String newVal = currentRequest.getGadgetUserPref();

        if (StringUtils.equalsIgnoreCase(oldVal, newVal))
        {
            logger.debug("prefs didn't change; i refuse to update them");
            return oldVal;
View Full Code Here

Examples of org.eurekastreams.server.action.request.start.GadgetUserPrefActionRequest

        if (moduleId != null && moduleId > 0)
        {
            try
            {
                // create the request
                GadgetUserPrefActionRequest request = new GadgetUserPrefActionRequest(moduleId);

                // Create the actionContext
                PrincipalActionContext ac = new ServiceActionContext(request, null);

                // execute action and return results.
View Full Code Here

Examples of org.eurekastreams.server.action.request.start.GadgetUserPrefActionRequest

        }

        if (moduleId != null && moduleId > 0 && userPrefs.length() > 0)
        {
            // create the request.
            GadgetUserPrefActionRequest currentRequest = new GadgetUserPrefActionRequest(moduleId, userPrefs);

            // Create the actionContext
            PrincipalActionContext ac = new ServiceActionContext(currentRequest, null);

            try
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.