editingManager.setTheXML(editingBean.getXmlBuilder());
} else if (viewBean != null) {
editingManager.setTheXML(viewBean.getXmlBuilder());
}
XMLBuilder builderManaging = null;
if (getConfFile().equals("bar-vis")) {
List<String> confControl = new ArrayList<String>();
confControl.add(getConfFile());
confBean = editingManager.rewriteMultipleConf(confControl);
builderManaging = confBean.getTheXMLConfBarVis();
} else if (getConfFile().equals("bar-query")) {
List<String> confControl = new ArrayList<String>();
confControl.add(getConfFile());
confBean = editingManager.rewriteMultipleConf(confControl);
builderManaging = confBean.getTheXMLConfBarQuery();
} else if (getConfFile().equals("bar-preinsert")) {
List<String> confControl = new ArrayList<String>();
confControl.add(getConfFile());
confBean = editingManager.rewriteMultipleConf(confControl);
builderManaging = confBean.getTheXMLConfBarPreInsert();
} else if (getConfFile().equals("bar-nav")) {
List<String> confControl = new ArrayList<String>();
confControl.add(getConfFile());
confBean = editingManager.rewriteMultipleConf(confControl);
builderManaging = confBean.getTheXMLConfBarNav();
} else if (getConfFile().equals("bar-managing")) {
List<String> confControl = new ArrayList<String>();
confControl.add(getConfFile());
confBean = editingManager.rewriteMultipleConf(confControl);
builderManaging = confBean.getTheXMLConfBarManaging();
} else if (getConfFile().equals("bar-edt")) {
List<String> confControl = new ArrayList<String>();
confControl.add(getConfFile());
confBean = editingManager.rewriteMultipleConf(confControl);
builderManaging = confBean.getTheXMLConfBarEdt();
} else if (getConfFile().equals("bar-docedit")) {
List<String> confControl = new ArrayList<String>();
confControl.add(getConfFile());
confBean = editingManager.rewriteMultipleConf(confControl);
builderManaging = confBean.getTheXMLConfBarDocEdit();
} else {
builderManaging = new XMLBuilder("root");
}
// System.out.println(ExpressionEvaluationUtils.evaluateString(builderManaging.getXML("ISO-8859-1"), builderManaging.getXML("ISO-8859-1"), pageContext));
// XMLBuilder builderManaging = editingManager.genericMultipleConf(getConfFile(), getTheMultiEditingPath());
// List<String> confControl = new ArrayList<String>();
// confControl.add("titleManager");
// confControl.add("query");
// editingManager.rewriteMultipleConf(confControl);
// System.out.println(getConfFile());
// System.out.println(getTheMultiEditingPath());
int contaNodi = builderManaging.contaNodi("/root/managing/user/element");
for (int i = 0; i < contaNodi; i++) {
String functionTxt = "";
String anchorTxt = "";
String targetTxt = "";
String txtAhref = builderManaging.valoreNodo("/root/managing/user/element[" + (i + 1) + "]/@value");
int contaEventJavaScript = builderManaging.contaNodi("/root/managing/user/element[" + (i + 1) + "]/eventJavaScript");
int contaAnchor = builderManaging.contaNodi("/root/managing/user/element[" + (i + 1) + "]/anchor");
String isVisible = "true";
String testMethod = builderManaging.valoreNodo("/root/managing/user/element[" + (i + 1) + "]/@testMethod");
String testClass = builderManaging.valoreNodo("/root/managing/user/element[" + (i + 1) + "]/@testClass");
String userValue = builderManaging.valoreNodo("/root/managing/user/element[" + (i + 1) + "]/@userValue");
String xPathTest = builderManaging.valoreNodo("/root/managing/user/element[" + (i + 1) + "]/@xPathTest");
// questo lo devo usare quando ho tempo di farlo
String[] xPathTestSplit = xPathTest.split(";");
String[] userValueSplit = userValue.split(";");
// out.println("userValueSplit "+userValueSplit);
// out.println("userValueSplit "+userValueSplit.length);
// out.println("userValue "+userValue);
if (!testMethod.equals("") && !testClass.equals("")) {
try {
Class constructorParamDef[] = {};
Object constructorParam[] = {};
Class c = Class.forName(testClass);
Constructor theConstructor = c.getConstructor(constructorParamDef);
Object myobj = theConstructor.newInstance(constructorParam);
Method[] m = c.getDeclaredMethods();
// ClassUtils.getPublicMethod(arg0, arg1, arg2);
Object objValue = null;
Object objBean = null;
if (testClass.toUpperCase().indexOf("VIEWBEAN") != -1) {
objBean = viewBean;
} else if (testClass.toUpperCase().indexOf("EDITINGBEAN") != -1) {
objBean = editingBean;
} else if (testClass.toUpperCase().indexOf("TESTINGGENERIC") != -1) {
objBean = null;
}
for (int j = 0; j < m.length; j++) {
// System.out.println("mmmm " + m[j]);
// System.out.println("mmmm " + m[j].getName());
if (m[j].getName().equals(testMethod)) {
if (m[j].getParameterTypes().length > 3) {
objValue = m[j].invoke(myobj, new Object[] { objBean, workFlowBean, userValueSplit, xPathTest });
break;
} else {
objValue = m[j].invoke(myobj, new Object[] { objBean, workFlowBean, userValueSplit });
break;
}
}
}
if (objValue != null) {
// out.println("objValue " + objValue);
isVisible = objValue.toString();
// out.println("isVisible " + isVisible);
}
} catch (Exception e) {
out.println("ERRORE 1" + e.getMessage());
isVisible = "false";
}
}
if (isVisible.equals("true")) {
ReflectionUtil reflectionUtil = new ReflectionUtil();
if (contaAnchor == 1) {
for (int j = 0; j < contaAnchor; j++) {
String anchor = builderManaging.valoreNodo("/root/managing/user/element[" + (i + 1) + "]/anchor[" + (j + 1) + "]/@value");
int contaParamAnchor = builderManaging.contaNodi("/root/managing/user/element[" + (i + 1) + "]/anchor[" + (j + 1) + "]/paramAnchor");
String interrogativo = "?";
if (anchor.indexOf("#") != -1 || contaParamAnchor == 0) {
interrogativo = "";
}
if (ExpressionEvaluationUtils.isExpressionLanguage(anchor)) {
anchor = ExpressionEvaluationUtils.evaluateString(anchor, anchor, pageContext);
}
anchorTxt += "href=\"" + anchor + interrogativo;
for (int k = 0; k < contaParamAnchor; k++) {
String paramNameAnchor = builderManaging.valoreNodo("/root/managing/user/element[" + (i + 1) + "]/anchor[" + (j + 1) + "]/paramAnchor[" + (k + 1) + "]/@name");
String javaBean = builderManaging.valoreNodo("/root/managing/user/element[" + (i + 1) + "]/anchor[" + (j + 1) + "]/paramAnchor[" + (k + 1) + "]/@javaBean");
String paramValue = builderManaging.valoreNodo("/root/managing/user/element[" + (i + 1) + "]/anchor[" + (j + 1) + "]/paramAnchor[" + (k + 1) + "]/@paramValue");
String methodBean = builderManaging.valoreNodo("/root/managing/user/element[" + (i + 1) + "]/anchor[" + (j + 1) + "]/paramAnchor[" + (k + 1) + "]/text()");
int paramValueNum = paramValue.split(",").length;
Object[] methodParam = null;
Object methodValue = null;
if (!paramValue.equals("") && paramValueNum > 0) {
// System.out.println("MenuGestioneJstl.doStartTag() MAGGIORE DI ZEROOOOOOOOOO paramValueNum " + paramValueNum);
// System.out.println("MenuGestioneJstl.doStartTag() MAGGIORE DI ZEROOOOOOOOOO paramValue " + paramValue);
methodParam = new Object[paramValueNum];
for (int index = 0; index < paramValueNum; index++) {
// System.out.println("MenuGestioneJstl.doStartTag() paramValue.split(\",\")[index] " + paramValue.split(",")[index]);
methodParam[index] = paramValue.split(",")[index];// getObjectFromString("java.lang.String", paramValue.split(",")[index]);
// System.out.println("MenuGestioneJstl.doStartTag() methodParam " + methodParam);
}
}
// methodParam = null;
if (!javaBean.equals("")) {
Class c = null;
if (javaBean.toUpperCase().equals("VIEWBEAN")) {
methodValue = reflectionUtil.invokeMethod(viewBean, methodBean, methodParam);
} else if (javaBean.toUpperCase().equals("CONFBEAN")) {
methodValue = reflectionUtil.invokeMethod(confBean, methodBean, methodParam);
} else if (javaBean.toUpperCase().equals("USERBEAN")) {
methodValue = reflectionUtil.invokeMethod(userBean, methodBean, methodParam);
} else if (javaBean.toUpperCase().equals("EDITINGBEAN")) {
methodValue = reflectionUtil.invokeMethod(editingBean, methodBean, methodParam);
} else if (javaBean.toUpperCase().equals("WORKFLOWBEAN")) {
methodValue = reflectionUtil.invokeMethod(workFlowBean, methodBean, methodParam);
} else if (javaBean.toUpperCase().equals("REQUEST")) {
methodValue = request.getParameter(methodBean);
}
} else {
methodValue = methodBean;
}
String endCom = "&";
if (k == contaParamAnchor - 1) {
endCom = "";
}
anchorTxt += paramNameAnchor + "=" + methodValue + endCom;
System.out.println("MenuGestioneJstl.doStartTag()anchorTxt anchorTxt " + anchorTxt);
if (anchorTxt.endsWith("?")) {
System.out.println("MenuGestioneJstl.doStartTag()AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA");
anchorTxt = anchorTxt.substring(0, anchorTxt.length() - 1);
}
}
anchorTxt += "\"";
String target = builderManaging.valoreNodo("/root/managing/user/element[" + (i + 1) + "]/anchor[" + (j + 1) + "]/@target");
if (!target.equals("")) {
targetTxt = "target=\"" + ExpressionEvaluationUtils.evaluateString(target, target, pageContext) + "\"";
}
}
} else if (contaAnchor == 0 && contaEventJavaScript > 0) {
anchorTxt = "href=\"javascript:void(0)\"";
} else {
throw new Error("Qualcosa e andato storto. Anchor maggiore di uno");
}
// out.println("contaEventJavaScript " + contaEventJavaScript);
for (int j = 0; j < contaEventJavaScript; j++) {
String eventJavaScript = builderManaging.valoreNodo("/root/managing/user/element[" + (i + 1) + "]/eventJavaScript[" + (j + 1) + "]/@value");
// out.println("eventJavaScripty " + eventJavaScript);
eventJavaScript += "=\"";
int contaFunctionName = builderManaging.contaNodi("/root/managing/user/element[" + (i + 1) + "]/eventJavaScript[" + (j + 1) + "]/functionName");
for (int k = 0; k < contaFunctionName; k++) {
String functionName = builderManaging.valoreNodo("/root/managing/user/element[" + (i + 1) + "]/eventJavaScript[" + (j + 1) + "]/functionName[" + (k + 1) + "]/@value");
// out.println("functionName " + functionName);
eventJavaScript += functionName + "(";
int contaParamFunction = builderManaging.contaNodi("/root/managing/user/element[" + (i + 1) + "]/eventJavaScript[" + (j + 1) + "]/functionName[" + (k + 1) + "]/paramFunction");
for (int index = 0; index < contaParamFunction; index++) {
String javaBean = builderManaging.valoreNodo("/root/managing/user/element[" + (i + 1) + "]/eventJavaScript[" + (j + 1) + "]/functionName[" + (k + 1) + "]/paramFunction[" + (index + 1) + "]/@javaBean");
String methodBean = builderManaging.valoreNodo("/root/managing/user/element[" + (i + 1) + "]/eventJavaScript[" + (j + 1) + "]/functionName[" + (k + 1) + "]/paramFunction[" + (index + 1) + "]/text()");
String paramValue = builderManaging.valoreNodo("/root/managing/user/element[" + (i + 1) + "]/eventJavaScript[" + (j + 1) + "]/functionName[" + (k + 1) + "]/paramFunction[" + (index + 1) + "]/@paramValue");
String escapeSingleApex = builderManaging.valoreNodo("/root/managing/user/element[" + (i + 1) + "]/eventJavaScript[" + (j + 1) + "]/functionName[" + (k + 1) + "]/paramFunction[" + (index + 1) + "]/@escapeSingleApex");
// System.out.println("MenuGestioneJstl.doStartTag() MAGGIORE DI ZEROOOOOOOOOO paramValue " + paramValue);
int paramValueNum = paramValue.split(",").length;
Object[] methodParam = null;
Object methodValue = null;
if (!paramValue.equals("") && paramValueNum > 0) {