001/* 002 * (C) Copyright 2015 Nuxeo SA (http://nuxeo.com/) and contributors. 003 * 004 * All rights reserved. This program and the accompanying materials 005 * are made available under the terms of the GNU Lesser General Public License 006 * (LGPL) version 2.1 which accompanies this distribution, and is available at 007 * http://www.gnu.org/licenses/lgpl-2.1.html 008 * 009 * This library is distributed in the hope that it will be useful, 010 * but WITHOUT ANY WARRANTY; without even the implied warranty of 011 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 012 * Lesser General Public License for more details. 013 * 014 * Contributors: 015 * Antoine Taillefer <ataillefer@nuxeo.com> 016 */ 017package org.nuxeo.ecm.core.uidgen; 018 019/** 020 * @since 7.4 021 */ 022public abstract class AbstractUIDSequencer implements UIDSequencer { 023 024 protected String name; 025 026 @Override 027 public abstract void init(); 028 029 @Override 030 public abstract int getNext(String key); 031 032 @Override 033 public abstract void dispose(); 034 035 @Override 036 public String getName() { 037 return name; 038 } 039 040 @Override 041 public void setName(String name) { 042 this.name = name; 043 } 044 045 @Override 046 public void initSequence(String key, int id) { 047 while ((getNext(key)) < id) { 048 continue; 049 } 050 } 051 052}