diff --git a/repository/src/main/java/org/alfresco/encryption/ReEncryptor.java b/repository/src/main/java/org/alfresco/encryption/ReEncryptor.java index 4ac6c7bb5b..6f3f0078ec 100644 --- a/repository/src/main/java/org/alfresco/encryption/ReEncryptor.java +++ b/repository/src/main/java/org/alfresco/encryption/ReEncryptor.java @@ -1,28 +1,28 @@ -/* - * #%L - * Alfresco Repository - * %% - * Copyright (C) 2005 - 2016 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ +/* + * #%L + * Alfresco Repository + * %% + * Copyright (C) 2005 - 2016 Alfresco Software Limited + * %% + * This file is part of the Alfresco software. + * If the software was purchased under a paid Alfresco license, the terms of + * the paid license agreement will prevail. Otherwise, the software is + * provided under the following open source license terms: + * + * Alfresco is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Alfresco is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with Alfresco. If not, see . + * #L% + */ package org.alfresco.encryption; import java.io.Serializable; @@ -241,6 +241,12 @@ public class ReEncryptor implements ApplicationContextAware return properties.size(); } + @Override + public long getTotalEstimatedWorkSizeLong() + { + return properties.size(); + } + @Override public Collection getNextWork() { diff --git a/repository/src/main/java/org/alfresco/opencmis/AlfrescoCmisServiceImpl.java b/repository/src/main/java/org/alfresco/opencmis/AlfrescoCmisServiceImpl.java index ccb4c812ed..a4aebf40d4 100644 --- a/repository/src/main/java/org/alfresco/opencmis/AlfrescoCmisServiceImpl.java +++ b/repository/src/main/java/org/alfresco/opencmis/AlfrescoCmisServiceImpl.java @@ -1959,6 +1959,12 @@ public class AlfrescoCmisServiceImpl extends AbstractCmisService implements Alfr return size; } + @Override + public synchronized long getTotalEstimatedWorkSizeLong() + { + return size; + } + @Override public synchronized Collection getNextWork() { diff --git a/repository/src/main/java/org/alfresco/repo/activities/feed/FeedNotifierImpl.java b/repository/src/main/java/org/alfresco/repo/activities/feed/FeedNotifierImpl.java index c502aea187..99979a8535 100644 --- a/repository/src/main/java/org/alfresco/repo/activities/feed/FeedNotifierImpl.java +++ b/repository/src/main/java/org/alfresco/repo/activities/feed/FeedNotifierImpl.java @@ -1,28 +1,28 @@ -/* - * #%L - * Alfresco Repository - * %% - * Copyright (C) 2005 - 2016 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ +/* + * #%L + * Alfresco Repository + * %% + * Copyright (C) 2005 - 2016 Alfresco Software Limited + * %% + * This file is part of the Alfresco software. + * If the software was purchased under a paid Alfresco license, the terms of + * the paid license agreement will prevail. Otherwise, the software is + * provided under the following open source license terms: + * + * Alfresco is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Alfresco is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with Alfresco. If not, see . + * #L% + */ package org.alfresco.repo.activities.feed; import java.util.Collection; @@ -427,6 +427,12 @@ public class FeedNotifierImpl implements FeedNotifier, ApplicationContextAware return personService.countPeople(); } + @Override + public long getTotalEstimatedWorkSizeLong() + { + return personService.countPeople(); + } + @Override public Collection getNextWork() { diff --git a/repository/src/main/java/org/alfresco/repo/activities/feed/local/LocalFeedGenerator.java b/repository/src/main/java/org/alfresco/repo/activities/feed/local/LocalFeedGenerator.java index e18f5d5fd2..aed73da56b 100644 --- a/repository/src/main/java/org/alfresco/repo/activities/feed/local/LocalFeedGenerator.java +++ b/repository/src/main/java/org/alfresco/repo/activities/feed/local/LocalFeedGenerator.java @@ -1,28 +1,28 @@ -/* - * #%L - * Alfresco Repository - * %% - * Copyright (C) 2005 - 2016 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ +/* + * #%L + * Alfresco Repository + * %% + * Copyright (C) 2005 - 2016 Alfresco Software Limited + * %% + * This file is part of the Alfresco software. + * If the software was purchased under a paid Alfresco license, the terms of + * the paid license agreement will prevail. Otherwise, the software is + * provided under the following open source license terms: + * + * Alfresco is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Alfresco is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with Alfresco. If not, see . + * #L% + */ package org.alfresco.repo.activities.feed.local; import java.util.ArrayList; @@ -155,13 +155,25 @@ public class LocalFeedGenerator extends AbstractFeedGenerator @Override public int getTotalEstimatedWorkSize() + { + return (int) calculateEstimatedWorkSize(); + } + + @Override + public long getTotalEstimatedWorkSizeLong() + { + return calculateEstimatedWorkSize(); + } + + private long calculateEstimatedWorkSize() { long size = maxSequence - minSequence + 1; long remain = size % batchSize; long workSize = (remain == 0) ? (size / batchSize) : (size / batchSize + 1); - return (int) workSize; + return workSize; } + @Override public Collection getNextWork() { diff --git a/repository/src/main/java/org/alfresco/repo/admin/patch/AbstractPatch.java b/repository/src/main/java/org/alfresco/repo/admin/patch/AbstractPatch.java index 0f477e8b7d..91d6e075db 100644 --- a/repository/src/main/java/org/alfresco/repo/admin/patch/AbstractPatch.java +++ b/repository/src/main/java/org/alfresco/repo/admin/patch/AbstractPatch.java @@ -1,28 +1,28 @@ -/* - * #%L - * Alfresco Repository - * %% - * Copyright (C) 2005 - 2016 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ +/* + * #%L + * Alfresco Repository + * %% + * Copyright (C) 2005 - 2016 Alfresco Software Limited + * %% + * This file is part of the Alfresco software. + * If the software was purchased under a paid Alfresco license, the terms of + * the paid license agreement will prevail. Otherwise, the software is + * provided under the following open source license terms: + * + * Alfresco is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Alfresco is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with Alfresco. If not, see . + * #L% + */ package org.alfresco.repo.admin.patch; import java.io.PrintWriter; @@ -486,6 +486,11 @@ public abstract class AbstractPatch implements Patch, ApplicationEventPublisher return tenants.size(); } + public long getTotalEstimatedWorkSizeLong() + { + return tenants.size(); + } + @Override public Collection getNextWork() { @@ -554,13 +559,13 @@ public abstract class AbstractPatch implements Patch, ApplicationEventPublisher logger.debug("batch worker finished processing id:" + id); } - if (batchProcessor.getTotalErrors() > 0) + if (batchProcessor.getTotalErrorsLong() > 0) { - sb.append("\n" + " and failure during update of tennants total success: " + batchProcessor.getSuccessfullyProcessedEntries() + " number of errors: " +batchProcessor.getTotalErrors() + " lastError" + batchProcessor.getLastError()); + sb.append("\n" + " and failure during update of tennants total success: " + batchProcessor.getSuccessfullyProcessedEntriesLong() + " number of errors: " +batchProcessor.getTotalErrorsLong() + " lastError" + batchProcessor.getLastError()); } else { - sb.append("\n" + " and successful batch update of " + batchProcessor.getTotalResults() + "tennants"); + sb.append("\n" + " and successful batch update of " + batchProcessor.getTotalResultsLong() + "tennants"); } } diff --git a/repository/src/main/java/org/alfresco/repo/admin/patch/impl/AddUnmovableAspectToSitesPatch.java b/repository/src/main/java/org/alfresco/repo/admin/patch/impl/AddUnmovableAspectToSitesPatch.java index 048669c3fd..c73f80011a 100755 --- a/repository/src/main/java/org/alfresco/repo/admin/patch/impl/AddUnmovableAspectToSitesPatch.java +++ b/repository/src/main/java/org/alfresco/repo/admin/patch/impl/AddUnmovableAspectToSitesPatch.java @@ -1,28 +1,28 @@ -/* - * #%L - * Alfresco Repository - * %% - * Copyright (C) 2005 - 2016 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ +/* + * #%L + * Alfresco Repository + * %% + * Copyright (C) 2005 - 2016 Alfresco Software Limited + * %% + * This file is part of the Alfresco software. + * If the software was purchased under a paid Alfresco license, the terms of + * the paid license agreement will prevail. Otherwise, the software is + * provided under the following open source license terms: + * + * Alfresco is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Alfresco is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with Alfresco. If not, see . + * #L% + */ package org.alfresco.repo.admin.patch.impl; import java.util.ArrayList; @@ -90,6 +90,12 @@ public class AddUnmovableAspectToSitesPatch extends AsynchronousPatch return sites.size(); } + @Override + public long getTotalEstimatedWorkSizeLong() + { + return sites.size(); + } + @Override public Collection getNextWork() { diff --git a/repository/src/main/java/org/alfresco/repo/admin/patch/impl/AliasableAspectPatch.java b/repository/src/main/java/org/alfresco/repo/admin/patch/impl/AliasableAspectPatch.java index 9ccff50492..c2ce1d2bd9 100644 --- a/repository/src/main/java/org/alfresco/repo/admin/patch/impl/AliasableAspectPatch.java +++ b/repository/src/main/java/org/alfresco/repo/admin/patch/impl/AliasableAspectPatch.java @@ -1,28 +1,28 @@ -/* - * #%L - * Alfresco Repository - * %% - * Copyright (C) 2005 - 2016 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ +/* + * #%L + * Alfresco Repository + * %% + * Copyright (C) 2005 - 2016 Alfresco Software Limited + * %% + * This file is part of the Alfresco software. + * If the software was purchased under a paid Alfresco license, the terms of + * the paid license agreement will prevail. Otherwise, the software is + * provided under the following open source license terms: + * + * Alfresco is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Alfresco is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with Alfresco. If not, see . + * #L% + */ package org.alfresco.repo.admin.patch.impl; import java.util.ArrayList; @@ -93,6 +93,11 @@ public class AliasableAspectPatch extends AbstractPatch return result.size(); } + public long getTotalEstimatedWorkSizeLong() + { + return result.size(); + } + public Collection getNextWork() { if(val != null) diff --git a/repository/src/main/java/org/alfresco/repo/admin/patch/impl/FixBpmPackagesPatch.java b/repository/src/main/java/org/alfresco/repo/admin/patch/impl/FixBpmPackagesPatch.java index 5a7fd056ca..4aa4d902dd 100644 --- a/repository/src/main/java/org/alfresco/repo/admin/patch/impl/FixBpmPackagesPatch.java +++ b/repository/src/main/java/org/alfresco/repo/admin/patch/impl/FixBpmPackagesPatch.java @@ -237,6 +237,12 @@ public class FixBpmPackagesPatch extends AbstractPatch return assocCount; } + @Override + public synchronized long getTotalEstimatedWorkSizeLong() + { + return assocCount; + } + @Override public synchronized Collection getNextWork() { diff --git a/repository/src/main/java/org/alfresco/repo/admin/patch/impl/ImapUnsubscribedAspectPatch.java b/repository/src/main/java/org/alfresco/repo/admin/patch/impl/ImapUnsubscribedAspectPatch.java index 497c70a62d..b243a45b34 100644 --- a/repository/src/main/java/org/alfresco/repo/admin/patch/impl/ImapUnsubscribedAspectPatch.java +++ b/repository/src/main/java/org/alfresco/repo/admin/patch/impl/ImapUnsubscribedAspectPatch.java @@ -1,28 +1,28 @@ -/* - * #%L - * Alfresco Repository - * %% - * Copyright (C) 2005 - 2016 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ +/* + * #%L + * Alfresco Repository + * %% + * Copyright (C) 2005 - 2016 Alfresco Software Limited + * %% + * This file is part of the Alfresco software. + * If the software was purchased under a paid Alfresco license, the terms of + * the paid license agreement will prevail. Otherwise, the software is + * provided under the following open source license terms: + * + * Alfresco is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Alfresco is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with Alfresco. If not, see . + * #L% + */ package org.alfresco.repo.admin.patch.impl; import java.util.ArrayList; @@ -76,6 +76,11 @@ public class ImapUnsubscribedAspectPatch extends AbstractPatch return result.size(); } + public long getTotalEstimatedWorkSizeLong() + { + return result.size(); + } + public Collection getNextWork() { result.clear(); diff --git a/repository/src/main/java/org/alfresco/repo/admin/patch/impl/RenameSiteAuthorityDisplayName.java b/repository/src/main/java/org/alfresco/repo/admin/patch/impl/RenameSiteAuthorityDisplayName.java index cfdd43f3ba..5532b924b1 100644 --- a/repository/src/main/java/org/alfresco/repo/admin/patch/impl/RenameSiteAuthorityDisplayName.java +++ b/repository/src/main/java/org/alfresco/repo/admin/patch/impl/RenameSiteAuthorityDisplayName.java @@ -1,28 +1,28 @@ -/* - * #%L - * Alfresco Repository - * %% - * Copyright (C) 2005 - 2016 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ +/* + * #%L + * Alfresco Repository + * %% + * Copyright (C) 2005 - 2016 Alfresco Software Limited + * %% + * This file is part of the Alfresco software. + * If the software was purchased under a paid Alfresco license, the terms of + * the paid license agreement will prevail. Otherwise, the software is + * provided under the following open source license terms: + * + * Alfresco is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Alfresco is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with Alfresco. If not, see . + * #L% + */ package org.alfresco.repo.admin.patch.impl; import java.util.ArrayList; @@ -143,6 +143,12 @@ public class RenameSiteAuthorityDisplayName extends AbstractPatch { return siteInfos.size(); } + + @Override + public long getTotalEstimatedWorkSizeLong() + { + return siteInfos.size(); + } @Override public Collection getNextWork() diff --git a/repository/src/main/java/org/alfresco/repo/admin/patch/impl/SurfConfigFolderPatch.java b/repository/src/main/java/org/alfresco/repo/admin/patch/impl/SurfConfigFolderPatch.java index d0efcf862b..5edca887ab 100644 --- a/repository/src/main/java/org/alfresco/repo/admin/patch/impl/SurfConfigFolderPatch.java +++ b/repository/src/main/java/org/alfresco/repo/admin/patch/impl/SurfConfigFolderPatch.java @@ -1,28 +1,28 @@ -/* - * #%L - * Alfresco Repository - * %% - * Copyright (C) 2005 - 2016 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ +/* + * #%L + * Alfresco Repository + * %% + * Copyright (C) 2005 - 2016 Alfresco Software Limited + * %% + * This file is part of the Alfresco software. + * If the software was purchased under a paid Alfresco license, the terms of + * the paid license agreement will prevail. Otherwise, the software is + * provided under the following open source license terms: + * + * Alfresco is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Alfresco is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with Alfresco. If not, see . + * #L% + */ package org.alfresco.repo.admin.patch.impl; @@ -449,6 +449,12 @@ public class SurfConfigFolderPatch extends AsynchronousPatch @Override public synchronized int getTotalEstimatedWorkSize() + { + return (int)getTotalEstimatedWorkSizeLong(); + } + + @Override + public synchronized long getTotalEstimatedWorkSizeLong() { if (maxId == Long.MAX_VALUE) { @@ -459,6 +465,7 @@ public class SurfConfigFolderPatch extends AsynchronousPatch } } return 0; + } @Override diff --git a/repository/src/main/java/org/alfresco/repo/batch/BatchMonitor.java b/repository/src/main/java/org/alfresco/repo/batch/BatchMonitor.java index 6cefca7459..f3c9b45e1e 100644 --- a/repository/src/main/java/org/alfresco/repo/batch/BatchMonitor.java +++ b/repository/src/main/java/org/alfresco/repo/batch/BatchMonitor.java @@ -1,28 +1,28 @@ -/* - * #%L - * Alfresco Repository - * %% - * Copyright (C) 2005 - 2016 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ +/* + * #%L + * Alfresco Repository + * %% + * Copyright (C) 2005 - 2016 Alfresco Software Limited + * %% + * This file is part of the Alfresco software. + * If the software was purchased under a paid Alfresco license, the terms of + * the paid license agreement will prevail. Otherwise, the software is + * provided under the following open source license terms: + * + * Alfresco is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Alfresco is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with Alfresco. If not, see . + * #L% + */ package org.alfresco.repo.batch; import java.util.Date; @@ -50,10 +50,10 @@ public interface BatchMonitor /** * Gets the total number of results. - * + * @deprecated use {@link #getTotalResultsLong()} instead * @return the total number of results */ - public int getTotalResults(); + @Deprecated public int getTotalResults(); /** * Gets the ID of the entry being processed @@ -64,10 +64,10 @@ public interface BatchMonitor /** * Gets the number of successfully processed entries. - * + * @deprecated use {@link #getSuccessfullyProcessedEntriesLong()} instead * @return the successfully processed entries */ - public int getSuccessfullyProcessedEntries(); + @Deprecated public int getSuccessfullyProcessedEntries(); /** * Gets the progress expressed as a percentage. @@ -78,10 +78,10 @@ public interface BatchMonitor /** * Gets the total number of errors. - * + * @deprecated use {@link #getTotalErrorsLong()} instead * @return the total number of errors */ - public int getTotalErrors(); + @Deprecated public int getTotalErrors(); /** * Gets the stack trace of the last error. @@ -103,4 +103,35 @@ public interface BatchMonitor * @return the end time */ public Date getEndTime(); + + /** + * Gets the total number of results. + * + * @return the total number of results + */ + public default long getTotalResultsLong() + { + throw new UnsupportedOperationException("getTotalResultsLong need to be implemented"); + + } + + /** + * Gets the total number of errors. + * + * @return the total number of errors + */ + public default long getTotalErrorsLong() + { + throw new UnsupportedOperationException("getTotalErrorsLong need to be implemented"); + } + + /** + * Gets the number of successfully processed entries. + * + * @return the successfully processed entries + */ + public default long getSuccessfullyProcessedEntriesLong() + { + throw new UnsupportedOperationException("getSuccessfullyProcessedEntriesLong need to be implemented"); + } } diff --git a/repository/src/main/java/org/alfresco/repo/batch/BatchProcessWorkProvider.java b/repository/src/main/java/org/alfresco/repo/batch/BatchProcessWorkProvider.java index 11b609ccab..b98cf9c0d9 100644 --- a/repository/src/main/java/org/alfresco/repo/batch/BatchProcessWorkProvider.java +++ b/repository/src/main/java/org/alfresco/repo/batch/BatchProcessWorkProvider.java @@ -43,10 +43,10 @@ public interface BatchProcessWorkProvider * Instances can provide accurate answers on each call, but only if the answer can be * provided quickly and efficiently; usually it is enough to to cache the result after * providing an initial estimate. - * + * @deprecated use {@link #getTotalEstimatedWorkSizeLong()} instead. * @return a total work size estimate */ - int getTotalEstimatedWorkSize(); + @Deprecated int getTotalEstimatedWorkSize(); /** * Get the next lot of work for the batch processor. Implementations should return @@ -58,4 +58,18 @@ public interface BatchProcessWorkProvider * if there is no more work remaining. */ Collection getNextWork(); + + /** + * Get an estimate of the total number of objects that will be provided by this instance. + * Instances can provide accurate answers on each call, but only if the answer can be + * provided quickly and efficiently; usually it is enough to to cache the result after + * providing an initial estimate. + * + * @return a total work size estimate + */ + default long getTotalEstimatedWorkSizeLong() + { + throw new UnsupportedOperationException("getTotalEstimatedWorkSizeLong need to implemented"); + } + } diff --git a/repository/src/main/java/org/alfresco/repo/batch/BatchProcessor.java b/repository/src/main/java/org/alfresco/repo/batch/BatchProcessor.java index aa9199ca96..28573e5c97 100644 --- a/repository/src/main/java/org/alfresco/repo/batch/BatchProcessor.java +++ b/repository/src/main/java/org/alfresco/repo/batch/BatchProcessor.java @@ -110,10 +110,10 @@ public class BatchProcessor implements BatchMonitor private String lastErrorEntryId; /** The total number of errors. */ - private int totalErrors; + private long totalErrors; /** The number of successfully processed entries. */ - private int successfullyProcessedEntries; + private long successfullyProcessedEntries; /** The start time. */ private Date startTime; @@ -280,7 +280,15 @@ public class BatchProcessor implements BatchMonitor /** * {@inheritDoc} */ - public synchronized int getSuccessfullyProcessedEntries() + @Deprecated public synchronized int getSuccessfullyProcessedEntries() + { + return Math.toIntExact(this.successfullyProcessedEntries); + } + + /** + * {@inheritDoc} + */ + public synchronized long getSuccessfullyProcessedEntriesLong() { return this.successfullyProcessedEntries; } @@ -290,8 +298,8 @@ public class BatchProcessor implements BatchMonitor */ public synchronized String getPercentComplete() { - int totalResults = this.workProvider.getTotalEstimatedWorkSize(); - int processed = this.successfullyProcessedEntries + this.totalErrors; + long totalResults = this.workProvider.getTotalEstimatedWorkSizeLong(); + long processed = this.successfullyProcessedEntries + this.totalErrors; return processed <= totalResults ? NumberFormat.getPercentInstance().format( totalResults == 0 ? 1.0F : (float) processed / totalResults) : "Unknown"; } @@ -299,7 +307,23 @@ public class BatchProcessor implements BatchMonitor /** * {@inheritDoc} */ - public synchronized int getTotalErrors() + @Deprecated public synchronized int getTotalErrors() + { + return Math.toIntExact(this.totalErrors); + } + + /** + * {@inheritDoc} + */ + @Deprecated public int getTotalResults() + { + return this.workProvider.getTotalEstimatedWorkSize(); + } + + /** + * {@inheritDoc} + */ + public synchronized long getTotalErrorsLong() { return this.totalErrors; } @@ -307,9 +331,9 @@ public class BatchProcessor implements BatchMonitor /** * {@inheritDoc} */ - public int getTotalResults() + public long getTotalResultsLong() { - return this.workProvider.getTotalEstimatedWorkSize(); + return this.workProvider.getTotalEstimatedWorkSizeLong(); } /** @@ -340,12 +364,42 @@ public class BatchProcessor implements BatchMonitor * increased performance. If false, all invocations are performed in the current * transaction. This is required if calling synchronously (e.g. in response to an authentication event in * the same transaction). + * @deprecated use {@link #processLong(BatchProcessWorker, boolean)} instead * @return the number of invocations */ @SuppressWarnings("serial") - public int process(final BatchProcessWorker worker, final boolean splitTxns) + @Deprecated public int process(final BatchProcessWorker worker, final boolean splitTxns) { int count = workProvider.getTotalEstimatedWorkSize(); + return (int)process(worker, splitTxns, count); + + } + + /** + * Invokes the worker for each entry in the collection, managing transactions and collating success / failure + * information. + * + * @param worker + * the worker + * @param splitTxns + * Can the modifications to Alfresco be split across multiple transactions for maximum performance? If + * true, worker invocations are isolated in separate transactions in batches for + * increased performance. If false, all invocations are performed in the current + * transaction. This is required if calling synchronously (e.g. in response to an authentication event in + * the same transaction). + * @return the number of invocations + */ + @SuppressWarnings("serial") + public long processLong(final BatchProcessWorker worker, final boolean splitTxns) + { + long count = workProvider.getTotalEstimatedWorkSizeLong(); + return process(worker, splitTxns, count); + + } + + + private long process(final BatchProcessWorker worker, final boolean splitTxns, long count) + { synchronized (this) { this.startTime = new Date(); @@ -365,27 +419,27 @@ public class BatchProcessor implements BatchMonitor // Create a thread pool executor with the specified number of threads and a finite blocking queue of jobs ExecutorService executorService = splitTxns && this.workerThreads > 1 ? - new ThreadPoolExecutor( - this.workerThreads, this.workerThreads, 0L, TimeUnit.MILLISECONDS, - new ArrayBlockingQueue(this.workerThreads * this.batchSize * 10) - { - // Add blocking behaviour to work queue - @Override - public boolean offer(Runnable o) - { - try - { - put(o); - } - catch (InterruptedException e) - { - return false; - } - return true; - } + new ThreadPoolExecutor( + this.workerThreads, this.workerThreads, 0L, TimeUnit.MILLISECONDS, + new ArrayBlockingQueue(this.workerThreads * this.batchSize * 10) + { + // Add blocking behaviour to work queue + @Override + public boolean offer(Runnable o) + { + try + { + put(o); + } + catch (InterruptedException e) + { + return false; + } + return true; + } - }, - threadFactory) : null; + }, + threadFactory) : null; try { Iterator iterator = new WorkProviderIterator(this.workProvider); @@ -402,7 +456,7 @@ public class BatchProcessor implements BatchMonitor { batch = new ArrayList(this.batchSize); } - + if (executorService == null) { callback.run(); @@ -447,13 +501,12 @@ public class BatchProcessor implements BatchMonitor if (this.totalErrors > 0 && this.logger.isErrorEnabled()) { this.logger.error(getProcessName() + ": " + this.totalErrors - + " error(s) detected. Last error from entry \"" + this.lastErrorEntryId + "\"", - this.lastError); + + " error(s) detected. Last error from entry \"" + this.lastErrorEntryId + "\"", + this.lastError); } } } } - /** * Reports the current progress. * @@ -464,12 +517,20 @@ public class BatchProcessor implements BatchMonitor */ private synchronized void reportProgress(boolean last) { - int processed = this.successfullyProcessedEntries + this.totalErrors; + long processed = this.successfullyProcessedEntries + this.totalErrors; if (processed % this.loggingInterval == 0 ^ last) { StringBuilder message = new StringBuilder(100).append(getProcessName()).append(": Processed ").append( processed).append(" entries"); - int totalResults = this.workProvider.getTotalEstimatedWorkSize(); + long totalResults = 0; + try + { + totalResults = this.workProvider.getTotalEstimatedWorkSizeLong(); + } + catch (UnsupportedOperationException uoe) + { + totalResults = this.workProvider.getTotalEstimatedWorkSize(); + } if (totalResults >= processed) { message.append(" out of ").append(totalResults).append(". ").append( @@ -830,11 +891,11 @@ public class BatchProcessor implements BatchMonitor { if (this.txnErrors > 0) { - int processed = BatchProcessor.this.successfullyProcessedEntries + BatchProcessor.this.totalErrors; - int currentIncrement = processed % BatchProcessor.this.loggingInterval; - int newErrors = BatchProcessor.this.totalErrors + this.txnErrors; + long processed = BatchProcessor.this.successfullyProcessedEntries + BatchProcessor.this.totalErrors; + long currentIncrement = processed % BatchProcessor.this.loggingInterval; + long newErrors = BatchProcessor.this.totalErrors + this.txnErrors; // Work out the number of logging intervals we will cross and report them - int intervals = (this.txnErrors + currentIncrement) / BatchProcessor.this.loggingInterval; + long intervals = (this.txnErrors + currentIncrement) / BatchProcessor.this.loggingInterval; if (intervals > 0) { BatchProcessor.this.totalErrors += BatchProcessor.this.loggingInterval - currentIncrement; @@ -850,11 +911,11 @@ public class BatchProcessor implements BatchMonitor if (this.txnSuccesses > 0) { - int processed = BatchProcessor.this.successfullyProcessedEntries + BatchProcessor.this.totalErrors; - int currentIncrement = processed % BatchProcessor.this.loggingInterval; - int newSuccess = BatchProcessor.this.successfullyProcessedEntries + this.txnSuccesses; + long processed = BatchProcessor.this.successfullyProcessedEntries + BatchProcessor.this.totalErrors; + long currentIncrement = processed % BatchProcessor.this.loggingInterval; + long newSuccess = BatchProcessor.this.successfullyProcessedEntries + this.txnSuccesses; // Work out the number of logging intervals we will cross and report them - int intervals = (this.txnSuccesses + currentIncrement) / BatchProcessor.this.loggingInterval; + long intervals = (this.txnSuccesses + currentIncrement) / BatchProcessor.this.loggingInterval; if (intervals > 0) { BatchProcessor.this.successfullyProcessedEntries += BatchProcessor.this.loggingInterval diff --git a/repository/src/main/java/org/alfresco/repo/bulkimport/impl/StripingFilesystemTracker.java b/repository/src/main/java/org/alfresco/repo/bulkimport/impl/StripingFilesystemTracker.java index 44f1252128..5ac930afb4 100644 --- a/repository/src/main/java/org/alfresco/repo/bulkimport/impl/StripingFilesystemTracker.java +++ b/repository/src/main/java/org/alfresco/repo/bulkimport/impl/StripingFilesystemTracker.java @@ -1,20 +1,20 @@ /* - * #%L - * Alfresco Repository - * %% - * Copyright (C) 2005 - 2016 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Alfresco is distributed in the hope that it will be useful, + * #%L + * Alfresco Repository + * %% + * Copyright (C) 2005 - 2016 Alfresco Software Limited + * %% + * This file is part of the Alfresco software. + * If the software was purchased under a paid Alfresco license, the terms of + * the paid license agreement will prevail. Otherwise, the software is + * provided under the following open source license terms: + * + * Alfresco is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Alfresco is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. @@ -195,6 +195,12 @@ public class StripingFilesystemTracker extends AbstractFilesystemTracker return count(); } + @Override + public long getTotalEstimatedWorkSizeLong() + { + return count(); + } + @Override public Collection getNextWork() { diff --git a/repository/src/main/java/org/alfresco/repo/domain/permissions/FixedAclUpdater.java b/repository/src/main/java/org/alfresco/repo/domain/permissions/FixedAclUpdater.java index a100f55b74..9ad0a3cb60 100644 --- a/repository/src/main/java/org/alfresco/repo/domain/permissions/FixedAclUpdater.java +++ b/repository/src/main/java/org/alfresco/repo/domain/permissions/FixedAclUpdater.java @@ -241,9 +241,14 @@ public class FixedAclUpdater extends TransactionListenerAdapter implements Appli @Override public int getTotalEstimatedWorkSize() { - int workSize = getNodesWithAspects.getWorkSize(); - return workSize; + return (int)getTotalEstimatedWorkSizeLong(); } + @Override + public long getTotalEstimatedWorkSizeLong() + { + return getNodesWithAspects.getWorkSize(); + } + @Override public Collection getNextWork() diff --git a/repository/src/main/java/org/alfresco/repo/node/archive/NodeArchiveServiceImpl.java b/repository/src/main/java/org/alfresco/repo/node/archive/NodeArchiveServiceImpl.java index cd19b400f5..4d6692ea71 100644 --- a/repository/src/main/java/org/alfresco/repo/node/archive/NodeArchiveServiceImpl.java +++ b/repository/src/main/java/org/alfresco/repo/node/archive/NodeArchiveServiceImpl.java @@ -244,6 +244,15 @@ public class NodeArchiveServiceImpl implements NodeArchiveService { return 0; } + + /** + * @return Returns 0, always + */ + public synchronized long getTotalEstimatedWorkSizeLong() + { + return 0; + } + public synchronized Collection getNextWork() { if (vmShutdownLister.isVmShuttingDown()) diff --git a/repository/src/main/java/org/alfresco/repo/node/db/NodeStringLengthWorker.java b/repository/src/main/java/org/alfresco/repo/node/db/NodeStringLengthWorker.java index 693ef1afdf..cdf3178ab6 100644 --- a/repository/src/main/java/org/alfresco/repo/node/db/NodeStringLengthWorker.java +++ b/repository/src/main/java/org/alfresco/repo/node/db/NodeStringLengthWorker.java @@ -1,28 +1,28 @@ -/* - * #%L - * Alfresco Repository - * %% - * Copyright (C) 2005 - 2016 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ +/* + * #%L + * Alfresco Repository + * %% + * Copyright (C) 2005 - 2016 Alfresco Software Limited + * %% + * This file is part of the Alfresco software. + * If the software was purchased under a paid Alfresco license, the terms of + * the paid license agreement will prevail. Otherwise, the software is + * provided under the following open source license terms: + * + * Alfresco is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Alfresco is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with Alfresco. If not, see . + * #L% + */ package org.alfresco.repo.node.db; import java.util.Collection; @@ -240,6 +240,12 @@ public class NodeStringLengthWorker implements ApplicationContextAware return -1; } + @Override + public long getTotalEstimatedWorkSizeLong() + { + return -1; + } + @Override public Collection getNextWork() { diff --git a/repository/src/main/java/org/alfresco/repo/security/authentication/UpgradePasswordHashWorker.java b/repository/src/main/java/org/alfresco/repo/security/authentication/UpgradePasswordHashWorker.java index 4558953155..2d0203713e 100644 --- a/repository/src/main/java/org/alfresco/repo/security/authentication/UpgradePasswordHashWorker.java +++ b/repository/src/main/java/org/alfresco/repo/security/authentication/UpgradePasswordHashWorker.java @@ -1,28 +1,28 @@ -/* - * #%L - * Alfresco Repository - * %% - * Copyright (C) 2005 - 2016 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ +/* + * #%L + * Alfresco Repository + * %% + * Copyright (C) 2005 - 2016 Alfresco Software Limited + * %% + * This file is part of the Alfresco software. + * If the software was purchased under a paid Alfresco license, the terms of + * the paid license agreement will prevail. Otherwise, the software is + * provided under the following open source license terms: + * + * Alfresco is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Alfresco is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with Alfresco. If not, see . + * #L% + */ package org.alfresco.repo.security.authentication; import java.io.Serializable; @@ -403,6 +403,15 @@ public class UpgradePasswordHashWorker implements ApplicationContextAware, Initi return (int)totalUserCount; } + @Override + public long getTotalEstimatedWorkSizeLong() + { + // execute a query to get total number of user nodes in the system. + long totalUserCount = patchDAO.getCountNodesWithTypId(ContentModel.TYPE_USER); + + return totalUserCount; + } + @Override public Collection getNextWork() { diff --git a/repository/src/main/java/org/alfresco/repo/security/person/HomeFolderProviderSynchronizer.java b/repository/src/main/java/org/alfresco/repo/security/person/HomeFolderProviderSynchronizer.java index dcc0db4d5c..010614d4e5 100644 --- a/repository/src/main/java/org/alfresco/repo/security/person/HomeFolderProviderSynchronizer.java +++ b/repository/src/main/java/org/alfresco/repo/security/person/HomeFolderProviderSynchronizer.java @@ -1,28 +1,28 @@ -/* - * #%L - * Alfresco Repository - * %% - * Copyright (C) 2005 - 2016 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ +/* + * #%L + * Alfresco Repository + * %% + * Copyright (C) 2005 - 2016 Alfresco Software Limited + * %% + * This file is part of the Alfresco software. + * If the software was purchased under a paid Alfresco license, the terms of + * the paid license agreement will prevail. Otherwise, the software is + * provided under the following open source license terms: + * + * Alfresco is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Alfresco is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with Alfresco. If not, see . + * #L% + */ package org.alfresco.repo.security.person; import java.util.ArrayList; @@ -320,8 +320,8 @@ public class HomeFolderProviderSynchronizer extends AbstractLifecycleBean threadCount, peoplePerTransaction, null, batchLogger, 100); - processor.process(worker, true); - if (processor.getTotalErrors() > 0) + processor.processLong(worker, true); + if (processor.getTotalErrorsLong() > 0) { logger.info(" -- Give up after error --"); break; @@ -874,6 +874,12 @@ public class HomeFolderProviderSynchronizer extends AbstractLifecycleBean return size; } + @Override + public synchronized long getTotalEstimatedWorkSizeLong() + { + return size; + } + @Override public synchronized Collection getNextWork() { diff --git a/repository/src/main/java/org/alfresco/tools/RenameUser.java b/repository/src/main/java/org/alfresco/tools/RenameUser.java index 9ccd101a8c..af2eb5ac5a 100644 --- a/repository/src/main/java/org/alfresco/tools/RenameUser.java +++ b/repository/src/main/java/org/alfresco/tools/RenameUser.java @@ -1,28 +1,28 @@ -/* - * #%L - * Alfresco Repository - * %% - * Copyright (C) 2005 - 2016 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ +/* + * #%L + * Alfresco Repository + * %% + * Copyright (C) 2005 - 2016 Alfresco Software Limited + * %% + * This file is part of the Alfresco software. + * If the software was purchased under a paid Alfresco license, the terms of + * the paid license agreement will prevail. Otherwise, the software is + * provided under the following open source license terms: + * + * Alfresco is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Alfresco is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with Alfresco. If not, see . + * #L% + */ package org.alfresco.tools; import java.io.BufferedReader; @@ -59,13 +59,13 @@ import org.alfresco.service.transaction.TransactionService; import org.alfresco.util.VmShutdownListener; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; - -/** - * Rename user tool. This tool provides minimal support for renaming users. - * See {@link #displayHelp} message for restrictions. - *
- * Usage: renameUser -user username [options] oldUsername newUsername");
- *        renameUser -user username [options] -file filename");
+
+/**
+ * Rename user tool. This tool provides minimal support for renaming users.
+ * See {@link #displayHelp} message for restrictions.
+ * 
+ * Usage: renameUser -user username [options] oldUsername newUsername");
+ *        renameUser -user username [options] -file filename");
  * 
* The csv file has a simple comma separated list, with * a pair of usernames on each line. Comments and blank @@ -549,6 +549,12 @@ public class RenameUser extends Tool return size; } + @Override + public synchronized long getTotalEstimatedWorkSizeLong() + { + return size; + } + @Override public synchronized Collection getNextWork() {