@Test public void testMultipleTargetsFullSchema() throws OperationException { String schema = "common"; assertTrue(source.hasSchema(schema)); assertTrue(target1.hasSchema(schema)); assertTrue(target2.hasSchema(schema)); source.setProperty(schema, "icon-expanded", "icon-expanded1"); source.setProperty(schema, "icon", "icon1"); session.saveDocument(source); target1.setProperty(schema, "icon-expanded", "icon-expanded2"); target1.setProperty(schema, "icon", "icon2"); session.saveDocument(target1); target2.setProperty(schema, "icon-expanded", "icon-expanded2"); target2.setProperty(schema, "icon", "icon2"); session.saveDocument(target2); context.setInput(targets); OperationChain chain = new OperationChain("testMultipleTargersFullSchema"); chain.add(CopySchema.ID).set("sourceId", source.getId()).set("schema", schema); targets = (DocumentModelList)service.run(context, chain); assertEquals(target1, targets.get(0)); assertEquals(target2, targets.get(1)); for (Map.Entry<String, Object> pair : source.getProperties(schema).entrySet()) { assertEquals(source.getProperty(schema, pair.getKey()), target1.getProperty(schema, pair.getKey())); assertEquals(source.getProperty(schema, pair.getKey()), target2.getProperty(schema, pair.getKey())); } }
@OperationMethod(collector = DocumentModelCollector.class) public DocumentModel run(DocumentModel target) throws OperationException { DocumentModel source = getDocumentFromIdOrPath(); copySchemaProperties(source, target); if (saveDocument) { target = session.saveDocument(target); if (save) { session.save(); } } return target; }
CopySchema { @OperationMethod(collector = DocumentModelCollector.class) public DocumentModel run(DocumentModel target) throws OperationException { DocumentModel source = getDocumentFromIdOrPath(); copySchemaProperties(source, target); if (saveDocument) { target = session.saveDocument(target); if (save) { session.save(); } } return target; } }
CopySchema { @OperationMethod(collector = DocumentModelCollector.class) public DocumentModel run(DocumentModel target) throws OperationException { DocumentModel source = getDocumentFromIdOrPath(); copySchemaProperties(source, target); if (saveDocument) { target = session.saveDocument(target); if (save) { session.save(); } } return target; }  }
CopySchema { @OperationMethod(collector = DocumentModelCollector.class) public DocumentModel run(DocumentModel target) throws OperationException { DocumentModel source = getDocumentFromIdOrPath(); copySchemaProperties(source, target); if (saveDocument) { target = session.saveDocument(target); if (save) { session.save(); } } return target; }  @OperationMethod(collector = DocumentModelCollector.class) DocumentModel run(DocumentModel target); }
CopySchema { @OperationMethod(collector = DocumentModelCollector.class) public DocumentModel run(DocumentModel target) throws OperationException { DocumentModel source = getDocumentFromIdOrPath(); copySchemaProperties(source, target); if (saveDocument) { target = session.saveDocument(target); if (save) { session.save(); } } return target; }  @OperationMethod(collector = DocumentModelCollector.class) DocumentModel run(DocumentModel target); static final String ID; }