1 package de.webman.content.eventhandler; 2 3 import com.teamkonzept.web.*; 4 import com.teamkonzept.webman.*; 5 import com.teamkonzept.webman.mainint.*; 6 import de.webman.content.workflow.db.VersionStatusTransitionDBData; 7 import com.teamkonzept.webman.mainint.db.queries.*; 8 import com.teamkonzept.webman.mainint.events.*; 9 import com.teamkonzept.lib.*; 10 import com.teamkonzept.field.*; 11 import com.teamkonzept.field.db.*; 12 import com.teamkonzept.db.*; 13 import de.webman.content.workflow.*; 14 import de.webman.content.*; 15 import java.sql.*; 16 import java.util.*; 17 18 24 public class CESwitchMutipleContentHandler extends DefaultEventHandler implements DatabaseDefaults, ParameterTypes, FrameConstants 25 { 26 private CESwitchMutipleContentHandler() 27 {} 28 29 private static CESwitchMutipleContentHandler instance = new CESwitchMutipleContentHandler(); 30 31 public static CESwitchMutipleContentHandler getInstance() 32 { 33 return instance; 34 } 35 36 public void handleEvent(TKEvent evt) throws TKException 37 { 38 try 39 { 40 CEUtils.checkEvent(evt); 41 String newStatus = ""; 42 newStatus = evt.getParameter("NEW_STATUS",evt.getName()); 43 44 Integer newStatusInt = new Integer (newStatus); 47 Vector instanceIDs = CEUtils.getSelectedContentsList(evt); 49 50 if (instanceIDs != null) 51 { 52 boolean del; 53 int i = 0; 54 while (i < instanceIDs.size()) 55 { 56 Content content = ContentFactory.getInstance().getContent(new Integer ((String )(instanceIDs.elementAt(i)))); 57 del = true; 59 try 60 { 61 content.switchToStatus(newStatusInt, evt.getRemoteUser(), true); 62 } 63 catch(Exception e) 64 { 65 del = false; 66 } 67 if (del) 68 instanceIDs.remove(i); 69 else 70 i++; 71 } 72 evt.getParams().put(PARAMETER,"SELECTED_CONTENTS_LIST",new String (CEUtils.getSelectedContentsString(instanceIDs) + "-")); 74 evt.getParams().put(PARAMETER,"NOT_SELECTED_CONTENTS_LIST",new String ("")); 75 } 76 77 evt.getParams().put(PARAMETER, "RECALCULATE", "a"); 78 CEBrowseHandler.getInstance().handleEvent(evt); 80 81 } 82 catch (Throwable e) 83 { 84 throw WebmanExceptionHandler.getException(e); 86 } 87 } 88 89 public boolean isHandler(TKEvent evt) 90 { 91 return (evt.getName().startsWith("CE_SWITCH_MUTIPLE")); 92 } 93 } | Popular Tags |