Skip to content

Commit

Permalink
Merge https://github.com/Amir-Github/js-remoting into Amir-Github-2a2…
Browse files Browse the repository at this point in the history
…d3fb
  • Loading branch information
sbryzak committed Dec 23, 2010
2 parents e1dbf74 + c6c8288 commit aeb2a00
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions impl/src/main/resources/org/jboss/seam/remoting/remote.js
Expand Up @@ -1332,7 +1332,7 @@ Seam.validate = function(beansList , callBack, groups){
listItem[Seam.validation_groups] = groups;
if(listItem[Seam.validation_traverse] == true){
var properties = listItem[Seam.validation_props];
var beans = Seam.getObjectGraph(bean, true, properties);
var beans = Seam.getObjectGraph(bean, true, [] ,properties);
for(var j=0;j<beans.length;j++){
if(!groups && !listItem[Seam.validation_groups])
tempList.push({bean: beans[j]});
Expand Down Expand Up @@ -1371,7 +1371,13 @@ Seam.validate = function(beansList , callBack, groups){
}
};

Seam.getObjectGraph = function(bean, recursive, properties){
Seam.getObjectGraph = function(bean, recursive, graph, properties){
if(graph.length > 0){
for(var i=0;i<graph.length;i++)
if(graph[i] == bean)
return [];
}
graph.push(bean);
var beans = [];
var meta = [];
var metaData = Seam.getBeanMetadata(bean);
Expand All @@ -1393,7 +1399,7 @@ Seam.getObjectGraph = function(bean, recursive, properties){
if(bean[meta[i].field] != undefined){
if(meta[i].type == "bean"){
beans.push(bean[meta[i].field]);
beans = beans.concat(Seam.getObjectGraph(bean[meta[i].field] , recursive, null));
beans = beans.concat(Seam.getObjectGraph(bean[meta[i].field] , recursive, graph));
}
else{
var values = [];
Expand All @@ -1404,7 +1410,7 @@ Seam.getObjectGraph = function(bean, recursive, properties){

for(var k=0;k<values.length;k++){
beans.push(values[k]);
beans = beans.concat(Seam.getObjectGraph(values[k], recursive, null));
beans = beans.concat(Seam.getObjectGraph(values[k], recursive, graph));
}
}
}
Expand Down

0 comments on commit aeb2a00

Please sign in to comment.