Briefcase Engine

The Briefcase Engine offers collections of content instances that can be shared among multiple users. Briefcase contents can also be queried using the search engine, using a custom filter.

The basic workflow when working with briefcases is as follows:

Example 6.20. Working with briefcases and metadata

final BriefcaseEngine be = EJBLookup.getBriefcaseEngine();

// create a new briefcase
final int briefcaseId = be.create("test", "description", /* ACL */ null);

// get PKs of all visible folders
final FxResultSet result = new SqlQueryBuilder().select("@pk").type("FOLDER").getResult();
final List<FxPK> folders = result.collectColumn(1);
assert !folders.isEmpty();

// add to briefcase
be.addItems(briefcaseId, folders);
assert be.load(briefcaseId).getSize() == folders.size();

// add some metadata for this briefcase for the first folder
final FxReferenceMetaData<FxPK> meta = FxReferenceMetaData.createNew(folders.get(0));
meta.put("processed", "false");
be.mergeMetaData(briefcaseId, Arrays.asList(meta));

// select briefcase contents
final FxResultSet items = new SqlQueryBuilder().select("@pk", "caption", "@metadata")
	.filterBriefcase(briefcaseId)
	.getResult();
assert items.getRowCount() == folders.size();

// get metadata from FxSQL result set
final List<FxReferenceMetaData<FxPK>> resultMeta = items.collectColumn(3);
// check if our "processed" flag set above was preserved
assert false == FxReferenceMetaData.findByContent(
			resultMeta,
			meta.getReference()
		).getBoolean(
			"processed",
			/* default */ true
		);