use of com.agiletec.aps.system.common.entity.model.IApsEntity in project entando-core by entando.
the class ApsEntityManager method reloadEntityReferences.
protected void reloadEntityReferences(String entityId) {
try {
IApsEntity entity = this.getEntity(entityId);
if (entity != null) {
this.getEntityDao().reloadEntitySearchRecords(entityId, entity);
}
logger.info("Entities search references reloaded {}", entityId);
} catch (Throwable t) {
logger.error("Error reloading the entities search references: {}", entityId, t);
}
}
use of com.agiletec.aps.system.common.entity.model.IApsEntity in project entando-core by entando.
the class ApsEntityManager method createEntityFromXml.
/**
* Create and populate the entity as specified by its type and XML
* definition.
*
* @param entityTypeCode The Entity Type code.
* @param xml The XML of the associated entity.
* @return The populated entity.
* @throws ApsSystemException If errors detected while retrieving the
* entity.
*/
protected IApsEntity createEntityFromXml(String entityTypeCode, String xml) throws ApsSystemException {
try {
IApsEntity entityPrototype = this.getEntityPrototype(entityTypeCode);
SAXParserFactory parseFactory = SAXParserFactory.newInstance();
SAXParser parser = parseFactory.newSAXParser();
InputSource is = new InputSource(new StringReader(xml));
EntityHandler handler = this.getEntityHandler();
handler.initHandler(entityPrototype, this.getXmlAttributeRootElementName(), this.getCategoryManager());
parser.parse(is, handler);
return entityPrototype;
} catch (ParserConfigurationException | SAXException | IOException t) {
logger.error("Error detected while creating the entity. typecode: {} - xml: {}", entityTypeCode, xml, t);
throw new ApsSystemException("Error detected while creating the entity", t);
}
}
use of com.agiletec.aps.system.common.entity.model.IApsEntity in project entando-core by entando.
the class ApsEntityManager method getEntityPrototypes.
@Override
public Map<String, IApsEntity> getEntityPrototypes() {
Map<String, IApsEntity> prototypes = new HashMap<>();
Map<String, IApsEntity> mainPrototypes = this.getEntityTypes();
Iterator<String> iter = mainPrototypes.keySet().iterator();
while (iter.hasNext()) {
String code = iter.next();
IApsEntity mainPrototype = mainPrototypes.get(code);
prototypes.put(code, mainPrototype.getEntityPrototype());
}
return prototypes;
}
use of com.agiletec.aps.system.common.entity.model.IApsEntity in project entando-core by entando.
the class ContentFinderAction method createBaseFilters.
@SuppressWarnings("rawtypes")
protected void createBaseFilters() {
try {
int initSize = this.getFilters().length;
ContentFinderSearchInfo searchInfo = getContentSearchInfo();
EntitySearchFilter[] roleFilters = this.getEntityActionHelper().getRoleFilters(this);
this.addFilters(roleFilters);
IApsEntity prototype = this.getEntityPrototype();
searchInfo.removeFilter(IEntityManager.ENTITY_TYPE_CODE_FILTER_KEY);
searchInfo.removeFilterByPrefix(ContentFinderSearchInfo.ATTRIBUTE_FILTER);
if (null != prototype) {
EntitySearchFilter filterToAdd = new EntitySearchFilter(IEntityManager.ENTITY_TYPE_CODE_FILTER_KEY, false, prototype.getTypeCode(), false);
this.addFilter(filterToAdd);
searchInfo.addFilter(IEntityManager.ENTITY_TYPE_CODE_FILTER_KEY, filterToAdd);
EntitySearchFilter[] filters = this.getEntityActionHelper().getAttributeFilters(this, prototype);
this.addFilters(filters);
searchInfo.addAttributeFilters(filters);
}
this.setAddedAttributeFilter(this.getFilters().length > initSize);
} catch (Throwable t) {
_logger.error("Error while creating entity filters", t);
throw new RuntimeException("Error while creating entity filters", t);
}
}
use of com.agiletec.aps.system.common.entity.model.IApsEntity in project entando-core by entando.
the class AbstractApsEntityFinderAction method getEntityPrototypes.
public List<IApsEntity> getEntityPrototypes() {
List<IApsEntity> entityPrototypes = null;
try {
Map<String, IApsEntity> modelMap = this.getEntityManager().getEntityPrototypes();
entityPrototypes = new ArrayList<IApsEntity>(modelMap.values());
BeanComparator comparator = new BeanComparator("typeDescr");
Collections.sort(entityPrototypes, comparator);
} catch (Throwable t) {
_logger.error("Error while extracting entity prototypes", t);
throw new RuntimeException("Error while extracting entity prototypes", t);
}
return entityPrototypes;
}
Aggregations