public static String join(String separator, String... array) { return join(separator, Arrays.asList(array)); }
public static String getEmbedPath(String embedId) { String[] idParts = embedId.split(ID_SEP_REG); if (idParts.length < 4) { return null; } return StringUtils.join(IEntity.ID_SEP, Arrays.asList(idParts).subList(0, idParts.length - 1)); }
public static String getParentId(String embedId) { String[] idParts = embedId.split(ID_SEP_REG); if(idParts.length <= 4){ return idParts[1]; } return StringUtils.join(IEntity.ID_SEP, Arrays.asList(idParts).subList(0, idParts.length-2)); }
/** * Mongo array operations doesn't not support $ with pullAll. Find the extract index number. */ protected String getEmbedPath(BitSet arrayBits, String embedId, DBObject getObject, MetaClass rootMetaClass) { List<String> updatePathList = new ArrayList<String>(); getArrayOffsetPath(arrayBits, embedId, getObject, rootMetaClass, updatePathList); return StringUtils.join(EntityIDHelper.DOT, updatePathList); }
/** * Mongo array operations doesn't not support $ with pullAll. Find the extract index number. */ protected String getEmbedPath(BitSet arrayBits, String embedId, DBObject getObject, MetaClass rootMetaClass) { List<String> updatePathList = new ArrayList<String>(); getArrayOffsetPath(arrayBits, embedId, getObject, rootMetaClass, updatePathList); return StringUtils.join(FlattenEntityIDHelper.DOT, updatePathList); }
protected String getUpdatePath(BitSet arrayBits, String embedId, DBObject getObject, MetaClass rootMetaClass) { // mongodb only support one $ in the dot notation path List<String> updatePathList = new ArrayList<String>(); if (arrayBits.cardinality() <= 1) { // use $ operator for 1- array in the path: a.$.b or a.b.$ getArrayLocatorPath(arrayBits, embedId, rootMetaClass, updatePathList); } else { // use offset for 2+ array in the path: a.0.b.1 getArrayOffsetPath(arrayBits, embedId, getObject, rootMetaClass, updatePathList); } return StringUtils.join(EntityIDHelper.DOT, updatePathList); }
protected String getUpdatePath(BitSet arrayBits, String embedId, DBObject getObject, MetaClass rootMetaClass) { // mongodb only support one $ in the dot notation path List<String> updatePathList = new ArrayList<String>(); if (arrayBits.cardinality() <= 1) { // use $ operator for 1- array in the path: a.$.b or a.b.$ getArrayLocatorPath(arrayBits, embedId, rootMetaClass, updatePathList); } else { // use offset for 2+ array in the path: a.0.b.1 getArrayOffsetPath(arrayBits, embedId, getObject, rootMetaClass, updatePathList); } return StringUtils.join(FlattenEntityIDHelper.DOT, updatePathList); }
public static String generateEmbedPath(String rootType, String parentId, MetaField metaField) { CheckConditions.checkArgument(!StringUtils.isNullOrEmpty(parentId)); CheckConditions.checkNotNull(metaField); String genPath = null; if(parentId.startsWith(rootType)){ genPath = StringUtils.join(IEntity.ID_SEP, parentId, metaField.getName()); } else { genPath = StringUtils.join(IEntity.ID_SEP, rootType, parentId, metaField.getName()); } return genPath; }
/** * Mongo array operations doesn't not support $ with pullAll. Find the extract index number. */ protected String getEmbedPath(BitSet arrayBits, String embedId, DBObject getObject, MetaClass rootMetaClass) { List<String> updatePathList = new ArrayList<String>(); getArrayOffsetPath(arrayBits, embedId, getObject, rootMetaClass, updatePathList); return StringUtils.join(EntityIDHelper.DOT, updatePathList); }
protected String getUpdatePath(BitSet arrayBits, String embedId, DBObject getObject, MetaClass rootMetaClass) { // mongodb only support one $ in the dot notation path List<String> updatePathList = new ArrayList<String>(); if (arrayBits.cardinality() <= 1) { // use $ operator for 1- array in the path: a.$.b or a.b.$ getArrayLocatorPath(arrayBits, embedId, rootMetaClass, updatePathList); } else { // use offset for 2+ array in the path: a.0.b.1 getArrayOffsetPath(arrayBits, embedId, getObject, rootMetaClass, updatePathList); } return StringUtils.join(EntityIDHelper.DOT, updatePathList); }
public static String generateEmbedIdByEmbedPath(String embedPath, String embedId) { CheckConditions.checkArgument(!StringUtils.isNullOrEmpty(embedPath)); CheckConditions.checkArgument(!StringUtils.isNullOrEmpty(embedId)); return StringUtils.join(IEntity.ID_SEP, embedPath, embedId); }