Search in sources :

Example 16 with Category

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

the class TestResourceFinderAction method testViewImageResourcesByCustomerUser.

public void testViewImageResourcesByCustomerUser() throws Throwable {
    String result = this.executeShowList("editorCustomers", "Image");
    assertEquals(Action.SUCCESS, result);
    ResourceFinderAction action = (ResourceFinderAction) this.getAction();
    String resourceTypeCode = action.getResourceTypeCode();
    assertNotNull(resourceTypeCode);
    assertEquals("Image", resourceTypeCode);
    assertEquals(1, action.getResources().size());
    Category root = ((ResourceFinderAction) action).getCategoryRoot();
    assertNotNull(root);
    assertEquals("Home", root.getTitle());
}
Also used : Category(com.agiletec.aps.system.services.category.Category)

Example 17 with Category

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

the class TestResourceFinderAction method testViewImageResources.

public void testViewImageResources() throws Throwable {
    String result = this.executeShowList("admin", "Image");
    assertEquals(Action.SUCCESS, result);
    ResourceFinderAction action = (ResourceFinderAction) this.getAction();
    String resourceTypeCode = action.getResourceTypeCode();
    assertNotNull(resourceTypeCode);
    assertEquals("Image", resourceTypeCode);
    assertEquals(3, action.getResources().size());
    Category root = ((ResourceFinderAction) action).getCategoryRoot();
    assertNotNull(root);
    assertEquals("Home", root.getTitle());
}
Also used : Category(com.agiletec.aps.system.services.category.Category)

Example 18 with Category

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

the class TestResourceFinderAction method testViewAttachResources.

public void testViewAttachResources() throws Throwable {
    String result = this.executeShowList("admin", "Attach");
    assertEquals(Action.SUCCESS, result);
    ResourceFinderAction action = (ResourceFinderAction) this.getAction();
    String resourceTypeCode = action.getResourceTypeCode();
    assertNotNull(resourceTypeCode);
    assertEquals("Attach", resourceTypeCode);
    assertEquals(1, action.getResources().size());
    Category root = ((ResourceFinderAction) action).getCategoryRoot();
    assertNotNull(root);
    assertEquals("Home", root.getTitle());
}
Also used : Category(com.agiletec.aps.system.services.category.Category)

Example 19 with Category

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

the class TestTrashReferencedCategory method testTrashReferencedCategory.

public void testTrashReferencedCategory() throws Throwable {
    String categoryCode = "evento";
    Category masterCategory = this._categoryManager.getCategory(categoryCode);
    assertNotNull(masterCategory);
    try {
        this.setUserOnSession("admin");
        this.initAction("/do/Category", "trash");
        this.addParameter("selectedNode", categoryCode);
        String result = this.executeAction();
        assertEquals("references", result);
        CategoryAction action = (CategoryAction) this.getAction();
        Map<String, List> references = action.getReferences();
        assertEquals(2, references.size());
        List contentReferences = references.get(JacmsSystemConstants.CONTENT_MANAGER + "Utilizers");
        assertEquals(2, contentReferences.size());
        for (int i = 0; i < contentReferences.size(); i++) {
            String contentId = (String) contentReferences.get(i);
            assertTrue(contentId.equals("EVN193") || contentId.equals("EVN192"));
        }
    } catch (Throwable t) {
        throw t;
    }
}
Also used : Category(com.agiletec.aps.system.services.category.Category) List(java.util.List) CategoryAction(com.agiletec.apsadmin.category.CategoryAction)

Example 20 with Category

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

the class JAXBEntity method buildEntity.

public IApsEntity buildEntity(IApsEntity prototype, ICategoryManager categoryManager) {
    try {
        prototype.setDescription(this.getDescription());
        prototype.setId(this.getId());
        prototype.setMainGroup(this.getMainGroup());
        prototype.setTypeCode(this.getTypeCode());
        prototype.setTypeDescription(this.getTypeDescription());
        if (null != this.getGroups() && !this.getGroups().isEmpty()) {
            Iterator<String> iter = this.getGroups().iterator();
            while (iter.hasNext()) {
                prototype.addGroup(iter.next());
            }
        }
        if (null != this.getCategories() && !this.getCategories().isEmpty()) {
            Iterator<String> iter = this.getCategories().iterator();
            while (iter.hasNext()) {
                String categoryCode = iter.next();
                Category category = categoryManager.getCategory(categoryCode);
                if (null != category) {
                    prototype.addCategory(category);
                }
            }
        }
        if (null == this.getAttributes()) {
            return prototype;
        }
        for (int i = 0; i < this.getAttributes().size(); i++) {
            AbstractJAXBAttribute jaxrAttribute = this.getAttributes().get(i);
            AttributeInterface attribute = (AttributeInterface) prototype.getAttribute(jaxrAttribute.getName());
            if (null != attribute && attribute.getType().equals(jaxrAttribute.getType())) {
                attribute.valueFrom(jaxrAttribute);
            }
        }
    } catch (Throwable t) {
        _logger.error("Error creating Entity", t);
        throw new RuntimeException("Error creating Entity", t);
    }
    return prototype;
}
Also used : Category(com.agiletec.aps.system.services.category.Category) AbstractJAXBAttribute(com.agiletec.aps.system.common.entity.model.attribute.AbstractJAXBAttribute) AttributeInterface(com.agiletec.aps.system.common.entity.model.attribute.AttributeInterface)

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