
org.broadleafcommerce.cms.file.domain.ImageStaticAssetImpl Maven / Gradle / Ivy
/*
* Copyright 2008-2009 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.broadleafcommerce.cms.file.domain;
import org.broadleafcommerce.openadmin.audit.AdminAuditableListener;
import org.broadleafcommerce.presentation.AdminPresentation;
import org.hibernate.annotations.Cache;
import org.hibernate.annotations.CacheConcurrencyStrategy;
import javax.persistence.*;
/**
* Created by bpolster.
*/
@Entity
@Inheritance(strategy = InheritanceType.JOINED)
@EntityListeners(value = { AdminAuditableListener.class })
@Table(name = "BLC_IMG_STATIC_ASSET")
@Cache(usage= CacheConcurrencyStrategy.NONSTRICT_READ_WRITE, region="blCMSElements")
public class ImageStaticAssetImpl extends StaticAssetImpl implements ImageStaticAsset {
@Column(name ="WIDTH")
@AdminPresentation(friendlyName="Width", order=1, group = "Image Details", readOnly = true)
protected Integer width;
@Column(name ="HEIGHT")
@AdminPresentation(friendlyName="Height", order=2, group = "Image Details", readOnly = true)
protected Integer height;
@Override
public Integer getWidth() {
return width;
}
@Override
public void setWidth(Integer width) {
this.width = width;
}
@Override
public Integer getHeight() {
return height;
}
@Override
public void setHeight(Integer height) {
this.height = height;
}
@Override
public ImageStaticAsset cloneEntity() {
ImageStaticAssetImpl asset = new ImageStaticAssetImpl();
asset.name = name;
asset.site = site;
asset.archivedFlag = archivedFlag;
asset.deletedFlag = deletedFlag;
asset.fullUrl = fullUrl;
asset.fileSize = fileSize;
asset.mimeType = mimeType;
asset.sandbox = sandbox;
asset.originalAssetId = originalAssetId;
asset.width = width;
asset.height = height;
for (String key : contentMessageValues.keySet()) {
StaticAssetDescription oldAssetDescription = contentMessageValues.get(key);
StaticAssetDescription newAssetDescription = oldAssetDescription.cloneEntity();
asset.getContentMessageValues().put(key, newAssetDescription);
}
return asset;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy