}
public static PortletEntry mapDatabaseToEntry(PortletDbEntry pde)
throws TorqueException
{
PortletEntry pe = new BasePortletEntry(pde.getId());
pe.setApplication(pde.getApplication());
pe.setCachedOnURL(pde.getCachedOnUrl());
pe.setClassname(pde.getClassname());
pe.setDescription(pde.getDescription());
pe.setHidden(pde.getHidden());
MetaInfo meta = new BaseMetaInfo();
meta.setImage(pde.getImage());
meta.setDescription(pde.getDescription());
meta.setTitle(pde.getTitle());
pe.setMetaInfo(meta);
pe.setName(pde.getName());
pe.setParent(pde.getParent());
if(pde.getSecurityRef() != null)
{
SecurityReference ref = new BaseSecurityReference();
ref.setParent(pde.getSecurityRef());
pe.setSecurityRef(ref);
}
pe.setTitle(pde.getTitle());
pe.setType(pde.getType());
pe.setURL(pde.getURL());
// parameters
Iterator params = pde.getPortletParameters().iterator();
while (params.hasNext())
{
PortletParameter pp = (PortletParameter)params.next();
CachedParameter cp = new BaseCachedParameter(pp.getId());
cp.setCachedOnName(pp.getCachedOnName());
cp.setCachedOnValue(pp.getCachedOnValue());
cp.setDescription(pp.getDescription());
cp.setHidden(pp.getHidden());
cp.setName(pp.getName());
cp.setType(pp.getType());
cp.setValue(pp.getValue());
cp.setTitle(pp.getTitle());
if (pp.getDescription() != null || pp.getTitle() != null || pp.getImage() != null)
{
MetaInfo meta2 = new BaseMetaInfo();
meta2.setImage(pp.getImage());
meta2.setDescription(pp.getDescription());
meta2.setTitle(pp.getTitle());
cp.setMetaInfo(meta2);
}
if (pp.getSecurityRef() != null)
{
SecurityReference ref2 = new BaseSecurityReference();
ref2.setParent(pp.getSecurityRef());
cp.setSecurityRef(ref2);
}
pe.addParameter(cp);
}
// media types
Iterator mtypes = pde.getPortletMediatypes().iterator();
while (mtypes.hasNext())
{
PortletMediatype pm = (PortletMediatype)mtypes.next();
pe.addMediaType(pm.getName());
}
// categories
Iterator categories = pde.getPortletCategorys().iterator();
while (categories.hasNext())
{
PortletCategory pc = (PortletCategory)categories.next();
pe.addCategory(pc.getName(), pc.getGroup());
}
return pe;
}