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());
}
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());
}
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());
}
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;
}
}
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;
}
Aggregations