Package org.exoplatform.application.registry

Examples of org.exoplatform.application.registry.Application


        //
        ContentType<?> contentType = customization.getType();
        ApplicationType<?> applicationType = ApplicationType.getType(contentType);

        //
        Application application = new Application();
        /**
         * Apps ID has a "/" character that is rendered into id markup.
         * We need to workaround it to be W3C compliant.
         */
        application.setId(contentDef.getCategory().getName() + "_slash_" + contentDef.getName());
        application.setCategoryName(contentDef.getCategory().getName());
        application.setType(applicationType);
        application.setApplicationName(contentDef.getName());
        application.setIconURL(getApplicationIconURL(contentDef));
        application.setDisplayName(contentDef.getDisplayName());
        application.setDescription(contentDef.getDescription());
        application.setAccessPermissions(new ArrayList<String>(contentDef.getAccessPermissions()));
        application.setCreatedDate(contentDef.getCreationDate());
        application.setModifiedDate(contentDef.getLastModificationDate());
        application.setStorageId(customization.getId());
        application.setContentId(customization.getContentId());
        return application;
    }
View Full Code Here


                    if (accessPers == null || accessPers.length == 0)
                        accessPers = new String[] { UserACL.EVERYONE };
                    uiContainer.setAccessPermissions(accessPers);
                    uiSource = uiContainer;
                } else {
                    Application app = null;
                    UIApplicationList appList = uiApp.findFirstComponentOfType(UIApplicationList.class);
                    app = appList.getApplication(sourceId);
                    ApplicationType applicationType = app.getType();

                    //
                    UIPortlet uiPortlet = uiTarget.createUIComponent(UIPortlet.class, null, null);
                    // Only setting title for Gadgets as it's using Portlet wrapper for displaying
                    if (app.getType().equals(ApplicationType.GADGET)) {
                        uiPortlet.setTitle(app.getDisplayName());
                    }
                    uiPortlet.setDescription(app.getDescription());
                    List<String> accessPersList = app.getAccessPermissions();
                    String[] accessPers = accessPersList.toArray(new String[accessPersList.size()]);
                    for (String accessPer : accessPers) {
                        if (accessPer.equals(""))
                            accessPers = null;
                    }
                    if (accessPers == null || accessPers.length == 0)
                        accessPers = new String[] { UserACL.EVERYONE };
                    uiPortlet.setAccessPermissions(accessPers);
                    UIPage uiPage = uiTarget.getAncestorOfType(UIPage.class);

                    // Hardcode on state to fix error while drag/drop Dashboard
                    if ("dashboard/DashboardPortlet".equals(app.getContentId())) {
                        TransientApplicationState state = new TransientApplicationState<Object>(app.getContentId());
                        uiPortlet.setState(new PortletState(state, applicationType));
                    } else {
                        ApplicationState state;
                        // if we have a new portlet added to the page we need for it to have its own state.
                        // otherwise all new portlets added to a page will have the same state.
                        if (newComponent) {
                            state = new TransientApplicationState<Object>(app.getContentId());

                            // if the portlet is not new, then we should clone it from the original portlet
                        } else {
                            state = new CloneApplicationState<Object>(app.getStorageId());
                        }
                        uiPortlet.setState(new PortletState(state, applicationType));
                    }
                    uiPortlet.setPortletInPortal(uiTarget instanceof UIPortal);
View Full Code Here

        public void execute(Event<UIApplicationOrganizer> event) throws Exception {
            UIApplicationOrganizer uiOrganizer = event.getSource();
            String appName = event.getRequestContext().getRequestParameter(OBJECTID);
            UIApplicationForm uiApplicationForm = uiOrganizer.getChild(UIApplicationForm.class);
            if (uiApplicationForm != null) {
                Application app = uiApplicationForm.getApplication();
                if (app != null && app.getApplicationName().equals(appName)) {
                    UIApplication uiApp = event.getRequestContext().getUIApplication();
                    uiApp.addMessage(new ApplicationMessage("UIOrganizer.msg.deleteApplicationInUse", null));
                    return;
                }
            }
            ApplicationRegistryService service = uiOrganizer.getApplicationComponent(ApplicationRegistryService.class);
            Application app = uiOrganizer.getApplication(appName);
            if (service.getApplication(app.getId()) != null) {
                service.remove(app);
            }
            String cateName = uiOrganizer.getSelectedCategory().getName();
            uiOrganizer.reload();
            uiOrganizer.setSelectedCategory(cateName);
View Full Code Here

            ApplicationRegistryService appRegService = selector.getApplicationComponent(ApplicationRegistryService.class);
            List<ApplicationCategory> categories = appRegService.getApplicationCategories();
            categories = categories != null ? categories : new ArrayList<ApplicationCategory>();
            for (ApplicationCategory category : categories) {
                if (selector.getSelectedCategories().contains("category_" + category.getName())) {
                    Application newApp = cloneApplication(selector.getApplication());
                    UIApplicationRegistryPortlet.setPermissionToAdminGroup(newApp);
                    appRegService.save(category, newApp);
                }
            }
            selector.clearSelectedCategories();
View Full Code Here

            event.getRequestContext().addUIComponentToUpdateByAjax(appInfo);
        }

        private Application cloneApplication(Application app) {
            Application newApp = new Application();
            newApp.setApplicationName(app.getApplicationName());
            newApp.setDisplayName(app.getDisplayName());
            newApp.setType(app.getType());
            newApp.setDescription(app.getDescription());
            newApp.setAccessPermissions(app.getAccessPermissions());
            newApp.setContentId(app.getContentId());
            return newApp;
        }
View Full Code Here

        public void execute(Event<UIPortletInfo> event) throws Exception {
            UIPortletInfo uiPortletInfo = event.getSource();
            PortletExtra portlet = uiPortletInfo.getPortlet();
            uiPortletInfo.removeChild(UICategorySelector.class);
            UICategorySelector selector = uiPortletInfo.addChild(UICategorySelector.class, null, CATEGORY_ID);
            Application app = new Application();
            app.setApplicationName(portlet.getName());

            // I really hate the fact that the code to create Applications is spread all over and doesn't properly deal with
            // application types
            if (portlet.isRemote()) {
                app.setType(ApplicationType.WSRP_PORTLET);
            } else {
                app.setType(ApplicationType.PORTLET);
            }
            app.setDisplayName(portlet.getDisplayName());
            app.setContentId(portlet.getId());
            app.setAccessPermissions(new ArrayList<String>());

            selector.setApplication(app);
            selector.setRendered(true);
        }
View Full Code Here

        public void execute(Event<UIApplicationOrganizer> event) throws Exception {
            WebuiRequestContext ctx = event.getRequestContext();
            String appName = ctx.getRequestParameter(OBJECTID);
            UIApplicationOrganizer uiOrganizer = event.getSource();
            Application selectedApp = uiOrganizer.getApplication(appName);
            ApplicationRegistryService service = uiOrganizer.getApplicationComponent(ApplicationRegistryService.class);
            String selectedAppId = selectedApp.getId();
            if (service.getApplication(selectedAppId) == null) {
                UIApplication uiApp = ctx.getUIApplication();
                uiApp.addMessage(new ApplicationMessage("UIOrganizer.msg.applicationNoExist", null));
                ApplicationCategory selectedCategory = uiOrganizer.getSelectedCategory();
                if (service.getApplicationCategory(selectedCategory.getName()) != null) {
View Full Code Here

    public static class CancelActionListener extends EventListener<UICategoryForm> {

        public void execute(Event<UICategoryForm> event) throws Exception {
            UICategoryForm uiForm = event.getSource();
            UIApplicationOrganizer uiOrganizer = uiForm.getParent();
            Application application = uiOrganizer.getSelectedApplication();
            if (application != null) {
                uiOrganizer.setSelectedApplication(application);
            } else {
                uiOrganizer.reload();
            }
View Full Code Here

        } else if (ApplicationType.GADGET == type) {
            GadgetRegistryService gadgetService = getApplicationComponent(GadgetRegistryService.class);
            List<Gadget> gadgets = gadgetService.getAllGadgets();
            List<Application> applications = new ArrayList<Application>(gadgets.size());
            for (Gadget gadget : gadgets) {
                Application app = new Application();
                app.setApplicationName(gadget.getName());
                app.setType(ApplicationType.GADGET);
                app.setDisplayName(gadget.getTitle());
                app.setContentId(gadget.getName());
                String description = (gadget.getDescription() == null || gadget.getDescription().length() < 1) ? gadget
                        .getName() : gadget.getDescription();
                app.setDescription(description);
                app.setAccessPermissions(new ArrayList<String>());
                applications.add(app);
            }
            return applications;
        }
View Full Code Here

            LocalizedString descriptionLS = info.getMeta().getMetaValue(MetaInfo.DESCRIPTION);
            LocalizedString displayNameLS = info.getMeta().getMetaValue(MetaInfo.DISPLAY_NAME);

            String portletName = info.getName();
            Application app = new Application();
            app.setApplicationName(portletName);
            // app.setApplicationGroup(info.getApplicationName());
            ApplicationType appType;
            String contentId;
            String displayName = Util.getLocalizedStringValue(displayNameLS, portletName);
            if (remote) {
                appType = ApplicationType.WSRP_PORTLET;
                contentId = portlet.getContext().getId();
                displayName += ApplicationRegistryService.REMOTE_DISPLAY_NAME_SUFFIX; // add remote to display name to make it
                                                                                      // more obvious that the portlet is remote
            } else {
                appType = ApplicationType.PORTLET;
                contentId = info.getApplicationName() + "/" + info.getName();
            }
            app.setType(appType);
            app.setDisplayName(displayName);
            app.setDescription(Util.getLocalizedStringValue(descriptionLS, portletName));
            app.setAccessPermissions(new ArrayList<String>());
            app.setContentId(contentId);
            applications.add(app);
        }

        return applications;
    }
View Full Code Here

TOP

Related Classes of org.exoplatform.application.registry.Application

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.