Tabnine Logo
Property.isModified
Code IndexAdd Tabnine to your IDE (free)

How to use
isModified
method
in
javax.jcr.Property

Best Java code snippets using javax.jcr.Property.isModified (Showing top 20 results out of 315)

  • Add the Codota plugin to your IDE and get smart completions
private void myMethod () {
List l =
  • Codota Iconnew ArrayList()
  • Codota Iconnew LinkedList()
  • Smart code suggestions by Tabnine
}
origin: org.apache.sling/org.apache.sling.scripting.javascript

public boolean jsGet_modified() {
  return property.isModified();
}
origin: info.magnolia/magnolia-core

@Override
public boolean isModified() {
  return getWrappedProperty().isModified();
}
origin: org.onehippo.jcr.console/hippo-jcr-console-api

  public static boolean hasNewOrModifiedProperty(Node node) {
    if (node == null) {
      return false;
    }
    
    try {
      for (PropertyIterator propIt = node.getProperties(); propIt.hasNext(); ) {
        Property prop = propIt.nextProperty();
        
        if (prop.isNew() || prop.isModified()) {
          return true;
        }
      }
    } catch (RepositoryException e) {
      log.warn("Failed to retrieve property iterator", e);
    }
    
    return false;
  }
}
origin: ModeShape/modeshape

@Test
public void changedPropertyOnModifiedNodeShouldBeModified() {
  assertThat(modifiedPropertyOnModifiedNode.isModified(), is(true));
}
origin: ModeShape/modeshape

@Test
public void newPropertyOnModifiedNodeShouldNotBeModified() {
  assertThat(newPropertyOnModifiedNode.isModified(), is(false));
}
origin: ModeShape/modeshape

@Test
public void unchangedPropertyOnModifiedNodeShouldNotBeModifiedOrNew() {
  assertThat(unmodifiedPropertyOnModifiedNode.isModified(), is(false));
  assertThat(unmodifiedPropertyOnModifiedNode.isNew(), is(false));
}
origin: apache/jackrabbit

/**
 * @throws Exception
 */
public void testPropertyIsModified() throws Exception {
  // prerequisite: existing property
  testRootNode.setProperty(propertyName1, "0");
  testRootNode.save();
  // get user transaction object
  UserTransaction utx = new UserTransactionImpl(superuser);
  // start transaction
  utx.begin();
  // 'add' property and save
  testRootNode.setProperty(propertyName1, "1");
  assertTrue("Unsaved property must be modified.", testRootNode.getProperty(propertyName1).isModified());
  testRootNode.save();
  assertFalse("Saved property must not be modified.", testRootNode.getProperty(propertyName1).isModified());
  // commit
  utx.commit();
}
origin: ModeShape/modeshape

protected void assertNumberOfNewOrModifiedProperties( Node node,
                           int expected ) throws Exception {
  int numModifiedOrNewProperties = 0;
  for (PropertyIterator iter = node.getProperties(); iter.hasNext();) {
    Property prop = iter.nextProperty();
    if (prop.isNew() || prop.isModified()) ++numModifiedOrNewProperties;
  }
  assertThat(numModifiedOrNewProperties, is(expected));
}
origin: ModeShape/modeshape

protected void assertNoModifiedOrNewProperties( Node node ) throws Exception {
  for (PropertyIterator iter = node.getProperties(); iter.hasNext();) {
    Property prop = iter.nextProperty();
    assertThat(prop.isNew(), is(false));
    assertThat(prop.isModified(), is(false));
  }
}
origin: org.chromattic/chromattic.core

public void testReAddRef() throws Exception {
 Session session = login();
 //
 Node root = session.getRootNode();
 Node a = root.addNode("a3");
 a.addMixin("mix:referenceable");
 Node b = root.addNode("b3");
 b.setProperty("ref", a);
 session.save();
 //
 session = login();
 root = session.getRootNode();
 a = root.getNode("a3");
 b = root.getNode("b3");
 Property ref = b.getProperty("ref");
 //
 ref.remove();
 b.setProperty("ref", a);
 assertFalse(ref.isNew());
 assertTrue(ref.isModified());
 assertFalse(a.getReferences().hasNext());
 //
 session.save();
 b.setProperty("ref", a);
 assertFalse(ref.isNew());
 assertTrue(ref.isModified());
 assertEquals(ref, a.getReferences());
}
origin: apache/jackrabbit-oak

  @Test
  public void testGetStatus() throws Exception {
    deny(path, privilegesFromName(PrivilegeConstants.JCR_READ));
    allow(path, privilegesFromName(PrivilegeConstants.REP_READ_PROPERTIES));

    List<String> propertyPaths = new ArrayList<String>();
    propertyPaths.add(childPPath);
    propertyPaths.add(childchildPPath);
    propertyPaths.add(path + "/jcr:primaryType");

    for (String pPath : propertyPaths) {
      Property p = testSession.getProperty(pPath);
      assertFalse(p.isModified());
      assertFalse(p.isNew());
    }
  }
}
origin: ModeShape/modeshape

@Test
public void newNodeShouldHaveAllNewProperties() throws Exception {
  assertThat(newNode.isNew(), is(true));
  assertThat(newNode.isModified(), is(false));
  for (PropertyIterator iter = newNode.getProperties(); iter.hasNext();) {
    Property prop = iter.nextProperty();
    assertThat(prop.isNew(), is(true));
    assertThat(prop.isModified(), is(false));
  }
}
origin: org.chromattic/chromattic.core

public void testAddRef() throws Exception {
 Session session = login();
 //
 Node root = session.getRootNode();
 Node a = root.addNode("a1");
 a.addMixin("mix:referenceable");
 Node b = root.addNode("b1");
 //
 Property ref = b.setProperty("ref", a);
 assertTrue(ref.isNew());
 assertFalse(ref.isModified());
 assertEquals(0, Collections.set(JCR.adapt(a.getReferences())).size());
 //
 session.save();
 assertFalse(ref.isNew());
 assertFalse(ref.isModified());
 assertEquals(ref, a.getReferences());
}
origin: apache/jackrabbit

public void testWriteVersionStore() throws RepositoryException, NotExecutableException {
  Node trn = getTestNode();
  modifyPrivileges(trn.getPath(), PrivilegeRegistry.REP_WRITE, true);
  modifyPrivileges(trn.getPath(), Privilege.JCR_VERSION_MANAGEMENT, false);
  Node n = createVersionableNode(testRootNode);
  try {
    Node n2 = trn.getNode(nodeName1);
    n2.checkin();
    fail("No write permission in the version storage.");
  } catch (AccessDeniedException e) {
    // success
    log.debug(e.getMessage());
    // ... but the property must not be modified nor indicating
    // checkedIn status
    Property p = n.getProperty("jcr:isCheckedOut");
    assertFalse(p.isModified());
    assertTrue(n.getProperty("jcr:isCheckedOut").getValue().getBoolean());
  }
}
origin: apache/jackrabbit

  public void testRemovedNewItem() throws RepositoryException {
    Node n = testRootNode.addNode(nodeName2);
    Property p = n.setProperty(propertyName1, testValue);
    n.remove();

    testRootNode.refresh(true);

    // n must still be new and accessible
    String msg = "Refresh 'true' must revert the removal of new a Node/Property.";
    assertFalse(msg, testRootNode.hasNode(nodeName2));
    assertFalse(msg, n.isNew() && n.isModified());
    assertFalse(msg, p.isNew() && p.isModified());
    try {
      n.hasProperty(propertyName1);
      fail(msg);
    } catch (InvalidItemStateException e) {
      // success
    }
    try {
      p.getString();
      fail(msg);
    } catch (InvalidItemStateException e) {
      // success
    }
  }
}
origin: ModeShape/modeshape

protected void assertSameProperties( Node share,
                   Node original ) throws RepositoryException {
  Set<String> originalPropertyNames = new HashSet<String>();
  for (PropertyIterator iter = original.getProperties(); iter.hasNext();) {
    Property property = iter.nextProperty();
    originalPropertyNames.add(property.getName());
  }
  for (PropertyIterator iter = share.getProperties(); iter.hasNext();) {
    Property property = iter.nextProperty();
    Property originalProperty = original.getProperty(property.getName());
    originalPropertyNames.remove(property.getName());
    assertThat(property.isModified(), is(originalProperty.isModified()));
    assertThat(property.isMultiple(), is(originalProperty.isMultiple()));
    assertThat(property.isNew(), is(originalProperty.isNew()));
    assertThat(property.isNode(), is(originalProperty.isNode()));
    assertThat(property.isSame(originalProperty), is(true)); // not the same property owner instance, but isSame()
    if (property.isMultiple()) {
      Value[] values = property.getValues();
      Value[] originalValues = originalProperty.getValues();
      assertThat(values.length, is(originalValues.length));
      for (int i = 0; i != values.length; ++i) {
        assertThat(values[i].equals(originalValues[i]), is(true));
      }
    } else {
      assertThat(property.getValue(), is(originalProperty.getValue()));
    }
  }
  assertThat("Extra properties in original: " + originalPropertyNames, originalPropertyNames.isEmpty(), is(true));
}
origin: org.chromattic/chromattic.core

public void testUpdateRef() throws Exception {
 Session session = login();
 //
 Node root = session.getRootNode();
 Node a = root.addNode("a4");
 a.addMixin("mix:referenceable");
 Node b = root.addNode("b4");
 b.addMixin("mix:referenceable");
 Node c = root.addNode("c4");
 Property ref = c.setProperty("ref", a);
 //
 assertTrue(ref.isNew());
 assertFalse(ref.isModified());
 assertEquals(0, Collections.set(JCR.adapt(a.getReferences())).size());
 assertEquals(0, Collections.set(JCR.adapt(b.getReferences())).size());
 //
 c.setProperty("ref", b);
 assertTrue(ref.isNew());
 assertTrue(ref.isModified());
 assertEquals(0, Collections.set(JCR.adapt(a.getReferences())).size());
 assertEquals(0, Collections.set(JCR.adapt(b.getReferences())).size());
 //
 session.save();
 assertFalse(ref.isNew());
 assertFalse(ref.isModified());
 assertEquals(0, Collections.set(JCR.adapt(a.getReferences())).size());
 assertEquals(ref, b.getReferences());
}
origin: apache/jackrabbit-oak

@Test
public void testCheckInCheckout() throws Exception {
  modify(path, REP_WRITE, true);
  modify(path, Privilege.JCR_VERSION_MANAGEMENT, false);
  Node n = createVersionableNode(superuser.getNode(path));
  try {
    testSession.refresh(false);
    Node testNode = testSession.getNode(n.getPath());
    testNode.checkin();
    fail("Missing jcr:versionManagement privilege -> checkin/checkout must fail.");
  } catch (AccessDeniedException e) {
    // success
    // ... but the property must not be modified nor indicating
    // checkedIn status
    Property p = n.getProperty("jcr:isCheckedOut");
    assertFalse(p.isModified());
    assertTrue(n.getProperty("jcr:isCheckedOut").getValue().getBoolean());
  }
}
origin: apache/jackrabbit-oak

@Test
public void setStringProperty() throws RepositoryException, IOException {
  Node parentNode = getNode(TEST_PATH);
  addProperty(parentNode, "string", getAdminSession().getValueFactory().createValue("string \" value"));
  Property property = parentNode.getProperty("string");
  property.setValue("new value");
  assertTrue(parentNode.isModified());
  assertTrue(property.isModified());
  assertFalse(property.isNew());
  property.getSession().save();
  Session session2 = createAnonymousSession();
  try {
    Property property2 = session2.getProperty(TEST_PATH + "/string");
    assertEquals("new value", property2.getString());
  } finally {
    session2.logout();
  }
}
origin: apache/jackrabbit-oak

private void addProperty(Node parentNode, String name, Value value) throws RepositoryException, IOException {
  String propertyPath = parentNode.getPath() + '/' + name;
  assertFalse(getAdminSession().propertyExists(propertyPath));
  Property added = parentNode.setProperty(name, value);
  assertTrue(parentNode.isModified());
  assertFalse(added.isModified());
  assertTrue(added.isNew());
  getAdminSession().save();
  Session session2 = createAnonymousSession();
  try {
    assertTrue(session2.propertyExists(propertyPath));
    Value value2 = session2.getProperty(propertyPath).getValue();
    assertEquals(value.getType(), value2.getType());
    if (value.getType() == PropertyType.BINARY) {
      assertEqualStream(value.getStream(), value2.getStream());
    } else {
      assertEquals(value.getString(), value2.getString());
    }
    if (value2.getType() == PropertyType.REFERENCE || value2.getType() == PropertyType.WEAKREFERENCE) {
      String ref = value2.getString();
      assertNotNull(getAdminSession().getNodeByIdentifier(ref));
    }
  } finally {
    session2.logout();
  }
}
javax.jcrPropertyisModified

Popular methods of Property

  • getString
    Returns a String representation of the value of this property. A shortcut for Property.getValue().g
  • getValues
    Returns an array of all the values of this property. Used to access multi-value properties. The arra
  • getValue
    Returns the value of this property as a Value object. The object returned is a copy of the stored va
  • getName
  • getType
    Returns the type of this Property. One of: * PropertyType.STRING * PropertyType.BINARY * Property
  • getBinary
    Returns a Binary representation of the value of this property. A shortcut for Property.getValue().g
  • getBoolean
    Returns a boolean representation of the value of this property. A shortcut for Property.getValue().
  • remove
  • isMultiple
    Returns true if this property is multi-valued andfalse if this property is single-valued.
  • getDate
    Returns a Calendar representation of the value of this property. A shortcut for Property.getValue()
  • getLong
    Returns a long representation of the value of this property. A shortcut for Property.getValue().get
  • getDefinition
    Returns the property definition that applies to this property. In some cases there may appear to be
  • getLong,
  • getDefinition,
  • setValue,
  • getParent,
  • getPath,
  • getNode,
  • getLength,
  • getDouble,
  • getStream,
  • getSession

Popular in Java

  • Creating JSON documents from java classes using gson
  • notifyDataSetChanged (ArrayAdapter)
  • setRequestProperty (URLConnection)
  • orElseThrow (Optional)
    Return the contained value, if present, otherwise throw an exception to be created by the provided s
  • BorderLayout (java.awt)
    A border layout lays out a container, arranging and resizing its components to fit in five regions:
  • FlowLayout (java.awt)
    A flow layout arranges components in a left-to-right flow, much like lines of text in a paragraph. F
  • Thread (java.lang)
    A thread is a thread of execution in a program. The Java Virtual Machine allows an application to ha
  • MessageDigest (java.security)
    Uses a one-way hash function to turn an arbitrary number of bytes into a fixed-length byte sequence.
  • Timer (java.util)
    Timers schedule one-shot or recurring TimerTask for execution. Prefer java.util.concurrent.Scheduled
  • Join (org.hibernate.mapping)
  • Top 15 Vim Plugins
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyStudentsTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now