|
From: <jt...@hy...> - 2007-03-12 23:53:49
|
Author: jtravis Date: 2007-03-12 15:53:46 -0800 (Mon, 12 Mar 2007) New Revision: 3717 URL: http://svn.hyperic.org/?view=rev&root=Hyperic+HQ&revision=3717 Modified: trunk/installer/data/db-upgrade.xml trunk/sql/events/Action.hq-xml trunk/src/org/hyperic/hq/events/server/session/Action.java trunk/src/org/hyperic/hq/events/server/session/ActionManagerEJBImpl.java Log: Fix HQ-554. Deleting an action which was associated with an escalation will now mark it as deleted, but leave it in the DB to deal with FKs from the GalertActionLogs Modified: trunk/installer/data/db-upgrade.xml =================================================================== --- trunk/installer/data/db-upgrade.xml 2007-03-12 23:09:21 UTC (rev 3716) +++ trunk/installer/data/db-upgrade.xml 2007-03-12 23:53:46 UTC (rev 3717) @@ -4924,6 +4924,15 @@ </schema-directSQL> </schemaSpec> + <schemaSpec version="3.20"> + <schema-addColumn table="EAM_ACTION" column="DELETED" + columnType="BOOLEAN"/> + <schema-update table="EAM_ACTION" column="DELETED" + columnType="BOOLEAN" value="FALSE" /> + <schema-alterColumn table="EAM_ACTION" column="DELETED" + nullable="NOT NULL"/> + </schemaSpec> + </dbupgrade> </target> Modified: trunk/sql/events/Action.hq-xml =================================================================== --- trunk/sql/events/Action.hq-xml 2007-03-12 23:09:21 UTC (rev 3716) +++ trunk/sql/events/Action.hq-xml 2007-03-12 23:53:46 UTC (rev 3717) @@ -47,6 +47,11 @@ <key column="ACTION_ID" /> <one-to-many class="AlertActionLog" /> </bag> + + <property name="deleted"> + <column name="DELETED" not-null="true"/> + </property> + </class> </hibernate-mapping> Modified: trunk/src/org/hyperic/hq/events/server/session/Action.java =================================================================== --- trunk/src/org/hyperic/hq/events/server/session/Action.java 2007-03-12 23:09:21 UTC (rev 3716) +++ trunk/src/org/hyperic/hq/events/server/session/Action.java 2007-03-12 23:53:46 UTC (rev 3717) @@ -28,7 +28,6 @@ import java.util.ArrayList; import java.util.Collection; import java.util.Collections; -import java.util.Set; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; @@ -44,7 +43,6 @@ import org.hyperic.hq.events.NoOpAction; import org.hyperic.hq.events.shared.ActionValue; import org.hyperic.util.ArrayUtil; -import org.hyperic.util.StringUtil; import org.hyperic.util.config.ConfigResponse; import org.hyperic.util.config.EncodingException; import org.hyperic.util.json.JSON; @@ -65,7 +63,8 @@ private AlertDefinition _alertDef; private Collection _logEntries = new ArrayList(); private Collection _children = new ArrayList(); - + private boolean _deleted = false; + private ActionValue _valueObj; static Action newInstance(JSONObject json) @@ -205,6 +204,14 @@ _logEntries = logEntries; } + public boolean isDeleted() { + return _deleted; + } + + protected void setDeleted(boolean deleted) { + _deleted = deleted; + } + public ActionValue getActionValue() { if (_valueObj == null) _valueObj = new ActionValue(); Modified: trunk/src/org/hyperic/hq/events/server/session/ActionManagerEJBImpl.java =================================================================== --- trunk/src/org/hyperic/hq/events/server/session/ActionManagerEJBImpl.java 2007-03-12 23:09:21 UTC (rev 3716) +++ trunk/src/org/hyperic/hq/events/server/session/ActionManagerEJBImpl.java 2007-03-12 23:53:46 UTC (rev 3717) @@ -181,12 +181,13 @@ } /** - * Delete a free-standing action + * Mark a free-standing action as deleted. These actions will later be + * deleted by a cleanup thread. * * @ejb:interface-method */ - public void deleteAction(Action a) { - _actDAO.remove(a); + public void markActionDeleted(Action a) { + a.setDeleted(true); } private void setParentAction(ActionValue val, Action action) { |