Support multiple schemas in drag and drop import with metadata

Hi,

My documents use multiple schemas (quite a typical case I think, with dublincore + custom schema). I want to customize the “intelligent import” form to show items from these multiple schemas - rather like the “create” form without drag and drop.

I have found this question which shows how to customize the form, unfortunately this only supports a single schema so I have to pick between dc and (one of) my custom schema(s).

Apart from hacking DndFormActionBean, is there any way to work around this limitation?

Cheers,

0 votes

1 answers

1139 views

ANSWER



I finally overrode the DndFormActionBean with the following:

public List<String> getSchema() {
    if (schema != null && !schema.isEmpty()) {
        String[] schemas = schema.split(",");
        currentSchema = new ArrayList<String>(schemas.length);
        Collections.addAll(currentSchema, schemas);
    }
    return currentSchema;
}

(...)

@Factory(value = "dataCollector", scope = ScopeType.PAGE)
public Map<String, Map<String, Serializable>> getCollector() {
    if (metadataCollector == null) {
        metadataCollector = new HashMap<String, Map<String, Serializable>>();
        for (String schema : getSchema()) {
            metadataCollector.put(schema,
                new HashMap<String, Serializable>());
        }
    }
    return metadataCollector;
} 

This supports a comma-separated list of schemas in the action link parameters. It seems to work.

1 votes