contentKind = ObjectGenerator.CONTENT_KIND.ImageFractalJpeg;
else
contentKind = ObjectGenerator.CONTENT_KIND.StaticText;
}
// Create a hierarchy of folders and fill it with some documents
ObjectGenerator gen = new ObjectGenerator(objectFactory, svc, svc, svc, repositoryId, contentKind);
gen.setNumberOfDocumentsToCreatePerFolder(docsPerLevel);
// Set the type id for all created documents:
gen.setDocumentTypeId(documentTypeId);
// Set the type id for all created folders:
gen.setFolderTypeId(folderTypeId);
// Set contentSize
gen.setContentSizeInKB(contentSizeKB);
// set properties that need to be filled
// set the properties the generator should fill with values for
// documents:
// Note: must be valid properties in configured document and folder
// type
List<String> propsToSet = readPropertiesToSetFromConfig(parameters,
ConfigConstants.FILLER_DOCUMENT_PROPERTY);
if (null != propsToSet) {
gen.setDocumentPropertiesToGenerate(propsToSet);
}
propsToSet = readPropertiesToSetFromConfig(parameters, ConfigConstants.FILLER_FOLDER_PROPERTY);
if (null != propsToSet) {
gen.setFolderPropertiesToGenerate(propsToSet);
}
// Simulate a runtime context with configuration parameters
// Attach the CallContext to a thread local context that can be
// accessed from everywhere
DummyCallContext ctx = new DummyCallContext();
// create thread local storage and attach call context
getService(ctx);
// Build the tree
RepositoryInfo rep = svc.getRepositoryInfo(repositoryId, null);
String rootFolderId = rep.getRootFolderId();
try {
gen.createFolderHierachy(levels, childrenPerLevel, rootFolderId);
// Dump the tree
gen.dumpFolder(rootFolderId, "*");
} catch (Exception e) {
LOG.error("Could not create folder hierarchy with documents. " + e);
e.printStackTrace();
}
destroy();