use of org.craftercms.studio.api.v1.to.DmDependencyTO in project studio by craftercms.
the class WorkflowServiceImpl method goLivepackage.
protected void goLivepackage(String site, SubmitPackage submitpackage, DmDependencyTO dmDependencyTO, boolean isNotScheduled, SubmitPackage dependencyPackage, String approver, Set<String> rescheduledUris, Set<String> processedUris) {
if (!processedUris.contains(dmDependencyTO.getUri())) {
handleReferences(site, submitpackage, dmDependencyTO, isNotScheduled, dependencyPackage, approver, rescheduledUris, processedUris);
List<DmDependencyTO> children = dmDependencyTO.getChildren();
if (children != null) {
for (DmDependencyTO child : children) {
handleReferences(site, submitpackage, child, isNotScheduled, dependencyPackage, approver, rescheduledUris, processedUris);
goLivepackage(site, submitpackage, child, isNotScheduled, dependencyPackage, approver, rescheduledUris, processedUris);
}
}
processedUris.add(dmDependencyTO.getUri());
}
}
use of org.craftercms.studio.api.v1.to.DmDependencyTO in project studio by craftercms.
the class WorkflowServiceImpl method reject.
protected void reject(String site, List<DmDependencyTO> submittedItems, String reason, String approver) {
if (submittedItems != null) {
// and only submit the top level items to workflow
for (DmDependencyTO dmDependencyTO : submittedItems) {
DependencyRules rule = new DependencyRules(site);
rule.setContentService(contentService);
rule.setObjectStateService(objectStateService);
rejectThisAndReferences(site, dmDependencyTO, rule, approver, reason);
List<DmDependencyTO> children = dmDependencyTO.getChildren();
if (children != null) {
for (DmDependencyTO child : children) {
rejectThisAndReferences(site, child, rule, approver, reason);
}
}
}
if (!submittedItems.isEmpty()) {
// for some reason , submittedItems.get(0).getSubmittedBy() returns empty and
// metadata for the same value is also empty , using last modify to blame the rejection.
final ItemMetadata metaData = objectMetadataManager.getProperties(site, submittedItems.get(0).getUri());
// worst case, we need someone to blame.
String whoToBlame = "admin";
if (metaData != null && StringUtils.isNotBlank(metaData.getModifier())) {
whoToBlame = metaData.getModifier();
}
notificationService.notifyContentRejection(site, whoToBlame, getDeploymentPaths(submittedItems), reason, approver, Locale.ENGLISH);
}
}
// TODO: send the reason to the user
}
use of org.craftercms.studio.api.v1.to.DmDependencyTO in project studio by craftercms.
the class DependencyRules method applySubmitRule.
public Set<DmDependencyTO> applySubmitRule(DmDependencyTO submittedItem) {
Set<DmDependencyTO> dependencies = new HashSet<DmDependencyTO>();
if (submittedItem.getDocuments() != null) {
for (DmDependencyTO document : submittedItem.getDocuments()) {
if (objectStateService.isUpdatedOrNew(site, document.getUri())) {
document.setNow(submittedItem.isNow());
document.setScheduledDate(submittedItem.getScheduledDate());
document.setSubmitted(true);
dependencies.add(document);
}
Set<DmDependencyTO> dependencyTOSet = applySubmitRule(document);
dependencies.addAll(dependencyTOSet);
}
}
// get components
if (submittedItem.getComponents() != null) {
for (DmDependencyTO component : submittedItem.getComponents()) {
if (objectStateService.isUpdatedOrNew(site, component.getUri())) {
component.setNow(submittedItem.isNow());
component.setScheduledDate(submittedItem.getScheduledDate());
component.setSubmitted(true);
dependencies.add(component);
}
Set<DmDependencyTO> dependencyTOSet = applySubmitRule(component);
dependencies.addAll(dependencyTOSet);
}
}
// get assets
if (submittedItem.getAssets() != null) {
for (DmDependencyTO asset : submittedItem.getAssets()) {
if (objectStateService.isUpdatedOrNew(site, asset.getUri())) {
dependencies.add(asset);
asset.setNow(submittedItem.isNow());
asset.setScheduledDate(submittedItem.getScheduledDate());
asset.setSubmitted(true);
}
Set<DmDependencyTO> dependencyTOSet = applySubmitRule(asset);
dependencies.addAll(dependencyTOSet);
}
}
// get templates
if (submittedItem.getRenderingTemplates() != null) {
for (DmDependencyTO template : submittedItem.getRenderingTemplates()) {
if (objectStateService.isUpdatedOrNew(site, template.getUri())) {
dependencies.add(template);
template.setNow(submittedItem.isNow());
template.setScheduledDate(submittedItem.getScheduledDate());
template.setSubmitted(true);
}
Set<DmDependencyTO> dependencyTOSet = applySubmitRule(template);
dependencies.addAll(dependencyTOSet);
}
}
// get level descriptors
if (submittedItem.getLevelDescriptors() != null) {
for (DmDependencyTO ld : submittedItem.getLevelDescriptors()) {
if (objectStateService.isUpdatedOrNew(site, ld.getUri())) {
dependencies.add(ld);
ld.setNow(submittedItem.isNow());
ld.setScheduledDate(submittedItem.getScheduledDate());
ld.setSubmitted(true);
}
Set<DmDependencyTO> dependencyTOSet = applySubmitRule(ld);
dependencies.addAll(dependencyTOSet);
}
}
// get pages
if (submittedItem.getPages() != null) {
for (DmDependencyTO page : submittedItem.getPages()) {
if (objectStateService.isNew(site, page.getUri())) {
page.setNow(submittedItem.isNow());
page.setScheduledDate(submittedItem.getScheduledDate());
page.setSubmitted(true);
dependencies.add(page);
}
Set<DmDependencyTO> childPages = applySubmitRule(page);
dependencies.addAll(childPages);
}
}
return dependencies;
}
Aggregations