Controller
===========================================
if (pageContext.getParameter("Search") != null) {
String BuildingID = pageContext.getParameter("SearchBuild");
String FloorID = pageContext.getParameter("SearchFloor");
String OfficeID = pageContext.getParameter("SearchOffice");
am.xxinitBuildQuery(BuildingID, FloorID, OfficeID);
}
Application Module
============================================
public void xxinitBuildQuery(String BuildingID, String FloorID, String OfficeID) {
BuildingVOImpl vo = getBuildingVO1();
vo.xxBuildingDetails(BuildingID, FloorID, OfficeID);
if (((BuildingID == null) || ("".equals(BuildingID))) && ((FloorID == null) || ("".equals(FloorID))) && ((OfficeID == null) || ("".equals(OfficeID))))
throw new OAException("If Building ,Floor & Office search options are null, then this page will display all the location data", (byte)2);
}
View Object
============================================
public void xxBuildingDetails(String BuildingID, String FloorID, String OfficeID)
{
if ((BuildingID != null) && (!"".equals(BuildingID)))
{
setWhereClauseParam(0, BuildingID);
}
else setWhereClauseParam(0, null);
if ((FloorID != null) && (!"".equals(FloorID)))
{
setWhereClauseParam(1, FloorID);
}
else setWhereClauseParam(1, null);
if ((OfficeID != null) && (!"".equals(OfficeID)))
{
setWhereClauseParam(2, OfficeID);
}
else setWhereClauseParam(2, null);
executeQuery();
}
View Query
========================
SELECT *
FROM pn_locations_v
WHERE location_code = NVL (:1, location_code)
AND (NVL (:2, 'A') = 'A'
OR (location_id =
(SELECT flr.parent_location_id
FROM pn_locations_all flr
WHERE flr.location_code = :2
AND flr.location_type_lookup_code = 'FLOOR'
AND ROWNUM = 1)) )
AND (NVL (:3, 'A') = 'A'
OR (location_id =
(SELECT flr.parent_location_id
FROM pn_locations_all flr
WHERE flr.location_id = (SELECT flr.parent_location_id
FROM pn_locations_all flr
WHERE flr.location_code = :3
AND flr.location_type_lookup_code = 'OFFICE' AND ROWNUM = 1)
AND flr.location_type_lookup_code = 'FLOOR'
AND ROWNUM = 1)) )
===========================================
if (pageContext.getParameter("Search") != null) {
String BuildingID = pageContext.getParameter("SearchBuild");
String FloorID = pageContext.getParameter("SearchFloor");
String OfficeID = pageContext.getParameter("SearchOffice");
am.xxinitBuildQuery(BuildingID, FloorID, OfficeID);
}
Application Module
============================================
public void xxinitBuildQuery(String BuildingID, String FloorID, String OfficeID) {
BuildingVOImpl vo = getBuildingVO1();
vo.xxBuildingDetails(BuildingID, FloorID, OfficeID);
if (((BuildingID == null) || ("".equals(BuildingID))) && ((FloorID == null) || ("".equals(FloorID))) && ((OfficeID == null) || ("".equals(OfficeID))))
throw new OAException("If Building ,Floor & Office search options are null, then this page will display all the location data", (byte)2);
}
View Object
============================================
public void xxBuildingDetails(String BuildingID, String FloorID, String OfficeID)
{
if ((BuildingID != null) && (!"".equals(BuildingID)))
{
setWhereClauseParam(0, BuildingID);
}
else setWhereClauseParam(0, null);
if ((FloorID != null) && (!"".equals(FloorID)))
{
setWhereClauseParam(1, FloorID);
}
else setWhereClauseParam(1, null);
if ((OfficeID != null) && (!"".equals(OfficeID)))
{
setWhereClauseParam(2, OfficeID);
}
else setWhereClauseParam(2, null);
executeQuery();
}
View Query
========================
SELECT *
FROM pn_locations_v
WHERE location_code = NVL (:1, location_code)
AND (NVL (:2, 'A') = 'A'
OR (location_id =
(SELECT flr.parent_location_id
FROM pn_locations_all flr
WHERE flr.location_code = :2
AND flr.location_type_lookup_code = 'FLOOR'
AND ROWNUM = 1)) )
AND (NVL (:3, 'A') = 'A'
OR (location_id =
(SELECT flr.parent_location_id
FROM pn_locations_all flr
WHERE flr.location_id = (SELECT flr.parent_location_id
FROM pn_locations_all flr
WHERE flr.location_code = :3
AND flr.location_type_lookup_code = 'OFFICE' AND ROWNUM = 1)
AND flr.location_type_lookup_code = 'FLOOR'
AND ROWNUM = 1)) )
No comments:
Post a Comment