@Entity(value = "elements", noClassnameStored = true) public class ElementImpl extends BasicEntityBean{ public String type; public String locator; public String method; public int position; public ElementImpl() { type = ""; locator = ""; name = ""; method = ""; position = 0; } }
public CappedAt getCappedAt() { Entity entity = (Entity) getFirstAnnotation(Entity.class); if (entity == null) { return null; } return entity.cap(); }
/** * Returns a WriteConcern for this mapped class - by default it is SAFE. * * @return */ public WriteConcern getWriteConcern() { WriteConcern wc = WriteConcern.SAFE; Entity entity = (Entity) getFirstAnnotation(Entity.class); if (entity == null) { return wc; } if (entity.concern() != null && !entity.concern().isEmpty()) { wc = WriteConcern.valueOf(entity.concern()); } return wc; }
/** * Should a class name be stored with entities? * * @return */ public boolean isClassNameStored() { Entity entity = (Entity) getFirstAnnotation(Entity.class); if (entity == null) { return false; } return !entity.noClassnameStored(); }
/** * Returns any Mongo ReadPreference stated on this class. * @return */ public ReadPreference getReadPreference() { Entity entity = (Entity) getFirstAnnotation(Entity.class); if (entity == null) { return null; } if (entity.queryNonPrimary()) { return ReadPreference.secondaryPreferred(); } return null; }
@Entity(value = "repository", noClassnameStored = true) public class RepositoryImpl extends BasicEntityBean { public String type; @Reference(ignoreMissing = true) public List<ElementImpl> rows = new ArrayList<ElementImpl>(); }
private void processMappings() { Reflections reflection = new Reflections(Domain.class.getPackage().getName()); Set<Class<?>> typesAnnotatedWith = reflection.getTypesAnnotatedWith(Entity.class); for (Class<?> c : typesAnnotatedWith) { Entity entity = c.getAnnotation(Entity.class); enitityManager.register(entity.value(), c); morphia.map(c); LOG.info(c + " type has been registered to Morphia !"); } }
@Entity(value = "teams", noClassnameStored = true) public class GroupImpl extends BasicTaggableMongoBean { @Id ObjectId id = new ObjectId(); }
/** * Used to store counters for other entities. * * @author skot */ @Entity(value = "ids", noClassnameStored = true) public static class StoredId { final @Id String className; protected Long value = 1L; public StoredId(String name) { className = name; } protected StoredId() { className = ""; } public Long getValue() { return value; } } }
@Entity(value = "test", noClassnameStored = true) @Embedded public class CampaignLine {
@Entity(value = "tags", noClassnameStored = true) public class TagImpl implements ITaggable {
@Entity(value = "tags", noClassnameStored = true) public class TagImpl {
@Entity(value = "teams", noClassnameStored = true) public class UserImpl extends BasicTaggableMongoBean { @Id ObjectId id = new ObjectId(); @Reference List<GroupImpl> groups; }
@Entity(value = "repository") public class RepositoryImpl extends BasicEntityBean implements IRepository{ public String type; @Embedded public ProjectImpl project; @Reference(ignoreMissing = true) public List<ElementImpl> rows = new ArrayList<>(); }
@Entity(value = "test", noClassnameStored = true) @Embedded public class ComponentConfigLine {
@Entity(value = "test", noClassnameStored = true) @Embedded public class ComponentConfigLine {
@Entity(value = "test", noClassnameStored = true) @Embedded public class SwingPageConfigLine {
@Entity(value = "test", noClassnameStored = true) @Embedded public class WebPageConfigLine {
@Entity(value = "test", noClassnameStored = true) @Embedded public class SwingPageConfigLine {