public static NodeBase GetNodeById(string documentId) { NodeBase lNode = null; Alfresco.RepositoryWebService.Store spacesStore = new Alfresco.RepositoryWebService.Store(); spacesStore.scheme = Alfresco.RepositoryWebService.StoreEnum.workspace; spacesStore.address = Constants.SPACES_STORE; // Create a query object Alfresco.RepositoryWebService.Query query = new Alfresco.RepositoryWebService.Query(); query.language = Constants.QUERY_LANG_LUCENE; query.statement = string.Format("@sys\\:node-uuid:\"{0}\"", documentId); QueryResult result = WebServiceFactory.getRepositoryService().query(spacesStore, query, true); if (result.resultSet.rows != null) { ResultSetRow row = result.resultSet.rows[0]; lNode = new NodeBase(); lNode.properties = new NamedValue[row.columns.Length]; row.columns.CopyTo(lNode.properties, 0); lNode.id = documentId; } return(lNode); }
private bool isNewContent(String spaceUuid, String name) { bool isNew = true; // Create a query object Alfresco.RepositoryWebService.Query query = new Alfresco.RepositoryWebService.Query(); query.language = Alfresco.RepositoryWebService.QueryLanguageEnum.lucene; // Create a query object String search = "+PARENT:\"workspace://SpacesStore/" + spaceUuid + "\" +@cm\\:name:\"" + name + "\""; query.statement = search; // Initialise the reference to the spaces store Alfresco.RepositoryWebService.Store spacesStore = new Alfresco.RepositoryWebService.Store(); spacesStore.scheme = Alfresco.RepositoryWebService.StoreEnum.workspace; spacesStore.address = "SpacesStore"; QueryResult result = this.repoService.query(spacesStore, query, true); if (result.resultSet.rows != null) { isNew = false; } return(isNew); }
public void CanPerformSearches() { AuthenticationUtils.startSession("admin", "admin"); try { RepositoryService repositoryService = WebServiceFactory.getRepositoryService(); Store spacesStore = new Store(StoreEnum.workspace, "SpacesStore"); String luceneQuery = "PATH:\"/app:company_home\""; Query query = new Query(Constants.QUERY_LANG_LUCENE, luceneQuery); QueryResult queryResult = repositoryService.query(spacesStore, query, false); ResultSet resultSet = queryResult.resultSet; ResultSetRow[] results = resultSet.rows; //your custom list IList<CustomResultVO> customResultList = new List<CustomResultVO>(); //retrieve results from the resultSet foreach(ResultSetRow resultRow in results) { ResultSetRowNode nodeResult = resultRow.node; //create your custom value object CustomResultVO customResultVo = new CustomResultVO(); customResultVo.Id = nodeResult.id; customResultVo.Type = nodeResult.type; //retrieve properties from the current node foreach(NamedValue namedValue in resultRow.columns) { if (Constants.PROP_NAME.Equals(namedValue.name)) { customResultVo.Name = namedValue.value; } else if (Constants.PROP_DESCRIPTION.Equals(namedValue.name)) { customResultVo.Description = namedValue.value; } } //add the current result to your custom list customResultList.Add(customResultVo); } Assert.AreEqual(1, customResultList.Count); CustomResultVO firstResult = customResultList[0]; Assert.IsNotNull(firstResult.Id); Assert.AreEqual("{http://www.alfresco.org/model/content/1.0}folder", firstResult.Type); } finally { AuthenticationUtils.endSession(); } }
private void initializeRootFolder() { // Suppress repainting the TreeView until all the objects have been created. treealfresco.BeginUpdate(); // get the root position, Company Home TreeNode rootNode = new TreeNode(); Alfresco.RepositoryWebService.Reference reference = new Alfresco.RepositoryWebService.Reference(); reference.store = this.spacesStore; reference.path = "/app:company_home"; // Create a query object Alfresco.RepositoryWebService.Query query = new Alfresco.RepositoryWebService.Query(); query.language = Alfresco.RepositoryWebService.QueryLanguageEnum.lucene; query.statement = "Path:\"/\" AND @cm\\:title:\"Company Home\""; QueryResult result = this.repoService.query(this.spacesStore, query, true); string name = null; if (result.resultSet.rows != null) { // construct root node ResultSetRow row = result.resultSet.rows[0]; foreach (NamedValue namedValue in row.columns) { if (namedValue.name.Contains("title") == true) { name = namedValue.value; rootNode.Text = name; rootNode.Name = name; } } rootNode.Tag = row.node; } // add the root node to the tree view this.treealfresco.Nodes.AddRange(new System.Windows.Forms.TreeNode[] { rootNode }); buildTree(rootNode, reference); // Begin repainting the TreeView. treealfresco.EndUpdate(); }
public ResultSetRow FindNodeById(string nodeId) { ResultSetRow lResult = null; Alfresco.RepositoryWebService.Query query = new Alfresco.RepositoryWebService.Query(); query.language = Constants.QUERY_LANG_LUCENE; //TODO: Consultas que sí funcionan: //query.statement = "PATH:\"//app:company_home//cm:Pruebas//cm:Test_Folder/*\""; //query.statement = "PATH:\"//cm:Pruebas//cm:Test_Folder/*\""; Todos los archivos de un folder //query.statement = "PATH:\"//cm:Pruebas//cm:Test_Folder\""; Devuelve un folder query.statement = "@sys\\:node-uuid:\"" + nodeId + "\""; QueryResult result = WebServiceFactory.getRepositoryService().query(spacesStore, query, false); if (result.resultSet.rows != null) { lResult = result.resultSet.rows[0]; } return(lResult); }
private String getNodeUuidFromLocation(String spaceUuid, String name) { String uuid = ""; // Create a query object Alfresco.RepositoryWebService.Query query = new Alfresco.RepositoryWebService.Query(); query.language = Alfresco.RepositoryWebService.QueryLanguageEnum.lucene; String search = "+PARENT:\"workspace://SpacesStore/" + spaceUuid + "\" +@cm\\:name:\"" + name + "\""; query.statement = search; // Initialise the reference to the spaces store Alfresco.RepositoryWebService.Store spacesStore = new Alfresco.RepositoryWebService.Store(); spacesStore.scheme = Alfresco.RepositoryWebService.StoreEnum.workspace; spacesStore.address = "SpacesStore"; QueryResult result = this.repoService.query(spacesStore, query, true); if (result.resultSet.rows != null) { uuid = result.resultSet.rows[0].node.id; } return(uuid); }
private bool isNewContent(String spaceUuid, String name) { bool isNew = true; // Create a query object Alfresco.RepositoryWebService.Query query = new Alfresco.RepositoryWebService.Query(); query.language = Alfresco.RepositoryWebService.QueryLanguageEnum.lucene; // Create a query object String search = "+PARENT:\"workspace://SpacesStore/" + spaceUuid + "\" +@cm\\:name:\"" + name + "\""; query.statement = search; // Initialise the reference to the spaces store Alfresco.RepositoryWebService.Store spacesStore = new Alfresco.RepositoryWebService.Store(); spacesStore.scheme = Alfresco.RepositoryWebService.StoreEnum.workspace; spacesStore.address = "SpacesStore"; QueryResult result = this.repoService.query(spacesStore, query, true); if (result.resultSet.rows != null) { isNew = false; } return isNew; }
private String getNodeUuidFromLocation(String spaceUuid, String name) { String uuid = ""; // Create a query object Alfresco.RepositoryWebService.Query query = new Alfresco.RepositoryWebService.Query(); query.language = Alfresco.RepositoryWebService.QueryLanguageEnum.lucene; String search = "+PARENT:\"workspace://SpacesStore/" + spaceUuid + "\" +@cm\\:name:\"" + name + "\""; query.statement = search; // Initialise the reference to the spaces store Alfresco.RepositoryWebService.Store spacesStore = new Alfresco.RepositoryWebService.Store(); spacesStore.scheme = Alfresco.RepositoryWebService.StoreEnum.workspace; spacesStore.address = "SpacesStore"; QueryResult result = this.repoService.query(spacesStore, query, true); if (result.resultSet.rows != null) { uuid = result.resultSet.rows[0].node.id; } return uuid; }
/// <remarks/> public System.IAsyncResult Beginquery(Store store, Query query1, bool includeMetaData, System.AsyncCallback callback, object asyncState) { return this.BeginInvoke("query", new object[] { store, query1, includeMetaData}, callback, asyncState); }
private void initializeRootFolder() { // Suppress repainting the TreeView until all the objects have been created. treeView1.BeginUpdate(); // get the root position, Company Home TreeNode rootNode = new TreeNode(); Alfresco.RepositoryWebService.Reference reference = new Alfresco.RepositoryWebService.Reference(); reference.store = this.spacesStore; reference.path = "/app:company_home"; // Create a query object Query query = new Query(); query.language = Constants.QUERY_LANG_LUCENE; query.statement = "Path:\"/\" AND @cm\\:title:\"Company Home\""; QueryResult result = this.repoService.query(this.spacesStore, query, true); string name = null; if (result.resultSet.rows != null) { // construct root node ResultSetRow row = result.resultSet.rows[0]; foreach (NamedValue namedValue in row.columns) { if (namedValue.name.Contains("title") == true) { name = namedValue.value; rootNode.Text = name; rootNode.Name = name; } } rootNode.Tag = row.node; } // add the root node to the tree view this.treeView1.Nodes.AddRange(new System.Windows.Forms.TreeNode[] { rootNode }); buildTree(rootNode, reference); // Begin repainting the TreeView. treeView1.EndUpdate(); }
public ResultSetRow FindNodeById(string nodeId) { ResultSetRow lResult = null; Alfresco.RepositoryWebService.Query query = new Alfresco.RepositoryWebService.Query(); query.language = Constants.QUERY_LANG_LUCENE; //TODO: Consultas que sí funcionan: //query.statement = "PATH:\"//app:company_home//cm:Pruebas//cm:Test_Folder/*\""; //query.statement = "PATH:\"//cm:Pruebas//cm:Test_Folder/*\""; Todos los archivos de un folder //query.statement = "PATH:\"//cm:Pruebas//cm:Test_Folder\""; Devuelve un folder query.statement = "@sys\\:node-uuid:\"" + nodeId + "\""; QueryResult result = WebServiceFactory.getRepositoryService().query(spacesStore, query, false); if (result.resultSet.rows != null) { lResult = result.resultSet.rows[0]; } return lResult; }
public static NodeBase GetNodeById(string documentId) { NodeBase lNode = null; Alfresco.RepositoryWebService.Store spacesStore = new Alfresco.RepositoryWebService.Store(); spacesStore.scheme = Alfresco.RepositoryWebService.StoreEnum.workspace; spacesStore.address = Constants.SPACES_STORE; // Create a query object Alfresco.RepositoryWebService.Query query = new Alfresco.RepositoryWebService.Query(); query.language = Constants.QUERY_LANG_LUCENE; query.statement = string.Format("@sys\\:node-uuid:\"{0}\"", documentId); QueryResult result = WebServiceFactory.getRepositoryService().query(spacesStore, query, true); if (result.resultSet.rows != null) { ResultSetRow row = result.resultSet.rows[0]; lNode = new NodeBase(); lNode.properties = new NamedValue[row.columns.Length]; row.columns.CopyTo(lNode.properties, 0); lNode.id = documentId; } return lNode; }
private void initializeRootFolder() { try { // Suppress repainting the TreeView until all the objects have been created. this.treeView1.BeginUpdate(); // get the root position, Company Home TreeNode rootNode = new TreeNode(); Alfresco.RepositoryWebService.Reference reference = new Alfresco.RepositoryWebService.Reference(); reference.store = this.spacesStore; reference.path = "/app:company_home"; // Create a query object Query query = new Query(); query.language = QueryLanguageEnum.lucene; query.statement = "Path:\"/\" AND @cm\\:title:\"Company Home\""; QueryResult result = this.repoService.query(this.spacesStore, query, true); string name = null; if (result.resultSet.rows != null) { // construct root node ResultSetRow row = result.resultSet.rows[0]; foreach (NamedValue namedValue in row.columns) { if (namedValue.name.Contains("title") == true) { name = namedValue.value; rootNode.Text = name; rootNode.Name = name; } } rootNode.Tag = row.node; if (this.selectedUuid.Equals(row.node.id)) { this.setInitNode(rootNode); } } // add the root node to the tree view this.treeView1.Nodes.AddRange(new System.Windows.Forms.TreeNode[] { rootNode }); try { this.buildTree(rootNode, reference); } catch (Exception e) { Log log = new Log(); log.ErrorLog(".\\log\\", "frmTreeViewBrowse method initializeRootFolder calling buildtree recursion method " + e.Message, e.StackTrace); } // Begin repainting the TreeView. this.treeView1.EndUpdate(); } catch (Exception ex) { Log log = new Log(); log.ErrorLog(".\\log\\", "frmTreeViewBrowse method initializeRootFolder " + ex.Message, ex.StackTrace); } }