本文整理汇总了Java中org.apache.chemistry.opencmis.client.api.OperationContext类的典型用法代码示例。如果您正苦于以下问题:Java OperationContext类的具体用法?Java OperationContext怎么用?Java OperationContext使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
OperationContext类属于org.apache.chemistry.opencmis.client.api包,在下文中一共展示了OperationContext类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: searchDocuments
import org.apache.chemistry.opencmis.client.api.OperationContext; //导入依赖的package包/类
public static List<Document> searchDocuments(Session pSession, String pTypeId, String pWhereClause) {
mLog.debug("START searchDocuments(String, String");
// per evitare il problema dei documenti duplicati
LinkedHashMap<String, Document> lHashMapResults = new LinkedHashMap<String, Document>();
// Temporanea disabilitazione della cache
OperationContext lOperationContext = pSession.createOperationContext();
lOperationContext.setCacheEnabled(false);
ItemIterable<CmisObject> lResult = pSession.queryObjects(pTypeId, pWhereClause, false, lOperationContext);
for (CmisObject cmisObject : lResult) {
// TODO (Alessio) gestione paginazione (in entrata e in uscita, anche se probabilmente è
// già gestita internamente in queryObjects)
lHashMapResults.put(cmisObject.getId(), (Document) cmisObject);
}
mLog.debug("END searchDocuments(String, String");
return new ArrayList<Document>(lHashMapResults.values());
}
开发者ID:MakeITBologna,项目名称:zefiro,代码行数:21,代码来源:AlfrescoHelper.java
示例2: setupOperationContext
import org.apache.chemistry.opencmis.client.api.OperationContext; //导入依赖的package包/类
protected void setupOperationContext(final int maxItems, final Session session)
{
final OperationContext operationContext = session.createOperationContext();
operationContext.setCacheEnabled(true);
operationContext.setOrderBy(MessageFormat.format("{0} ASC", PropertyIds.NAME));
operationContext.setMaxItemsPerPage(maxItems);
operationContext.setFilterString(null);
operationContext.setIncludePathSegments(false);
operationContext.setIncludeAcls(false);
operationContext.setIncludeAllowableActions(false);
operationContext.setIncludePolicies(false);
operationContext.setIncludeRelationships(IncludeRelationships.NONE);
operationContext.setLoadSecondaryTypeProperties(true);
session.setDefaultContext(operationContext);
}
开发者ID:AFaust,项目名称:alfresco-cmis-documentlist,代码行数:20,代码来源:CMISDocumentListTreeNodeGet.java
示例3: setupOperationContext
import org.apache.chemistry.opencmis.client.api.OperationContext; //导入依赖的package包/类
protected void setupOperationContext(final int maxItems, final Session session)
{
final OperationContext operationContext = session.createOperationContext();
operationContext.setCacheEnabled(true);
// type descending => cmis:folder, cmis:document
operationContext.setOrderBy(MessageFormat.format("{0} DESC,{1} ASC", PropertyIds.BASE_TYPE_ID, PropertyIds.NAME));
operationContext.setMaxItemsPerPage(maxItems);
operationContext.setFilterString(null);
operationContext.setRenditionFilterString("*");
operationContext.setIncludePathSegments(true);
// TODO: need to be included once
operationContext.setIncludeAcls(false);
operationContext.setIncludeAllowableActions(false);
operationContext.setIncludePolicies(false);
operationContext.setIncludeRelationships(IncludeRelationships.NONE);
operationContext.setLoadSecondaryTypeProperties(true);
session.setDefaultContext(operationContext);
}
开发者ID:AFaust,项目名称:alfresco-cmis-documentlist,代码行数:23,代码来源:CMISDocumentListGet.java
示例4: convert
import org.apache.chemistry.opencmis.client.api.OperationContext; //导入依赖的package包/类
public OperationContext convert(final BaseCMISOperationContext sourceContext)
{
final OperationContext operationContext = OperationContextUtils.createOperationContext();
operationContext.setCacheEnabled(true);
operationContext.setOrderBy(this.getCMISOrderByClause(sourceContext));
// TODO Add other parametes
// operationContext.setMaxItemsPerPage(ctx.getMaxItems);
operationContext.setFilterString(null);
operationContext.setRenditionFilterString("*");
operationContext.setIncludePathSegments(true);
// TODO: need to be included once
operationContext.setIncludeAcls(false);
operationContext.setIncludeAllowableActions(false);
operationContext.setIncludePolicies(false);
operationContext.setIncludeRelationships(IncludeRelationships.NONE);
operationContext.setLoadSecondaryTypeProperties(true);
return operationContext;
}
开发者ID:AFaust,项目名称:alfresco-cmis-documentlist,代码行数:22,代码来源:RhinoCMISConnectorImpl.java
示例5: connect
import org.apache.chemistry.opencmis.client.api.OperationContext; //导入依赖的package包/类
@Override
public ScriptCMISRepository connect(final String serverId, final ScriptCMISOperationContext ctx)
{
// TODO GET the information form configuration file
final Map<String, String> parameters = new HashMap<String, String>();
parameters.put(SessionParameter.USER, "admin");
parameters.put(SessionParameter.PASSWORD, "admin");
parameters.put(SessionParameter.AUTHENTICATION_PROVIDER_CLASS, CertificateNotValidatingAuthenticationProvider.class.getName());
parameters.put(SessionParameter.BROWSER_URL, "http://cmis.alfresco.com/cmisbrowser");
parameters.put(SessionParameter.BINDING_TYPE, BindingType.BROWSER.value());
final SessionFactoryImpl sessionFactory = SessionFactoryImpl.newInstance();
final List<Repository> repositories = sessionFactory.getRepositories(parameters);
final Repository mainRepository = repositories.get(0);
parameters.put(SessionParameter.REPOSITORY_ID, mainRepository.getId());
final Session session = sessionFactory.createSession(parameters);
session.setDefaultContext(DefaultTypeConverter.INSTANCE.convert(OperationContext.class, ctx));
final RhinoCMISRepositoryImpl scriptCMISRepository = new RhinoCMISRepositoryImpl(session);
return scriptCMISRepository;
}
开发者ID:AFaust,项目名称:alfresco-cmis-documentlist,代码行数:23,代码来源:RhinoCMISConnectorImpl.java
示例6: StartCMISSession
import org.apache.chemistry.opencmis.client.api.OperationContext; //导入依赖的package包/类
/**
* @param userDataService service to retrieve user authentication details
* @param sessionService service to register a load test session
* @param bindingUrl the URL as required by the {@link SessionParameter.ATOMPUB_URL} or {@link SessionParameter.BROWSER_URL} parameter
* @param bindingType one of the supported CMIS binding types: 'browser' or 'atompub'
* @param repositoryId the ID of the repository required by the {@link SessionParameter.REPOSITORY_ID} parameter
* @param ctx the operation context for all calls made by the session.
* Event processors must not adjust but should copy it if changes are required.
*/
public StartCMISSession(
UserDataService userDataService, SessionService sessionService,
String bindingUrl, String bindingType,
String repositoryId,
OperationContext ctx)
{
super();
this.userDataService = userDataService;
this.sessionService = sessionService;
this.bindingUrl = bindingUrl;
this.bindingType = bindingType;
this.repositoryId = repositoryId;
this.ctx = ctx;
this.eventNameSessionStarted = EVENT_NAME_SESSION_STARTED;
}
开发者ID:AlfrescoBenchmark,项目名称:benchmark-cmis,代码行数:25,代码来源:StartCMISSession.java
示例7: getCmisObjectByPath
import org.apache.chemistry.opencmis.client.api.OperationContext; //导入依赖的package包/类
public static CmisObject getCmisObjectByPath(final Session session,
final String path, final OperationContext context,
final String what) throws TheBlendException {
if (session == null) {
throw new IllegalArgumentException("Session must be set!");
}
if (path == null || !path.startsWith("/")) {
throw new TheBlendException("Invalid path to " + what + "!");
}
OperationContext oc = context;
if (oc == null) {
oc = session.getDefaultContext();
}
try {
return session.getObjectByPath(path, oc);
} catch (CmisObjectNotFoundException onfe) {
throw new TheBlendException("The " + what + " does not exist!",
onfe);
} catch (CmisBaseException cbe) {
throw new TheBlendException("Could not retrieve the " + what
+ ":" + cbe.getMessage(), cbe);
}
}
开发者ID:fmui,项目名称:ApacheChemistryInAction,代码行数:27,代码来源:CMISHelper.java
示例8: getAllVersions
import org.apache.chemistry.opencmis.client.api.OperationContext; //导入依赖的package包/类
public List<Document> getAllVersions(String objectId)
{
CmisObject o = getObject(objectId);
if(o instanceof Document)
{
Document d = (Document)o;
OperationContext ctx = new OperationContextImpl();
List<Document> res = d.getAllVersions(ctx);
return res;
}
else
{
throw new IllegalArgumentException("Object does not exist or is not a document");
}
}
开发者ID:Alfresco,项目名称:alfresco-remote-api,代码行数:16,代码来源:PublicApiClient.java
示例9: RequestContext
import org.apache.chemistry.opencmis.client.api.OperationContext; //导入依赖的package包/类
public RequestContext(String networkId, String runAsUser, OperationContext cmisOperationCtxOverride)
{
this(runAsUser);
this.networkId = networkId;
this.password = null;
this.cmisOperationCtxOverride = cmisOperationCtxOverride;
}
开发者ID:Alfresco,项目名称:alfresco-remote-api,代码行数:8,代码来源:RequestContext.java
示例10: getDocumentRenditions
import org.apache.chemistry.opencmis.client.api.OperationContext; //导入依赖的package包/类
public static List<Rendition> getDocumentRenditions(Session pSession, String pStrDocumentId, String pStrFilter) {
mLog.debug("START getDocumentRenditions(String, String)");
OperationContext operationContext = pSession.createOperationContext();
operationContext.setFilterString(PropertyIds.NAME);
operationContext.setRenditionFilterString(pStrFilter);
CmisObject lCmisObject = pSession.getObject(pStrDocumentId);
List<Rendition> lListResults = lCmisObject.getRenditions();
mLog.debug("END getDocumentRenditions(String)");
return lListResults;
}
开发者ID:MakeITBologna,项目名称:zefiro,代码行数:13,代码来源:AlfrescoHelper.java
示例11: processFolderRecursively
import org.apache.chemistry.opencmis.client.api.OperationContext; //导入依赖的package包/类
int processFolderRecursively(Folder folder) throws Exception {
processFolderNode(folder);
OperationContext operationContext = cmisConsumer.createOperationContext();
operationContext.setMaxItemsPerPage(pageSize);
int count = 0;
int pageNumber = 0;
boolean finished = false;
ItemIterable<CmisObject> itemIterable = folder.getChildren(operationContext);
while (!finished) {
ItemIterable<CmisObject> currentPage = itemIterable.skipTo(count).getPage();
LOG.debug("Processing page {}", pageNumber);
for (CmisObject child : currentPage) {
if (CMISHelper.isFolder(child)) {
Folder childFolder = (Folder)child;
processFolderRecursively(childFolder);
} else {
processNonFolderNode(child, folder);
}
count++;
if (totalPolled == readCount) {
finished = true;
break;
}
}
pageNumber++;
if (!currentPage.getHasMoreItems()) {
finished = true;
}
}
return totalPolled;
}
开发者ID:HydAu,项目名称:Camel,代码行数:37,代码来源:RecursiveTreeWalker.java
示例12: getAllVersions
import org.apache.chemistry.opencmis.client.api.OperationContext; //导入依赖的package包/类
public List<Document> getAllVersions(String objectId)
{
CmisObject o = getObject(objectId);
if(o instanceof Document)
{
Document d = (Document)o;
OperationContext ctx = new OperationContextImpl();
List<Document> res = d.getAllVersions(ctx);
return res;
}
else
{
throw new IllegalArgumentException("Object does not exist or is not a document");
}
}
开发者ID:Alfresco,项目名称:community-edition-old,代码行数:16,代码来源:PublicApiClient.java
示例13: getMinimalOperationContext
import org.apache.chemistry.opencmis.client.api.OperationContext; //导入依赖的package包/类
public OperationContext getMinimalOperationContext(){
OperationContext operationContext = session.createOperationContext();
operationContext.setCacheEnabled(false);
operationContext.setIncludeAcls(false);
operationContext.setIncludeAllowableActions(false);
operationContext.setIncludePathSegments(false);
operationContext.setIncludePolicies(false);
operationContext.setIncludeRelationships(IncludeRelationships.NONE);
return operationContext;
}
开发者ID:kylefernandadams,项目名称:cmis-jmeter-test,代码行数:13,代码来源:CmisHelper.java
示例14: convertOperationContext
import org.apache.chemistry.opencmis.client.api.OperationContext; //导入依赖的package包/类
/**
* Convert an operation context into a DBObject for neat, searchable persistence
*/
public static DBObject convertOperationContext(OperationContext ctx)
{
return BasicDBObjectBuilder.start()
.append("pageSize", ctx.getMaxItemsPerPage())
.append("orderBy", ctx.getOrderBy())
.append("cacheEnabled", ctx.isCacheEnabled())
.append("includeAcls", ctx.isIncludeAcls())
.append("includeAllowableActions", ctx.isIncludeAllowableActions())
.append("includePathSegments", ctx.isIncludePathSegments())
.append("includePolicies", ctx.isIncludePolicies())
.get();
}
开发者ID:AlfrescoBenchmark,项目名称:benchmark-cmis,代码行数:16,代码来源:StartCMISSession.java
示例15: getCmisObject
import org.apache.chemistry.opencmis.client.api.OperationContext; //导入依赖的package包/类
/**
* Gets a CMIS object from the repository.
*
* @param session
* the OpenCMIS session
* @param id
* the id of the object
* @param context
* the Operation Context
* @param what
* string that describes the object, used for error
* messages
* @return the CMIS object
* @throws TheBlendException
*/
public static CmisObject getCmisObject(final Session session,
final String id, final OperationContext context,
final String what) throws TheBlendException {
if (session == null) {
throw new IllegalArgumentException("Session must be set!");
}
if (id == null || id.length() == 0) {
throw new TheBlendException("Invalid id for " + what + "!");
}
OperationContext oc = context;
if (oc == null) {
oc = session.getDefaultContext();
}
try {
return session.getObject(id, oc);
} catch (CmisObjectNotFoundException onfe) {
throw new TheBlendException("The " + what + " does not exist!",
onfe);
} catch (CmisBaseException cbe) {
throw new TheBlendException("Could not retrieve the " + what
+ ":" + cbe.getMessage(), cbe);
}
}
开发者ID:fmui,项目名称:ApacheChemistryInAction,代码行数:42,代码来源:CMISHelper.java
示例16: getDocumet
import org.apache.chemistry.opencmis.client.api.OperationContext; //导入依赖的package包/类
public static Document getDocumet(final Session session,
final String id, final OperationContext context,
final String what) throws TheBlendException {
// fetch the document object
CmisObject cmisObject = getCmisObject(session, id, context, what);
// if the object is not a document, throw an exception
if (!(cmisObject instanceof Document)) {
throw new TheBlendException("Object is not a document!");
}
return (Document) cmisObject;
}
开发者ID:fmui,项目名称:ApacheChemistryInAction,代码行数:14,代码来源:CMISHelper.java
示例17: getFolder
import org.apache.chemistry.opencmis.client.api.OperationContext; //导入依赖的package包/类
public static Folder getFolder(final Session session,
final String id, final OperationContext context, String what)
throws TheBlendException {
// fetch the folder object
CmisObject cmisObject = getCmisObject(session, id, context, what);
// if the object is not a folder, throw an exception
if (!(cmisObject instanceof Folder)) {
throw new TheBlendException("Object is not a folder!");
}
return (Folder) cmisObject;
}
开发者ID:fmui,项目名称:ApacheChemistryInAction,代码行数:14,代码来源:CMISHelper.java
示例18: getDocumetByPath
import org.apache.chemistry.opencmis.client.api.OperationContext; //导入依赖的package包/类
public static Document getDocumetByPath(final Session session,
final String path, final OperationContext context,
final String what) throws TheBlendException {
// fetch the document object
CmisObject cmisObject = getCmisObjectByPath(session, path,
context, what);
// if the object is not a document, throw an exception
if (!(cmisObject instanceof Document)) {
throw new TheBlendException("Object is not a document!");
}
return (Document) cmisObject;
}
开发者ID:fmui,项目名称:ApacheChemistryInAction,代码行数:15,代码来源:CMISHelper.java
示例19: getFolderByPath
import org.apache.chemistry.opencmis.client.api.OperationContext; //导入依赖的package包/类
public static Folder getFolderByPath(final Session session,
final String path, final OperationContext context, String what)
throws TheBlendException {
// fetch the folder object
CmisObject cmisObject = getCmisObjectByPath(session, path,
context, what);
// if the object is not a folder, throw an exception
if (!(cmisObject instanceof Folder)) {
throw new TheBlendException("Object is not a folder!");
}
return (Folder) cmisObject;
}
开发者ID:fmui,项目名称:ApacheChemistryInAction,代码行数:15,代码来源:CMISHelper.java
示例20: testPublicApi110
import org.apache.chemistry.opencmis.client.api.OperationContext; //导入依赖的package包/类
@Test
public void testPublicApi110() throws Exception
{
Iterator<TestNetwork> networksIt = getTestFixture().networksIterator();
final TestNetwork network1 = networksIt.next();
Iterator<String> personIt = network1.getPersonIds().iterator();
final String person1Id = personIt.next();
final String person2Id = personIt.next();
final List<NodeRef> nodes = new ArrayList<NodeRef>(5);
// Create some favourite targets, sites, files and folders
TenantUtil.runAsUserTenant(new TenantRunAsWork<Void>()
{
@Override
public Void doWork() throws Exception
{
String siteName1 = "site" + GUID.generate();
SiteInformation siteInfo1 = new SiteInformation(siteName1, siteName1, siteName1, SiteVisibility.PUBLIC);
TestSite site1 = network1.createSite(siteInfo1);
String siteName2 = "site" + GUID.generate();
SiteInformation siteInfo2 = new SiteInformation(siteName2, siteName2, siteName2, SiteVisibility.PRIVATE);
TestSite site2 = network1.createSite(siteInfo2);
NodeRef nodeRef1 = repoService.createDocument(site1.getContainerNodeRef(DOCUMENT_LIBRARY_CONTAINER_NAME), "Test Doc1", "Test Doc1 Title", "Test Doc1 Description", "Test Content");
nodes.add(nodeRef1);
NodeRef nodeRef2 = repoService.createDocument(site1.getContainerNodeRef(DOCUMENT_LIBRARY_CONTAINER_NAME), "Test Doc2", "Test Doc2 Title", "Test Doc2 Description", "Test Content");
nodes.add(nodeRef2);
NodeRef nodeRef3 = repoService.createDocument(site2.getContainerNodeRef(DOCUMENT_LIBRARY_CONTAINER_NAME), "Test Doc2", "Test Doc2 Title", "Test Doc2 Description", "Test Content");
nodes.add(nodeRef3);
repoService.createAssociation(nodeRef2, nodeRef1, ASSOC_ORIGINAL);
repoService.createAssociation(nodeRef3, nodeRef1, ASSOC_ORIGINAL);
site1.inviteToSite(person2Id, SiteRole.SiteCollaborator);
return null;
}
}, person1Id, network1.getId());
{
OperationContext cmisOperationCtxOverride = new OperationContextImpl();
cmisOperationCtxOverride.setIncludeRelationships(IncludeRelationships.BOTH);
publicApiClient.setRequestContext(new RequestContext(network1.getId(), person2Id, cmisOperationCtxOverride));
CmisSession cmisSession = publicApiClient.createPublicApiCMISSession(Binding.atom, CMIS_VERSION_10, AlfrescoObjectFactoryImpl.class.getName());
CmisObject o1 = cmisSession.getObject(nodes.get(0).getId());
List<Relationship> relationships = o1.getRelationships();
assertEquals(1, relationships.size());
Relationship r = relationships.get(0);
CmisObject source = r.getSource();
CmisObject target = r.getTarget();
String sourceVersionSeriesId = (String)source.getProperty(PropertyIds.VERSION_SERIES_ID).getFirstValue();
String targetVersionSeriesId = (String)target.getProperty(PropertyIds.VERSION_SERIES_ID).getFirstValue();
assertEquals(nodes.get(1).getId(), sourceVersionSeriesId);
assertEquals(nodes.get(0).getId(), targetVersionSeriesId);
}
}
开发者ID:Alfresco,项目名称:alfresco-remote-api,代码行数:59,代码来源:TestCMIS.java
注:本文中的org.apache.chemistry.opencmis.client.api.OperationContext类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论