org.bson.types.ObjectId

Here are the examples of the java api org.bson.types.ObjectId taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.

552 Examples 7

19 Source : Person.java
with Apache License 2.0
from xiancloud

/**
 * Sets the id
 *
 * @param id the id
 */
public void setId(final ObjectId id) {
    this.id = id;
}

19 Source : TestConstants.java
with Apache License 2.0
from UltimateSoftware

public clreplaced TestConstants {

    public static final double BASE_AMOUNT = 5.0;

    public static final ObjectId ACCOUNT_ID = new ObjectId("5c8ffe2b7c0bec3538855a06");

    public static final ObjectId CUSTOMER_ID = new ObjectId("5c8ffe2b7c0bec3538855a0a");

    public static final ObjectId NO_CUSTOMER_ID = new ObjectId("5c892aecf72465a56c4f816d");

    public static final ObjectId NO_ACCOUNT_ID = new ObjectId("5c8ffe687c0bec35e6e2258f");

    public static final ObjectId DESTINATION_ID = new ObjectId("5c8ffe687c0bec35e6e22589");

    public static final ObjectId TRANSACTION_ID = new ObjectId("5c8ffe687c0bec35e6e2258a");
}

19 Source : TwitchAccount.java
with MIT License
from Twasi

public void setId(ObjectId id) {
    this.id = id;
}

19 Source : BetaCode.java
with MIT License
from Twasi

public void setObjectId(ObjectId objectId) {
    this.objectId = objectId;
}

19 Source : BaseEntity.java
with MIT License
from Twasi

public abstract clreplaced BaseEnreplacedy implements IEnreplacedy {

    @Id
    private ObjectId id;

    @Override
    public <T extends BaseEnreplacedy> boolean isSame(T enreplacedy) {
        return enreplacedy.getId().equals(getId());
    }

    public ObjectId getId() {
        return id;
    }
}

19 Source : TestRestController.java
with MIT License
from TransEmpiric

@GetMapping("/{id}")
Mono<User> findById(@PathVariable ObjectId id) {
    return this.userReactiveCrudRepository.findById(id);
}

19 Source : UserRestController.java
with MIT License
from TransEmpiric

@GetMapping("/{id}")
Mono<User> findById(@PathVariable ObjectId id) {
    return this.repo.findById(id);
}

19 Source : Product.java
with GNU General Public License v3.0
from springframeworkguru

public void setId(ObjectId id) {
    this._id = id;
}

19 Source : GameObject.java
with GNU General Public License v3.0
from simon987

/**
 * An instance of an object (e.g. a Cubot, a NPC...) inside the
 * game universe
 */
public abstract clreplaced GameObject implements JSONSerializable, MongoSerializable {

    private boolean dead;

    /**
     * Object's unique identifier
     */
    private ObjectId objectId;

    /**
     * X coordinate of the object in its World
     */
    private int x;

    /**
     * Y coordinate of the object in its World
     */
    private int y;

    /**
     * Direction of the object
     */
    private Direction direction = Direction.NORTH;

    /**
     * Current World of the object
     */
    private World world;

    public GameObject() {
    }

    public GameObject(Doreplacedent doreplacedent) {
        objectId = doreplacedent.getObjectId("id");
        x = doreplacedent.getInteger("x");
        y = doreplacedent.getInteger("y");
    }

    /**
     * Increment the location of the game object by 1 tile
     * Collision checks happen here
     */
    public boolean incrementLocation() {
        int newX = getX() + direction.dX;
        int newY = getY() + direction.dY;
        if (newX < 0 || newY < 0 || newX >= world.getWorldSize() || newY >= world.getWorldSize()) {
            // Next tile is out of world bounds, move to next world
            World nextWorld = GameServer.INSTANCE.getGameUniverse().getWorld(world.getX() + direction.dX, world.getY() + direction.dY, true, world.getDimension());
            // Move object to next World
            world.removeObject(this);
            world.decUpdatable();
            nextWorld.addObject(this);
            nextWorld.incUpdatable();
            setWorld(nextWorld);
            // Set position on next World according to direction
            switch(direction) {
                case NORTH:
                    setY(nextWorld.getWorldSize() - 1);
                    break;
                case EAST:
                    setX(0);
                    break;
                case SOUTH:
                    setY(0);
                    break;
                case WEST:
                    setX(nextWorld.getWorldSize() - 1);
                    break;
                default:
                    break;
            }
            return true;
        } else {
            ArrayList<GameObject> frontObjects = world.getGameObjectsAt(newX, newY);
            // Check for enterable objects
            if (frontObjects.size() > 0 && frontObjects.get(0) instanceof Enterable) {
                return (((Enterable) frontObjects.get(0)).enter(this));
            }
            // Check collision
            if (this.world.getGameObjectsBlockingAt(newX, newY).size() > 0) {
                return false;
            }
            Tile tile = world.getTileMap().getTileAt(newX, newY);
            if (tile.walk(this)) {
                this.setX(newX);
                this.setY(newY);
                return true;
            } else {
                return false;
            }
        }
    }

    public abstract char getMapInfo();

    public Point getFrontTile() {
        if (direction == Direction.NORTH) {
            return new Point(x, y - 1);
        } else if (direction == Direction.EAST) {
            return new Point(x + 1, y);
        } else if (direction == Direction.SOUTH) {
            return new Point(x, y + 1);
        } else {
            return new Point(x - 1, y);
        }
    }

    /**
     * Get the first directly adjacent tile (starting east, going clockwise)
     */
    public Point getAdjacentTile() {
        if (!getWorld().isTileBlocked(getX() + 1, getY())) {
            return new Point(getX() + 1, getY());
        } else if (!getWorld().isTileBlocked(getX(), getY() + 1)) {
            return new Point(getX(), getY() + 1);
        } else if (!getWorld().isTileBlocked(getX() - 1, getY())) {
            return new Point(getX() - 1, getY());
        } else if (!getWorld().isTileBlocked(getX(), getY() - 1)) {
            return new Point(getX(), getY() - 1);
        } else {
            return null;
        }
    }

    public int getAdjacentTileCount(boolean diagonals) {
        int[] xPositions = { 1, 0, -1, 0, 1, -1, 1, -1 };
        int[] yPositions = { 0, 1, 0, -1, 1, 1, -1, -1 };
        int range = diagonals ? xPositions.length : xPositions.length / 2;
        int count = 0;
        for (int index = 0; index < range; index++) {
            int currentX = x + xPositions[index];
            int currentY = y + yPositions[index];
            if (getWorld().getTileMap().isInBounds(currentX, currentY) && !getWorld().isTileBlocked(currentX, currentY)) {
                count++;
            }
        }
        return count;
    }

    public ObjectId getObjectId() {
        return objectId;
    }

    public void setObjectId(ObjectId objectId) {
        this.objectId = objectId;
    }

    public int getX() {
        return x;
    }

    public void setX(int x) {
        this.x = x;
    }

    public int getY() {
        return y;
    }

    public void setY(int y) {
        this.y = y;
    }

    public Direction getDirection() {
        return direction;
    }

    public void setDirection(Direction direction) {
        this.direction = direction;
    }

    public World getWorld() {
        return world;
    }

    public void setWorld(World world) {
        this.world = world;
    }

    @Override
    public JSONObject jsonSerialise() {
        JSONObject json = new JSONObject();
        json.put("i", getObjectId().toHexString());
        json.put("t", getClreplaced().getCanonicalName());
        json.put("x", getX());
        json.put("y", getY());
        return json;
    }

    @Override
    public JSONObject debugJsonSerialise() {
        return jsonSerialise();
    }

    public boolean isAt(int x, int y) {
        return this.x == x && this.y == y;
    }

    public boolean isDead() {
        return dead;
    }

    public void setDead(boolean dead) {
        this.dead = dead;
    }

    /**
     * Called before this GameObject is removed from the world - defaults to doing nothing
     *
     * @return true if cancelled
     */
    public boolean onDeadCallback() {
        return false;
    }

    public void initialize() {
    }

    @Override
    public Doreplacedent mongoSerialise() {
        Doreplacedent doreplacedent = new Doreplacedent();
        doreplacedent.put("id", getObjectId());
        doreplacedent.put("type", getClreplaced().getCanonicalName());
        doreplacedent.put("x", getX());
        doreplacedent.put("y", getY());
        return doreplacedent;
    }
}

19 Source : Account.java
with MIT License
from researchgate

public void setMentorAccountId(ObjectId mentorAccountId) {
    this.mentorAccountId = mentorAccountId;
}

19 Source : LinkedEntity.java
with Apache License 2.0
from quarkusio

public clreplaced LinkedEnreplacedy extends PanacheMongoEnreplacedy {

    public String name;

    public ObjectId myForeignId;
}

19 Source : Pojo.java
with Apache License 2.0
from quarkusio

public clreplaced Pojo {

    public ObjectId id;

    public String description;

    public Optional<String> optionalString;
}

19 Source : ReactivePanacheMongoEntity.java
with Apache License 2.0
from quarkusio

/**
 * Represents an enreplacedy with a generated ID field {@link #id} of type {@link ObjectId}. If your
 * Mongo enreplacedies extend this clreplaced they gain the ID field and auto-generated accessors
 * to all their public fields, as well as all the useful methods from {@link ReactivePanacheMongoEnreplacedyBase}.
 *
 * If you want a custom ID type or strategy, you can directly extend {@link ReactivePanacheMongoEnreplacedyBase}
 * instead, and write your own ID field. You will still get auto-generated accessors and
 * all the useful methods.
 *
 * @see ReactivePanacheMongoEnreplacedyBase
 */
public abstract clreplaced ReactivePanacheMongoEnreplacedy extends ReactivePanacheMongoEnreplacedyBase {

    /**
     * The auto-generated ID field.
     * This field is set by Mongo when this enreplacedy is persisted.
     *
     * @see #persist()
     */
    public ObjectId id;

    @Override
    public String toString() {
        return this.getClreplaced().getSimpleName() + "<" + id + ">";
    }
}

19 Source : PanacheMongoEntity.java
with Apache License 2.0
from quarkusio

/**
 * Represents an enreplacedy with a generated ID field {@link #id} of type {@link ObjectId}. If your
 * Mongo enreplacedies extend this clreplaced they gain the ID field and auto-generated accessors
 * to all their public fields, as well as all the useful methods from {@link PanacheMongoEnreplacedyBase}.
 *
 * If you want a custom ID type or strategy, you can directly extend {@link PanacheMongoEnreplacedyBase}
 * instead, and write your own ID field. You will still get auto-generated accessors and
 * all the useful methods.
 *
 * @see PanacheMongoEnreplacedyBase
 */
public abstract clreplaced PanacheMongoEnreplacedy extends PanacheMongoEnreplacedyBase {

    /**
     * The auto-generated ID field.
     * This field is set by Mongo when this enreplacedy is persisted.
     *
     * @see #persist()
     */
    public ObjectId id;

    @Override
    public String toString() {
        return this.getClreplaced().getSimpleName() + "<" + id + ">";
    }
}

19 Source : Ratings.java
with Apache License 2.0
from PreferredAI

public void set_id(ObjectId _id) {
    this._id = _id;
}

19 Source : Occasion.java
with Eclipse Public License 1.0
from OpenLiberty

public void setId(ObjectId id) {
    if (null != id) {
        this.id = id;
    }
}

19 Source : TodoItem.java
with Apache License 2.0
from mongodb

public clreplaced TodoItem {

    private final ObjectId _id;

    private final String _text;

    private final boolean _checked;

    public TodoItem(final Doreplacedent doreplacedent) {
        _id = doreplacedent.getObjectId("_id");
        _text = doreplacedent.getString("text");
        if (doreplacedent.containsKey("checked")) {
            _checked = doreplacedent.getBoolean("checked");
        } else {
            _checked = false;
        }
    }

    public ObjectId getId() {
        return _id;
    }

    public String getText() {
        return _text;
    }

    public boolean getChecked() {
        return _checked;
    }
}

19 Source : CustomType.java
with Apache License 2.0
from mongodb

public clreplaced CustomType {

    private ObjectId id;

    private final int intValue;

    public CustomType(final ObjectId id, final int intValue) {
        this.id = id;
        this.intValue = intValue;
    }

    public ObjectId getId() {
        return id;
    }

    void setId(final ObjectId id) {
        this.id = id;
    }

    CustomType withNewObjectId() {
        setId(new ObjectId());
        return this;
    }

    public int getIntValue() {
        return intValue;
    }

    @Override
    public boolean equals(final Object object) {
        if (this == object) {
            return true;
        }
        if (!(object instanceof CustomType)) {
            return false;
        }
        final CustomType other = (CustomType) object;
        return id.equals(other.id) && intValue == other.intValue;
    }

    @Override
    public int hashCode() {
        throw new UnsupportedOperationException("hashCode not designed");
    }

    public static clreplaced Codec implements CollectibleCodec<CustomType> {

        @Override
        public CustomType generateIdIfAbsentFromDoreplacedent(final CustomType doreplacedent) {
            return doreplacedentHasId(doreplacedent) ? doreplacedent.withNewObjectId() : doreplacedent;
        }

        @Override
        public boolean doreplacedentHasId(final CustomType doreplacedent) {
            return doreplacedent.getId() == null;
        }

        @Override
        public BsonValue getDoreplacedentId(final CustomType doreplacedent) {
            return new BsonString(doreplacedent.getId().toHexString());
        }

        @Override
        public CustomType decode(final BsonReader reader, final DecoderContext decoderContext) {
            final Doreplacedent doreplacedent = (new DoreplacedentCodec()).decode(reader, decoderContext);
            return new CustomType(doreplacedent.getObjectId("_id"), doreplacedent.getInteger("intValue"));
        }

        @Override
        public void encode(final BsonWriter writer, final CustomType value, final EncoderContext encoderContext) {
            final Doreplacedent doreplacedent = new Doreplacedent();
            if (value.getId() != null) {
                doreplacedent.put("_id", value.getId());
            }
            doreplacedent.put("intValue", value.getIntValue());
            (new DoreplacedentCodec()).encode(writer, doreplacedent, encoderContext);
        }

        @Override
        public Clreplaced<CustomType> getEncoderClreplaced() {
            return CustomType.clreplaced;
        }
    }
}

19 Source : CustomType.java
with Apache License 2.0
from mongodb

void setId(final ObjectId id) {
    this.id = id;
}

19 Source : UserApiKey.java
with Apache License 2.0
from mongodb

/**
 * A struct representing a user API key as returned by the Sreplacedch client API.
 */
public final clreplaced UserApiKey {

    private final ObjectId id;

    private final String key;

    private final String name;

    private final Boolean disabled;

    /**
     * Constructs a user API key with the provided parameters.
     * @param id The id of the user API key as an ObjectId hex string.
     * @param key The key itself.
     * @param name The name of the key.
     * @param disabled Whether or not the key is disabled.
     */
    @JsonCreator
    public UserApiKey(@JsonProperty(ApiKeyFields.ID) final String id, @JsonProperty(ApiKeyFields.KEY) final String key, @JsonProperty(ApiKeyFields.NAME) final String name, @JsonProperty(ApiKeyFields.DISABLED) final Boolean disabled) {
        this.id = new ObjectId(id);
        this.key = key;
        this.name = name;
        this.disabled = disabled;
    }

    /**
     * Returns the id of this API key.
     *
     * @return the id of this API key.
     */
    @JsonProperty(ApiKeyFields.ID)
    public ObjectId getId() {
        return id;
    }

    /**
     * Returns the key of this API key. This is only returned on the creation request for a key.
     *
     * @return the key of this API key.
     */
    @JsonProperty(ApiKeyFields.KEY)
    @Nullable
    public String getKey() {
        return key;
    }

    /**
     * Returns the name of the API key.
     *
     * @return the name of the API key.
     */
    @JsonProperty(ApiKeyFields.NAME)
    public String getName() {
        return name;
    }

    /**
     * Returns whether or not this API key is disabled for login usage.
     *
     * @return whether or not this API key is disabled for login usage.
     */
    @JsonProperty(ApiKeyFields.DISABLED)
    public Boolean getDisabled() {
        return disabled;
    }

    @Override
    public String toString() {
        try {
            return SreplacedchObjectMapper.getInstance().writeValuereplacedtring(this);
        } catch (final JsonProcessingException e) {
            e.printStackTrace();
            throw new RuntimeException(e);
        }
    }
}

19 Source : Person.java
with Apache License 2.0
from MaBeuLux88

public Person setId(ObjectId id) {
    this.id = id;
    return this;
}

19 Source : ShoppingCart.java
with GNU General Public License v3.0
from Lottoritter

public void setPlayerId(ObjectId playerId) {
    this.playerId = playerId;
}

19 Source : Token.java
with GNU General Public License v3.0
from Lottoritter

public void setHash(ObjectId hash) {
    this.hash = hash;
}

19 Source : Ticket.java
with GNU General Public License v3.0
from Lottoritter

public void setPriceListId(ObjectId priceListId) {
    this.priceListId = priceListId;
}

19 Source : State.java
with Apache License 2.0
from kaiso

@Doreplacedent(collection = "states")
public clreplaced State {

    @Id
    private ObjectId id;

    private String name;

    public ObjectId getId() {
        return id;
    }

    public void setId(ObjectId id) {
        this.id = id;
    }

    public String getName() {
        return name;
    }

    public void setName(String address) {
        this.name = address;
    }
}

19 Source : Passport.java
with Apache License 2.0
from kaiso

@Doreplacedent()
public clreplaced Preplacedport {

    @Id
    private ObjectId id;

    @Indexed(unique = true)
    private String number;

    @OneToOne(mappedBy = "preplacedport", fetch = FetchType.EAGER)
    private Person owner;

    public ObjectId getId() {
        return id;
    }

    public void setId(ObjectId id) {
        this.id = id;
    }

    public String getNumber() {
        return number;
    }

    public void setNumber(String number) {
        this.number = number;
    }

    public Person getOwner() {
        return owner;
    }

    public void setOwner(Person owner) {
        this.owner = owner;
    }
}

19 Source : AuthorGroupServiceImpl.java
with MIT License
from Jannchie

private boolean hasPermission(ObjectId userId, AuthorGroup ag) {
    return userId.equals(ag.getMaintainer().getId()) || userId.equals(ag.getCreator().getId());
}

19 Source : AuthorGroupServiceImpl.java
with MIT License
from Jannchie

private boolean hasPermission(ObjectId userId, ObjectId groupId) {
    AuthorGroup ag = getAuthorList(groupId);
    return userId == null || userId.equals(ag.getMaintainer().getId()) || userId.equals(ag.getCreator().getId());
}

19 Source : AuthorGroupServiceImpl.java
with MIT License
from Jannchie

private void setIsStared(ObjectId userId, AuthorGroup authorGroup) {
    authorGroup.setStared(false);
    for (UserStarAuthorGroup u : authorGroup.getStarList()) {
        if (u.getUserId().equals(userId) && u.getStarring()) {
            authorGroup.setStared(true);
            break;
        }
    }
}

19 Source : GuessingService.java
with MIT License
from Jannchie

public Result<?> announceResult(ObjectId guessingId, Integer index) {
    return null;
}

19 Source : UserStarAuthorGroup.java
with MIT License
from Jannchie

/**
 * @author Jannchie
 */
@Doreplacedent("user_star_author_group")
public clreplaced UserStarAuthorGroup {

    private ObjectId userId;

    private ObjectId groupId;

    private Boolean starring;

    public UserStarAuthorGroup(ObjectId userId, ObjectId groupId) {
        this.userId = userId;
        this.groupId = groupId;
    }

    public ObjectId getUserId() {
        return userId;
    }

    public void setUserId(ObjectId userId) {
        this.userId = userId;
    }

    public ObjectId getGroupId() {
        return groupId;
    }

    public void setGroupId(ObjectId groupId) {
        this.groupId = groupId;
    }

    public Boolean getStarring() {
        if (starring == null) {
            return true;
        }
        return starring;
    }

    public void setStarring(Boolean starring) {
        this.starring = starring;
    }
}

19 Source : UserStarAuthorGroup.java
with MIT License
from Jannchie

public void setGroupId(ObjectId groupId) {
    this.groupId = groupId;
}

19 Source : UserStarAuthorGroup.java
with MIT License
from Jannchie

public void setUserId(ObjectId userId) {
    this.userId = userId;
}

19 Source : UserMessage.java
with MIT License
from Jannchie

/**
 * @author Jannchie
 */
@Doreplacedent("user_message")
public clreplaced UserMessage {

    private ObjectId userId;

    private ObjectId senderId;

    private String msg;

    private Integer state;

    public ObjectId getSenderId() {
        return senderId;
    }

    public void setSenderId(ObjectId senderId) {
        this.senderId = senderId;
    }

    public ObjectId getUserId() {
        return userId;
    }

    public void setUserId(ObjectId userId) {
        this.userId = userId;
    }

    public String getMsg() {
        return msg;
    }

    public void setMsg(String msg) {
        this.msg = msg;
    }

    public Integer getState() {
        return state;
    }

    public void setState(Integer state) {
        this.state = state;
    }
}

19 Source : UserMessage.java
with MIT License
from Jannchie

public void setSenderId(ObjectId senderId) {
    this.senderId = senderId;
}

19 Source : GuessingItem.java
with MIT License
from Jannchie

public void setGuessingId(ObjectId guessingId) {
    this.guessingId = guessingId;
}

19 Source : GroupUpdateRecord.java
with MIT License
from Jannchie

public void setGid(ObjectId gid) {
    this.gid = gid;
}

19 Source : AgendaVote.java
with MIT License
from Jannchie

public void setAgendaId(ObjectId agendaId) {
    this.agendaId = agendaId;
}

19 Source : AbstractMongoEntity.java
with Apache License 2.0
from i-Cell-Mobilsoft-Open-Source

/**
 * Setter for the field {@code id}.
 *
 * @param id
 *            id to set
 */
public void setId(ObjectId id) {
    this.id = id;
}

19 Source : BuildDataCreateResponse.java
with Apache License 2.0
from Hygieia

public void setDashboardId(ObjectId dashboardId) {
    this.dashboardId = dashboardId;
}

19 Source : BuildDataCreateResponse.java
with Apache License 2.0
from Hygieia

public void setCollectorItemId(ObjectId collectorItemId) {
    this.collectorItemId = collectorItemId;
}

19 Source : Widget.java
with Apache License 2.0
from Hygieia

public void setComponentId(ObjectId componentId) {
    this.componentId = componentId;
}

19 Source : TestResult.java
with Apache License 2.0
from Hygieia

public void setBuildId(ObjectId buildId) {
    this.buildId = buildId;
}

19 Source : TeamInventory.java
with Apache License 2.0
from Hygieia

public void setCollectorId(ObjectId collectorId) {
    this.collectorId = collectorId;
}

19 Source : ScoreMetric.java
with Apache License 2.0
from Hygieia

public void setScoreTypeId(ObjectId scoreTypeId) {
    this.scoreTypeId = scoreTypeId;
}

19 Source : ScoreComponentMetricBase.java
with Apache License 2.0
from Hygieia

public void setRefId(ObjectId refId) {
    this.refId = refId;
}

19 Source : ScoreCollectorItem.java
with Apache License 2.0
from Hygieia

public void setDashboardId(ObjectId dashboardId) {
    getOptions().put(DASHBOARD_ID, dashboardId);
}

19 Source : RelatedCollectorItem.java
with Apache License 2.0
from Hygieia

@Doreplacedent(collection = "related_items")
public clreplaced RelatedCollectorItem extends BaseModel {

    @NotNull
    private ObjectId left;

    @NotNull
    private ObjectId right;

    @NotNull
    private String source;

    @NotNull
    private String reason;

    @NotNull
    private long creationTime;

    public ObjectId getLeft() {
        return left;
    }

    public void setLeft(ObjectId left) {
        this.left = left;
    }

    public ObjectId getRight() {
        return right;
    }

    public void setRight(ObjectId right) {
        this.right = right;
    }

    public long getCreationTime() {
        return creationTime;
    }

    public void setCreationTime(long creationTime) {
        this.creationTime = creationTime;
    }

    public String getSource() {
        return source;
    }

    public void setSource(String source) {
        this.source = source;
    }

    public String getReason() {
        return reason;
    }

    public void setReason(String reason) {
        this.reason = reason;
    }
}

19 Source : RelatedCollectorItem.java
with Apache License 2.0
from Hygieia

public void setLeft(ObjectId left) {
    this.left = left;
}

19 Source : RelatedCollectorItem.java
with Apache License 2.0
from Hygieia

public void setRight(ObjectId right) {
    this.right = right;
}

See More Examples