Package org.fluxtream.core.connectors

Examples of org.fluxtream.core.connectors.Connector


    @Deprecated
    public Response handlePhotoUpload(@ApiParam(value="Connector to upload the photo for", required=true) @QueryParam("connector_name") final String connectorName,
                                      @ApiParam(value="Multipart encoded photo data", required=true) 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


            List<ApiKey> keys = guestService.getApiKeys(uid);
            ApiKey api = null;

            for (ApiKey key : keys){
                Connector connector = key.getConnector();
                if (connector.getName().equals(connectorName)||
                    connector.getPrettyName().equals(connectorName)){
                    api = key;
                    break;
                }
            }
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 = checkForPermissionAccess(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

    @Autowired
    BodyTrackHelper bodyTrackHelper;

    @Override
    public AbstractFacetVO<AbstractFacet> getFacet(final int api, final int objectType, final long facetId) {
        Connector connector = Connector.fromValue(api);
        final ObjectType ot = ObjectType.getObjectType(connector, objectType);
        final AbstractFacet facet = em.find(ot.facetClass(), facetId);
        final GuestSettings guestSettings = settingsService.getSettings(facet.guestId);
        final TimeZone timeZone = metadataService.getTimeZone(facet.guestId, facet.start);
        final String date = TimeUtils.dateFormatter.withZone(DateTimeZone.forTimeZone(timeZone)).print(facet.start);
View Full Code Here

        }
    }

    private void logDuplicateFacet(AbstractFacet facet) {
    try {
      Connector connector = Connector.fromValue(facet.api);
      StringBuilder sb = new StringBuilder("module=updateQueue component=apiDataServiceImpl action=logDuplicateFacet")
                    .append(" connector=" + connector.getName())
                    .append(" objectType=").append(facet.objectType)
                    .append(" guestId=" + facet.guestId);
      if (facet.objectType!=-1) {
        ObjectType[] objectType = connector.getObjectTypesForValue(facet.objectType);
        if (objectType!=null&&objectType.length!=0)
          sb.append(" objectType=").append(objectType[0].getName());
        else if (objectType!=null && objectType.length>1) {
          sb.append(" objectType=[");
          for (int i = 0; i < objectType.length; i++) {
View Full Code Here

  @Override
    @Transactional(readOnly = false)
  public void cacheEmptyData(UpdateInfo updateInfo, long fromMidnight,
      long toMidnight) {
    Connector connector = updateInfo.apiKey.getConnector();
    List<ObjectType> objectTypes = ObjectType.getObjectTypes(connector,
        updateInfo.objectTypes);
    for (ObjectType objectType : objectTypes) {
      try {
        AbstractFacet facet = objectType.facetClass().newInstance();
View Full Code Here

        facet.comment = comment;
        em.persist(facet);
    }

    private AbstractFacet getFacet(final String connectorName, final String objectTypeName, final long facetId) {
        final Connector connector = Connector.getConnector(connectorName);
        Class<? extends AbstractFacet> facetClass = connector.facetClass();
        if (objectTypeName!=null) {
            final ObjectType objectType = ObjectType.getObjectType(connector, objectTypeName);
            facetClass = objectType.facetClass();
        }
View Full Code Here

            // filter out photo connectors that aren't shared with this user
            if (coachee!=null) {
                List<String> sourcesToRemove = new ArrayList<String>();
                for (Source source : response.sources) {
                    final Connector photoConnectorForSource = Connector.fromDeviceNickname(source.name);
                    if (photoConnectorForSource!=null) {
                        final List<ApiKey> apiKeys = guestService.getApiKeys(coachee.guestId, photoConnectorForSource);
                        for (ApiKey apiKey : apiKeys) {
                            if (buddiesService.getSharedConnector(apiKey.getId(), AuthHelper.getGuestId())==null) {
                                sourcesToRemove.add(source.name);
View Full Code Here

    }

    private Map<String, List<AbstractFacet>> sortFacetsByFacetName(List<? extends AbstractFacet> facets) {
    Map<String, List<AbstractFacet>> facetsByDeviceNickname = new HashMap<String, List<AbstractFacet>>();
    for (AbstractFacet facet : facets) {
      Connector connector = Connector.fromValue(facet.api);
      String connectorAndObjectType = connector.getName();
      if (connector.objectTypes()!=null&&connector.objectTypes().length>0) {
                ObjectType objectType = ObjectType.getObjectType(connector, facet.objectType);
        if(objectType !=null) {
                    connectorAndObjectType += "." + objectType.getName();
                }
      }
View Full Code Here

            StringBuilder sb = new StringBuilder("module=updateQueue component=worker action=start").append(" guestId=").append(task.getGuestId()).append(" connector=").append(task.connectorName).append(" objectType=").append(task.objectTypes).append(" apiKeyId=").append(task.apiKeyId);
            logger.info(sb.toString());

            apiKey = guestService.getApiKey(task.apiKeyId);

            Connector conn = apiKey.getConnector();

            // Check if this connector type is enabled and supportsSync before calling update.
            // If it is disabled and/or does not support sync, don't try to update it.
            boolean doUpdate = true;
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.