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

How to use
getSession
method
in
javax.jcr.Property

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

origin: org.apache.sling/org.apache.sling.scripting.javascript

public Object jsGet_session() {
  try {
    return property.getSession();
  } catch (RepositoryException re) {
    return Undefined.instance;
  }
}
origin: apache/jackrabbit

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

  public void call() throws RepositoryException {
    Session s = prop.getSession();
    prop.remove();
    s.save();
  }
}, Event.PROPERTY_REMOVED);
origin: apache/jackrabbit

/**
 * Tests if getSession() is same as through which the Property was acquired
 */
public void testGetSession() throws RepositoryException {
  assertSame("getSession must return the Session through which " +
      "the Property was acquired.",
      property.getSession(),
      session);
}
origin: info.magnolia/magnolia-core

@Override
public Session getSession() throws RepositoryException {
  return getWrappedProperty().getSession();
}
origin: org.onehippo.cms7/hippo-cms-translation-repository

  private Value[] toValues(List<String> strings) throws RepositoryException {
    final List<Value> values = new ArrayList<>(strings.size());
    final ValueFactory valueFactory = property.getSession().getValueFactory();
    for (String string : strings) {
      values.add(valueFactory.createValue(string));
    }
    return values.toArray(new Value[values.size()]);
  }
}
origin: org.apache.jackrabbit/jackrabbit-jcr-commons

public Property addProperty(String key, Value value) throws RepositoryException {
  Node parent = getOrCreateParent(key);
  if (parent.hasProperty(key)) {
    throw new ItemExistsException(key);
  }
  Property p = parent.setProperty(key, value);
  treeManager.split(this, parent, p);
  if (autoSave) {
    p.getSession().save();
  }
  return p;
}
origin: apache/jackrabbit

public Property addProperty(String key, Value value) throws RepositoryException {
  Node parent = getOrCreateParent(key);
  if (parent.hasProperty(key)) {
    throw new ItemExistsException(key);
  }
  Property p = parent.setProperty(key, value);
  treeManager.split(this, parent, p);
  if (autoSave) {
    p.getSession().save();
  }
  return p;
}
origin: org.apache.sling/org.apache.sling.testing.sling-mock-oak

public Property addProperty(String key, Value value) throws RepositoryException {
  Node parent = getOrCreateParent(key);
  if (parent.hasProperty(key)) {
    throw new ItemExistsException(key);
  }
  Property p = parent.setProperty(key, value);
  treeManager.split(this, parent, p);
  if (autoSave) {
    p.getSession().save();
  }
  return p;
}
origin: org.onehippo.cms7/hippo-repository-engine

public static boolean propertyIsIdentical(final Property jcrProperty, final ModelProperty modelProperty)
    throws RepositoryException, IOException {
  return propertyIsIdentical(jcrProperty, modelProperty,
      determineVerifiedValues(modelProperty, jcrProperty.getSession()));
}
origin: org.onehippo.jcr.console/hippo-jcr-console-api

@Override
public void setObject(Date object) {
  Calendar calendar = new GregorianCalendar();
  calendar.setTime(object);
  try {
    valueModel.setValue(valueModel.getJcrPropertymodel().getProperty().getSession().getValueFactory()
        .createValue(calendar));
  } catch (RepositoryException ex) {
    log.error(ex.getMessage(), ex);
  }
  super.setObject(object);
}
origin: org.onehippo.cms7/hippo-cms-api

@Override
public void setObject(Date object) {
  Calendar calendar = new GregorianCalendar();
  calendar.setTime(object);
  try {
    valueModel.setValue(valueModel.getJcrPropertymodel().getProperty().getSession().getValueFactory()
        .createValue(calendar));
  } catch (RepositoryException ex) {
    log.error(ex.getMessage(), ex);
  }
  super.setObject(object);
}
origin: apache/jackrabbit

/**
 * Test the restore of a OnParentVersion-ABORT property
 *
 * @throws javax.jcr.RepositoryException
 */
public void testRestorePropJcr2() throws RepositoryException {
  try {
    VersionManager versionManager = p.getSession().getWorkspace().getVersionManager();
    String path = p.getParent().getPath();
    versionManager.checkout(path);
    versionManager.checkin(path);
    fail("On checkin of N which has a property with OnParentVersion ABORT defined, an UnsupportedRepositoryOperationException must be thrown.");
  } catch (VersionException e) {
    // success
  }
}
origin: org.onehippo.cms7/hippo-cms-console-frontend

private static boolean isPartOfHippoDocument(final Property property) throws RepositoryException {
  final Node root = property.getSession().getRootNode();
  Node current = property.getParent();
  while (!current.isSame(root)) {
    Node parent = current.getParent();
    if (parent.isNodeType(HippoNodeType.NT_HANDLE) && current.isNodeType(HippoNodeType.NT_DOCUMENT)) {
      return true;
    }
    current = parent;
  }
  return false;
}
origin: info.magnolia/magnolia-core

public Link(Property property) {
  try {
    setJCRNode(property.getParent());
    setWorkspace(property.getSession().getWorkspace().toString());
    setProperty(property);
    setPropertyName(property.getName());
  } catch (RepositoryException e) {
    throw new RuntimeRepositoryException(e);
  }
}
origin: info.magnolia/magnolia-core

@Test
public void testWorkspaceReturnsLogicalName3() throws RepositoryException {
  // GIVEN
  Node root = MgnlContext.getJCRSession("magnolia-mgnlSystem").getRootNode();
  root.addNode("test", NodeTypes.ContentNode.NAME).setProperty("testProp", "testVal");
  root.getSession().save();
  // WHEN
  String name = root.getNode("test").getProperty("testProp").getSession().getWorkspace().getName();
  // THEN
  assertTrue(name.equals("magnolia-mgnlSystem"));
}
origin: apache/jackrabbit

/**
 * Test the restore of a OnParentVersion-IGNORE property
 *
 * @throws javax.jcr.RepositoryException
 */
public void testRestorePropJcr2() throws RepositoryException {
  Node propParent = p.getParent();
  VersionManager versionManager = propParent.getSession().getWorkspace().getVersionManager();
  String path = propParent.getPath();
  versionManager.checkout(path);
  Version v = versionManager.checkin(path);
  versionManager.checkout(path);
  p.setValue(newPropValue);
  p.getSession().save();
  versionManager.restore(v, false);
  assertEquals("On restore of a OnParentVersion-IGNORE property P, the current value of P must be left unchanged.", p.getString(), newPropValue);
}
origin: org.onehippo.cms7/hippo-cms-api

  /**
   * Special purpose override, makes sure the JcrPropertyValueModel will never be null or ""
   * (non-Javadoc)
   * @see org.apache.wicket.model.IModel#setObject(java.lang.Object)
   */
  public void setObject(String object) {
    if (object == null) {
      return;
    }
    String value = (String) object;
    if (value.length() > 0) {
      try {
        model.setValue(model.getJcrPropertymodel().getProperty().getSession().getValueFactory().createValue(value));
      } catch(RepositoryException ex) {
        log.error(ex.getMessage(), ex);
      }
    }
  }
}
origin: info.magnolia/magnolia-core

@Override
public NodeData getWrappedNodeData() {
  try {
    // DHM.getNodeData() can still return null and the var itself is transient and won't survive serialization
    if (nodeData == null || (nodeData.isExist() && !nodeData.getJCRProperty().getSession().isLive())) {
      nodeData = getHierarchyManager().getNodeData(getPath());
    }
  } catch (RepositoryException e) {
    log.error("can't reinitialize node {}", getPath(), e);
  }
  return nodeData;
}
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();
  }
}
javax.jcrPropertygetSession

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

Popular in Java

  • Making http requests using okhttp
  • getSupportFragmentManager (FragmentActivity)
  • runOnUiThread (Activity)
  • getContentResolver (Context)
  • BorderLayout (java.awt)
    A border layout lays out a container, arranging and resizing its components to fit in five regions:
  • EOFException (java.io)
    Thrown when a program encounters the end of a file or stream during an input operation.
  • URL (java.net)
    A Uniform Resource Locator that identifies the location of an Internet resource as specified by RFC
  • SQLException (java.sql)
    An exception that indicates a failed JDBC operation. It provides the following information about pro
  • JButton (javax.swing)
  • Project (org.apache.tools.ant)
    Central representation of an Ant project. This class defines an Ant project with all of its targets,
  • From CI to AI: The AI layer in your organization
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

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