Examples of AddGadgetRequest


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

    /**
     * {@inheritDoc}
     */
    public void insert(final AddGadgetToStartPageRequest inRequest)
    {
        super.callWriteAction("addGadget", new AddGadgetRequest(inRequest.getTabId(), inRequest.getUrl(), inRequest
                .getPrefs()), new OnSuccessCommand<Gadget>()
        {
            public void onSuccess(final Gadget response)
            {
                if (inRequest.getPrefs() != null)
View Full Code Here

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

     *             can result from bad arguments, the user not being logged in, or not finding the user in the database
     */
    @Override
    public Serializable execute(final PrincipalActionContext inActionContext) throws ExecutionException
    {
        AddGadgetRequest request = (AddGadgetRequest) inActionContext.getParams();
        Long tabId = request.getTabId();
        String gadgetDefUrl = request.getGadgetDefinitionUrl();
        Person owner = personMapper.findByAccountId(inActionContext.getPrincipal().getAccountId());
        Tab tab = owner.getTabs(TabGroupType.START).get(0);

        if (null != tabId)
        {
            tab = tabMapper.findById(tabId);
        }

        try
        {
            GadgetDefinition gadgetDef;

            // UUID identified by starting with { and ending with }
            if (gadgetDefUrl.startsWith("{") && gadgetDefUrl.substring(gadgetDefUrl.length() - 1).equals("}"))
            {
                // gadget def is identified by a UUID
                gadgetDef = gadgetDefinitionMapper.findByUUID(gadgetDefUrl.substring(1, gadgetDefUrl.length() - 1));
            }
            else
            {
                // gadget def is identified by a URL.
                gadgetDef = gadgetDefinitionMapper.findByUrl(gadgetDefUrl);
            }

            /*
             * If gadgetDef is not found, throw an exception, something went wrong, most likely a bad UUID or URL.
             */
            if (null == gadgetDef)
            {
                throw new ExecutionException("Unable to instantiate gadgetDef.");
            }

            // increment the indexes of any gadgets in that zone
            shiftGadget(tab.getGadgets());

            // get the owner

            // create the new gadget at the top of the last zone
            Gadget gadget = new Gadget(gadgetDef, 0, 0, owner, request.getUserPrefs() == null ? "" : request
                    .getUserPrefs());

            // insert the new gadget - room has been made for it
            tab.getGadgets().add(gadget);

View Full Code Here

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

     *             thrown if the user does not have proper access
     */
    @Override
    public void authorize(final PrincipalActionContext inActionContext) throws AuthorizationException
    {
        AddGadgetRequest request = (AddGadgetRequest) inActionContext.getParams();
        Long tabId = request.getTabId();

        // get the Tab we're inserting the Gadget into
        if (tabId == null)
        {
            // if client passes null for id, find the first tab
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.