Search in sources :

Example 1 with IGxSilentTrn

use of com.genexus.IGxSilentTrn in project JavaClasses by genexuslabs.

the class Indexer method getIndexRecord.

private IndexRecord getIndexRecord(Object obj, GXContentInfo contentInfo) {
    if (contentInfo == null)
        contentInfo = new GXContentInfo();
    IndexRecord ir = new IndexRecord();
    if (obj instanceof GXFile) {
        GXFile file = (GXFile) obj;
        ir.setUri(file.getAbsoluteName());
        ir.setContent(DocumentHandler.getText(file.getAbsoluteName(), file.getExt()).toLowerCase());
        ir.setEntity(contentInfo.getType() == null ? file.getClass().getName() : contentInfo.getType());
        ir.setTitle(contentInfo.getTitle() == null ? file.getName() : contentInfo.getTitle());
        ir.setViewer(contentInfo.getViewer() == null ? file.getName() : contentInfo.getViewer());
        ir.setKeys(contentInfo.getKeys() == null || contentInfo.getKeys().size() == 0 ? new Vector<String>() : contentInfo.getKeys());
    } else if (obj instanceof GxSilentTrnSdt) {
        IGxSilentTrn bc = ((GxSilentTrnSdt) obj).getTransaction();
        GXContentInfo info = bc.getContentInfo();
        ir.setUri(info.getId());
        ir.setContent(IndexRecord.processContent(bc.toString()));
        ir.setEntity(contentInfo.getType() == null ? info.getType() : contentInfo.getType());
        ir.setTitle(contentInfo.getTitle() == null ? info.getTitle() : contentInfo.getTitle());
        ir.setViewer(contentInfo.getViewer() == null ? info.getViewer() : contentInfo.getViewer());
        ir.setKeys(contentInfo.getKeys() == null || contentInfo.getKeys().size() == 0 ? info.getKeys() : contentInfo.getKeys());
    } else if (obj instanceof String) {
        ir.setUri(contentInfo.getId() == null ? "" : contentInfo.getId());
        ir.setContent(IndexRecord.processContent((String) obj));
        ir.setEntity(contentInfo.getType() == null ? "" : contentInfo.getType());
        ir.setTitle(contentInfo.getTitle() == null ? "" : contentInfo.getTitle());
        ir.setViewer(contentInfo.getViewer() == null ? "" : contentInfo.getViewer());
        ir.setKeys(contentInfo.getKeys() == null || contentInfo.getKeys().size() == 0 ? new Vector<String>() : contentInfo.getKeys());
    } else {
        ir = null;
    }
    return ir;
}
Also used : GXFile(com.genexus.util.GXFile) Vector(java.util.Vector) GxSilentTrnSdt(com.genexus.GxSilentTrnSdt) IGxSilentTrn(com.genexus.IGxSilentTrn)

Aggregations

GxSilentTrnSdt (com.genexus.GxSilentTrnSdt)1 IGxSilentTrn (com.genexus.IGxSilentTrn)1 GXFile (com.genexus.util.GXFile)1 Vector (java.util.Vector)1