javax.jcr.ValueFormatException Java Examples

The following examples show how to use javax.jcr.ValueFormatException. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ValueFactoryImpl.java    From jackalope with Apache License 2.0 6 votes vote down vote up
@Override
public Value createValue(String value, int type) throws ValueFormatException {
    switch (type) {
        case PropertyType.STRING:
            return createValue(value);
        case PropertyType.LONG:
            return createValue(Long.valueOf(value));
        case PropertyType.DOUBLE:
            return createValue(Double.valueOf(value));
        case PropertyType.BOOLEAN:
            return createValue(Boolean.valueOf(value));
        case PropertyType.DECIMAL:
            return createValue(new BigDecimal(value));
        case PropertyType.DATE: // TODO: parse dates
        case PropertyType.BINARY:
            return createValue(createBinary(value));
        default:
            return null;
    }
}
 
Example #2
Source File: PropertyImpl.java    From jackalope with Apache License 2.0 5 votes vote down vote up
@Override
@Nonnull
public long[] getLengths() throws ValueFormatException, RepositoryException {
    if (!isMultiple()) throw new ValueFormatException();
    List<Long> lengths = new ArrayList<>();
    for (Value value : values)
        lengths.add((long)value.getString().length());
    return Longs.toArray(lengths);
}
 
Example #3
Source File: PropertyImpl.java    From jackalope with Apache License 2.0 5 votes vote down vote up
public PropertyImpl(@Nonnull SessionImpl session, @Nonnull String path, @Nonnull String[] values) throws ValueFormatException, VersionException, LockException, ConstraintViolationException, RepositoryException {
    this(session, path);
    List<Value> stringValues = new ArrayList<>(values.length);
    for (String value : values)
        stringValues.add(new ValueImpl(value));
    setValue(stringValues.toArray(new Value[stringValues.size()]));
}
 
Example #4
Source File: PropertyImpl.java    From jackalope with Apache License 2.0 5 votes vote down vote up
@Override
public void setValue(@Nonnull String[] values) throws ValueFormatException, VersionException, LockException, ConstraintViolationException, RepositoryException {
    List<Value> valueList = new ArrayList<>(values.length);
    for (String value : values)
        valueList.add(new ValueImpl(value));
    setValue(valueList.toArray(new Value[valueList.size()]));
}
 
Example #5
Source File: NodeImpl.java    From jackalope with Apache License 2.0 5 votes vote down vote up
@Override
public Property setProperty(String name, Value[] values) throws ValueFormatException, VersionException, LockException, ConstraintViolationException, RepositoryException {
    PropertyImpl property = getOrCreateProperty(name);
    property.setValue(values);
    session.changeItem(this);
    return property;
}
 
Example #6
Source File: Restrictions.java    From APM with Apache License 2.0 5 votes vote down vote up
private Value[] createRestrictions(ValueFactory valueFactory, List<String> names)
    throws ValueFormatException {

  Value[] values = new Value[names.size()];
  for (int index = 0; index < names.size(); index++) {
    values[index] = valueFactory.createValue(names.get(index), PropertyType.NAME);
  }
  return values;
}
 
Example #7
Source File: Restrictions.java    From APM with Apache License 2.0 5 votes vote down vote up
private void addRestrictions(ValueFactory valueFactory, Map<String, Value[]> result, String key, List<String> names)
    throws ValueFormatException {

  if (names != null && !names.isEmpty()) {
    result.put(key, createRestrictions(valueFactory, names));
  }
}
 
Example #8
Source File: Restrictions.java    From APM with Apache License 2.0 5 votes vote down vote up
public Map<String, Value[]> getMultiValueRestrictions(ValueFactory valueFactory)
    throws ValueFormatException {

  Map<String, Value[]> result = new HashMap<>();
  addRestrictions(valueFactory, result, "rep:ntNames", ntNames);
  addRestrictions(valueFactory, result, "rep:itemNames", itemNames);
  return result;
}
 
Example #9
Source File: PropertyImpl.java    From jackalope with Apache License 2.0 4 votes vote down vote up
public PropertyImpl(@Nonnull SessionImpl session, @Nonnull String path, @Nonnull Value value) throws ValueFormatException, VersionException, LockException, ConstraintViolationException, RepositoryException {
    this(session, path);
    setValue(value);
}
 
Example #10
Source File: PropertyImpl.java    From jackalope with Apache License 2.0 4 votes vote down vote up
@Override
@Nullable
public InputStream getStream() throws ValueFormatException, RepositoryException {
    return null;  // deprecated
}
 
Example #11
Source File: PropertyImpl.java    From jackalope with Apache License 2.0 4 votes vote down vote up
@Override
@Nonnull
public Value[] getValues() throws ValueFormatException, RepositoryException {
    return values;
}
 
Example #12
Source File: PropertyImpl.java    From jackalope with Apache License 2.0 4 votes vote down vote up
@Override
@Nonnull
public String getString() throws ValueFormatException, RepositoryException {
    if (isMultiple()) throw new ValueFormatException();
    return value.getString();  //To change body of implemented methods use File | Settings | File Templates.
}
 
Example #13
Source File: PropertyImpl.java    From jackalope with Apache License 2.0 4 votes vote down vote up
@Override
public void setValue(boolean value) throws ValueFormatException, VersionException, LockException, ConstraintViolationException, RepositoryException {
    setValue(new ValueImpl(value));
}
 
Example #14
Source File: PropertyImpl.java    From jackalope with Apache License 2.0 4 votes vote down vote up
@Override
public void setValue(@Nonnull Calendar value) throws ValueFormatException, VersionException, LockException, ConstraintViolationException, RepositoryException {
    setValue(new ValueImpl(value));
}
 
Example #15
Source File: PropertyImpl.java    From jackalope with Apache License 2.0 4 votes vote down vote up
@Override
public void setValue(@Nonnull BigDecimal value) throws ValueFormatException, VersionException, LockException, ConstraintViolationException, RepositoryException {
    setValue(new ValueImpl(value));
}
 
Example #16
Source File: PropertyImpl.java    From jackalope with Apache License 2.0 4 votes vote down vote up
@Override
public void setValue(double value) throws ValueFormatException, VersionException, LockException, ConstraintViolationException, RepositoryException {
    setValue(new ValueImpl(value));
}
 
Example #17
Source File: PropertyImpl.java    From jackalope with Apache License 2.0 4 votes vote down vote up
@Override
public void setValue(@Nonnull Node value) throws ValueFormatException, VersionException, LockException, ConstraintViolationException, RepositoryException {
    //Not implemented
}
 
Example #18
Source File: NodeImpl.java    From jackalope with Apache License 2.0 4 votes vote down vote up
@Override
public Property setProperty(String name, long value) throws ValueFormatException, VersionException, LockException, ConstraintViolationException, RepositoryException {
    return setProperty(name, new ValueImpl(value));
}
 
Example #19
Source File: NodeImpl.java    From jackalope with Apache License 2.0 4 votes vote down vote up
@Override
public Property setProperty(String name, BigDecimal value) throws ValueFormatException, VersionException, LockException, ConstraintViolationException, RepositoryException {
    return setProperty(name, new ValueImpl(value));
}
 
Example #20
Source File: PropertyImpl.java    From jackalope with Apache License 2.0 4 votes vote down vote up
@Override
public boolean getBoolean() throws ValueFormatException, RepositoryException {
    if (isMultiple()) throw new ValueFormatException();
    return value.getBoolean();  //To change body of implemented methods use File | Settings | File Templates.
}
 
Example #21
Source File: NodeImpl.java    From jackalope with Apache License 2.0 4 votes vote down vote up
@Override
public Property setProperty(String name, boolean value) throws ValueFormatException, VersionException, LockException, ConstraintViolationException, RepositoryException {
    return setProperty(name, new ValueImpl(value));
}
 
Example #22
Source File: NodeImpl.java    From jackalope with Apache License 2.0 4 votes vote down vote up
@Override
public Property setProperty(String name, Binary value) throws ValueFormatException, VersionException, LockException, ConstraintViolationException, RepositoryException {
    return setProperty(name, new ValueImpl(value));
}
 
Example #23
Source File: NodeImpl.java    From jackalope with Apache License 2.0 4 votes vote down vote up
@Override
public Property setProperty(String name, InputStream value) throws ValueFormatException, VersionException, LockException, ConstraintViolationException, RepositoryException {
    return null;  //deprecated
}
 
Example #24
Source File: NodeImpl.java    From jackalope with Apache License 2.0 4 votes vote down vote up
@Override
public Property setProperty(String name, String value, int type) throws ValueFormatException, VersionException, LockException, ConstraintViolationException, RepositoryException {
    // TODO: Implement type conversions
    throw new UnsupportedOperationException();
}
 
Example #25
Source File: NodeImpl.java    From jackalope with Apache License 2.0 4 votes vote down vote up
@Override
public Property setProperty(String name, String value) throws ValueFormatException, VersionException, LockException, ConstraintViolationException, RepositoryException {
    return setProperty(name, new ValueImpl(value));
}
 
Example #26
Source File: NodeImpl.java    From jackalope with Apache License 2.0 4 votes vote down vote up
@Override
public Property setProperty(String name, String[] values, int type) throws ValueFormatException, VersionException, LockException, ConstraintViolationException, RepositoryException {
    return setProperty(name, values); // TODO: Implement type conversions
}
 
Example #27
Source File: NodeImpl.java    From jackalope with Apache License 2.0 4 votes vote down vote up
@Override
public Property setProperty(String name, String[] values) throws ValueFormatException, VersionException, LockException, ConstraintViolationException, RepositoryException {
    return setProperty(name, Values.convertStringsToValues(values));
}
 
Example #28
Source File: NodeImpl.java    From jackalope with Apache License 2.0 4 votes vote down vote up
@Override
public Property setProperty(String name, Value[] values, int type) throws ValueFormatException, VersionException, LockException, ConstraintViolationException, RepositoryException {
    return setProperty(name, values); // TODO: Implement type conversions
}
 
Example #29
Source File: PropertyImpl.java    From jackalope with Apache License 2.0 4 votes vote down vote up
@Override
public double getDouble() throws ValueFormatException, RepositoryException {
    if (isMultiple()) throw new ValueFormatException();
    return value.getDouble();  //To change body of implemented methods use File | Settings | File Templates.
}
 
Example #30
Source File: PropertyImpl.java    From jackalope with Apache License 2.0 4 votes vote down vote up
@Override
public long getLong() throws ValueFormatException, RepositoryException {
    if (isMultiple()) throw new ValueFormatException();
    return value.getLong();  //To change body of implemented methods use File | Settings | File Templates.
}