public abstract class GraphicElement extends Object implements Cloneable, Serializable, ResourceHolder, org.hibernate.classic.Lifecycle, Visitable
Modifier and Type | Field and Description |
---|---|
protected Long |
dbid |
static Properties |
DEFAULT_PROPERTIES |
protected Properties |
description |
static String |
DESCRIPTOR_FILENAME |
protected String |
id |
protected static String |
JSPS_PREFIX |
protected static String |
JSPS_SUFFIX |
protected Long |
panelId |
protected HashMap |
resources |
protected Long |
sectionId |
protected String |
workspaceId |
Constructor and Description |
---|
GraphicElement()
Empty constructor required by Hibernate
|
GraphicElement(String id,
File zipFile)
Constructs a graphic resource with given id and zip file.
|
Modifier and Type | Method and Description |
---|---|
Object |
acceptVisit(WorkspaceVisitor visitor) |
void |
checkDeployment()
Determine if this element has been deployed, and if not, deploys to the default deployment directory.
|
void |
clearDeploymentFiles()
Clear the files inside the deployment dir.
|
Object |
clone() |
int |
compareTo(Object o)
Compare with another element.
|
protected void |
deploy()
Process the element descriptor inside the zip file, and set properties for given graphic element.
|
protected void |
deployFiles()
Deploy to a given directory.
|
protected abstract Object |
elementClone()
Clone this object.
|
boolean |
equals(Object o) |
protected abstract String |
getBaseDir()
Subdirectory inside getMappingDir() where this element stores files.
|
abstract String |
getCategoryName()
Get the category name representing this type of element
|
Long |
getDbid()
Database identifier
|
protected String |
getDeploymentDirName()
Physical directory name where this resource is to be deployed.
|
Map |
getDescription()
Element i18n description
|
protected abstract String |
getDescriptorFileName()
Name of the file that contains the descriptor (i.e. skin.properties...)
|
String |
getId()
Identifier
|
abstract GraphicElementManager |
getInstanceManager()
Manager that handles this type of resource.
|
Date |
getLastModified() |
protected LocaleManager |
getLocaleManager() |
protected abstract String |
getMappingDir()
Directory where the elements of this type deployment files should be placed (starting in the webapp root)
also serves as starting point for urls.
|
Long |
getPanelId()
Panel identifier this resource belongs to
|
protected String |
getPrefixForResourcePath(String resourcePath)
Determine a prefix String for resource with given path
|
ResourceName |
getRelativeResourceName(String id)
Given a resource id in this resource container, return a name based on the resource id.
|
Resource |
getResource(ResourceName resourceName,
String lang)
Retrieve a resource by name in a given lang
|
ResourceName |
getResourceName(String id)
Given a resource id in this resource container, return a name based on the resource id.
|
Set |
getResources()
Returns a set of resource identifiers stored in this element
|
Long |
getSectionId()
Section identifier this resource belongs to
|
protected String |
getSuffixForResourcePath(String resourcePath)
Determine a prefix String for resource with given path
|
protected File |
getTmpZipFile() |
String |
getWorkspaceId()
Workspace identifier this resource belongs to
|
byte[] |
getZipFile()
Zipped file content
|
boolean |
onDelete(org.hibernate.Session s) |
void |
onLoad(org.hibernate.Session s,
Serializable id) |
boolean |
onSave(org.hibernate.Session s) |
boolean |
onUpdate(org.hibernate.Session s) |
void |
setDbid(Long dbid)
Database identifier
|
protected void |
setDescription(Properties description)
Element i18n description
|
protected void |
setDescription(String value,
String lang)
Element i18n description
|
void |
setId(String id)
Identifier
|
void |
setLastModified(Date lastModified) |
void |
setPanelId(Long panelId)
Panel identifier this resource belongs to
|
void |
setSectionId(Long sectionId)
Section identifier this resource belongs to
|
void |
setWorkspaceId(String workspaceId)
Workspace identifier this resource belongs to
|
void |
setZipFile(byte[] zipFile)
Zipped file content
|
void |
setZipFile(File f)
Zipped file
|
protected void |
unzip(ZipInputStream zin,
String s,
String resourcePath)
Unzip given stream to destination file.
|
protected Long dbid
protected String id
protected Properties description
protected HashMap resources
protected String workspaceId
protected Long sectionId
protected Long panelId
public static final String DESCRIPTOR_FILENAME
public static final Properties DEFAULT_PROPERTIES
protected static final String JSPS_PREFIX
protected static final String JSPS_SUFFIX
protected LocaleManager getLocaleManager()
protected abstract String getDescriptorFileName()
protected abstract String getMappingDir()
protected abstract String getBaseDir()
public abstract GraphicElementManager getInstanceManager()
protected abstract Object elementClone()
protected File getTmpZipFile()
public Long getDbid()
public void setDbid(Long dbid)
dbid
- Database identifierpublic String getId()
public void setId(String id)
id
- Identifierpublic Date getLastModified()
public void setLastModified(Date lastModified)
public Map getDescription()
protected void setDescription(Properties description)
description
- Element i18n descriptionprotected void setDescription(String value, String lang)
value
- lang
- public Set getResources()
getResources
in interface ResourceHolder
public Resource getResource(ResourceName resourceName, String lang)
getResource
in interface ResourceHolder
resourceName
- Resource namelang
- language for the resourcepublic ResourceName getResourceName(String id)
id
- Resource id, something like "CLOSE", "ICO_SMALL" ...public ResourceName getRelativeResourceName(String id)
id
- Resource id, something like "CLOSE", "ICO_SMALL" ...public abstract String getCategoryName()
public byte[] getZipFile()
public void setZipFile(byte[] zipFile) throws Exception
zipFile
- Zipped file contentException
public void setZipFile(File f) throws Exception
f
- Zipped fileException
public String getWorkspaceId()
public void setWorkspaceId(String workspaceId)
workspaceId
- Workspace identifier this resource belongs topublic Long getSectionId()
public void setSectionId(Long sectionId)
sectionId
- Section identifier this resource belongs topublic Long getPanelId()
public void setPanelId(Long panelId)
panelId
- Panel identifier this resource belongs toprotected void deploy() throws Exception
IOException
Exception
protected void deployFiles() throws Exception
IOException
Exception
protected void unzip(ZipInputStream zin, String s, String resourcePath) throws IOException
zin
- Stream to unzip.s
- File name for destination.IOException
- in case there are errors in the stream.protected String getPrefixForResourcePath(String resourcePath)
resourcePath
- protected String getSuffixForResourcePath(String resourcePath)
resourcePath
- protected String getDeploymentDirName()
public void checkDeployment()
checkDeployment
in interface ResourceHolder
public void clearDeploymentFiles()
public int compareTo(Object o)
o
- the Object to be compared.ClassCastException
- if the specified object's type prevents it
from being compared to this Object.public boolean onSave(org.hibernate.Session s) throws org.hibernate.CallbackException
onSave
in interface org.hibernate.classic.Lifecycle
org.hibernate.CallbackException
public boolean onUpdate(org.hibernate.Session s) throws org.hibernate.CallbackException
onUpdate
in interface org.hibernate.classic.Lifecycle
org.hibernate.CallbackException
public boolean onDelete(org.hibernate.Session s) throws org.hibernate.CallbackException
onDelete
in interface org.hibernate.classic.Lifecycle
org.hibernate.CallbackException
public void onLoad(org.hibernate.Session s, Serializable id)
onLoad
in interface org.hibernate.classic.Lifecycle
public Object acceptVisit(WorkspaceVisitor visitor) throws Exception
acceptVisit
in interface Visitable
Exception
Copyright © 2012-2014 JBoss by Red Hat. All Rights Reserved.