Package org.zanata.async.handle

Examples of org.zanata.async.handle.CopyVersionTaskHandle


    private Identity identity;

    public void startCopyVersion(String projectSlug, String versionSlug,
            String newVersionSlug) {
        CopyVersionKey key = CopyVersionKey.getKey(projectSlug, newVersionSlug);
        CopyVersionTaskHandle handle = new CopyVersionTaskHandle();
        asyncTaskHandleManager.registerTaskHandle(handle, key);
        copyVersionServiceImpl.startCopyVersion(projectSlug, versionSlug,
                newVersionSlug, handle);
    }
View Full Code Here


                newVersionSlug, handle);
    }

    public void cancelCopyVersion(String projectSlug, String versionSlug) {
        if (isCopyVersionRunning(projectSlug, versionSlug)) {
            CopyVersionTaskHandle handle =
                    getCopyVersionProcessHandle(projectSlug, versionSlug);
            handle.cancel(true);
            handle.setCancelledTime(System.currentTimeMillis());
            handle.setCancelledBy(identity.getCredentials().getUsername());

            log.info("Copy version cancelled- {}:{}", projectSlug, versionSlug);
        }
    }
View Full Code Here

        return (CopyVersionTaskHandle) asyncTaskHandleManager
                .getHandleByKey(CopyVersionKey.getKey(projectSlug, versionSlug));
    }

    public boolean isCopyVersionRunning(String projectSlug, String versionSlug) {
        CopyVersionTaskHandle handle =
                getCopyVersionProcessHandle(projectSlug, versionSlug);
        return handle != null && !handle.isDone();
    }
View Full Code Here

                    versionSlug);
        }

        @Override
        public String getCompletedPercentage() {
            CopyVersionTaskHandle handle = getHandle();
            if (handle != null) {
                double completedPercent =
                        (double) handle.getCurrentProgress() / (double) handle
                                .getMaxProgress() * 100;
                return PERCENT_FORMAT.format(completedPercent);
            } else {
                return "0";
            }
View Full Code Here

                return "0";
            }
        }

        public int getProcessedDocuments() {
            CopyVersionTaskHandle handle = getHandle();
            if (handle != null) {
                return handle.getDocumentCopied();
            }
            return 0;
        }
View Full Code Here

            }
            return 0;
        }

        public int getTotalDocuments() {
            CopyVersionTaskHandle handle = getHandle();
            if (handle != null) {
                return handle.getTotalDoc();
            }
            return 0;
        }
View Full Code Here

                .isCopyVersionRunning(projectSlug, versionSlug);
    }

    public String
            getCopiedDocumentCount(String projectSlug, String versionSlug) {
        CopyVersionTaskHandle handler =
                copyVersionManager.getCopyVersionProcessHandle(projectSlug,
                        versionSlug);

        if (handler == null) {
            return "0";
        } else {
            return String.valueOf(handler.getDocumentCopied());
        }
    }
View Full Code Here

                msgs.format("jsf.copyVersion.Cancelled", versionSlug));
    }

    public String getCopyVersionCompletePercent(String projectSlug,
            String versionSlug) {
        CopyVersionTaskHandle handler =
                copyVersionManager.getCopyVersionProcessHandle(projectSlug,
                        versionSlug);

        if (handler != null) {
            double completedPercent =
                    (double) handler.getCurrentProgress() / (double) handler
                            .getMaxProgress() * 100;
            if (Double.compare(completedPercent, 100) == 0) {
                conversationScopeMessages.setMessage(
                        FacesMessage.SEVERITY_INFO,
                        msgs.format("jsf.copyVersion.Completed", versionSlug));
View Full Code Here

        }
    }

    public String getCopyVersionTotalDocuments(String projectSlug,
            String versionSlug) {
        CopyVersionTaskHandle handler =
                copyVersionManager.getCopyVersionProcessHandle(projectSlug,
                        versionSlug);

        if (handler == null) {
            return "0";
        } else {
            return String.valueOf(handler.getTotalDoc());
        }
    }
View Full Code Here

                newVersionSlug);

        insertTextFlowAndTargetToDoc(existingDoc, tfCount, false);

        spyService.copyVersion(existingProjectSlug, existingVersionSlug,
                newVersionSlug, new CopyVersionTaskHandle());

        int expectedTfBatchRuns =
                (tfCount / spyService.TF_BATCH_SIZE)
                        + (tfCount % spyService.TF_BATCH_SIZE == 0 ? 0 : 1);
View Full Code Here

TOP

Related Classes of org.zanata.async.handle.CopyVersionTaskHandle

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.