Refine search
private static void copyFolderTypes(final Node parentNode, final Node newFolder) throws RepositoryException { final Property parentFolderType = parentNode.getProperty(HIPPOSTD_FOLDERTYPE); newFolder.setProperty(HIPPOSTD_FOLDERTYPE, parentFolderType.getValues()); } }
private boolean needsUpdate(Node indexNode, IndexDefinition def) throws RepositoryException { Value[] currentPropertyNames = indexNode.getProperty(PN_PROPERTY_NAMES).getValues(); return !currentPropertyNames[0].getString().equals(def.propertyName); }
private boolean isLive(Node document) throws RepositoryException { final Property property = JcrUtils.getPropertyIfExists(document, HippoNodeType.HIPPO_AVAILABILITY); if (property != null) { for (Value value : property.getValues()) { if ("live".equals(value.getString())) { return true; } } } return false; }
private void writeSupertypes(Writer out, Node node) throws IOException, RepositoryException { Value[] types = node.getProperty(JcrConstants.JCR_SUPERTYPES).getValues(); String delim = " > "; for (Value s: types) { out.write(delim); out.write(s.getString()); delim = ", "; } }
/** * Tests if adding properties with <code>Node.setProperty(String, * String[])</code> works with <code>Session.save()</code> */ public void testNewStringArrayPropertySession() throws Exception { testNode.setProperty(propertyName2, sArray1); superuser.save(); assertEquals("Setting properties with Node.setProperty(String, String[]) and Session.save() not working", Arrays.asList(vArray1), Arrays.asList(testNode.getProperty(propertyName2).getValues())); }
public final Set<String> getMembers(Node group) throws RepositoryException { final Property membersProperty = JcrUtils.getPropertyIfExists(group, HippoNodeType.HIPPO_MEMBERS); if (membersProperty != null) { Value[] values = membersProperty.getValues(); final Set<String> members = new HashSet<>(values.length); for (final Value value : values) { members.add(value.getString()); } return members; } return new HashSet<>(); }
private boolean isLive(Node variant) throws RepositoryException { if (variant.hasProperty(HippoNodeType.HIPPO_AVAILABILITY)) { Property property = variant.getProperty(HippoNodeType.HIPPO_AVAILABILITY); for (Value value : property.getValues()) { if ("live".equals(value.getString())) { return true; } } } return false; }
/** * Tests if adding properties with <code>Node.setProperty(String, * Value[])</code> works with <code>Session.save()</code> */ public void testNewValueArrayPropertySession() throws Exception { testNode.setProperty(propertyName2, vArray1); superuser.save(); assertEquals("Setting properties with Node.setProperty(String, Value[]) and Session.save() not working", Arrays.asList(vArray1), Arrays.asList(testNode.getProperty(propertyName2).getValues())); }
public List<String> getGalleryTypes() throws RemoteException, RepositoryException { List<String> list = new LinkedList<>(); Value[] values = subject.getProperty(HIPPOSTD_GALLERYTYPE).getValues(); for (final Value value : values) { list.add(value.getString()); } return list; }
/** * Tests if adding properties with <code>Node.setProperty(String, * Value[])</code> works with <code>parentNode.save()</code> */ public void testNewValueArrayPropertyParent() throws Exception { testNode.setProperty(propertyName2, vArray1); testRootNode.getSession().save(); assertEquals("Setting properties with Node.setProperty(String, Value[]) and parentNode.save() not working", Arrays.asList(vArray1), Arrays.asList(testNode.getProperty(propertyName2).getValues())); }
/** * 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); }
public static String getDefaultPosition(final Node editorTemplate) throws RepositoryException { final Node root = editorTemplate.getNode("root"); if (root.hasProperty("wicket.extensions")) { final Value[] extensions = root.getProperty("wicket.extensions").getValues(); return root.getProperty(extensions[0].getString()).getString() + ".item"; } return "${cluster.id}.field"; }
/** * Tests if adding properties with <code>Node.setProperty(String, Value[], * int)</code> works with <code>Session.save()</code> */ public void testNewValueArrayPropertySessionWithPropertyType() throws Exception { testNode.setProperty(propertyName2, vArray1, PropertyType.STRING); superuser.save(); assertEquals("Setting properties with Node.setProperty(String, Value[], int) and Session.save() not working", Arrays.asList(vArray1), Arrays.asList(testNode.getProperty(propertyName2).getValues())); }
public List<String> getMembers() throws RepositoryException { List<String> members = new ArrayList<String>(); if (node.hasProperty(HippoNodeType.HIPPO_MEMBERS)) { Value[] vals = node.getProperty(HippoNodeType.HIPPO_MEMBERS).getValues(); for (Value val : vals) { members.add(val.getString()); } } Collections.sort(members); return members; }
protected static boolean hasProperty(final Node node, final String propertyName) throws RepositoryException { if (!node.hasProperty(propertyName)) { return false; } final Property property = node.getProperty(propertyName); if (!property.isMultiple()) { return true; } // empty multiple property is equivalent to no property. return property.getValues().length > 0; }
@Test public void testMultiStringProperty() throws Exception { // GIVEN final String propertyName = "multi"; final String first = "one"; final String second = "two"; // WHEN root.setProperty(propertyName, new String[]{first, second}); // THEN assertTrue(root.hasProperty(propertyName)); Property property = root.getProperty(propertyName); assertEquals(first, property.getValues()[0].getString()); assertEquals(second, property.getValues()[1].getString()); }
public static String getDefaultPosition(final Node editorTemplate) throws RepositoryException { final Node root = editorTemplate.getNode("root"); if (root.hasProperty("wicket.extensions")) { final Value[] extensions = root.getProperty("wicket.extensions").getValues(); return root.getProperty(extensions[0].getString()).getString() + ".item"; } return "${cluster.id}.field"; }
/** * Tests if adding properties with <code>Node.setProperty(String, String[], * int)</code> works with <code>parentNode.save()</code> */ public void testNewStringArrayPropertyParentWithPropertyType() throws Exception { testNode.setProperty(propertyName2, sArray1, PropertyType.STRING); testRootNode.getSession().save(); assertEquals("Setting properties with Node.setProperty(String, String[], int) and parentNode.save() not working", Arrays.asList(vArray1), Arrays.asList(testNode.getProperty(propertyName2).getValues())); }