Details
Description
1.custom node type ,
[decm:note]
- decm:user (string) mandatory
- decm:date (date) mandatory
- decm:text (string) mandatory
2.ocm bean
@Node(jcrType = "decm:note")
public class DmsNote {
@Field(path = true)
private String path;
@Field(jcrName = "decm:user")
private String user;
@Field(jcrName = "decm:date")
private Date date;
@Field(jcrName = "decm:text")
private String text;
3.ocm insert
List<Class> annotatedClassNames = new ArrayList<Class>();
annotatedClassNames.add(DmsNote.class);
annotatedClassNames.add(DmsFolder.class);
// 2.
Mapper mapper = new AnnotationMapperImpl(annotatedClassNames);
// 3.
ObjectContentManager ocm = new ObjectContentManagerImpl(ses, mapper);
DmsNote not = (DmsNote) ocm.getObject("/decmNoteTest");
System.out.println(not.toString());
DmsNote f = new DmsNote();
f.setPath("/decmNoteTest");
f.setDate(new Date());
f.setText("ceshiha");
f.setUser("lucas.yue");
ocm.insert(f);
4.error:
Caused by: javax.jcr.NamespaceException: ocm: is not a registered namespace prefix.