Loads the app categories.<p>

@return the app categories
10234
private Map<String, I_CmsAppCategory> loadCategories() {

        Map<String, I_CmsAppCategory> appCategories = new HashMap<String, I_CmsAppCategory>();
        CmsAppCategory main = new CmsAppCategory(MAIN_CATEGORY_ID, null, 0, 0);
        appCategories.put(main.getId(), main);
        CmsAppCategory admin = new CmsAppCategory(ADMINISTRATION_CATEGORY_ID, null, 5, 0);
        appCategories.put(admin.getId(), admin);
        CmsAppCategory legacy = new CmsAppCategory(LEGACY_CATEGORY_ID, null, 10, 0);
        appCategories.put(legacy.getId(), legacy);
        List<I_CmsFolderAppCategory> folder = loadAppFolder();
        for (I_CmsFolderAppCategory appFolder : folder) {
            appCategories.put(appFolder.getId(), appFolder);
        }
        Iterator<I_CmsAppCategory> categoryIt = ServiceLoader.load(I_CmsAppCategory.class).iterator();
        while (categoryIt.hasNext()) {
            try {
                I_CmsAppCategory cat = categoryIt.next();
                if (!appCategories.containsKey(cat.getId())
                    || (appCategories.get(cat.getId()).getPriority() < cat.getPriority())) {
                    appCategories.put(cat.getId(), cat);
                }
            } catch (Throwable t) {
                LOG.error("Error loading workplace app category from classpath.", t);
            }
        }
        return appCategories;
    }
915052
public CmsAppCategoryNode buildHierarchy() {

        // STEP 0: Initialize everything and sort categories by priority

        Collections.sort(m_appCategoryList, new Comparator<I_CmsAppCategory>() {

            public int compare(I_CmsAppCategory cat1, I_CmsAppCategory cat2) {

                return ComparisonChain.start().compare(cat1.getPriority(), cat2.getPriority()).result();
            }
        });
        m_rootNode = new CmsAppCategoryNode();
        m_nodes.clear();
        m_nodes.put(null, m_rootNode);

        // STEP 1: Create a node for each category

        for (I_CmsAppCategory category : m_appCategoryList) {
            m_nodes.put(category.getId(), new CmsAppCategoryNode(category));
        }

        // STEP 2: Assign category nodes to nodes for their parent category

        for (CmsAppCategoryNode node : m_nodes.values()) {
            if (node != m_rootNode) {
                addNodeToItsParent(node);
            }
        }

        // STEP 3: Assign app configs to category nodes

        for (I_CmsWorkplaceAppConfiguration appConfig : m_appConfigs) {
            addAppConfigToCategory(appConfig);
        }

        // STEP 4: Validate whether there are unused categories / apps

        Set<String> usedNodes = findReachableNodes(m_rootNode, new HashSet<String>());
        if (usedNodes.size() < m_nodes.size()) {
            LOG.warn("Unused app categories: " + Sets.difference(m_nodes.keySet(), usedNodes));
        }
        Set<String> unusedApps = Sets.newHashSet();
        for (I_CmsWorkplaceAppConfiguration appConfig : m_appConfigs) {
            if (!usedNodes.contains(appConfig.getAppCategory())) {
                unusedApps.add(appConfig.getId());
            }
        }
        if (unusedApps.size() > 0) {
            LOG.warn("Unused apps: " + unusedApps);
        }

        // STEP 5: Remove parts of the hierarchy which don't contain any apps
        m_rootNode.removeApplessSubtrees();

        // STEP 6: Sort all categories and app configurations for each node
        m_rootNode.sortRecursively();

        return m_rootNode;
    }
639316
protected List<CmsResource> getCategoryItems() {

        List<CmsResource> result = Collections.emptyList();
        if (CmsStringUtil.isNotEmpty(getParamGalleryPath())) {
            try {
                CmsCategoryService service = CmsCategoryService.getInstance();
                // get the edited resource if present
                String editedResource = "/";
                if (CmsStringUtil.isNotEmpty(getParamResource())) {
                    editedResource = CmsResource.getFolderPath(getParamResource());
                }
                // read the matching resources for the category
                result = service.readCategoryResources(getCms(), getParamGalleryPath(), true, editedResource);
                // filter the matched resources to get only the specific items as result
                int resTypeId = getGalleryItemsTypeId();
                if (resTypeId != -1) {
                    List<CmsResource> unfiltered = new ArrayList<CmsResource>(result);
                    result = new ArrayList<CmsResource>(unfiltered.size());
                    Iterator<CmsResource> i = unfiltered.iterator();
                    while (i.hasNext()) {
                        CmsResource res = i.next();
                        if (res.getTypeId() == resTypeId) {
                            result.add(res);
                        }
                    }
                }
            } catch (CmsException e) {
                // error reading resources
                if (LOG.isErrorEnabled()) {
                    LOG.error(e.getLocalizedMessage(), e);
                }
            } catch (NullPointerException e) {
                // ignore this exception
                if (LOG.isErrorEnabled()) {
                    LOG.error(e.getLocalizedMessage(), e);
                }
            }
        }
        return result;
    }
637482
def get_application_modules(self):
        
        modules = []
        appgroups = get_application_groups()
        for title, kwargs in appgroups:
            AppListClass = get_class(kwargs.pop('module'))  # e.g. CmsAppIconlist, AppIconlist, Applist
            modules.append(AppListClass(title, **kwargs))
        return modules
461351
private List<I_CmsWorkplaceAppConfiguration> loadAppsUsingServiceLoader() {

        List<I_CmsWorkplaceAppConfiguration> appConfigurations = new ArrayList<I_CmsWorkplaceAppConfiguration>();
        Iterator<I_CmsWorkplaceAppConfiguration> configs = ServiceLoader.load(
            I_CmsWorkplaceAppConfiguration.class).iterator();
        while (configs.hasNext()) {
            try {
                I_CmsWorkplaceAppConfiguration config = configs.next();
                appConfigurations.add(config);
            } catch (Throwable t) {
                LOG.error("Error loading workplace app configuration from classpath.", t);
            }
        }
        return appConfigurations;
    }
717817
protected List<CmsCategory> getResourceCategories() throws CmsException {

        if (m_resCats == null) {
            m_resCats = m_categoryService.readResourceCategories(getJsp().getCmsObject(), getParamResource());
        }
        return m_resCats;
    }
749166
protected function loadViews()
    {
        if (is_dir($appPath = $this->publishViewPath())) {
            view()->addNamespace($this->getKey(), $appPath);
        }

        view()->addNamespace($this->getKey(), $this->getViewsPath());
    }
1122512
public Map<Integer, String> getCategories()
    {
        if (categories == null)
        {
            categories = new TreeMap<>();
        }

        Map<String, Object> responseMap = super.getAttributes();
        for (Entry<String, Object> response : responseMap.entrySet())
        {
            String key = response.getKey();
            if (key.toLowerCase(Locale.US).contains("category"))
            {
                String[] keyParts = key.split("-");

                // if it doesn't have at least category-XXXXXX, skip
                if (keyParts.length < 2)
                    continue;

                // try to get the number of this category, skip if we mess up
                Integer categoryNumber;
                try
                {
                    categoryNumber = Integer.parseInt(keyParts[1]);
                }
                catch (Exception exception)
                {
                    continue;
                }

                categories.put(categoryNumber, (String) response.getValue());
            }
        }

        return categories;
    }
977433
private void loadCategories() {

        CmsRpcAction<List<CmsCategoryTreeEntry>> action = new CmsRpcAction<List<CmsCategoryTreeEntry>>() {

            @Override
            public void execute() {

                start(200, true);
                CmsCoreProvider.getService().getCategoriesForSitePath(m_dialogBean.getReferenceSitePath(), this);
            }

            @Override
            protected void onResponse(List<CmsCategoryTreeEntry> result) {

                m_dialogBean.setCategories(result);
                m_handler.setCategoriesTabContent(result, new ArrayList<String>());
                m_handler.onCategoriesTabSelection();
                stop(false);
            }
        };
        action.execute();
    }
1025600
public Observable<List<String>> getAllCategories() {
    return getAllProducts().map(products -> {
      Set<String> categories = new HashSet<String>();
      for (Product p : products) {
        categories.add(p.getCategory());
      }

      List<String> result = new ArrayList<String>(categories.size());
      result.addAll(categories);
      return result;
    });
  }
1367295
function() {
  // Get list of dirs from app registry.
  return getAppRegistry()
  // Map app dirs to app names.
  .then(inspectDirs)
  .all()
  .tap(function(appRegistryApps) {
    log.debug(format('Apps in registry: %j', appRegistryApps));
  });

}
291452
@SuppressWarnings("unchecked")
    public Collection<CmsCategory> getSelectedCategories() {

        Set<CmsCategory> result = new HashSet<CmsCategory>();
        if (m_isDiplayOny) {
            // in case of display only, all displayed categories are assume selected
            result.addAll((Collection<? extends CmsCategory>)getItemIds());
        } else {
            for (Entry<CmsCategory, CheckBox> entry : m_checkboxes.entrySet()) {
                if (entry.getValue().getValue().booleanValue()) {
                    result.add(entry.getKey());
                }
            }
        }
        return result;
    }
319363
public Collection<ApplicationDefinition> getAllAppDefs() {
        Utils.require(!m_restClient.isClosed(), "Client has been closed");

        try {
            // Send a GET request to "/_applications" to list all applications.
        	StringBuilder uri = new StringBuilder(Utils.isEmpty(m_apiPrefix) ? "" : "/" + m_apiPrefix);          			
            uri.append("/_applications/");
            
            RESTResponse response = m_restClient.sendRequest(HttpMethod.GET, uri.toString());
            m_logger.debug("listAllApplications() response: {}", response.toString());
            throwIfErrorResponse(response);
            
            UNode rootNode = UNode.parse(response.getBody(), response.getContentType());
            List<ApplicationDefinition> appDefList = new ArrayList<ApplicationDefinition>();
            for (UNode appNode : rootNode.getMemberList()) {
                ApplicationDefinition appDef = new ApplicationDefinition();
                appDef.parse(appNode);
                appDefList.add(appDef);
            }
            return appDefList;
        } catch (Exception e) {
            throw new RuntimeException(e);
        }
    }
95840
@Override
    public Application getApplication()
    {
        if (m_application != null)
            return m_application;
        if (this.getApplet() != null)
            if (this.getApplet() != this)
                return ((BaseApplet)this.getApplet()).getApplication();
        return null;
    }
891551
public static function loadAll()
    {
        $app = Application::getFacadeApplication();
        $db = $app->make(Connection::class);
        $permissionkeys = [];
        $txt = $app->make('helper/text');
        $e = $db->executeQuery(<<<'EOT'
select pkID, pkName, pkDescription, pkHandle, pkCategoryHandle, pkCanTriggerWorkflow, pkHasCustomClass, PermissionKeys.pkCategoryID, PermissionKeyCategories.pkgID
from PermissionKeys
inner join PermissionKeyCategories on PermissionKeyCategories.pkCategoryID = PermissionKeys.pkCategoryID
EOT
        );
        while (($r = $e->fetch(PDO::FETCH_ASSOC)) !== false) {
            if ($r['pkHasCustomClass']) {
                $class = '\\Core\\Permission\\Key\\' . $txt->camelcase($r['pkHandle'] . '_' . $r['pkCategoryHandle']) . 'Key';
            } else {
                $class = '\\Core\\Permission\\Key\\' . $txt->camelcase($r['pkCategoryHandle']) . 'Key';
            }
            $pkgHandle = $r['pkgID'] ? PackageList::getHandle($r['pkgID']) : null;
            $class = core_class($class, $pkgHandle);
            $pk = $app->make($class);
            $pk->setPropertiesFromArray($r);
            $permissionkeys[$r['pkHandle']] = $pk;
            $permissionkeys[$r['pkID']] = $pk;
        }

        $cache = $app->make('cache/request');
        if ($cache->isEnabled()) {
            $cache->getItem('permission_keys')->set($permissionkeys)->save();
        }

        return $permissionkeys;
    }
450747
public String[] getCategories() {

        List<String> l = m_parameters.getCategories();
        return l.toArray(new String[l.size()]);
    }
13714
public CategoryOverview getCategories() {
        ClientResource resource = new ClientResource(Route.ALL_CATEGORY.url());

        try {
            Representation repr = resource.get();
            return mapper.readValue(repr.getText(), CategoryOverview.class);
        } catch (IOException ex) {
            LEX4JLogger.log(Level.WARNING, "Could not retrieve the categories correctly!");
            return null;
        }
    }