As we transition to the new Hyland Community, some post links may be temporarily disrupted as we finalize redirects. We apologize for the inconvenience and are working to resolve this as quickly as possible. Details.
reference = new Reference(store, row.getNode().getId(), null); predicate = new Predicate(new Reference[]{reference}, null, null); nodes = repositoryService.get(predicate); for (i=0;i < nodes[0].getProperties().length; i++) { //Nombre if (nodes[0].getProperties(i).getName().equals("{http://www.alfresco.org/model/content/1.0}name")) { sName = nodes[0].getProperties(i).getValue(); }
var myfile = companyhome.childByNamePath(name); props = myfile.getProperties(); for (i=0;i<props.length;i++){ txt += "<b>" + props[i].getName() + "</b>:" + props[i].getValue() + "<br>"; }
reference = new Reference(store, row.getNode().getId(), null); predicate = new Predicate(new Reference[]{reference}, null, null); nodes = repositoryService.get(predicate); for (i=0;i < nodes[0].getProperties().length; i++) { //Nombre if (nodes[0].getProperties(i).getName().equals("{http://www.alfresco.org/model/content/1.0}name")) { sName = nodes[0].getProperties(i).getValue(); } You can access this way to all properties
When i try to display the properties (please see code) var myfile = companyhome.childByNamePath(name); props = myfile.getProperties(); for (i=0;i<props.length;i++){ txt += "<b>" + props[i].getName() + "</b>:" + props[i].getValue() + "<br>"; } the variable "props" has "null" value, not an object, and I don't know why. So I look for the properties when I create the Node "name" (createNode function). What I see in the Java code (please see /HEAD/root/projects/repository/source/java/org/alfresco/repo/jscript/ScriptNode.java) is that properties attribute has "null" value if we don't put anything in properties parameter function.
When i try to display the properties (please see code) var myfile = companyhome.childByNamePath(name); props = myfile.getProperties(); for (i=0;i<props.length;i++){ txt += "<b>" + props[i].getName() + "</b>:" + props[i].getValue() + "<br>"; } the variable "props" has "null" value, not an object, and I don't know why. So I look for the properties when I create the Node "name" (createNode function). What I see in the Java code (please see /HEAD/root/projects/repository/source/java/org/alfresco/repo/jscript/ScriptNode.java) is that properties attribute has "null" value if we don't put anything in properties parameter function.The code the other user posted was for using WebServices - the code you are trying to use is the JavaScript API - they are quite different and methods/properties are accessed using a different syntax.I suggest you take a look at the examples in the JavaScript API docs:http://wiki.alfresco.com/wiki/JavaScript_APIthen you'll see that the code you are using will not work at all.Thanks,Kevin
package wizard.actions; import javax.jcr.Node; import javax.jcr.NodeIterator; import javax.jcr.Property; import javax.jcr.PropertyIterator; import javax.jcr.Repository; import javax.jcr.Session; import javax.jcr.SimpleCredentials; import org.springframework.context.ApplicationContext; import org.springframework.context.support.ClassPathXmlApplicationContext;