CODE STYLE class.javaBridgePM.php

This commit is contained in:
Fernando Ontiveros
2012-10-09 12:52:35 -04:00
parent ace3ab8006
commit f2ec274099

View File

@@ -1,6 +1,7 @@
<?php
/**
* class.javaBridgePM.php
*
* @package workflow.engine.classes
*
* ProcessMaker Open Source Edition
@@ -23,12 +24,15 @@
* Coral Gables, FL, 33134, USA, or email info@colosa.com.
*/
if ( ! defined ( 'JAVA_BRIDGE_PATH') ) define ( 'JAVA_BRIDGE_PATH', 'JavaBridgePM' );
if ( ! defined ( 'JAVA_BRIDGE_PORT') ) define ( 'JAVA_BRIDGE_PORT', '8080' );
if ( ! defined ( 'JAVA_BRIDGE_HOST') ) define ( 'JAVA_BRIDGE_HOST', '127.0.0.1' );
if (! defined( 'JAVA_BRIDGE_PATH' ))
define( 'JAVA_BRIDGE_PATH', 'JavaBridgePM' );
if (! defined( 'JAVA_BRIDGE_PORT' ))
define( 'JAVA_BRIDGE_PORT', '8080' );
if (! defined( 'JAVA_BRIDGE_HOST' ))
define( 'JAVA_BRIDGE_HOST', '127.0.0.1' );
/**
*
* @package workflow.engine.classes
*/
class JavaBridgePM
@@ -41,6 +45,7 @@
* checkJavaExtension
* check if the java extension was loaded.
*
*
* @return true or false
*/
function checkJavaExtension ()
@@ -53,7 +58,8 @@
$includedFiles = get_included_files();
$found = false;
foreach ($includedFiles as $filename) {
if ( $urlJavaInc == $filename ) $found = true;
if ($urlJavaInc == $filename)
$found = true;
}
if (! $found) {
throw new Exception( 'The PHP/Java Bridge is not defined' );
@@ -68,14 +74,14 @@
}
return true;
}
catch ( Exception $e ) {
} catch (Exception $e) {
throw new Exception( 'Error in checkJavaExtension: ' . $e->getMessage() );
}
}
/**
* convert a php value to a java one...
*
* @param string $value
* @param string $className
* @return s boolean success
@@ -88,42 +94,33 @@
if ($className == 'java.lang.String') {
$temp = new Java( 'java.lang.String', $value );
return $temp;
}
else if ($className == 'java.lang.Boolean' ||
$className == 'java.lang.Integer' ||
$className == 'java.lang.Long' ||
$className == 'java.lang.Short' ||
$className == 'java.lang.Double' ||
$className == 'java.math.BigDecimal') {
} else if ($className == 'java.lang.Boolean' || $className == 'java.lang.Integer' || $className == 'java.lang.Long' || $className == 'java.lang.Short' || $className == 'java.lang.Double' || $className == 'java.math.BigDecimal') {
$temp = new Java( $className, $value );
return $temp;
}
else if ($className == 'java.sql.Timestamp' ||
$className == 'java.sql.Time') {
} else if ($className == 'java.sql.Timestamp' || $className == 'java.sql.Time') {
$temp = new Java( $className );
$javaObject = $temp->valueOf( $value );
return $javaObject;
}
}
catch (Exception $err) {
echo ( 'unable to convert value, ' . $value .
' could not be converted to ' . $className);
} catch (Exception $err) {
echo ('unable to convert value, ' . $value . ' could not be converted to ' . $className);
return false;
}
echo ( 'unable to convert value, class name '.$className.
' not recognised');
echo ('unable to convert value, class name ' . $className . ' not recognised');
return false;
}
/**
* generateJrxmlFromDynaform
*
* @param string $outDocUid
* @param string $dynaformUid
* @param object $template
* @return void
*/
function generateJrxmlFromDynaform ( $outDocUid, $dynaformUid, $template ) {
function generateJrxmlFromDynaform ($outDocUid, $dynaformUid, $template)
{
require_once 'classes/model/Dynaform.php';
$dyn = new Dynaform();
$aFields = $dyn->load( $dynaformUid );
@@ -146,8 +143,7 @@
$template->assign( 'heightDetail', count( $xmlFields ) * 15 + 20 );
$template->assign( 'PAGE_NUMBER', '{PAGE_NUMBER}' );
$logoReporte = 'http://' .$_SERVER['SERVER_NAME'] . ':' .$_SERVER['SERVER_PORT'] .
'/images/processmaker.logo.jpg';
$logoReporte = 'http://' . $_SERVER['SERVER_NAME'] . ':' . $_SERVER['SERVER_PORT'] . '/images/processmaker.logo.jpg';
$template->assign( 'logoReporte', $logoReporte );
foreach ($xmlFields as $key => $val) {
@@ -155,7 +151,6 @@
$template->assign( 'fieldName', $key );
}
$posX = 140;
$posLabelX = 5;
$posY = 10;