Package org.fluxtream.core.mvc.models

Examples of org.fluxtream.core.mvc.models.ConnectorModelFull


                }
                if (!guestService.hasApiKey(guest.getId(), api)||api.getName().equals("facebook")/*HACK*/) {
                    connectors.remove(i--);
                } else {
                    ConnectorInfo connector = connectorInfo;
                    ConnectorModelFull connectorModel = new ConnectorModelFull();
                    Connector conn = Connector.fromValue(connector.api);
                    ApiKey apiKey = guestService.getApiKey(guest.getId(), conn);

                    connectorModel.prettyName = conn.prettyName();
                    List<String> facetTypes = new ArrayList<String>();
                    ObjectType[] objTypes = conn.objectTypes();
                    if (objTypes != null) {
                        for (ObjectType obj : objTypes) {
                            facetTypes.add(connector.connectorName + "-" + obj.getName());
                        }
                    }
                    connectorModel.facetTypes = facetTypes;
                    connectorModel.status = apiKey.status!=null?apiKey.status.toString():"NA";
                    connectorModel.name = connector.name;
                    connectorModel.connectUrl = connector.connectUrl;
                    connectorModel.image = env.get("homeBaseUrl") + connector.image.substring(1);
                    connectorModel.connectorName = connector.connectorName;
                    connectorModel.enabled = connector.enabled;
                    connectorModel.manageable = connector.manageable;
                    connectorModel.text = connector.text;
                    connectorModel.api = connector.api;
                    connectorModel.apiKeyId = apiKey.getId();
                    connectorModel.lastSync = connector.supportsSync?getLastSync(apiKey):Long.MAX_VALUE;
                    connectorModel.latestData = getLatestData(apiKey);
                    final String auditTrail = checkForErrors(apiKey);
                    connectorModel.errors = auditTrail!=null;
                    connectorModel.auditTrail = auditTrail!=null?auditTrail:"";
                    connectorModel.syncing = checkIfSyncInProgress(guest.getId(), conn);
                    connectorModel.channels = settingsService.getChannelsForConnector(guest.getId(), conn);
                    connectorModel.sticky = connector.connectorName.equals("fluxtream_capture");
                    connectorModel.supportsRenewToken = connector.supportsRenewTokens;
                    connectorModel.supportsSync = connector.supportsSync;
                    connectorModel.supportsFileUpload = connector.supportsFileUpload;
                    connectorModel.prettyName = conn.prettyName();
                    final String uploadMessageKey = conn.getName() + ".upload";
                    if (res.containsKey(uploadMessageKey)) {
                        final String uploadMessage = res.getString(uploadMessageKey);
                        connectorModel.uploadMessage = uploadMessage;
                    }
                    connectorsArray.add(connectorModel);
                }
            }
            if (buddyToAccessParameter!=null) {
                final List<SharedConnector> sharedConnectors = buddiesService.getSharedConnectors(AuthHelper.getGuestId(), coachee.guestId);
                List<ConnectorModelFull> unshared = new ArrayList<ConnectorModelFull>();

                eachTrustingBuddyConnector:for (int i=0; i<connectorsArray.size(); i++) {
                    ConnectorModelFull fullModel = connectorsArray.get(i);
                    for (SharedConnector sharedConnector : sharedConnectors) {
                        if (sharedConnector.connectorName.equals(fullModel.connectorName))
                            continue eachTrustingBuddyConnector;
                    }
                    unshared.add(fullModel);
                }

                for (ConnectorModelFull toRemove : unshared) {
                    for (int i=0; i<connectorsArray.size(); i++) {
                        ConnectorModelFull fullModel = connectorsArray.get(i);
                        if (fullModel.apiKeyId==toRemove.apiKeyId)
                            connectorsArray.remove(fullModel);
                    }
                }
            }
View Full Code Here

TOP

Related Classes of org.fluxtream.core.mvc.models.ConnectorModelFull

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.