}
}
public void insert(Session session, Node parentNode, String nodeName, Object object) {
ClassDescriptor classDescriptor = mapper.getClassDescriptorByClass(object.getClass());
String jcrType = classDescriptor.getJcrType();
if ((jcrType == null) || jcrType.equals("")) {
jcrType = ManagerConstant.NT_UNSTRUCTURED;
}
Node objectNode;
try {
objectNode = parentNode.addNode(nodeName, jcrType);
} catch (NoSuchNodeTypeException nsnte) {
throw new JcrMappingException("Unknown node type " + jcrType + " for mapped class " + object.getClass(), nsnte);
} catch (RepositoryException re) {
throw new ObjectContentManagerException("Cannot create new node of type " + jcrType + " from mapped class "
+ object.getClass(), re);
}
String[] mixinTypes = classDescriptor.getJcrMixinTypes();
String mixinTypeName = null;
try {
// Add mixin types
if (null != classDescriptor.getJcrMixinTypes()) {
for (int i = 0; i < mixinTypes.length; i++) {
mixinTypeName = mixinTypes[i].trim();
objectNode.addMixin(mixinTypeName);
}
}
// Add mixin types defined in the associated interfaces
if (!classDescriptor.hasDiscriminator() && classDescriptor.hasInterfaces()) {
Iterator interfacesIterator = classDescriptor.getImplements().iterator();
while (interfacesIterator.hasNext()) {
String interfaceName = (String) interfacesIterator.next();
ClassDescriptor interfaceDescriptor = mapper
.getClassDescriptorByClass(ReflectionUtils.forName(interfaceName));
objectNode.addMixin(interfaceDescriptor.getJcrType().trim());
}
}
// If required, add the discriminator node type
if (classDescriptor.hasDiscriminator()) {