AdapterConfig { public static ArrayList<AdapterConfig> findAdapterByOwner(String accountId, String adapterType, String address) { TwigCompatibleMongoDatastore datastore = new TwigCompatibleMongoDatastore(); RootFindCommand<AdapterConfig> cmd = datastore.find().type(AdapterConfig.class); if (adapterType != null) cmd.addFilter("adapterType", FilterOperator.EQUAL, adapterType.toLowerCase()); if (address != null) cmd.addFilter("address", FilterOperator.EQUAL, address.toLowerCase()); return fetchAllAdaptersForAccount(Arrays.asList(accountId), cmd.now(), true); } AdapterConfig(); @POST @Consumes("application/json") @Produces("application/json") @JsonIgnore Response createConfig(String json); @PUT @Path("{uuid}") @Consumes("application/json") @Produces("application/json") @JsonIgnore Response updateConfig(@PathParam("uuid") String configid, String json); @GET @Path("{uuid}") @Produces("application/json") @JsonIgnore Response getConfig(@PathParam("uuid") String configid); @DELETE @Path("{uuid}") @Produces("application/json") @JsonIgnore Response deleteConfig(@PathParam("uuid") String configid, String json); @GET @Produces("application/json") @JsonIgnore Response getAllConfigs(@QueryParam("adapter") String adapterType,
			@QueryParam("address") String address,@QueryParam("keyword") String keyword ); @GET @Path("reset") @Produces("application/json") @JsonIgnore Response resetConfigs(@QueryParam("password") String password ); void update(); static AdapterConfig getAdapterConfig(String adapterID); static AdapterConfig findAdapterConfigFromList(String adapterID, String type, ArrayNode adapters); static List<AdapterConfig> findAdapterConfigFromList(String type, ArrayNode adapters); static AdapterConfig findAdapterConfig(String adapterType, String lookupKey); static AdapterConfig findAdapterConfig(String adapterType, String localAddress, String keyword); static AdapterConfig findAdapterConfigByUsername(String username); static ArrayList<AdapterConfig> findAdapters(String adapterType, String myAddress, String keyword); static ArrayList<AdapterConfig> findAdapterByOwner(String accountId, String adapterType, String address); static ArrayList<AdapterConfig> findAdapterByAccount(String accountId, String adapterType, String address); static AdapterConfig getAdapterForOwner(String adapterId, String accountId); static List<AdapterConfig> findAdapterByOwnerList(List<String> adapterIds); static ArrayList<AdapterConfig> findAdaptersByList(Collection<String> adapterIDs); static ArrayList<AdapterConfig> findAdapterByAccount(String accountId); static boolean adapterExists(String adapterType, String myAddress, String keyword); static boolean updateSubscription(String configid, String subscriptionId); String getPreferred_language(); void setPreferred_language(String preferred_language); String getConfigId(); void setConfigId(String configId); String getPublicKey(); void setPublicKey(String publicKey); String getAdapterType(); void setAdapterType(String adapterType); @JsonIgnore String getURLForInboundScenario(Session session); String getInitialAgentURL(); void setInitialAgentURL(String initialAgentURL); @JsonIgnore Dialog getDialog(); String getAddress(); void setAddress(String address); String getMyAddress(); void setMyAddress(String myAddress); String getKeyword(); void setKeyword(String keyword); void setStatus(com.askfast.commons.Status status); com.askfast.commons.Status getStatus(); String getXsiURL(); void setXsiURL(String xsiURL); String getXsiUser(); void setXsiUser(String xsiUser); String getXsiPasswd(); void setXsiPasswd(String xsiPasswd); String getXsiSubscription(); void setXsiSubscription(String xsiSubscription); String getAccessToken(); void setAccessToken(String accessToken); String getAccessTokenSecret(); void setAccessTokenSecret(String accessTokenSecret); String getOwner(); void setOwner(String owner); Collection<String> getAccounts(); void addAccount(String accountId); void removeAccount(String accountId); void setAccounts(Collection<String> accounts); Boolean isAnonymous(); void setAnonymous(Boolean anonymous); Map<String, Object> getProperties(); T getProperties(String key, TypeReference<T> type); void setProperties( Map<String, Object> properties ); static void delete( String configId ); void delete(); @JsonIgnore void setDialogId(String dialogId); AccountType getAccountType(); void setAccountType(AccountType accountType); static AdapterConfig checkIfAdapterMatchesForAccountId(Collection<String> accountIds,
        AdapterConfig adapterConfig, boolean checkOwnerOnly); @JsonIgnore boolean isCallAdapter(); @JsonIgnore boolean isSMSAdapter(); @JsonIgnore AdapterProviders getProvider(); void addMediaProperties(String key, Object value); @JsonIgnore boolean isPrivate(); @JsonIgnore void markAsPrivate(); @JsonIgnore String getFormattedMyAddress(); @JsonIgnore Long getCreationTimestamp(); Long getAttachTimestamp(String accountId); Long getDetachTimestamp(String accountId); static final String ADAPTER_CREATION_TIME_KEY; static final String ADAPTER_PROVIDER_KEY; static final String ADAPTER_ATTACH_TIME_KEY; static final String ADAPTER_DETACH_TIME_KEY; static final String ACCESS_TOKEN_KEY; static final String ACCESS_TOKEN_SECRET_KEY; static final String XSI_USER_KEY; static final String XSI_PASSWORD_KEY; static final String DIALOG_ID_KEY; @Id
	public String configId; }
@Test public void adapterFetchByOwnedAccountsOnlyTest() throws Exception { String linkedAccountId = UUID.randomUUID().toString(); createAdapterWithOwnerAndSharedAccount(UUID.randomUUID().toString(), Arrays.asList(linkedAccountId)); TwigCompatibleMongoDatastore datastore = new TwigCompatibleMongoDatastore(); RootFindCommand<AdapterConfig> cmd = datastore.find().type(AdapterConfig.class); List<AdapterConfig> allAdapters = cmd.now().toArray(); assertTrue(allAdapters.size() == 1); allAdapters = AdapterConfig.findAdapterByOwner(linkedAccountId, null, null); assertTrue(allAdapters.size() == 0); }