Issue #3004: Move ClearPracticeVTECTableRequest and its handler from gfe to activetable plugin.

Change-Id: I46b1d79f1b6602254febff5d7c3d8f655a22bf2d

Former-commit-id: 1c7e650e6a [formerly c8a6dc8769] [formerly da31ab2042 [formerly 6c5e65e538e145d31c84d2f81f7b41202ae41ad0]]
Former-commit-id: da31ab2042
Former-commit-id: 72229cfb94
This commit is contained in:
David Gillingham 2014-04-09 15:11:03 -05:00
parent 64f44d5e6c
commit 0385a4395e
10 changed files with 155 additions and 128 deletions

View file

@ -32,6 +32,7 @@ import org.eclipse.core.runtime.Status;
import com.raytheon.uf.common.activetable.ActiveTableMode;
import com.raytheon.uf.common.activetable.ActiveTableRecord;
import com.raytheon.uf.common.activetable.request.ClearPracticeVTECTableRequest;
import com.raytheon.uf.common.dataplugin.gfe.db.objects.DatabaseID;
import com.raytheon.uf.common.dataplugin.gfe.db.objects.GridLocation;
import com.raytheon.uf.common.dataplugin.gfe.db.objects.GridParmInfo;
@ -41,7 +42,6 @@ import com.raytheon.uf.common.dataplugin.gfe.discrete.DiscreteKey;
import com.raytheon.uf.common.dataplugin.gfe.reference.ReferenceData;
import com.raytheon.uf.common.dataplugin.gfe.reference.ReferenceID;
import com.raytheon.uf.common.dataplugin.gfe.request.AbstractGfeRequest;
import com.raytheon.uf.common.dataplugin.gfe.request.ClearPracticeVTECTableRequest;
import com.raytheon.uf.common.dataplugin.gfe.request.CommitGridsRequest;
import com.raytheon.uf.common.dataplugin.gfe.request.CreateNewDbRequest;
import com.raytheon.uf.common.dataplugin.gfe.request.GetActiveTableRequest;
@ -119,6 +119,7 @@ import com.raytheon.viz.gfe.core.parm.Parm;
* fix warnings.
* 11/20/2013 #2331 randerso Added getTopoData method
* 04/03/2014 #2737 randerso Moved clientISCSendStatus to SaveGFEGridRequest
* 04/09/2014 #3004 dgilling Support moved ClearPracticeVTECTableRequest.
*
* </pre>
*
@ -752,10 +753,15 @@ public class IFPClient {
}
public void clearPracticeTable(String siteId) throws VizException {
ClearPracticeVTECTableRequest request = new ClearPracticeVTECTableRequest();
request.setRequestedSiteId(SiteMap.getInstance().getSite4LetterId(
siteId));
makeRequest(request);
try {
ClearPracticeVTECTableRequest request = new ClearPracticeVTECTableRequest(
SiteMap.getInstance().getSite4LetterId(siteId),
workstationID);
ThriftClient.sendRequest(request);
} catch (VizException e) {
throw new GFEServerException(
"Could not clear practice active table.", e);
}
}
public ServerResponse<?> getGridHistory(ParmID parmID,

View file

@ -27,11 +27,6 @@
<constructor-arg value="com.raytheon.uf.common.dataplugin.gfe.request.SaveASCIIGridsRequest"/>
<constructor-arg ref="SaveASCIIGridsHandler"/>
</bean>
<bean id="clearTableHandler" class="com.raytheon.edex.plugin.gfe.server.handler.ClearPracticeVTECTableHandler"/>
<bean factory-bean="handlerRegistry" factory-method="register">
<constructor-arg value="com.raytheon.uf.common.dataplugin.gfe.request.ClearPracticeVTECTableRequest"/>
<constructor-arg ref="clearTableHandler"/>
</bean>
<bean id="brokerConnectionsProvider" class="com.raytheon.uf.edex.esb.camel.jms.QpidBrokerConnectionsImpl"/>
<bean id="clientsHandler" class="com.raytheon.edex.plugin.gfe.server.handler.GetClientsHandler">
<constructor-arg ref="brokerConnectionsProvider"/>

View file

@ -0,0 +1,90 @@
/**
* This software was developed and / or modified by Raytheon Company,
* pursuant to Contract DG133W-05-CQ-1067 with the US Government.
*
* U.S. EXPORT CONTROLLED TECHNICAL DATA
* This software product contains export-restricted data whose
* export/transfer/disclosure is restricted by U.S. law. Dissemination
* to non-U.S. persons whether in the United States or abroad requires
* an export license or other authorization.
*
* Contractor Name: Raytheon Company
* Contractor Address: 6825 Pine Street, Suite 340
* Mail Stop B8
* Omaha, NE 68106
* 402.291.0100
*
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
* further licensing information.
**/
package com.raytheon.uf.common.activetable.request;
import com.raytheon.uf.common.message.WsId;
import com.raytheon.uf.common.serialization.annotations.DynamicSerialize;
import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
import com.raytheon.uf.common.serialization.comm.IServerRequest;
/**
* Request to clear practice VTEC active table.
*
* <pre>
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Apr 09, 2014 #3004 dgilling Move to activetable plugin, remove GFE
* dependencies.
*
* </pre>
*
* @author xxxxxxxx
* @version 1.0
*/
@DynamicSerialize
public final class ClearPracticeVTECTableRequest implements IServerRequest {
@DynamicSerializeElement
private WsId workstationID;
@DynamicSerializeElement
private String siteID;
/**
* Default constructor. Intended only to be used by DynamicSerialize.
*/
public ClearPracticeVTECTableRequest() {
}
/**
* Constructs a new request for the given site ID and workstation ID.
*
* @param siteID
* The 4-character site identifier of the site whose active table
* you want to clear.
* @param workstationID
* <code>WsId</code> of the user making the request.
*/
public ClearPracticeVTECTableRequest(String siteID, WsId workstationID) {
this.siteID = siteID;
this.workstationID = workstationID;
}
public WsId getWorkstationID() {
return workstationID;
}
public void setWorkstationID(WsId workstationID) {
this.workstationID = workstationID;
}
public String getSiteID() {
return siteID;
}
public void setSiteID(String siteID) {
this.siteID = siteID;
}
}

View file

@ -1,60 +0,0 @@
/**
* This software was developed and / or modified by Raytheon Company,
* pursuant to Contract DG133W-05-CQ-1067 with the US Government.
*
* U.S. EXPORT CONTROLLED TECHNICAL DATA
* This software product contains export-restricted data whose
* export/transfer/disclosure is restricted by U.S. law. Dissemination
* to non-U.S. persons whether in the United States or abroad requires
* an export license or other authorization.
*
* Contractor Name: Raytheon Company
* Contractor Address: 6825 Pine Street, Suite 340
* Mail Stop B8
* Omaha, NE 68106
* 402.291.0100
*
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
* further licensing information.
**/
package com.raytheon.uf.common.dataplugin.gfe.request;
import com.raytheon.uf.common.activetable.ActiveTableMode;
import com.raytheon.uf.common.serialization.annotations.DynamicSerialize;
import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
@DynamicSerialize
public class ClearPracticeVTECTableRequest extends AbstractGfeRequest {
// public class GetActiveTableRequest extends AbstractGfeRequest {
@DynamicSerializeElement
private String requestedSiteId;
@DynamicSerializeElement
private ActiveTableMode mode;
/**
* @return the requestedSiteId
*/
public String getRequestedSiteId() {
return requestedSiteId;
}
/**
* @param requestedSiteId
* the requestedSiteId to set
*/
public void setRequestedSiteId(String requestedSiteId) {
this.requestedSiteId = requestedSiteId;
}
public ActiveTableMode getMode() {
return mode;
}
public void setMode(ActiveTableMode mode) {
this.mode = mode;
}
}

View file

@ -3,6 +3,11 @@
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.1.xsd
http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd">
<bean id="clearTableHandler" class="com.raytheon.uf.edex.activetable.handler.ClearPracticeVTECTableHandler"/>
<bean factory-bean="handlerRegistry" factory-method="register">
<constructor-arg value="com.raytheon.uf.common.activetable.request.ClearPracticeVTECTableRequest"/>
<constructor-arg ref="clearTableHandler"/>
</bean>
<bean id="getActiveTableHandler" class="com.raytheon.uf.edex.activetable.GetActiveTableHandler"/>
<bean factory-bean="handlerRegistry" factory-method="register">
<constructor-arg value="com.raytheon.uf.common.activetable.GetActiveTableRequest"/>

View file

@ -81,6 +81,8 @@ import com.raytheon.uf.edex.database.query.DatabaseQuery;
* Aug 29, 2013 1843 dgilling Move ETN related methods to
* GetNextEtnUtil.
* Mar 06, 2014 2883 randerso Pass siteId into python code
* Apr 10, 2014 3004 dgilling Remove ActiveTableMode parameter from
* clearPracticeTable().
*
* </pre>
*
@ -530,8 +532,8 @@ public class ActiveTable {
python.dispose();
}
public static void clearPracticeTable(String requestedSiteId,
ActiveTableMode mode) throws DataAccessLayerException {
public static void clearPracticeTable(String requestedSiteId)
throws DataAccessLayerException {
CoreDao dao = practiceDao;
String sql = "delete from practice_activetable;";
dao.executeNativeSql(sql);

View file

@ -17,57 +17,51 @@
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
* further licensing information.
**/
package com.raytheon.edex.plugin.gfe.server.handler;
package com.raytheon.uf.edex.activetable.handler;
/**
* TODO Add Description
*
* <pre>
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Apr 23, 2010 wkwock Initial creation
*
* </pre>
*
* @author wkwock
* @version 1.0
*/
import java.util.List;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import com.raytheon.uf.common.dataplugin.gfe.request.ClearPracticeVTECTableRequest;
import com.raytheon.uf.common.dataplugin.gfe.server.message.ServerResponse;
import com.raytheon.uf.common.activetable.request.ClearPracticeVTECTableRequest;
import com.raytheon.uf.common.serialization.comm.IRequestHandler;
import com.raytheon.uf.common.status.IUFStatusHandler;
import com.raytheon.uf.common.status.UFStatus;
import com.raytheon.uf.edex.activetable.ActiveTable;
import com.raytheon.uf.edex.database.DataAccessLayerException;
/**
* Request handler for clearing the practice VTEC active table.
*
* <pre>
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Apr 23, 2010 wkwock Initial creation
* Apr 09, 2014 #3004 dgilling Move to activetable plugin, remove GFE
* dependencies.
*
* </pre>
*
* @author wkwock
* @version 1.0
*/
public class ClearPracticeVTECTableHandler implements
IRequestHandler<ClearPracticeVTECTableRequest> {
private static final transient IUFStatusHandler statusHandler = UFStatus
.getHandler(ClearPracticeVTECTableHandler.class);
@Override
public ServerResponse<List<String>> handleRequest(
ClearPracticeVTECTableRequest request) throws Exception {
ServerResponse<List<String>> sr = new ServerResponse<List<String>>();
Log logger = LogFactory.getLog(getClass());
public Boolean handleRequest(ClearPracticeVTECTableRequest request)
throws Exception {
try {
ActiveTable.clearPracticeTable(request.getRequestedSiteId(),
request.getMode());
ActiveTable.clearPracticeTable(request.getSiteID());
} catch (DataAccessLayerException e) {
logger.error("Error failed to clear practice VTEC table", e);
sr.addMessage("Error failed to clear practice VTEC table");
statusHandler.error("Error failed to clear practice VTEC table", e);
throw new Exception("Unable to clear practice VTEC table.", e);
}
logger
statusHandler
.info("Practice VTEC table (practice_activetable in DB) has been cleared.");
return sr;
return Boolean.TRUE;
}
}

View file

@ -20,26 +20,21 @@
# File auto-generated against equivalent DynamicSerialize Java class
from dynamicserialize.dstypes.com.raytheon.uf.common.dataplugin.gfe.request import AbstractGfeRequest
class ClearPracticeVTECTableRequest(AbstractGfeRequest):
class ClearPracticeVTECTableRequest(object):
def __init__(self):
super(ClearPracticeVTECTableRequest, self).__init__()
self.requestedSiteId = None
self.mode = None
self.siteID = None
self.workstationID = None
def getRequestedSiteId(self):
return self.requestedSiteId
def getSiteID(self):
return self.siteID
def setRequestedSiteId(self, requestedSiteId):
self.requestedSiteId = requestedSiteId
def setSiteID(self, siteID):
self.siteID = siteID
def getMode(self):
return self.mode
def getWorkstationID(self):
return self.workstationID
def setMode(self, mode):
if mode not in ['OPERATIONAL', 'PRACTICE']:
raise ValueError("Invalid value " + mode + " specified for ActiveTableMode.")
self.mode = mode
def setWorkstationID(self, workstationID):
self.workstationID = workstationID

View file

@ -21,11 +21,13 @@
# File auto-generated by PythonFileGenerator
__all__ = [
'ClearPracticeVTECTableRequest',
'MergeActiveTableRequest',
'RetrieveRemoteActiveTableRequest',
'SendActiveTableRequest'
]
from ClearPracticeVTECTableRequest import ClearPracticeVTECTableRequest
from MergeActiveTableRequest import MergeActiveTableRequest
from RetrieveRemoteActiveTableRequest import RetrieveRemoteActiveTableRequest
from SendActiveTableRequest import SendActiveTableRequest

View file

@ -22,7 +22,6 @@
__all__ = [
'AbstractGfeRequest',
'ClearPracticeVTECTableRequest',
'CommitGridsRequest',
'ConfigureTextProductsRequest',
'ExecuteIfpNetCDFGridRequest',
@ -52,7 +51,6 @@ __all__ = [
]
from AbstractGfeRequest import AbstractGfeRequest
from ClearPracticeVTECTableRequest import ClearPracticeVTECTableRequest
from CommitGridsRequest import CommitGridsRequest
from ConfigureTextProductsRequest import ConfigureTextProductsRequest
from ExecuteIfpNetCDFGridRequest import ExecuteIfpNetCDFGridRequest