protected Document fillCreateOptions(DocumentRef parentRef, String childName, Map<String, Serializable> options) throws DocumentSecurityException { Document folder; if (parentRef == null || EMPTY_PATH.equals(parentRef)) { folder = getSession().getNullDocument(); options.put(CoreEventConstants.DESTINATION_REF, null); options.put(CoreEventConstants.DESTINATION_PATH, null); options.put(CoreEventConstants.DESTINATION_NAME, childName); options.put(CoreEventConstants.DESTINATION_EXISTS, false); } else { folder = resolveReference(parentRef); checkPermission(folder, ADD_CHILDREN); options.put(CoreEventConstants.DESTINATION_REF, parentRef); options.put(CoreEventConstants.DESTINATION_PATH, folder.getPath()); options.put(CoreEventConstants.DESTINATION_NAME, childName); if (Boolean.TRUE.equals(options.get(CoreSession.SKIP_DESTINATION_CHECK_ON_CREATE))) { options.put(CoreEventConstants.DESTINATION_EXISTS, false); } else { options.put(CoreEventConstants.DESTINATION_EXISTS, folder.hasChild(childName)); } } return folder; }