Search in sources :

Example 1 with PropertyId

use of org.opencastproject.assetmanager.api.PropertyId in project opencast by opencast.

the class DuplicateEventWorkflowOperationHandler method copyProperties.

private void copyProperties(String namespace, MediaPackage source, MediaPackage destination) {
    final AQueryBuilder q = assetManager.createQuery();
    final AResult properties = q.select(q.propertiesOf(namespace)).where(q.mediaPackageId(source.getIdentifier().toString())).run();
    if (properties.getRecords().head().isNone()) {
        logger.info("No properties to copy for media package {}.", source.getIdentifier(), namespace);
        return;
    }
    for (final Property p : properties.getRecords().head().get().getProperties()) {
        final PropertyId newPropId = PropertyId.mk(destination.getIdentifier().toString(), namespace, p.getId().getName());
        assetManager.setProperty(Property.mk(newPropId, p.getValue()));
    }
}
Also used : AQueryBuilder(org.opencastproject.assetmanager.api.query.AQueryBuilder) AResult(org.opencastproject.assetmanager.api.query.AResult) Property(org.opencastproject.assetmanager.api.Property) PropertyId(org.opencastproject.assetmanager.api.PropertyId)

Aggregations

Property (org.opencastproject.assetmanager.api.Property)1 PropertyId (org.opencastproject.assetmanager.api.PropertyId)1 AQueryBuilder (org.opencastproject.assetmanager.api.query.AQueryBuilder)1 AResult (org.opencastproject.assetmanager.api.query.AResult)1