use of com.agiletec.aps.system.common.entity.model.AttributeSearchInfo in project entando-core by entando.
the class DateAttribute method getSearchInfos.
@Override
public List<AttributeSearchInfo> getSearchInfos(List<Lang> systemLangs) {
if (this.getDate() != null) {
List<AttributeSearchInfo> infos = new ArrayList<>();
AttributeSearchInfo info = new AttributeSearchInfo(null, this.getDate(), null, null);
infos.add(info);
return infos;
}
return null;
}
use of com.agiletec.aps.system.common.entity.model.AttributeSearchInfo in project entando-core by entando.
the class MonoTextAttribute method getSearchInfos.
@Override
public List<AttributeSearchInfo> getSearchInfos(List<Lang> systemLangs) {
if (this.getText() != null) {
List<AttributeSearchInfo> infos = new ArrayList<>();
String text = this.getText();
if (text != null && text.length() >= 255) {
text = text.substring(0, 254);
}
AttributeSearchInfo info = new AttributeSearchInfo(text, null, null, null);
infos.add(info);
return infos;
}
return null;
}
use of com.agiletec.aps.system.common.entity.model.AttributeSearchInfo in project entando-core by entando.
the class NumberAttribute method getSearchInfos.
@Override
public List<AttributeSearchInfo> getSearchInfos(List<Lang> systemLangs) {
if (this.getValue() != null) {
List<AttributeSearchInfo> infos = new ArrayList<>();
AttributeSearchInfo info = new AttributeSearchInfo(null, null, this.getValue(), null);
infos.add(info);
return infos;
}
return null;
}
use of com.agiletec.aps.system.common.entity.model.AttributeSearchInfo in project entando-core by entando.
the class AbstractEntityDAO method addEntitySearchRecord.
protected void addEntitySearchRecord(String id, IApsEntity entity, PreparedStatement stat) throws Throwable {
EntityAttributeIterator attributeIter = new EntityAttributeIterator(entity);
while (attributeIter.hasNext()) {
AttributeInterface currAttribute = (AttributeInterface) attributeIter.next();
List<AttributeSearchInfo> infos = currAttribute.getSearchInfos(this.getLangManager().getLangs());
if (currAttribute.isSearchable() && null != infos) {
for (int i = 0; i < infos.size(); i++) {
AttributeSearchInfo searchInfo = infos.get(i);
stat.setString(1, id);
stat.setString(2, currAttribute.getName());
stat.setString(3, searchInfo.getString());
if (searchInfo.getDate() != null) {
stat.setTimestamp(4, new java.sql.Timestamp(searchInfo.getDate().getTime()));
} else {
stat.setDate(4, null);
}
stat.setBigDecimal(5, searchInfo.getBigDecimal());
stat.setString(6, searchInfo.getLangCode());
stat.addBatch();
stat.clearParameters();
}
}
}
stat.executeBatch();
}
use of com.agiletec.aps.system.common.entity.model.AttributeSearchInfo in project entando-core by entando.
the class IndexerDAO method indexAttribute.
private void indexAttribute(Document document, AttributeInterface attribute, Lang lang) throws ApsSystemException {
attribute.setRenderingLang(lang.getCode());
if (attribute instanceof IndexableAttributeInterface) {
String valueToIndex = ((IndexableAttributeInterface) attribute).getIndexeableFieldValue();
String indexingType = attribute.getIndexingType();
String fieldName = lang.getCode();
if (null != indexingType && IndexableAttributeInterface.INDEXING_TYPE_UNSTORED.equalsIgnoreCase(indexingType)) {
document.add(new TextField(fieldName, valueToIndex, Field.Store.NO));
}
if (null != indexingType && IndexableAttributeInterface.INDEXING_TYPE_TEXT.equalsIgnoreCase(indexingType)) {
document.add(new TextField(fieldName, valueToIndex, Field.Store.YES));
}
}
if (attribute.isSearchable()) {
List<Lang> langs = new ArrayList<Lang>();
langs.add(lang);
AttributeTracer tracer = new AttributeTracer();
tracer.setLang(lang);
String name = tracer.getFormFieldName(attribute);
List<AttributeSearchInfo> searchInfos = attribute.getSearchInfos(langs);
if (null != searchInfos) {
for (int i = 0; i < searchInfos.size(); i++) {
AttributeSearchInfo info = searchInfos.get(i);
Field field = null;
if (null != info.getDate()) {
field = new TextField(name, DateTools.timeToString(info.getDate().getTime(), DateTools.Resolution.MINUTE), Field.Store.YES);
} else if (null != info.getBigDecimal()) {
field = new IntField(name, info.getBigDecimal().intValue(), Field.Store.YES);
} else {
field = new TextField(name, info.getString(), Field.Store.YES);
}
document.add(field);
}
}
}
}
Aggregations