String mediaIdParam = req.getParameter("mid");
String idParam = req.getParameter("cid");
if (idParam == null||mediaIdParam==null) throw new ServletModuleException("smod content :: attach :: cid/mid missing");
+
try {
EntityContent entContent = (EntityContent)mainModule.getById(idParam);
entContent.attach(mediaIdParam);
catch(ModuleException e) {
theLog.printError("smod content :: attach :: could not get entityContent");
}
+
+ try{
+ DatabaseContentToMedia.getInstance().setMedia(idParam,mediaIdParam);
+ } catch(Exception e){
+ theLog.printError("set media failed");
+ }
_showObject(idParam, req, res);
}
{
String idParam = req.getParameter("cid");
if (idParam == null) throw new ServletModuleException("smod content :: dettach :: cid missing");
+
+ //1-1-relation
+ //schould be deleted soon
try {
EntityContent entContent = (EntityContent)mainModule.getById(idParam);
entContent.dettach();
catch(ModuleException e) {
theLog.printError("smod content :: dettach :: could not get entityContent");
}
+
+ //1-n-relation
+ try{
+ DatabaseContentToMedia.getInstance().deleteByContentId(idParam);
+ } catch(Exception e){
+ theLog.printError("remove media failed");
+ }
_showObject(idParam, req, res);
}