Package org.gatein.api.site

Examples of org.gatein.api.site.Site$AttributeKeys


        ((SiteImpl) site).save(dataStorage, userPortalConfigService);
    }

    @Override
    public boolean removeSite(SiteId siteId) {
        Site site = getSite(siteId);
        if (site == null) {
            return false;
        }
        SiteKey siteKey = Util.from(Parameters.requireNonNull(siteId, "siteId"));
        PortalConfig data = new PortalConfig(siteKey.getTypeName(), siteKey.getName());
View Full Code Here


        ((SiteImpl) site).save(dataStorage, userPortalConfigService);
    }

    @Override
    public boolean removeSite(SiteId siteId) {
        Site site = getSite(siteId);
        if (site == null) {
            return false;
        }
        SiteKey siteKey = Util.from(Parameters.requireNonNull(siteId, "siteId"));
        PortalConfig data = new PortalConfig(siteKey.getTypeName(), siteKey.getName());
View Full Code Here

    }

    String resolve(NodeContext<ApiNode> ctx) {
        if (i18nResolver == null) {
            PortalRequest request = PortalRequest.getInstance();
            Site site;
            if (request.getSiteId().equals(siteId)) {
                site = request.getSite();
            } else { // look it up
                site = request.getPortal().getSite(siteId);
            }

            if (site == null) {
                throw new ApiException("Could not resolve display name because site " + siteId + " could not be found.");
            }

            i18nResolver = new Navigation18NResolver(descriptionService, bundleManager, site.getLocale(), siteId);
        }

        return i18nResolver.resolveName(ctx.getState().getLabel(), ctx.getId(), ctx.getName());
    }
View Full Code Here

        ((SiteImpl) site).save(dataStorage, userPortalConfigService);
    }

    @Override
    public boolean removeSite(SiteId siteId) {
        Site site = getSite(siteId);
        if (site == null) {
            return false;
        }
        SiteKey siteKey = Util.from(Parameters.requireNonNull(siteId, "siteId"));
        PortalConfig data = new PortalConfig(siteKey.getTypeName(), siteKey.getName());
View Full Code Here

            return null;
        } else if (sorting.getComparator() == null) {
            return new Comparator<PortalConfig>() {
                @Override
                public int compare(PortalConfig o1, PortalConfig o2) {
                    Site site = new SiteImpl(o1);
                    Site other = new SiteImpl(o2);
                    if (sorting.getOrder() == Sorting.Order.descending) {
                        Site tmp = site;
                        site = other;
                        other = tmp;
                    }

                    return site.compareTo(other);
View Full Code Here

        ((SiteImpl) site).save(dataStorage, userPortalConfigService);
    }

    @Override
    public boolean removeSite(SiteId siteId) {
        Site site = getSite(siteId);
        if (site == null) {
            return false;
        }
        SiteKey siteKey = Util.from(Parameters.requireNonNull(siteId, "siteId"));
        PortalConfig data = new PortalConfig(siteKey.getTypeName(), siteKey.getName());
View Full Code Here

        List<Site> sites = portal.findSites(query);
        return populateModel(sites, modelProvider.newModel(ModelList.class), address);
    }

    private ModelObject _getSite(SiteId id, OperationContext context) {
        Site site = requireSite(id, context);

        // Populate site model
        return populateModel(site, modelProvider.newModel(ModelObject.class), context.getAddress());
    }
View Full Code Here

        // Populate site model
        return populateModel(site, modelProvider.newModel(ModelObject.class), context.getAddress());
    }

    private ModelObject _addSite(PathAddress address, SiteId siteId, String template) {
        Site site;
        try {
            if (template == null) {
                site = portal.createSite(siteId);
            } else {
                site = portal.createSite(siteId, template);
View Full Code Here

            throw notFound("Cannot remove site", id);
        }
    }

    private ModelObject _updateSite(SiteId id, ModelObject siteModel, OperationContext context) {
        Site site = requireSite(id, context);

        if (siteModel.has("displayName")) {
            String displayName = get(siteModel, ModelString.class, "displayName").getValue();
            site.setDisplayName(displayName);
        }
        if (siteModel.has("description")) {
            String description = get(siteModel, ModelString.class, "description").getValue();
            site.setDescription(description);
        }
        if (siteModel.has("skin")) {
            String skin = get(siteModel, ModelString.class, "skin").getValue();
            site.setSkin(skin);
        }
        if (siteModel.has("locale")) {
            Locale locale = getLocale(siteModel, "locale");
            site.setLocale(locale);
        }
        if (siteModel.has("access-permissions")) {
            Permission permission = getPermission(siteModel, false, "access-permissions");
            site.setAccessPermission(permission);
        }
        if (siteModel.has("edit-permissions")) {
            Permission permission = getPermission(siteModel, true, "edit-permissions");
            site.setEditPermission(permission);
        }
        if (siteModel.hasDefined("attributes")) {
            ModelList list = get(siteModel, ModelList.class, "attributes");
            for (int i = 0; i < list.size(); i++) {
                ModelValue mv = list.get(i);
                String field = "attributes["+i+"]"; // Used for error reporting
                if (mv.getValueType() != ModelValue.ModelValueType.OBJECT) {
                    throw invalidType(mv, ModelValue.ModelValueType.OBJECT, field);
                }
                ModelObject attrModel = mv.asValue(ModelObject.class);
                if (!attrModel.hasDefined("key")) {
                    throw requiredField(field, "key");
                }
                String key = get(attrModel, ModelString.class, "key").getValue();
                if (!attrModel.has("value")) {
                    throw requiredField(field, "value");
                }
                String value = get(attrModel, ModelString.class, "value").getValue();
                site.getAttributes().put(key, value);
            }
        }

        portal.saveSite(site);
View Full Code Here

        return populateModel(site, modelProvider.newModel(ModelObject.class), context.getAddress());
    }

    private Site requireSite(SiteId id, OperationContext context) {
        Site site = portal.getSite(id);
        if (site == null) throw new ResourceNotFoundException("Site not found for " + id);

        // Verify current user has access to site
        verifyAccess(site, context);
View Full Code Here

TOP

Related Classes of org.gatein.api.site.Site$AttributeKeys

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.