001 package org.cumulus4j.store.model.gae;
002
003 import java.util.Locale;
004
005 import javax.jdo.identity.StringIdentity;
006
007 import org.cumulus4j.store.model.ObjectIdFactory;
008 import org.cumulus4j.store.reflectionwrapper.gae.KeyFactory;
009
010 public class ObjectIdFactoryGae extends ObjectIdFactory {
011
012 /**
013 * @deprecated Do not use this constructor directly! It exists only for the ServiceLoader!
014 * Use {@link ObjectIdFactory#getInstance()} instead!
015 */
016 @Deprecated
017 public ObjectIdFactoryGae() { }
018
019 @Override
020 public Object createObjectId(Class<?> entityClass, long id) {
021 String kind = entityClass.getSimpleName().toLowerCase(Locale.UK);
022 // Object key = KeyFactory.getInstance().createKey(kind, id).getWrappedObject();
023 // return key;
024 String keyString = KeyFactory.getInstance().createKeyString(kind, id);
025 return new StringIdentity(entityClass, keyString);
026 }
027 }