本文整理汇总了Java中org.alfresco.service.cmr.audit.AuditService类的典型用法代码示例。如果您正苦于以下问题:Java AuditService类的具体用法?Java AuditService怎么用?Java AuditService使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
AuditService类属于org.alfresco.service.cmr.audit包,在下文中一共展示了AuditService类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: cleanupAuditData
import org.alfresco.service.cmr.audit.AuditService; //导入依赖的package包/类
protected void cleanupAuditData(final String auditApplicationName, final JobExecutionContext context)
{
final AuditService auditService = JobUtilities.getJobDataValue(context, "auditService", AuditService.class);
final String cutOffPeriodStr = JobUtilities.getJobDataValue(context, "cutOffPeriod", String.class);
final String timezoneStr = JobUtilities.getJobDataValue(context, "timezone", String.class, false);
final Period cutOffPeriod = Period.parse(cutOffPeriodStr);
final ZoneId zone = ZoneId.of(timezoneStr != null ? timezoneStr : "Z");
final ZonedDateTime now = LocalDateTime.now(ZoneId.of("Z")).atZone(zone);
final ZonedDateTime cutOffDate = now.minus(cutOffPeriod);
final long epochSecond = cutOffDate.toEpochSecond();
LOGGER.debug("Clearing all audit entries of application {} until {}", auditApplicationName, cutOffDate);
auditService.clearAudit(auditApplicationName, null, Long.valueOf(epochSecond));
}
开发者ID:Acosix,项目名称:alfresco-audit,代码行数:17,代码来源:AuditApplicationCleanupJob.java
示例2: findAuditAppById
import org.alfresco.service.cmr.audit.AuditService; //导入依赖的package包/类
private AuditService.AuditApplication findAuditAppById(String auditAppId)
{
AuditService.AuditApplication auditApp = null;
Map<String, AuditService.AuditApplication> auditApplicationsByName = auditService.getAuditApplications();
if (auditApplicationsByName != null)
{
for (AuditService.AuditApplication auditApplication : auditApplicationsByName.values())
{
if (auditApplication.getKey().equals("/" + auditAppId))
{
auditApp = auditApplication;
}
}
}
return auditApp;
}
开发者ID:Alfresco,项目名称:alfresco-remote-api,代码行数:17,代码来源:AuditImpl.java
示例3: update
import org.alfresco.service.cmr.audit.AuditService; //导入依赖的package包/类
@Override
public AuditApp update(String auditAppId, AuditApp auditApp, Parameters parameters)
{
checkEnabled();
AuditService.AuditApplication auditApplication = findAuditAppByIdOr404(auditAppId);
// Enable/Disable audit application
if (auditApp.getIsEnabled() && !auditApplication.isEnabled())
{
auditService.enableAudit(auditApplication.getName(), null);
}
else if (!auditApp.getIsEnabled() && auditApplication.isEnabled())
{
auditService.disableAudit(auditApplication.getName(), null);
}
return new AuditApp(auditApplication.getKey().substring(1), auditApplication.getName(), auditApp.getIsEnabled());
}
开发者ID:Alfresco,项目名称:alfresco-remote-api,代码行数:20,代码来源:AuditImpl.java
示例4: setup
import org.alfresco.service.cmr.audit.AuditService; //导入依赖的package包/类
@Before
public void setup() throws Exception
{
super.setup();
permissionService = applicationContext.getBean("permissionService", PermissionService.class);
authorityService = (AuthorityService) applicationContext.getBean("AuthorityService");
auditService = applicationContext.getBean("AuditService", AuditService.class);
AuditModelRegistryImpl auditModelRegistry = (AuditModelRegistryImpl) applicationContext.getBean("auditModel.modelRegistry");
// Register the test model
URL testModelUrl = ResourceUtils.getURL("classpath:alfresco/audit/alfresco-audit-access.xml");
auditModelRegistry.registerModel(testModelUrl);
auditModelRegistry.loadAuditModels();
}
开发者ID:Alfresco,项目名称:alfresco-remote-api,代码行数:17,代码来源:AuditAppTest.java
示例5: PersonConsolidationAuditWorker
import org.alfresco.service.cmr.audit.AuditService; //导入依赖的package包/类
protected PersonConsolidationAuditWorker(final NodeService nodeService, final AuditService auditService,
final AuditComponent auditComponent, final int timeframeHours)
{
this.nodeService = nodeService;
this.auditService = auditService;
this.auditComponent = auditComponent;
this.timeframeHours = timeframeHours;
}
开发者ID:Acosix,项目名称:alfresco-audit,代码行数:9,代码来源:ConsolidateActiveUsersAuditJob.java
示例6: getAuditApp
import org.alfresco.service.cmr.audit.AuditService; //导入依赖的package包/类
@Override
public AuditApp getAuditApp(String auditAppId, Parameters parameters)
{
checkEnabled();
AuditService.AuditApplication auditApplication = findAuditAppByIdOr404(auditAppId);
return new AuditApp(auditApplication.getKey().substring(1), auditApplication.getName(), auditApplication.isEnabled());
}
开发者ID:Alfresco,项目名称:alfresco-remote-api,代码行数:10,代码来源:AuditImpl.java
示例7: findAuditAppByIdOr404
import org.alfresco.service.cmr.audit.AuditService; //导入依赖的package包/类
private AuditService.AuditApplication findAuditAppByIdOr404(String auditAppId)
{
AuditService.AuditApplication auditApplication = findAuditAppById(auditAppId);
if (auditApplication == null)
{
throw new EntityNotFoundException(auditAppId);
}
return auditApplication;
}
开发者ID:Alfresco,项目名称:alfresco-remote-api,代码行数:12,代码来源:AuditImpl.java
示例8: getAuditApps
import org.alfresco.service.cmr.audit.AuditService; //导入依赖的package包/类
@Override
public CollectionWithPagingInfo<AuditApp> getAuditApps(Paging paging)
{
checkEnabled();
Map<String, AuditService.AuditApplication> auditApplicationsByName = auditService.getAuditApplications();
Set<String> audAppsName = new TreeSet<String>(auditApplicationsByName.keySet());
Iterator<String> audAppsNameIt = audAppsName.iterator();
int skipCount = paging.getSkipCount();
int maxItems = paging.getMaxItems();
int totalItems = audAppsName.size();
int end = skipCount + maxItems;
if (skipCount >= totalItems)
{
List<AuditApp> empty = Collections.emptyList();
return CollectionWithPagingInfo.asPaged(paging, empty, false, totalItems);
}
List<AuditApp> auditApps = new ArrayList<AuditApp>(totalItems);
int count = 0;
for (int i = 0; i < end && audAppsNameIt.hasNext(); i++)
{
String auditAppName = audAppsNameIt.next();
if (i < skipCount)
{
continue;
}
count++;
AuditApplication auditApplication = auditApplicationsByName.get(auditAppName);
auditApps.add(new AuditApp(auditApplication.getKey().substring(1), auditApplication.getName(), auditApplication.isEnabled()));
}
boolean hasMoreItems = (skipCount + count < totalItems);
return CollectionWithPagingInfo.asPaged(paging, auditApps, hasMoreItems, totalItems);
}
开发者ID:Alfresco,项目名称:alfresco-remote-api,代码行数:41,代码来源:AuditImpl.java
示例9: deleteAuditEntry
import org.alfresco.service.cmr.audit.AuditService; //导入依赖的package包/类
@Override
public void deleteAuditEntry(String auditAppId, long auditEntryId, Parameters parameters)
{
checkEnabled();
AuditService.AuditApplication auditApplication = findAuditAppByIdOr404(auditAppId);
int deleted = auditService.clearAuditByIdRange(auditApplication.getName(), auditEntryId, auditEntryId + 1);
if (deleted != 1)
{
throw new EntityNotFoundException("" + auditEntryId);
}
}
开发者ID:Alfresco,项目名称:alfresco-remote-api,代码行数:14,代码来源:AuditImpl.java
示例10: testGetApplications
import org.alfresco.service.cmr.audit.AuditService; //导入依赖的package包/类
@Test
public void testGetApplications(){
AuthenticationUtil.setAdminUserAsFullyAuthenticatedUser();
AuditService.AuditApplication auditApp = scriptAuditService.getApplications().entrySet().iterator().next().getValue();
Assert.assertTrue(auditApp.getKey().contains("/tagging"));
Assert.assertTrue(auditApp.getName().contains("Alfresco Tagging Service"));
Assert.assertTrue(auditApp.isEnabled()==true);
}
开发者ID:jgoldhammer,项目名称:alfresco-jscript-extensions,代码行数:11,代码来源:TestScriptAuditService.java
示例11: getAuditService
import org.alfresco.service.cmr.audit.AuditService; //导入依赖的package包/类
@Override
public AuditService getAuditService()
{
return (AuditService)getService(AUDIT_SERVICE);
}
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:6,代码来源:ServiceDescriptorRegistry.java
示例12: setAuditService
import org.alfresco.service.cmr.audit.AuditService; //导入依赖的package包/类
/**
* Sets the audit service.
*/
public void setAuditService(AuditService auditService)
{
this.auditService = auditService;
}
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:8,代码来源:CMISConnector.java
示例13: getAuditService
import org.alfresco.service.cmr.audit.AuditService; //导入依赖的package包/类
@Override
public AuditService getAuditService()
{
// A mock response
return null;
}
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:7,代码来源:MockedTestServiceRegistry.java
示例14: setUp
import org.alfresco.service.cmr.audit.AuditService; //导入依赖的package包/类
@Override
protected void setUp() throws Exception
{
// Detect any dangling transactions as there is a lot of direct UserTransaction manipulation
if (AlfrescoTransactionSupport.getTransactionReadState() != TxnReadState.TXN_NONE)
{
throw new IllegalStateException(
"There should not be any transactions when starting test: " +
AlfrescoTransactionSupport.getTransactionId() + " started at " +
new Date(AlfrescoTransactionSupport.getTransactionStartTime()));
}
// Get services
this.taggingService = (TaggingService)ctx.getBean("TaggingService");
this.nodeService = (NodeService) ctx.getBean("NodeService");
this.contentService = (ContentService) ctx.getBean("ContentService");
this.transactionService = (TransactionService)ctx.getBean("transactionComponent");
this.auditService = (AuditService)ctx.getBean("auditService");
this.authenticationComponent = (AuthenticationComponent)ctx.getBean("authenticationComponent");
this.executer = (ContentMetadataExtracter) ctx.getBean("extract-metadata");
executer.setEnableStringTagging(true);
executer.setTaggingService(taggingService);
if (init == false)
{
this.transactionService.getRetryingTransactionHelper().doInTransaction(new RetryingTransactionCallback<Void>(){
@Override
public Void execute() throws Throwable
{
// Authenticate as the system user
authenticationComponent.setSystemUserAsCurrentUser();
// Create the store and get the root node
ContentMetadataExtracterTagMappingTest.storeRef = nodeService.createStore(StoreRef.PROTOCOL_WORKSPACE, "Test_" + System.currentTimeMillis());
ContentMetadataExtracterTagMappingTest.rootNode = nodeService.getRootNode(ContentMetadataExtracterTagMappingTest.storeRef);
// Create the required tagging category
NodeRef catContainer = nodeService.createNode(ContentMetadataExtracterTagMappingTest.rootNode, ContentModel.ASSOC_CHILDREN, QName.createQName(NamespaceService.CONTENT_MODEL_1_0_URI, "categoryContainer"), ContentModel.TYPE_CONTAINER).getChildRef();
NodeRef catRoot = nodeService.createNode(
catContainer,
ContentModel.ASSOC_CHILDREN,
QName.createQName(NamespaceService.CONTENT_MODEL_1_0_URI, "categoryRoot"),
ContentModel.TYPE_CATEGORYROOT).getChildRef();
nodeService.createNode(
catRoot,
ContentModel.ASSOC_CATEGORIES,
ContentModel.ASPECT_TAGGABLE,
ContentModel.TYPE_CATEGORY).getChildRef();
MetadataExtracterRegistry registry = (MetadataExtracterRegistry) ctx.getBean("metadataExtracterRegistry");
extractor = new TagMappingMetadataExtracter();
extractor.setRegistry(registry);
extractor.register();
init = true;
return null;
}});
}
// We want to know when tagging actions have finished running
asyncOccurs = (new TaggingServiceImplTest()).new AsyncOccurs();
((PolicyComponent)ctx.getBean("policyComponent")).bindClassBehaviour(
AsynchronousActionExecutionQueuePolicies.OnAsyncActionExecute.QNAME,
ActionModel.TYPE_ACTION,
new JavaBehaviour(asyncOccurs, "onAsyncActionExecute", NotificationFrequency.EVERY_EVENT)
);
// We do want action tracking whenever the tag scope updater runs
UpdateTagScopesActionExecuter updateTagsAction =
(UpdateTagScopesActionExecuter)ctx.getBean("update-tagscope");
updateTagsAction.setTrackStatus(true);
}
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:77,代码来源:ContentMetadataExtracterTagMappingTest.java
示例15: setAuditService
import org.alfresco.service.cmr.audit.AuditService; //导入依赖的package包/类
/**
* @param auditService
* the auditService to set
*/
public void setAuditService(final AuditService auditService)
{
this.auditService = auditService;
}
开发者ID:Acosix,项目名称:alfresco-audit,代码行数:9,代码来源:AuditUserGet.java
示例16: consolidateActiveUsersAudit
import org.alfresco.service.cmr.audit.AuditService; //导入依赖的package包/类
protected void consolidateActiveUsersAudit(final JobExecutionContext context, final RetryingTransactionHelper retryingTransactionHelper)
{
final AuditService auditService = JobUtilities.getJobDataValue(context, "auditService", AuditService.class);
final AuditComponent auditComponent = JobUtilities.getJobDataValue(context, "auditComponent", AuditComponent.class);
final NamespaceService namespaceService = JobUtilities.getJobDataValue(context, "namespaceService", NamespaceService.class);
final NodeService nodeService = JobUtilities.getJobDataValue(context, "nodeService", NodeService.class);
final PersonService personService = JobUtilities.getJobDataValue(context, "personService", PersonService.class);
final SearchService searchService = JobUtilities.getJobDataValue(context, "searchService", SearchService.class);
final String workerThreadsParam = JobUtilities.getJobDataValue(context, "workerThreads", String.class, true);
final String batchSizeParam = JobUtilities.getJobDataValue(context, "batchSize", String.class, true);
final String timeframeHoursParam = JobUtilities.getJobDataValue(context, "timeframeHours", String.class, true);
final int workerThreads = workerThreadsParam != null ? Math.min(1, Integer.parseInt(workerThreadsParam, 10)) : 4;
final int batchSize = batchSizeParam != null ? Math.min(1, Integer.parseInt(batchSizeParam, 10)) : 10;
final int timeframeHours = timeframeHoursParam != null ? Integer.parseInt(timeframeHoursParam, 10) : 1;
if (timeframeHours <= 0)
{
throw new IllegalArgumentException("timeframeHours must be a positive integer");
}
if (timeframeHours > 24)
{
throw new IllegalArgumentException("timeframeHours cannot be greater than a day of 24 hours");
}
if (24 % timeframeHours != 0)
{
throw new IllegalArgumentException("Number of hours in a day must be divisible by timeframeHours");
}
final BatchProcessor<NodeRef> processor = new BatchProcessor<>(ConsolidateActiveUsersAuditJob.class.getName(),
retryingTransactionHelper, new PersonBatchWorkProvider(namespaceService, nodeService, personService, searchService),
workerThreads, batchSize, null, LogFactory.getLog(ConsolidateActiveUsersAuditJob.class.getName() + ".batchProcessor"),
Math.max(25, workerThreads * batchSize * 2));
final PersonConsolidationAuditWorker worker = new PersonConsolidationAuditWorker(nodeService, auditService, auditComponent,
timeframeHours);
processor.process(worker, true);
}
开发者ID:Acosix,项目名称:alfresco-audit,代码行数:42,代码来源:ConsolidateActiveUsersAuditJob.java
示例17: setAuditService
import org.alfresco.service.cmr.audit.AuditService; //导入依赖的package包/类
/**
* @param auditService the service that provides the actual data
*/
public void setAuditService(AuditService auditService)
{
this.auditService = auditService;
}
开发者ID:Alfresco,项目名称:alfresco-remote-api,代码行数:8,代码来源:AbstractAuditWebScript.java
示例18: setAuditService
import org.alfresco.service.cmr.audit.AuditService; //导入依赖的package包/类
public void setAuditService(AuditService auditService)
{
this.auditService = auditService;
}
开发者ID:Alfresco,项目名称:alfresco-remote-api,代码行数:5,代码来源:DiscoveryApiWebscript.java
示例19: listAuditEntries
import org.alfresco.service.cmr.audit.AuditService; //导入依赖的package包/类
@Override
public CollectionWithPagingInfo<AuditEntry> listAuditEntries(String auditAppId, Parameters parameters)
{
checkEnabled();
AuditService.AuditApplication auditApplication = findAuditAppByIdOr404(auditAppId);
// adding orderBy property
Pair<String, Boolean> sortProp = getAuditEntrySortProp(parameters);
Boolean forward = true;
if ((sortProp != null) && (sortProp.getFirst().equals(CREATED_AT)))
{
forward = sortProp.getSecond();
}
// Parse where clause properties.
List<AuditEntry> entriesAudit = new ArrayList<>();
Query q = parameters.getQuery();
// paging
Paging paging = parameters.getPaging();
int skipCount = paging.getSkipCount();
int maxItems = paging.getMaxItems();
int limit = skipCount + maxItems + 1; // to detect hasMoreItems
if (q != null)
{
// filtering via "where" clause
AuditEntryQueryWalker propertyWalker = new AuditEntryQueryWalker();
QueryHelper.walk(q, propertyWalker);
entriesAudit = getQueryResultAuditEntries(auditApplication, propertyWalker, parameters.getInclude(), limit, forward);
}
// clear null elements
entriesAudit.removeAll(Collections.singleton(null));
int totalItems = entriesAudit.size();
if (skipCount >= totalItems)
{
List<AuditEntry> empty = Collections.emptyList();
return CollectionWithPagingInfo.asPaged(paging, empty, false, totalItems);
}
else
{
int end = Math.min(limit - 1, totalItems);
boolean hasMoreItems = totalItems > end;
entriesAudit = entriesAudit.subList(skipCount, end);
return CollectionWithPagingInfo.asPaged(paging, entriesAudit, hasMoreItems, totalItems);
}
}
开发者ID:Alfresco,项目名称:alfresco-remote-api,代码行数:51,代码来源:AuditImpl.java
示例20: deleteAuditEntries
import org.alfresco.service.cmr.audit.AuditService; //导入依赖的package包/类
@Override
public void deleteAuditEntries(String auditAppId, Parameters parameters)
{
checkEnabled();
AuditService.AuditApplication auditApplication = findAuditAppByIdOr404(auditAppId);
Query q = parameters.getQuery();
if ((q == null) || (q.getTree() == null))
{
throw new InvalidArgumentException("where clause is required to delete audit entries (" + auditAppId + ")");
}
// delete via "where" clause
DeleteAuditEntriesQueryWalker walker = new DeleteAuditEntriesQueryWalker();
QueryHelper.walk(q, walker);
Long fromId = walker.getFromId();
Long toId = walker.getToId();
validateWhereBetween(auditAppId, fromId, toId);
Long fromTime = walker.getFromTime();
Long toTime = walker.getToTime();
validateWhereBetween(auditAppId, fromTime, toTime);
if ((fromId != null) && (fromTime != null))
{
throw new InvalidArgumentException("where clause is invalid - cannot specify both createdAt & id (" + auditAppId + ")");
}
if (fromId != null)
{
auditService.clearAuditByIdRange(auditApplication.getName(), fromId, toId); // ignore
// response
}
else if (fromTime != null)
{
auditService.clearAudit(auditApplication.getName(), fromTime, toTime); // ignore
// response
}
// return success (even if nothing is deleted)
}
开发者ID:Alfresco,项目名称:alfresco-remote-api,代码行数:46,代码来源:AuditImpl.java
注:本文中的org.alfresco.service.cmr.audit.AuditService类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论