@Test public void testThrowException() { String schema = "dublincore"; String property = "title"; boolean triggeredException = false; assertTrue(target1.hasSchema(schema)); target1.setProperty(schema, property, target1.getName()); session.saveDocument(target1); context.setInput(target1); OperationChain chain = new OperationChain("testThrowException"); chain.add(CopySchema.ID).set("schema", schema); try { target1 = (DocumentModel)service.run(context, chain); } catch (OperationException e) { triggeredException = true; } assertTrue(triggeredException); }
@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; }