4,6 → 4,7 |
import net.sf.hibernate.*; |
import ak.hostcaptain.util.HibernateUtil; |
import ak.hostcaptain.util.ModelException; |
import ak.hostcaptain.util.ModelSecurityException; |
|
public class MailAliasDestinationManager |
{ |
33,16 → 34,27 |
{ |
} |
|
public MailAliasDestination create() |
public MailAliasDestination create(User editor) |
throws ModelException |
{ |
if(!allowedToCreate(editor)) throw new ModelSecurityException(); |
|
return new MailAliasDestination(); |
} |
|
public MailAliasDestination get(Long id) |
public boolean allowedToCreate(User editor) |
throws ModelException |
{ |
return true; |
} |
|
public MailAliasDestination get(User editor, Long id) |
throws ModelException |
{ |
MailAliasDestination dest; |
|
try { |
return (MailAliasDestination)HibernateUtil.currentSession() |
dest = (MailAliasDestination)HibernateUtil.currentSession() |
.load(MailAliasDestination.class, id); |
} |
catch(HibernateException ex) |
49,11 → 61,19 |
{ |
throw new ModelException(ex); |
} |
|
if(!dest.viewableBy(editor)) |
throw new ModelSecurityException(); |
|
return dest; |
} |
|
public void save(MailAliasDestination mailAliasDestination) |
public void save(User editor, MailAliasDestination mailAliasDestination) |
throws ModelException |
{ |
if(!mailAliasDestination.editableBy(editor)) |
throw new ModelSecurityException(); |
|
try { |
HibernateUtil.currentSession().saveOrUpdate(mailAliasDestination); |
} |
63,9 → 83,12 |
} |
} |
|
public void delete(MailAliasDestination mailAliasDestination) |
public void delete(User editor, MailAliasDestination mailAliasDestination) |
throws ModelException |
{ |
if(!mailAliasDestination.deleteableBy(editor)) |
throw new ModelSecurityException(); |
|
try { |
HibernateUtil.currentSession().delete(mailAliasDestination); |
} |
75,11 → 98,6 |
} |
} |
|
public Collection listMailAliasesDestination() |
{ |
return null; |
} |
|
public Collection listMailAliasesDestination(MailAlias alias) |
throws ModelException |
{ |
94,6 → 112,12 |
} |
} |
|
public boolean areMailAliasesDestinationsAvailable(User editor) |
throws ModelException |
{ |
return true; |
} |
|
private static MailAliasDestinationManager mailAliasDestinationManager = null; |
|
public static MailAliasDestinationManager getInstance() |