1 package com.atlassian.core.ofbiz.test.mock; 2 3 import org.ofbiz.core.entity.SequenceUtil; 4 import org.ofbiz.core.entity.model.ModelEntity; 5 6 import java.util.HashMap; 7 import java.util.Map; 8 9 public class MockSequenceUtil extends SequenceUtil { 10 Map sequences = new HashMap(); 11 12 public MockSequenceUtil(String helperName, ModelEntity seqEntity, String nameFieldName, String idFieldName) { 13 super(helperName, seqEntity, nameFieldName, idFieldName); 14 } 15 16 public Long getNextSeqId(String seqName) { 17 Long l = null; 18 19 synchronized (sequences) { 20 l = (Long) sequences.get(seqName); 21 22 if (l == null) { 23 l = new Long(0); 24 } 25 26 l = new Long(l.longValue() + 1); 27 28 sequences.put(seqName, l); 29 } 30 31 return new Long(l.longValue()); 32 } 33 }