congrats Icon
New! Tabnine Pro 14-day free trial
Start a free trial
Tabnine Logo
Property.getLong
Code IndexAdd Tabnine to your IDE (free)

How to use
getLong
method
in
javax.jcr.Property

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

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

public Object jsGet_long() {
  try {
    return property.getLong();
  } catch (RepositoryException re) {
    return Undefined.instance;
  }
}
origin: info.magnolia/magnolia-module-standard-templating-kit

@Override
protected int getMaxResults() {
  try {
    if (content.hasProperty("maxResults")) {
      return (int) content.getProperty("maxResults").getLong();
    }
    return Integer.MAX_VALUE;
  } catch (RepositoryException e) {
    return Integer.MAX_VALUE;
  }
}
origin: info.magnolia/magnolia-core

public static Long getLong(Node node, String name, Long defaultValue) {
  if (node != null) {
    try {
      if (node.hasProperty(name)) {
        return node.getProperty(name).getLong();
      }
    } catch (RepositoryException e) {
      log.error("can't read value '{}' of the Node '{}' will return default value", name, node.toString(), e);
    }
  }
  return defaultValue;
}
origin: apache/jackrabbit

/**
 * Tests if adding a property with <code>Node.setProperty(String,
 * long)</code> works with <code>Session.save()</code>
 */
public void testNewLongPropertySession() throws Exception {
  testNode.setProperty(propertyName1, l1);
  superuser.save();
  assertEquals("Setting property with Node.setProperty(String, long) and Session.save() not working",
      new Long(l1),
      new Long(testNode.getProperty(propertyName1).getLong()));
}
origin: apache/jackrabbit

/**
 * Tests if adding a property with <code>Node.setProperty(String,
 * long)</code> works with <code>parentNode.save()</code>
 */
public void testNewLongPropertyParent() throws Exception {
  testNode.setProperty(propertyName1, l1);
  testRootNode.getSession().save();
  assertEquals("Setting property with Node.setProperty(String, long) and parentNode.save() not working",
      new Long(l1),
      new Long(testNode.getProperty(propertyName1).getLong()));
}
origin: info.magnolia/magnolia-core

public long getLongProperty(String name) {
  try {
    final Property property = getJCRProperty(name);
    if (property != null) {
      return property.getLong();
    }
  } catch (RepositoryException re) {
    log.error(re.getMessage(), re);
  }
  return 0L;
}
origin: exoplatform/platform

private ForumsWeeklyStatistic getForumsWeeklyStatistic(Node node) throws Exception {
 ForumsWeeklyStatistic statistic = new ForumsWeeklyStatistic();
 statistic.setId(node.getName());
 statistic.setStartDate(node.getProperty("exo:startDate").getDate().getTime());
 statistic.setStartPostsCountOfWeek(node.getProperty("exo:startPostsCountOfWeek").getLong());
 statistic.setPostsCountOfWeek(node.getProperty("exo:postsCountOfWeek").getLong());
 statistic.setLastStatEntry(node.getProperty("exo:lastStatEntry").getDate().getTime());
 return statistic;
}
origin: org.fcrepo/fcrepo-kernel-modeshape

@Override
public long getContentSize() {
  try {
    if (hasDescriptionProperty(CONTENT_SIZE)) {
      return getDescriptionProperty(CONTENT_SIZE).getLong();
    }
  } catch (final RepositoryException e) {
    LOGGER.warn("Could not get contentSize(): {}", e.getMessage());
  }
  return -1L;
}
origin: info.magnolia/magnolia-core

@Override
public long getLong() {
  if (isExist()) {
    try {
      return getJCRProperty().getLong();
    } catch (RepositoryException e) {
      throw new RuntimeException("Can't read value of nodedata " + toString(), e);
    }
  }
  return 0;
}
origin: brix-cms/brix-cms

public long getLong(Property property) throws RepositoryException {
  if (getPrevious() != null) {
    return getPrevious().getLong(property);
  } else {
    return property.getLong();
  }
}
origin: apache/jackrabbit-oak

  @Override
  protected void entering(Node node, int level) throws RepositoryException {
    if (node.isNodeType("rep:Permissions")
        && node.hasProperty("rep:accessControlledPath")
        && path.equals(node.getProperty("rep:accessControlledPath").getString())) {
      assertEquals(index, node.getProperty("rep:index").getLong());
      assertEquals(isAllow, node.getProperty("rep:isAllow").getBoolean());
    }
  }
};
origin: apache/jackrabbit-oak

private static void check(Session session) throws RepositoryException {
  if (session.getNode("/testNode").getProperty("p1").getLong() +
      session.getNode("/testNode").getProperty("p2").getLong() < 0) {
    fail("p1 + p2 < 0");
  }
}
origin: apache/jackrabbit-oak

private static void assertCounter(@NotNull final Node counter, final long expectedCount) 
                throws RepositoryException {
  checkNotNull(counter);
  
  assertTrue(counter.hasProperty(PROP_COUNTER));
  assertEquals(expectedCount, counter.getProperty(PROP_COUNTER).getLong());
  assertFalse(counter.hasProperty(PROP_INCREMENT));
}

origin: ModeShape/modeshape

protected void assertFile( Node node,
              File file ) throws Exception {
  assertThat(node.getName(), is(file.getName()));
  assertThat(node.getIndex(), is(1));
  assertThat(node.getPrimaryNodeType().getName(), is("nt:file"));
  assertThat(node.getProperty("jcr:created").getLong(), is(createdTimeFor(file)));
  Node content = node.getNode("jcr:content");
  assertThat(content.getName(), is("jcr:content"));
  assertThat(content.getIndex(), is(1));
  assertThat(content.getPrimaryNodeType().getName(), is("nt:resource"));
  assertThat(content.getProperty("jcr:lastModified").getLong(), is(file.lastModified()));
}
origin: ModeShape/modeshape

@Test
public void shouldSequenceTextTemplate() throws Exception {
  // GIVEN
  String filename = "text.ott";
  // WHEN
  createNodeWithContentFromFile(filename, filename);
  // THEN
  Node sequencedNode = getOutputNode(rootNode, "sequenced/odf/" + filename);
  assertThat(sequencedNode.getProperty(JcrConstants.JCR_MIME_TYPE).getString(), is("application/vnd.oasis.opendocument.text-template"));
  assertThat(sequencedNode.getProperty(PAGES).getLong(), is(2L));
  assertCommonMetadata(sequencedNode);
}
origin: info.magnolia/magnolia-core

  private void checkACL(String path, long right, String permissionNodeName) throws RepositoryException {
    assertTrue(userRoleSession.nodeExists("/superuser/acl_userroles"));
    aclUserrolesNode = userRoleSession.getNode("/superuser/acl_userroles");
    assertTrue(aclUserrolesNode.hasNode(permissionNodeName));
    Node permission = aclUserrolesNode.getNode(permissionNodeName);
    assertTrue(permission.hasProperty("path"));
    assertEquals(path, permission.getProperty("path").getString());
    assertTrue(permission.hasProperty("permissions"));
    assertEquals(right, permission.getProperty("permissions").getLong());
  }
}
origin: info.magnolia/magnolia-core

@Test
public void setPropertyToInteger() throws Exception {
  // GIVEN
  final int value = 123;
  PropertyUtil.setProperty(root, PROPERTY_NAME, value);
  // WHEN
  Long longValue = root.getProperty(PROPERTY_NAME).getLong();
  // THEN
  assertEquals(value, longValue.intValue());
}
origin: info.magnolia/magnolia-core

@Test
public void setPropertyToLong() throws Exception {
  // GIVEN
  final Object value = Long.valueOf(123l);
  PropertyUtil.setProperty(root, PROPERTY_NAME, value);
  // WHEN
  long resr = root.getProperty(PROPERTY_NAME).getLong();
  // THEN
  assertEquals(value, resr);
}
origin: apache/jackrabbit

public void testReset() throws Exception {
  TokenInfo info = tokenProvider.createToken(testuser, new SimpleCredentials(userId, userId.toCharArray()));
  long expTime = getTokenNode(info).getProperty("rep:token.exp").getLong();
  long loginTime = waitForSystemTimeIncrement(System.currentTimeMillis());
  assertFalse(info.resetExpiration(loginTime));
  assertFalse(info.resetExpiration(loginTime + TokenBasedAuthentication.TOKEN_EXPIRATION));
  assertTrue(info.resetExpiration(loginTime + TokenBasedAuthentication.TOKEN_EXPIRATION / 2));
  long expTime2 = getTokenNode(info).getProperty("rep:token.exp").getLong();
  assertFalse(expTime == expTime2);
}
origin: ModeShape/modeshape

@Test
public void shouldCreateProjectionWithoutAlias() throws Exception {
  // link the first external document
  federationManager.createProjection("/testRoot", SOURCE_NAME, MockConnector.DOC1_LOCATION, null);
  assertEquals(1, testRoot.getNodes().getSize());
  Node doc1Federated = assertNodeFound("/testRoot" + MockConnector.DOC1_LOCATION);
  assertEquals(testRoot.getIdentifier(), doc1Federated.getParent().getIdentifier());
  assertEquals("a string", doc1Federated.getProperty("federated1_prop1").getString());
  assertEquals(12, doc1Federated.getProperty("federated1_prop2").getLong());
}
javax.jcrPropertygetLong

Javadoc

Returns a long representation of the value of this property. A shortcut for Property.getValue().getLong().

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()
  • getDefinition
    Returns the property definition that applies to this property. In some cases there may appear to be
  • setValue
    Sets the value of this property to the values array. If this property's property type is not constra
  • getDefinition,
  • setValue,
  • getParent,
  • getPath,
  • getNode,
  • getLength,
  • getDouble,
  • getStream,
  • getSession

Popular in Java

  • Updating database using SQL prepared statement
  • addToBackStack (FragmentTransaction)
  • onCreateOptionsMenu (Activity)
  • getSharedPreferences (Context)
  • BorderLayout (java.awt)
    A border layout lays out a container, arranging and resizing its components to fit in five regions:
  • FileNotFoundException (java.io)
    Thrown when a file specified by a program cannot be found.
  • Selector (java.nio.channels)
    A controller for the selection of SelectableChannel objects. Selectable channels can be registered w
  • Iterator (java.util)
    An iterator over a sequence of objects, such as a collection.If a collection has been changed since
  • Properties (java.util)
    A Properties object is a Hashtable where the keys and values must be Strings. Each property can have
  • Semaphore (java.util.concurrent)
    A counting semaphore. Conceptually, a semaphore maintains a set of permits. Each #acquire blocks if
  • Top 17 Plugins for Android Studio
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