This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.someco.cmis.examples; | |
import java.io.ByteArrayInputStream; | |
import java.io.InputStream; | |
import java.math.BigInteger; | |
import java.util.HashMap; | |
import java.util.List; | |
import java.util.Map; | |
import org.apache.chemistry.opencmis.client.api.Document; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
document = session.getObjectByPath('/versionableExample.txt') | |
println("Checked out?" + document.versionSeriesCheckedOut) | |
versions = document.getAllVersions() | |
for (version in versions) { | |
println ("Version:" + version.versionLabel + " PWC?:" + version.privateWorkingCopy) | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.someco; | |
import java.io.IOException; | |
import com.google.api.client.http.GenericUrl; | |
import com.google.api.client.http.HttpRequest; | |
import com.google.api.client.http.HttpRequestFactory; | |
import com.google.api.client.http.HttpRequestInitializer; | |
import com.google.api.client.http.HttpTransport; | |
import com.google.api.client.http.javanet.NetHttpTransport; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import org.apache.chemistry.opencmis.commons.* | |
import org.apache.chemistry.opencmis.commons.data.* | |
import org.apache.chemistry.opencmis.commons.enums.* | |
import org.apache.chemistry.opencmis.client.api.* | |
String cql = "SELECT D.cmis:name, T.cm:title FROM cmis:document as D join cm:titled as T on D.cmis:objectId = T.cmis:objectId" | |
ItemIterable<QueryResult> results = session.query(cql, false) | |
results.each { hit -> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
List<Object> aspects = doc.getProperty("cmis:secondaryObjectTypeIds").getValues(); | |
if (!aspects.contains("P:cm:geographic")) { | |
aspects.add("P:cm:geographic"); | |
HashMap<String, Object> props = new HashMap<String, Object>(); | |
props.put("cmis:secondaryObjectTypeIds", aspects); | |
doc.updateProperties(props); | |
System.out.println("Added aspect"); | |
} else { | |
System.out.println("Doc already had aspect"); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var results = search.luceneSearch("ASPECT:\"ASPECT NAME HERE\""); | |
for each (var doc in results) { | |
doc.removeAspect("ASPECT NAME HERE"); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
testDoc = session.getObjectByPath("/test/testfolder1/test1.txt") | |
catIds = testDoc.getPropertyValue("cm:categories") | |
for (catId in catIds) { | |
cat = session.getObject(catId) | |
println(cat.name) | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def addCategory(documentPath, categoryName) { | |
println("Adding '" + categoryName + "' to the document at " + documentPath) | |
rs = session.query("select alfcmis:nodeRef from cm:category where cmis:name = '" + categoryName + "'", false) | |
if (rs.getTotalNumItems() == 0) { | |
println("Couldn't find category with name: " + categoryName) | |
return | |
} | |
catId = rs.getAt(0).getPropertyValueById("alfcmis:nodeRef") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
rs = session.query("select cmis:objectId FROM cm:person where cm:firstName like 'Te%' and cm:organization like 'Green%' and cm:location like 'Dallas%' and (cm:companypostcode <> '75070' or cm:companypostcode is null)", false) | |
if (rs.getTotalNumItems() == 0) { | |
println("Couldn't find person that matched query") | |
return | |
} | |
for (res in rs) { | |
personId = res.getPropertyValueById("cmis:objectId") | |
person = session.getObject(personId) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
rs = session.query("select R.cmis:objectId from rule:rule as R join cm:titled as T on R.cmis:objectId = T.cmis:objectId where T.cm:title = 'add classifiable aspect'", false) | |
if (rs.getTotalNumItems() == 0) { | |
println("Couldn't find a rule that matched your query") | |
return | |
} | |
for (res in rs) { | |
ruleId = res.getPropertyValueById('cmis:objectId') | |
rule = session.getObject(ruleId) |
OlderNewer