SelectionProviderLogic.createSelectionProvider(name, fieldNames.length, fieldTypes, objects); selectionProvider.setDisplayMode(dm); selectionProvider.setSearchDisplayMode(sdm); } else if (!StringUtils.isEmpty(hql)) { Database database = (name, objects, tableAccessor.getKeyProperties(), textFormats); selectionProvider.setDisplayMode(dm); selectionProvider.setSearchDisplayMode(sdm);
SelectionProviderLogic.createSelectionProvider(name, fieldNames.length, fieldTypes, objects); selectionProvider.setDisplayMode(dm); selectionProvider.setSearchDisplayMode(sdm); } else if (!StringUtils.isEmpty(hql)) { Database database = (name, objects, tableAccessor.getKeyProperties(), textFormats); selectionProvider.setDisplayMode(dm); selectionProvider.setSearchDisplayMode(sdm);
public DefaultSelectionProvider createSelectionProviderFromHql (String name, String databaseName, String hql, DisplayMode dm, SearchDisplayMode sdm) { Database database = DatabaseLogic.findDatabaseByName(persistence.getModel(), databaseName); Table table = QueryUtils.getTableFromQueryString(database, hql); String entityName = table.getActualEntityName(); Session session = persistence.getSession(databaseName); Collection<Object> objects = QueryUtils.getObjects(session, hql, null, null); TableAccessor tableAccessor = persistence.getTableAccessor(databaseName, entityName); ShortName shortNameAnnotation = tableAccessor.getAnnotation(ShortName.class); TextFormat[] textFormats = null; //L'ordinamento e' usato solo in caso di chiave singola if (shortNameAnnotation != null && tableAccessor.getKeyProperties().length == 1) { textFormats = new TextFormat[] { OgnlTextFormat.create(shortNameAnnotation.value()) }; } DefaultSelectionProvider selectionProvider = SelectionProviderLogic.createSelectionProvider (name, objects, tableAccessor.getKeyProperties(), textFormats); selectionProvider.setDisplayMode(dm); selectionProvider.setSearchDisplayMode(sdm); return selectionProvider; }
public DefaultSelectionProvider createSelectionProviderFromHql (String name, String databaseName, String hql, DisplayMode dm, SearchDisplayMode sdm) { Database database = DatabaseLogic.findDatabaseByName(persistence.getModel(), databaseName); Table table = QueryUtils.getTableFromQueryString(database, hql); String entityName = table.getActualEntityName(); Session session = persistence.getSession(databaseName); Collection<Object> objects = QueryUtils.getObjects(session, hql, null, null); TableAccessor tableAccessor = persistence.getTableAccessor(databaseName, entityName); ShortName shortNameAnnotation = tableAccessor.getAnnotation(ShortName.class); TextFormat[] textFormats = null; //L'ordinamento e' usato solo in caso di chiave singola if (shortNameAnnotation != null && tableAccessor.getKeyProperties().length == 1) { textFormats = new TextFormat[] { OgnlTextFormat.create(shortNameAnnotation.value()) }; } DefaultSelectionProvider selectionProvider = SelectionProviderLogic.createSelectionProvider (name, objects, tableAccessor.getKeyProperties(), textFormats); selectionProvider.setDisplayMode(dm); selectionProvider.setSearchDisplayMode(sdm); return selectionProvider; }