Package org.fluxtream.core.connectors

Examples of org.fluxtream.core.connectors.Connector


            return;
        // ignore if guestId is not in parse list
        if (!parse.isInParseGuestList(event.updateInfo.getGuestId()))
            return;
        final StringBuilder msgAtts = new StringBuilder("module=events component=DataReceivedEventListener action=handleEvent");
        final Connector connector = event.updateInfo.apiKey.getConnector();
        final String connectorName = connector.getName();
        final Guest guest = guestService.getGuestById(event.updateInfo.getGuestId());
        final StringBuilder sb = new StringBuilder(msgAtts)
                .append(" connector=").append(connectorName)
                .append(" eventType=").append(event.objectTypes)
                .append(" date=").append(event.date)
View Full Code Here


    @Produces({MediaType.APPLICATION_JSON})
    public Response handlePhotoUpload(@ApiParam(value="Connector to upload the photo for", required=true) @QueryParam("connector_name") final String connectorName,
                                      final MultiPart multiPart) {
        Response response;

        final Connector connector = Connector.getConnector(connectorName);
        if (connector != null) {
            // We currently only support photo uploads for the Fluxtream Capture connector
            if ("fluxtream_capture".equals(connector.getName())) {
                try {
                    if (multiPart != null) {
                        byte[] photoBytes = null;
                        String jsonMetadata = null;
View Full Code Here

    }

    private ApiKey  getApiKeyFromConnectorName(String connectorName, List<ApiKey> keys, ApiKey api) {
        for (ApiKey key : keys){
            Connector connector = key.getConnector();
            if (connector.getName().equals(connectorName)||
                connector.getPrettyName().equals(connectorName)){
                api = key;
                break;
            }
        }
        return api;
View Full Code Here

                                                   final String connectorName,
                                                   final String objectTypeName,
                                                   final long facetId,
                                                   final FacetMetaDataOperation operation) {
            // Try to find the connector by pretty name, and then if that fails the find by actual name
            Connector connector = ConnectorUtils.findConnectorByPrettyName(guestService, uid, connectorName);
            if (connector == null) {
                connector = Connector.getConnector(connectorName);
            }

            if (connector != null) {
                // Check authorization: is the logged-in user the same as the UID in the key?  If not, does the logged-in user
                // have coaching access AND access to the FluxtreamCapture connector?
                boolean accessAllowed = false;
                Long loggedInUserId = null;
                try {
                    loggedInUserId = AuthHelper.getGuestId();
                    accessAllowed = isOwnerOrAdmin(uid);
                    if (!accessAllowed) {
                        final CoachingBuddy coachee = buddiesService.getTrustingBuddy(loggedInUserId, uid);
                        if (coachee != null) {
                            accessAllowed = coachee.hasAccessToConnector(connector.getName());
                        }
                    }
                }
                catch (Exception e) {
                    LOG.error("BodyTrackController.setFacetMetadata(): Exception while trying to check authorization.", e);
View Full Code Here

        return items;
    }

    @Override
    public List<AbstractFacetVO<AbstractFacet>> getFacetVOs(GuestSettings guestSettings, ApiKey apiKey, final String objectTypeName, final long start, final long end, final String value) {
        Connector connector = apiKey.getConnector();
        String[] objectTypeNameParts = objectTypeName.split("-");
        ObjectType objectType = null;
        for (ObjectType ot : connector.objectTypes()){
            if (ot.getName().equals(objectTypeNameParts[1])){
                objectType = ot;
                break;
            }
        }
View Full Code Here

        facet.timeUpdated = System.currentTimeMillis();
    }

  @Autowired
  final protected void setConnectorUpdateService(@Qualifier("connectorUpdateServiceImpl") ConnectorUpdateService ads) {
    Connector connector = connector();
    ads.addUpdater(connector, this);
  }
View Full Code Here

    @Path("/{connector}/{objectType}")
    @Produces({MediaType.APPLICATION_JSON})
    public Response getObjectTypeUpdateTasks(@PathParam("connector") String connectorName, @PathParam("objectType") String objectTypeName) {
        try{
            long guestId = AuthHelper.getGuestId();
            final Connector connector = Connector.getConnector(connectorName);
            final ObjectType objectType = ObjectType.getObjectType(connector, objectTypeName);
            ApiKey apiKey = guestService.getApiKey(guestId, Connector.getConnector(connectorName));
            final UpdateWorkerTask scheduledUpdate =
                    connectorUpdateService.getUpdateWorkerTask(apiKey, objectType.value());
            return Response.ok(scheduledUpdate!=null?toJSON(scheduledUpdate).toString():"{}").build();
View Full Code Here

        return facets;
    }

    @Override
  public void deleteAllFacets(ApiKey apiKey) {
        final Connector connector = apiKey.getConnector();
        if (connector.hasDeleteOrder()){
            final int[] deleteOrder = connector.getDeleteOrder();
            for (int ot : deleteOrder) {
                ObjectType objectType = ObjectType.getObjectType(connector, ot);
                deleteAllFacets(apiKey, objectType);
            }
        } else {
            final ObjectType[] objectTypes = connector.objectTypes();
            for (ObjectType objectType : objectTypes) {
                deleteAllFacets(apiKey, objectType);
            }
        }
  }
View Full Code Here

    @Produces({ MediaType.APPLICATION_JSON })
    public String fixUpTimeBounds()
            throws Exception {
        List<ConnectorInfo> connectors =  sysService.getConnectors();
        for (ConnectorInfo connectorInfo : connectors) {
            final Connector connector = connectorInfo.getApi();
            if (connector==null)
                continue;
            else {
                List<Guest> guests = guestService.getAllGuests();
                for (Guest g : guests) {
                    ApiKey apiKey = guestService.getApiKey(g.getId(), connector);
                    if (apiKey==null) continue;
                    final ObjectType[] objectTypes = connector.objectTypes();
                    if (objectTypes!=null&&objectTypes.length>0) {
                        for (ObjectType objectType : objectTypes)
                            saveTimeBoundaries(apiKey, objectType);
                    } else
                        saveTimeBoundaries(apiKey, null);
View Full Code Here

    /** Returns the Connector having the given pretty name.  Returns <code>null</code> if no such connector exists. */
    public static Connector findConnectorByPrettyName(final GuestService guestService, final long guestId, final String connectorPrettyName) {
        List<ApiKey> userKeys = guestService.getApiKeys(guestId);
        for (ApiKey key : userKeys) {
            if (key != null) {
                final Connector connector = key.getConnector();
                if (connector != null && connector.prettyName() != null && connector.prettyName().equals(connectorPrettyName)) {
                    return connector;
                }
            }
        }

View Full Code Here

TOP

Related Classes of org.fluxtream.core.connectors.Connector

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.