Fork me on GitHub

CPD Results

The following document contains the results of PMD's CPD 7.17.0.

Duplications

File Project Line
org/onehippo/forge/content/exim/repository/jaxrs/ContentEximExportService.java Hippo Content Export / Import Repository JAX-RS Services 91
org/onehippo/forge/content/exim/repository/jaxrs/ContentEximImportService.java Hippo Content Export / Import Repository JAX-RS Services 87
public Response exportContentToZip(@Context SecurityContext securityContext, @Context HttpServletRequest request,
            @Multipart(value = "batchSize", required = false) String batchSizeParam,
            @Multipart(value = "throttle", required = false) String throttleParam,
            @Multipart(value = "publishOnImport", required = false) String publishOnImportParam,
            @Multipart(value = "dataUrlSizeThreshold", required = false) String dataUrlSizeThresholdParam,
            @Multipart(value = "docbasePropNames", required = false) String docbasePropNamesParam,
            @Multipart(value = "documentTags", required = false) String documentTagsParam,
            @Multipart(value = "binaryTags", required = false) String binaryTagsParam,
            @Multipart(value = "paramsJson", required = false) String paramsJsonParam,
            @Multipart(value = "params", required = false) Attachment paramsAttachment) {
File Project Line
org/onehippo/forge/content/exim/repository/jaxrs/ContentEximImportService.java Hippo Content Export / Import Repository JAX-RS Services 337
org/onehippo/forge/content/exim/repository/jaxrs/ContentEximImportService.java Hippo Content Export / Import Repository JAX-RS Services 433
result.incrementFailedBinaryCount();
                    }
                    if (processStatus != null) {
                        // the remaining 5% for cleaning paths to convert those to uuids.
                        processStatus.setProgress(0.95 * ((double) batchCount) / ((double) jsonFiles.length));
                    }
                }
                ++batchCount;
                if (batchCount % params.getBatchSize() == 0) {
                    importTask.getDocumentManager().getSession().save();
                    importTask.getDocumentManager().getSession().refresh(false);
                    if (params.getThrottle() > 0) {
                        Thread.sleep(params.getThrottle());
                    }
                }
            }
        }

        importTask.getDocumentManager().getSession().save();
        importTask.getDocumentManager().getSession().refresh(false);

        return batchCount;
    }

    private int importDocuments(Logger procLogger, ProcessStatus processStatus, FileObject[] jsonFiles,
File Project Line
org/onehippo/forge/content/exim/repository/jaxrs/ContentEximExportService.java Hippo Content Export / Import Repository JAX-RS Services 328
org/onehippo/forge/content/exim/repository/jaxrs/ContentEximExportService.java Hippo Content Export / Import Repository JAX-RS Services 432
applyTagContentProperties(contentNode, params.getBinaryTags());

                String relPath = StringUtils.removeStart(ContentPathUtils.removeIndexNotationInNodePath(variantPath),
                        "/");
                FileObject file = baseFolder.resolveFile(relPath + ".json");
                record.setAttribute("file", file.getName().getPath());
                exportTask.writeContentNodeToJsonFile(contentNode, file);

                procLogger.debug("Exported document from {} to {}.", handlePath, file.getName().getPath());
                record.setSucceeded(true);
            } catch (Exception e) {
                procLogger.error("Failed to process record: {}", record, e);
                if (record != null) {
                    record.setErrorMessage(e.toString());
                }
            } finally {
                if (record != null) {
                    exportTask.endRecord();
                    result.incrementTotalBinaryCount();
File Project Line
org/onehippo/forge/content/exim/core/impl/DefaultBinaryImportTask.java Hippo Content Export / Import Core 43
org/onehippo/forge/content/exim/core/impl/WorkflowDocumentVariantImportTask.java Hippo Content Export / Import Core 45
public DefaultBinaryImportTask(final DocumentManager documentManager) {
        super(documentManager);
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public ContentNodeBindingItemFilter<ContentItem> getContentNodeBindingItemFilter() {
        if (contentNodeBindingItemFilter == null) {
            DefaultContentNodeJcrBindingItemFilter filter = new DefaultContentNodeJcrBindingItemFilter();
            filter.addPropertyPathExclude(Constants.META_PROP_NODE_LOCALIZED_NAME);
            filter.addPropertyPathExclude(Constants.META_PROP_NODE_PATH);
            filter.addPropertyPathExclude("hippostdpubwf:*");
            filter.addPropertyPathExclude("hippo:availability");
            filter.addPropertyPathExclude("hippo:paths");
            filter.addPropertyPathExclude("hippo:related");
            filter.addPropertyPathExclude("hippostd:holder");
            filter.addPropertyPathExclude("hippostd:state");
            filter.addPropertyPathExclude("hippostd:stateSummary");
            contentNodeBindingItemFilter = filter;
        }

        return contentNodeBindingItemFilter;
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public String createOrUpdateBinaryFolder(String folderLocation, String primaryTypeName, String[] folderTypes,
File Project Line
org/onehippo/forge/content/exim/repository/jaxrs/ContentEximExportService.java Hippo Content Export / Import Repository JAX-RS Services 125
org/onehippo/forge/content/exim/repository/jaxrs/ContentEximImportService.java Hippo Content Export / Import Repository JAX-RS Services 135
if (paramsAttachment != null) {
                final String json = attachmentToString(paramsAttachment, "UTF-8");
                if (StringUtils.isNotBlank(json)) {
                    params = getObjectMapper().readValue(json, ExecutionParams.class);
                }
            } else {
                if (StringUtils.isNotBlank(paramsJsonParam)) {
                    params = getObjectMapper().readValue(paramsJsonParam, ExecutionParams.class);
                }
            }
            overrideExecutionParamsByParameters(params, batchSizeParam, throttleParam, publishOnImportParam,
                    dataUrlSizeThresholdParam, docbasePropNamesParam, documentTagsParam, binaryTagsParam);

            if (processStatus != null) {
                processStatus.setExecutionParams(params);
            }
File Project Line
org/onehippo/forge/content/exim/repository/jaxrs/ContentEximImportService.java Hippo Content Export / Import Repository JAX-RS Services 259
org/onehippo/forge/content/exim/repository/jaxrs/ContentEximImportService.java Hippo Content Export / Import Repository JAX-RS Services 362
ExecutionParams params, FileObject baseFolder, DefaultBinaryImportTask importTask, Result result,
            int batchCount) throws Exception {
        final String baseFolderUrlPrefix = baseFolder.getURL().toString();
        final AntPathMatcher pathMatcher = new AntPathMatcher();

        for (FileObject file : jsonFiles) {
            if (isStopRequested(baseFolder)) {
                procLogger.info("Stop requested by file at {}/{}", baseFolder.getName().getPath(),
                        STOP_REQUEST_FILE_REL_PATH);
                break;
            }

            ContentNode contentNode = importTask.readContentNodeFromJsonFile(file);

            String primaryTypeName = contentNode.getPrimaryType();
            String path = contentNode.getProperty("jcr:path").getValue();

            if (!isBinaryPathIncluded(pathMatcher, params, path)) {