public Void execute() throws Throwable { behaviourFilter.disableBehaviour(ContentModel.ASPECT_AUDITABLE); // Lasts for txn // Set the auditable properties explicitly Long currentTime = System.currentTimeMillis(); auditableProps.put(ContentModel.PROP_CREATOR, "Creator-" +currentTime); auditableProps.put(ContentModel.PROP_CREATED, new Date(currentTime - 1000L)); auditableProps.put(ContentModel.PROP_MODIFIER, "Modifier-" + currentTime); auditableProps.put(ContentModel.PROP_MODIFIED, new Date(currentTime - 1000L)); nodeService.addProperties(nodeRef, auditableProps); // Done return null; } };
internalNodeService.addProperties(targetNodeRef, residualProperties);
internalNodeService.addProperties(targetNodeRef, residualProperties);
nodeService.addProperties( rootNodeRef, Collections.singletonMap(PROP_QNAME_ANY_PROP_MULTIPLE, (Serializable) listProp)); listProp.add("ONE"); nodeService.addProperties( rootNodeRef, Collections.singletonMap(PROP_QNAME_ANY_PROP_MULTIPLE, (Serializable) listProp)); listProp.add("TWO"); nodeService.addProperties( rootNodeRef, Collections.singletonMap(PROP_QNAME_ANY_PROP_MULTIPLE, (Serializable) listProp)); nodeService.addProperties( rootNodeRef, Collections.singletonMap(PROP_QNAME_ANY_PROP_SINGLE, (Serializable) listProp)); listProp.add("ONE"); nodeService.addProperties( rootNodeRef, Collections.singletonMap(PROP_QNAME_ANY_PROP_SINGLE, (Serializable) listProp)); listProp.add("TWO"); nodeService.addProperties( rootNodeRef, Collections.singletonMap(PROP_QNAME_ANY_PROP_SINGLE, (Serializable) listProp));
internalNodeService.addProperties(targetNodeRef, classProperties);
internalNodeService.addProperties(targetNodeRef, classProperties);
props.put(ContentModel.PROP_IS_INDEXED, false); this.nodeService.addProperties(currentDescriptorNodeRef, props);
@Override public Void execute() throws Throwable { assertEquals(0, taggingService.findTagScope(testData.container1).getTags().size()); assertEquals(0, taggingService.findTagScope(testData.container2).getTags().size()); assertEquals(1, nodeService.getChildAssocs(testData.container1).size()); // Now update the folder to add in tags Map<QName, Serializable> taggedFolderProps = new HashMap<QName, Serializable>(1); List<NodeRef> tagsList = new ArrayList<NodeRef>(); tagsList.add(testData.tagFoo1); tagsList.add(testData.tagFoo3); taggedFolderProps.put(ContentModel.ASPECT_TAGGABLE, (Serializable) tagsList); nodeService.addProperties(testData.taggedFolder, taggedFolderProps); return null; } });
this.nodeService.addProperties(nodeRef, propsToPersist);
nodeService.addProperties(nodeRef, metadata.getProperties());
nodeService.addProperties(nodeRef, metadata.getProperties());
this.nodeService.addProperties(nodeRef, propsToPersist);
@Test public void testRenameSite() { // test that changing the name of a site generates an appropriate exception try { String siteName = GUID.generate(); SiteInfo siteInfo = createSite(siteName, "doclib", SiteVisibility.PUBLIC); NodeRef childRef = siteInfo.getNodeRef(); Map<QName, Serializable> props = new HashMap<QName, Serializable>(); props.put(ContentModel.PROP_NAME, siteName + "Renamed"); nodeService.addProperties(childRef, props); fail("Should have caught rename"); } catch(SiteServiceException e) { assertTrue(e.getMessage().contains("can not be renamed")); } }
@Test public void testAddProperties() throws Exception { Map<QName, Serializable> properties = nodeService.getProperties(rootNodeRef); // Add an aspect with a default value nodeService.addAspect(rootNodeRef, ASPECT_QNAME_TEST_TITLED, null); assertNull("Expected null property", nodeService.getProperty(rootNodeRef, PROP_QNAME_TEST_TITLE)); assertNull("Expected null property", nodeService.getProperty(rootNodeRef, PROP_QNAME_TEST_DESCRIPTION)); // Now add a map of two properties and check Map<QName, Serializable> addProperties = new HashMap<QName, Serializable>(11); addProperties.put(PROP_QNAME_TEST_TITLE, "Title"); addProperties.put(PROP_QNAME_TEST_DESCRIPTION, "Description"); nodeService.addProperties(rootNodeRef, addProperties); // Check Map<QName, Serializable> checkProperties = nodeService.getProperties(rootNodeRef); assertEquals("Title", checkProperties.get(PROP_QNAME_TEST_TITLE)); assertEquals("Description", checkProperties.get(PROP_QNAME_TEST_DESCRIPTION)); }
nodeService.addProperties(nodeRef, auditableProps);
@Override protected void persistNode(NodeRef nodeRef, FormData data) { super.persistNode(nodeRef, data); QName type = this.nodeService.getType(nodeRef); Set<QName> aspectNames = getAspectNames(getTypedItem(typeItem)); TypeDefinition typeDef = this.dictionaryService.getAnonymousType(type, aspectNames); Map<QName, PropertyDefinition> propDefs = typeDef.getProperties(); Map<QName, Serializable> propsToPersist = new HashMap<QName, Serializable>(); for (FieldData fieldData : data) { String fieldName = fieldData.getName(); if (fieldName.startsWith(PROP_DATA_PREFIX)) { processPropertyPersist(nodeRef, propDefs, fieldData, propsToPersist, data); } } this.nodeService.addProperties(nodeRef, propsToPersist); }
nodeService.addProperties(nodeRef, properties); nodeService.addProperties(nodeRef, properties);
nodeService.addProperties(nodeRef, properties);
@Override public Void execute() throws Throwable { assertEquals(3, taggingService.findTagScope(testData.container1).getTags().size()); assertEquals(3, taggingService.findTagScope(testData.container2).getTags().size()); assertEquals(2, nodeService.getChildAssocs(testData.container2).size()); assertEquals(1, nodeService.getChildAssocs(testData.taggedFolder2).size()); assertEquals(2, taggingService.findTagScope(testData.container1).getTag("foo1").getCount()); assertEquals(1, taggingService.findTagScope(testData.container1).getTag("foo2").getCount()); assertEquals(1, taggingService.findTagScope(testData.container1).getTag("foo3").getCount()); assertEquals(3, taggingService.findTagScope(testData.container2).getTag("foo1").getCount()); assertEquals(2, taggingService.findTagScope(testData.container2).getTag("foo2").getCount()); assertEquals(1, taggingService.findTagScope(testData.container2).getTag("foo3").getCount()); // Update the document on the original List<NodeRef> tagsList = new ArrayList<NodeRef>(); tagsList.add(testData.tagBar); Map<QName, Serializable> taggedDocProps = new HashMap<QName, Serializable>(1); taggedDocProps.put(ContentModel.ASPECT_TAGGABLE, (Serializable)tagsList); taggedDocProps.put(ContentModel.PROP_NAME, "UpdatedDocument"); nodeService.addProperties(testData.taggedDoc, taggedDocProps); return null; } });
properties = new HashMap<QName, Serializable>(5); properties.put(BaseNodeServiceTest.PROP_QNAME_TEST_DESCRIPTION, "A description"); nodeService.addProperties(nodeRef, properties); assertTrue("Aspect not automatically added during 'addProperties'", nodeService.hasAspect(nodeRef, BaseNodeServiceTest.ASPECT_QNAME_TEST_TITLED));