本文整理汇总了Java中org.alfresco.service.cmr.audit.AuditQueryParameters类的典型用法代码示例。如果您正苦于以下问题:Java AuditQueryParameters类的具体用法?Java AuditQueryParameters怎么用?Java AuditQueryParameters使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
AuditQueryParameters类属于org.alfresco.service.cmr.audit包,在下文中一共展示了AuditQueryParameters类的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: testAuditDeleteEntriesForApplication
import org.alfresco.service.cmr.audit.AuditQueryParameters; //导入依赖的package包/类
/**
* Ensure that only the correct application's audit entries are deleted.
* @throws Exception
*/
public void testAuditDeleteEntriesForApplication() throws Exception
{
final String app1 = doAuditEntryImpl(6);
final String app2 = doAuditEntryImpl(18);
final AuditQueryCallbackImpl resultsCallback = new AuditQueryCallbackImpl();
RetryingTransactionCallback<Void> deletedCallback = new RetryingTransactionCallback<Void>()
{
public Void execute() throws Throwable
{
Long app1Id = auditDAO.getAuditApplication(app1).getId();
auditDAO.deleteAuditEntries(app1Id, null, null);
// There should be no entries for app1
// but still entries for app2
auditDAO.findAuditEntries(resultsCallback, new AuditQueryParameters(), Integer.MAX_VALUE);
assertEquals("All entries should have been deleted from app1", 0, resultsCallback.numEntries(app1));
assertEquals("No entries should have been deleted from app2", 18, resultsCallback.numEntries(app2));
return null;
}
};
txnHelper.doInTransaction(deletedCallback);
}
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:28,代码来源:AuditDAOTest.java
示例2: createAuditParameters
import org.alfresco.service.cmr.audit.AuditQueryParameters; //导入依赖的package包/类
private AuditQueryParameters createAuditParameters(String appName,
String user, Long fromTime, Long toTime, Boolean forward) {
final AuditQueryParameters params = new AuditQueryParameters();
if (forward != null) {
params.setForward(forward);
}
if (StringUtils.isNotBlank(appName)) {
params.setApplicationName(appName);
}
if (StringUtils.isNotBlank(user)) {
params.setUser(user);
}
if (fromTime != null) {
params.setFromTime(fromTime);
}
if (toTime != null) {
params.setToTime(toTime);
}
return params;
}
开发者ID:jgoldhammer,项目名称:alfresco-jscript-extensions,代码行数:26,代码来源:ScriptAuditService.java
示例3: auditQuery
import org.alfresco.service.cmr.audit.AuditQueryParameters; //导入依赖的package包/类
/**
* {@inheritDoc}
*/
public void auditQuery(AuditQueryCallback callback, AuditQueryParameters parameters, int maxResults)
{
ParameterCheck.mandatory("callback", callback);
ParameterCheck.mandatory("parameters", parameters);
// Shortcuts
if (parameters.isZeroResultQuery())
{
return;
}
auditDAO.findAuditEntries(callback, parameters, maxResults);
}
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:17,代码来源:AuditComponentImpl.java
示例4: queryAuditLog
import org.alfresco.service.cmr.audit.AuditQueryParameters; //导入依赖的package包/类
/**
* Query the audit log as 'admin'
*/
private void queryAuditLog(final AuditQueryCallback callback, final AuditQueryParameters parameters, final int maxResults)
{
RunAsWork<Void> work = new RunAsWork<Void>()
{
@Override
public Void doWork() throws Exception
{
auditService.auditQuery(callback, parameters, maxResults);
return null;
}
};
AuthenticationUtil.runAs(work, AuthenticationUtil.getAdminRoleName());
}
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:17,代码来源:AuditComponentTest.java
示例5: testMaxResults
import org.alfresco.service.cmr.audit.AuditQueryParameters; //导入依赖的package包/类
public void testMaxResults() throws Exception
{
try
{
AuditQueryCallbackImpl callback = new AuditQueryCallbackImpl();
auditDAO.findAuditEntries(callback, new AuditQueryParameters(), -1);
fail("maxResults == -1 should be disallowed");
}
catch(IllegalArgumentException e)
{
// ok
}
}
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:14,代码来源:AuditDAOTest.java
示例6: queryAuditLog
import org.alfresco.service.cmr.audit.AuditQueryParameters; //导入依赖的package包/类
/**
* Clearn the audit log as 'admin'
*/
private void queryAuditLog(final AuditQueryCallback callback, final AuditQueryParameters parameters, final int maxResults)
{
RunAsWork<Void> work = new RunAsWork<Void>()
{
@Override
public Void doWork() throws Exception
{
auditService.auditQuery(callback, parameters, maxResults);
return null;
}
};
AuthenticationUtil.runAs(work, AuthenticationUtil.getAdminRoleName());
}
开发者ID:Alfresco,项目名称:community-edition-old,代码行数:17,代码来源:AuditComponentTest.java
示例7: auditQuery
import org.alfresco.service.cmr.audit.AuditQueryParameters; //导入依赖的package包/类
/**
* {@inheritDoc}
* @since 3.3
*/
public void auditQuery(AuditQueryCallback callback, AuditQueryParameters parameters, int maxResults)
{
auditComponent.auditQuery(callback, parameters, maxResults);
}
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:9,代码来源:AuditServiceImpl.java
示例8: getContentChanges
import org.alfresco.service.cmr.audit.AuditQueryParameters; //导入依赖的package包/类
/**
* Returns content changes.
*/
public ObjectList getContentChanges(Holder<String> changeLogToken, BigInteger maxItems)
{
final ObjectListImpl result = new ObjectListImpl();
result.setObjects(new ArrayList<ObjectData>());
EntryIdCallback changeLogCollectingCallback = new EntryIdCallback(true)
{
@Override
public boolean handleAuditEntry(Long entryId, String user, long time, Map<String, Serializable> values)
{
result.getObjects().addAll(createChangeEvents(time, values));
return super.handleAuditEntry(entryId, user, time, values);
}
};
Long from = null;
if ((changeLogToken != null) && (changeLogToken.getValue() != null))
{
try
{
from = Long.parseLong(changeLogToken.getValue());
}
catch (NumberFormatException e)
{
throw new CmisInvalidArgumentException("Invalid change log token: " + changeLogToken);
}
}
AuditQueryParameters params = new AuditQueryParameters();
params.setApplicationName(CMIS_CHANGELOG_AUDIT_APPLICATION);
params.setForward(true);
params.setFromId(from);
// So we have a BigInteger. We need to ensure that we cut it down to an integer smaller than Integer.MAX_VALUE
int maxResults = (maxItems == null ? contentChangesDefaultMaxItems : maxItems.intValue());
maxResults = maxResults < 1 ? contentChangesDefaultMaxItems : maxResults; // Just a double check of the unbundled contents
maxResults = maxResults > contentChangesDefaultMaxItems ? contentChangesDefaultMaxItems : maxResults; // cut it down
int queryFor = maxResults + 1; // Query for 1 more so that we know if there are more results
auditService.auditQuery(changeLogCollectingCallback, params, queryFor);
String newChangeLogToken = null;
// Check if we got more than the client requested
if (result.getObjects().size() >= maxResults)
{
// Build the change log token from the last item
StringBuilder clt = new StringBuilder();
newChangeLogToken = (from == null ? clt.append(maxItems.intValue() + 1).toString() : clt.append(from.longValue() + maxItems.intValue()).toString()); // TODO: Make this readable
// Remove extra item that was not actually requested
result.getObjects().remove(result.getObjects().size() - 1).getId();
// Note to client that there are more items
result.setHasMoreItems(true);
}
else
{
// We got the same or fewer than the number requested, so there are no more items
result.setHasMoreItems(false);
}
if (changeLogToken != null)
{
changeLogToken.setValue(newChangeLogToken);
}
return result;
}
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:71,代码来源:CMISConnector.java
示例9: createRepositoryInfo
import org.alfresco.service.cmr.audit.AuditQueryParameters; //导入依赖的package包/类
/**
* Creates the repository info object.
*/
private RepositoryInfo createRepositoryInfo(CmisVersion cmisVersion)
{
Descriptor currentDescriptor = descriptorService.getCurrentRepositoryDescriptor();
// get change token
boolean auditEnabled = auditService.isAuditEnabled(CMIS_CHANGELOG_AUDIT_APPLICATION, "/"
+ CMIS_CHANGELOG_AUDIT_APPLICATION);
String latestChangeLogToken = null;
if (auditEnabled)
{
EntryIdCallback auditQueryCallback = new EntryIdCallback(false);
AuditQueryParameters params = new AuditQueryParameters();
params.setApplicationName(CMIS_CHANGELOG_AUDIT_APPLICATION);
params.setForward(false);
auditService.auditQuery(auditQueryCallback, params, 1);
String entryId = auditQueryCallback.getEntryId();
// MNT-13529
// add initial change log token
latestChangeLogToken = entryId == null ? "0" : entryId;
}
// compile repository info
RepositoryInfoImpl ri = new RepositoryInfoImpl();
ri.setId(currentDescriptor.getId());
ri.setName(currentDescriptor.getName());
ri.setDescription(currentDescriptor.getName());
ri.setVendorName("Alfresco");
ri.setProductName("Alfresco " + descriptorService.getServerDescriptor().getEdition());
ri.setProductVersion(currentDescriptor.getVersion());
NodeRef rootNodeRef = getRootNodeRef();
ri.setRootFolder(constructObjectId(rootNodeRef, null));
ri.setCmisVersion(cmisVersion);
ri.setChangesIncomplete(true);
ri.setChangesOnType(Arrays.asList(new BaseTypeId[] { BaseTypeId.CMIS_DOCUMENT, BaseTypeId.CMIS_FOLDER }));
ri.setLatestChangeLogToken(latestChangeLogToken);
ri.setPrincipalAnonymous(AuthenticationUtil.getGuestUserName());
ri.setPrincipalAnyone(PermissionService.ALL_AUTHORITIES);
RepositoryCapabilitiesImpl repCap = new RepositoryCapabilitiesImpl();
ri.setCapabilities(repCap);
repCap.setAllVersionsSearchable(false);
repCap.setCapabilityAcl(CapabilityAcl.MANAGE);
repCap.setCapabilityChanges(auditEnabled ? CapabilityChanges.OBJECTIDSONLY : CapabilityChanges.NONE);
repCap.setCapabilityContentStreamUpdates(CapabilityContentStreamUpdates.ANYTIME);
repCap.setCapabilityJoin(CapabilityJoin.NONE);
repCap.setCapabilityQuery(CapabilityQuery.BOTHCOMBINED);
repCap.setCapabilityRendition(CapabilityRenditions.READ);
repCap.setIsPwcSearchable(false);
repCap.setIsPwcUpdatable(true);
repCap.setSupportsGetDescendants(true);
repCap.setSupportsGetFolderTree(true);
repCap.setSupportsMultifiling(true);
repCap.setSupportsUnfiling(false);
repCap.setSupportsVersionSpecificFiling(false);
AclCapabilitiesDataImpl aclCap = new AclCapabilitiesDataImpl();
ri.setAclCapabilities(aclCap);
aclCap.setAclPropagation(AclPropagation.PROPAGATE);
aclCap.setSupportedPermissions(SupportedPermissions.BOTH);
aclCap.setPermissionDefinitionData(repositoryPermissions);
aclCap.setPermissionMappingData(permissionMappings);
return ri;
}
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:73,代码来源:CMISConnector.java
示例10: testAuditDeleteEntriesForApplicationBetweenTimes
import org.alfresco.service.cmr.audit.AuditQueryParameters; //导入依赖的package包/类
/**
* Ensure that an application's audit entries can be deleted between 2 times.
* @throws Exception
*/
public void testAuditDeleteEntriesForApplicationBetweenTimes() throws Exception
{
RetryingTransactionCallback<Void> deletedCallback = new RetryingTransactionCallback<Void>()
{
AuditQueryCallbackImpl preDeleteCallback = new AuditQueryCallbackImpl();
AuditQueryCallbackImpl resultsCallback = new AuditQueryCallbackImpl();
public Void execute() throws Throwable
{
AuditApplicationInfo info1 = createAuditApp();
String app1 = info1.getName();
Long app1Id = info1.getId();
AuditApplicationInfo info2 = createAuditApp();
String app2 = info2.getName();
// Create items 10, 11, 12, 13, 14 for application 1
// Create items 21, 22 for application 2
createItem(info1, 10);
createItem(info1, 11);
Thread.sleep(10); // stop previous statements being executed during t1
Thread.sleep(10);
final long t1 = System.currentTimeMillis();
Thread.sleep(10);
Thread.sleep(10);
createItem(info2, 21);
createItem(info1, 12);
createItem(info1, 13);
Thread.sleep(10);
Thread.sleep(10);
final long t2 = System.currentTimeMillis();
Thread.sleep(10); // stop next statements being executed during t2
Thread.sleep(10);
createItem(info2, 22);
createItem(info1, 14);
auditDAO.findAuditEntries(preDeleteCallback, new AuditQueryParameters(), Integer.MAX_VALUE);
assertEquals(5, preDeleteCallback.numEntries(app1));
assertEquals(2, preDeleteCallback.numEntries(app2));
auditDAO.deleteAuditEntries(app1Id, t1, t2);
auditDAO.findAuditEntries(resultsCallback, new AuditQueryParameters(), Integer.MAX_VALUE);
assertEquals("Two entries should have been deleted from app1", 3, resultsCallback.numEntries(app1));
assertEquals("No entries should have been deleted from app2", 2, resultsCallback.numEntries(app2));
return null;
}
};
txnHelper.doInTransaction(deletedCallback);
}
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:56,代码来源:AuditDAOTest.java
示例11: testAuditDeleteEntriesBetweenTimes
import org.alfresco.service.cmr.audit.AuditQueryParameters; //导入依赖的package包/类
/**
* Ensure audit entries can be deleted between two times - for all applications.
* @throws Exception
*/
public void testAuditDeleteEntriesBetweenTimes() throws Exception
{
RetryingTransactionCallback<Void> deletedCallback = new RetryingTransactionCallback<Void>()
{
AuditQueryCallbackImpl preDeleteCallback = new AuditQueryCallbackImpl();
AuditQueryCallbackImpl resultsCallback = new AuditQueryCallbackImpl();
public Void execute() throws Throwable
{
AuditApplicationInfo info1 = createAuditApp();
String app1 = info1.getName();
AuditApplicationInfo info2 = createAuditApp();
String app2 = info2.getName();
// Create items 10, 11, 12, 13, 14 for application 1
// Create items 21, 22 for application 2
createItem(info1, 10);
createItem(info1, 11);
Thread.sleep(10);
Thread.sleep(10); // stop previous statements being executed during t1
final long t1 = System.currentTimeMillis();
Thread.sleep(10);
Thread.sleep(10);
createItem(info2, 21);
createItem(info1, 12);
createItem(info1, 13);
Thread.sleep(10);
Thread.sleep(10);
final long t2 = System.currentTimeMillis();
Thread.sleep(10); // stop next statements being executed during t2
Thread.sleep(10);
createItem(info2, 22);
createItem(info1, 14);
auditDAO.findAuditEntries(preDeleteCallback, new AuditQueryParameters(), Integer.MAX_VALUE);
assertEquals(5, preDeleteCallback.numEntries(app1));
assertEquals(2, preDeleteCallback.numEntries(app2));
// Delete audit entries between times - for all applications.
auditDAO.deleteAuditEntries(null, t1, t2);
auditDAO.findAuditEntries(resultsCallback, new AuditQueryParameters(), Integer.MAX_VALUE);
assertEquals("Two entries should have been deleted from app1", 3, resultsCallback.numEntries(app1));
assertEquals("One entry should have been deleted from app2", 1, resultsCallback.numEntries(app2));
return null;
}
};
txnHelper.doInTransaction(deletedCallback);
}
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:55,代码来源:AuditDAOTest.java
示例12: getContentChanges
import org.alfresco.service.cmr.audit.AuditQueryParameters; //导入依赖的package包/类
/**
* Returns content changes.
*/
public ObjectList getContentChanges(Holder<String> changeLogToken, BigInteger maxItems)
{
final ObjectListImpl result = new ObjectListImpl();
result.setObjects(new ArrayList<ObjectData>());
EntryIdCallback changeLogCollectingCallback = new EntryIdCallback(true)
{
@Override
public boolean handleAuditEntry(Long entryId, String user, long time, Map<String, Serializable> values)
{
result.getObjects().addAll(createChangeEvents(time, values));
return super.handleAuditEntry(entryId, user, time, values);
}
};
Long from = null;
if ((changeLogToken != null) && (changeLogToken.getValue() != null))
{
try
{
from = Long.parseLong(changeLogToken.getValue());
}
catch (NumberFormatException e)
{
throw new CmisInvalidArgumentException("Invalid change log token: " + changeLogToken);
}
}
AuditQueryParameters params = new AuditQueryParameters();
params.setApplicationName(CMIS_CHANGELOG_AUDIT_APPLICATION);
params.setForward(true);
params.setFromId(from);
int maxResults = (maxItems == null ? 0 : maxItems.intValue());
maxResults = (maxResults < 1 ? 0 : maxResults + 1);
auditService.auditQuery(changeLogCollectingCallback, params, maxResults);
String newChangeLogToken = null;
if (maxResults > 0)
{
if (result.getObjects().size() >= maxResults)
{
StringBuilder clt = new StringBuilder();
newChangeLogToken = (from == null ? clt.append(maxItems.intValue() + 1).toString() : clt.append(from.longValue() + maxItems.intValue()).toString());
result.getObjects().remove(result.getObjects().size() - 1).getId();
result.setHasMoreItems(true);
}
else
{
result.setHasMoreItems(false);
}
}
if (changeLogToken != null)
{
changeLogToken.setValue(newChangeLogToken);
}
return result;
}
开发者ID:Alfresco,项目名称:community-edition-old,代码行数:65,代码来源:CMISConnector.java
示例13: auditQuery
import org.alfresco.service.cmr.audit.AuditQueryParameters; //导入依赖的package包/类
/**
* Find audit entries using the given parameters
*
* @param callback the data callback per entry
* @param parameters the parameters for the query (may not be <tt>null</tt>)
* @param maxResults the maximum number of results to retrieve (must be greater than 0)
*
* @throws IllegalArgumentException if maxResults less or equal to zero
*
* @since 3.2
*/
void auditQuery(AuditQueryCallback callback, AuditQueryParameters parameters, int maxResults);
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:13,代码来源:AuditComponent.java
示例14: auditQuery
import org.alfresco.service.cmr.audit.AuditQueryParameters; //导入依赖的package包/类
/**
* Find audit entries using the given parameters
*
* @param callback the data callback per entry
* @param parameters the parameters for the query (may not be <tt>null</tt>)
* @param maxResults the maximum number of results to retrieve (zero or negative to ignore)
*
* @since 3.2
*/
void auditQuery(AuditQueryCallback callback, AuditQueryParameters parameters, int maxResults);
开发者ID:Alfresco,项目名称:community-edition-old,代码行数:11,代码来源:AuditComponent.java
注:本文中的org.alfresco.service.cmr.audit.AuditQueryParameters类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论