Examples of MapJSONStringEntity


Examples of com.box.boxjavalibv2.jsonentities.MapJSONStringEntity

     * @param destinationFolderId
     *            the ID of the user who the folder will be transferred to
     * @return
     */
    public BoxUserRequestObject setDestinationUser(final String destinationUserId) {
        MapJSONStringEntity id = new MapJSONStringEntity();
        id.put(BoxUser.FIELD_ID, destinationUserId);
        put("owned_by", id);
        return this;
    }
View Full Code Here

Examples of com.box.boxjavalibv2.jsonentities.MapJSONStringEntity

        return me;
    }

    private static StringBody getMetadataBody(String parentId, String name) throws UnsupportedEncodingException, BoxRestException {
        MapJSONStringEntity parentEntity = new MapJSONStringEntity();
        parentEntity.put(Constants.ID, parentId);

        MapJSONStringEntity entity = new MapJSONStringEntity();
        entity.put(KEY_PARENT, parentEntity);
        entity.put(KEY_NAME, name);
        return new StringBody(entity.toJSONString(new ObjectMapper()), Charset.forName(CharEncoding.UTF_8));
    }
View Full Code Here

Examples of com.box.boxjavalibv2.jsonentities.MapJSONStringEntity

     * @param role
     *            role/access level of this collaboration(This is a String defined in {@link com.box.boxjavalibv2.dao.CollaborationRole}
     * @return BoxCollabRequestObject
     */
    public static BoxCollabRequestObject createCollaborationObject(final String folderId, final String userId, final String login, final String role) {
        MapJSONStringEntity item = getItemEntity(folderId);
        MapJSONStringEntity accessibleBy = getAccessibilityEntity(userId, login);
        return (new BoxCollabRequestObject()).setItem(item).setAccessibleBy(accessibleBy).setRole(role);
    }
View Full Code Here

Examples of com.box.boxjavalibv2.jsonentities.MapJSONStringEntity

        put(BoxCollaboration.FIELD_ROLE, role);
        return this;
    }

    private static MapJSONStringEntity getItemEntity(String folderId) {
        MapJSONStringEntity entity = new MapJSONStringEntity();
        entity.put("id", folderId);
        entity.put("type", BoxResourceType.FOLDER.toString());
        return entity;
    }
View Full Code Here

Examples of com.box.boxjavalibv2.jsonentities.MapJSONStringEntity

        entity.put("type", BoxResourceType.FOLDER.toString());
        return entity;
    }

    private static MapJSONStringEntity getAccessibilityEntity(final String userId, final String login) {
        MapJSONStringEntity entity = new MapJSONStringEntity();
        if (StringUtils.isNotEmpty(userId)) {
            entity.put("id", userId);
        }
        entity.put("login", login);
        return entity;
    }
View Full Code Here

Examples of com.box.boxjavalibv2.jsonentities.MapJSONStringEntity

     *
     * @param parentId
     * @return
     */
    public BoxItemRestoreRequestObject setNewParent(final String parentId) {
        MapJSONStringEntity id = new MapJSONStringEntity();
        id.put(BoxFolder.FIELD_ID, parentId);
        put(BoxItem.FIELD_PARENT, id);
        return this;
    }
View Full Code Here

Examples of com.box.boxjavalibv2.jsonentities.MapJSONStringEntity

     * @param email
     *            email address
     * @return
     */
    public BoxFolderRequestObject setUploadEmail(String access, String email) {
        MapJSONStringEntity entity = new MapJSONStringEntity();
        entity.put(BoxEmail.FIELD_ACCESS, access);
        entity.put(BoxEmail.FIELD_EMAIL, email);
        put(BoxFolder.FIELD_FOLDER_UPLOAD_EMAIL, entity);
        return this;
    }
View Full Code Here

Examples of com.box.boxjavalibv2.jsonentities.MapJSONStringEntity

     * @param parentId
     *            id of parent
     * @return
     */
    public BoxItemRequestObject setParent(String parentId) {
        MapJSONStringEntity entity = new MapJSONStringEntity();
        entity.put(BoxFolder.FIELD_ID, parentId);
        put(BoxItem.FIELD_PARENT, entity);
        return this;
    }
View Full Code Here

Examples of com.box.boxjavalibv2.jsonentities.MapJSONStringEntity

        put(BoxComment.FIELD_ITEM, getItemEntity(type, itemId));
        return this;
    }

    private static MapJSONStringEntity getItemEntity(final BoxResourceType type, final String itemId) {
        MapJSONStringEntity entity = new MapJSONStringEntity();
        entity.put("type", type.toString());
        entity.put("id", itemId);
        return entity;
    }
View Full Code Here

Examples of com.box.boxjavalibv2.jsonentities.MapJSONStringEntity

        String role = "testrole789";

        BoxCollabRequestObject obj = BoxCollabRequestObject.createCollabObject(folderId, userId, login, role);

        // String jsonStr = obj.getJSONEntity().toJSONString(new BoxJSONParser(new BoxResourceHub()));
        MapJSONStringEntity item = (MapJSONStringEntity) obj.getFromEntity(ITEM_STR);
        Assert.assertEquals(folderId, item.get(BoxFolder.FIELD_ID));
        Assert.assertEquals(BoxResourceType.FOLDER.toString(), item.get(BoxFolder.FIELD_TYPE));

        MapJSONStringEntity accessible = (MapJSONStringEntity) obj.getFromEntity(ACCESSIBLE_STR);
        Assert.assertEquals(userId, accessible.get(BoxUser.FIELD_ID));
        Assert.assertEquals(login, accessible.get(BoxUser.FIELD_LOGIN));

        Assert.assertEquals(role, obj.getFromEntity(ROLE_STR));
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.