/** * Extract the metadata only from the input stream. Depending on media type validation, * the detector could be run against input stream in order to ensure that parser supports this * type of content. * @param in input stream to extract the metadata from * @return the extracted metadata converted to SearchBean or null if extraction is not possible * or was unsuccessful */ public SearchBean extractMetadataToSearchBean(final InputStream in) { TikaContent tc = extractMetadata(in); if (tc == null) { return null; } Metadata metadata = tc.getMetadata(); SearchBean bean = new SearchBean(); for (final String property: metadata.names()) { bean.set(property, metadata.get(property)); } return bean; }
private Object getValue(String getter, T pojo) { String thePropertyName; int index = getter.indexOf("."); if (index != -1) { thePropertyName = getter.substring(0, index); } else { thePropertyName = getter; } Object value; try { if (beanspector != null) { value = beanspector.swap(pojo).getValue(thePropertyName.toLowerCase()); } else { value = ((SearchBean)pojo).get(getter); } return getPrimitiveValue(getter, value); } catch (Throwable e) { return null; } }
private Object getValue(String getter, T pojo) { String thePropertyName; int index = getter.indexOf("."); if (index != -1) { thePropertyName = getter.substring(0, index); } else { thePropertyName = getter; } Object value; try { if (beanspector != null) { value = beanspector.swap(pojo).getValue(thePropertyName.toLowerCase()); } else { value = ((SearchBean)pojo).get(getter); } return getPrimitiveValue(getter, value); } catch (Throwable e) { return null; } }
private Object getValue(String getter, T pojo) { String thePropertyName; int index = getter.indexOf("."); if (index != -1) { thePropertyName = getter.substring(0, index); } else { thePropertyName = getter; } Object value; try { if (beanspector != null) { value = beanspector.swap(pojo).getValue(thePropertyName.toLowerCase()); } else { value = ((SearchBean)pojo).get(getter); } return getPrimitiveValue(getter, value); } catch (Throwable e) { return null; } }
/** * Extract the metadata only from the input stream. Depending on media type validation, * the detector could be run against input stream in order to ensure that parser supports this * type of content. * @param in input stream to extract the metadata from * @return the extracted metadata converted to SearchBean or null if extraction is not possible * or was unsuccessful */ public SearchBean extractMetadataToSearchBean(final InputStream in) { TikaContent tc = extractMetadata(in); if (tc == null) { return null; } Metadata metadata = tc.getMetadata(); SearchBean bean = new SearchBean(); for (final String property: metadata.names()) { bean.set(property, metadata.get(property)); } return bean; }
private static SearchClause getPrimitiveSearchClause(final SearchCondition<SearchBean> sc) { SearchClause clause = new SearchClause(); String property = sc.getCondition().getKeySet().iterator().next(); clause.setProperty(property); String value = sc.getCondition().get(property).replace("%252C", ",").replace("%253B", ";"); clause.setValue(value);