Package org.exoplatform.portal.config.model

Examples of org.exoplatform.portal.config.model.PortalConfig


            default:
                throw new AssertionError();
        }
        for (Iterator<String> i = list.iterator(); i.hasNext();) {
            String name = i.next();
            PortalConfig config = storage_.getPortalConfig(siteType.getName(), name);
            if (config == null || !userACL_.hasPermission(config)) {
                i.remove();
            }
        }
        return list;
View Full Code Here


        }
    }

    @Override
    public void export(OutputStream outputStream) throws IOException {
        PortalConfig portalConfig;
        try {
            portalConfig = dataStorage.getPortalConfig(siteKey.getTypeName(), siteKey.getName());
        } catch (Exception e) {
            throw new IOException("Could not retrieve site " + siteKey, e);
        }
View Full Code Here

        this.dataStorage = dataStorage;
    }

    @Override
    public void importData(ImportMode importMode) throws Exception {
        PortalConfig dst = dataStorage.getPortalConfig(siteKey.getTypeName(), siteKey.getName());

        switch (importMode) {
        // Really doesn't make sense to "merge" site layout data. Really two modes, conserve (keep) and overwrite.
            case CONSERVE:
                if (dst == null) {
View Full Code Here

        this.dataStorage = dataStorage;
    }

    @Override
    public void importData(ImportMode importMode) throws Exception {
        PortalConfig portalConfig = dataStorage.getPortalConfig(siteKey.getTypeName(), siteKey.getName());
        if (portalConfig == null)
            throw new Exception("Cannot import navigation because site does not exist for " + siteKey);

        Locale locale = (portalConfig.getLocale() == null) ? Locale.ENGLISH : new Locale(portalConfig.getLocale());

        final NavigationContext navContext = navigationService.loadNavigation(siteKey);
        if (navContext == null) {
            rollbackTask = new RollbackTask() {
                @Override
View Full Code Here

                if (SiteLayoutExportTask.FILES.contains(file)) {
                    // Unmarshal site layout data
                    Marshaller<PortalConfig> marshaller = operationContext.getBindingProvider().getMarshaller(
                            PortalConfig.class, ContentType.XML);
                    PortalConfig portalConfig = marshaller.unmarshal(zis);
                    portalConfig.setType(siteKey.getTypeName());
                    if (!portalConfig.getName().equals(siteKey.getName())) {
                        throw new OperationException(operationName,
                                "Name of site does not match that of the zip entry site name.");
                    }

                    // Add import task to run later
View Full Code Here

        this.src = portal;
        this.service = dataStorage_;
    }

    public void perform() throws Exception {
        PortalConfig existingPortalConfig = service.getPortalConfig(src.getType(), src.getName());
        PortalConfig dst = null;

        //
        switch (mode) {
            case CONSERVE:
                dst = null;
View Full Code Here

            writer.writeEndElement();
        }
    }

    private PortalConfig unmarshalPortalConfig(StaxNavigator<Element> navigator) throws XMLStreamException {
        PortalConfig portalConfig = new PortalConfig();

        Container portalLayout = null;
        Element current = navigator.child();
        while (current != null) {
            switch (current) {
                case PORTAL_NAME:
                    portalConfig.setName(navigator.getContent());
                    current = navigator.sibling();
                    break;
                case LOCALE:
                    portalConfig.setLocale(navigator.getContent());
                    current = navigator.sibling();
                    break;
                case LABEL:
                    portalConfig.setLabel(navigator.getContent());
                    current = navigator.sibling();
                    break;
                case DESCRIPTION:
                    portalConfig.setDescription(navigator.getContent());
                    current = navigator.sibling();
                    break;
                case SKIN:
                    portalConfig.setSkin(navigator.getContent());
                    current = navigator.sibling();
                    break;
                case PROPERTIES:
                    Properties properties = new Properties();
                    if (navigator.navigate(Axis.CHILD, Element.PROPERTIES_ENTRY)) {
                        for (StaxNavigator<Element> fork : navigator.fork(Element.PROPERTIES_ENTRY)) {
                            String key = getRequiredAttribute(fork, Attribute.PROPERTIES_KEY.getLocalName());
                            String value = getRequiredContent(fork, false);
                            properties.put(key, value);
                        }
                    } else {
                        throw expectedElement(navigator, Element.PROPERTIES_ENTRY);
                    }
                    portalConfig.setProperties(properties);
                    current = navigator.next();
                    break;
                case ACCESS_PERMISSIONS:
                    portalConfig.setAccessPermissions(unmarshalAccessPermissions(navigator, false));
                    current = navigator.sibling();
                    break;
                case EDIT_PERMISSION:
                    portalConfig.setEditPermission(unmarshalEditPermission(navigator));
                    current = navigator.sibling();
                    break;
                case PORTAL_REDIRECTS:
                    portalConfig.setPortalRedirects((ArrayList<PortalRedirect>) redirectXmlHandler.read(navigator.fork()));
                    current = navigator.sibling();
                    break;
                case PORTAL_LAYOUT:
                    portalLayout = new Container();
                    current = navigator.child();
                    break;
                case MOVE_APPLICATIONS_PERMISSIONS:
                    if (portalLayout == null) {
                        throw expectedElement(navigator, Element.PORTAL_LAYOUT);
                    }
                    portalLayout.setMoveAppsPermissions(unmarshalPermissions(navigator, false));
                    current = navigator.sibling();
                    break;
                case MOVE_CONTAINERS_PERMISSIONS:
                    if (portalLayout == null) {
                        throw expectedElement(navigator, Element.PORTAL_LAYOUT);
                    }
                    portalLayout.setMoveContainersPermissions(unmarshalPermissions(navigator, false));
                    current = navigator.sibling();
                    break;
                case PAGE_BODY:
                    if (portalLayout == null) {
                        throw expectedElement(navigator, Element.PORTAL_LAYOUT);
                    }
                    portalLayout.getChildren().add(new PageBody());
                    current = navigator.sibling();
                    break;
                case PORTLET_APPLICATION:
                    if (portalLayout == null) {
                        throw expectedElement(navigator, Element.PORTAL_LAYOUT);
                    }
                    portalLayout.getChildren().add(unmarshalPortletApplication(navigator.fork()));
                    current = navigator.sibling();
                    break;
                case GADGET_APPLICATION:
                    if (portalLayout == null) {
                        throw expectedElement(navigator, Element.PORTAL_LAYOUT);
                    }
                    portalLayout.getChildren().add(unmarshalGadgetApplication(navigator.fork()));
                    current = navigator.sibling();
                    break;
                case CONTAINER:
                    if (portalLayout == null) {
                        throw expectedElement(navigator, Element.PORTAL_LAYOUT);
                    }
                    portalLayout.getChildren().add(unmarshalContainer(navigator.fork()));
                    current = navigator.sibling();
                    break;
                case UNKNOWN:
                    throw unknownElement(navigator);
                default:
                    throw unexpectedElement(navigator);
            }
        }

        // TODO: We should raise this exception as soon as we know so location is accurate
        if (portalConfig.getAccessPermissions() == null)
            throw expectedElement(navigator, Element.ACCESS_PERMISSIONS);
        if (portalLayout == null) {
            portalLayout = PortalConfig.DEFAULT_LAYOUT;
        } else {
            int count = countPageBodyElements(portalLayout, 0);
            if (count < 1) {
                throw new StaxNavException("No page-body element found.");
            } else if (count > 1) {
                throw new StaxNavException("Multiple page-body elements found.");
            }
        }

        portalConfig.setPortalLayout(portalLayout);

        return portalConfig;
    }
View Full Code Here

            throws ResourceNotFoundException, OperationException {
        DataStorage dataStorage = operationContext.getRuntimeContext().getRuntimeComponent(DataStorage.class);
        SiteKey siteKey = getSiteKey(site);

        try {
            PortalConfig portalConfig = dataStorage.getPortalConfig(siteKey.getTypeName(), siteKey.getName());
            resultHandler.completed(portalConfig);
        } catch (Exception e) {
            throw new OperationException(operationContext.getOperationName(),
                    "Could not retrieve site layout for site " + site, e);
        }
View Full Code Here

    public static PageBody copy(PageBody existing) {
        return new PageBody();
    }

    public static PortalConfig copy(PortalConfig existing) {
        PortalConfig portalConfig = new PortalConfig(existing.getType(), existing.getName());
        portalConfig.setAccessPermissions(copy(existing.getAccessPermissions()));
        portalConfig.setDescription(existing.getDescription());
        portalConfig.setEditPermission(existing.getEditPermission());
        portalConfig.setLabel(existing.getLabel());
        portalConfig.setLocale(existing.getLocale());
        portalConfig.setModifiable(existing.isModifiable());
        portalConfig.setPortalLayout(copy(existing.getPortalLayout()));
        portalConfig.setProperties(new Properties(existing.getProperties()));

        return portalConfig;
    }
View Full Code Here

        UserPortalConfigService configService = this.getApplicationComponent(UserPortalConfigService.class);
        Set<String> portalTemplates = configService.getPortalTemplates();
        for (String tempName : portalTemplates) {
            SelectItemCategory category = new SelectItemCategory(tempName);
            PortalConfig config = configService.getPortalConfigFromTemplate(tempName);
            if (config != null) {
                SelectItemOption<String> option = new SelectItemOption<String>(config.getLabel(), tempName,
                        config.getDescription(), tempName);
                category.addSelectItemOption(option);
                uiTemplateInput.getItemCategories().add(category);
            }
        }
        if (uiTemplateInput.getSelectedItemOption() == null) {
View Full Code Here

TOP

Related Classes of org.exoplatform.portal.config.model.PortalConfig

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.