Package com.box.boxjavalibv2.jsonentities

Examples of com.box.boxjavalibv2.jsonentities.MapJSONStringEntity


        LOG.debug("getCurrentUser: " + result);
    }

    @Test
    public void testGetEmailAliases() throws Exception {
        final BoxUser enterpriseUser = createEnterpriseUser();

        try {
            final Map<String, Object> headers = new HashMap<String, Object>();
            // parameter type is String
            headers.put("CamelBox.userId", enterpriseUser.getId());
            // parameter type is com.box.restclientv2.requestsbase.BoxDefaultRequestObject
//            headers.put("CamelBox.defaultRequest", null);

            List result = requestBodyAndHeaders("direct://GETEMAILALIASES", null, headers);

            assertNotNull("getEmailAliases result", result);
            LOG.debug("getEmailAliases: " + result);
        } finally {
            deleteEnterpriseUser(enterpriseUser.getId());
        }
    }
View Full Code Here


    }

    @Ignore("Developer account errors out with 'This does not currently support moving content into non-root folders'")
    @Test
    public void testMoveFolderToAnotherUser() throws Exception {
        final BoxUser enterpriseUser = createEnterpriseUser();

        try {
            final String toUserId = enterpriseUser.getId();
            moveTestFolder(testUserId, toUserId);
            moveTestFolder(toUserId, testUserId);
        } finally {
            deleteEnterpriseUser(enterpriseUser.getId());
        }
    }
View Full Code Here

        LOG.debug("moveFolderToAnotherUser: " + result);
    }

    @Test
    public void testUpdateUserInformaiton() throws Exception {
        final BoxUser enterpriseUser = createEnterpriseUser();

        try {
            final Map<String, Object> headers = new HashMap<String, Object>();
            // parameter type is String
            headers.put("CamelBox.userId", enterpriseUser.getId());
            // parameter type is com.box.boxjavalibv2.requests.requestobjects.BoxUserRequestObject
            final BoxUserRequestObject requestObject =
                    BoxUserRequestObject.updateUserInfoRequestObject(false);
            requestObject.setJobTitle(CAMEL_JOB_TITLE);
            headers.put("CamelBox.userRequest", requestObject);

            BoxUser result = requestBodyAndHeaders("direct://UPDATEUSERINFORMAITON", null, headers);

            assertNotNull("updateUserInformaiton result", result);
            assertEquals("updateUserInformaiton job title", CAMEL_JOB_TITLE, result.getJobTitle());
            LOG.debug("updateUserInformaiton: " + result);
        } finally {
            deleteEnterpriseUser(enterpriseUser.getId());
        }
    }
View Full Code Here

    }

    @Ignore("Requires multiple confirmed email aliases, do disabled by default")
    @Test
    public void testUpdateUserPrimaryLogin() throws Exception {
        final BoxUser enterpriseUser = createEnterpriseUser();

        try {
            final Map<String, Object> headers = new HashMap<String, Object>();
            // parameter type is String
            headers.put("CamelBox.userId", enterpriseUser.getId());
            // parameter type is com.box.boxjavalibv2.requests.requestobjects.BoxUserUpdateLoginRequestObject
            final BoxUserUpdateLoginRequestObject requestObject =
                    BoxUserUpdateLoginRequestObject.updateUserPrimaryLoginRequestObject(UPDATED_EMAIL_ALIAS);
            headers.put("CamelBox.userUpdateLoginRequest", requestObject);

            BoxUser result = requestBodyAndHeaders("direct://UPDATEUSERPRIMARYLOGIN", null, headers);

            assertNotNull("updateUserPrimaryLogin result", result);
            assertEquals("updateUserPrimaryLogin primary login", UPDATED_EMAIL_ALIAS, result.getLogin());
            LOG.debug("updateUserPrimaryLogin: " + result);
        } finally {
            deleteEnterpriseUser(enterpriseUser.getId());
        }
    }
View Full Code Here

        try {
            final Map<String, Object> headers = new HashMap<String, Object>();
            // parameter type is String
            headers.put("CamelBox.folderId", testFolder.getId());
            // parameter type is com.box.boxjavalibv2.requests.requestobjects.BoxSharedLinkRequestObject
            final BoxSharedLinkRequestEntity sharedLink = new BoxSharedLinkRequestEntity(
                    BoxSharedLinkAccess.COLLABORATORS);
            headers.put("CamelBox.sharedLinkRequest",
                    BoxSharedLinkRequestObject.createSharedLinkRequestObject(sharedLink));

            BoxFolder result = requestBodyAndHeaders("direct://CREATESHAREDLINK", null, headers);
View Full Code Here

     * @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

        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

     * @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

        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

        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

TOP

Related Classes of com.box.boxjavalibv2.jsonentities.MapJSONStringEntity

Copyright © 2018 www.massapicom. 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.