本文整理汇总了Java中io.vertigo.dynamo.domain.model.DtObject类的典型用法代码示例。如果您正苦于以下问题:Java DtObject类的具体用法?Java DtObject怎么用?Java DtObject使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
DtObject类属于io.vertigo.dynamo.domain.model包,在下文中一共展示了DtObject类的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onIndex
import io.vertigo.dynamo.domain.model.DtObject; //导入依赖的package包/类
/** {@inheritDoc} */
@Override
public void onIndex(final Index<DtObject, DtObject> index) {
if (!initialized) {
init();
}
final Collection<Index<DtObject, DtObject>> indexCollection = indexMap.get(index.getDefinition());
//final long freeMem = Runtime.getRuntime().freeMemory();
long dataToIndexSize = 0;
synchronized (indexCollection) {
indexCollection.add(index);
for (final Index<?, ?> testIndex : indexCollection) {
dataToIndexSize += estimateDtObjectSize(testIndex.getIndexDtObject());
}
}
//System.out.println("dataToIndexSize= " + dataToIndexSize * 100 / (1024 * 1024) / 100d + " Mo, " + indexCollection.size() + " objets, freeMem= " + freeMem * 100 / (1024 * 1024) / 100d + " Mo, " + (freeMem <= dataToIndexSize * 1.20d ? ">>FLUSH<<" : "-CONTINUE-"));
if (indexCollection.size() >= 20 || dataToIndexSize >= 20 * 1024 * 1024) { //plus de 20 docs ou > 20Mo
flush(index.getDefinition(), indexCollection);
}
}
示例2: registerMasterData
import io.vertigo.dynamo.domain.model.DtObject; //导入依赖的package包/类
private static <O extends DtObject> void registerMasterData(final StoreManager storeManager, final Class<O> dtObjectClass, final Integer duration, final boolean isBigList) {
final DtDefinition dtDefinition = DtObjectUtil.findDtDefinition(dtObjectClass);
memorizeMdl(dtObjectClass, dtDefinition.getName());
// Si la durée dans le cache n'est pas précisé, on se base sur le type de la clé primaire
// pour déterminer la
// durée
final int cacheDuration;
if (duration == null) {
final DtField primaryKey = dtDefinition.getIdField().get();
if (primaryKey.getDomain().getDataType() == DataType.String) {
cacheDuration = CACHE_DURATION_LONG;
} else {
cacheDuration = CACHE_DURATION_SHORT;
}
} else {
cacheDuration = duration;
}
storeManager.getDataStoreConfig().registerCacheable(dtDefinition, cacheDuration, !isBigList, !isBigList);
// on enregistre le filtre actif
final DtListURIForMasterData uriActif = new DtListURIForMasterData(dtDefinition, ACTIVE_DATA_CODE);
if (dtDefinition.contains(IS_ACTIVE)) {
storeManager.getMasterDataConfig().register(uriActif, IS_ACTIVE, Boolean.TRUE);
} else {
storeManager.getMasterDataConfig().register(uriActif);
}
// On enregistre la liste globale
final DtListURIForMasterData uri = new DtListURIForMasterData(dtDefinition, ALL_DATA_CODE);
storeManager.getMasterDataConfig().register(uri);
}
示例3: memorizeMdl
import io.vertigo.dynamo.domain.model.DtObject; //导入依赖的package包/类
private static void memorizeMdl(final Class<? extends DtObject> dtObjectClass, final String cacheName) {
Set<String> set = MDL_MAP.get(dtObjectClass);
if (set == null) {
set = new HashSet<>();
MDL_MAP.put(dtObjectClass, set);
}
set.add(cacheName);
}
示例4: run
import io.vertigo.dynamo.domain.model.DtObject; //导入依赖的package包/类
/** {@inheritDoc} */
@Override
public void run() {
for (final Class<?> dtDefinitionClazz : new DtDefinitions()) {
final DtDefinition dtDefinition = DtObjectUtil.findDtDefinition((Class<? extends DtObject>) dtDefinitionClazz);
if (storeManager.getMasterDataConfig().containsMasterData(dtDefinition)) {
ensureInCache(dtDefinition);
}
}
}
示例5: estimateDtObjectSize
import io.vertigo.dynamo.domain.model.DtObject; //导入依赖的package包/类
private static long estimateDtObjectSize(final DtObject dto) {
long estimatedSize = 1 * 1024;
for (final DtField dtField : DtObjectUtil.findDtDefinition(dto).getFields()) {
if (DataType.String == dtField.getDomain().getDataType()) {
final String value = (String) dtField.getDataAccessor().getValue(dto);
estimatedSize += value != null ? value.length() : 0;
}
}
return estimatedSize;
}
示例6: flush
import io.vertigo.dynamo.domain.model.DtObject; //导入依赖的package包/类
/** {@inheritDoc} */
@Override
public void flush() {
if (!initialized) {
init();
}
for (final Map.Entry<IndexDefinition, Collection<Index<DtObject, DtObject>>> entry : indexMap.entrySet()) {
flush(entry.getKey(), entry.getValue());
}
}
示例7: clearMdlCache
import io.vertigo.dynamo.domain.model.DtObject; //导入依赖的package包/类
/**
* Vide le cache de façon spécifique sur une liste de référence.
*
* @param dtObjectClass classe de lal iste de référence
*/
public static void clearMdlCache(final Class<? extends DtObject> dtObjectClass) {
final CacheManager manager = Home.getApp().getComponentSpace().resolve(CacheManager.class);
final Set<String> set = MDL_MAP.get(dtObjectClass);
clearDtoCache(manager, set);
}
示例8: process
import io.vertigo.dynamo.domain.model.DtObject; //导入依赖的package包/类
Index<DtObject, DtObject> process(Document document);
示例9: onIndex
import io.vertigo.dynamo.domain.model.DtObject; //导入依赖的package包/类
void onIndex(final Index<DtObject, DtObject> index);