Package com.streamreduce.core.model

Examples of com.streamreduce.core.model.SobaObject


            // Fill out type (camel casing of the object type)
            extraMetadata.put("targetType", target.getClass().getSimpleName());

            // Fill out the SobaObject information
            if (target instanceof SobaObject) {
                SobaObject tSobaObject = (SobaObject) target;

                // Attempt to gather the user/account from the target of the event when there is no user logged in.
                // We can only do this for subclasses of SobaObject because the other two objects that create events
                // (Account/User) can only provide one piece of the puzzle.
                if (user == null) {
                    user = tSobaObject.getUser();
                    account = tSobaObject.getAccount();
                }

                extraMetadata.put("targetVisibility", tSobaObject.getVisibility());
                extraMetadata.put("targetAlias", tSobaObject.getAlias());
                extraMetadata.put("targetHashtags", tSobaObject.getHashtags());
            }

            // Fill in specific object information
            if (target instanceof Account) {
                Account tAccount = (Account) target;
View Full Code Here


                }
            }

            // Add tags to the Connection/InventoryItem for message creation only, do not persist (Validation occurs)
            JSONArray hashtags = entry.has("hashtags") ? entry.getJSONArray("hashtags") : null;
            SobaObject target = inventoryItemId == null ? connection : inventoryItem;
            // TODO: add Custom TAG hack, remove this and do it right
            target.addHashtag("custom");

            if (hashtags != null) {
                // Pull in hashtags from the actual IMG message
                for (Object rawHashtag : hashtags) {
                    if (rawHashtag instanceof String) {
                        target.addHashtag((String) rawHashtag);
                    } else {
                        return error("All hashtags specified in the 'hashtags' attribute must be strings.",
                                Response.status(Response.Status.BAD_REQUEST));
                    }
                }
View Full Code Here

            // Validate object type (Class's simple name)
            Assert.assertEquals(eventMetadata.get("targetType"), expectedTarget.getClass().getSimpleName());

            // Validate SobaObject generated metadata
            if (expectedTarget instanceof SobaObject) {
                SobaObject tSobaObject = (SobaObject) expectedTarget;
                Map<String, Object> sExpectedMetadata = new HashMap<>();

                sExpectedMetadata.put("targetAlias", tSobaObject.getAlias());
                sExpectedMetadata.put("targetHashtags", tSobaObject.getHashtags());

                validateEventMetadata(eventMetadata, sExpectedMetadata, true);
            }

            // Validate the generated metadata based on object type
View Full Code Here

                .build();
    }

    @Test
    public void testCreateSobaMessage_IncludesSenderAccountId() {
        SobaObject sender = createValidSender();

        SobaMessage sobaMessage = new SobaMessage.Builder()
                .type(MessageType.INVENTORY_ITEM)
                .visibility(SobaObject.Visibility.ACCOUNT)
                .sender(sender)
                .build();

        assertEquals(sender.getAccount().getId(), sobaMessage.getSenderAccountId());

    }
View Full Code Here

public class SobaMessageResponseDTOTest {

    @Test
    public void testIncludesSenderConnectionId() {
        SobaObject sender = createValidSender();

        SobaMessage sobaMessage = new SobaMessage.Builder()
                .type(MessageType.INVENTORY_ITEM)
                .visibility(SobaObject.Visibility.ACCOUNT)
                .sender(sender)
                .build();
        SobaMessageResponseDTO responseDTO = SobaMessageResponseDTO.fromSobaMessage(sobaMessage);
        Assert.assertEquals(sender.getAccount().getId(),responseDTO.getSenderAccountId());
    }
View Full Code Here

TOP

Related Classes of com.streamreduce.core.model.SobaObject

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.