Search in sources :

Example 21 with Category

use of com.agiletec.aps.system.services.category.Category in project entando-core by entando.

the class ContentDAO method addCategoryCode.

private void addCategoryCode(Category category, Set<String> codes) {
    codes.add(category.getCode());
    Category parentCategory = (Category) category.getParent();
    if (null != parentCategory && !parentCategory.getCode().equals(parentCategory.getParentCode())) {
        this.addCategoryCode(parentCategory, codes);
    }
}
Also used : Category(com.agiletec.aps.system.services.category.Category)

Example 22 with Category

use of com.agiletec.aps.system.services.category.Category in project entando-core by entando.

the class ResourceAction method edit.

/**
 * Executes the specific action to modify an existing resource.
 *
 * @return The result code.
 */
public String edit() {
    try {
        ResourceInterface resource = this.loadResource(this.getResourceId());
        this.setResourceTypeCode(resource.getType());
        this.setDescr(resource.getDescription());
        List<Category> resCategories = resource.getCategories();
        for (int i = 0; i < resCategories.size(); i++) {
            Category resCat = resCategories.get(i);
            this.getCategoryCodes().add(resCat.getCode());
        }
        this.setMainGroup(resource.getMainGroup());
        this.setStrutsAction(ApsAdminSystemConstants.EDIT);
    } catch (Throwable t) {
        _logger.error("error in edit", t);
        return FAILURE;
    }
    return SUCCESS;
}
Also used : Category(com.agiletec.aps.system.services.category.Category) ResourceInterface(com.agiletec.plugins.jacms.aps.system.services.resource.model.ResourceInterface)

Example 23 with Category

use of com.agiletec.aps.system.services.category.Category in project entando-core by entando.

the class ContentCategoryAction method removeCategory.

/**
 * Performs the action of removing a category from the content.
 * @return The result code.
 */
public String removeCategory() {
    this.updateContentOnSession();
    try {
        String categoryCode = this.getCategoryCode();
        Category category = this.getCategoryManager().getCategory(categoryCode);
        if (null != category) {
            this.getContent().removeCategory(category);
        }
    } catch (Throwable t) {
        _logger.error("error in removeCategory", t);
        return FAILURE;
    }
    return SUCCESS;
}
Also used : Category(com.agiletec.aps.system.services.category.Category)

Example 24 with Category

use of com.agiletec.aps.system.services.category.Category in project entando-core by entando.

the class TestContentBulkCommand method testCategoryCommands.

public void testCategoryCommands() {
    Collection<String> items = new ArrayList<String>();
    Collection<Category> categories = new ArrayList<Category>();
    UserDetails currentUser = null;
    BaseContentPropertyBulkCommand<Category> categoryCommand = this.initCategoriesCommand(JoinCategoryBulkCommand.BEAN_NAME, items, categories, currentUser);
    assertNotNull(categoryCommand);
    categoryCommand = this.initCategoriesCommand(RemoveCategoryBulkCommand.BEAN_NAME, items, categories, currentUser);
    assertNotNull(categoryCommand);
}
Also used : Category(com.agiletec.aps.system.services.category.Category) UserDetails(com.agiletec.aps.system.services.user.UserDetails) ArrayList(java.util.ArrayList)

Example 25 with Category

use of com.agiletec.aps.system.services.category.Category in project entando-core by entando.

the class EntityHandler method startCategory.

private void startCategory(Attributes attributes, String qName) throws SAXException {
    if (this._categoryManager != null) {
        String categoryCode = extractXmlAttribute(attributes, "id", qName, true);
        Category category = this._categoryManager.getCategory(categoryCode);
        if (null != category) {
            this._currentEntity.addCategory(category);
        }
    }
}
Also used : Category(com.agiletec.aps.system.services.category.Category)

Aggregations

Category (com.agiletec.aps.system.services.category.Category)91 ArrayList (java.util.ArrayList)23 ITreeNode (com.agiletec.aps.system.common.tree.ITreeNode)9 ResourceNotFoundException (org.entando.entando.aps.system.exception.ResourceNotFoundException)7 AttributeInterface (com.agiletec.aps.system.common.entity.model.attribute.AttributeInterface)6 TextAttribute (com.agiletec.aps.system.common.entity.model.attribute.TextAttribute)6 List (java.util.List)6 ValidationGenericException (org.entando.entando.web.common.exceptions.ValidationGenericException)6 ApsSystemException (com.agiletec.aps.system.exception.ApsSystemException)5 Content (com.agiletec.plugins.jacms.aps.system.services.content.model.Content)5 RestServerError (org.entando.entando.aps.system.exception.RestServerError)5 ICategoryManager (com.agiletec.aps.system.services.category.ICategoryManager)4 Lang (com.agiletec.aps.system.services.lang.Lang)4 ResourceInterface (com.agiletec.plugins.jacms.aps.system.services.resource.model.ResourceInterface)4 CategoryDto (org.entando.entando.aps.system.services.category.model.CategoryDto)4 IDataObjectSearchEngineManager (org.entando.entando.aps.system.services.dataobjectsearchengine.IDataObjectSearchEngineManager)4 SearchEngineManager (org.entando.entando.aps.system.services.dataobjectsearchengine.SearchEngineManager)4 Cache (org.springframework.cache.Cache)4 CategoryUtilizer (com.agiletec.aps.system.services.category.CategoryUtilizer)3 HashSet (java.util.HashSet)3