use of org.craftercms.studio.api.v2.dal.AuditLog in project studio by craftercms.
the class StudioPublisherTask method generateWorkflowActivity.
protected void generateWorkflowActivity(String site, String environment, Set<String> packageIds, String username, String operation) throws SiteNotFoundException {
SiteFeed siteFeed = siteService.getSite(site);
AuditLog auditLog = auditServiceInternal.createAuditLogEntry();
auditLog.setOperation(operation);
auditLog.setActorId(username);
auditLog.setSiteId(siteFeed.getId());
auditLog.setPrimaryTargetId(site + ":" + environment);
auditLog.setPrimaryTargetType(TARGET_TYPE_CONTENT_ITEM);
auditLog.setPrimaryTargetValue(environment);
List<AuditLogParameter> auditLogParameters = new ArrayList<AuditLogParameter>();
for (String packageId : packageIds) {
AuditLogParameter auditLogParameter = new AuditLogParameter();
auditLogParameter.setTargetId(site + ":" + environment);
auditLogParameter.setTargetType(TARGET_TYPE_CONTENT_ITEM);
auditLogParameter.setTargetValue(packageId);
auditLogParameters.add(auditLogParameter);
}
auditLog.setParameters(auditLogParameters);
auditServiceInternal.insertAuditLog(auditLog);
}
use of org.craftercms.studio.api.v2.dal.AuditLog in project studio by craftercms.
the class AuditServiceInternalImpl method createAuditLogEntry.
@Override
public AuditLog createAuditLogEntry() {
AuditLog auditLog = new AuditLog();
String clusterNodeId = StringUtils.EMPTY;
HierarchicalConfiguration<ImmutableNode> clusterNodeData = studioConfiguration.getSubConfig(CLUSTERING_NODE_REGISTRATION);
if (clusterNodeData != null && !clusterNodeData.isEmpty()) {
clusterNodeId = clusterNodeData.getString(CLUSTER_MEMBER_LOCAL_ADDRESS);
}
auditLog.setOrganizationId(1);
auditLog.setOrigin(ORIGIN_API);
auditLog.setClusterNodeId(clusterNodeId);
return auditLog;
}
use of org.craftercms.studio.api.v2.dal.AuditLog in project studio by craftercms.
the class DashboardController method prepareAuditResult.
private List<AuditDashboardItem> prepareAuditResult(List<AuditLog> auditLogs) {
List<AuditDashboardItem> resultItems = new ArrayList<AuditDashboardItem>();
for (AuditLog auditLog : auditLogs) {
AuditDashboardItem item = new AuditDashboardItem();
item.setSiteId(auditLog.getSiteName());
item.setActor(auditLog.getActorId());
item.setOperation(auditLog.getOperation());
item.setOperationTimestamp(auditLog.getOperationTimestamp());
item.setTarget(auditLog.getPrimaryTargetValue());
resultItems.add(item);
}
return resultItems;
}
use of org.craftercms.studio.api.v2.dal.AuditLog in project studio by craftercms.
the class SiteServiceImpl method insertRemoveRemoteAuditLog.
private void insertRemoveRemoteAuditLog(String siteId, String remoteName) throws SiteNotFoundException {
SiteFeed siteFeed = getSite(siteId);
String user = securityService.getCurrentUser();
AuditLog auditLog = auditServiceInternal.createAuditLogEntry();
auditLog.setOperation(OPERATION_REMOVE_REMOTE);
auditLog.setActorId(user);
auditLog.setSiteId(siteFeed.getId());
auditLog.setPrimaryTargetId(remoteName);
auditLog.setPrimaryTargetType(TARGET_TYPE_REMOTE_REPOSITORY);
auditLog.setPrimaryTargetValue(remoteName);
auditServiceInternal.insertAuditLog(auditLog);
}
use of org.craftercms.studio.api.v2.dal.AuditLog in project studio by craftercms.
the class ContentServiceImpl method pushToRemote.
@Override
public boolean pushToRemote(String siteId, String remoteName, String remoteBranch) throws ServiceLayerException, InvalidRemoteUrlException, AuthenticationException, CryptoException {
if (!siteService.exists(siteId)) {
throw new SiteNotFoundException();
}
boolean toRet = _contentRepository.pushToRemote(siteId, remoteName, remoteBranch);
SiteFeed siteFeed = siteService.getSite(siteId);
AuditLog auditLog = auditServiceInternal.createAuditLogEntry();
auditLog.setOperation(OPERATION_PUSH_TO_REMOTE);
auditLog.setSiteId(siteFeed.getId());
auditLog.setActorId(userService.getCurrentUser().getUsername());
auditLog.setPrimaryTargetId(remoteName + "/" + remoteBranch);
auditLog.setPrimaryTargetType(TARGET_TYPE_REMOTE_REPOSITORY);
auditLog.setPrimaryTargetValue(remoteName + "/" + remoteBranch);
auditServiceInternal.insertAuditLog(auditLog);
return toRet;
}
Aggregations