javax.jcr.Property.setValue()方法的使用及代码示例

x33g5p2x  于2022-01-26 转载在 其他  
字(8.4k)|赞(0)|评价(0)|浏览(96)

本文整理了Java中javax.jcr.Property.setValue()方法的一些代码示例,展示了Property.setValue()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Property.setValue()方法的具体详情如下:
包路径:javax.jcr.Property
类名称:Property
方法名:setValue

Property.setValue介绍

[英]Sets the value of this property to value. Same as #setValue(Value value) except that the value is specified as a double.
[中]将此属性的值设置为[$0$]。与#setValue(Value value)相同,只是该值被指定为double

代码示例

代码示例来源:origin: apache/jackrabbit

public void call() throws RepositoryException {
    prop.setValue("modified");
    testRootNode.getSession().save();
  }
}, Event.PROPERTY_CHANGED);

代码示例来源:origin: apache/jackrabbit

/**
 * Test the persistence of a property modified with a String parameter and
 * saved from the Session Requires a single-value String (PROP_VALUE_2)
 */
public void testStringSession() throws RepositoryException {
  property1.setValue(PROP_VALUE_2);
  superuser.save();
  assertEquals("String node property not saved", PROP_VALUE_2, property1.getString());
}

代码示例来源:origin: apache/jackrabbit

public void call() throws RepositoryException {
    prop.setValue("modified");
    prop.getSession().save();
  }
}, Event.PROPERTY_CHANGED);

代码示例来源:origin: org.onehippo.cms7/hippo-repository-engine

/**
 * Set the autoexport:enabled property to false in the repository. This method should only be called in an exception
 * handler, as it assumes the current session state is garbage and aggressively clears it.
 * @throws RepositoryException
 */
private void disableAutoExportJcrProperty() throws RepositoryException {
  // this method is almost certainly being called while current session state is somehow unreliable
  // therefore, before attempting to work with the repo, we should attempt to reset to a good state
  eventProcessorSession.refresh(false);
  final Property autoExportEnableProperty = autoExportConfigNode.getProperty(AutoExportConstants.CONFIG_ENABLED_PROPERTY_NAME);
  autoExportEnableProperty.setValue(false);
  eventProcessorSession.save();
}

代码示例来源:origin: apache/jackrabbit

/**
 * Test the deletion of a property by assigning it a null value, saved from
 * the Session
 */
public void testRemoveMultiValueSession() throws RepositoryException {
  property2.setValue((Value[]) null);
  superuser.save();
  try {
    node.getProperty(propertyName2);
    fail("The property should not exist anymore, as a null Value has been assigned");
  } catch (PathNotFoundException e) {
    //success : the property has been deleted by assigning it a null value
  }
}

代码示例来源:origin: apache/jackrabbit

/**
 * Test the deletion of a property by assigning it a null value, saved from
 * the Session
 */
public void testRemoveBooleanSession() throws RepositoryException {
  property1.setValue((Value) null);
  superuser.save();
  try {
    node.getProperty(propertyName1);
    fail("The property should not exist anymore, as a null Value has been assigned");
  } catch (PathNotFoundException e) {
    //success : the property has been deleted by assigning it a null value
  }
}

代码示例来源:origin: apache/jackrabbit

/**
 * Test the deletion of a property by assigning it a null value, saved from
 * the Session
 */
public void testRemoveDoubleSession() throws RepositoryException {
  property1.setValue((Value) null);
  superuser.save();
  try {
    node.getProperty(propertyName1);
    fail("The property should not exist anymore, as a null Decimal has been assigned");
  } catch (PathNotFoundException e) {
    //success : the property has been deleted by assigning it a null value
  }
}

代码示例来源:origin: apache/jackrabbit

/**
 * Test the deletion of a property by assigning it a null value, saved from
 * the Session
 */
public void testRemoveNodeSession() throws RepositoryException {
  property1.setValue((Value) null);
  superuser.save();
  try {
    node.getProperty(propertyName1);
    fail("The property should not exist anymore, as a null Value has been assigned");
  } catch (PathNotFoundException e) {
    //success : the property has been deleted by assigning it a null value
  }
}

代码示例来源:origin: apache/jackrabbit

/**
 * Test the deletion of a property by assigning it a null value, saved from
 * the Session
 */
public void testRemoveMultiStringSession() throws RepositoryException {
  property2.setValue((String[]) null);
  superuser.save();
  try {
    node.getProperty(propertyName2);
    fail("The property should not exist anymore, as a null Value has been assigned");
  } catch (PathNotFoundException e) {
    //success : the property has been deleted by assigning it a null value
  }
}

代码示例来源:origin: apache/jackrabbit

/**
 * Test the deletion of a property by assigning it a null value, saved from
 * the Session
 */
public void testRemoveDoubleSession() throws RepositoryException {
  property1.setValue((Value) null);
  superuser.save();
  try {
    node.getProperty(propertyName1);
    fail("The property should not exist anymore, as a null Double has been assigned");
  } catch (PathNotFoundException e) {
    //success : the property has been deleted by assigning it a null value
  }
}

代码示例来源:origin: apache/jackrabbit

/**
   * Test the deletion of a property by assigning it a null value, saved from
   * the Session
   */
  public void testRemoveCalendarSession() throws RepositoryException {
    property1.setValue((Calendar) null);
    superuser.save();

    try {
      node.getProperty(propertyName1);
      fail("The property should not exist anymore, as a null Calendar has been assigned");
    } catch (PathNotFoundException e) {
      //success : the property has been deleted by assigning it a null value
    }
  }
}

代码示例来源:origin: apache/jackrabbit

/**
 * Test the deletion of a property by assigning it a null value, saved from
 * the Session
 */
public void testRemoveValueSession() throws RepositoryException {
  Value sv = null;
  property1.setValue(sv);
  superuser.save();
  try {
    node.getProperty(propertyName1);
    fail("The property should not exist anymore, as a null Value has been assigned");
  } catch (PathNotFoundException e) {
    //success : the property has been deleted by assigning it a null value
  }
}

代码示例来源:origin: apache/jackrabbit

/**
   * Test the deletion of a property by assigning it a null value, saved from
   * the Session
   */
  public void testRemoveLongSession() throws RepositoryException {
    property1.setValue((Value) null);
    superuser.save();

    try {
      node.getProperty(propertyName1);
      fail("The property should not exist anymore, as a null Value has been assigned");
    } catch (PathNotFoundException e) {
      //success : the property has been deleted by assigning it a null value
    }
  }
}

代码示例来源:origin: apache/jackrabbit

/**
 * Test the deletion of a property by assigning it a null value, saved from
 * the Session
 */
public void testRemoveStringSession() throws RepositoryException {
  String sv = null;
  property1.setValue(sv);
  superuser.save();
  try {
    node.getProperty(propertyName1);
    fail("The property should not exist anymore, as a null String has been assigned");
  } catch (PathNotFoundException e) {
    //success : the property has been deleted by assigning it a null value
  }
}

代码示例来源:origin: apache/jackrabbit

/**
 * Test the deletion of a value in a multi-value property
 */
public void testNullMultiValue() throws RepositoryException {
  property2.setValue(new Value[]{null, sv2});
  superuser.save();
  assertEquals("Null value not removed", Arrays.asList(property2.getValues()), Arrays.asList(new Value[]{sv2}));
}

代码示例来源:origin: apache/jackrabbit

/**
 * Test the persistence of a property modified with an multi-value Value
 * parameter and saved from the Session Requires a multi-value Value (mv2)
 */
public void testMultiValueSession() throws RepositoryException {
  property2.setValue(mv2);
  superuser.save();
  assertEquals("Node property not saved", Arrays.asList(mv2), Arrays.asList(property2.getValues()));
}

代码示例来源:origin: com.cognifide.qa.bb/bb-aem-common

/**
 * Removes node property.
 *
 * @param nodePath     Absolute path to node.
 * @param propertyName Property name.
 * @throws RepositoryException if problem with jcr repository occurred
 */
public void removeNodeProperty(String nodePath, String propertyName) throws RepositoryException {
 LOG.debug("Removing property '{}' from node '{}'", propertyName, nodePath);
 session.refresh(true);
 session.getNode(nodePath).getProperty(propertyName).setValue((String) null);
 session.save();
}

代码示例来源:origin: apache/jackrabbit

/**
 * Test the persistence of a property modified with a Value parameter, and
 * saved from the parent Node Requires a single-value Value (sv2)
 */
public void testValueParent() throws RepositoryException {
  property1.setValue(sv2);
  testRootNode.getSession().save();
  assertEquals("Value node property not saved", sv2, property1.getValue());
}

代码示例来源:origin: apache/jackrabbit

/**
 * Test the persistence of a property modified with an multi-value String
 * parameter and saved from the Session Requires a multi-value String (mv)
 */
public void testMultiStringSession() throws RepositoryException {
  String[] mv = new String[]{PROP_VALUE_1, PROP_VALUE_2};
  property2.setValue(mv);
  superuser.save();
  Value[] values = property2.getValues();
  List<String> strValues = new ArrayList<String>();
  for (int i = 0; i < values.length; i++) {
    strValues.add(values[i].getString());
  }
  assertEquals("Node property not saved", Arrays.asList(mv), strValues);
}

代码示例来源:origin: apache/jackrabbit

/**
 * Test the persistence of a property modified with a Value parameter and
 * saved from the Session Requires a single-value Value (sv2)
 */
public void testValueSession() throws RepositoryException {
  property1.setValue(sv2);
  superuser.save();
  assertEquals("Value node property not saved", sv2, property1.getValue());
}

相关文章