summaryrefslogtreecommitdiffstats
path: root/ecomp-sdk/epsdk-analytics
diff options
context:
space:
mode:
Diffstat (limited to 'ecomp-sdk/epsdk-analytics')
-rw-r--r--ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/controller/ActionHandler.java44
-rw-r--r--ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/gmap/map/NovaMap.java305
-rw-r--r--ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/model/pdf/PageEvent.java18
-rw-r--r--ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/model/runtime/FormField.java2832
-rw-r--r--ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/model/runtime/ReportRuntime.java4
-rw-r--r--ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/system/Globals.java2
-rw-r--r--ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/system/fusion/adapter/FusionAdapter.java10
7 files changed, 1658 insertions, 1557 deletions
diff --git a/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/controller/ActionHandler.java b/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/controller/ActionHandler.java
index ba455899..c4f411f7 100644
--- a/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/controller/ActionHandler.java
+++ b/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/controller/ActionHandler.java
@@ -858,13 +858,13 @@ public class ActionHandler extends org.onap.portalsdk.analytics.RaptorObject {
try {
jsonInString = mapper.writerWithDefaultPrettyPrinter().writeValueAsString(reportJSONRuntime);
} catch (Exception ex) {
- ex.printStackTrace();
+ logger.error(EELFLoggerDelegate.errorLogger,"reportRun", ex);
}
return jsonInString;
} catch (RaptorException e) {
try {
- e.printStackTrace();
+ logger.error(EELFLoggerDelegate.errorLogger,"reportRun", e);
if(rr!=null) { // when user tries report they don't have access this should not throw exception that's why this if is added.
if(isEmailAttachment)
@@ -885,7 +885,7 @@ public class ActionHandler extends org.onap.portalsdk.analytics.RaptorObject {
try {
jsonInString = mapper.writerWithDefaultPrettyPrinter().writeValueAsString(errorJSONRuntime);
} catch (Exception ex) {
- ex.printStackTrace();
+ logger.error(EELFLoggerDelegate.errorLogger,"reportRun", ex);
}
return jsonInString;
@@ -904,13 +904,13 @@ public class ActionHandler extends org.onap.portalsdk.analytics.RaptorObject {
try {
jsonInString = mapper.writerWithDefaultPrettyPrinter().writeValueAsString(errorJSONRuntime);
} catch (Exception ex1) {
- ex1.printStackTrace();
+ logger.error(EELFLoggerDelegate.errorLogger,ex.getMessage(), ex);
}
return jsonInString;
}
//nextPage = (new ErrorHandler()).processFatalError(request, e);
} catch (Exception t) {
- t.printStackTrace();
+ logger.error(EELFLoggerDelegate.errorLogger,t.getMessage(), t);
ErrorJSONRuntime errorJSONRuntime = new ErrorJSONRuntime();
errorJSONRuntime.setErrormessage(t.toString());
errorJSONRuntime.setStacktrace(getStackTrace(t));
@@ -923,7 +923,7 @@ public class ActionHandler extends org.onap.portalsdk.analytics.RaptorObject {
try {
jsonInString = mapper.writerWithDefaultPrettyPrinter().writeValueAsString(errorJSONRuntime);
} catch (Exception ex) {
- ex.printStackTrace();
+ logger.error(EELFLoggerDelegate.errorLogger,ex.getMessage(), ex);
}
return jsonInString;
@@ -1035,7 +1035,7 @@ public class ActionHandler extends org.onap.portalsdk.analytics.RaptorObject {
jsonInString = mapper.writerWithDefaultPrettyPrinter().writeValueAsString(quickLinks);
} catch (Exception e) {
- e.printStackTrace();
+ logger.error(EELFLoggerDelegate.errorLogger,e.getMessage(), e);
}
return jsonInString;
}
@@ -1071,7 +1071,7 @@ public class ActionHandler extends org.onap.portalsdk.analytics.RaptorObject {
nextPage = (new ErrorHandler()).processFatalError(request, new RaptorSchedularException(message));
}
- } catch(Exception ex) { ex.printStackTrace();}
+ } catch(Exception ex) { logger.error(EELFLoggerDelegate.errorLogger,ex.getMessage(), ex);}
return nextPage;
}
@@ -1102,7 +1102,7 @@ public class ActionHandler extends org.onap.portalsdk.analytics.RaptorObject {
return nextPage;
}
- } catch (Exception ex) { ex.printStackTrace();}
+ } catch (Exception ex) { logger.error(EELFLoggerDelegate.errorLogger,ex.getMessage(), ex);}
if(reportSchedule == null) reportSchedule = new ReportSchedule(reportID, scheduleID, AppUtils.getUserID(request), request);
String formFields = "";
formFields = reportSchedule.getFormFields();
@@ -1139,17 +1139,17 @@ public class ActionHandler extends org.onap.portalsdk.analytics.RaptorObject {
(new ErrorHandler()).processError(request, ve);
} catch (RaptorException e) {
nextPage = (new ErrorHandler()).processFatalError(request, e);
- e.printStackTrace();
+ logger.error(EELFLoggerDelegate.errorLogger,e.getMessage(), e);
try {
DbUtils.rollbackTransaction(connection);
- } catch (Exception e1) {e1.printStackTrace();}
+ } catch (Exception e1) {logger.error(EELFLoggerDelegate.errorLogger,e1.getMessage(), e1);}
} catch (Exception t) {
- t.printStackTrace();
+ logger.error(EELFLoggerDelegate.errorLogger,t.getMessage(), t);
}
finally {
try {
DbUtils.clearConnection(connection);
- } catch (Exception e1) {e1.printStackTrace();}
+ } catch (Exception e1) {logger.error(EELFLoggerDelegate.errorLogger,e1.getMessage(), e1);}
}
request.setAttribute("schedule_only", "Y");
//request.getSession().removeAttribute(AppConstants.SI_REPORT_SCHEDULE);
@@ -1236,17 +1236,17 @@ public class ActionHandler extends org.onap.portalsdk.analytics.RaptorObject {
(new ErrorHandler()).processError(request, ve);
} catch (RaptorException e) {
nextPage = (new ErrorHandler()).processFatalError(request, e);
- e.printStackTrace();
+ logger.error(EELFLoggerDelegate.errorLogger,e.getMessage(), e);
try {
DbUtils.rollbackTransaction(connection);
- } catch (Exception e1) {e1.printStackTrace();}
+ } catch (Exception e1) {logger.error(EELFLoggerDelegate.errorLogger,e1.getMessage(), e1);}
} catch (Exception t) {
- t.printStackTrace();
+ logger.error(EELFLoggerDelegate.errorLogger,t.getMessage(), t);
}
finally {
try {
DbUtils.clearConnection(connection);
- } catch (Exception e1) {e1.printStackTrace();}
+ } catch (Exception e1) {logger.error(EELFLoggerDelegate.errorLogger,e1.getMessage(), e1);}
}
}
request.setAttribute(AppConstants.RI_REPORT_ID, myScheduleRepID);
@@ -1282,7 +1282,7 @@ public class ActionHandler extends org.onap.portalsdk.analytics.RaptorObject {
} catch (RaptorException e) {
nextPage = (new ErrorHandler()).processFatalError(request, e);
} catch (Exception t) {
- t.printStackTrace();
+ logger.error(EELFLoggerDelegate.errorLogger,t.getMessage(), t);
}
return nextPage;
@@ -1491,7 +1491,7 @@ public class ActionHandler extends org.onap.portalsdk.analytics.RaptorObject {
if(dataSizeForPopUp >= 0)
request.getSession().setAttribute(AppConstants.SI_DATA_SIZE_FOR_TEXTFIELD_POPUP, ""+dataSizeForPopUp);
} catch (RaptorException e) {
- e.printStackTrace();
+ logger.error(EELFLoggerDelegate.errorLogger,e.getMessage(), e);
nextPage = (new ErrorHandler()).processFatalError(request, e);
}
return nextPage;
@@ -1920,7 +1920,7 @@ public class ActionHandler extends org.onap.portalsdk.analytics.RaptorObject {
xmlOut.println(allColumnsBuffer.toString());
xmlOut.flush();
xmlOut.close();
- } catch (IOException e) {e.printStackTrace();}
+ } catch (IOException e) {logger.error(EELFLoggerDelegate.errorLogger,e.getMessage(), e);}
try {
PrintWriter xmlOut = new PrintWriter(new BufferedWriter(new FileWriter(new File(whole_fileName))));
logger.debug(EELFLoggerDelegate.debugLogger, ("**************************"));
@@ -1933,7 +1933,7 @@ public class ActionHandler extends org.onap.portalsdk.analytics.RaptorObject {
//xmlOut.println(rr.getWholeSQL());
xmlOut.flush();
xmlOut.close();
- } catch (IOException e) {e.printStackTrace();}
+ } catch (IOException e) {logger.error(EELFLoggerDelegate.errorLogger,e.getMessage(), e);}
StringBuffer command = new StringBuffer(Globals.getShellScriptDir() + AppConstants.SHELL_SCRIPTS_DIR);
if(nvl(emailId).length()>0) {
@@ -2419,7 +2419,7 @@ public class ActionHandler extends org.onap.portalsdk.analytics.RaptorObject {
try {
jsonInString = mapper.writerWithDefaultPrettyPrinter().writeValueAsString(reportJSONRuntime);
} catch (Exception ex) {
- ex.printStackTrace();
+ logger.error(EELFLoggerDelegate.errorLogger,ex.getMessage(), ex);
}
return jsonInString;
diff --git a/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/gmap/map/NovaMap.java b/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/gmap/map/NovaMap.java
index 38db8eaf..c96a72db 100644
--- a/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/gmap/map/NovaMap.java
+++ b/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/gmap/map/NovaMap.java
@@ -56,82 +56,85 @@ import org.onap.portalsdk.analytics.gmap.line.LineInfo;
import org.onap.portalsdk.analytics.gmap.map.layer.SwingLayer;
import org.onap.portalsdk.analytics.gmap.node.Node;
import org.onap.portalsdk.analytics.gmap.node.NodeInfo;
+import org.onap.portalsdk.analytics.system.fusion.adapter.FusionAdapter;
+import org.onap.portalsdk.core.logging.logic.EELFLoggerDelegate;
public class NovaMap {
+
+ private static final EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(NovaMap.class);
+
private static int[] shapeWidth;
-
+
public static final Font TEXT_FONT = new Font("sans-serif", Font.BOLD, 12);
- public static final Font HEADER_FONT = new Font("sans-serif", Font.ITALIC+Font.BOLD, 12);
-
+ public static final Font HEADER_FONT = new Font("sans-serif", Font.ITALIC + Font.BOLD, 12);
+
private HashSet<String> showList;
private ArrayList<SwingLayer> swingLayers;
private AffineTransform transform;
-
+
private Node node;
private Line line;
private ColorProperties colorProperties;
-
+
private Rectangle2D defaultBoundary;
-
+
private int zoomLevel;
-
+
private String currentYearMonth;
-
+
private String dataLoaded = "";
-
+
/**
* size in screen pixel
*/
private Rectangle boundingBox;
-
+
/**
* size in pixel web mercator projection
*/
private Rectangle2D mapArea;
-
+
/**
* size in longitude latitude
*/
private Rectangle2D geoArea;
-
- public static double[] meter2pixel;
-
+
+ public static double[] meter2pixel;
+
private boolean showLegend = false;
-
+
static {
initShapeWidth();
initMeter2Pixel();
}
-
- private static void initMeter2Pixel() {
- meter2pixel = new double[MapConstant.ZOOM_MAX - MapConstant.ZOOM_MIN+1];
- meter2pixel[0] = 156543.04/2;
- for(int i=1; i<meter2pixel.length; ++i)
- meter2pixel[i] = meter2pixel[i-1]/2;
- }
-
+
+ private static void initMeter2Pixel() {
+ meter2pixel = new double[MapConstant.ZOOM_MAX - MapConstant.ZOOM_MIN + 1];
+ meter2pixel[0] = 156543.04 / 2;
+ for (int i = 1; i < meter2pixel.length; ++i)
+ meter2pixel[i] = meter2pixel[i - 1] / 2;
+ }
+
private static void initShapeWidth() {
- // ZOOM_MAX+1 is added to below line because of ArrayIndexOutOfException. This is Suggested by Hendra Tuty. - Sundar
- shapeWidth = new int[MapConstant.ZOOM_MAX];
+ // ZOOM_MAX+1 is added to below line because of ArrayIndexOutOfException. This
+ // is Suggested by Hendra Tuty. - Sundar
+ shapeWidth = new int[MapConstant.ZOOM_MAX];
int width = 0;
for (int i = 0; i < shapeWidth.length; i++) {
if (i < 5) {
- }
- else if (i == 5) {
+ } else if (i == 5) {
width = 4;
- }
- else if (i > 4 && i < 10) {
+ } else if (i > 4 && i < 10) {
width += 2;
- }
- else {
+ } else {
width++;
}
shapeWidth[i] = width;
}
}
-
+
public NovaMap() {
boundingBox = new Rectangle();
mapArea = new Rectangle2D.Double();
@@ -139,106 +142,93 @@ public class NovaMap {
showList = new HashSet<String>();
swingLayers = new ArrayList<SwingLayer>();
}
-
-
-
- public int getBestZoomLevel(double Latitude1, double Longitude1,
- double Latitude2, double Longitude2,
- double height, double width) {
-
- if (height==0)
- height=700;
- if (width==0)
- width=1200;
-
- double lat1 = Math.min(Latitude1, Latitude1);
- double CosLat = Math.cos(Math.toRadians(lat1));
- double Wmeter = getDistance(
- lat1, Longitude1,
- lat1, Longitude2)/CosLat;
- double Hmeter = getDistance(
- Latitude1, Longitude1,
- Latitude2, Longitude1)/CosLat;
+
+ public int getBestZoomLevel(double Latitude1, double Longitude1, double Latitude2, double Longitude2, double height,
+ double width) {
+
+ if (height == 0)
+ height = 700;
+ if (width == 0)
+ width = 1200;
+
+ double lat1 = Math.min(Latitude1, Latitude1);
+ double CosLat = Math.cos(Math.toRadians(lat1));
+ double Wmeter = getDistance(lat1, Longitude1, lat1, Longitude2) / CosLat;
+ double Hmeter = getDistance(Latitude1, Longitude1, Latitude2, Longitude1) / CosLat;
int zoom = 0;
- if(Latitude1 == Latitude2 && Longitude1 == Longitude2)
+ if (Latitude1 == Latitude2 && Longitude1 == Longitude2)
zoom = 15;
if (zoom <= 0) {
- for(;
- zoom < meter2pixel.length
- && (width*meter2pixel[zoom]) > Wmeter
- && (height*meter2pixel[zoom]) > Hmeter;
- ++zoom) ;
+ for (; zoom < meter2pixel.length && (width * meter2pixel[zoom]) > Wmeter
+ && (height * meter2pixel[zoom]) > Hmeter; ++zoom)
+ ;
}
-// && (1200*meter2pixel[zoom]) > Wmeter
-// && (700*meter2pixel[zoom]) > Hmeter;
+ // && (1200*meter2pixel[zoom]) > Wmeter
+ // && (700*meter2pixel[zoom]) > Hmeter;
- return zoom + MapConstant.ZOOM_MIN-1;
+ return zoom + MapConstant.ZOOM_MIN - 1;
}
- public static double getDistance(double Latitude1, double Longitude1,
- double Latitude2, double Longitude2) {
+ public static double getDistance(double Latitude1, double Longitude1, double Latitude2, double Longitude2) {
Latitude1 = Math.toRadians(Latitude1);
Longitude1 = Math.toRadians(Longitude1);
Latitude2 = Math.toRadians(Latitude2);
Longitude2 = Math.toRadians(Longitude2);
final double R = 6371.0; // earth's mean radius in km
- double dSinLat05 = Math.sin( (Latitude2 - Latitude1)/2 );
- double dSinLong05 = Math.sin( (Longitude2 - Longitude1)/2 );
- double a = dSinLat05 * dSinLat05 +
- Math.cos(Latitude1) * Math.cos(Latitude2) * dSinLong05 * dSinLong05;
- double c = (0==a || 1==a)
- ? 0
- : 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1.0-a));
- return R * c * 1000.0; //in meters
- }
-
+ double dSinLat05 = Math.sin((Latitude2 - Latitude1) / 2);
+ double dSinLong05 = Math.sin((Longitude2 - Longitude1) / 2);
+ double a = dSinLat05 * dSinLat05 + Math.cos(Latitude1) * Math.cos(Latitude2) * dSinLong05 * dSinLong05;
+ double c = (0 == a || 1 == a) ? 0 : 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1.0 - a));
+ return R * c * 1000.0; // in meters
+ }
+
public Rectangle getBoundingBox() {
return boundingBox;
}
-
+
public void setBoundingBox(int width, int height) {
boundingBox.setSize(width, height);
}
-
+
public void setNode(Node node) {
this.node = node;
}
-
+
public Node getNode() {
return node;
}
-
+
public void setLine(Line line) {
this.line = line;
}
-
+
public Line getLine() {
return line;
}
-
+
public void setColorProperties(ColorProperties colorProperties) {
this.colorProperties = colorProperties;
}
-
+
public ColorProperties getColorProperties() {
return colorProperties;
}
-
+
public void setZoomLevel(int zoomLevel) {
this.zoomLevel = zoomLevel;
}
-
+
public int getZoomLevel() {
return zoomLevel;
}
-
- public void addShowList(String type) {
+
+ public void addShowList(String type) {
showList.add(type.toUpperCase());
}
-
+
public void addShowList(String type, int number) {
showList.add(type.toUpperCase() + ":" + number);
}
@@ -246,15 +236,15 @@ public class NovaMap {
public void removeShowList(String type) {
showList.remove(type.toUpperCase());
}
-
+
public void removeShowList(String type, int number) {
showList.remove(type.toUpperCase() + ":" + number);
}
-
+
public void clearShowList() {
showList.clear();
}
-
+
public HashSet getShowList() {
return showList;
}
@@ -262,74 +252,70 @@ public class NovaMap {
public boolean containsShowList(String type) {
return showList.contains(type.toUpperCase());
}
-
+
public boolean containsShowList(String type, int number) {
return showList.contains(type.toUpperCase() + ":" + number);
}
-
+
public int getShowListSize() {
return showList.size();
}
-
+
public void addSwingLayer(SwingLayer swingLayer) {
swingLayers.add(swingLayer);
}
-
+
public void removeSwingLayer(SwingLayer swingLayer) {
swingLayers.remove(swingLayer);
}
-
+
public void clearSwingLayers() {
swingLayers.clear();
}
-
+
public ArrayList<SwingLayer> getSwingLayers() {
return swingLayers;
}
-
+
public int getShapeWidth() {
- return shapeWidth[getZoomLevel()>=22?21:(getZoomLevel()<=8 ? 8:getZoomLevel())];
+ return shapeWidth[getZoomLevel() >= 22 ? 21 : (getZoomLevel() <= 8 ? 8 : getZoomLevel())];
}
-
+
public Point2D getPixelPos(double latitude, double longitude) {
double sinLatitude = Math.sin(Math.toRadians(latitude));
- return new Point2D.Double(
- ((longitude + 180.0) / 360.0) * 256.0 * (1<<zoomLevel),
- ( 0.5 - Math.log((1.0+sinLatitude)/(1.0-sinLatitude))
- /(4.0*Math.PI) )*256.0*(1<<zoomLevel)
- );
+ return new Point2D.Double(((longitude + 180.0) / 360.0) * 256.0 * (1 << zoomLevel),
+ (0.5 - Math.log((1.0 + sinLatitude) / (1.0 - sinLatitude)) / (4.0 * Math.PI)) * 256.0
+ * (1 << zoomLevel));
}
-
+
private boolean checkTransform(Rectangle2D geoArea) {
System.out.println("%%%%%%map.checkTransform start");
if (!this.geoArea.equals(geoArea)) {
Point2D point1 = getPixelPos(geoArea.getMinY(), geoArea.getMinX());
Point2D point2 = getPixelPos(geoArea.getMaxY(), geoArea.getMaxX());
- mapArea.setRect(point1.getX(), point2.getY(),
- boundingBox.getWidth(), boundingBox.getHeight());
+ mapArea.setRect(point1.getX(), point2.getY(), boundingBox.getWidth(), boundingBox.getHeight());
this.geoArea.setRect(geoArea);
resetTransform(boundingBox, mapArea);
System.out.println("%%%%%%map.checkTransform end 1");
return true;
}
-
+
System.out.println("%%%%%%map.checkTransform end 2");
return false;
}
-
+
private void resetTransform(Rectangle boundingBox, Rectangle2D mapArea) {
System.out.println("%%%%%%map.resetTransform start");
- if (mapArea == null || boundingBox.getWidth() == 0 || boundingBox.getHeight() == 0 ) {
+ if (mapArea == null || boundingBox.getWidth() == 0 || boundingBox.getHeight() == 0) {
System.out.println("%%%%%%map.resetTransform end 1");
return;
}
- transform = new AffineTransform(mapArea.getWidth() / boundingBox.getWidth(),
- 0.0, 0.0, mapArea.getHeight() / boundingBox.getHeight(),
- mapArea.getMinX(), mapArea.getMinY());
- System.out.println("%%%%%%map.resetTransform end 2");
+ transform = new AffineTransform(mapArea.getWidth() / boundingBox.getWidth(), 0.0, 0.0,
+ mapArea.getHeight() / boundingBox.getHeight(), mapArea.getMinX(), mapArea.getMinY());
+ System.out.println("%%%%%%map.resetTransform end 2");
}
-
+
protected AffineTransform getTransform() {
if (transform != null) {
return new AffineTransform(transform);
@@ -337,40 +323,39 @@ public class NovaMap {
return null;
}
-
- public Point2D getScreenPointFromPixel(double xPixel, double yPixel) {
+
+ public Point2D getScreenPointFromPixel(double xPixel, double yPixel) {
try {
return getTransform().inverseTransform(new Point2D.Double(xPixel, yPixel), null);
- } catch (NoninvertibleTransformException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
+ } catch (NoninvertibleTransformException ex) {
+ logger.error(EELFLoggerDelegate.errorLogger, "getScreenPointFromPixel () failed ", ex);
}
return null;
}
-
+
public Point2D getScreenPointFromLonLat(double longitude, double latitude) {
Point2D point = getPixelPos(latitude, longitude);
return getScreenPointFromPixel(point.getX(), point.getY());
}
-
+
public Point2D getLonLatFromPixel(int x1, int y1) {
double x = (double) x1 / 256;
double y = (double) y1 / 256;
- double lon = -180; // x
+ double lon = -180; // x
double lonWidth = 360; // width 360
- //double lat = -90; // y
- //double latHeight = 180; // height 180
- double lat = -1;
+ // double lat = -90; // y
+ // double latHeight = 180; // height 180
+ double lat = -1;
double latHeight = 2;
int tilesAtThisZoom = 1 << getZoomLevel();
- lonWidth = 360.0 / tilesAtThisZoom;
- lon = -180 + (x * lonWidth);
+ lonWidth = 360.0 / tilesAtThisZoom;
+ lon = -180 + (x * lonWidth);
latHeight = -2.0 / tilesAtThisZoom;
- lat = 1 + (y * latHeight);
-
+ lat = 1 + (y * latHeight);
+
// convert lat and latHeight to degrees in a transverse mercator projection
// note that in fact the coordinates go from about -85 to +85 not -90 to 90!
latHeight += lat;
@@ -379,37 +364,38 @@ public class NovaMap {
lat = (2 * Math.atan(Math.exp(Math.PI * lat))) - (Math.PI / 2);
lat *= (180 / Math.PI);
-
+
latHeight -= lat;
if (lonWidth < 0) {
- lon = lon + lonWidth;
+ lon = lon + lonWidth;
lonWidth = -lonWidth;
}
if (latHeight < 0) {
- lat = lat + latHeight;
+ lat = lat + latHeight;
latHeight = -latHeight;
}
return new Point2D.Double(lon, lat + latHeight);
}
-
+
public ArrayList getImage(final HttpServletRequest request, Rectangle2D geoArea) {
- Object showListArr[] = ((HashSet)getShowList()).toArray();
+ Object showListArr[] = ((HashSet) getShowList()).toArray();
BufferedImage image = new BufferedImage(boundingBox.width, boundingBox.height, BufferedImage.TYPE_INT_ARGB);
final Graphics2D g2d = image.createGraphics();
- // LEGEND INFO
+ // LEGEND INFO
BufferedImage legendImage = null;
Graphics2D g2Legend = null;
- if(showLegend) {
- legendImage = new BufferedImage(boundingBox.width, (int)(20*showListArr.length) + 20, BufferedImage.TYPE_INT_ARGB);
+ if (showLegend) {
+ legendImage = new BufferedImage(boundingBox.width, (int) (20 * showListArr.length) + 20,
+ BufferedImage.TYPE_INT_ARGB);
g2Legend = legendImage.createGraphics();
g2Legend.setBackground(Color.WHITE);
}
checkTransform(geoArea);
-
+
boolean swingLayerPainted = false;
Object object = request.getAttribute("server_process_interrupted");
@@ -424,29 +410,28 @@ public class NovaMap {
}
ArrayList imageArr = new ArrayList();
- //if(showLegend) layer.paintLegend(g2Legend);
-
+ // if(showLegend) layer.paintLegend(g2Legend);
+
g2d.dispose();
- if(showLegend && g2Legend != null)
+ if (showLegend && g2Legend != null)
g2Legend.dispose();
object = request.getAttribute("server_process_interrupted");
-
+
if (object != null && ((Boolean) object)) {
System.out.println("interrupted");
return imageArr;
- }
- else if (!swingLayerPainted) {
+ } else if (!swingLayerPainted) {
System.out.println("not painted");
return imageArr;
}
-
+
imageArr.add(image);
- if(g2Legend!=null) {
+ if (g2Legend != null) {
imageArr.add(legendImage);
}
return imageArr;
}
-
+
public Object singleLeftClick(double longitude, double latitude, Rectangle2D geoArea) {
System.out.println("%%%%%%map.singleLeftClick start");
System.out.println("%%%%%%map.singleLeftClick check transform start");
@@ -455,33 +440,21 @@ public class NovaMap {
Point2D screenPoint = getScreenPointFromLonLat(longitude, latitude);
System.out.println("%%%%%%map.singleLeftClick getting nodeExist array ");
ArrayList<NodeInfo> existNodeInfo = node.nodeExist(screenPoint);
-
+
if (existNodeInfo == null) {
ArrayList<LineInfo> existLineInfo = line.lineExist(screenPoint);
-
+
if (existLineInfo == null) {
-
- }
- else {
+
+ } else {
System.out.println("%%%%%%map.singleLeftClick end 1");
return existLineInfo;
}
- }
- else {
-// if (existNodeInfo.size() == 1) {
-// NodeInfo nodeInfo = existNodeInfo.get(0);
-// node.getNodeCollection().clearSelectedNode();
-// node.getNodeCollection().addSelectedNode(nodeInfo.getID(), nodeInfo.getLegendID());
-// return getSelectedImage(geoArea);
-// }
-// else {
-// return existNodeInfo;
-// }
-
+ } else {
System.out.println("%%%%%%map.singleLeftClick end 2");
return existNodeInfo;
}
-
+
System.out.println("%%%%%%map.singleLeftClick end 3");
return null;
}
@@ -501,7 +474,7 @@ public class NovaMap {
public void setDefaultBoundary(Rectangle2D defaultBoundary) {
this.defaultBoundary = defaultBoundary;
}
-
+
public boolean isShowLegend() {
return showLegend;
}
@@ -517,5 +490,5 @@ public class NovaMap {
public void setDataLoaded(String dataLoaded) {
this.dataLoaded = dataLoaded;
}
-
+
}
diff --git a/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/model/pdf/PageEvent.java b/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/model/pdf/PageEvent.java
index 296df6df..3335699a 100644
--- a/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/model/pdf/PageEvent.java
+++ b/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/model/pdf/PageEvent.java
@@ -44,6 +44,7 @@ import java.net.MalformedURLException;
import org.onap.portalsdk.analytics.system.AppUtils;
import org.onap.portalsdk.analytics.system.Globals;
+import org.onap.portalsdk.core.logging.logic.EELFLoggerDelegate;
import com.lowagie.text.BadElementException;
import com.lowagie.text.Cell;
@@ -63,6 +64,9 @@ import com.lowagie.text.pdf.PdfPageEventHelper;
import com.lowagie.text.pdf.PdfWriter;
class PageEvent extends PdfPageEventHelper {
+
+ private static final EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(PageEvent.class);
+
private PdfBean pb;
private int pageNo = 0;
private int omit_page_count = 0;
@@ -228,17 +232,11 @@ class PageEvent extends PdfPageEventHelper {
Image img = null;
try {
img = Image.getInstance(pb.getFullWebContextPath() + AppUtils.getImgFolderURL() + File.separator + imgSrc);
- } catch (BadElementException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- img = null;
- } catch (MalformedURLException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
+ } catch (BadElementException | MalformedURLException e) {
+ logger.error(EELFLoggerDelegate.errorLogger,"addLogo() failed ", e);
img = null;
- } catch (IOException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
+ } catch (IOException e) {
+ logger.error(EELFLoggerDelegate.errorLogger,e.getMessage(), e);
}
if(img == null){
diff --git a/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/model/runtime/FormField.java b/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/model/runtime/FormField.java
index 7884e61f..7da22187 100644
--- a/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/model/runtime/FormField.java
+++ b/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/model/runtime/FormField.java
@@ -80,12 +80,17 @@ import org.onap.portalsdk.analytics.model.base.IdNameSql;
import org.onap.portalsdk.analytics.model.base.IdNameValue;
import org.onap.portalsdk.analytics.system.AppUtils;
import org.onap.portalsdk.analytics.system.ConnectionUtils;
+import org.onap.portalsdk.analytics.system.ExecuteQuery;
import org.onap.portalsdk.analytics.system.Globals;
import org.onap.portalsdk.analytics.util.DataSet;
import org.onap.portalsdk.analytics.util.Utils;
import org.onap.portalsdk.analytics.xmlobj.JavascriptItemType;
+import org.onap.portalsdk.core.logging.logic.EELFLoggerDelegate;
public class FormField extends org.onap.portalsdk.analytics.RaptorObject implements Serializable {
+
+ private static final EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(FormField.class);
+
private static final String HTML_FORM = "formd";
private String fieldName = null;
@@ -97,21 +102,21 @@ public class FormField extends org.onap.portalsdk.analytics.RaptorObject impleme
private String validationType = VT_NONE;
private boolean required = false;
-
+
public boolean hasPredefinedList = false;
private String defaultValue = null;
-
+
private Calendar rangeStartDate = null;
-
+
private Calendar rangeEndDate = null;
-
+
private String rangeStartDateSQL = null;
-
+
private String rangeEndDateSQL = null;
-
+
private String fieldDefaultSQL = null;
-
+
private String multiSelectListSize = null;
private String helpText = null;
@@ -119,16 +124,16 @@ public class FormField extends org.onap.portalsdk.analytics.RaptorObject impleme
private IdNameList lookupList = null;
private String dbInfo = null;
-
- private String userId = null;
-
- private boolean visible = true;
-
- private String dependsOn = null;
-
- private boolean triggerOtherFormFields = false;
-
- private boolean triggerThisFormfield = false;
+
+ private String userId = null;
+
+ private boolean visible = true;
+
+ private String dependsOn = null;
+
+ private boolean triggerOtherFormFields = false;
+
+ private boolean triggerThisFormfield = false;
// Form field types
public static final String FFT_TEXT_W_POPUP = "TEXT_WITH_POPUP";
@@ -148,19 +153,19 @@ public class FormField extends org.onap.portalsdk.analytics.RaptorObject impleme
public static final String FFT_LIST_MULTI = "LIST_MULTI_SELECT";
public static final String FFT_HIDDEN = "HIDDEN";
-
- public static final String FFT_BLANK = "BLANK";
-
+
+ public static final String FFT_BLANK = "BLANK";
+
// Validation types
public static final String VT_NONE = "NONE";
public static final String VT_DATE = "DATE";
-
- public static final String VT_TIMESTAMP_HR = "TIMESTAMP_HR";
- public static final String VT_TIMESTAMP_MIN = "TIMESTAMP_MIN";
+ public static final String VT_TIMESTAMP_HR = "TIMESTAMP_HR";
- public static final String VT_TIMESTAMP_SEC = "TIMESTAMP_SEC";
+ public static final String VT_TIMESTAMP_MIN = "TIMESTAMP_MIN";
+
+ public static final String VT_TIMESTAMP_SEC = "TIMESTAMP_SEC";
public static final String VT_INT = "INTEGER";
@@ -173,95 +178,99 @@ public class FormField extends org.onap.portalsdk.analytics.RaptorObject impleme
public static final String VT_FLOAT_POSITIVE = "POSITIVE_FLOAT";
public static final String VT_FLOAT_NON_NEGATIVE = "NON_NEGATIVE_FLOAT";
-
- private FormField(String fieldName, String fieldDisplayName, String fieldType,
- String validationType, boolean required, String defaultValue, String helpText, boolean visible, String dependsOn, Calendar rangeStartDate, Calendar rangeEndDate,
- String rangeStartDateSQL, String rangeEndDateSQL, String multiSelectListSize ) {
- //super();
- this (fieldName,fieldDisplayName,fieldType,validationType,required,defaultValue,helpText, dependsOn, rangeStartDate, rangeEndDate, rangeStartDateSQL, rangeEndDateSQL, multiSelectListSize);
- setVisible(visible);
+
+ private FormField(String fieldName, String fieldDisplayName, String fieldType, String validationType,
+ boolean required, String defaultValue, String helpText, boolean visible, String dependsOn,
+ Calendar rangeStartDate, Calendar rangeEndDate, String rangeStartDateSQL, String rangeEndDateSQL,
+ String multiSelectListSize) {
+ // super();
+ this(fieldName, fieldDisplayName, fieldType, validationType, required, defaultValue, helpText, dependsOn,
+ rangeStartDate, rangeEndDate, rangeStartDateSQL, rangeEndDateSQL, multiSelectListSize);
+ setVisible(visible);
} // FormField
- private FormField(String fieldName, String fieldDisplayName, String fieldType,
- String validationType, boolean required, String defaultValue, String helpText, String dependsOn, Calendar rangeStartDate, Calendar rangeEndDate,
- String rangeStartDateSQL, String rangeEndDateSQL, String multiSelectListSize ) {
- super();
- setFieldName(fieldName);
- setFieldDisplayName(fieldDisplayName);
- setFieldType(nvl(fieldType, FFT_TEXT));
- setValidationType(validationType);
- setRequired(required);
- setDefaultValue(defaultValue);
- setHelpText(helpText);
- setDependsOn(dependsOn);
- setRangeStartDate(rangeStartDate);
- setRangeEndDate(rangeEndDate);
- setRangeStartDateSQL(rangeStartDateSQL);
- setRangeEndDateSQL(rangeEndDateSQL);
- setMultiSelectListSize(multiSelectListSize);
- }
- public FormField(String fieldName, String fieldDisplayName, String fieldType,
- String validationType, boolean required, String defaultValue, String helpText,
- List predefinedValues, boolean visible, String dependsOn, Calendar rangeStartDate, Calendar rangeEndDate,
- String rangeStartDateSQL, String rangeEndDateSQL, String multiSelectListSize) {
- this(fieldName, fieldDisplayName, fieldType, validationType, required, defaultValue,
- helpText,visible, dependsOn, rangeStartDate, rangeEndDate, rangeStartDateSQL, rangeEndDateSQL, multiSelectListSize);
+ private FormField(String fieldName, String fieldDisplayName, String fieldType, String validationType,
+ boolean required, String defaultValue, String helpText, String dependsOn, Calendar rangeStartDate,
+ Calendar rangeEndDate, String rangeStartDateSQL, String rangeEndDateSQL, String multiSelectListSize) {
+ super();
+ setFieldName(fieldName);
+ setFieldDisplayName(fieldDisplayName);
+ setFieldType(nvl(fieldType, FFT_TEXT));
+ setValidationType(validationType);
+ setRequired(required);
+ setDefaultValue(defaultValue);
+ setHelpText(helpText);
+ setDependsOn(dependsOn);
+ setRangeStartDate(rangeStartDate);
+ setRangeEndDate(rangeEndDate);
+ setRangeStartDateSQL(rangeStartDateSQL);
+ setRangeEndDateSQL(rangeEndDateSQL);
+ setMultiSelectListSize(multiSelectListSize);
+ }
+
+ public FormField(String fieldName, String fieldDisplayName, String fieldType, String validationType,
+ boolean required, String defaultValue, String helpText, List predefinedValues, boolean visible,
+ String dependsOn, Calendar rangeStartDate, Calendar rangeEndDate, String rangeStartDateSQL,
+ String rangeEndDateSQL, String multiSelectListSize) {
+ this(fieldName, fieldDisplayName, fieldType, validationType, required, defaultValue, helpText, visible,
+ dependsOn, rangeStartDate, rangeEndDate, rangeStartDateSQL, rangeEndDateSQL, multiSelectListSize);
if (predefinedValues != null)
setPredefinedListLookup(predefinedValues);
} // FormField
- public FormField(String fieldName, String fieldDisplayName, String fieldType,
- String validationType, boolean required, String defaultValue, String helpText,
- String lookupSql, boolean visible, String dependsOn, Calendar rangeStartDate, Calendar rangeEndDate,
- String rangeStartDateSQL, String rangeEndDateSQL, String multiSelectListSize ) {
- this(fieldName, fieldDisplayName, fieldType, validationType, required, defaultValue,
- helpText,visible, dependsOn, rangeStartDate, rangeEndDate, rangeStartDateSQL, rangeEndDateSQL, multiSelectListSize);
- if (defaultValue!=null && defaultValue.length()>10 && defaultValue.substring(0,10).trim().toLowerCase().startsWith("select")) {
- setFieldDefaultSQL(defaultValue);
- setDefaultValue("");
- }
- setLookupList(new IdNameSql(lookupSql,defaultValue));
+ public FormField(String fieldName, String fieldDisplayName, String fieldType, String validationType,
+ boolean required, String defaultValue, String helpText, String lookupSql, boolean visible, String dependsOn,
+ Calendar rangeStartDate, Calendar rangeEndDate, String rangeStartDateSQL, String rangeEndDateSQL,
+ String multiSelectListSize) {
+ this(fieldName, fieldDisplayName, fieldType, validationType, required, defaultValue, helpText, visible,
+ dependsOn, rangeStartDate, rangeEndDate, rangeStartDateSQL, rangeEndDateSQL, multiSelectListSize);
+ if (defaultValue != null && defaultValue.length() > 10
+ && defaultValue.substring(0, 10).trim().toLowerCase().startsWith("select")) {
+ setFieldDefaultSQL(defaultValue);
+ setDefaultValue("");
+ }
+ setLookupList(new IdNameSql(lookupSql, defaultValue));
} // FormField
- public FormField(String fieldName, String fieldDisplayName, String fieldType,
- String validationType, boolean required, String defaultValue, String helpText,
- String dbTableName, String dbIdField, String dbNameField, String dbSortByField, boolean visible, String dependsOn, Calendar rangeStartDate, Calendar rangeEndDate,
+ public FormField(String fieldName, String fieldDisplayName, String fieldType, String validationType,
+ boolean required, String defaultValue, String helpText, String dbTableName, String dbIdField,
+ String dbNameField, String dbSortByField, boolean visible, String dependsOn, Calendar rangeStartDate,
+ Calendar rangeEndDate, String rangeStartDateSQL, String rangeEndDateSQL, String multiSelectListSize) {
+ this(fieldName, fieldDisplayName, fieldType, validationType, required, defaultValue, helpText, dbTableName,
+ dbIdField, dbNameField, dbSortByField, dependsOn, rangeStartDate, rangeEndDate, rangeStartDateSQL,
+ rangeEndDateSQL, multiSelectListSize);
+ setVisible(visible);
+ }
+
+ public FormField(String fieldName, String fieldDisplayName, String fieldType, String validationType,
+ boolean required, String defaultValue, String helpText, String dbTableName, String dbIdField,
+ String dbNameField, String dbSortByField, String dependsOn, Calendar rangeStartDate, Calendar rangeEndDate,
String rangeStartDateSQL, String rangeEndDateSQL, String multiSelectListSize) {
- this(fieldName, fieldDisplayName, fieldType, validationType, required, defaultValue,
- helpText,dbTableName,dbIdField,dbNameField,dbSortByField, dependsOn, rangeStartDate, rangeEndDate, rangeStartDateSQL, rangeEndDateSQL, multiSelectListSize);
- setVisible(visible);
- }
-
- public FormField(String fieldName, String fieldDisplayName, String fieldType,
- String validationType, boolean required, String defaultValue, String helpText,
- String dbTableName, String dbIdField, String dbNameField, String dbSortByField, String dependsOn,
- Calendar rangeStartDate, Calendar rangeEndDate,
- String rangeStartDateSQL, String rangeEndDateSQL, String multiSelectListSize ) {
- this(fieldName, fieldDisplayName, fieldType, validationType, required, defaultValue,
- helpText,dependsOn, rangeStartDate, rangeEndDate, rangeStartDateSQL, rangeEndDateSQL, multiSelectListSize);
- //if(dependsOn !=null){ this.dependsOn = dependsOn; }else { this.dependsOn = ""
- if (defaultValue!=null && defaultValue.length()>10 && defaultValue.substring(0,10).trim().toLowerCase().startsWith("select")) {
- setFieldDefaultSQL(defaultValue);
- setDefaultValue("");
- if(fieldType.equals(FFT_TEXT))
- setLookupList(new IdNameLookup(dbTableName, dbIdField, dbNameField, dbSortByField,defaultValue,true));
- else
- setLookupList(new IdNameLookup(dbTableName, dbIdField, dbNameField, dbSortByField,defaultValue,false));
- }
- else {
- if(fieldType.equals(FFT_TEXT))
- setLookupList(new IdNameLookup(dbTableName, dbIdField, dbNameField, dbSortByField, true));
- else
- setLookupList(new IdNameLookup(dbTableName, dbIdField, dbNameField, dbSortByField, false));
- }
-
- this.setRangeStartDate(rangeStartDate);
- this.setRangeEndDate(rangeEndDate);
- this.setRangeStartDateSQL(rangeStartDateSQL);
- this.setRangeEndDateSQL(rangeEndDateSQL);
-
+ this(fieldName, fieldDisplayName, fieldType, validationType, required, defaultValue, helpText, dependsOn,
+ rangeStartDate, rangeEndDate, rangeStartDateSQL, rangeEndDateSQL, multiSelectListSize);
+ // if(dependsOn !=null){ this.dependsOn = dependsOn; }else { this.dependsOn = ""
+ if (defaultValue != null && defaultValue.length() > 10
+ && defaultValue.substring(0, 10).trim().toLowerCase().startsWith("select")) {
+ setFieldDefaultSQL(defaultValue);
+ setDefaultValue("");
+ if (fieldType.equals(FFT_TEXT))
+ setLookupList(new IdNameLookup(dbTableName, dbIdField, dbNameField, dbSortByField, defaultValue, true));
+ else
+ setLookupList(
+ new IdNameLookup(dbTableName, dbIdField, dbNameField, dbSortByField, defaultValue, false));
+ } else {
+ if (fieldType.equals(FFT_TEXT))
+ setLookupList(new IdNameLookup(dbTableName, dbIdField, dbNameField, dbSortByField, true));
+ else
+ setLookupList(new IdNameLookup(dbTableName, dbIdField, dbNameField, dbSortByField, false));
+ }
+
+ this.setRangeStartDate(rangeStartDate);
+ this.setRangeEndDate(rangeEndDate);
+ this.setRangeStartDateSQL(rangeStartDateSQL);
+ this.setRangeEndDateSQL(rangeEndDateSQL);
+
} // FormField
-
private void setPredefinedListLookup(List predefinedValues) {
IdNameList lookup = new IdNameList();
@@ -269,7 +278,7 @@ public class FormField extends org.onap.portalsdk.analytics.RaptorObject impleme
String value = (String) iter.next();
lookup.addValue(value, value);
} // for
- setHasPredefinedList(true);
+ setHasPredefinedList(true);
setLookupList(lookup);
} // setPredefinedListLookup
@@ -337,26 +346,28 @@ public class FormField extends org.onap.portalsdk.analytics.RaptorObject impleme
this.lookupList = lookupList;
}
- public void setDefaultList(IdNameList lookupList) {
- this.lookupList = lookupList;
- }
-
+ public void setDefaultList(IdNameList lookupList) {
+ this.lookupList = lookupList;
+ }
+
public String getBaseSQL() {
return (lookupList == null) ? null : lookupList.getBaseSQL();
} // getBaseSQL
public String getBaseWholeSQL() {
return (lookupList == null) ? null : lookupList.getBaseWholeSQL();
- } // getBaseWholeSQL
-
+ } // getBaseWholeSQL
+
public String getBaseWholeReadonlySQL() {
return (lookupList == null) ? null : lookupList.getBaseWholeReadonlySQL();
} // getBaseWholeReadonlySQL
-
+
public String getBaseSQLForPDFExcel() {
- return (lookupList == null) ? null : lookupList.getBaseSQLForPDFExcel(getFieldType().equals(FFT_LIST_MULTI)||getFieldType().equals(FFT_CHECK_BOX)?true:false);
+ return (lookupList == null) ? null
+ : lookupList.getBaseSQLForPDFExcel(
+ getFieldType().equals(FFT_LIST_MULTI) || getFieldType().equals(FFT_CHECK_BOX) ? true : false);
} // getBaseSQLForPDFExcel
-
+
public String getDisplayNameHtml() {
if (nvl(helpText).length() > 0)
return "<a title=\"" + helpText + "\">" + fieldDisplayName + "</a>";
@@ -364,1454 +375,1562 @@ public class FormField extends org.onap.portalsdk.analytics.RaptorObject impleme
return fieldDisplayName;
} // getDisplayNameHtml
- /*public String getHtml() throws RaptorRuntimeException {
- return getHtml("" , null, null, false);
- } // getHtml*/
-
- public String getHtml(String fieldValue, HashMap formValues, ReportRuntime rr)throws RaptorRuntimeException {
- return getHtml(fieldValue,formValues, rr, false);
+ /*
+ * public String getHtml() throws RaptorRuntimeException { return getHtml("" ,
+ * null, null, false); } // getHtml
+ */
+
+ public String getHtml(String fieldValue, HashMap formValues, ReportRuntime rr) throws RaptorRuntimeException {
+ return getHtml(fieldValue, formValues, rr, false);
}
-
+
public String getHelpLink(String fieldName) {
- //return "<a href=\"#\" onclick=\"javascript:ShowContent('" + fieldName + "_div')\"><img src=\""+AppUtils.getBaseFolderURL()+"images/quickhelp_dk.gif\" width=\"12\" height=\"12\" alt=\"\" border=\"0\" class=\"qh-element\" /></a>";
- return ((getHelpText()!=null && getHelpText().length()>0)? "tooltipText=\""+ getHelpText()+"\">": ">");
- //return ((getHelpText()!=null && getHelpText().length()>0)? "<img src=\"static/fusion/raptor/images/quickhelp_lt.gif\" tooltipText=\""+ getHelpText() + "\"/>": "");
+ // return "<a href=\"#\" onclick=\"javascript:ShowContent('" + fieldName +
+ // "_div')\"><img src=\""+AppUtils.getBaseFolderURL()+"images/quickhelp_dk.gif\"
+ // width=\"12\" height=\"12\" alt=\"\" border=\"0\" class=\"qh-element\"
+ // /></a>";
+ return ((getHelpText() != null && getHelpText().length() > 0) ? "tooltipText=\"" + getHelpText() + "\">" : ">");
+ // return ((getHelpText()!=null && getHelpText().length()>0)? "<img
+ // src=\"static/fusion/raptor/images/quickhelp_lt.gif\" tooltipText=\""+
+ // getHelpText() + "\"/>": "");
}
-
-
+
public String getCallableAfterChainingJavascript(String fieldName, ReportRuntime rr) {
JavascriptItemType javascriptItemType = null;
StringBuffer callJavascriptText = new StringBuffer("");
- if(rr.getJavascriptList()!=null) {
+ if (rr.getJavascriptList() != null) {
for (Iterator iter = rr.getJavascriptList().getJavascriptItem().iterator(); iter.hasNext();) {
- javascriptItemType = (JavascriptItemType)iter.next();
- if(javascriptItemType.getFieldId().equals(fieldName)) {
- if(nvl(javascriptItemType.getCallText()).toLowerCase().startsWith("afterchaining"))
- callJavascriptText.append(" "+javascriptItemType.getCallText());
+ javascriptItemType = (JavascriptItemType) iter.next();
+ if (javascriptItemType.getFieldId().equals(fieldName)) {
+ if (nvl(javascriptItemType.getCallText()).toLowerCase().startsWith("afterchaining"))
+ callJavascriptText.append(" " + javascriptItemType.getCallText());
}
}
}
- return callJavascriptText.toString()+" ";
+ return callJavascriptText.toString() + " ";
}
+
public String getCallableJavascript(String fieldName, ReportRuntime rr) {
JavascriptItemType javascriptItemType = null;
StringBuffer callJavascriptText = new StringBuffer("");
- if(rr.getJavascriptList()!=null) {
+ if (rr.getJavascriptList() != null) {
for (Iterator iter = rr.getJavascriptList().getJavascriptItem().iterator(); iter.hasNext();) {
- javascriptItemType = (JavascriptItemType)iter.next();
- if(javascriptItemType.getFieldId().equals(fieldName)) {
- if(!nvl(javascriptItemType.getCallText()).toLowerCase().startsWith("afterchaining"))
- callJavascriptText.append(" "+javascriptItemType.getCallText());
+ javascriptItemType = (JavascriptItemType) iter.next();
+ if (javascriptItemType.getFieldId().equals(fieldName)) {
+ if (!nvl(javascriptItemType.getCallText()).toLowerCase().startsWith("afterchaining"))
+ callJavascriptText.append(" " + javascriptItemType.getCallText());
}
}
}
- return callJavascriptText.toString()+" ";
+ return callJavascriptText.toString() + " ";
}
-
+
public String getCallableOnChangeJavascript(String fieldName, ReportRuntime rr) {
- String callText = getCallableJavascript(fieldName, rr);
- if(callText != null && callText.trim().toLowerCase().indexOf("onchange")>=0) {
- Pattern re1 = Pattern.compile("\\=(.*?)\\)");
- Matcher matcher = re1.matcher(callText);
- while (matcher.find()) {
- callText = matcher.group();
- if(callText!=null && callText.startsWith("=\"")) {
- callText = callText.substring(2);
- } else if (callText!=null)
- callText = callText.substring(1);
- }
- callText = callText.replaceAll("this", "documentForm."+fieldName);
- } else callText = null;
- return callText;
- }
-
- public String getAjaxHtml(String fieldValue, HashMap formValues, ReportRuntime rr, boolean inSchedule) throws RaptorRuntimeException {
- fieldValue = nvl(fieldValue, defaultValue);
- String readOnly = "ff_readonly";
- try {
- if(fieldValue !=null && fieldValue.length() > 0)
- fieldValue = java.net.URLDecoder.decode(fieldValue, "UTF-8");
- } catch (UnsupportedEncodingException ex) {}
- catch (IllegalArgumentException ex1){}
- catch (Exception ex2){}
- if (fieldType.equals(FFT_COMBO_BOX)) {
- StringBuffer sb = new StringBuffer();
- //System.out.println("COMBO BOX " + fieldName);
- String oldSQL = "";
- if (!required)
- sb.append("obj.options[obj.options.length] = new Option('-->select value<--','');");
+ String callText = getCallableJavascript(fieldName, rr);
+ if (callText != null && callText.trim().toLowerCase().indexOf("onchange") >= 0) {
+ Pattern re1 = Pattern.compile("\\=(.*?)\\)");
+ Matcher matcher = re1.matcher(callText);
+ while (matcher.find()) {
+ callText = matcher.group();
+ if (callText != null && callText.startsWith("=\"")) {
+ callText = callText.substring(2);
+ } else if (callText != null)
+ callText = callText.substring(1);
+ }
+ callText = callText.replaceAll("this", "documentForm." + fieldName);
+ } else
+ callText = null;
+ return callText;
+ }
+
+ public String getAjaxHtml(String fieldValue, HashMap formValues, ReportRuntime rr, boolean inSchedule)
+ throws RaptorRuntimeException {
+ fieldValue = nvl(fieldValue, defaultValue);
+ String readOnly = "ff_readonly";
+ try {
+ if (fieldValue != null && fieldValue.length() > 0)
+ fieldValue = java.net.URLDecoder.decode(fieldValue, "UTF-8");
+ } catch (UnsupportedEncodingException ex) {
+ } catch (IllegalArgumentException ex1) {
+ } catch (Exception ex2) {
+ }
+ if (fieldType.equals(FFT_COMBO_BOX)) {
+ StringBuffer sb = new StringBuffer();
+ // System.out.println("COMBO BOX " + fieldName);
+ String oldSQL = "";
+ if (!required)
+ sb.append("obj.options[obj.options.length] = new Option('-->select value<--','');");
+
+ IdNameList lookup = getLookupList();
+ try {
+ if (!hasPredefinedList) {
+ // if(dependsOn != null && dependsOn != "") {
+ // if(dependsOn != null && dependsOn != "" ) {
+ IdNameSql lu = (IdNameSql) lookup;
+ String SQL = "";
+ SQL = lu.getSql();
+ /*
+ * if(nvl(fieldValue,"").length()<=0) SQL = lu.getSql(); else SQL =
+ * lu.getBaseSQLForPDFExcel(false);
+ */
+ // System.out.println("FORMFIELD 6666667 First" + ((IdNameSql)lookup).getSql());
+ oldSQL = lu.getSql();
+ // SQL = Utils.replaceInString(SQL, "[VALUE]", fieldValue);
+ if (formValues != null) {
+ Set set = formValues.entrySet();
+ String value = "";
+ for (Iterator iter = set.iterator(); iter.hasNext();) {
+ Map.Entry entry = (Entry) iter.next();
+ value = (String) entry.getValue();
+ if (inSchedule) {
+ try {
+ value = java.net.URLDecoder.decode(Utils.oracleSafe(value), "UTF-8");
+ } catch (UnsupportedEncodingException ex) {
- IdNameList lookup = getLookupList();
- try {
- if(!hasPredefinedList) {
- //if(dependsOn != null && dependsOn != "") {
- //if(dependsOn != null && dependsOn != "" ) {
- IdNameSql lu = (IdNameSql) lookup;
- String SQL = "";
- SQL = lu.getSql();
- /*if(nvl(fieldValue,"").length()<=0)
- SQL = lu.getSql();
- else
- SQL = lu.getBaseSQLForPDFExcel(false);
- */
- //System.out.println("FORMFIELD 6666667 First" + ((IdNameSql)lookup).getSql());
- oldSQL = lu.getSql();
- //SQL = Utils.replaceInString(SQL, "[VALUE]", fieldValue);
- if(formValues != null) {
- Set set = formValues.entrySet();
- String value = "";
- for(Iterator iter = set.iterator(); iter.hasNext(); ) {
- Map.Entry entry = (Entry) iter.next();
- value = (String) entry.getValue();
- if(inSchedule) {
- try {
- value = java.net.URLDecoder.decode(Utils.oracleSafe(value), "UTF-8");
- } catch (UnsupportedEncodingException ex) {
-
- }
- }
- if (value!=null && (value.length() <=0 || value.equals("NULL"))) {
- value = "NULL";
- SQL = Utils.replaceInString(SQL, "'["+entry.getKey()+"]'", value);
- SQL = Utils.replaceInString(SQL, "["+entry.getKey()+"]", value);
- } else {
- SQL = Utils.replaceInString(SQL, "["+entry.getKey()+"]", value);
- }
}
- lookup = new IdNameSql(-1,SQL,lu.getDefaultSQL());
}
- //}
- lookupList = lookup;
-
- //}
+ if (value != null && (value.length() <= 0 || value.equals("NULL"))) {
+ value = "NULL";
+ SQL = Utils.replaceInString(SQL, "'[" + entry.getKey() + "]'", value);
+ SQL = Utils.replaceInString(SQL, "[" + entry.getKey() + "]", value);
+ } else {
+ SQL = Utils.replaceInString(SQL, "[" + entry.getKey() + "]", value);
+ }
+ }
+ lookup = new IdNameSql(-1, SQL, lu.getDefaultSQL());
+ }
+ // }
+ lookupList = lookup;
+
+ // }
try {
lookup.loadUserData(0, "", getDbInfo(), getUserId());
- } catch (Exception e ){ e.printStackTrace(); //throw new RaptorRuntimeException(e);
+ } catch (Exception e) {
+ logger.error(EELFLoggerDelegate.errorLogger, "getAjaxHtml() failed ", e);
}
- }
- lookup.trimToSize();
-
- String selectedValue = "";
- int count = 0;
- for (lookup.resetNext(); lookup.hasNext();) {
- IdNameValue value = lookup.getNext();
- if(value != null && value.getId() != null && value.getName() != null ) {
- /*if (count == 0 && required) {
- selectedValue = value.getId();
- count++;
- } else if (nvl(fieldValue).length()>0){
- if (fieldValue != null && fieldValue.equals(value.getId())){
- selectedValue = value.getId();
- }
- count++;
- } else {
- count++;
- } */
- if (count == 0) {
- if(required){
- selectedValue = value.getId();
- }
- count++;
- }
- sb.append("obj.options[obj.options.length] = new Option('" + Utils.singleQuoteEncode(value.getName())+"','"+Utils.singleQuoteEncode(value.getId())+"');");
- if ((fieldValue != null && fieldValue.equals(value.getId()))){
- sb.append("obj.options[obj.options.length-1].selected=true;");
+ }
+ lookup.trimToSize();
+
+ String selectedValue = "";
+ int count = 0;
+ for (lookup.resetNext(); lookup.hasNext();) {
+ IdNameValue value = lookup.getNext();
+ if (value != null && value.getId() != null && value.getName() != null) {
+ /*
+ * if (count == 0 && required) { selectedValue = value.getId(); count++; } else
+ * if (nvl(fieldValue).length()>0){ if (fieldValue != null &&
+ * fieldValue.equals(value.getId())){ selectedValue = value.getId(); } count++;
+ * } else { count++; }
+ */
+ if (count == 0) {
+ if (required) {
selectedValue = value.getId();
}
- if(value.isReadOnly())
- sb.append("obj.disabled=true;");
- else
- sb.append("obj.disabled=false;");
-
+ count++;
}
- } // for
- if (formValues.containsKey(fieldDisplayName)){
- formValues.remove(fieldDisplayName);
+ sb.append("obj.options[obj.options.length] = new Option('"
+ + Utils.singleQuoteEncode(value.getName()) + "','"
+ + Utils.singleQuoteEncode(value.getId()) + "');");
+ if ((fieldValue != null && fieldValue.equals(value.getId()))) {
+ sb.append("obj.options[obj.options.length-1].selected=true;");
+ selectedValue = value.getId();
+ }
+ if (value.isReadOnly())
+ sb.append("obj.disabled=true;");
+ else
+ sb.append("obj.disabled=false;");
+
}
- formValues.put(fieldDisplayName, selectedValue);
- } catch (Exception e) {
- //throw new RaptorRuntimeException(e);
+ } // for
+ if (formValues.containsKey(fieldDisplayName)) {
+ formValues.remove(fieldDisplayName);
}
- if(!hasPredefinedList) {
- if(oldSQL != null && !oldSQL.equals("")) {
- ((IdNameSql)lookup).setSQL(oldSQL);
- }
+ formValues.put(fieldDisplayName, selectedValue);
+ } catch (Exception e) {
+ // throw new RaptorRuntimeException(e);
+ }
+ if (!hasPredefinedList) {
+ if (oldSQL != null && !oldSQL.equals("")) {
+ ((IdNameSql) lookup).setSQL(oldSQL);
}
- //System.out.println("FORMFIELD 6666667 " + ((IdNameSql)lookup).getSql());
- if( isVisible())
- return sb.toString();
- else return "";
- } else if (fieldType.equals(FFT_LIST_MULTI)) {
- StringBuffer sb = new StringBuffer();
- String oldSQL = "";
+ }
+ // System.out.println("FORMFIELD 6666667 " + ((IdNameSql)lookup).getSql());
+ if (isVisible())
+ return sb.toString();
+ else
+ return "";
+ } else if (fieldType.equals(FFT_LIST_MULTI)) {
+ StringBuffer sb = new StringBuffer();
+ String oldSQL = "";
+
+ fieldValue = '|' + fieldValue + '|';
+ IdNameList lookup = getLookupList();
+ try {
+ if (!hasPredefinedList) {
+ // if(dependsOn != null && dependsOn != "") {
+ // if(dependsOn != null && dependsOn != "" ) {
+ IdNameSql lu = (IdNameSql) lookup;
+ String SQL = "";
+ SQL = lu.getSql();
+ /*
+ * if(nvl(fieldValue,"").length()<=0) SQL = lu.getSql(); else SQL =
+ * lu.getBaseSQLForPDFExcel(false); SQL = Utils.replaceInString(SQL, "[VALUE]",
+ * fieldValue);
+ */
+ oldSQL = lu.getSql();
+ if (formValues != null) {
+ Set set = formValues.entrySet();
+ String value = "";
+ for (Iterator iter = set.iterator(); iter.hasNext();) {
+ Map.Entry entry = (Entry) iter.next();
+ value = (String) entry.getValue();
+ if (inSchedule) { // ('1347')
+ try {
+ value = java.net.URLDecoder.decode(value, "UTF-8");
+ } catch (UnsupportedEncodingException ex) {
- fieldValue = '|' + fieldValue + '|';
- IdNameList lookup = getLookupList();
- try {
- if(!hasPredefinedList) {
- //if(dependsOn != null && dependsOn != "") {
- //if(dependsOn != null && dependsOn != "" ) {
- IdNameSql lu = (IdNameSql) lookup;
- String SQL = "";
- SQL = lu.getSql();
- /*if(nvl(fieldValue,"").length()<=0)
- SQL = lu.getSql();
- else
- SQL = lu.getBaseSQLForPDFExcel(false);
- SQL = Utils.replaceInString(SQL, "[VALUE]", fieldValue);
- */
- oldSQL = lu.getSql();
- if(formValues != null) {
- Set set = formValues.entrySet();
- String value = "";
- for(Iterator iter = set.iterator(); iter.hasNext(); ) {
- Map.Entry entry = (Entry) iter.next();
- value = (String) entry.getValue();
- if(inSchedule) { //('1347')
- try {
- value = java.net.URLDecoder.decode(value, "UTF-8");
- } catch (UnsupportedEncodingException ex) {
-
- }
- }
- SQL = Utils.replaceInString(SQL, "["+entry.getKey()+"]", value);
}
- lookup = new IdNameSql(-1,SQL,lu.getDefaultSQL());
}
- //}
- lookupList = lookup;
- //}
-
- lookup.loadUserData(0, "", getDbInfo(),getUserId());
+ SQL = Utils.replaceInString(SQL, "[" + entry.getKey() + "]", value);
+ }
+ lookup = new IdNameSql(-1, SQL, lu.getDefaultSQL());
}
+ // }
+ lookupList = lookup;
+ // }
- for (lookup.resetNext(); lookup.hasNext();) {
- IdNameValue value = lookup.getNext();
- sb.append("obj.options[obj.options.length] = new Option('" + Utils.singleQuoteEncode(value.getName()) +"','"+Utils.singleQuoteEncode(value.getId())+"');");
- if (fieldValue.indexOf('|' + value.getId() + '|') >= 0)
- sb.append("obj.options[obj.options.length-1].selected=true;");
- if(value.isReadOnly())
- sb.append("obj.disabled=true;");
- else
- sb.append("obj.disabled=false;");
+ lookup.loadUserData(0, "", getDbInfo(), getUserId());
+ }
- } // for
+ for (lookup.resetNext(); lookup.hasNext();) {
+ IdNameValue value = lookup.getNext();
+ sb.append(
+ "obj.options[obj.options.length] = new Option('" + Utils.singleQuoteEncode(value.getName())
+ + "','" + Utils.singleQuoteEncode(value.getId()) + "');");
+ if (fieldValue.indexOf('|' + value.getId() + '|') >= 0)
+ sb.append("obj.options[obj.options.length-1].selected=true;");
+ if (value.isReadOnly())
+ sb.append("obj.disabled=true;");
+ else
+ sb.append("obj.disabled=false;");
- // lookup.clearData();
- } catch (Exception e) {
- //throw new RaptorRuntimeException(e);
- }
- if(!hasPredefinedList) {
- if(oldSQL != null && !oldSQL.equals("")) {
- ((IdNameSql)lookup).setSQL(oldSQL);
- }
+ } // for
+
+ // lookup.clearData();
+ } catch (Exception e) {
+ // throw new RaptorRuntimeException(e);
+ }
+ if (!hasPredefinedList) {
+ if (oldSQL != null && !oldSQL.equals("")) {
+ ((IdNameSql) lookup).setSQL(oldSQL);
}
- if(isVisible())
- return sb.toString();
- else
- return "";
- } else if (fieldType.equals(FFT_TEXT_W_POPUP)) {
- //System.out.println("TEXT POPUP " + fieldName);
- String oldSQL = "";
- IdNameValue idNamevalue = null;
- String fieldDefValue="";
- String fieldDefDisplay="";
- try {
- IdNameList lookup = getLookupList();
- if(dependsOn != null && dependsOn != "" ) {
- IdNameSql lu = (IdNameSql) lookup;
- String SQL = getBaseWholeSQL();
- if(SQL.toLowerCase().indexOf(readOnly) != -1) {
- SQL = getBaseWholeReadonlySQL();
- }
- oldSQL = lu.getSql();
- if(formValues != null) {
- Set set = formValues.entrySet();
- String value = "";
- for(Iterator iter = set.iterator(); iter.hasNext(); ) {
- Map.Entry entry = (Entry) iter.next();
- value = (String) entry.getValue();
- if(inSchedule) {
- try {
- value = java.net.URLDecoder.decode(Utils.oracleSafe(value), "UTF-8");
- } catch (UnsupportedEncodingException ex) {
-
- }
- }
- SQL = Utils.replaceInString(SQL, "["+entry.getKey()+"]", value);
-// if(SQL.indexOf("'"+"["+entry.getKey()+"]"+"'")!=-1) {
- if(SQL.indexOf("'"+"["+entry.getKey()+"]"+"'")!=-1 || SQL.indexOf("'"+"["+entry.getKey())!=-1 || SQL.indexOf(entry.getKey()+"]"+"'")!=-1
- || SQL.indexOf("'%"+"["+entry.getKey()+"]"+"%'")!=-1 || SQL.indexOf("'%"+"["+entry.getKey())!=-1 || SQL.indexOf(entry.getKey()+"]"+"%'")!=-1
- || SQL.indexOf("'_"+"["+entry.getKey()+"]"+"_'")!=-1 || SQL.indexOf("'_"+"["+entry.getKey())!=-1 || SQL.indexOf(entry.getKey()+"]"+"_'")!=-1
- || SQL.indexOf("'%_"+"["+entry.getKey()+"]"+"_%'")!=-1 || SQL.indexOf("'%_"+"["+entry.getKey())!=-1 || SQL.indexOf(entry.getKey()+"]"+"_%'")!=-1) {
-
- SQL = Utils.replaceInString(SQL, "["+entry.getKey()+"]", nvl(
- value, "NULL"));
- } else {
- // Added to prevent SQL Injection
- if(SQL.indexOf("["+entry.getKey()+"]")!=-1) {
- try {
- double vD = Double.parseDouble(value);
- SQL = Utils.replaceInString(SQL, "["+entry.getKey()+"]", nvl(
- value, "NULL"));
- } catch (NumberFormatException ex) {
- throw new UserDefinedException("Expected number, Given String for the form field \"" + "["+entry.getKey()+"]"+"\"");
- }
- }
- }
- }
- if(getFieldDefaultSQL()!=null && (fieldValue == null || fieldValue.trim().equalsIgnoreCase("null")|| fieldValue.trim().length()<=0))
- lookup = new IdNameSql(-1,SQL,lu.getDefaultSQL());
- else
- lookup = new IdNameSql(-1,SQL,null);
- }
+ }
+ if (isVisible())
+ return sb.toString();
+ else
+ return "";
+ } else if (fieldType.equals(FFT_TEXT_W_POPUP)) {
+ // System.out.println("TEXT POPUP " + fieldName);
+ String oldSQL = "";
+ IdNameValue idNamevalue = null;
+ String fieldDefValue = "";
+ String fieldDefDisplay = "";
+ try {
+ IdNameList lookup = getLookupList();
+ if (dependsOn != null && dependsOn != "") {
+ IdNameSql lu = (IdNameSql) lookup;
+ String SQL = getBaseWholeSQL();
+ if (SQL.toLowerCase().indexOf(readOnly) != -1) {
+ SQL = getBaseWholeReadonlySQL();
}
- //lookupList = lookup;
-
- if(getFieldDefaultSQL()!=null && (fieldValue == null || fieldValue.trim().equalsIgnoreCase("null")|| fieldValue.trim().length()<=0)) {
- lookup.loadUserData(0, "", getDbInfo(), getUserId());
- for (lookup.resetNext(); lookup.hasNext();) {
- idNamevalue = lookup.getNext();
- break;
-
- }
- if(idNamevalue!=null){
- fieldDefValue = nvl(idNamevalue.getId());
- fieldDefDisplay = nvl(idNamevalue.getName());
- }
- } else {
- try {
- // -2 indicates to run the whole sql for matching value
- lookup.loadUserData(-2, "", getDbInfo(), getUserId());
- lookup.trimToSize();
- for (lookup.resetNext(); lookup.hasNext();) {
- IdNameValue value = lookup.getNext();
- if(value != null && value.getId() != null && value.getName() != null ) {
- fieldDefValue = nvl(value.getId());
- if (fieldValue != null && fieldValue.equals(value.getId())) {
- fieldDefDisplay = nvl(value.getName());
- break;
- }
- else {
- fieldDefValue = "";
- fieldDefDisplay = "";
- }
- }
- }
- if (fieldDefDisplay == null || fieldDefDisplay.length()<=0) {
- fieldDefDisplay = nvl(fieldDefValue);
- }
-
- if(oldSQL != null && !oldSQL.equals("") && lookup!=null) {
- ((IdNameSql)lookup).setSQL(oldSQL);
- }
-
- } catch (Exception e) {
- //throw new RaptorRuntimeException(e);
- }
-
-
- //----- END ---//
-
-
- if(getFieldDefaultSQL()!=null && (fieldValue == null || fieldValue.trim().equalsIgnoreCase("null")|| fieldValue.length()<=0)) {
- fieldDefValue = nvl((idNamevalue!=null)?idNamevalue.getId():"");
- fieldDefDisplay = nvl((idNamevalue!=null)?idNamevalue.getName():"");
- } else {
- if(fieldValue == null || fieldValue.trim().equalsIgnoreCase("null")|| fieldValue.length()<=0) fieldValue="";
- fieldDefValue = nvl(fieldDefValue);
- fieldDefDisplay = nvl(fieldDefDisplay);
- }
-
- }
- }catch(Exception e) { //throw new RaptorRuntimeException(e);
- }
- if(isVisible()) {
- /* return "<input type=text class=\"text\" size=30 maxlength=50 id=\"" + fieldName +"\" name=\"" + fieldName + "\" value=\""
- + nvl(fieldDefValue) + "\">\n" + "<a href=\"javascript:showArgPopupNew('"
- + fieldName + "', 'document.formd." + fieldName
- + "')\"><img border=0 src=\"" + AppUtils.getImgFolderURL()
- + "shareicon.gif\" " + getHelpLink(fieldName);
- */
- return "obj.value=\""+Utils.singleQuoteEncode(nvl(fieldDefValue))+"\";";
-
- } else
- return "";
- } else if (fieldType.equals(FFT_HIDDEN) || fieldType.equals(FFT_TEXT) || fieldType.equals(FFT_TEXTAREA) ) {
- StringBuffer sb = new StringBuffer();
- String oldSQL = "";
- try {
- IdNameList lookup = getLookupList();
- //if(dependsOn != null && dependsOn != "") {
- //if(dependsOn != null && dependsOn != "" ) {
- IdNameSql lu = (IdNameSql) lookup;
- String SQL = lu.getSql();
- //System.out.println("SQL HIDDEN 1 " + SQL);
- oldSQL = lu.getSql();
- if(formValues != null) {
- Set set = formValues.entrySet();
- String value = "";
- for(Iterator iter = set.iterator(); iter.hasNext(); ) {
- Map.Entry entry = (Entry) iter.next();
- value = (String) entry.getValue();
- if(value == null || value.trim().length()<=0) {
- value = "NULL";
+ oldSQL = lu.getSql();
+ if (formValues != null) {
+ Set set = formValues.entrySet();
+ String value = "";
+ for (Iterator iter = set.iterator(); iter.hasNext();) {
+ Map.Entry entry = (Entry) iter.next();
+ value = (String) entry.getValue();
+ if (inSchedule) {
+ try {
+ value = java.net.URLDecoder.decode(Utils.oracleSafe(value), "UTF-8");
+ } catch (UnsupportedEncodingException ex) {
+
+ }
+ }
+ SQL = Utils.replaceInString(SQL, "[" + entry.getKey() + "]", value);
+ // if(SQL.indexOf("'"+"["+entry.getKey()+"]"+"'")!=-1) {
+ if (SQL.indexOf("'" + "[" + entry.getKey() + "]" + "'") != -1
+ || SQL.indexOf("'" + "[" + entry.getKey()) != -1
+ || SQL.indexOf(entry.getKey() + "]" + "'") != -1
+ || SQL.indexOf("'%" + "[" + entry.getKey() + "]" + "%'") != -1
+ || SQL.indexOf("'%" + "[" + entry.getKey()) != -1
+ || SQL.indexOf(entry.getKey() + "]" + "%'") != -1
+ || SQL.indexOf("'_" + "[" + entry.getKey() + "]" + "_'") != -1
+ || SQL.indexOf("'_" + "[" + entry.getKey()) != -1
+ || SQL.indexOf(entry.getKey() + "]" + "_'") != -1
+ || SQL.indexOf("'%_" + "[" + entry.getKey() + "]" + "_%'") != -1
+ || SQL.indexOf("'%_" + "[" + entry.getKey()) != -1
+ || SQL.indexOf(entry.getKey() + "]" + "_%'") != -1) {
+
+ SQL = Utils.replaceInString(SQL, "[" + entry.getKey() + "]", nvl(value, "NULL"));
+ } else {
+ // Added to prevent SQL Injection
+ if (SQL.indexOf("[" + entry.getKey() + "]") != -1) {
+ try {
+ double vD = Double.parseDouble(value);
+ SQL = Utils.replaceInString(SQL, "[" + entry.getKey() + "]",
+ nvl(value, "NULL"));
+ } catch (NumberFormatException ex) {
+ throw new UserDefinedException(
+ "Expected number, Given String for the form field \"" + "["
+ + entry.getKey() + "]" + "\"");
}
- if(inSchedule) {
- try {
- value = java.net.URLDecoder.decode(value, "UTF-8");
- } catch (UnsupportedEncodingException ex) {
-
- }
- }
- //System.out.println("HIDDEN " + "["+entry.getKey()+"]" + "-" + value);
- SQL = Utils.replaceInString(SQL, "["+entry.getKey()+"]", value);
}
-
- lookup = new IdNameSql(-1,SQL,lu.getDefaultSQL());
}
- //System.out.println("SQL HIDDEN 2 " + SQL);
- //}
- lookupList = lookup;
- //}
- if(nvl(fieldValue).length()>0 && (dependsOn == null || dependsOn.length()<=0)) {
- sb.append((fieldValue!=null)?"obj.value=\""+nvl(fieldValue)+"\";":"");
- } else if (lookup != null) {
- lookup.loadUserData(0, "", getDbInfo(), getUserId());
- int iCnt = 0;
- for (lookup.resetNext(); lookup.hasNext(); iCnt++) {
- IdNameValue value = lookup.getNext();
- //System.out.println("HIDDEN " + value.getId() + " " + value.getName());
- sb.append((value!=null)?"obj.value=\""+nvl(value.getId())+"\";":"");
- if(value.isReadOnly())
- sb.append("obj.disabled=true;");
- else
- sb.append("obj.disabled=false;");
- break;
- } // for
- if(lookup.size()<=0) {
- sb.append("obj.value=\"\"");
-
}
- } else {
- sb.append((fieldValue!=null)?"obj.value=\""+Utils.singleQuoteEncode(nvl(fieldValue))+"\";":"");
+ if (getFieldDefaultSQL() != null && (fieldValue == null
+ || fieldValue.trim().equalsIgnoreCase("null") || fieldValue.trim().length() <= 0))
+ lookup = new IdNameSql(-1, SQL, lu.getDefaultSQL());
+ else
+ lookup = new IdNameSql(-1, SQL, null);
}
- if(oldSQL != null && !oldSQL.equals("")) {
- ((IdNameSql)lookup).setSQL(oldSQL);
- }
- // lookup.clearData();
- } catch (Exception e) {
- //throw new RaptorRuntimeException(e);
}
- //if(isVisible())
- return sb.toString() ;
- } else if (fieldType.equals(FFT_LIST_BOX)) {
- StringBuffer sb = new StringBuffer();
- //System.out.println("COMBO BOX " + fieldName);
- String oldSQL = "";
- if (!required)
- sb.append("obj.options[obj.options.length] = new Option('-->select value<--','');");
+ // lookupList = lookup;
- IdNameList lookup = getLookupList();
- try {
- if(!hasPredefinedList) {
- //if(dependsOn != null && dependsOn != "") {
- //if(dependsOn != null && dependsOn != "" ) {
- IdNameSql lu = (IdNameSql) lookup;
- String SQL = "";
- SQL = lu.getSql();
- /*if(nvl(fieldValue,"").length()<=0)
- SQL = lu.getSql();
- else
- SQL = lu.getBaseSQLForPDFExcel(false);
- */
- //System.out.println("FORMFIELD 6666667 First" + ((IdNameSql)lookup).getSql());
- oldSQL = lu.getSql();
- //SQL = Utils.replaceInString(SQL, "[VALUE]", fieldValue);
- if(formValues != null) {
- Set set = formValues.entrySet();
- String value = "";
- for(Iterator iter = set.iterator(); iter.hasNext(); ) {
- Map.Entry entry = (Entry) iter.next();
- value = (String) entry.getValue();
- if(inSchedule) {
- try {
- value = java.net.URLDecoder.decode(Utils.oracleSafe(value), "UTF-8");
- } catch (UnsupportedEncodingException ex) {
-
- }
- }
- if (value!=null && (value.length() <=0 || value.equals("NULL"))) {
- value = "NULL";
- SQL = Utils.replaceInString(SQL, "'["+entry.getKey()+"]'", value);
- SQL = Utils.replaceInString(SQL, "["+entry.getKey()+"]", value);
- } else {
- SQL = Utils.replaceInString(SQL, "["+entry.getKey()+"]", value);
- }
+ if (getFieldDefaultSQL() != null && (fieldValue == null || fieldValue.trim().equalsIgnoreCase("null")
+ || fieldValue.trim().length() <= 0)) {
+ lookup.loadUserData(0, "", getDbInfo(), getUserId());
+ for (lookup.resetNext(); lookup.hasNext();) {
+ idNamevalue = lookup.getNext();
+ break;
+
+ }
+ if (idNamevalue != null) {
+ fieldDefValue = nvl(idNamevalue.getId());
+ fieldDefDisplay = nvl(idNamevalue.getName());
+ }
+ } else {
+ try {
+ // -2 indicates to run the whole sql for matching value
+ lookup.loadUserData(-2, "", getDbInfo(), getUserId());
+ lookup.trimToSize();
+ for (lookup.resetNext(); lookup.hasNext();) {
+ IdNameValue value = lookup.getNext();
+ if (value != null && value.getId() != null && value.getName() != null) {
+ fieldDefValue = nvl(value.getId());
+ if (fieldValue != null && fieldValue.equals(value.getId())) {
+ fieldDefDisplay = nvl(value.getName());
+ break;
+ } else {
+ fieldDefValue = "";
+ fieldDefDisplay = "";
}
- lookup = new IdNameSql(-1,SQL,lu.getDefaultSQL());
}
- //}
- lookupList = lookup;
-
- //}
- try {
- lookup.loadUserData(0, "", getDbInfo(), getUserId());
- } catch (Exception e ){ e.printStackTrace(); //throw new RaptorRuntimeException(e);
+ }
+ if (fieldDefDisplay == null || fieldDefDisplay.length() <= 0) {
+ fieldDefDisplay = nvl(fieldDefValue);
+ }
+
+ if (oldSQL != null && !oldSQL.equals("") && lookup != null) {
+ ((IdNameSql) lookup).setSQL(oldSQL);
+ }
+
+ } catch (Exception e) {
+ // throw new RaptorRuntimeException(e);
}
+
+ // ----- END ---//
+
+ if (getFieldDefaultSQL() != null && (fieldValue == null
+ || fieldValue.trim().equalsIgnoreCase("null") || fieldValue.length() <= 0)) {
+ fieldDefValue = nvl((idNamevalue != null) ? idNamevalue.getId() : "");
+ fieldDefDisplay = nvl((idNamevalue != null) ? idNamevalue.getName() : "");
+ } else {
+ if (fieldValue == null || fieldValue.trim().equalsIgnoreCase("null")
+ || fieldValue.length() <= 0)
+ fieldValue = "";
+ fieldDefValue = nvl(fieldDefValue);
+ fieldDefDisplay = nvl(fieldDefDisplay);
}
- lookup.trimToSize();
-
- String selectedValue = "";
- int count = 0;
- for (lookup.resetNext(); lookup.hasNext();) {
+
+ }
+ } catch (Exception e) { // throw new RaptorRuntimeException(e);
+ }
+ if (isVisible()) {
+ /*
+ * return "<input type=text class=\"text\" size=30 maxlength=50 id=\"" +
+ * fieldName +"\" name=\"" + fieldName + "\" value=\"" + nvl(fieldDefValue) +
+ * "\">\n" + "<a href=\"javascript:showArgPopupNew('" + fieldName +
+ * "', 'document.formd." + fieldName + "')\"><img border=0 src=\"" +
+ * AppUtils.getImgFolderURL() + "shareicon.gif\" " + getHelpLink(fieldName);
+ */
+ return "obj.value=\"" + Utils.singleQuoteEncode(nvl(fieldDefValue)) + "\";";
+
+ } else
+ return "";
+ } else if (fieldType.equals(FFT_HIDDEN) || fieldType.equals(FFT_TEXT) || fieldType.equals(FFT_TEXTAREA)) {
+ StringBuffer sb = new StringBuffer();
+ String oldSQL = "";
+ try {
+ IdNameList lookup = getLookupList();
+ // if(dependsOn != null && dependsOn != "") {
+ // if(dependsOn != null && dependsOn != "" ) {
+ IdNameSql lu = (IdNameSql) lookup;
+ String SQL = lu.getSql();
+ // System.out.println("SQL HIDDEN 1 " + SQL);
+ oldSQL = lu.getSql();
+ if (formValues != null) {
+ Set set = formValues.entrySet();
+ String value = "";
+ for (Iterator iter = set.iterator(); iter.hasNext();) {
+ Map.Entry entry = (Entry) iter.next();
+ value = (String) entry.getValue();
+ if (value == null || value.trim().length() <= 0) {
+ value = "NULL";
+ }
+ if (inSchedule) {
+ try {
+ value = java.net.URLDecoder.decode(value, "UTF-8");
+ } catch (UnsupportedEncodingException ex) {
+
+ }
+ }
+ // System.out.println("HIDDEN " + "["+entry.getKey()+"]" + "-" + value);
+ SQL = Utils.replaceInString(SQL, "[" + entry.getKey() + "]", value);
+ }
+
+ lookup = new IdNameSql(-1, SQL, lu.getDefaultSQL());
+ }
+ // System.out.println("SQL HIDDEN 2 " + SQL);
+ // }
+ lookupList = lookup;
+ // }
+ if (nvl(fieldValue).length() > 0 && (dependsOn == null || dependsOn.length() <= 0)) {
+ sb.append((fieldValue != null) ? "obj.value=\"" + nvl(fieldValue) + "\";" : "");
+ } else if (lookup != null) {
+ lookup.loadUserData(0, "", getDbInfo(), getUserId());
+ int iCnt = 0;
+ for (lookup.resetNext(); lookup.hasNext(); iCnt++) {
IdNameValue value = lookup.getNext();
- if(value != null && value.getId() != null && value.getName() != null ) {
- /*if (count == 0 && required) {
- selectedValue = value.getId();
- count++;
- } else if (nvl(fieldValue).length()>0){
- if (fieldValue != null && fieldValue.equals(value.getId())){
- selectedValue = value.getId();
+ // System.out.println("HIDDEN " + value.getId() + " " + value.getName());
+ sb.append((value != null) ? "obj.value=\"" + nvl(value.getId()) + "\";" : "");
+ if (value.isReadOnly())
+ sb.append("obj.disabled=true;");
+ else
+ sb.append("obj.disabled=false;");
+ break;
+ } // for
+ if (lookup.size() <= 0) {
+ sb.append("obj.value=\"\"");
+
+ }
+ } else {
+ sb.append((fieldValue != null) ? "obj.value=\"" + Utils.singleQuoteEncode(nvl(fieldValue)) + "\";"
+ : "");
+ }
+ if (oldSQL != null && !oldSQL.equals("")) {
+ ((IdNameSql) lookup).setSQL(oldSQL);
+ }
+ // lookup.clearData();
+ } catch (Exception e) {
+ // throw new RaptorRuntimeException(e);
+ }
+ // if(isVisible())
+ return sb.toString();
+ } else if (fieldType.equals(FFT_LIST_BOX)) {
+ StringBuffer sb = new StringBuffer();
+ // System.out.println("COMBO BOX " + fieldName);
+ String oldSQL = "";
+ if (!required)
+ sb.append("obj.options[obj.options.length] = new Option('-->select value<--','');");
+
+ IdNameList lookup = getLookupList();
+ try {
+ if (!hasPredefinedList) {
+ // if(dependsOn != null && dependsOn != "") {
+ // if(dependsOn != null && dependsOn != "" ) {
+ IdNameSql lu = (IdNameSql) lookup;
+ String SQL = "";
+ SQL = lu.getSql();
+ /*
+ * if(nvl(fieldValue,"").length()<=0) SQL = lu.getSql(); else SQL =
+ * lu.getBaseSQLForPDFExcel(false);
+ */
+ // System.out.println("FORMFIELD 6666667 First" + ((IdNameSql)lookup).getSql());
+ oldSQL = lu.getSql();
+ // SQL = Utils.replaceInString(SQL, "[VALUE]", fieldValue);
+ if (formValues != null) {
+ Set set = formValues.entrySet();
+ String value = "";
+ for (Iterator iter = set.iterator(); iter.hasNext();) {
+ Map.Entry entry = (Entry) iter.next();
+ value = (String) entry.getValue();
+ if (inSchedule) {
+ try {
+ value = java.net.URLDecoder.decode(Utils.oracleSafe(value), "UTF-8");
+ } catch (UnsupportedEncodingException ex) {
+
}
- count++;
+ }
+ if (value != null && (value.length() <= 0 || value.equals("NULL"))) {
+ value = "NULL";
+ SQL = Utils.replaceInString(SQL, "'[" + entry.getKey() + "]'", value);
+ SQL = Utils.replaceInString(SQL, "[" + entry.getKey() + "]", value);
} else {
- count++;
- } */
- if (count == 0) {
- if(required){
- selectedValue = value.getId();
- }
- count++;
+ SQL = Utils.replaceInString(SQL, "[" + entry.getKey() + "]", value);
}
- sb.append("obj.options[obj.options.length] = new Option('" + Utils.singleQuoteEncode(value.getName())+"','"+Utils.singleQuoteEncode(value.getId())+"');");
- if ((fieldValue != null && fieldValue.equals(value.getId()))){
- sb.append("obj.options[obj.options.length-1].selected=true;");
+ }
+ lookup = new IdNameSql(-1, SQL, lu.getDefaultSQL());
+ }
+ // }
+ lookupList = lookup;
+
+ // }
+ try {
+ lookup.loadUserData(0, "", getDbInfo(), getUserId());
+ } catch (Exception e) {
+ logger.error(EELFLoggerDelegate.errorLogger, "getAjaxHtml () failed", e);
+
+ }
+ }
+ lookup.trimToSize();
+
+ String selectedValue = "";
+ int count = 0;
+ for (lookup.resetNext(); lookup.hasNext();) {
+ IdNameValue value = lookup.getNext();
+ if (value != null && value.getId() != null && value.getName() != null) {
+ /*
+ * if (count == 0 && required) { selectedValue = value.getId(); count++; } else
+ * if (nvl(fieldValue).length()>0){ if (fieldValue != null &&
+ * fieldValue.equals(value.getId())){ selectedValue = value.getId(); } count++;
+ * } else { count++; }
+ */
+ if (count == 0) {
+ if (required) {
selectedValue = value.getId();
}
- if(value.isReadOnly())
- sb.append("obj.disabled=true;");
- else
- sb.append("obj.disabled=false;");
-
+ count++;
}
- } // for
- if (formValues.containsKey(fieldDisplayName)){
- formValues.remove(fieldDisplayName);
+ sb.append("obj.options[obj.options.length] = new Option('"
+ + Utils.singleQuoteEncode(value.getName()) + "','"
+ + Utils.singleQuoteEncode(value.getId()) + "');");
+ if ((fieldValue != null && fieldValue.equals(value.getId()))) {
+ sb.append("obj.options[obj.options.length-1].selected=true;");
+ selectedValue = value.getId();
+ }
+ if (value.isReadOnly())
+ sb.append("obj.disabled=true;");
+ else
+ sb.append("obj.disabled=false;");
+
}
- formValues.put(fieldDisplayName, selectedValue);
- } catch (Exception e) {
- //throw new RaptorRuntimeException(e);
+ } // for
+ if (formValues.containsKey(fieldDisplayName)) {
+ formValues.remove(fieldDisplayName);
}
- if(!hasPredefinedList) {
- if(oldSQL != null && !oldSQL.equals("")) {
- ((IdNameSql)lookup).setSQL(oldSQL);
- }
+ formValues.put(fieldDisplayName, selectedValue);
+ } catch (Exception e) {
+ // throw new RaptorRuntimeException(e);
+ }
+ if (!hasPredefinedList) {
+ if (oldSQL != null && !oldSQL.equals("")) {
+ ((IdNameSql) lookup).setSQL(oldSQL);
}
- //System.out.println("FORMFIELD 6666667 " + ((IdNameSql)lookup).getSql());
- if( isVisible())
- return sb.toString();
- else return "";
- }
+ }
+ // System.out.println("FORMFIELD 6666667 " + ((IdNameSql)lookup).getSql());
+ if (isVisible())
+ return sb.toString();
+ else
+ return "";
+ }
- return "";
+ return "";
}
-
- public String getHtml(String fieldValue, HashMap formValues, ReportRuntime rr, boolean inSchedule) throws RaptorRuntimeException {
- fieldValue = nvl(fieldValue, defaultValue);
- int MILLIS_IN_DAY = 1000 * 60 * 60 * 24;
- String readOnlyInSql = "ff_readonly";
- boolean readOnly = false;
- try {
- if(fieldValue !=null && fieldValue.length() > 0)
- fieldValue = java.net.URLDecoder.decode(fieldValue, "UTF-8");
- } catch (UnsupportedEncodingException ex) {}
- catch (IllegalArgumentException ex1){}
- catch (Exception ex2){}
- //System.out.println(fieldName + " " + fieldType + " " + fieldValue);
- if (fieldType.equals(FFT_TEXT_W_POPUP)) {
- //System.out.println("TEXT POPUP " + fieldName);
- String oldSQL = "";
- IdNameValue idNamevalue = null;
- String fieldDefValue="";
- String fieldDefDisplay="";
- IdNameList lookup = null;
- try {
- lookup = getLookupList();
- if(!hasPredefinedList) {
- if(dependsOn != null && dependsOn != "" ) {
- IdNameSql lu = (IdNameSql) lookup;
- String SQL = getBaseWholeSQL();
- if(SQL.toLowerCase().indexOf(readOnlyInSql) != -1) {
- SQL = getBaseWholeReadonlySQL();
- }
- oldSQL = lu.getSql();
- if(formValues != null) {
+
+ public String getHtml(String fieldValue, HashMap formValues, ReportRuntime rr, boolean inSchedule)
+ throws RaptorRuntimeException {
+ fieldValue = nvl(fieldValue, defaultValue);
+ int MILLIS_IN_DAY = 1000 * 60 * 60 * 24;
+ String readOnlyInSql = "ff_readonly";
+ boolean readOnly = false;
+ try {
+ if (fieldValue != null && fieldValue.length() > 0)
+ fieldValue = java.net.URLDecoder.decode(fieldValue, "UTF-8");
+ } catch (UnsupportedEncodingException ex) {
+ } catch (IllegalArgumentException ex1) {
+ } catch (Exception ex2) {
+ }
+ // System.out.println(fieldName + " " + fieldType + " " + fieldValue);
+ if (fieldType.equals(FFT_TEXT_W_POPUP)) {
+ // System.out.println("TEXT POPUP " + fieldName);
+ String oldSQL = "";
+ IdNameValue idNamevalue = null;
+ String fieldDefValue = "";
+ String fieldDefDisplay = "";
+ IdNameList lookup = null;
+ try {
+ lookup = getLookupList();
+ if (!hasPredefinedList) {
+ if (dependsOn != null && dependsOn != "") {
+ IdNameSql lu = (IdNameSql) lookup;
+ String SQL = getBaseWholeSQL();
+ if (SQL.toLowerCase().indexOf(readOnlyInSql) != -1) {
+ SQL = getBaseWholeReadonlySQL();
+ }
+ oldSQL = lu.getSql();
+ if (formValues != null) {
Set set = formValues.entrySet();
String value = "";
- for(Iterator iter = set.iterator(); iter.hasNext(); ) {
+ for (Iterator iter = set.iterator(); iter.hasNext();) {
Map.Entry entry = (Entry) iter.next();
value = (String) entry.getValue();
- SQL = Utils.replaceInString(SQL, "["+entry.getKey()+"]", value);
-// if(SQL.indexOf("'"+"["+entry.getKey()+"]"+"'")!=-1) {
- if(SQL.indexOf("'"+"["+entry.getKey()+"]"+"'")!=-1 || SQL.indexOf("'"+"["+entry.getKey())!=-1 || SQL.indexOf(entry.getKey()+"]"+"'")!=-1
- || SQL.indexOf("'%"+"["+entry.getKey()+"]"+"%'")!=-1 || SQL.indexOf("'%"+"["+entry.getKey())!=-1 || SQL.indexOf(entry.getKey()+"]"+"%'")!=-1
- || SQL.indexOf("'_"+"["+entry.getKey()+"]"+"_'")!=-1 || SQL.indexOf("'_"+"["+entry.getKey())!=-1 || SQL.indexOf(entry.getKey()+"]"+"_'")!=-1
- || SQL.indexOf("'%_"+"["+entry.getKey()+"]"+"_%'")!=-1 || SQL.indexOf("'%_"+"["+entry.getKey())!=-1 || SQL.indexOf(entry.getKey()+"]"+"_%'")!=-1) {
-
- SQL = Utils.replaceInString(SQL, "["+entry.getKey()+"]", nvl(
- value, "NULL"));
+ SQL = Utils.replaceInString(SQL, "[" + entry.getKey() + "]", value);
+ // if(SQL.indexOf("'"+"["+entry.getKey()+"]"+"'")!=-1) {
+ if (SQL.indexOf("'" + "[" + entry.getKey() + "]" + "'") != -1
+ || SQL.indexOf("'" + "[" + entry.getKey()) != -1
+ || SQL.indexOf(entry.getKey() + "]" + "'") != -1
+ || SQL.indexOf("'%" + "[" + entry.getKey() + "]" + "%'") != -1
+ || SQL.indexOf("'%" + "[" + entry.getKey()) != -1
+ || SQL.indexOf(entry.getKey() + "]" + "%'") != -1
+ || SQL.indexOf("'_" + "[" + entry.getKey() + "]" + "_'") != -1
+ || SQL.indexOf("'_" + "[" + entry.getKey()) != -1
+ || SQL.indexOf(entry.getKey() + "]" + "_'") != -1
+ || SQL.indexOf("'%_" + "[" + entry.getKey() + "]" + "_%'") != -1
+ || SQL.indexOf("'%_" + "[" + entry.getKey()) != -1
+ || SQL.indexOf(entry.getKey() + "]" + "_%'") != -1) {
+
+ SQL = Utils.replaceInString(SQL, "[" + entry.getKey() + "]", nvl(value, "NULL"));
} else {
// Added to prevent SQL Injection
- if(SQL.indexOf("["+entry.getKey()+"]")!=-1) {
+ if (SQL.indexOf("[" + entry.getKey() + "]") != -1) {
try {
double vD = Double.parseDouble(value);
- SQL = Utils.replaceInString(SQL, "["+entry.getKey()+"]", nvl(
- value, "NULL"));
- } catch (NumberFormatException ex) {
- throw new UserDefinedException("Expected number, Given String for the form field \"" + "["+entry.getKey()+"]"+"\"");
- }
+ SQL = Utils.replaceInString(SQL, "[" + entry.getKey() + "]",
+ nvl(value, "NULL"));
+ } catch (NumberFormatException ex) {
+ throw new UserDefinedException(
+ "Expected number, Given String for the form field \"" + "["
+ + entry.getKey() + "]" + "\"");
+ }
}
}
+ }
+ if (getFieldDefaultSQL() != null && (fieldValue == null
+ || fieldValue.trim().equalsIgnoreCase("null") || fieldValue.trim().length() <= 0))
+ lookup = new IdNameSql(-1, SQL, lu.getDefaultSQL());
+ else
+ lookup = new IdNameSql(-1, SQL, null);
+ }
+ }
+ // lookupList = lookup;
+
+ if (getFieldDefaultSQL() != null && (fieldValue == null
+ || fieldValue.trim().equalsIgnoreCase("null") || fieldValue.trim().length() <= 0)) {
+ lookup.loadUserData(0, "", getDbInfo(), getUserId());
+ for (lookup.resetNext(); lookup.hasNext();) {
+ idNamevalue = lookup.getNext();
+ break;
+
+ }
+ fieldDefValue = nvl(idNamevalue.getId());
+ fieldDefDisplay = nvl(idNamevalue.getName());
+ } else {
+ try {
+ // -2 indicates to run the whole sql for matching value
+ lookup.loadUserData(-2, "", getDbInfo(), getUserId());
+ } catch (Exception e) {
+ // throw new RaptorRuntimeException(e);
+ }
+
+ lookup.trimToSize();
+ for (lookup.resetNext(); lookup.hasNext();) {
+ IdNameValue value = lookup.getNext();
+ if (value != null && value.getId() != null && value.getName() != null) {
+ fieldDefValue = nvl(value.getId());
+ if (fieldValue != null && fieldValue.equals(value.getId())) {
+ fieldDefDisplay = nvl(value.getName());
+ break;
+ } else {
+ fieldDefValue = "";
+ fieldDefDisplay = "";
}
- if(getFieldDefaultSQL()!=null && (fieldValue == null || fieldValue.trim().equalsIgnoreCase("null")|| fieldValue.trim().length()<=0))
- lookup = new IdNameSql(-1,SQL,lu.getDefaultSQL());
- else
- lookup = new IdNameSql(-1,SQL,null);
+ }
+ }
+ if (fieldDefDisplay == null || fieldDefDisplay.length() <= 0) {
+ fieldDefDisplay = nvl(fieldDefValue);
+ }
+
+ // ----- END ---//
+
+ if (getFieldDefaultSQL() != null && (fieldValue == null
+ || fieldValue.trim().equalsIgnoreCase("null") || fieldValue.length() <= 0)) {
+ fieldDefValue = nvl((idNamevalue != null) ? idNamevalue.getId() : "");
+ fieldDefDisplay = nvl((idNamevalue != null) ? idNamevalue.getName() : "");
+ } else {
+ if (fieldValue == null || fieldValue.trim().equalsIgnoreCase("null")
+ || fieldValue.length() <= 0)
+ fieldValue = "";
+ fieldDefValue = nvl(fieldDefValue);
+ fieldDefDisplay = nvl(fieldDefDisplay);
+ }
+
+ }
+ } else {
+ lookup.trimToSize();
+ for (lookup.resetNext(); lookup.hasNext();) {
+ IdNameValue value = lookup.getNext();
+ if (value != null && value.getId() != null && value.getName() != null) {
+ fieldDefValue = nvl(value.getId());
+ if (fieldValue != null && fieldValue.equals(value.getId())) {
+ fieldDefDisplay = nvl(value.getName());
+ break;
+ } else {
+ fieldDefValue = "";
+ fieldDefDisplay = "";
+ }
+ }
+ }
+ if (fieldDefDisplay == null || fieldDefDisplay.length() <= 0) {
+ fieldDefDisplay = nvl(fieldDefValue);
}
}
- //lookupList = lookup;
-
- if(getFieldDefaultSQL()!=null && (fieldValue == null || fieldValue.trim().equalsIgnoreCase("null")|| fieldValue.trim().length()<=0)) {
- lookup.loadUserData(0, "", getDbInfo(), getUserId());
- for (lookup.resetNext(); lookup.hasNext();) {
- idNamevalue = lookup.getNext();
- break;
-
- }
- fieldDefValue = nvl(idNamevalue.getId());
- fieldDefDisplay = nvl(idNamevalue.getName());
- } else {
- try {
- // -2 indicates to run the whole sql for matching value
- lookup.loadUserData(-2, "", getDbInfo(), getUserId());
- } catch (Exception e) {
- //throw new RaptorRuntimeException(e);
- }
-
- lookup.trimToSize();
- for (lookup.resetNext(); lookup.hasNext();) {
- IdNameValue value = lookup.getNext();
- if(value != null && value.getId() != null && value.getName() != null ) {
- fieldDefValue = nvl(value.getId());
- if (fieldValue != null && fieldValue.equals(value.getId())) {
- fieldDefDisplay = nvl(value.getName());
- break;
- }
- else {
- fieldDefValue = "";
- fieldDefDisplay = "";
- }
- }
- }
- if (fieldDefDisplay == null || fieldDefDisplay.length()<=0) {
- fieldDefDisplay = nvl(fieldDefValue);
- }
-
-
-
- //----- END ---//
-
-
- if(getFieldDefaultSQL()!=null && (fieldValue == null || fieldValue.trim().equalsIgnoreCase("null")|| fieldValue.length()<=0)) {
- fieldDefValue = nvl((idNamevalue!=null)?idNamevalue.getId():"");
- fieldDefDisplay = nvl((idNamevalue!=null)?idNamevalue.getName():"");
- } else {
- if(fieldValue == null || fieldValue.trim().equalsIgnoreCase("null")|| fieldValue.length()<=0) fieldValue="";
- fieldDefValue = nvl(fieldDefValue);
- fieldDefDisplay = nvl(fieldDefDisplay);
- }
-
- }
- } else {
- lookup.trimToSize();
- for (lookup.resetNext(); lookup.hasNext();) {
- IdNameValue value = lookup.getNext();
- if(value != null && value.getId() != null && value.getName() != null ) {
- fieldDefValue = nvl(value.getId());
- if (fieldValue != null && fieldValue.equals(value.getId())) {
- fieldDefDisplay = nvl(value.getName());
- break;
- }
- else {
- fieldDefValue = "";
- fieldDefDisplay = "";
- }
- }
- }
- if (fieldDefDisplay == null || fieldDefDisplay.length()<=0) {
- fieldDefDisplay = nvl(fieldDefValue);
- }
- }
- }catch(Exception e) { //throw new RaptorRuntimeException(e);
- }
-
- if(!hasPredefinedList) {
- if(oldSQL != null && !oldSQL.equals("")) {
- ((IdNameSql)lookup).setSQL(oldSQL);
- }
+ } catch (Exception e) { // throw new RaptorRuntimeException(e);
+ }
+
+ if (!hasPredefinedList) {
+ if (oldSQL != null && !oldSQL.equals("")) {
+ ((IdNameSql) lookup).setSQL(oldSQL);
+ }
}
-
- if(isVisible()) {
- /* return "<input type=text class=\"text\" size=30 maxlength=50 id=\"" + fieldName +"\" name=\"" + fieldName + "\" value=\""
- + nvl(fieldDefValue) + "\">\n" + "<a href=\"javascript:showArgPopupNew('"
- + fieldName + "', 'document.formd." + fieldName
- + "')\"><img border=0 src=\"" + AppUtils.getImgFolderURL()
- + "shareicon.gif\" " + getHelpLink(fieldName);
- */
- String progress = "<div id=\""+fieldName+"_content\" style=\"display:none;width:100%;height:100%;align:center;\"> <img src=\""+AppUtils.getImgFolderURL()+"progress.gif\" border=\"0\" alt=\"Loading, please wait...\" /></div> ";
-
- return progress+"<input type=\"text\" class=\"text\" name=\""+getFieldName()+"_display\" readonly=true value=\""+ fieldDefDisplay +"\""+ getCallableJavascript(getFieldName(), rr) + getHelpLink(fieldName) + " \n "
- +"<input type=\"hidden\" name=\""+getFieldName()+"\" value=\""+nvl(fieldDefValue)+"\"/> \n &nbsp;\n"
- + "<a href=\"javascript:showArgPopupNew('"
- + fieldName + "', 'document.formd." + fieldName
- + "')\"><img border=0 src=\"" + AppUtils.getImgFolderURL()
- + "shareicon.gif\" " + getHelpLink(fieldName);
-
- } else
- return "";
+
+ if (isVisible()) {
+ /*
+ * return "<input type=text class=\"text\" size=30 maxlength=50 id=\"" +
+ * fieldName +"\" name=\"" + fieldName + "\" value=\"" + nvl(fieldDefValue) +
+ * "\">\n" + "<a href=\"javascript:showArgPopupNew('" + fieldName +
+ * "', 'document.formd." + fieldName + "')\"><img border=0 src=\"" +
+ * AppUtils.getImgFolderURL() + "shareicon.gif\" " + getHelpLink(fieldName);
+ */
+ String progress = "<div id=\"" + fieldName
+ + "_content\" style=\"display:none;width:100%;height:100%;align:center;\"> <img src=\""
+ + AppUtils.getImgFolderURL()
+ + "progress.gif\" border=\"0\" alt=\"Loading, please wait...\" /></div> ";
+
+ return progress + "<input type=\"text\" class=\"text\" name=\"" + getFieldName()
+ + "_display\" readonly=true value=\"" + fieldDefDisplay + "\""
+ + getCallableJavascript(getFieldName(), rr) + getHelpLink(fieldName) + " \n "
+ + "<input type=\"hidden\" name=\"" + getFieldName() + "\" value=\"" + nvl(fieldDefValue)
+ + "\"/> \n &nbsp;\n" + "<a href=\"javascript:showArgPopupNew('" + fieldName
+ + "', 'document.formd." + fieldName + "')\"><img border=0 src=\"" + AppUtils.getImgFolderURL()
+ + "shareicon.gif\" " + getHelpLink(fieldName);
+
+ } else
+ return "";
} else if (fieldType.equals(FFT_TEXT)) {
- IdNameValue value = null;
- String strValue = "";
- boolean avail_ReadOnly = false;
- try {
- IdNameList lookup = getLookupList();
- IdNameSql lu = null;
- String valueSQL = "";
- String oldSQL = "";
- if(lookup instanceof IdNameSql) {
- lu = (IdNameSql) lookup;
- if(lu.getSql().length() > 0) {
- valueSQL = lu.getSql();
- avail_ReadOnly = (valueSQL.toLowerCase().indexOf(readOnlyInSql)!=-1);
- //System.out.println("OLD SQL TEXT" + valueSQL);
- //oldSQL = lu.getSql();
- if(formValues != null) {
+ IdNameValue value = null;
+ String strValue = "";
+ boolean avail_ReadOnly = false;
+ try {
+ IdNameList lookup = getLookupList();
+ IdNameSql lu = null;
+ String valueSQL = "";
+ String oldSQL = "";
+ if (lookup instanceof IdNameSql) {
+ lu = (IdNameSql) lookup;
+ if (lu.getSql().length() > 0) {
+ valueSQL = lu.getSql();
+ avail_ReadOnly = (valueSQL.toLowerCase().indexOf(readOnlyInSql) != -1);
+ // System.out.println("OLD SQL TEXT" + valueSQL);
+ // oldSQL = lu.getSql();
+ if (formValues != null) {
Set set = formValues.entrySet();
String value1 = "";
- for(Iterator iter = set.iterator(); iter.hasNext(); ) {
+ for (Iterator iter = set.iterator(); iter.hasNext();) {
Map.Entry entry = (Entry) iter.next();
value1 = (String) entry.getValue();
- if (value1.length() <=0) {
+ if (value1.length() <= 0) {
value1 = "NULL";
- valueSQL = Utils.replaceInString(valueSQL, "'["+entry.getKey()+"]'", value1);
- valueSQL = Utils.replaceInString(valueSQL, "["+entry.getKey()+"]", value1);
- } else {
- valueSQL = Utils.replaceInString(valueSQL, "["+entry.getKey()+"]", value1);
+ valueSQL = Utils.replaceInString(valueSQL, "'[" + entry.getKey() + "]'", value1);
+ valueSQL = Utils.replaceInString(valueSQL, "[" + entry.getKey() + "]", value1);
+ } else {
+ valueSQL = Utils.replaceInString(valueSQL, "[" + entry.getKey() + "]", value1);
}
}
// should be value one.
- //lookup = new IdNameSql(-1,valueSQL,lu.getDefaultSQL());
- }
- }
- //lookupList = lookup;
- //System.out.println("8888888 88 " + valueSQL);
- }
- if(valueSQL!=null && valueSQL.length()>0) {
- DataSet ds = ConnectionUtils.getDataSet(valueSQL.toString(), dbInfo);
- strValue = ds.getString(0,1);
- if(avail_ReadOnly) readOnly = ds.getString(0, 2).toUpperCase().startsWith("Y")||ds.getString(0, 2).toUpperCase().startsWith("T");;
- }
- }catch(Exception e) { //throw new RaptorRuntimeException(e);
- }
- String returnString = "";
- String timestamp ="", timestamphr = "", timestampmin = "", timestampsec = "";
-
- returnString = "<input type=text class=\"text\" size="+(validationType.equals(VT_DATE)?"10":"30") +" maxlength=50 id=\"" + fieldName +"\" name=\""
- + fieldName + "\" id='"+ fieldName + "' "
- + (((validationType.equals(VT_DATE)||validationType.equals(VT_TIMESTAMP_HR) ||validationType.equals(VT_TIMESTAMP_MIN) ||validationType.equals(VT_TIMESTAMP_SEC))&& !inSchedule) ? "" : "")
- + getCallableJavascript(getFieldName(), rr) + " " + (readOnly?" readonly ":" ") + " value=\"";
-
-
- /*if(getFieldDefaultSQL()!=null)
- returnString += nvl(value.getId());
- else
- returnString += fieldValue;
- */
- if(fieldValue!=null && fieldValue.length()>0 && (!(fieldValue.toUpperCase().indexOf("SELECT ")!= -1 && fieldValue.toUpperCase().indexOf("FROM")!= -1)) ) {
- if(validationType.startsWith("TIMESTAMP")) {
- returnString += nvl((fieldValue!=null)?fieldValue.split(" ")[0]:"");
- if(fieldValue!=null && fieldValue.length()>0) {
- timestamp = (fieldValue.split(" ").length > 1)?fieldValue.split(" ")[1]:"";
- String timestampArr[] = timestamp.split(":");
- if((timestampArr.length == 1) || (timestampArr.length == 2) || (timestampArr.length == 3))
- timestamphr = timestampArr[0];
- if((timestampArr.length == 2) || (timestampArr.length == 3))
- timestampmin = timestampArr[1];
- if(timestampArr.length == 3)
- timestampsec = timestampArr[2];
+ // lookup = new IdNameSql(-1,valueSQL,lu.getDefaultSQL());
}
-
- } else returnString += fieldValue;
-
- } else if(getFieldDefaultSQL()!=null) {
-
- if(validationType.startsWith("TIMESTAMP")) {
- returnString += nvl((strValue.length()>0)?strValue.split(" ")[0]:"");
- if(strValue.length()>0) {
- timestamp = (strValue.split(" ").length > 1)?strValue.split(" ")[1]:"";
- String timestampArr[] = timestamp.split(":");
- if((timestampArr.length == 1) || (timestampArr.length == 2) || (timestampArr.length == 3))
- timestamphr = timestampArr[0];
- if((timestampArr.length == 2) || (timestampArr.length == 3))
- timestampmin = timestampArr[1];
- if(timestampArr.length == 3)
+ }
+ // lookupList = lookup;
+ // System.out.println("8888888 88 " + valueSQL);
+ }
+ if (valueSQL != null && valueSQL.length() > 0) {
+ DataSet ds = ConnectionUtils.getDataSet(valueSQL.toString(), dbInfo);
+ strValue = ds.getString(0, 1);
+ if (avail_ReadOnly)
+ readOnly = ds.getString(0, 2).toUpperCase().startsWith("Y")
+ || ds.getString(0, 2).toUpperCase().startsWith("T");
+ ;
+ }
+ } catch (Exception e) { // throw new RaptorRuntimeException(e);
+ }
+ String returnString = "";
+ String timestamp = "", timestamphr = "", timestampmin = "", timestampsec = "";
+
+ returnString = "<input type=text class=\"text\" size=" + (validationType.equals(VT_DATE) ? "10" : "30")
+ + " maxlength=50 id=\"" + fieldName + "\" name=\"" + fieldName + "\" id='" + fieldName + "' "
+ + (((validationType.equals(VT_DATE) || validationType.equals(VT_TIMESTAMP_HR)
+ || validationType.equals(VT_TIMESTAMP_MIN) || validationType.equals(VT_TIMESTAMP_SEC))
+ && !inSchedule) ? "" : "")
+ + getCallableJavascript(getFieldName(), rr) + " " + (readOnly ? " readonly " : " ") + " value=\"";
+
+ /*
+ * if(getFieldDefaultSQL()!=null) returnString += nvl(value.getId()); else
+ * returnString += fieldValue;
+ */
+ if (fieldValue != null && fieldValue.length() > 0 && (!(fieldValue.toUpperCase().indexOf("SELECT ") != -1
+ && fieldValue.toUpperCase().indexOf("FROM") != -1))) {
+ if (validationType.startsWith("TIMESTAMP")) {
+ returnString += nvl((fieldValue != null) ? fieldValue.split(" ")[0] : "");
+ if (fieldValue != null && fieldValue.length() > 0) {
+ timestamp = (fieldValue.split(" ").length > 1) ? fieldValue.split(" ")[1] : "";
+ String timestampArr[] = timestamp.split(":");
+ if ((timestampArr.length == 1) || (timestampArr.length == 2) || (timestampArr.length == 3))
+ timestamphr = timestampArr[0];
+ if ((timestampArr.length == 2) || (timestampArr.length == 3))
+ timestampmin = timestampArr[1];
+ if (timestampArr.length == 3)
timestampsec = timestampArr[2];
- }
-
- } else if (nvl(strValue).length()>0) {
- returnString += strValue;
- } else
- returnString += nvl((value!=null)?value.getId():"");
- } else if (nvl(strValue).length()>0) {
- returnString += strValue;
- } else
- returnString += nvl((value!=null)?value.getId():"");
-
-
- /*returnString += "\">"
- + (validationType.equals(VT_DATE) ? "\n\t\t\t<a href=\"#\" onClick=\"window.dateField=document."
- + HTML_FORM
- + "."
- + fieldName
- + ";calendar=window.open('"
- + AppUtils.getRaptorActionURL()
- + "popup.calendar','cal','WIDTH=200,HEIGHT=250');return false;\">"
- + "\n\t\t\t\t<img src=\""
- + AppUtils.getImgFolderURL()
- + "calender_icon.gif\" align=absmiddle border=0 width=20 height=20></a>"
- : ""); */
-
- SimpleDateFormat dtf = new SimpleDateFormat("MM/dd/yyyy");
- String stRangeText = this.getRangeStartDate() == null ? null : dtf.format(this.getRangeStartDate().getTime());
- String endRangeText = this.getRangeEndDate() == null ? null : dtf.format(this.getRangeEndDate().getTime());
- /////////////////////////
-
- //get the date sqls
-
- //System.out.println("////////////start range date before Start" + this.getRangeStartDateSQL());
-
- if (this.getRangeStartDateSQL() != null && this.getRangeStartDateSQL().trim().toLowerCase().startsWith("select")){
- //System.out.println("////////////start range date Starting");
- String SQL = this.getRangeStartDateSQL();
- if(formValues != null) {
- Set set = formValues.entrySet();
- String v = "";
- for(Iterator iter = set.iterator(); iter.hasNext(); ) {
- Map.Entry entry = (Entry) iter.next();
- v = (String) entry.getValue();
- //System.out.println("///////// key is " + entry.getKey() + " = " + v);
- SQL = Utils.replaceInString(SQL, "["+entry.getKey()+"]", v);
- }
-
- }
- //System.out.println("////////////start range date sql created" + SQL);
- try{
- DataSet ds = ConnectionUtils.getDataSet(SQL.toString(), dbInfo);
- //System.out.println("////////////start range date is : " + ds.get(0));
- dtf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
- Calendar tStart = Calendar.getInstance();
- tStart.setTime(dtf.parse(ds.getString(0,0)));
- dtf = new SimpleDateFormat("MM/dd/yyyy");
- stRangeText = dtf.format(tStart.getTime().getTime()-MILLIS_IN_DAY);
-
- }catch(Exception e){
- System.out.println("Exception////////// : start range date is : " + e);
- }
- }
-
- if (this.getRangeEndDateSQL() != null && this.getRangeEndDateSQL().trim().toLowerCase().startsWith("select")){
- //System.out.println("////////////end range date Starting");
- String SQL = this.getRangeEndDateSQL();
- if(formValues != null) {
- Set set = formValues.entrySet();
- String v = "";
- for(Iterator iter = set.iterator(); iter.hasNext(); ) {
- Map.Entry entry = (Entry) iter.next();
- v = (String) entry.getValue();
- SQL = Utils.replaceInString(SQL, "["+entry.getKey()+"]", v);
- }
-
- }
- try{
- DataSet ds = ConnectionUtils.getDataSet(SQL.toString(), dbInfo);
- //System.out.println("////////////end range date is : " + ds.get(0));
- dtf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
- Calendar tStart = Calendar.getInstance();
- tStart.setTime(dtf.parse(ds.getString(0,0)));
- dtf = new SimpleDateFormat("MM/dd/yyyy");
- //endRangeText = dtf.format(tStart.getTime());
- endRangeText = dtf.format(tStart.getTime().getTime()+MILLIS_IN_DAY);
- }catch(Exception e){
- System.out.println("Exception////////// : end range date is : " + e);
- }
- }
-
-
- //////////////////////
- String calendarOnClickMethodCall = "";
- String timeStampStr = "";
- if (stRangeText == null || endRangeText == null)
- calendarOnClickMethodCall = "'oCalendar.select(document." + HTML_FORM + "." + fieldName + ", event,\""+ Globals.getCalendarOutputDateFormat() +"\"); return false;'";
- else
- calendarOnClickMethodCall = "'oCalendar=new CalendarPopup(\"calendarDiv\", \"calendarFrame\");oCalendar.setCssPrefix(\"raptor\");oCalendar.addDisabledDates(null, \"" + stRangeText + "\"); oCalendar.addDisabledDates(\"" + endRangeText + "\", null); oCalendar.select(document." + HTML_FORM + "." + fieldName + ", event,\""+ Globals.getCalendarOutputDateFormat() +"\"); return false;'";
- returnString += "\" " + getHelpLink(fieldName)
- + (validationType.equals(VT_DATE) || validationType.equals(VT_TIMESTAMP_HR) || validationType.equals(VT_TIMESTAMP_MIN) || validationType.equals(VT_TIMESTAMP_SEC)
- ? "\n\t\t\t<img src='" + AppUtils.getImgFolderURL()+ "calender_icon.gif' align=absmiddle border=0 width='20' height='20' onClick=" + calendarOnClickMethodCall + " style='cursor:hand'>"
- : "");
- if(validationType.equals(VT_TIMESTAMP_HR) || validationType.equals(VT_TIMESTAMP_MIN) || validationType.equals(VT_TIMESTAMP_SEC) ) {
- //Add Hours/Minutes and Seconds.
- timeStampStr = " <font class=rtabletext>Hour&nbsp;</font><select id = \""+ fieldName+ "_Hr\" name=\""+ fieldName+ "_Hr\" "+ (readOnly?"disabled":"")+" >";
- int hour = 0;
- int t_hr = 0;
- try {
- hour = Integer.parseInt(nvl(rr.getParamValue(fieldName+"_Hr"),"0"));
- if(hour == 0) {
- if(inSchedule) hour = Integer.parseInt(nvl(((String)formValues.get(fieldName+"_Hr")),"0"));
- }
-// System.out.println("Hour =" + hour);
- } catch (NumberFormatException ex) { hour = 0; }
- try {
- t_hr = Integer.parseInt(timestamphr);
-// System.out.println("THR =" + t_hr);
- } catch (NumberFormatException ex) { t_hr = 0;}
-
- if(hour <= 0) hour = t_hr;
- // System.out.println("Form Values 887 " + formValues);
- /*if (formValues.containsKey(fieldDisplayName+"_Hr")){
- formValues.remove(fieldDisplayName+"_Hr");
- formValues.put(fieldDisplayName+"_Hr", hour);
+ }
+
} else
- formValues.put(fieldDisplayName+"_Hr", hour);
- System.out.println("Form Values 887 " + formValues);
- */
-
- //int t_min = Integer.parseInt(timestampmin);
- //int t_sec = Integer.parseInt(timestampsec);
- for (int i = 0; i < 24; i++) {
- if(i==0) timeStampStr += "<option value=\"" + i + "\""+ ((hour==i)?" selected":"") +">00</option>";
- else if(i<10) timeStampStr += "<option value=\"" + i + "\""+ ((hour==i)?" selected":"") +">" + "0"+i + "</option>";
- else timeStampStr += "<option value=\"" + i + "\""+ ((hour==i)?" selected":"") +">" + i + "</option>";
-
- }
- timeStampStr += "</select>";
- }
- //Minutes
- if( validationType.equals(VT_TIMESTAMP_MIN) || validationType.equals(VT_TIMESTAMP_SEC) ) {
- int minutes = 0;
- int t_min = 0;
- try {
- minutes = Integer.parseInt(nvl(rr.getParamValue(fieldName+"_Min"),"0"));
- if(minutes == 0) {
- if(inSchedule) minutes = Integer.parseInt(nvl(((String)formValues.get(fieldName+"_Min")),"0"));
- }
- } catch (NumberFormatException ex) {minutes = 0;}
- try {
- t_min = Integer.parseInt(timestampmin);
- } catch (NumberFormatException ex) { t_min = 0;}
-
- if(minutes <= 0) minutes = t_min;
- /*if (formValues.containsKey(fieldDisplayName+"_Min")){
- formValues.remove(fieldDisplayName+"_Min");
- formValues.put(fieldDisplayName+"_Min", minutes);
+ returnString += fieldValue;
+
+ } else if (getFieldDefaultSQL() != null) {
+
+ if (validationType.startsWith("TIMESTAMP")) {
+ returnString += nvl((strValue.length() > 0) ? strValue.split(" ")[0] : "");
+ if (strValue.length() > 0) {
+ timestamp = (strValue.split(" ").length > 1) ? strValue.split(" ")[1] : "";
+ String timestampArr[] = timestamp.split(":");
+ if ((timestampArr.length == 1) || (timestampArr.length == 2) || (timestampArr.length == 3))
+ timestamphr = timestampArr[0];
+ if ((timestampArr.length == 2) || (timestampArr.length == 3))
+ timestampmin = timestampArr[1];
+ if (timestampArr.length == 3)
+ timestampsec = timestampArr[2];
+ }
+
+ } else if (nvl(strValue).length() > 0) {
+ returnString += strValue;
} else
- formValues.put(fieldDisplayName+"_Min", minutes);
- */
- timeStampStr += " <font class=rtabletext>Min&nbsp;</font><select id = \""+ fieldName+ "_Min\" name=\""+ fieldName+ "_Min\" "+ (readOnly?"disabled":"")+" >";
- for (int i = 0; i < 60; i++) {
- if(i==0) timeStampStr += "<option value=\"" + i + "\""+ ((minutes==i)?" selected":"") +">00</option>";
- else if(i<10) timeStampStr += "<option value=\"" + i + "\""+ ((minutes==i)?" selected":"") +">" + "0"+i + "</option>";
- else timeStampStr += "<option value=\"" + i + "\""+ ((minutes==i)?" selected":"") +">" + i + "</option>";
+ returnString += nvl((value != null) ? value.getId() : "");
+ } else if (nvl(strValue).length() > 0) {
+ returnString += strValue;
+ } else
+ returnString += nvl((value != null) ? value.getId() : "");
+
+ /*
+ * returnString += "\">" + (validationType.equals(VT_DATE) ?
+ * "\n\t\t\t<a href=\"#\" onClick=\"window.dateField=document." + HTML_FORM +
+ * "." + fieldName + ";calendar=window.open('" + AppUtils.getRaptorActionURL() +
+ * "popup.calendar','cal','WIDTH=200,HEIGHT=250');return false;\">" +
+ * "\n\t\t\t\t<img src=\"" + AppUtils.getImgFolderURL() +
+ * "calender_icon.gif\" align=absmiddle border=0 width=20 height=20></a>" : "");
+ */
+
+ SimpleDateFormat dtf = new SimpleDateFormat("MM/dd/yyyy");
+ String stRangeText = this.getRangeStartDate() == null ? null
+ : dtf.format(this.getRangeStartDate().getTime());
+ String endRangeText = this.getRangeEndDate() == null ? null : dtf.format(this.getRangeEndDate().getTime());
+ /////////////////////////
+
+ // get the date sqls
+
+ // System.out.println("////////////start range date before Start" +
+ // this.getRangeStartDateSQL());
+
+ if (this.getRangeStartDateSQL() != null
+ && this.getRangeStartDateSQL().trim().toLowerCase().startsWith("select")) {
+ // System.out.println("////////////start range date Starting");
+ String SQL = this.getRangeStartDateSQL();
+ if (formValues != null) {
+ Set set = formValues.entrySet();
+ String v = "";
+ for (Iterator iter = set.iterator(); iter.hasNext();) {
+ Map.Entry entry = (Entry) iter.next();
+ v = (String) entry.getValue();
+ // System.out.println("///////// key is " + entry.getKey() + " = " + v);
+ SQL = Utils.replaceInString(SQL, "[" + entry.getKey() + "]", v);
+ }
+
}
- timeStampStr += "</select>";
- }
- //Seconds
- if( validationType.equals(VT_TIMESTAMP_SEC) ) {
- int seconds = 0;
- int t_sec = 0;
- try {
- seconds = Integer.parseInt(nvl(rr.getParamValue(fieldName+"_Sec"),"0"));
- if(seconds == 0) {
- if(inSchedule) seconds = Integer.parseInt(nvl(((String)formValues.get(fieldName+"_Sec")),"0"));
- }
- } catch (NumberFormatException ex) {seconds = 0;}
- try {
- t_sec = Integer.parseInt(timestampsec);
- } catch (NumberFormatException ex) { t_sec = 0;}
-
- if(seconds <= 0) seconds = t_sec;
- /*if (formValues.containsKey(fieldDisplayName+"_Sec")){
- formValues.remove(fieldDisplayName+"_Sec");
- formValues.put(fieldDisplayName+"_Sec", seconds);
- } else
- formValues.put(fieldDisplayName+"_Sec", seconds);
- */
- timeStampStr += " <font class=rtabletext>Sec&nbsp;</font><select id = \""+ fieldName+ "_Sec\" name=\""+ fieldName+ "_Sec\" "+ (readOnly?"disabled":"")+" >";
- for (int i = 0; i < 60; i++) {
- if(i==0) timeStampStr += "<option value=\"" + i + "\""+ ((seconds==i)?" selected":"") +">00</option>";
- else if(i<10) timeStampStr += "<option value=\"" + i + "\""+ ((seconds==i)?" selected":"") +">" + "0"+i + "</option>";
- else timeStampStr += "<option value=\"" + i + "\""+ ((seconds==i)?" selected":"") +">" + i + "</option>";
+ // System.out.println("////////////start range date sql created" + SQL);
+ try {
+ DataSet ds = ConnectionUtils.getDataSet(SQL.toString(), dbInfo);
+ // System.out.println("////////////start range date is : " + ds.get(0));
+ dtf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+ Calendar tStart = Calendar.getInstance();
+ tStart.setTime(dtf.parse(ds.getString(0, 0)));
+ dtf = new SimpleDateFormat("MM/dd/yyyy");
+ stRangeText = dtf.format(tStart.getTime().getTime() - MILLIS_IN_DAY);
+
+ } catch (Exception e) {
+ System.out.println("Exception////////// : start range date is : " + e);
+ }
+ }
+
+ if (this.getRangeEndDateSQL() != null
+ && this.getRangeEndDateSQL().trim().toLowerCase().startsWith("select")) {
+ // System.out.println("////////////end range date Starting");
+ String SQL = this.getRangeEndDateSQL();
+ if (formValues != null) {
+ Set set = formValues.entrySet();
+ String v = "";
+ for (Iterator iter = set.iterator(); iter.hasNext();) {
+ Map.Entry entry = (Entry) iter.next();
+ v = (String) entry.getValue();
+ SQL = Utils.replaceInString(SQL, "[" + entry.getKey() + "]", v);
+ }
+
+ }
+ try {
+ DataSet ds = ConnectionUtils.getDataSet(SQL.toString(), dbInfo);
+ // System.out.println("////////////end range date is : " + ds.get(0));
+ dtf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+ Calendar tStart = Calendar.getInstance();
+ tStart.setTime(dtf.parse(ds.getString(0, 0)));
+ dtf = new SimpleDateFormat("MM/dd/yyyy");
+ // endRangeText = dtf.format(tStart.getTime());
+ endRangeText = dtf.format(tStart.getTime().getTime() + MILLIS_IN_DAY);
+ } catch (Exception e) {
+ System.out.println("Exception////////// : end range date is : " + e);
+ }
+ }
+
+ //////////////////////
+ String calendarOnClickMethodCall = "";
+ String timeStampStr = "";
+ if (stRangeText == null || endRangeText == null)
+ calendarOnClickMethodCall = "'oCalendar.select(document." + HTML_FORM + "." + fieldName + ", event,\""
+ + Globals.getCalendarOutputDateFormat() + "\"); return false;'";
+ else
+ calendarOnClickMethodCall = "'oCalendar=new CalendarPopup(\"calendarDiv\", \"calendarFrame\");oCalendar.setCssPrefix(\"raptor\");oCalendar.addDisabledDates(null, \""
+ + stRangeText + "\"); oCalendar.addDisabledDates(\"" + endRangeText
+ + "\", null); oCalendar.select(document." + HTML_FORM + "." + fieldName + ", event,\""
+ + Globals.getCalendarOutputDateFormat() + "\"); return false;'";
+ returnString += "\" " + getHelpLink(fieldName)
+ + (validationType.equals(VT_DATE) || validationType.equals(VT_TIMESTAMP_HR) || validationType
+ .equals(VT_TIMESTAMP_MIN) || validationType.equals(VT_TIMESTAMP_SEC) ? "\n\t\t\t<img src='"
+ + AppUtils.getImgFolderURL()
+ + "calender_icon.gif' align=absmiddle border=0 width='20' height='20' onClick="
+ + calendarOnClickMethodCall + " style='cursor:hand'>" : "");
+ if (validationType.equals(VT_TIMESTAMP_HR) || validationType.equals(VT_TIMESTAMP_MIN)
+ || validationType.equals(VT_TIMESTAMP_SEC)) {
+ // Add Hours/Minutes and Seconds.
+ timeStampStr = " <font class=rtabletext>Hour&nbsp;</font><select id = \"" + fieldName + "_Hr\" name=\""
+ + fieldName + "_Hr\" " + (readOnly ? "disabled" : "") + " >";
+ int hour = 0;
+ int t_hr = 0;
+ try {
+ hour = Integer.parseInt(nvl(rr.getParamValue(fieldName + "_Hr"), "0"));
+ if (hour == 0) {
+ if (inSchedule)
+ hour = Integer.parseInt(nvl(((String) formValues.get(fieldName + "_Hr")), "0"));
+ }
+ // System.out.println("Hour =" + hour);
+ } catch (NumberFormatException ex) {
+ hour = 0;
+ }
+ try {
+ t_hr = Integer.parseInt(timestamphr);
+ // System.out.println("THR =" + t_hr);
+ } catch (NumberFormatException ex) {
+ t_hr = 0;
+ }
+
+ if (hour <= 0)
+ hour = t_hr;
+ // System.out.println("Form Values 887 " + formValues);
+ /*
+ * if (formValues.containsKey(fieldDisplayName+"_Hr")){
+ * formValues.remove(fieldDisplayName+"_Hr");
+ * formValues.put(fieldDisplayName+"_Hr", hour); } else
+ * formValues.put(fieldDisplayName+"_Hr", hour);
+ * System.out.println("Form Values 887 " + formValues);
+ */
+
+ // int t_min = Integer.parseInt(timestampmin);
+ // int t_sec = Integer.parseInt(timestampsec);
+ for (int i = 0; i < 24; i++) {
+ if (i == 0)
+ timeStampStr += "<option value=\"" + i + "\"" + ((hour == i) ? " selected" : "")
+ + ">00</option>";
+ else if (i < 10)
+ timeStampStr += "<option value=\"" + i + "\"" + ((hour == i) ? " selected" : "") + ">" + "0" + i
+ + "</option>";
+ else
+ timeStampStr += "<option value=\"" + i + "\"" + ((hour == i) ? " selected" : "") + ">" + i
+ + "</option>";
+
+ }
+ timeStampStr += "</select>";
+ }
+ // Minutes
+ if (validationType.equals(VT_TIMESTAMP_MIN) || validationType.equals(VT_TIMESTAMP_SEC)) {
+ int minutes = 0;
+ int t_min = 0;
+ try {
+ minutes = Integer.parseInt(nvl(rr.getParamValue(fieldName + "_Min"), "0"));
+ if (minutes == 0) {
+ if (inSchedule)
+ minutes = Integer.parseInt(nvl(((String) formValues.get(fieldName + "_Min")), "0"));
+ }
+ } catch (NumberFormatException ex) {
+ minutes = 0;
+ }
+ try {
+ t_min = Integer.parseInt(timestampmin);
+ } catch (NumberFormatException ex) {
+ t_min = 0;
+ }
+
+ if (minutes <= 0)
+ minutes = t_min;
+ /*
+ * if (formValues.containsKey(fieldDisplayName+"_Min")){
+ * formValues.remove(fieldDisplayName+"_Min");
+ * formValues.put(fieldDisplayName+"_Min", minutes); } else
+ * formValues.put(fieldDisplayName+"_Min", minutes);
+ */
+ timeStampStr += " <font class=rtabletext>Min&nbsp;</font><select id = \"" + fieldName + "_Min\" name=\""
+ + fieldName + "_Min\" " + (readOnly ? "disabled" : "") + " >";
+ for (int i = 0; i < 60; i++) {
+ if (i == 0)
+ timeStampStr += "<option value=\"" + i + "\"" + ((minutes == i) ? " selected" : "")
+ + ">00</option>";
+ else if (i < 10)
+ timeStampStr += "<option value=\"" + i + "\"" + ((minutes == i) ? " selected" : "") + ">" + "0"
+ + i + "</option>";
+ else
+ timeStampStr += "<option value=\"" + i + "\"" + ((minutes == i) ? " selected" : "") + ">" + i
+ + "</option>";
+ }
+ timeStampStr += "</select>";
+ }
+ // Seconds
+ if (validationType.equals(VT_TIMESTAMP_SEC)) {
+ int seconds = 0;
+ int t_sec = 0;
+ try {
+ seconds = Integer.parseInt(nvl(rr.getParamValue(fieldName + "_Sec"), "0"));
+ if (seconds == 0) {
+ if (inSchedule)
+ seconds = Integer.parseInt(nvl(((String) formValues.get(fieldName + "_Sec")), "0"));
+ }
+ } catch (NumberFormatException ex) {
+ seconds = 0;
}
- timeStampStr += "</select>";
- }
-
- returnString += timeStampStr;
- String checkboxStr = "";
- if(inSchedule && (validationType.equals(VT_DATE) || validationType.equals(VT_TIMESTAMP_HR) || validationType.equals(VT_TIMESTAMP_MIN) || validationType.equals(VT_TIMESTAMP_SEC)) ) {
- if(!Globals.isScheduleDateParamAutoIncr()) {
- checkboxStr = /*checkboxStr +" "+ */ "<input type=\"checkbox\" name=\""+getFieldName()+"_auto\" value=\"_auto\" checked/>";
- } else {
- checkboxStr = /*checkboxStr +" "+ */"<input type=\"hidden\" name=\""+getFieldName()+"_auto\" value=\"_auto\"/>";
- }
- /*if(validationType.equals(VT_TIMESTAMP_HR) || validationType.equals(VT_TIMESTAMP_MIN) || validationType.equals(VT_TIMESTAMP_SEC)) {
- checkboxStr = checkboxStr +" "+ "<input type=\"hidden\" name=\""+getFieldName()+"_Hr_auto\" value=\"_auto\"/>";
- }
- if(validationType.equals(VT_TIMESTAMP_MIN) || validationType.equals(VT_TIMESTAMP_SEC)) {
- checkboxStr = checkboxStr +" "+ "<input type=\"hidden\" name=\""+getFieldName()+"_Min_auto\" value=\"_auto\"/>";
- }
- if(validationType.equals(VT_TIMESTAMP_SEC)) {
- checkboxStr = checkboxStr +" "+ "<input type=\"hidden\" name=\""+getFieldName()+"_Sec_auto\" value=\"_auto\"/>";
- }*/
- }
- if(isVisible())
- return returnString+checkboxStr;
- else return "";
+ try {
+ t_sec = Integer.parseInt(timestampsec);
+ } catch (NumberFormatException ex) {
+ t_sec = 0;
+ }
+
+ if (seconds <= 0)
+ seconds = t_sec;
+ /*
+ * if (formValues.containsKey(fieldDisplayName+"_Sec")){
+ * formValues.remove(fieldDisplayName+"_Sec");
+ * formValues.put(fieldDisplayName+"_Sec", seconds); } else
+ * formValues.put(fieldDisplayName+"_Sec", seconds);
+ */
+ timeStampStr += " <font class=rtabletext>Sec&nbsp;</font><select id = \"" + fieldName + "_Sec\" name=\""
+ + fieldName + "_Sec\" " + (readOnly ? "disabled" : "") + " >";
+ for (int i = 0; i < 60; i++) {
+ if (i == 0)
+ timeStampStr += "<option value=\"" + i + "\"" + ((seconds == i) ? " selected" : "")
+ + ">00</option>";
+ else if (i < 10)
+ timeStampStr += "<option value=\"" + i + "\"" + ((seconds == i) ? " selected" : "") + ">" + "0"
+ + i + "</option>";
+ else
+ timeStampStr += "<option value=\"" + i + "\"" + ((seconds == i) ? " selected" : "") + ">" + i
+ + "</option>";
+ }
+ timeStampStr += "</select>";
+ }
+
+ returnString += timeStampStr;
+ String checkboxStr = "";
+ if (inSchedule && (validationType.equals(VT_DATE) || validationType.equals(VT_TIMESTAMP_HR)
+ || validationType.equals(VT_TIMESTAMP_MIN) || validationType.equals(VT_TIMESTAMP_SEC))) {
+ if (!Globals.isScheduleDateParamAutoIncr()) {
+ checkboxStr = /* checkboxStr +" "+ */ "<input type=\"checkbox\" name=\"" + getFieldName()
+ + "_auto\" value=\"_auto\" checked/>";
+ } else {
+ checkboxStr = /* checkboxStr +" "+ */"<input type=\"hidden\" name=\"" + getFieldName()
+ + "_auto\" value=\"_auto\"/>";
+ }
+ /*
+ * if(validationType.equals(VT_TIMESTAMP_HR) ||
+ * validationType.equals(VT_TIMESTAMP_MIN) ||
+ * validationType.equals(VT_TIMESTAMP_SEC)) { checkboxStr = checkboxStr +" "+
+ * "<input type=\"hidden\" name=\""+getFieldName()
+ * +"_Hr_auto\" value=\"_auto\"/>"; } if(validationType.equals(VT_TIMESTAMP_MIN)
+ * || validationType.equals(VT_TIMESTAMP_SEC)) { checkboxStr = checkboxStr
+ * +" "+ "<input type=\"hidden\" name=\""+getFieldName()
+ * +"_Min_auto\" value=\"_auto\"/>"; }
+ * if(validationType.equals(VT_TIMESTAMP_SEC)) { checkboxStr = checkboxStr
+ * +" "+ "<input type=\"hidden\" name=\""+getFieldName()
+ * +"_Sec_auto\" value=\"_auto\"/>"; }
+ */
+ }
+ if (isVisible())
+ return returnString + checkboxStr;
+ else
+ return "";
} else if (fieldType.equals(FFT_TEXTAREA)) {
-
- if(nvl(fieldValue).length()>0) {
+
+ if (nvl(fieldValue).length() > 0) {
fieldValue = Pattern.compile("(^[\r\n])|\\([\\']", Pattern.DOTALL).matcher(fieldValue).replaceAll("");
fieldValue = Pattern.compile("[\\']\\)", Pattern.DOTALL).matcher(fieldValue).replaceAll("");
- fieldValue = fieldValue.replaceAll("','",","); // changed from "|"
- fieldValue = fieldValue.replaceAll("' , '","\r\n");
+ fieldValue = fieldValue.replaceAll("','", ","); // changed from "|"
+ fieldValue = fieldValue.replaceAll("' , '", "\r\n");
}
-
- if(isVisible())
- return "<textarea rows=4 cols=30 id=\"" + fieldName +"\" name=\"" + fieldName + "\""+ getCallableJavascript(getFieldName(), rr) + getHelpLink(fieldName) + nvl(fieldValue)
- + "</textarea>";
- else
- return "";
+
+ if (isVisible())
+ return "<textarea rows=4 cols=30 id=\"" + fieldName + "\" name=\"" + fieldName + "\""
+ + getCallableJavascript(getFieldName(), rr) + getHelpLink(fieldName) + nvl(fieldValue)
+ + "</textarea>";
+ else
+ return "";
} else if (fieldType.equals(FFT_COMBO_BOX)) {
StringBuffer sb = new StringBuffer();
- //System.out.println("COMBO BOX " + fieldName);
+ // System.out.println("COMBO BOX " + fieldName);
String oldSQL = "";
IdNameList lookup = getLookupList();
try {
- if(!hasPredefinedList) {
- //if(dependsOn != null && dependsOn != "") {
- //if(dependsOn != null && dependsOn != "" ) {
- IdNameSql lu = (IdNameSql) lookup;
- String SQL = lu.getSql();
- //System.out.println("FORMFIELD 6666667 First" + ((IdNameSql)lookup).getSql());
- oldSQL = lu.getSql();
- if(formValues != null) {
- Set set = formValues.entrySet();
- String value = "";
- for(Iterator iter = set.iterator(); iter.hasNext(); ) {
- Map.Entry entry = (Entry) iter.next();
- value = (String) entry.getValue();
- if (value!=null && (value.length() <=0 || value.equals("NULL"))) {
- value = "NULL";
- SQL = Utils.replaceInString(SQL, "'["+entry.getKey()+"]'", value);
- SQL = Utils.replaceInString(SQL, "["+entry.getKey()+"]", value);
- } else {
- SQL = Utils.replaceInString(SQL, "["+entry.getKey()+"]", value);
- }
+ if (!hasPredefinedList) {
+ // if(dependsOn != null && dependsOn != "") {
+ // if(dependsOn != null && dependsOn != "" ) {
+ IdNameSql lu = (IdNameSql) lookup;
+ String SQL = lu.getSql();
+ // System.out.println("FORMFIELD 6666667 First" + ((IdNameSql)lookup).getSql());
+ oldSQL = lu.getSql();
+ if (formValues != null) {
+ Set set = formValues.entrySet();
+ String value = "";
+ for (Iterator iter = set.iterator(); iter.hasNext();) {
+ Map.Entry entry = (Entry) iter.next();
+ value = (String) entry.getValue();
+ if (value != null && (value.length() <= 0 || value.equals("NULL"))) {
+ value = "NULL";
+ SQL = Utils.replaceInString(SQL, "'[" + entry.getKey() + "]'", value);
+ SQL = Utils.replaceInString(SQL, "[" + entry.getKey() + "]", value);
+ } else {
+ SQL = Utils.replaceInString(SQL, "[" + entry.getKey() + "]", value);
}
- lookup = new IdNameSql(-1,SQL,lu.getDefaultSQL());
}
- //}
+ lookup = new IdNameSql(-1, SQL, lu.getDefaultSQL());
+ }
+ // }
lookupList = lookup;
-
-
- //}
- try {
- lookup.loadUserData(0, "", getDbInfo(), getUserId());
- } catch (Exception e ){ e.printStackTrace(); //throw new RaptorRuntimeException(e);
- }
+
+ // }
+ try {
+ lookup.loadUserData(0, "", getDbInfo(), getUserId());
+ } catch (Exception e) {
+ logger.error(EELFLoggerDelegate.errorLogger, "getHtml () failed ", e);
+
+ }
}
lookup.trimToSize();
-
+
for (lookup.resetNext(); lookup.hasNext();) {
IdNameValue value = lookup.getNext();
readOnly = value.isReadOnly();
break;
}
-
+
String selectedValue = "";
int count = 0;
- sb.append("<div id=\""+fieldName+"_content\" style=\"display:none;width:100%;height:100%;align:center;\"> <img src=\""+AppUtils.getImgFolderURL()+"progress.gif\" border=\"0\" alt=\"Loading, please wait...\" /></div>");
- sb.append("<select id=\"" + fieldName +"\" name=\"");
+ sb.append("<div id=\"" + fieldName
+ + "_content\" style=\"display:none;width:100%;height:100%;align:center;\"> <img src=\""
+ + AppUtils.getImgFolderURL()
+ + "progress.gif\" border=\"0\" alt=\"Loading, please wait...\" /></div>");
+ sb.append("<select id=\"" + fieldName + "\" name=\"");
sb.append(fieldName);
- sb.append("\" "+ (readOnly?"disabled":"")+" size=1 " + getCallableJavascript(getFieldName(), rr) + getHelpLink(fieldName));
+ sb.append("\" " + (readOnly ? "disabled" : "") + " size=1 " + getCallableJavascript(getFieldName(), rr)
+ + getHelpLink(fieldName));
if (!required)
sb.append("<option value=\"\">-->select value<--");
-
+
for (lookup.resetNext(); lookup.hasNext();) {
IdNameValue value = lookup.getNext();
- if(value != null && value.getId() != null && value.getName() != null ) {
- /*if (count == 0 && required) {
- selectedValue = value.getId();
- count++;
- } else if (nvl(fieldValue).length()>0){
- if (fieldValue != null && fieldValue.equals(value.getId())){
- selectedValue = value.getId();
- }
- count++;
- } else {
- count++;
- } */
+ if (value != null && value.getId() != null && value.getName() != null) {
+ /*
+ * if (count == 0 && required) { selectedValue = value.getId(); count++; } else
+ * if (nvl(fieldValue).length()>0){ if (fieldValue != null &&
+ * fieldValue.equals(value.getId())){ selectedValue = value.getId(); } count++;
+ * } else { count++; }
+ */
if (count == 0) {
- if(required){
- selectedValue = value.getId();
+ if (required) {
+ selectedValue = value.getId();
}
count++;
}
sb.append("<option value=\"");
sb.append(value.getId());
-
- if (nvl(fieldValue).length()>0) {
+
+ if (nvl(fieldValue).length() > 0) {
if (fieldValue.equals(value.getId())) { // || (value.isDefaultValue()))
sb.append("\" selected>");
selectedValue = value.getId();
- }
- else
+ } else
sb.append("\">");
} else {
- if(value!=null && value.isDefaultValue()) {
+ if (value != null && value.isDefaultValue()) {
sb.append("\" selected>");
selectedValue = value.getId();
} else {
sb.append("\">");
}
}
-
+
sb.append(value.getName());
sb.append("</option>\n");
}
} // for
- if (formValues.containsKey(fieldDisplayName)){
+ if (formValues.containsKey(fieldDisplayName)) {
formValues.remove(fieldDisplayName);
}
- formValues.put(fieldDisplayName, selectedValue);
+ formValues.put(fieldDisplayName, selectedValue);
} catch (Exception e) {
- //throw new RaptorRuntimeException(e);
+ // throw new RaptorRuntimeException(e);
}
- if(!hasPredefinedList) {
- if(oldSQL != null && !oldSQL.equals("")) {
- ((IdNameSql)lookup).setSQL(oldSQL);
- }
+ if (!hasPredefinedList) {
+ if (oldSQL != null && !oldSQL.equals("")) {
+ ((IdNameSql) lookup).setSQL(oldSQL);
+ }
}
- //System.out.println("FORMFIELD 6666667 " + ((IdNameSql)lookup).getSql());
- if(sb.length()<=0) {
- sb.append("<div id=\""+fieldName+"_content\" style=\"display:none;width:100%;height:100%;align:center;\"> <img src=\""+AppUtils.getImgFolderURL()+"progress.gif\" border=\"0\" alt=\"Loading, please wait...\" /></div>");
- sb.append("<select id=\"" + fieldName +"\" name=\"");
+ // System.out.println("FORMFIELD 6666667 " + ((IdNameSql)lookup).getSql());
+ if (sb.length() <= 0) {
+ sb.append("<div id=\"" + fieldName
+ + "_content\" style=\"display:none;width:100%;height:100%;align:center;\"> <img src=\""
+ + AppUtils.getImgFolderURL()
+ + "progress.gif\" border=\"0\" alt=\"Loading, please wait...\" /></div>");
+ sb.append("<select id=\"" + fieldName + "\" name=\"");
sb.append(fieldName);
- sb.append("\" "+ (readOnly?"disabled":"")+" size=1 " + getCallableJavascript(getFieldName(), rr) + getHelpLink(fieldName));
+ sb.append("\" " + (readOnly ? "disabled" : "") + " size=1 " + getCallableJavascript(getFieldName(), rr)
+ + getHelpLink(fieldName));
}
-
- sb.append("</select>");
- if( isVisible())
- return sb.toString();
- else return "";
+
+ sb.append("</select>");
+ if (isVisible())
+ return sb.toString();
+ else
+ return "";
} else if (fieldType.equals(FFT_LIST_BOX)) {
StringBuffer sb = new StringBuffer();
String oldSQL = "";
- IdNameList lookup = null;
+ IdNameList lookup = null;
lookup = getLookupList();
String selectedValue = "";
try {
- if(!hasPredefinedList) {
- //if(dependsOn != null && dependsOn != "") {
- //if(dependsOn != null && dependsOn != "" ) {
- IdNameSql lu = (IdNameSql) lookup;
- String SQL = lu.getSql();
- oldSQL = lu.getSql();
- if(formValues != null) {
- Set set = formValues.entrySet();
- String value = "";
- for(Iterator iter = set.iterator(); iter.hasNext(); ) {
- Map.Entry entry = (Entry) iter.next();
- value = (String) entry.getValue();
- SQL = Utils.replaceInString(SQL, "["+entry.getKey()+"]", value);
- }
- lookup = new IdNameSql(-1,SQL,lu.getDefaultSQL());
+ if (!hasPredefinedList) {
+ // if(dependsOn != null && dependsOn != "") {
+ // if(dependsOn != null && dependsOn != "" ) {
+ IdNameSql lu = (IdNameSql) lookup;
+ String SQL = lu.getSql();
+ oldSQL = lu.getSql();
+ if (formValues != null) {
+ Set set = formValues.entrySet();
+ String value = "";
+ for (Iterator iter = set.iterator(); iter.hasNext();) {
+ Map.Entry entry = (Entry) iter.next();
+ value = (String) entry.getValue();
+ SQL = Utils.replaceInString(SQL, "[" + entry.getKey() + "]", value);
}
- //}
- lookupList = lookup;
- //}
- try {
- lookup.loadUserData(0, "", getDbInfo(), getUserId());
- } catch (Exception e ){ e.printStackTrace(); //throw new RaptorRuntimeException(e);
- }
+ lookup = new IdNameSql(-1, SQL, lu.getDefaultSQL());
+ }
+ // }
+ lookupList = lookup;
+ // }
+ try {
+ lookup.loadUserData(0, "", getDbInfo(), getUserId());
+ } catch (Exception e) {
+ logger.error(EELFLoggerDelegate.errorLogger, "getHtml () failed", e);
+
+ }
}
lookup.trimToSize();
-
+
for (lookup.resetNext(); lookup.hasNext();) {
IdNameValue value = lookup.getNext();
readOnly = value.isReadOnly();
break;
}
-
+
int iCnt = 0;
- sb.append("<select id=\"" + fieldName +"\" name=\"");
+ sb.append("<select id=\"" + fieldName + "\" name=\"");
sb.append(fieldName);
- sb.append("\" "+ (readOnly?"disabled":"")+" size=4 " + getCallableJavascript(getFieldName(), rr) + getHelpLink(fieldName));
+ sb.append("\" " + (readOnly ? "disabled" : "") + " size=4 " + getCallableJavascript(getFieldName(), rr)
+ + getHelpLink(fieldName));
if (!required)
sb.append("<option value=\"\">-->select value<--");
-
+
for (lookup.resetNext(); lookup.hasNext(); iCnt++) {
IdNameValue value = lookup.getNext();
sb.append("<option value=\"");
- sb.append((value!=null)?value.getId():"");
- if (nvl(fieldValue).length()>0) {
- if (fieldValue.equals((value!=null)?value.getId():"") || (fieldValue.equals("") && required && iCnt == 0)) {
+ sb.append((value != null) ? value.getId() : "");
+ if (nvl(fieldValue).length() > 0) {
+ if (fieldValue.equals((value != null) ? value.getId() : "")
+ || (fieldValue.equals("") && required && iCnt == 0)) {
sb.append("\" selected>");
selectedValue = value.getId();
} else {
sb.append("\">");
}
} else {
- if(value!=null && value.isDefaultValue()) {
+ if (value != null && value.isDefaultValue()) {
sb.append("\" selected>");
selectedValue = value.getId();
} else {
sb.append("\">");
}
}
- if (formValues.containsKey(fieldDisplayName)){
+ if (formValues.containsKey(fieldDisplayName)) {
formValues.remove(fieldDisplayName);
}
- formValues.put(fieldDisplayName, selectedValue);
-
- sb.append((value!=null)?value.getName():"");
+ formValues.put(fieldDisplayName, selectedValue);
+
+ sb.append((value != null) ? value.getName() : "");
sb.append("</option>\n");
} // for
// lookup.clearData();
} catch (Exception e) {
- //throw new RaptorRuntimeException(e);
+ // throw new RaptorRuntimeException(e);
}
- if(sb.length()<=0) {
- sb.append("<select id=\"" + fieldName +"\" name=\"");
+ if (sb.length() <= 0) {
+ sb.append("<select id=\"" + fieldName + "\" name=\"");
sb.append(fieldName);
- sb.append("\" "+ (readOnly?"disabled":"")+" size=4 " + getCallableJavascript(getFieldName(), rr) + getHelpLink(fieldName));
+ sb.append("\" " + (readOnly ? "disabled" : "") + " size=4 " + getCallableJavascript(getFieldName(), rr)
+ + getHelpLink(fieldName));
}
-
+
sb.append("</select>");
-
- if(!hasPredefinedList) {
- if(oldSQL != null && !oldSQL.equals("")) {
- ((IdNameSql)lookup).setSQL(oldSQL);
- }
+
+ if (!hasPredefinedList) {
+ if (oldSQL != null && !oldSQL.equals("")) {
+ ((IdNameSql) lookup).setSQL(oldSQL);
+ }
}
-
- if(isVisible())
- return sb.toString();
- else
- return "";
+
+ if (isVisible())
+ return sb.toString();
+ else
+ return "";
} else if (fieldType.equals(FFT_HIDDEN)) {
StringBuffer sb = new StringBuffer();
String oldSQL = "";
- String progress = "<div id=\""+fieldName+"_content\" style=\"display:none;width:100%;height:100%;align:center;\"> <img src=\""+AppUtils.getImgFolderURL()+"progress.gif\" border=\"0\" alt=\"Loading, please wait...\" /></div> ";
- sb.append(progress);
- sb.append("<input id=\"" + fieldName +"\" name=\"");
+ String progress = "<div id=\"" + fieldName
+ + "_content\" style=\"display:none;width:100%;height:100%;align:center;\"> <img src=\""
+ + AppUtils.getImgFolderURL()
+ + "progress.gif\" border=\"0\" alt=\"Loading, please wait...\" /></div> ";
+ sb.append(progress);
+ sb.append("<input id=\"" + fieldName + "\" name=\"");
sb.append(fieldName);
sb.append("\" type=\"hidden\"");
IdNameList lookup = null;
-
+
try {
lookup = getLookupList();
- if(lookup != null) {
- //if(dependsOn != null && dependsOn != "") {
- //if(dependsOn != null && dependsOn != "" ) {
- IdNameSql lu = (IdNameSql) lookup;
- String SQL = lu.getSql();
- //System.out.println("SQL HIDDEN 1 " + SQL);
- oldSQL = lu.getSql();
- if(formValues != null) {
- Set set = formValues.entrySet();
- String value = "";
- for(Iterator iter = set.iterator(); iter.hasNext(); ) {
- Map.Entry entry = (Entry) iter.next();
- value = (String) entry.getValue();
- //System.out.println("HIDDEN " + "["+entry.getKey()+"]" + "-" + value);
- SQL = Utils.replaceInString(SQL, "["+entry.getKey()+"]", value);
- }
-
- lookup = new IdNameSql(-1,SQL,lu.getDefaultSQL());
- }
- //System.out.println("SQL HIDDEN 2 " + SQL);
- //}
- lookupList = lookup;
- //}
- if(nvl(fieldValue).length()>0 && (dependsOn == null || dependsOn.length()<=0)) {
+ if (lookup != null) {
+ // if(dependsOn != null && dependsOn != "") {
+ // if(dependsOn != null && dependsOn != "" ) {
+ IdNameSql lu = (IdNameSql) lookup;
+ String SQL = lu.getSql();
+ // System.out.println("SQL HIDDEN 1 " + SQL);
+ oldSQL = lu.getSql();
+ if (formValues != null) {
+ Set set = formValues.entrySet();
+ String value = "";
+ for (Iterator iter = set.iterator(); iter.hasNext();) {
+ Map.Entry entry = (Entry) iter.next();
+ value = (String) entry.getValue();
+ // System.out.println("HIDDEN " + "["+entry.getKey()+"]" + "-" + value);
+ SQL = Utils.replaceInString(SQL, "[" + entry.getKey() + "]", value);
+ }
+
+ lookup = new IdNameSql(-1, SQL, lu.getDefaultSQL());
+ }
+ // System.out.println("SQL HIDDEN 2 " + SQL);
+ // }
+ lookupList = lookup;
+ // }
+ if (nvl(fieldValue).length() > 0 && (dependsOn == null || dependsOn.length() <= 0)) {
sb.append(" value=\"");
- sb.append((fieldValue!=null)?fieldValue:"");
+ sb.append((fieldValue != null) ? fieldValue : "");
sb.append("\">");
- } else if (lookup != null) {
+ } else if (lookup != null) {
lookup.loadUserData(0, "", getDbInfo(), getUserId());
int iCnt = 0;
for (lookup.resetNext(); lookup.hasNext(); iCnt++) {
IdNameValue value = lookup.getNext();
- //System.out.println("HIDDEN " + value.getId() + " " + value.getName());
+ // System.out.println("HIDDEN " + value.getId() + " " + value.getName());
sb.append(" value=\"");
- sb.append((value!=null)?value.getId():"");
+ sb.append((value != null) ? value.getId() : "");
sb.append("\">");
- break;
+ break;
} // for
- if(lookup.size()<=0) {
+ if (lookup.size() <= 0) {
sb.append(" value=\"");
sb.append("\">");
-
+
}
} else {
sb.append(" value=\"");
- sb.append((fieldValue!=null)?fieldValue:"");
+ sb.append((fieldValue != null) ? fieldValue : "");
sb.append("\"/>");
}
} else {
sb.append(" value=\"");
- sb.append((fieldValue!=null)?fieldValue:"");
+ sb.append((fieldValue != null) ? fieldValue : "");
sb.append("\"/>");
}
- if(oldSQL != null && !oldSQL.equals("")) {
- ((IdNameSql)lookup).setSQL(oldSQL);
- }
+ if (oldSQL != null && !oldSQL.equals("")) {
+ ((IdNameSql) lookup).setSQL(oldSQL);
+ }
// lookup.clearData();
} catch (Exception e) {
sb.append(" value=\"\"/>");
- //throw new RaptorRuntimeException(e);
+ // throw new RaptorRuntimeException(e);
+ }
+
+ if (!hasPredefinedList) {
+ if (oldSQL != null && !oldSQL.equals("")) {
+ ((IdNameSql) lookup).setSQL(oldSQL);
+ }
}
-
- if(!hasPredefinedList) {
- if(oldSQL != null && !oldSQL.equals("")) {
- ((IdNameSql)lookup).setSQL(oldSQL);
- }
- }
- //if(isVisible())
- return sb.toString() ;
- } else if (fieldType.equals(FFT_RADIO_BTN)) {
+ // if(isVisible())
+ return sb.toString();
+ } else if (fieldType.equals(FFT_RADIO_BTN)) {
StringBuffer sb = new StringBuffer();
if (!required) {
- sb.append("<input id=\"" + fieldName +"\" type=radio name=\"");
+ sb.append("<input id=\"" + fieldName + "\" type=radio name=\"");
sb.append(fieldName);
sb.append("\" value=\"\"");
if (fieldValue.length() == 0)
sb.append(" checked");
- //sb.append( getCallableJavascript(getFieldName(), rr) );
- sb.append(getHelpLink(fieldName)+ " Any<br>\n");
+ // sb.append( getCallableJavascript(getFieldName(), rr) );
+ sb.append(getHelpLink(fieldName) + " Any<br>\n");
}
try {
IdNameList lookup = getLookupList();
- lookup.loadUserData(0, "", getDbInfo(),getUserId());
+ lookup.loadUserData(0, "", getDbInfo(), getUserId());
String selectedValue = "";
int iCnt = 0;
for (lookup.resetNext(); lookup.hasNext(); iCnt++) {
IdNameValue value = lookup.getNext();
- sb.append("<input id=\"" + fieldName +"\" type=radio name=\"");
+ sb.append("<input id=\"" + fieldName + "\" type=radio name=\"");
sb.append(fieldName);
sb.append("\" value=\"");
- sb.append((value!=null)?value.getId():"");
- if (nvl(fieldValue).length()>0) {
- if (fieldValue.equals((value!=null)?value.getId():"") || (fieldValue.equals("") && required && iCnt == 0)) {
+ sb.append((value != null) ? value.getId() : "");
+ if (nvl(fieldValue).length() > 0) {
+ if (fieldValue.equals((value != null) ? value.getId() : "")
+ || (fieldValue.equals("") && required && iCnt == 0)) {
sb.append("\" checked>");
selectedValue = value.getId();
} else {
sb.append("\">");
}
} else {
- if(value!=null && value.isDefaultValue()) {
+ if (value != null && value.isDefaultValue()) {
sb.append("\" checked>");
selectedValue = value.getId();
} else {
sb.append("\">");
}
}
- sb.append((value!=null)?value.getName():"");
+ sb.append((value != null) ? value.getName() : "");
sb.append("<br>\n");
} // for
- if (formValues.containsKey(fieldDisplayName)){
+ if (formValues.containsKey(fieldDisplayName)) {
formValues.remove(fieldDisplayName);
}
- formValues.put(fieldDisplayName, selectedValue);
+ formValues.put(fieldDisplayName, selectedValue);
// lookup.clearData();
} catch (Exception e) {
- throw new RaptorRuntimeException(e);
+ throw new RaptorRuntimeException(e);
}
- if(isVisible())
- return sb.toString() ;
- else
- return "";
+ if (isVisible())
+ return sb.toString();
+ else
+ return "";
} else if (fieldType.equals(FFT_CHECK_BOX)) {
StringBuffer sb = new StringBuffer();
fieldValue = '|' + fieldValue + '|';
- int count = 0 ;
+ int count = 0;
try {
String selectedValue = "";
IdNameList lookup = getLookupList();
- if(lookup != null) {
+ if (lookup != null) {
lookup.loadUserData(0, "", getDbInfo(), getUserId());
-
+
for (lookup.resetNext(); lookup.hasNext();) {
count++;
IdNameValue value = lookup.getNext();
- sb.append("<input id=\"" + fieldName +"\" type=checkbox name=\"");
+ sb.append("<input id=\"" + fieldName + "\" type=checkbox name=\"");
sb.append(fieldName);
sb.append("\" value=\"");
- sb.append((value!=null)?value.getId():"");
-
- if (!fieldValue.equals("||")) {
- if (fieldValue.indexOf('|' + ((value!=null)?value.getId():"") + '|') >= 0) { // || (value.isDefaultValue()))
+ sb.append((value != null) ? value.getId() : "");
+
+ if (!fieldValue.equals("||")) {
+ if (fieldValue.indexOf('|' + ((value != null) ? value.getId() : "") + '|') >= 0) { // ||
+ // (value.isDefaultValue()))
sb.append("\" checked " + getHelpLink(fieldName));
selectedValue = value.getId();
- }
- else
+ } else
sb.append("\"" + getHelpLink(fieldName));
} else {
- if(value!=null && value.isDefaultValue()) {
+ if (value != null && value.isDefaultValue()) {
sb.append("\" checked " + getHelpLink(fieldName));
selectedValue = value.getId();
} else {
sb.append("\"" + getHelpLink(fieldName));
}
}
-
- if(!(/*(value.getName().equals("Y")||value.getName().equals("N")) && */(!lookup.hasNext()) && count == 1))
- sb.append((value!=null)?value.getName():"");
+
+ if (!(/* (value.getName().equals("Y")||value.getName().equals("N")) && */(!lookup.hasNext())
+ && count == 1))
+ sb.append((value != null) ? value.getName() : "");
sb.append("<br>\n");
} // for
-
- if (formValues.containsKey(fieldDisplayName)){
+
+ if (formValues.containsKey(fieldDisplayName)) {
formValues.remove(fieldDisplayName);
}
- formValues.put(fieldDisplayName, selectedValue);
+ formValues.put(fieldDisplayName, selectedValue);
}
// lookup.clearData();
} catch (Exception e) {
- throw new RaptorRuntimeException(e);
+ throw new RaptorRuntimeException(e);
}
- if(isVisible())
- return sb.toString();
- else
- return "";
+ if (isVisible())
+ return sb.toString();
+ else
+ return "";
} else if (fieldType.equals(FFT_LIST_MULTI)) {
StringBuffer sb = new StringBuffer();
String oldSQL = "";
@@ -1819,27 +1938,27 @@ public class FormField extends org.onap.portalsdk.analytics.RaptorObject impleme
fieldValue = '|' + fieldValue + '|';
IdNameList lookup = getLookupList();
try {
- if(!hasPredefinedList) {
- //if(dependsOn != null && dependsOn != "") {
- //if(dependsOn != null && dependsOn != "" ) {
- IdNameSql lu = (IdNameSql) lookup;
- String SQL = lu.getSql();
- oldSQL = lu.getSql();
- if(formValues != null) {
- Set set = formValues.entrySet();
- String value = "";
- for(Iterator iter = set.iterator(); iter.hasNext(); ) {
- Map.Entry entry = (Entry) iter.next();
- value = (String) entry.getValue();
- SQL = Utils.replaceInString(SQL, "["+entry.getKey()+"]", value);
- }
- lookup = new IdNameSql(-1,SQL,lu.getDefaultSQL());
- }
- //}
- lookupList = lookup;
- //}
-
- lookup.loadUserData(0, "", getDbInfo(),getUserId());
+ if (!hasPredefinedList) {
+ // if(dependsOn != null && dependsOn != "") {
+ // if(dependsOn != null && dependsOn != "" ) {
+ IdNameSql lu = (IdNameSql) lookup;
+ String SQL = lu.getSql();
+ oldSQL = lu.getSql();
+ if (formValues != null) {
+ Set set = formValues.entrySet();
+ String value = "";
+ for (Iterator iter = set.iterator(); iter.hasNext();) {
+ Map.Entry entry = (Entry) iter.next();
+ value = (String) entry.getValue();
+ SQL = Utils.replaceInString(SQL, "[" + entry.getKey() + "]", value);
+ }
+ lookup = new IdNameSql(-1, SQL, lu.getDefaultSQL());
+ }
+ // }
+ lookupList = lookup;
+ // }
+
+ lookup.loadUserData(0, "", getDbInfo(), getUserId());
}
for (lookup.resetNext(); lookup.hasNext();) {
IdNameValue value = lookup.getNext();
@@ -1847,64 +1966,73 @@ public class FormField extends org.onap.portalsdk.analytics.RaptorObject impleme
break;
}
- sb.append("<div id=\""+fieldName+"_content\" style=\"display:none;width:100%;height:100%;align:center;\"> <img src=\""+AppUtils.getImgFolderURL()+"progress.gif\" border=\"0\" alt=\"Loading, please wait...\" /></div>");
- sb.append("<select id=\"" + fieldName +"\" name=\"");
+ sb.append("<div id=\"" + fieldName
+ + "_content\" style=\"display:none;width:100%;height:100%;align:center;\"> <img src=\""
+ + AppUtils.getImgFolderURL()
+ + "progress.gif\" border=\"0\" alt=\"Loading, please wait...\" /></div>");
+ sb.append("<select id=\"" + fieldName + "\" name=\"");
sb.append(fieldName);
- sb.append("\" "+ (readOnly?"disabled":"")+" size=\""+ multiSelectListSize +"\" multiple " + getCallableJavascript(getFieldName(), rr) + getHelpLink(fieldName));
-
+ sb.append("\" " + (readOnly ? "disabled" : "") + " size=\"" + multiSelectListSize + "\" multiple "
+ + getCallableJavascript(getFieldName(), rr) + getHelpLink(fieldName));
+
for (lookup.resetNext(); lookup.hasNext();) {
IdNameValue value = lookup.getNext();
sb.append("<option value=\"");
- sb.append((value!=null)?value.getId():"");
- if (!fieldValue.equals("||")) {
- if (fieldValue.indexOf('|' + ((value!=null)?value.getId():"") + '|') >= 0) // || (value.isDefaultValue()))
+ sb.append((value != null) ? value.getId() : "");
+ if (!fieldValue.equals("||")) {
+ if (fieldValue.indexOf('|' + ((value != null) ? value.getId() : "") + '|') >= 0) // ||
+ // (value.isDefaultValue()))
sb.append("\" selected>");
else
sb.append("\">");
} else {
- if(value!=null && value.isDefaultValue()) {
+ if (value != null && value.isDefaultValue()) {
sb.append("\" selected>");
} else {
sb.append("\">");
}
}
- sb.append((value!=null)?value.getName():"");
+ sb.append((value != null) ? value.getName() : "");
sb.append("</option>\n");
} // for
// lookup.clearData();
} catch (Exception e) {
- //throw new RaptorRuntimeException(e);
+ // throw new RaptorRuntimeException(e);
}
- if(!hasPredefinedList) {
- if(oldSQL != null && !oldSQL.equals("")) {
- ((IdNameSql)lookup).setSQL(oldSQL);
- }
+ if (!hasPredefinedList) {
+ if (oldSQL != null && !oldSQL.equals("")) {
+ ((IdNameSql) lookup).setSQL(oldSQL);
+ }
}
- if(sb.length()<=0) {
- sb.append("<div id=\""+fieldName+"_content\" style=\"display:none;width:100%;height:100%;align:center;\"> <img src=\""+AppUtils.getImgFolderURL()+"progress.gif\" border=\"0\" alt=\"Loading, please wait...\" /></div>");
- sb.append("<select id=\"" + fieldName +"\" name=\"");
+ if (sb.length() <= 0) {
+ sb.append("<div id=\"" + fieldName
+ + "_content\" style=\"display:none;width:100%;height:100%;align:center;\"> <img src=\""
+ + AppUtils.getImgFolderURL()
+ + "progress.gif\" border=\"0\" alt=\"Loading, please wait...\" /></div>");
+ sb.append("<select id=\"" + fieldName + "\" name=\"");
sb.append(fieldName);
- sb.append("\" "+ (readOnly?"disabled":"")+" size=\""+ multiSelectListSize +"\" multiple " + getCallableJavascript(getFieldName(), rr) + getHelpLink(fieldName));
+ sb.append("\" " + (readOnly ? "disabled" : "") + " size=\"" + multiSelectListSize + "\" multiple "
+ + getCallableJavascript(getFieldName(), rr) + getHelpLink(fieldName));
}
sb.append("</select>");
- if(isVisible())
- return sb.toString();
- else
- return "";
+ if (isVisible())
+ return sb.toString();
+ else
+ return "";
} else if (fieldType.equals(FFT_BLANK)) {
StringBuffer sb = new StringBuffer();
sb.append("&nbsp;");
return sb.toString();
} else
- throw new org.onap.portalsdk.analytics.error.RaptorRuntimeException("FormField.getHtml: Unsupported form field type");
+ throw new org.onap.portalsdk.analytics.error.RaptorRuntimeException(
+ "FormField.getHtml: Unsupported form field type");
} // getHtml
public String getValidateJavaScript() {
StringBuffer javaScript = new StringBuffer();
- if (fieldType.equals(FFT_TEXT_W_POPUP) || fieldType.equals(FFT_TEXT)
- || fieldType.equals(FFT_TEXTAREA)) {
+ if (fieldType.equals(FFT_TEXT_W_POPUP) || fieldType.equals(FFT_TEXT) || fieldType.equals(FFT_TEXTAREA)) {
if (required) {
javaScript.append("\n\tif(document.");
javaScript.append(HTML_FORM);
@@ -1925,7 +2053,8 @@ public class FormField extends org.onap.portalsdk.analytics.RaptorObject impleme
if (!validationType.equals(VT_NONE)) {
javaScript.append("\n\tif(! ");
- if (validationType.equals(VT_DATE)||validationType.equals(VT_TIMESTAMP_HR)||validationType.equals(VT_TIMESTAMP_MIN)||validationType.equals(VT_TIMESTAMP_SEC))
+ if (validationType.equals(VT_DATE) || validationType.equals(VT_TIMESTAMP_HR)
+ || validationType.equals(VT_TIMESTAMP_MIN) || validationType.equals(VT_TIMESTAMP_SEC))
javaScript.append("checkDate(");
else if (validationType.equals(VT_INT))
javaScript.append("checkInteger(");
@@ -1944,13 +2073,15 @@ public class FormField extends org.onap.portalsdk.analytics.RaptorObject impleme
javaScript.append(".");
javaScript.append(fieldName);
javaScript.append(".value");
- if (validationType.equals(VT_DATE)||validationType.equals(VT_TIMESTAMP_HR)||validationType.equals(VT_TIMESTAMP_MIN)||validationType.equals(VT_TIMESTAMP_SEC))
+ if (validationType.equals(VT_DATE) || validationType.equals(VT_TIMESTAMP_HR)
+ || validationType.equals(VT_TIMESTAMP_MIN) || validationType.equals(VT_TIMESTAMP_SEC))
javaScript.append(", true");
javaScript.append(")) {\n\t\talert(\"");
javaScript.append(fieldDisplayName);
javaScript.append(" is not a valid ");
- if (validationType.equals(VT_DATE)||validationType.equals(VT_TIMESTAMP_HR)||validationType.equals(VT_TIMESTAMP_MIN)||validationType.equals(VT_TIMESTAMP_SEC))
- javaScript.append("date formatted "+ Globals.getCalendarOutputDateFormat());
+ if (validationType.equals(VT_DATE) || validationType.equals(VT_TIMESTAMP_HR)
+ || validationType.equals(VT_TIMESTAMP_MIN) || validationType.equals(VT_TIMESTAMP_SEC))
+ javaScript.append("date formatted " + Globals.getCalendarOutputDateFormat());
else if (validationType.equals(VT_INT))
javaScript.append("integer");
else if (validationType.equals(VT_INT_POSITIVE))
@@ -2022,38 +2153,34 @@ public class FormField extends org.onap.portalsdk.analytics.RaptorObject impleme
public String getDbInfo() {
return dbInfo;
}
-
- public void setUserId(String userId) {
- this.userId = userId;
- }
-
- public String getUserId() {
- return userId;
- }
-
-
- public String getFieldDefaultSQL() {
-
- return fieldDefaultSQL;
- }
-
-
- public void setFieldDefaultSQL(String fieldDefaultSQL) {
-
- this.fieldDefaultSQL = fieldDefaultSQL;
- }
-
-
- public boolean isVisible() {
-
- return visible;
- }
-
-
- public void setVisible(boolean visible) {
-
- this.visible = visible;
- }
+
+ public void setUserId(String userId) {
+ this.userId = userId;
+ }
+
+ public String getUserId() {
+ return userId;
+ }
+
+ public String getFieldDefaultSQL() {
+
+ return fieldDefaultSQL;
+ }
+
+ public void setFieldDefaultSQL(String fieldDefaultSQL) {
+
+ this.fieldDefaultSQL = fieldDefaultSQL;
+ }
+
+ public boolean isVisible() {
+
+ return visible;
+ }
+
+ public void setVisible(boolean visible) {
+
+ this.visible = visible;
+ }
public String getDependsOn() {
return dependsOn;
@@ -2064,7 +2191,7 @@ public class FormField extends org.onap.portalsdk.analytics.RaptorObject impleme
}
public Calendar getRangeEndDate() {
- if(rangeEndDate != null)
+ if (rangeEndDate != null)
rangeEndDate.add(Calendar.DATE, 1);
return rangeEndDate;
}
@@ -2074,8 +2201,8 @@ public class FormField extends org.onap.portalsdk.analytics.RaptorObject impleme
}
public Calendar getRangeStartDate() {
- if(rangeStartDate != null)
- rangeStartDate.add(Calendar.DATE, -1);
+ if (rangeStartDate != null)
+ rangeStartDate.add(Calendar.DATE, -1);
return rangeStartDate;
}
@@ -2094,7 +2221,7 @@ public class FormField extends org.onap.portalsdk.analytics.RaptorObject impleme
public void setMultiSelectListSize(String multiSelectListSize) {
this.multiSelectListSize = multiSelectListSize;
}
-
+
public String getRangeStartDateSQL() {
return rangeStartDateSQL;
}
@@ -2126,6 +2253,5 @@ public class FormField extends org.onap.portalsdk.analytics.RaptorObject impleme
public void setTriggerThisFormfield(boolean triggerThisFormfield) {
this.triggerThisFormfield = triggerThisFormfield;
}
-
-
+
} // FormField
diff --git a/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/model/runtime/ReportRuntime.java b/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/model/runtime/ReportRuntime.java
index 03c8214d..171dc7c8 100644
--- a/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/model/runtime/ReportRuntime.java
+++ b/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/model/runtime/ReportRuntime.java
@@ -500,7 +500,7 @@ public class ReportRuntime extends ReportWrapper implements Cloneable, Serializa
for (int i = 0; i < scheduleSessionParam.length; i++) {
//debugLogger.debug(" scheduleSessionParam[i] " + scheduleSessionParam[i] + " " + request.getParameter(scheduleSessionParam[i]) );
if(request.getParameter(scheduleSessionParam[i])!=null)
- paramList.add(new IdNameValue(scheduleSessionParam[i].toUpperCase(), request.getParameter(scheduleSessionParam[i])));
+ paramList.add(new IdNameValue(ESAPI.encoder().canonicalize(scheduleSessionParam[i].toUpperCase()), ESAPI.encoder().canonicalize(request.getParameter(scheduleSessionParam[i]))));
}
}
@@ -531,7 +531,7 @@ public class ReportRuntime extends ReportWrapper implements Cloneable, Serializa
String scheduleSessionDispParam = scheduleSessionParam[i];
if(nvl(scheduleSessionDispParam).length()>0) {
String scheduleSessionDispParamArr[] = scheduleSessionDispParam.split(";");
- paramList.add(new IdNameValue(scheduleSessionDispParamArr[1], nvl(request.getParameter(scheduleSessionDispParamArr[0]),"")));
+ paramList.add(new IdNameValue(ESAPI.encoder().canonicalize(scheduleSessionDispParamArr[1]), ESAPI.encoder().canonicalize(nvl(request.getParameter(scheduleSessionDispParamArr[0]),""))));
}
}
}
diff --git a/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/system/Globals.java b/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/system/Globals.java
index 04795bf4..2818989c 100644
--- a/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/system/Globals.java
+++ b/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/system/Globals.java
@@ -335,7 +335,7 @@ public class Globals extends org.onap.portalsdk.analytics.RaptorObject {
}
catch (IOException e) {
- e.printStackTrace();
+ logger.error(EELFLoggerDelegate.errorLogger,e.getMessage(), e);
}
try {
diff --git a/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/system/fusion/adapter/FusionAdapter.java b/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/system/fusion/adapter/FusionAdapter.java
index 3ac51bbe..adfc7d22 100644
--- a/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/system/fusion/adapter/FusionAdapter.java
+++ b/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/system/fusion/adapter/FusionAdapter.java
@@ -42,12 +42,16 @@ import java.util.Map;
import javax.servlet.ServletContext;
+import org.onap.portalsdk.analytics.model.runtime.FormField;
import org.onap.portalsdk.core.FusionObject;
+import org.onap.portalsdk.core.logging.logic.EELFLoggerDelegate;
import org.springframework.beans.factory.annotation.Autowired;
import com.mchange.v2.c3p0.ComboPooledDataSource;
public class FusionAdapter implements FusionObject {
+
+ private static final EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(FusionAdapter.class);
public static final String LOCAL_SESSION_FACTORY_KEY = "local";
@@ -76,7 +80,7 @@ public class FusionAdapter implements FusionObject {
try {
connection = getDataSource().getConnection();
} catch(Exception ex) {
- ex.printStackTrace();
+ logger.error(EELFLoggerDelegate.errorLogger,ex.getMessage(), ex);
}
return connection;
}
@@ -88,7 +92,7 @@ public class FusionAdapter implements FusionObject {
try {
connection = getDataSourceMap().get(schemaId).getConnection();
} catch (Exception e) {
- e.printStackTrace();
+ logger.error(EELFLoggerDelegate.errorLogger,e.getMessage(), e);
}
return connection;
@@ -101,7 +105,7 @@ public class FusionAdapter implements FusionObject {
conn.close();
}
catch (Exception e) {
- e.printStackTrace();
+ logger.error(EELFLoggerDelegate.errorLogger,e.getMessage(), e);
}
}