Package org.exoplatform.application.registry

Examples of org.exoplatform.application.registry.ApplicationRegistryService


        UIFormInputInfo uiInfo;

        HTMLEntityEncoder encoder = HTMLEntityEncoder.getInstance();

        //
        ApplicationRegistryService appRegService = getApplicationComponent(ApplicationRegistryService.class);
        List<ApplicationCategory> categories = getAllCategories();
        List<UIFormInputSet> uiInputSetList = new ArrayList<UIFormInputSet>();
        for (ApplicationCategory category : categories) {
            uiInputSet = new UIFormInputSet(category.getName());
            boolean defaultValue = false;
            if (application != null) {
                String definitionName = application.getDisplayName().replace(' ', '_');
                defaultValue = appRegService.getApplication(category.getName(), definitionName) != null;
            }
            checkBoxInput = new UICheckBoxInput("category_" + category.getName(), null, defaultValue);
            checkBoxInput.setOnChange("SelectBox");
            uiInfo = new UIFormInputInfo("categoryName", null, encoder.encode(category.getDisplayName(true)));
            uiInputSet.addChild(checkBoxInput);
View Full Code Here


    public static class SaveActionListener extends EventListener<UICategorySelector> {
        public void execute(Event<UICategorySelector> event) throws Exception {
            UICategorySelector selector = event.getSource();

            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();

            UIContainer appInfo = selector.getParent();
View Full Code Here

    public static class SelectBoxActionListener extends EventListener<UICategorySelector> {

        @Override
        public void execute(Event<UICategorySelector> event) throws Exception {
            UICategorySelector selector = event.getSource();
            ApplicationRegistryService appRegService = selector.getApplicationComponent(ApplicationRegistryService.class);
            List<ApplicationCategory> categories = appRegService.getApplicationCategories();
            UICheckBoxInput chkInput;
            for (ApplicationCategory category : categories) {
                chkInput = selector.getUIInput("category_" + category.getName());
                if (chkInput != null && chkInput.isChecked()) {
                    selector.addSelectedCategory("category_" + category.getName());
View Full Code Here

    public static class SaveActionListener extends EventListener<UICategoryForm> {
        public void execute(Event<UICategoryForm> event) throws Exception {
            UICategoryForm uiForm = event.getSource();
            WebuiRequestContext ctx = event.getRequestContext();
            UIApplicationOrganizer uiOrganizer = uiForm.getParent();
            ApplicationRegistryService service = uiForm.getApplicationComponent(ApplicationRegistryService.class);
            ApplicationCategory category = uiForm.getCategory();
            boolean isCreateNew = category == null;
            if (isCreateNew) {
                category = new ApplicationCategory();
            }
            UIFormInputSet uiSetting = uiForm.getChildById(FIELD_SETTING);
            UIFormInputSet uiPermission = uiForm.getChildById(FIELD_PERMISSION);
            category.setName(uiSetting.getUIStringInput(FIELD_NAME).getValue());
            String displayName = uiSetting.getUIStringInput(FIELD_DISPLAY_NAME).getValue();
            category.setDisplayName(displayName);

            category.setDescription(uiSetting.getUIFormTextAreaInput(FIELD_DESCRIPTION).getValue());

            UIListPermissionSelector uiListPermissionSelector = uiPermission.getChild(UIListPermissionSelector.class);
            ArrayList<String> pers = new ArrayList<String>();
            if (uiListPermissionSelector.getValue() != null) {
                for (String per : uiListPermissionSelector.getValue()) {
                    pers.add(per);
                }
            }
            category.setAccessPermissions(pers);
            ApplicationCategory existCategory = service.getApplicationCategory(category.getName());
            if (!isCreateNew) {
                if (existCategory == null) {
                    uiOrganizer.reload();
                    UIApplication uiApp = ctx.getUIApplication();
                    uiApp.addMessage(new ApplicationMessage("category.msg.changeNotExist", null));
                    ctx.addUIComponentToUpdateByAjax(uiOrganizer);
                    return;
                }
                category.setModifiedDate(new Date());
            } else {
                if (existCategory != null) {
                    UIApplication uiApp = event.getRequestContext().getUIApplication();
                    uiApp.addMessage(new ApplicationMessage("UICategoryForm.msg.SameName", null));
                    if (uiOrganizer.getCategory(category.getName()) == null) {
                        uiOrganizer.initApplicationCategories();
                    }
                    return;
                }
                category.setModifiedDate(new Date());
                category.setCreatedDate(new Date());
            }
            service.save(category);
            uiForm.setValue(null);
            uiOrganizer.reload();
            uiOrganizer.setSelectedCategory(category.getName());
            ctx.addUIComponentToUpdateByAjax(uiOrganizer);
        }
View Full Code Here

    public static class SaveActionListener extends EventListener<UIApplicationForm> {
        public void execute(Event<UIApplicationForm> event) throws Exception {
            UIApplicationForm uiForm = event.getSource();
            WebuiRequestContext ctx = event.getRequestContext();
            UIApplicationOrganizer uiOrganizer = uiForm.getParent();
            ApplicationRegistryService service = uiForm.getApplicationComponent(ApplicationRegistryService.class);
            Application application = uiForm.getApplication();
            if (service.getApplication(application.getId()) == null) {
                UIApplication uiApp = ctx.getUIApplication();
                uiApp.addMessage(new ApplicationMessage("application.msg.changeNotExist", null));
                uiOrganizer.reload();
                uiOrganizer.setSelectedCategory(application.getCategoryName());
                ctx.addUIComponentToUpdateByAjax(uiOrganizer);
                return;
            }
            uiForm.invokeSetBindingBean(application);
            application.setModifiedDate(Calendar.getInstance().getTime());
            String displayName = application.getDisplayName();
            if (displayName == null || displayName.trim().length() < 1) {
                application.setDisplayName(application.getApplicationName());
            }
            service.update(application);
            ApplicationCategory selectedCat = uiOrganizer.getSelectedCategory();
            uiOrganizer.reload();
            uiOrganizer.setSelectedCategory(selectedCat);
            uiOrganizer.setSelectedApplication(application);
            ctx.addUIComponentToUpdateByAjax(uiOrganizer);
View Full Code Here

        }

    }

    private String getCategorieNames() throws Exception {
        ApplicationRegistryService appRegService = getApplicationComponent(ApplicationRegistryService.class);
        List<ApplicationCategory> allCategories = appRegService.getApplicationCategories();
        List<String> nameList = new ArrayList<String>();

        for (ApplicationCategory category : allCategories) {
            for (Application application : appRegService.getApplications(category)) {
                if (application.getContentId().equals(portlet_.getId())) {
                    nameList.add(category.getDisplayName(true));
                }
            }
        }
View Full Code Here

        MonitorEvent<UIPortal> pnevent = new MonitorEvent<UIPortal>(uiPortal, "ChangeApplicationList", portalContext);
        uiPortal.broadcast(pnevent, Event.Phase.PROCESS);
    }

    public void initApplicationCategories() throws Exception {
        ApplicationRegistryService service = getApplicationComponent(ApplicationRegistryService.class);
        categories = service.getApplicationCategories(new Util.CategoryComparator());
    }
View Full Code Here

        public void execute(Event<UIApplicationOrganizer> event) throws Exception {
            String categoryName = event.getRequestContext().getRequestParameter(OBJECTID);
            WebuiRequestContext ctx = event.getRequestContext();
            UIApplicationOrganizer uiOrganizer = event.getSource();
            ApplicationRegistryService service = uiOrganizer.getApplicationComponent(ApplicationRegistryService.class);
            ApplicationCategory existingCate = service.getApplicationCategory(categoryName);
            if (existingCate == null) {
                UIApplication uiApp = ctx.getUIApplication();
                uiApp.addMessage(new ApplicationMessage("UIOrganizer.msg.categoryNoExist", null));
                uiOrganizer.reload();
                return;
View Full Code Here

    public static class ImportAllApplicationsActionListener extends EventListener<UIApplicationOrganizer> {

        public void execute(Event<UIApplicationOrganizer> event) throws Exception {
            UIApplicationOrganizer uiOrganizer = event.getSource();
            ApplicationRegistryService service = uiOrganizer.getApplicationComponent(ApplicationRegistryService.class);

            service.importAllPortlets();
            service.importExoGadgets();
            uiOrganizer.reload();
            event.getRequestContext().addUIComponentToUpdateByAjax(uiOrganizer);
        }
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) {
                    uiOrganizer.setSelectedCategory(selectedCategory);
                } else {
                    uiOrganizer.reload();
                }
                return;
View Full Code Here

TOP

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

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.