use of com.agiletec.aps.system.services.category.Category in project entando-core by entando.
the class TestContentBulkCommand method initCategoriesCommand.
private BaseContentPropertyBulkCommand<Category> initCategoriesCommand(String commandBeanName, Collection<String> items, Collection<Category> categories, UserDetails currentUser) {
ApplicationContext applicationContext = this.getApplicationContext();
BaseContentPropertyBulkCommand<Category> command = (BaseContentPropertyBulkCommand<Category>) applicationContext.getBean(commandBeanName);
ContentPropertyBulkCommandContext<Category> context = new ContentPropertyBulkCommandContext<Category>(items, categories, currentUser, new DefaultBulkCommandTracer<String>());
command.init(context);
return command;
}
use of com.agiletec.aps.system.services.category.Category in project entando-core by entando.
the class AbstractResource method getResourceDOM.
/**
* Restituisce la classe dom (necessaria per la generazione dell'xml della risorsa)
* preparata con gli attributi base della risorsa.
* @return La classe dom preparata con gli attributi base della risorsa.
*/
protected ResourceDOM getResourceDOM() {
ResourceDOM resourceDom = this.getNewResourceDOM();
resourceDom.setTypeCode(this.getType());
resourceDom.setId(this.getId());
resourceDom.setDescription(this.getDescription());
resourceDom.setMainGroup(this.getMainGroup());
resourceDom.setMasterFileName(this.getMasterFileName());
if (null != this.getCategories()) {
for (int i = 0; i < this.getCategories().size(); i++) {
Category cat = (Category) this.getCategories().get(i);
resourceDom.addCategory(cat.getCode());
}
}
return resourceDom;
}
use of com.agiletec.aps.system.services.category.Category in project entando-core by entando.
the class IndexerDAO method createDocument.
/**
* Crea un oggetto Document pronto per l'indicizzazione da un oggetto Content.
* @param entity Il contenuto dal quale ricavare il Document.
* @return L'oggetto Document ricavato dal contenuto.
* @throws ApsSystemException In caso di errore
*/
protected Document createDocument(IApsEntity entity) throws ApsSystemException {
Document document = new Document();
document.add(new StringField(CONTENT_ID_FIELD_NAME, entity.getId(), Field.Store.YES));
document.add(new TextField(CONTENT_TYPE_FIELD_NAME, entity.getTypeCode(), Field.Store.YES));
document.add(new StringField(CONTENT_GROUP_FIELD_NAME, entity.getMainGroup(), Field.Store.YES));
Iterator<String> iterGroups = entity.getGroups().iterator();
while (iterGroups.hasNext()) {
String groupName = (String) iterGroups.next();
document.add(new StringField(CONTENT_GROUP_FIELD_NAME, groupName, Field.Store.YES));
}
try {
EntityAttributeIterator attributesIter = new EntityAttributeIterator(entity);
while (attributesIter.hasNext()) {
AttributeInterface currentAttribute = (AttributeInterface) attributesIter.next();
List<Lang> langs = this.getLangManager().getLangs();
for (int i = 0; i < langs.size(); i++) {
Lang currentLang = (Lang) langs.get(i);
this.indexAttribute(document, currentAttribute, currentLang);
}
}
List<Category> categories = entity.getCategories();
if (null != categories && !categories.isEmpty()) {
for (int i = 0; i < categories.size(); i++) {
Category category = categories.get(i);
this.indexCategory(document, category);
}
}
} catch (Throwable t) {
_logger.error("Error creating document", t);
throw new ApsSystemException("Error creating document", t);
}
return document;
}
use of com.agiletec.aps.system.services.category.Category in project entando-core by entando.
the class ResourceDAO method addCategoryCode.
private void addCategoryCode(ResourceInterface resource, Category category, Set<String> codes) {
if (category.getCode().equals(category.getParent().getCode())) {
return;
}
codes.add(category.getCode());
Category parentCategory = (Category) category.getParent();
if (null != parentCategory) {
this.addCategoryCode(resource, parentCategory, codes);
}
}
use of com.agiletec.aps.system.services.category.Category in project entando-core by entando.
the class EntityWrapper method getCategories.
/**
* Return the categories list of the entity.
* @return The list of categories.
*/
public List<Category> getCategories() {
List<Category> categories = new ArrayList<Category>();
List<Category> contentCategories = this._entity.getCategories();
for (int i = 0; i < contentCategories.size(); i++) {
Category cat = contentCategories.get(i);
Category clone = cat.getCloneForWrapper();
clone.setRenderingLang(this._renderingLang);
categories.add(clone);
}
return categories;
}
Aggregations