Codota Logo
Property.getType
Code IndexAdd Codota to your IDE (free)

How to use
getType
method
in
javax.jcr.Property

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

  • Common ways to obtain Property
private void myMethod () {
Property p =
  • Codota IconNode node;String name;String value;node.setProperty(name, value)
  • Codota IconNode node;String relPath;node.getProperty(relPath)
  • Codota IconPropertyIterator iter;iter.nextProperty()
  • Smart code suggestions by Codota
}
origin: org.onehippo.cms7/hippo-repository-connector

/**
 * @inheritDoc
 */
public int getType() throws RepositoryException {
  return property.getType();
}
origin: apache/jackrabbit

/** {@inheritDoc} */
public int getType() throws RepositoryException, RemoteException {
  try {
    return property.getType();
  } catch (RepositoryException ex) {
    throw getRepositoryException(ex);
  }
}
origin: info.magnolia/magnolia-core

@Override
public boolean evaluateTyped(Property property) {
  try {
    return !excludedNames.contains(property.getName()) && !excludedTypes.contains(PropertyType.nameFromValue(property.getType()));
  } catch (RepositoryException e) {
    return false;
  }
}
origin: info.magnolia/magnolia-core

@Override
public int getType() {
  if (isExist()) {
    try {
      return getJCRProperty().getType();
    } catch (Exception e) {
      log.warn("Unable to read property type for {}", name);
    }
  }
  return PropertyType.UNDEFINED;
}
origin: apache/jackrabbit

  public void testNotNormalizedPathValue() throws RepositoryException {
    ValueFactory vf = superuser.getValueFactory();
    Value pathValue = vf.createValue("/a/../b/./c/dd/..", PropertyType.PATH);

    Property p = testRootNode.setProperty(propertyName1, pathValue);

    assertEquals(PropertyType.PATH, p.getType());
    assertEquals(pathValue.getString(), p.getValue().getString());
    assertEquals(pathValue, p.getValue());                
  }
}
origin: org.onehippo.cms7/hippo-repository-modules

private void forStringCodecProperties(final Node node, final PropertyVisitor visitor) throws RepositoryException {
  final PropertyIterator properties = node.getProperties();
  while (properties.hasNext()) {
    final Property property = properties.nextProperty();
    if (!property.isMultiple()
        && property.getType() == PropertyType.STRING
        && !property.getName().contains(":")) {
      visitor.visit(property);
    }
  }
}
origin: apache/jackrabbit-oak

public void testRemoveReferenced1() throws RepositoryException {
  Node ref = testRootNode.addNode(nodeName1, testNodeType);
  ref.addMixin(mixReferenceable);
  superuser.save();
  Node n1 = testRootNode.addNode(nodeName2, testNodeType);
  n1.setProperty("ref", ref);
  assertEquals(PropertyType.REFERENCE, n1.getProperty("ref").getType());
  superuser.save();
  ref.remove();
  n1.remove();
  superuser.save();
}
origin: apache/jackrabbit

public void testSetPropertyConvertMultiValued() throws RepositoryException {
  Node n = testRootNode.addNode(nodeName1, "test:canSetProperty");
  // must convert to long there is no other definition for this property
  Property p = n.setProperty("LongMultiple", new String[]{"123", "456"});
  assertEquals(PropertyType.nameFromValue(PropertyType.LONG),
      PropertyType.nameFromValue(p.getType()));
}
origin: info.magnolia/magnolia-core

@Test
public void setPropertyStringStringInt() throws RepositoryException {
  // GIVEN
  Node node = MgnlContext.getJCRSession("website").getRootNode().addNode("test", MgnlNodeType.NT_CONTENT);
  assertTrue(NodeUtil.isWrappedWith(node, MgnlAuditLoggingContentDecoratorNodeWrapper.class));
  // WHEN
  node.setProperty("test", "true", PropertyType.BOOLEAN);
  // THEN
  assertEquals(PropertyType.BOOLEAN, node.getProperty("test").getType());
}
origin: info.magnolia/magnolia-core

@Test
public void setPropertyStringStringArrayInt() throws RepositoryException {
  // GIVEN
  Node node = MgnlContext.getJCRSession("website").getRootNode().addNode("test", MgnlNodeType.NT_CONTENT);
  assertTrue(NodeUtil.isWrappedWith(node, MgnlAuditLoggingContentDecoratorNodeWrapper.class));
  String[] values = {"true"};
  // WHEN
  node.setProperty("test", values, PropertyType.BOOLEAN);
  // THEN
  assertEquals(PropertyType.BOOLEAN, node.getProperty("test").getType());
}
origin: apache/jackrabbit-oak

public void testGetTypeOfPredecessors() throws RepositoryException {
  Node node = testRootNode.addNode(nodeName1, testNodeType);
  node.addMixin(mixVersionable);
  superuser.save();
  VersionManager vMgr = superuser.getWorkspace().getVersionManager();
  vMgr.checkin(node.getPath());
  assertEquals(PropertyType.nameFromValue(PropertyType.REFERENCE),
      PropertyType.nameFromValue(node.getProperty(jcrPredecessors).getType()));
}
origin: org.chromattic/chromattic.core

public void testStringKey() throws Exception {
 assertNull(o.getString());
 Map<String, Object> map = o.getProperties();
 map.put("string_property", "foo");
 assertEquals("foo", map.get("string_property"));
 assertEquals(PropertyType.STRING, node.getProperty("string_property").getType());
 assertEquals("foo", node.getProperty("string_property").getString());
 if (getConfig().isStateCacheDisabled()) {
  node.setProperty("string_property", (String)null);
  assertEquals(null, map.get("string_property"));
 }
}
origin: info.magnolia/magnolia-core

@Test
public void setPropertyStringValueInt() throws RepositoryException {
  // GIVEN
  Node node = MgnlContext.getJCRSession("website").getRootNode().addNode("test", MgnlNodeType.NT_CONTENT);
  assertTrue(NodeUtil.isWrappedWith(node, MgnlAuditLoggingContentDecoratorNodeWrapper.class));
  // WHEN
  node.setProperty("test", ValueFactoryImpl.getInstance().createValue("true"), PropertyType.BOOLEAN);
  // THEN
  assertEquals(PropertyType.BOOLEAN, node.getProperty("test").getType());
}
origin: info.magnolia/magnolia-core

@Test
public void setPropertyStringValueArrayInt() throws RepositoryException {
  // GIVEN
  Node node = MgnlContext.getJCRSession("website").getRootNode().addNode("test", MgnlNodeType.NT_CONTENT);
  assertTrue(NodeUtil.isWrappedWith(node, MgnlAuditLoggingContentDecoratorNodeWrapper.class));
  Value[] values = {ValueFactoryImpl.getInstance().createValue("true")};
  // WHEN
  node.setProperty("test", values, PropertyType.BOOLEAN);
  // THEN
  assertEquals(PropertyType.BOOLEAN, node.getProperty("test").getType());
}
origin: info.magnolia/magnolia-core

@Test
public void updateFrom534CheckSuperuserRolePermissionAreUpdated() throws Exception {
  // GIVEN
  Node roleNode = NodeUtil.createPath(userRolesSession.getRootNode(), "superuser", NodeTypes.Role.NAME);
  Node permissionNode = NodeUtil.createPath(roleNode, "acl_forum", NodeTypes.Role.NAME);
  Node wrongPermissionNode = NodeUtil.createPath(permissionNode, "0", NodeTypes.ContentNode.NAME);
  wrongPermissionNode.setProperty("permissions", "63");
  // WHEN
  executeUpdatesAsIfTheCurrentlyInstalledVersionWas(Version.parseVersion("5.3.4"));
  // THEN
  assertThat(wrongPermissionNode.getProperty("permissions").getType(), CoreMatchers.is(PropertyType.LONG));
}
origin: info.magnolia/magnolia-core

@Test
public void addLongProperty() throws Exception {
  final Long propertyValue = 666L;
  final ValueFactory valueFactory = mock(ValueFactory.class);
  when(valueFactory.createValue(propertyValue)).thenReturn(new MockValue(propertyValue));
  session.setValueFactory(valueFactory);
  final NodeOperation op = Ops.addProperty(PROPERTY_NAME, propertyValue);
  op.exec(rootNode, errorHandler);
  assertThat(rootNode, hasProperty(PROPERTY_NAME, propertyValue));
  assertThat("We want to make sure the property is created with the correct type",
      rootNode.getProperty(PROPERTY_NAME).getType(), is(PropertyType.LONG));
}
origin: org.onehippo.cms7/hippo-repository-engine

protected DefinitionPropertyImpl exportProperty(final Property property, DefinitionNodeImpl definitionNode) throws RepositoryException {
  if (property.isMultiple()) {
    return definitionNode.addProperty(property.getName(), ValueType.fromJcrType(property.getType()),
        valuesFrom(property, definitionNode));
  } else {
    final ValueImpl value = valueFrom(property, definitionNode);
    final DefinitionPropertyImpl targetProperty = definitionNode.addProperty(property.getName(), value);
    value.setParent(targetProperty);
    return targetProperty;
  }
}
origin: info.magnolia/magnolia-core

@Test
public void testGetType() throws Exception {
  String stringValue = "string";
  Property property = new MockProperty("test", new MockValue(stringValue), null);
  assertEquals(PropertyType.STRING, property.getType());
}
origin: apache/jackrabbit-oak

private static void assertVersionablePath(final VersionHistory history, final String versionablePath)
    throws RepositoryException {
  final String workspaceName = history.getSession().getWorkspace().getName();
  assertTrue(history.isNodeType(MIX_REP_VERSIONABLE_PATHS));
  assertTrue(history.hasProperty(workspaceName));
  final Property pathProperty = history.getProperty(workspaceName);
  assertEquals(PropertyType.PATH, pathProperty.getType());
  assertEquals(versionablePath, pathProperty.getString());
}
origin: apache/jackrabbit-oak

public void testStringRequiredTypeBoolean() throws Exception {
  Value stringValue = superuser.getValueFactory().createValue("true", PropertyType.STRING);
  Property p = node.setProperty(BOOLEAN_PROP_NAME, stringValue);
  assertEquals(PropertyType.BOOLEAN, p.getType());
  assertEquals(PropertyType.BOOLEAN, p.getValue().getType());
  assertTrue(p.getBoolean());
  PropertyDefinition def = p.getDefinition();
  assertEquals(PropertyType.BOOLEAN, def.getRequiredType());
  assertEquals(NT_NAME, def.getDeclaringNodeType().getName());
}
javax.jcrPropertygetType

Javadoc

Returns the type of this Property. One of:
  • PropertyType.STRING
  • PropertyType.BINARY
  • PropertyType.DATE
  • PropertyType.DOUBLE
  • PropertyType.LONG
  • PropertyType.BOOLEAN
  • PropertyType.NAME
  • PropertyType.PATH
  • PropertyType.REFERENCE
  • PropertyType.WEAKREFERENCE
  • PropertyType.URI
The type returned is that which was set at property creation. Note that for some property p, the type returned by p.getType() will differ from the type returned by p.getDefinition.getRequiredType() only in the case where the latter returns UNDEFINED. The type of a property instance is never UNDEFINED (it must always have some actual type).

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
  • 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
  • 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

  • Finding current android device location
  • compareTo (BigDecimal)
  • getOriginalFilename (MultipartFile)
    Return the original filename in the client's filesystem.This may contain path information depending
  • getSupportFragmentManager (FragmentActivity)
    Return the FragmentManager for interacting with fragments associated with this activity.
  • FlowLayout (java.awt)
    A flow layout arranges components in a left-to-right flow, much like lines of text in a paragraph. F
  • FileOutputStream (java.io)
    A file output stream is an output stream for writing data to aFile or to a FileDescriptor. Whether
  • Path (java.nio.file)
  • Servlet (javax.servlet)
    Defines methods that all servlets must implement.A servlet is a small Java program that runs within
  • JButton (javax.swing)
  • Option (scala)
Codota Logo
  • Products

    Search for Java codeSearch for JavaScript codeEnterprise
  • IDE Plugins

    IntelliJ IDEAWebStormAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogCodota Academy Plugin user guide Terms of usePrivacy policyJava Code IndexJavascript Code Index
Get Codota for your IDE now