use of com.enonic.xp.impl.server.rest.model.ReprocessContentResultJson in project xp by enonic.
the class ContentResource method reprocess.
@POST
@Path("reprocess")
@Deprecated
public ReprocessContentResultJson reprocess(final ReprocessContentRequestJson request) {
final List<ContentPath> updated = new ArrayList<>();
final List<String> errors = new ArrayList<>();
final Content content = this.contentService.getByPath(request.getSourceBranchPath().getContentPath());
try {
reprocessContent(content, request.isSkipChildren(), updated, errors);
} catch (Exception e) {
errors.add(String.format("Content '%s' - %s: %s", content.getPath().toString(), e.getClass().getCanonicalName(), e.getMessage()));
LOG.warn("Error reprocessing content [" + content.getPath() + "]", e);
}
return new ReprocessContentResultJson(ContentPaths.from(updated), errors);
}
use of com.enonic.xp.impl.server.rest.model.ReprocessContentResultJson in project xp by enonic.
the class ReprocessRunnableTask method run.
@Override
public void run(final TaskId id, final ProgressReporter progressReporter) {
final List<ContentPath> updated = new ArrayList<>();
final List<String> errors = new ArrayList<>();
final Content content = this.contentService.getByPath(params.getSourceBranchPath().getContentPath());
try {
if (!params.isSkipChildren()) {
String nodePath = CONTENT_ROOT_PATH.asAbsolute().toString();
final ContentPath contentPath = params.getSourceBranchPath().getContentPath();
if (!ContentPath.ROOT.equals(contentPath)) {
nodePath += content.getPath().asAbsolute().toString();
}
final ConstraintExpr pathExpr = CompareExpr.like(FieldExpr.from("_path"), ValueExpr.string(nodePath + "/*"));
final ContentQuery countChildren = ContentQuery.create().queryExpr(QueryExpr.from(pathExpr)).size(0).build();
total = (int) contentService.find(countChildren).getTotalHits() + 1;
}
reprocessContent(content, params.isSkipChildren(), updated, errors, progressReporter);
} catch (Exception e) {
errors.add(String.format("Content '%s' - %s: %s", content.getPath().toString(), e.getClass().getCanonicalName(), e.getMessage()));
LOG.warn("Error reprocessing content [" + content.getPath() + "]", e);
}
progressReporter.info(new ReprocessContentResultJson(ContentPaths.from(updated), errors).toString());
}
Aggregations