diff --git a/ccm-cms/src/main/java/org/librecms/pages/models/AudioAssetModel.java b/ccm-cms/src/main/java/org/librecms/pages/models/AudioAssetModel.java new file mode 100644 index 000000000..4169dbb32 --- /dev/null +++ b/ccm-cms/src/main/java/org/librecms/pages/models/AudioAssetModel.java @@ -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.AudioAsset; + +/** + * + * @author Jens Pelzetter + */ +public class AudioAssetModel extends AbstractAssetModel { + + private LegalMetadataModel legalMetadata; + + @Override + public String getType() { + return AudioAsset.class.getName(); + } + + public LegalMetadataModel getLegalMetadata() { + return legalMetadata; + } + + public void setLegalMetadata(final LegalMetadataModel legalMetadata) { + this.legalMetadata = legalMetadata; + } + +} diff --git a/ccm-cms/src/main/java/org/librecms/pages/models/AudioAssetModelBuilder.java b/ccm-cms/src/main/java/org/librecms/pages/models/AudioAssetModelBuilder.java new file mode 100644 index 000000000..c06f9cc1f --- /dev/null +++ b/ccm-cms/src/main/java/org/librecms/pages/models/AudioAssetModelBuilder.java @@ -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.AudioAsset; + +import javax.inject.Inject; +import javax.transaction.Transactional; + +/** + * + * @author Jens Pelzetter + */ +public class AudioAssetModelBuilder + extends AbstractAssetModelBuilder { + + @Inject + private LegalMetadataModelBuilder legalMetadataModelBuilder; + + @Override + public Class buildsAssetModelFor() { + return AudioAsset.class; + } + + @Override + protected AudioAssetModel buildModel() { + return new AudioAssetModel(); + } + + @Transactional(Transactional.TxType.REQUIRED) + @Override + protected void addProperties( + final AudioAsset asset, final AudioAssetModel model + ) { + super.addProperties(asset, model); + model.setLegalMetadata( + legalMetadataModelBuilder.buildAssetModel(asset.getLegalMetadata()) + ); + } + +}