/** * {@inheritDoc} */ public Value createValue(Node value) throws RepositoryException { return createValue(value, false); }
/** * {@inheritDoc} */ public Value createValue(Node value) throws RepositoryException { return createValue(value, false); }
public Value createValue(Binary value) { // TODO review/optimize/refactor try { return createValue(value.getStream()); } catch (RepositoryException ex) { throw new RuntimeException(ex); } }
public Value createValue(Binary value) { // TODO review/optimize/refactor try { return createValue(value.getStream()); } catch (RepositoryException ex) { throw new RuntimeException(ex); } }
/** * Highlights the matching terms in the passed <code>text</code>. * * @param text the text where to apply highlighting. * @return a StringValue or <code>null</code> if highlighting fails. */ private Value highlight(String text) { if (!(excerptProvider instanceof HighlightingExcerptProvider)) { return null; } HighlightingExcerptProvider hep = (HighlightingExcerptProvider) excerptProvider; try { long time = System.currentTimeMillis(); text = hep.highlight(text); time = System.currentTimeMillis() - time; log.debug("Highlighted text in {} ms.", time); return valueFactory.createValue(text); } catch (IOException e) { return null; } }
/** * Returns the spell checked string of the first relation query node * with a spellcheck operation. * * @return a StringValue or <code>null</code> if the spell checker * thinks the words are spelled correctly. This method also * returns <code>null</code> if no spell checker is configured. */ private Value getSpellCheckedStatement() { String v = null; if (spellSuggestion != null) { try { v = spellSuggestion.getSuggestion(); } catch (IOException e) { log.warn("Spell checking failed", e); } } if (v != null) { return valueFactory.createValue(v); } else { return null; } } }
/** * Returns the spell checked string of the first relation query node * with a spellcheck operation. * * @return a StringValue or <code>null</code> if the spell checker * thinks the words are spelled correctly. This method also * returns <code>null</code> if no spell checker is configured. */ private Value getSpellCheckedStatement() { String v = null; if (spellSuggestion != null) { try { v = spellSuggestion.getSuggestion(); } catch (IOException e) { log.warn("Spell checking failed", e); } } if (v != null) { return valueFactory.createValue(v); } else { return null; } } }
/** * Highlights the matching terms in the passed <code>text</code>. * * @param text the text where to apply highlighting. * @return a StringValue or <code>null</code> if highlighting fails. */ private Value highlight(String text) { if (!(excerptProvider instanceof HighlightingExcerptProvider)) { return null; } HighlightingExcerptProvider hep = (HighlightingExcerptProvider) excerptProvider; try { long time = System.currentTimeMillis(); text = hep.highlight(text); time = System.currentTimeMillis() - time; log.debug("Highlighted text in {} ms.", time); return valueFactory.createValue(text); } catch (IOException e) { return null; } }
/** * Creates an excerpt for node with the given <code>id</code>. * * @param id a node id. * @return a StringValue or <code>null</code> if the excerpt cannot be * created or an error occurs. */ private Value createExcerpt(NodeId id) { if (excerptProvider == null) { return null; } try { long time = System.currentTimeMillis(); String excerpt = excerptProvider.getExcerpt(id, 3, 150); time = System.currentTimeMillis() - time; log.debug("Created excerpt in {} ms.", time); if (excerpt != null) { return valueFactory.createValue(excerpt); } else { return null; } } catch (IOException e) { return null; } }
/** * Creates an excerpt for node with the given <code>id</code>. * * @param id a node id. * @return a StringValue or <code>null</code> if the excerpt cannot be * created or an error occurs. */ private Value createExcerpt(NodeId id) { if (excerptProvider == null) { return null; } try { long time = System.currentTimeMillis(); String excerpt = excerptProvider.getExcerpt(id, 3, 150); time = System.currentTimeMillis() - time; log.debug("Created excerpt in {} ms.", time); if (excerpt != null) { return valueFactory.createValue(excerpt); } else { return null; } } catch (IOException e) { return null; } }
@Override public Value createValue(QValue qvalue) { if (qvalue instanceof InternalValue && PropertyType.BINARY == qvalue.getType()) { try { return new BinaryValueImpl(((InternalValue) qvalue).getBLOBFileValue().copy()); } catch (RepositoryException e) { // should not get here log.error(e.getMessage(), e); } } return super.createValue(qvalue); }
@Override public Value createValue(QValue qvalue) { if (qvalue instanceof InternalValue && PropertyType.BINARY == qvalue.getType()) { try { return new BinaryValueImpl(((InternalValue) qvalue).getBLOBFileValue().copy()); } catch (RepositoryException e) { // should not get here log.error(e.getMessage(), e); } } return super.createValue(qvalue); }
@Override public Value createValue(String value, int type) throws ValueFormatException { if (PropertyType.BINARY == type) { try { InternalValue qvalue = (InternalValue) getQValueFactory().create(value, type); return new BinaryValueImpl(qvalue.getBLOBFileValue()); } catch (RepositoryException e) { throw new ValueFormatException(e); } } else { return super.createValue(value, type); } } }
@Override public Value createValue(String value, int type) throws ValueFormatException { if (PropertyType.BINARY == type) { try { InternalValue qvalue = (InternalValue) getQValueFactory().create(value, type); return new BinaryValueImpl(qvalue.getBLOBFileValue()); } catch (RepositoryException e) { throw new ValueFormatException(e); } } else { return super.createValue(value, type); } } }
/** * Returns the string value of the identified property default value. * * @param def property definition * @param index default value index * @return default value */ private String getDefaultValue(QPropertyDefinition def, int index) { try { QValue[] values = def.getDefaultValues(); NamespaceResolver nsResolver = new AdditionalNamespaceResolver(registry); NamePathResolver resolver = new DefaultNamePathResolver(nsResolver); ValueFactoryQImpl factory = new ValueFactoryQImpl(InternalValueFactory.getInstance(), resolver); return factory.createValue(values[index]).getString(); } catch (RepositoryException e) { throw new AssertionFailedError(e.getMessage()); } }
return super.createValue(binary);
return super.createValue(binary);
ValueFactory factory) throws RepositoryException { if (factory instanceof ValueFactoryQImpl) { return ((ValueFactoryQImpl)factory).createValue(qualifiedValue);
ValueFactory factory) throws RepositoryException { if (factory instanceof ValueFactoryQImpl) { return ((ValueFactoryQImpl)factory).createValue(value); } else { Value jcrValue;
ValueFactory factory) throws RepositoryException { if (factory instanceof ValueFactoryQImpl) { return ((ValueFactoryQImpl)factory).createValue(value); } else { Value jcrValue;