Model for ExternalAudioAssets

pull/10/head
Jens Pelzetter 2021-11-06 15:53:39 +01:00
parent 9ba0610308
commit ccf0fe5819
2 changed files with 101 additions and 0 deletions

View File

@ -0,0 +1,44 @@
/*
* Copyright (C) 2021 LibreCCM Foundation.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
* MA 02110-1301 USA
*/
package org.librecms.pages.models;
import org.librecms.assets.ExternalAudioAsset;
/**
*
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
*/
public class ExternalAudioAssetModel extends BookmarkModel {
private LegalMetadataModel legalMetadata;
@Override
public String getType() {
return ExternalAudioAsset.class.getName();
}
public LegalMetadataModel getLegalMetadata() {
return legalMetadata;
}
public void setLegalMetadata(final LegalMetadataModel legalMetadata) {
this.legalMetadata = legalMetadata;
}
}

View File

@ -0,0 +1,57 @@
/*
* Copyright (C) 2021 LibreCCM Foundation.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
* MA 02110-1301 USA
*/
package org.librecms.pages.models;
import org.librecms.assets.ExternalAudioAsset;
import javax.inject.Inject;
import javax.transaction.Transactional;
/**
*
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
*/
public class ExternalAudioAssetModelBuilder
extends AbstractBookmarkModelBuilder<ExternalAudioAsset, ExternalAudioAssetModel> {
@Inject
private LegalMetadataModelBuilder legalMetadataModelBuilder;
@Override
public Class<ExternalAudioAsset> buildsAssetModelFor() {
return ExternalAudioAsset.class;
}
@Override
protected ExternalAudioAssetModel buildModel() {
return new ExternalAudioAssetModel();
}
@Transactional(Transactional.TxType.REQUIRED)
@Override
protected void addProperties(
final ExternalAudioAsset asset, final ExternalAudioAssetModel model
) {
super.addProperties(asset, model);
model.setLegalMetadata(
legalMetadataModelBuilder.buildAssetModel(asset.getLegalMetadata())
);
}
}