repo_name
stringlengths 7
104
| file_path
stringlengths 13
198
| context
stringlengths 67
7.15k
| import_statement
stringlengths 16
4.43k
| code
stringlengths 40
6.98k
| prompt
stringlengths 227
8.27k
| next_line
stringlengths 8
795
|
---|---|---|---|---|---|---|
izumin5210/Sunazuri | app/src/main/java/info/izumin/android/sunazuri/infrastructure/repository/source/oauth/OauthRemoteDataSource.java | // Path: app/src/main/java/info/izumin/android/sunazuri/infrastructure/api/OauthApi.java
// public interface OauthApi {
// @POST("/oauth/token")
// Single<AccessTokenEntity> fetchToken(
// @Query("client_id") String clientId,
// @Query("client_secret") String clientSecret,
// @Query("grant_type") String grantType,
// @Query("redirect_uri") String redirectUri,
// @Query("code") String code
// );
//
// @POST("/oauth/revoke")
// Completable revoke(
// @Header("Authorization") String authorization
// );
// }
//
// Path: app/src/main/java/info/izumin/android/sunazuri/infrastructure/api/UsersApi.java
// public interface UsersApi {
// @GET("/v1/user")
// Single<AuthorizedUserEntity> fetch(
// @Query("access_token") String accessToken
// );
// }
//
// Path: app/src/main/java/info/izumin/android/sunazuri/infrastructure/cache/LoginCache.java
// public interface LoginCache {
// long getUserId();
// void putUserId(long userId);
// String getTeamId();
// void putTeamName(String teamName);
// void removeAll();
// boolean isUserCached();
// boolean isTeamCached();
// }
//
// Path: app/src/main/java/info/izumin/android/sunazuri/infrastructure/entity/AccessTokenEntity.java
// @Table
// @JsonSerializable(fieldNamingPolicy = FieldNamingPolicy.LOWER_CASE_WITH_UNDERSCORES)
// public class AccessTokenEntity {
// public static final String TAG = AccessTokenEntity.class.getSimpleName();
//
// @Column
// public String accessToken;
//
// @Column
// public String tokenType;
//
// @Column
// public String scope;
//
// @PrimaryKey(auto = false)
// @Column
// public AuthorizedUserEntity user;
// }
//
// Path: app/src/main/java/info/izumin/android/sunazuri/infrastructure/entity/OauthParams.java
// public class OauthParams {
// public static final String TAG = OauthParams.class.getSimpleName();
//
// public final String endpoint;
// public final String clientId;
// public final String clientSecret;
// public final String redirectUri;
// public final String scope;
// public final String responseType;
// public final String authorizePath;
// public final String grantType;
//
// public OauthParams(String endpoint, String clientId, String clientSecret, String redirectUri, String scope, String responseType, String authorizePath, String grantType) {
// this.endpoint = endpoint;
// this.clientId = clientId;
// this.clientSecret = clientSecret;
// this.redirectUri = redirectUri;
// this.scope = scope;
// this.responseType = responseType;
// this.authorizePath = authorizePath;
// this.grantType = grantType;
// }
//
// public String getAuthorizeUri() {
// return endpoint + authorizePath
// + "?client_id=" + clientId
// + "&redirect_uri=" + redirectUri
// + "&scope=" + scope
// + "&response_type=" + responseType;
// }
// }
| import info.izumin.android.sunazuri.infrastructure.api.OauthApi;
import info.izumin.android.sunazuri.infrastructure.api.UsersApi;
import info.izumin.android.sunazuri.infrastructure.cache.LoginCache;
import info.izumin.android.sunazuri.infrastructure.dao.AccessTokenDao;
import info.izumin.android.sunazuri.infrastructure.entity.AccessTokenEntity;
import info.izumin.android.sunazuri.infrastructure.entity.OauthParams;
import info.izumin.android.sunazuri.infrastructure.util.Encryptor;
import rx.Observable;
import rx.Single;
import java.util.List; | package info.izumin.android.sunazuri.infrastructure.repository.source.oauth;
/**
* Created by izumin on 5/13/2016 AD.
*/
class OauthRemoteDataSource implements OauthDataSource {
public static final String TAG = OauthRemoteDataSource.class.getSimpleName();
private final UsersApi usersApi;
private final OauthApi oauthApi;
private final OauthParams oauthParams;
private final AccessTokenDao accessTokenDao;
private final Encryptor encryptor; | // Path: app/src/main/java/info/izumin/android/sunazuri/infrastructure/api/OauthApi.java
// public interface OauthApi {
// @POST("/oauth/token")
// Single<AccessTokenEntity> fetchToken(
// @Query("client_id") String clientId,
// @Query("client_secret") String clientSecret,
// @Query("grant_type") String grantType,
// @Query("redirect_uri") String redirectUri,
// @Query("code") String code
// );
//
// @POST("/oauth/revoke")
// Completable revoke(
// @Header("Authorization") String authorization
// );
// }
//
// Path: app/src/main/java/info/izumin/android/sunazuri/infrastructure/api/UsersApi.java
// public interface UsersApi {
// @GET("/v1/user")
// Single<AuthorizedUserEntity> fetch(
// @Query("access_token") String accessToken
// );
// }
//
// Path: app/src/main/java/info/izumin/android/sunazuri/infrastructure/cache/LoginCache.java
// public interface LoginCache {
// long getUserId();
// void putUserId(long userId);
// String getTeamId();
// void putTeamName(String teamName);
// void removeAll();
// boolean isUserCached();
// boolean isTeamCached();
// }
//
// Path: app/src/main/java/info/izumin/android/sunazuri/infrastructure/entity/AccessTokenEntity.java
// @Table
// @JsonSerializable(fieldNamingPolicy = FieldNamingPolicy.LOWER_CASE_WITH_UNDERSCORES)
// public class AccessTokenEntity {
// public static final String TAG = AccessTokenEntity.class.getSimpleName();
//
// @Column
// public String accessToken;
//
// @Column
// public String tokenType;
//
// @Column
// public String scope;
//
// @PrimaryKey(auto = false)
// @Column
// public AuthorizedUserEntity user;
// }
//
// Path: app/src/main/java/info/izumin/android/sunazuri/infrastructure/entity/OauthParams.java
// public class OauthParams {
// public static final String TAG = OauthParams.class.getSimpleName();
//
// public final String endpoint;
// public final String clientId;
// public final String clientSecret;
// public final String redirectUri;
// public final String scope;
// public final String responseType;
// public final String authorizePath;
// public final String grantType;
//
// public OauthParams(String endpoint, String clientId, String clientSecret, String redirectUri, String scope, String responseType, String authorizePath, String grantType) {
// this.endpoint = endpoint;
// this.clientId = clientId;
// this.clientSecret = clientSecret;
// this.redirectUri = redirectUri;
// this.scope = scope;
// this.responseType = responseType;
// this.authorizePath = authorizePath;
// this.grantType = grantType;
// }
//
// public String getAuthorizeUri() {
// return endpoint + authorizePath
// + "?client_id=" + clientId
// + "&redirect_uri=" + redirectUri
// + "&scope=" + scope
// + "&response_type=" + responseType;
// }
// }
// Path: app/src/main/java/info/izumin/android/sunazuri/infrastructure/repository/source/oauth/OauthRemoteDataSource.java
import info.izumin.android.sunazuri.infrastructure.api.OauthApi;
import info.izumin.android.sunazuri.infrastructure.api.UsersApi;
import info.izumin.android.sunazuri.infrastructure.cache.LoginCache;
import info.izumin.android.sunazuri.infrastructure.dao.AccessTokenDao;
import info.izumin.android.sunazuri.infrastructure.entity.AccessTokenEntity;
import info.izumin.android.sunazuri.infrastructure.entity.OauthParams;
import info.izumin.android.sunazuri.infrastructure.util.Encryptor;
import rx.Observable;
import rx.Single;
import java.util.List;
package info.izumin.android.sunazuri.infrastructure.repository.source.oauth;
/**
* Created by izumin on 5/13/2016 AD.
*/
class OauthRemoteDataSource implements OauthDataSource {
public static final String TAG = OauthRemoteDataSource.class.getSimpleName();
private final UsersApi usersApi;
private final OauthApi oauthApi;
private final OauthParams oauthParams;
private final AccessTokenDao accessTokenDao;
private final Encryptor encryptor; | private final LoginCache loginCache; |
izumin5210/Sunazuri | app/src/main/java/info/izumin/android/sunazuri/infrastructure/repository/source/oauth/OauthRemoteDataSource.java | // Path: app/src/main/java/info/izumin/android/sunazuri/infrastructure/api/OauthApi.java
// public interface OauthApi {
// @POST("/oauth/token")
// Single<AccessTokenEntity> fetchToken(
// @Query("client_id") String clientId,
// @Query("client_secret") String clientSecret,
// @Query("grant_type") String grantType,
// @Query("redirect_uri") String redirectUri,
// @Query("code") String code
// );
//
// @POST("/oauth/revoke")
// Completable revoke(
// @Header("Authorization") String authorization
// );
// }
//
// Path: app/src/main/java/info/izumin/android/sunazuri/infrastructure/api/UsersApi.java
// public interface UsersApi {
// @GET("/v1/user")
// Single<AuthorizedUserEntity> fetch(
// @Query("access_token") String accessToken
// );
// }
//
// Path: app/src/main/java/info/izumin/android/sunazuri/infrastructure/cache/LoginCache.java
// public interface LoginCache {
// long getUserId();
// void putUserId(long userId);
// String getTeamId();
// void putTeamName(String teamName);
// void removeAll();
// boolean isUserCached();
// boolean isTeamCached();
// }
//
// Path: app/src/main/java/info/izumin/android/sunazuri/infrastructure/entity/AccessTokenEntity.java
// @Table
// @JsonSerializable(fieldNamingPolicy = FieldNamingPolicy.LOWER_CASE_WITH_UNDERSCORES)
// public class AccessTokenEntity {
// public static final String TAG = AccessTokenEntity.class.getSimpleName();
//
// @Column
// public String accessToken;
//
// @Column
// public String tokenType;
//
// @Column
// public String scope;
//
// @PrimaryKey(auto = false)
// @Column
// public AuthorizedUserEntity user;
// }
//
// Path: app/src/main/java/info/izumin/android/sunazuri/infrastructure/entity/OauthParams.java
// public class OauthParams {
// public static final String TAG = OauthParams.class.getSimpleName();
//
// public final String endpoint;
// public final String clientId;
// public final String clientSecret;
// public final String redirectUri;
// public final String scope;
// public final String responseType;
// public final String authorizePath;
// public final String grantType;
//
// public OauthParams(String endpoint, String clientId, String clientSecret, String redirectUri, String scope, String responseType, String authorizePath, String grantType) {
// this.endpoint = endpoint;
// this.clientId = clientId;
// this.clientSecret = clientSecret;
// this.redirectUri = redirectUri;
// this.scope = scope;
// this.responseType = responseType;
// this.authorizePath = authorizePath;
// this.grantType = grantType;
// }
//
// public String getAuthorizeUri() {
// return endpoint + authorizePath
// + "?client_id=" + clientId
// + "&redirect_uri=" + redirectUri
// + "&scope=" + scope
// + "&response_type=" + responseType;
// }
// }
| import info.izumin.android.sunazuri.infrastructure.api.OauthApi;
import info.izumin.android.sunazuri.infrastructure.api.UsersApi;
import info.izumin.android.sunazuri.infrastructure.cache.LoginCache;
import info.izumin.android.sunazuri.infrastructure.dao.AccessTokenDao;
import info.izumin.android.sunazuri.infrastructure.entity.AccessTokenEntity;
import info.izumin.android.sunazuri.infrastructure.entity.OauthParams;
import info.izumin.android.sunazuri.infrastructure.util.Encryptor;
import rx.Observable;
import rx.Single;
import java.util.List; | package info.izumin.android.sunazuri.infrastructure.repository.source.oauth;
/**
* Created by izumin on 5/13/2016 AD.
*/
class OauthRemoteDataSource implements OauthDataSource {
public static final String TAG = OauthRemoteDataSource.class.getSimpleName();
private final UsersApi usersApi;
private final OauthApi oauthApi;
private final OauthParams oauthParams;
private final AccessTokenDao accessTokenDao;
private final Encryptor encryptor;
private final LoginCache loginCache;
OauthRemoteDataSource(UsersApi usersApi,
OauthApi oauthApi,
OauthParams oauthParams,
AccessTokenDao accessTokenDao,
Encryptor encryptor,
LoginCache loginCache) {
this.usersApi = usersApi;
this.oauthApi = oauthApi;
this.oauthParams = oauthParams;
this.accessTokenDao = accessTokenDao;
this.encryptor = encryptor;
this.loginCache = loginCache;
}
@Override | // Path: app/src/main/java/info/izumin/android/sunazuri/infrastructure/api/OauthApi.java
// public interface OauthApi {
// @POST("/oauth/token")
// Single<AccessTokenEntity> fetchToken(
// @Query("client_id") String clientId,
// @Query("client_secret") String clientSecret,
// @Query("grant_type") String grantType,
// @Query("redirect_uri") String redirectUri,
// @Query("code") String code
// );
//
// @POST("/oauth/revoke")
// Completable revoke(
// @Header("Authorization") String authorization
// );
// }
//
// Path: app/src/main/java/info/izumin/android/sunazuri/infrastructure/api/UsersApi.java
// public interface UsersApi {
// @GET("/v1/user")
// Single<AuthorizedUserEntity> fetch(
// @Query("access_token") String accessToken
// );
// }
//
// Path: app/src/main/java/info/izumin/android/sunazuri/infrastructure/cache/LoginCache.java
// public interface LoginCache {
// long getUserId();
// void putUserId(long userId);
// String getTeamId();
// void putTeamName(String teamName);
// void removeAll();
// boolean isUserCached();
// boolean isTeamCached();
// }
//
// Path: app/src/main/java/info/izumin/android/sunazuri/infrastructure/entity/AccessTokenEntity.java
// @Table
// @JsonSerializable(fieldNamingPolicy = FieldNamingPolicy.LOWER_CASE_WITH_UNDERSCORES)
// public class AccessTokenEntity {
// public static final String TAG = AccessTokenEntity.class.getSimpleName();
//
// @Column
// public String accessToken;
//
// @Column
// public String tokenType;
//
// @Column
// public String scope;
//
// @PrimaryKey(auto = false)
// @Column
// public AuthorizedUserEntity user;
// }
//
// Path: app/src/main/java/info/izumin/android/sunazuri/infrastructure/entity/OauthParams.java
// public class OauthParams {
// public static final String TAG = OauthParams.class.getSimpleName();
//
// public final String endpoint;
// public final String clientId;
// public final String clientSecret;
// public final String redirectUri;
// public final String scope;
// public final String responseType;
// public final String authorizePath;
// public final String grantType;
//
// public OauthParams(String endpoint, String clientId, String clientSecret, String redirectUri, String scope, String responseType, String authorizePath, String grantType) {
// this.endpoint = endpoint;
// this.clientId = clientId;
// this.clientSecret = clientSecret;
// this.redirectUri = redirectUri;
// this.scope = scope;
// this.responseType = responseType;
// this.authorizePath = authorizePath;
// this.grantType = grantType;
// }
//
// public String getAuthorizeUri() {
// return endpoint + authorizePath
// + "?client_id=" + clientId
// + "&redirect_uri=" + redirectUri
// + "&scope=" + scope
// + "&response_type=" + responseType;
// }
// }
// Path: app/src/main/java/info/izumin/android/sunazuri/infrastructure/repository/source/oauth/OauthRemoteDataSource.java
import info.izumin.android.sunazuri.infrastructure.api.OauthApi;
import info.izumin.android.sunazuri.infrastructure.api.UsersApi;
import info.izumin.android.sunazuri.infrastructure.cache.LoginCache;
import info.izumin.android.sunazuri.infrastructure.dao.AccessTokenDao;
import info.izumin.android.sunazuri.infrastructure.entity.AccessTokenEntity;
import info.izumin.android.sunazuri.infrastructure.entity.OauthParams;
import info.izumin.android.sunazuri.infrastructure.util.Encryptor;
import rx.Observable;
import rx.Single;
import java.util.List;
package info.izumin.android.sunazuri.infrastructure.repository.source.oauth;
/**
* Created by izumin on 5/13/2016 AD.
*/
class OauthRemoteDataSource implements OauthDataSource {
public static final String TAG = OauthRemoteDataSource.class.getSimpleName();
private final UsersApi usersApi;
private final OauthApi oauthApi;
private final OauthParams oauthParams;
private final AccessTokenDao accessTokenDao;
private final Encryptor encryptor;
private final LoginCache loginCache;
OauthRemoteDataSource(UsersApi usersApi,
OauthApi oauthApi,
OauthParams oauthParams,
AccessTokenDao accessTokenDao,
Encryptor encryptor,
LoginCache loginCache) {
this.usersApi = usersApi;
this.oauthApi = oauthApi;
this.oauthParams = oauthParams;
this.accessTokenDao = accessTokenDao;
this.encryptor = encryptor;
this.loginCache = loginCache;
}
@Override | public Single<AccessTokenEntity> getToken(String code) { |
izumin5210/Sunazuri | app/src/main/java/info/izumin/android/sunazuri/infrastructure/api/UsersApi.java | // Path: app/src/main/java/info/izumin/android/sunazuri/infrastructure/entity/AuthorizedUserEntity.java
// @Table
// @JsonSerializable(fieldNamingPolicy = FieldNamingPolicy.LOWER_CASE_WITH_UNDERSCORES)
// public class AuthorizedUserEntity {
// public static final String TAG = AuthorizedUserEntity.class.getSimpleName();
//
// @PrimaryKey(auto = false)
// @Column
// public long id;
//
// @Column
// public String name;
//
// @Column(indexed = true)
// public String screenName;
//
// @Column
// public Date createdAt;
//
// @Column
// public Date updatedAt;
//
// @Column
// public String icon;
//
// @Column
// public String email;
// }
| import info.izumin.android.sunazuri.infrastructure.entity.AuthorizedUserEntity;
import retrofit2.http.GET;
import retrofit2.http.Query;
import rx.Single; | package info.izumin.android.sunazuri.infrastructure.api;
/**
* Created by izumin on 5/21/2016 AD.
*/
public interface UsersApi {
@GET("/v1/user") | // Path: app/src/main/java/info/izumin/android/sunazuri/infrastructure/entity/AuthorizedUserEntity.java
// @Table
// @JsonSerializable(fieldNamingPolicy = FieldNamingPolicy.LOWER_CASE_WITH_UNDERSCORES)
// public class AuthorizedUserEntity {
// public static final String TAG = AuthorizedUserEntity.class.getSimpleName();
//
// @PrimaryKey(auto = false)
// @Column
// public long id;
//
// @Column
// public String name;
//
// @Column(indexed = true)
// public String screenName;
//
// @Column
// public Date createdAt;
//
// @Column
// public Date updatedAt;
//
// @Column
// public String icon;
//
// @Column
// public String email;
// }
// Path: app/src/main/java/info/izumin/android/sunazuri/infrastructure/api/UsersApi.java
import info.izumin.android.sunazuri.infrastructure.entity.AuthorizedUserEntity;
import retrofit2.http.GET;
import retrofit2.http.Query;
import rx.Single;
package info.izumin.android.sunazuri.infrastructure.api;
/**
* Created by izumin on 5/21/2016 AD.
*/
public interface UsersApi {
@GET("/v1/user") | Single<AuthorizedUserEntity> fetch( |
izumin5210/Sunazuri | app/src/main/java/info/izumin/android/sunazuri/domain/repository/UsersRepository.java | // Path: app/src/main/java/info/izumin/android/sunazuri/domain/entity/AuthorizedUser.java
// public class AuthorizedUser {
// public static final String TAG = AuthorizedUser.class.getSimpleName();
//
// public final long id;
// public final String name;
// public final String screenName;
// public final Date createdAt;
// public final Date updatedAt;
// public final String icon;
// public final String email;
//
// public final AccessToken token;
//
// public AuthorizedUser(long id,
// String name,
// String screenName,
// Date createdAt,
// Date updatedAt,
// String icon,
// String email,
// AccessToken token) {
// this.id = id;
// this.name = name;
// this.screenName = screenName;
// this.createdAt = createdAt;
// this.updatedAt = updatedAt;
// this.icon = icon;
// this.email = email;
// this.token = token;
// }
// }
//
// Path: app/src/main/java/info/izumin/android/sunazuri/domain/entity/LoginInfo.java
// public class LoginInfo {
// public static final String TAG = LoginInfo.class.getSimpleName();
//
// public final AuthorizedUser user;
// public final Team team;
//
// public LoginInfo(AuthorizedUser user, Team team) {
// this.user = user;
// this.team = team;
// }
// }
| import info.izumin.android.sunazuri.domain.entity.AuthorizedUser;
import info.izumin.android.sunazuri.domain.entity.LoginInfo;
import rx.Observable;
import rx.Single;
import java.util.List; | package info.izumin.android.sunazuri.domain.repository;
/**
* Created by izumin on 5/24/2016 AD.
*/
public interface UsersRepository {
Observable<AuthorizedUser> getCurrentUser();
Single<List<AuthorizedUser>> getAuthorizedUsers(); | // Path: app/src/main/java/info/izumin/android/sunazuri/domain/entity/AuthorizedUser.java
// public class AuthorizedUser {
// public static final String TAG = AuthorizedUser.class.getSimpleName();
//
// public final long id;
// public final String name;
// public final String screenName;
// public final Date createdAt;
// public final Date updatedAt;
// public final String icon;
// public final String email;
//
// public final AccessToken token;
//
// public AuthorizedUser(long id,
// String name,
// String screenName,
// Date createdAt,
// Date updatedAt,
// String icon,
// String email,
// AccessToken token) {
// this.id = id;
// this.name = name;
// this.screenName = screenName;
// this.createdAt = createdAt;
// this.updatedAt = updatedAt;
// this.icon = icon;
// this.email = email;
// this.token = token;
// }
// }
//
// Path: app/src/main/java/info/izumin/android/sunazuri/domain/entity/LoginInfo.java
// public class LoginInfo {
// public static final String TAG = LoginInfo.class.getSimpleName();
//
// public final AuthorizedUser user;
// public final Team team;
//
// public LoginInfo(AuthorizedUser user, Team team) {
// this.user = user;
// this.team = team;
// }
// }
// Path: app/src/main/java/info/izumin/android/sunazuri/domain/repository/UsersRepository.java
import info.izumin.android.sunazuri.domain.entity.AuthorizedUser;
import info.izumin.android.sunazuri.domain.entity.LoginInfo;
import rx.Observable;
import rx.Single;
import java.util.List;
package info.izumin.android.sunazuri.domain.repository;
/**
* Created by izumin on 5/24/2016 AD.
*/
public interface UsersRepository {
Observable<AuthorizedUser> getCurrentUser();
Single<List<AuthorizedUser>> getAuthorizedUsers(); | Observable<LoginInfo> getLoginInfo(); |
izumin5210/Sunazuri | app/src/main/java/info/izumin/android/sunazuri/infrastructure/InfrastructureComponent.java | // Path: app/src/main/java/info/izumin/android/sunazuri/domain/repository/OauthRepository.java
// public interface OauthRepository {
// Single<AuthorizedUser> getToken(String code);
// }
//
// Path: app/src/main/java/info/izumin/android/sunazuri/domain/repository/TeamsRepository.java
// public interface TeamsRepository {
// Single<List<Team>> get(AuthorizedUser user);
// }
//
// Path: app/src/main/java/info/izumin/android/sunazuri/domain/repository/UsersRepository.java
// public interface UsersRepository {
// Observable<AuthorizedUser> getCurrentUser();
// Single<List<AuthorizedUser>> getAuthorizedUsers();
// Observable<LoginInfo> getLoginInfo();
// }
//
// Path: app/src/main/java/info/izumin/android/sunazuri/infrastructure/api/ApiModule.java
// @Module
// public class ApiModule {
// public static final String TAG = ApiModule.class.getSimpleName();
//
// private final String apiEndpoint;
// private final OauthParams oauthParams;
// private final List<String> responseEnvelopKeys;
//
// public ApiModule(String apiEndpoint, OauthParams oauthParams, List<String> responseEnvelopKeys) {
// this.apiEndpoint = apiEndpoint;
// this.oauthParams = oauthParams;
// this.responseEnvelopKeys = responseEnvelopKeys;
// }
//
// @Provides
// @Singleton
// EnvelopeTypeAdapterFactory envelopeTypeAdapterFactory() {
// return new EnvelopeTypeAdapterFactory(responseEnvelopKeys);
// }
//
// @Provides
// @Singleton
// Gson gson(EnvelopeTypeAdapterFactory envelopeTypeAdapterFactory) {
// return new GsonBuilder()
// .registerTypeAdapterFactory(StaticGsonTypeAdapterFactory.newInstance())
// .registerTypeAdapterFactory(envelopeTypeAdapterFactory)
// .create();
// }
//
// @Provides
// @Singleton
// Retrofit retrofit(OkHttpClient client, Gson gson) {
// return new Retrofit.Builder()
// .client(client)
// .baseUrl(apiEndpoint)
// .addCallAdapterFactory(RxJavaCallAdapterFactory.create())
// .addConverterFactory(GsonConverterFactory.create(gson))
// .build();
// }
//
// @Provides
// @Singleton
// OauthApi oauthApi(Retrofit retrofit) {
// return retrofit.create(OauthApi.class);
// }
//
// @Provides
// @Singleton
// TeamsApi teamsApi(Retrofit retrofit) {
// return retrofit.create(TeamsApi.class);
// }
//
// @Provides
// @Singleton
// UsersApi usersApi(Retrofit retrofit) {
// return retrofit.create(UsersApi.class);
// }
//
// @Provides
// @Singleton
// OauthParams oauthParams() {
// return oauthParams;
// }
// }
//
// Path: app/src/main/java/info/izumin/android/sunazuri/infrastructure/cache/CacheModule.java
// @Module
// public class CacheModule {
// public static final String TAG = CacheModule.class.getSimpleName();
//
// @Provides
// @Singleton
// LoginCache loginCache(LoginCacheImpl cache) {
// return cache;
// }
// }
//
// Path: app/src/main/java/info/izumin/android/sunazuri/infrastructure/entity/OauthParams.java
// public class OauthParams {
// public static final String TAG = OauthParams.class.getSimpleName();
//
// public final String endpoint;
// public final String clientId;
// public final String clientSecret;
// public final String redirectUri;
// public final String scope;
// public final String responseType;
// public final String authorizePath;
// public final String grantType;
//
// public OauthParams(String endpoint, String clientId, String clientSecret, String redirectUri, String scope, String responseType, String authorizePath, String grantType) {
// this.endpoint = endpoint;
// this.clientId = clientId;
// this.clientSecret = clientSecret;
// this.redirectUri = redirectUri;
// this.scope = scope;
// this.responseType = responseType;
// this.authorizePath = authorizePath;
// this.grantType = grantType;
// }
//
// public String getAuthorizeUri() {
// return endpoint + authorizePath
// + "?client_id=" + clientId
// + "&redirect_uri=" + redirectUri
// + "&scope=" + scope
// + "&response_type=" + responseType;
// }
// }
//
// Path: app/src/main/java/info/izumin/android/sunazuri/infrastructure/repository/RepositoryModule.java
// @Module(
// includes = {
// OauthRepositoryModule.class,
// TeamsRepositoryModule.class
// }
// )
// public class RepositoryModule {
// public static final String TAG = RepositoryModule.class.getSimpleName();
//
// @Provides
// @Singleton
// UsersRepository usersRepository(UsersRepositoryImpl repo) {
// return repo;
// }
// }
| import dagger.Component;
import info.izumin.android.sunazuri.domain.repository.OauthRepository;
import info.izumin.android.sunazuri.domain.repository.TeamsRepository;
import info.izumin.android.sunazuri.domain.repository.UsersRepository;
import info.izumin.android.sunazuri.infrastructure.api.ApiModule;
import info.izumin.android.sunazuri.infrastructure.cache.CacheModule;
import info.izumin.android.sunazuri.infrastructure.entity.OauthParams;
import info.izumin.android.sunazuri.infrastructure.repository.RepositoryModule;
import okhttp3.OkHttpClient;
import javax.inject.Singleton; | package info.izumin.android.sunazuri.infrastructure;
/**
* Created by izumin on 5/13/2016 AD.
*/
@Singleton
@Component(
modules = {
InfrastructureModule.class, | // Path: app/src/main/java/info/izumin/android/sunazuri/domain/repository/OauthRepository.java
// public interface OauthRepository {
// Single<AuthorizedUser> getToken(String code);
// }
//
// Path: app/src/main/java/info/izumin/android/sunazuri/domain/repository/TeamsRepository.java
// public interface TeamsRepository {
// Single<List<Team>> get(AuthorizedUser user);
// }
//
// Path: app/src/main/java/info/izumin/android/sunazuri/domain/repository/UsersRepository.java
// public interface UsersRepository {
// Observable<AuthorizedUser> getCurrentUser();
// Single<List<AuthorizedUser>> getAuthorizedUsers();
// Observable<LoginInfo> getLoginInfo();
// }
//
// Path: app/src/main/java/info/izumin/android/sunazuri/infrastructure/api/ApiModule.java
// @Module
// public class ApiModule {
// public static final String TAG = ApiModule.class.getSimpleName();
//
// private final String apiEndpoint;
// private final OauthParams oauthParams;
// private final List<String> responseEnvelopKeys;
//
// public ApiModule(String apiEndpoint, OauthParams oauthParams, List<String> responseEnvelopKeys) {
// this.apiEndpoint = apiEndpoint;
// this.oauthParams = oauthParams;
// this.responseEnvelopKeys = responseEnvelopKeys;
// }
//
// @Provides
// @Singleton
// EnvelopeTypeAdapterFactory envelopeTypeAdapterFactory() {
// return new EnvelopeTypeAdapterFactory(responseEnvelopKeys);
// }
//
// @Provides
// @Singleton
// Gson gson(EnvelopeTypeAdapterFactory envelopeTypeAdapterFactory) {
// return new GsonBuilder()
// .registerTypeAdapterFactory(StaticGsonTypeAdapterFactory.newInstance())
// .registerTypeAdapterFactory(envelopeTypeAdapterFactory)
// .create();
// }
//
// @Provides
// @Singleton
// Retrofit retrofit(OkHttpClient client, Gson gson) {
// return new Retrofit.Builder()
// .client(client)
// .baseUrl(apiEndpoint)
// .addCallAdapterFactory(RxJavaCallAdapterFactory.create())
// .addConverterFactory(GsonConverterFactory.create(gson))
// .build();
// }
//
// @Provides
// @Singleton
// OauthApi oauthApi(Retrofit retrofit) {
// return retrofit.create(OauthApi.class);
// }
//
// @Provides
// @Singleton
// TeamsApi teamsApi(Retrofit retrofit) {
// return retrofit.create(TeamsApi.class);
// }
//
// @Provides
// @Singleton
// UsersApi usersApi(Retrofit retrofit) {
// return retrofit.create(UsersApi.class);
// }
//
// @Provides
// @Singleton
// OauthParams oauthParams() {
// return oauthParams;
// }
// }
//
// Path: app/src/main/java/info/izumin/android/sunazuri/infrastructure/cache/CacheModule.java
// @Module
// public class CacheModule {
// public static final String TAG = CacheModule.class.getSimpleName();
//
// @Provides
// @Singleton
// LoginCache loginCache(LoginCacheImpl cache) {
// return cache;
// }
// }
//
// Path: app/src/main/java/info/izumin/android/sunazuri/infrastructure/entity/OauthParams.java
// public class OauthParams {
// public static final String TAG = OauthParams.class.getSimpleName();
//
// public final String endpoint;
// public final String clientId;
// public final String clientSecret;
// public final String redirectUri;
// public final String scope;
// public final String responseType;
// public final String authorizePath;
// public final String grantType;
//
// public OauthParams(String endpoint, String clientId, String clientSecret, String redirectUri, String scope, String responseType, String authorizePath, String grantType) {
// this.endpoint = endpoint;
// this.clientId = clientId;
// this.clientSecret = clientSecret;
// this.redirectUri = redirectUri;
// this.scope = scope;
// this.responseType = responseType;
// this.authorizePath = authorizePath;
// this.grantType = grantType;
// }
//
// public String getAuthorizeUri() {
// return endpoint + authorizePath
// + "?client_id=" + clientId
// + "&redirect_uri=" + redirectUri
// + "&scope=" + scope
// + "&response_type=" + responseType;
// }
// }
//
// Path: app/src/main/java/info/izumin/android/sunazuri/infrastructure/repository/RepositoryModule.java
// @Module(
// includes = {
// OauthRepositoryModule.class,
// TeamsRepositoryModule.class
// }
// )
// public class RepositoryModule {
// public static final String TAG = RepositoryModule.class.getSimpleName();
//
// @Provides
// @Singleton
// UsersRepository usersRepository(UsersRepositoryImpl repo) {
// return repo;
// }
// }
// Path: app/src/main/java/info/izumin/android/sunazuri/infrastructure/InfrastructureComponent.java
import dagger.Component;
import info.izumin.android.sunazuri.domain.repository.OauthRepository;
import info.izumin.android.sunazuri.domain.repository.TeamsRepository;
import info.izumin.android.sunazuri.domain.repository.UsersRepository;
import info.izumin.android.sunazuri.infrastructure.api.ApiModule;
import info.izumin.android.sunazuri.infrastructure.cache.CacheModule;
import info.izumin.android.sunazuri.infrastructure.entity.OauthParams;
import info.izumin.android.sunazuri.infrastructure.repository.RepositoryModule;
import okhttp3.OkHttpClient;
import javax.inject.Singleton;
package info.izumin.android.sunazuri.infrastructure;
/**
* Created by izumin on 5/13/2016 AD.
*/
@Singleton
@Component(
modules = {
InfrastructureModule.class, | RepositoryModule.class, |
izumin5210/Sunazuri | app/src/main/java/info/izumin/android/sunazuri/infrastructure/InfrastructureComponent.java | // Path: app/src/main/java/info/izumin/android/sunazuri/domain/repository/OauthRepository.java
// public interface OauthRepository {
// Single<AuthorizedUser> getToken(String code);
// }
//
// Path: app/src/main/java/info/izumin/android/sunazuri/domain/repository/TeamsRepository.java
// public interface TeamsRepository {
// Single<List<Team>> get(AuthorizedUser user);
// }
//
// Path: app/src/main/java/info/izumin/android/sunazuri/domain/repository/UsersRepository.java
// public interface UsersRepository {
// Observable<AuthorizedUser> getCurrentUser();
// Single<List<AuthorizedUser>> getAuthorizedUsers();
// Observable<LoginInfo> getLoginInfo();
// }
//
// Path: app/src/main/java/info/izumin/android/sunazuri/infrastructure/api/ApiModule.java
// @Module
// public class ApiModule {
// public static final String TAG = ApiModule.class.getSimpleName();
//
// private final String apiEndpoint;
// private final OauthParams oauthParams;
// private final List<String> responseEnvelopKeys;
//
// public ApiModule(String apiEndpoint, OauthParams oauthParams, List<String> responseEnvelopKeys) {
// this.apiEndpoint = apiEndpoint;
// this.oauthParams = oauthParams;
// this.responseEnvelopKeys = responseEnvelopKeys;
// }
//
// @Provides
// @Singleton
// EnvelopeTypeAdapterFactory envelopeTypeAdapterFactory() {
// return new EnvelopeTypeAdapterFactory(responseEnvelopKeys);
// }
//
// @Provides
// @Singleton
// Gson gson(EnvelopeTypeAdapterFactory envelopeTypeAdapterFactory) {
// return new GsonBuilder()
// .registerTypeAdapterFactory(StaticGsonTypeAdapterFactory.newInstance())
// .registerTypeAdapterFactory(envelopeTypeAdapterFactory)
// .create();
// }
//
// @Provides
// @Singleton
// Retrofit retrofit(OkHttpClient client, Gson gson) {
// return new Retrofit.Builder()
// .client(client)
// .baseUrl(apiEndpoint)
// .addCallAdapterFactory(RxJavaCallAdapterFactory.create())
// .addConverterFactory(GsonConverterFactory.create(gson))
// .build();
// }
//
// @Provides
// @Singleton
// OauthApi oauthApi(Retrofit retrofit) {
// return retrofit.create(OauthApi.class);
// }
//
// @Provides
// @Singleton
// TeamsApi teamsApi(Retrofit retrofit) {
// return retrofit.create(TeamsApi.class);
// }
//
// @Provides
// @Singleton
// UsersApi usersApi(Retrofit retrofit) {
// return retrofit.create(UsersApi.class);
// }
//
// @Provides
// @Singleton
// OauthParams oauthParams() {
// return oauthParams;
// }
// }
//
// Path: app/src/main/java/info/izumin/android/sunazuri/infrastructure/cache/CacheModule.java
// @Module
// public class CacheModule {
// public static final String TAG = CacheModule.class.getSimpleName();
//
// @Provides
// @Singleton
// LoginCache loginCache(LoginCacheImpl cache) {
// return cache;
// }
// }
//
// Path: app/src/main/java/info/izumin/android/sunazuri/infrastructure/entity/OauthParams.java
// public class OauthParams {
// public static final String TAG = OauthParams.class.getSimpleName();
//
// public final String endpoint;
// public final String clientId;
// public final String clientSecret;
// public final String redirectUri;
// public final String scope;
// public final String responseType;
// public final String authorizePath;
// public final String grantType;
//
// public OauthParams(String endpoint, String clientId, String clientSecret, String redirectUri, String scope, String responseType, String authorizePath, String grantType) {
// this.endpoint = endpoint;
// this.clientId = clientId;
// this.clientSecret = clientSecret;
// this.redirectUri = redirectUri;
// this.scope = scope;
// this.responseType = responseType;
// this.authorizePath = authorizePath;
// this.grantType = grantType;
// }
//
// public String getAuthorizeUri() {
// return endpoint + authorizePath
// + "?client_id=" + clientId
// + "&redirect_uri=" + redirectUri
// + "&scope=" + scope
// + "&response_type=" + responseType;
// }
// }
//
// Path: app/src/main/java/info/izumin/android/sunazuri/infrastructure/repository/RepositoryModule.java
// @Module(
// includes = {
// OauthRepositoryModule.class,
// TeamsRepositoryModule.class
// }
// )
// public class RepositoryModule {
// public static final String TAG = RepositoryModule.class.getSimpleName();
//
// @Provides
// @Singleton
// UsersRepository usersRepository(UsersRepositoryImpl repo) {
// return repo;
// }
// }
| import dagger.Component;
import info.izumin.android.sunazuri.domain.repository.OauthRepository;
import info.izumin.android.sunazuri.domain.repository.TeamsRepository;
import info.izumin.android.sunazuri.domain.repository.UsersRepository;
import info.izumin.android.sunazuri.infrastructure.api.ApiModule;
import info.izumin.android.sunazuri.infrastructure.cache.CacheModule;
import info.izumin.android.sunazuri.infrastructure.entity.OauthParams;
import info.izumin.android.sunazuri.infrastructure.repository.RepositoryModule;
import okhttp3.OkHttpClient;
import javax.inject.Singleton; | package info.izumin.android.sunazuri.infrastructure;
/**
* Created by izumin on 5/13/2016 AD.
*/
@Singleton
@Component(
modules = {
InfrastructureModule.class,
RepositoryModule.class,
HttpClientModule.class, | // Path: app/src/main/java/info/izumin/android/sunazuri/domain/repository/OauthRepository.java
// public interface OauthRepository {
// Single<AuthorizedUser> getToken(String code);
// }
//
// Path: app/src/main/java/info/izumin/android/sunazuri/domain/repository/TeamsRepository.java
// public interface TeamsRepository {
// Single<List<Team>> get(AuthorizedUser user);
// }
//
// Path: app/src/main/java/info/izumin/android/sunazuri/domain/repository/UsersRepository.java
// public interface UsersRepository {
// Observable<AuthorizedUser> getCurrentUser();
// Single<List<AuthorizedUser>> getAuthorizedUsers();
// Observable<LoginInfo> getLoginInfo();
// }
//
// Path: app/src/main/java/info/izumin/android/sunazuri/infrastructure/api/ApiModule.java
// @Module
// public class ApiModule {
// public static final String TAG = ApiModule.class.getSimpleName();
//
// private final String apiEndpoint;
// private final OauthParams oauthParams;
// private final List<String> responseEnvelopKeys;
//
// public ApiModule(String apiEndpoint, OauthParams oauthParams, List<String> responseEnvelopKeys) {
// this.apiEndpoint = apiEndpoint;
// this.oauthParams = oauthParams;
// this.responseEnvelopKeys = responseEnvelopKeys;
// }
//
// @Provides
// @Singleton
// EnvelopeTypeAdapterFactory envelopeTypeAdapterFactory() {
// return new EnvelopeTypeAdapterFactory(responseEnvelopKeys);
// }
//
// @Provides
// @Singleton
// Gson gson(EnvelopeTypeAdapterFactory envelopeTypeAdapterFactory) {
// return new GsonBuilder()
// .registerTypeAdapterFactory(StaticGsonTypeAdapterFactory.newInstance())
// .registerTypeAdapterFactory(envelopeTypeAdapterFactory)
// .create();
// }
//
// @Provides
// @Singleton
// Retrofit retrofit(OkHttpClient client, Gson gson) {
// return new Retrofit.Builder()
// .client(client)
// .baseUrl(apiEndpoint)
// .addCallAdapterFactory(RxJavaCallAdapterFactory.create())
// .addConverterFactory(GsonConverterFactory.create(gson))
// .build();
// }
//
// @Provides
// @Singleton
// OauthApi oauthApi(Retrofit retrofit) {
// return retrofit.create(OauthApi.class);
// }
//
// @Provides
// @Singleton
// TeamsApi teamsApi(Retrofit retrofit) {
// return retrofit.create(TeamsApi.class);
// }
//
// @Provides
// @Singleton
// UsersApi usersApi(Retrofit retrofit) {
// return retrofit.create(UsersApi.class);
// }
//
// @Provides
// @Singleton
// OauthParams oauthParams() {
// return oauthParams;
// }
// }
//
// Path: app/src/main/java/info/izumin/android/sunazuri/infrastructure/cache/CacheModule.java
// @Module
// public class CacheModule {
// public static final String TAG = CacheModule.class.getSimpleName();
//
// @Provides
// @Singleton
// LoginCache loginCache(LoginCacheImpl cache) {
// return cache;
// }
// }
//
// Path: app/src/main/java/info/izumin/android/sunazuri/infrastructure/entity/OauthParams.java
// public class OauthParams {
// public static final String TAG = OauthParams.class.getSimpleName();
//
// public final String endpoint;
// public final String clientId;
// public final String clientSecret;
// public final String redirectUri;
// public final String scope;
// public final String responseType;
// public final String authorizePath;
// public final String grantType;
//
// public OauthParams(String endpoint, String clientId, String clientSecret, String redirectUri, String scope, String responseType, String authorizePath, String grantType) {
// this.endpoint = endpoint;
// this.clientId = clientId;
// this.clientSecret = clientSecret;
// this.redirectUri = redirectUri;
// this.scope = scope;
// this.responseType = responseType;
// this.authorizePath = authorizePath;
// this.grantType = grantType;
// }
//
// public String getAuthorizeUri() {
// return endpoint + authorizePath
// + "?client_id=" + clientId
// + "&redirect_uri=" + redirectUri
// + "&scope=" + scope
// + "&response_type=" + responseType;
// }
// }
//
// Path: app/src/main/java/info/izumin/android/sunazuri/infrastructure/repository/RepositoryModule.java
// @Module(
// includes = {
// OauthRepositoryModule.class,
// TeamsRepositoryModule.class
// }
// )
// public class RepositoryModule {
// public static final String TAG = RepositoryModule.class.getSimpleName();
//
// @Provides
// @Singleton
// UsersRepository usersRepository(UsersRepositoryImpl repo) {
// return repo;
// }
// }
// Path: app/src/main/java/info/izumin/android/sunazuri/infrastructure/InfrastructureComponent.java
import dagger.Component;
import info.izumin.android.sunazuri.domain.repository.OauthRepository;
import info.izumin.android.sunazuri.domain.repository.TeamsRepository;
import info.izumin.android.sunazuri.domain.repository.UsersRepository;
import info.izumin.android.sunazuri.infrastructure.api.ApiModule;
import info.izumin.android.sunazuri.infrastructure.cache.CacheModule;
import info.izumin.android.sunazuri.infrastructure.entity.OauthParams;
import info.izumin.android.sunazuri.infrastructure.repository.RepositoryModule;
import okhttp3.OkHttpClient;
import javax.inject.Singleton;
package info.izumin.android.sunazuri.infrastructure;
/**
* Created by izumin on 5/13/2016 AD.
*/
@Singleton
@Component(
modules = {
InfrastructureModule.class,
RepositoryModule.class,
HttpClientModule.class, | ApiModule.class, |
izumin5210/Sunazuri | app/src/main/java/info/izumin/android/sunazuri/infrastructure/InfrastructureComponent.java | // Path: app/src/main/java/info/izumin/android/sunazuri/domain/repository/OauthRepository.java
// public interface OauthRepository {
// Single<AuthorizedUser> getToken(String code);
// }
//
// Path: app/src/main/java/info/izumin/android/sunazuri/domain/repository/TeamsRepository.java
// public interface TeamsRepository {
// Single<List<Team>> get(AuthorizedUser user);
// }
//
// Path: app/src/main/java/info/izumin/android/sunazuri/domain/repository/UsersRepository.java
// public interface UsersRepository {
// Observable<AuthorizedUser> getCurrentUser();
// Single<List<AuthorizedUser>> getAuthorizedUsers();
// Observable<LoginInfo> getLoginInfo();
// }
//
// Path: app/src/main/java/info/izumin/android/sunazuri/infrastructure/api/ApiModule.java
// @Module
// public class ApiModule {
// public static final String TAG = ApiModule.class.getSimpleName();
//
// private final String apiEndpoint;
// private final OauthParams oauthParams;
// private final List<String> responseEnvelopKeys;
//
// public ApiModule(String apiEndpoint, OauthParams oauthParams, List<String> responseEnvelopKeys) {
// this.apiEndpoint = apiEndpoint;
// this.oauthParams = oauthParams;
// this.responseEnvelopKeys = responseEnvelopKeys;
// }
//
// @Provides
// @Singleton
// EnvelopeTypeAdapterFactory envelopeTypeAdapterFactory() {
// return new EnvelopeTypeAdapterFactory(responseEnvelopKeys);
// }
//
// @Provides
// @Singleton
// Gson gson(EnvelopeTypeAdapterFactory envelopeTypeAdapterFactory) {
// return new GsonBuilder()
// .registerTypeAdapterFactory(StaticGsonTypeAdapterFactory.newInstance())
// .registerTypeAdapterFactory(envelopeTypeAdapterFactory)
// .create();
// }
//
// @Provides
// @Singleton
// Retrofit retrofit(OkHttpClient client, Gson gson) {
// return new Retrofit.Builder()
// .client(client)
// .baseUrl(apiEndpoint)
// .addCallAdapterFactory(RxJavaCallAdapterFactory.create())
// .addConverterFactory(GsonConverterFactory.create(gson))
// .build();
// }
//
// @Provides
// @Singleton
// OauthApi oauthApi(Retrofit retrofit) {
// return retrofit.create(OauthApi.class);
// }
//
// @Provides
// @Singleton
// TeamsApi teamsApi(Retrofit retrofit) {
// return retrofit.create(TeamsApi.class);
// }
//
// @Provides
// @Singleton
// UsersApi usersApi(Retrofit retrofit) {
// return retrofit.create(UsersApi.class);
// }
//
// @Provides
// @Singleton
// OauthParams oauthParams() {
// return oauthParams;
// }
// }
//
// Path: app/src/main/java/info/izumin/android/sunazuri/infrastructure/cache/CacheModule.java
// @Module
// public class CacheModule {
// public static final String TAG = CacheModule.class.getSimpleName();
//
// @Provides
// @Singleton
// LoginCache loginCache(LoginCacheImpl cache) {
// return cache;
// }
// }
//
// Path: app/src/main/java/info/izumin/android/sunazuri/infrastructure/entity/OauthParams.java
// public class OauthParams {
// public static final String TAG = OauthParams.class.getSimpleName();
//
// public final String endpoint;
// public final String clientId;
// public final String clientSecret;
// public final String redirectUri;
// public final String scope;
// public final String responseType;
// public final String authorizePath;
// public final String grantType;
//
// public OauthParams(String endpoint, String clientId, String clientSecret, String redirectUri, String scope, String responseType, String authorizePath, String grantType) {
// this.endpoint = endpoint;
// this.clientId = clientId;
// this.clientSecret = clientSecret;
// this.redirectUri = redirectUri;
// this.scope = scope;
// this.responseType = responseType;
// this.authorizePath = authorizePath;
// this.grantType = grantType;
// }
//
// public String getAuthorizeUri() {
// return endpoint + authorizePath
// + "?client_id=" + clientId
// + "&redirect_uri=" + redirectUri
// + "&scope=" + scope
// + "&response_type=" + responseType;
// }
// }
//
// Path: app/src/main/java/info/izumin/android/sunazuri/infrastructure/repository/RepositoryModule.java
// @Module(
// includes = {
// OauthRepositoryModule.class,
// TeamsRepositoryModule.class
// }
// )
// public class RepositoryModule {
// public static final String TAG = RepositoryModule.class.getSimpleName();
//
// @Provides
// @Singleton
// UsersRepository usersRepository(UsersRepositoryImpl repo) {
// return repo;
// }
// }
| import dagger.Component;
import info.izumin.android.sunazuri.domain.repository.OauthRepository;
import info.izumin.android.sunazuri.domain.repository.TeamsRepository;
import info.izumin.android.sunazuri.domain.repository.UsersRepository;
import info.izumin.android.sunazuri.infrastructure.api.ApiModule;
import info.izumin.android.sunazuri.infrastructure.cache.CacheModule;
import info.izumin.android.sunazuri.infrastructure.entity.OauthParams;
import info.izumin.android.sunazuri.infrastructure.repository.RepositoryModule;
import okhttp3.OkHttpClient;
import javax.inject.Singleton; | package info.izumin.android.sunazuri.infrastructure;
/**
* Created by izumin on 5/13/2016 AD.
*/
@Singleton
@Component(
modules = {
InfrastructureModule.class,
RepositoryModule.class,
HttpClientModule.class,
ApiModule.class, | // Path: app/src/main/java/info/izumin/android/sunazuri/domain/repository/OauthRepository.java
// public interface OauthRepository {
// Single<AuthorizedUser> getToken(String code);
// }
//
// Path: app/src/main/java/info/izumin/android/sunazuri/domain/repository/TeamsRepository.java
// public interface TeamsRepository {
// Single<List<Team>> get(AuthorizedUser user);
// }
//
// Path: app/src/main/java/info/izumin/android/sunazuri/domain/repository/UsersRepository.java
// public interface UsersRepository {
// Observable<AuthorizedUser> getCurrentUser();
// Single<List<AuthorizedUser>> getAuthorizedUsers();
// Observable<LoginInfo> getLoginInfo();
// }
//
// Path: app/src/main/java/info/izumin/android/sunazuri/infrastructure/api/ApiModule.java
// @Module
// public class ApiModule {
// public static final String TAG = ApiModule.class.getSimpleName();
//
// private final String apiEndpoint;
// private final OauthParams oauthParams;
// private final List<String> responseEnvelopKeys;
//
// public ApiModule(String apiEndpoint, OauthParams oauthParams, List<String> responseEnvelopKeys) {
// this.apiEndpoint = apiEndpoint;
// this.oauthParams = oauthParams;
// this.responseEnvelopKeys = responseEnvelopKeys;
// }
//
// @Provides
// @Singleton
// EnvelopeTypeAdapterFactory envelopeTypeAdapterFactory() {
// return new EnvelopeTypeAdapterFactory(responseEnvelopKeys);
// }
//
// @Provides
// @Singleton
// Gson gson(EnvelopeTypeAdapterFactory envelopeTypeAdapterFactory) {
// return new GsonBuilder()
// .registerTypeAdapterFactory(StaticGsonTypeAdapterFactory.newInstance())
// .registerTypeAdapterFactory(envelopeTypeAdapterFactory)
// .create();
// }
//
// @Provides
// @Singleton
// Retrofit retrofit(OkHttpClient client, Gson gson) {
// return new Retrofit.Builder()
// .client(client)
// .baseUrl(apiEndpoint)
// .addCallAdapterFactory(RxJavaCallAdapterFactory.create())
// .addConverterFactory(GsonConverterFactory.create(gson))
// .build();
// }
//
// @Provides
// @Singleton
// OauthApi oauthApi(Retrofit retrofit) {
// return retrofit.create(OauthApi.class);
// }
//
// @Provides
// @Singleton
// TeamsApi teamsApi(Retrofit retrofit) {
// return retrofit.create(TeamsApi.class);
// }
//
// @Provides
// @Singleton
// UsersApi usersApi(Retrofit retrofit) {
// return retrofit.create(UsersApi.class);
// }
//
// @Provides
// @Singleton
// OauthParams oauthParams() {
// return oauthParams;
// }
// }
//
// Path: app/src/main/java/info/izumin/android/sunazuri/infrastructure/cache/CacheModule.java
// @Module
// public class CacheModule {
// public static final String TAG = CacheModule.class.getSimpleName();
//
// @Provides
// @Singleton
// LoginCache loginCache(LoginCacheImpl cache) {
// return cache;
// }
// }
//
// Path: app/src/main/java/info/izumin/android/sunazuri/infrastructure/entity/OauthParams.java
// public class OauthParams {
// public static final String TAG = OauthParams.class.getSimpleName();
//
// public final String endpoint;
// public final String clientId;
// public final String clientSecret;
// public final String redirectUri;
// public final String scope;
// public final String responseType;
// public final String authorizePath;
// public final String grantType;
//
// public OauthParams(String endpoint, String clientId, String clientSecret, String redirectUri, String scope, String responseType, String authorizePath, String grantType) {
// this.endpoint = endpoint;
// this.clientId = clientId;
// this.clientSecret = clientSecret;
// this.redirectUri = redirectUri;
// this.scope = scope;
// this.responseType = responseType;
// this.authorizePath = authorizePath;
// this.grantType = grantType;
// }
//
// public String getAuthorizeUri() {
// return endpoint + authorizePath
// + "?client_id=" + clientId
// + "&redirect_uri=" + redirectUri
// + "&scope=" + scope
// + "&response_type=" + responseType;
// }
// }
//
// Path: app/src/main/java/info/izumin/android/sunazuri/infrastructure/repository/RepositoryModule.java
// @Module(
// includes = {
// OauthRepositoryModule.class,
// TeamsRepositoryModule.class
// }
// )
// public class RepositoryModule {
// public static final String TAG = RepositoryModule.class.getSimpleName();
//
// @Provides
// @Singleton
// UsersRepository usersRepository(UsersRepositoryImpl repo) {
// return repo;
// }
// }
// Path: app/src/main/java/info/izumin/android/sunazuri/infrastructure/InfrastructureComponent.java
import dagger.Component;
import info.izumin.android.sunazuri.domain.repository.OauthRepository;
import info.izumin.android.sunazuri.domain.repository.TeamsRepository;
import info.izumin.android.sunazuri.domain.repository.UsersRepository;
import info.izumin.android.sunazuri.infrastructure.api.ApiModule;
import info.izumin.android.sunazuri.infrastructure.cache.CacheModule;
import info.izumin.android.sunazuri.infrastructure.entity.OauthParams;
import info.izumin.android.sunazuri.infrastructure.repository.RepositoryModule;
import okhttp3.OkHttpClient;
import javax.inject.Singleton;
package info.izumin.android.sunazuri.infrastructure;
/**
* Created by izumin on 5/13/2016 AD.
*/
@Singleton
@Component(
modules = {
InfrastructureModule.class,
RepositoryModule.class,
HttpClientModule.class,
ApiModule.class, | CacheModule.class |
izumin5210/Sunazuri | app/src/main/java/info/izumin/android/sunazuri/infrastructure/InfrastructureComponent.java | // Path: app/src/main/java/info/izumin/android/sunazuri/domain/repository/OauthRepository.java
// public interface OauthRepository {
// Single<AuthorizedUser> getToken(String code);
// }
//
// Path: app/src/main/java/info/izumin/android/sunazuri/domain/repository/TeamsRepository.java
// public interface TeamsRepository {
// Single<List<Team>> get(AuthorizedUser user);
// }
//
// Path: app/src/main/java/info/izumin/android/sunazuri/domain/repository/UsersRepository.java
// public interface UsersRepository {
// Observable<AuthorizedUser> getCurrentUser();
// Single<List<AuthorizedUser>> getAuthorizedUsers();
// Observable<LoginInfo> getLoginInfo();
// }
//
// Path: app/src/main/java/info/izumin/android/sunazuri/infrastructure/api/ApiModule.java
// @Module
// public class ApiModule {
// public static final String TAG = ApiModule.class.getSimpleName();
//
// private final String apiEndpoint;
// private final OauthParams oauthParams;
// private final List<String> responseEnvelopKeys;
//
// public ApiModule(String apiEndpoint, OauthParams oauthParams, List<String> responseEnvelopKeys) {
// this.apiEndpoint = apiEndpoint;
// this.oauthParams = oauthParams;
// this.responseEnvelopKeys = responseEnvelopKeys;
// }
//
// @Provides
// @Singleton
// EnvelopeTypeAdapterFactory envelopeTypeAdapterFactory() {
// return new EnvelopeTypeAdapterFactory(responseEnvelopKeys);
// }
//
// @Provides
// @Singleton
// Gson gson(EnvelopeTypeAdapterFactory envelopeTypeAdapterFactory) {
// return new GsonBuilder()
// .registerTypeAdapterFactory(StaticGsonTypeAdapterFactory.newInstance())
// .registerTypeAdapterFactory(envelopeTypeAdapterFactory)
// .create();
// }
//
// @Provides
// @Singleton
// Retrofit retrofit(OkHttpClient client, Gson gson) {
// return new Retrofit.Builder()
// .client(client)
// .baseUrl(apiEndpoint)
// .addCallAdapterFactory(RxJavaCallAdapterFactory.create())
// .addConverterFactory(GsonConverterFactory.create(gson))
// .build();
// }
//
// @Provides
// @Singleton
// OauthApi oauthApi(Retrofit retrofit) {
// return retrofit.create(OauthApi.class);
// }
//
// @Provides
// @Singleton
// TeamsApi teamsApi(Retrofit retrofit) {
// return retrofit.create(TeamsApi.class);
// }
//
// @Provides
// @Singleton
// UsersApi usersApi(Retrofit retrofit) {
// return retrofit.create(UsersApi.class);
// }
//
// @Provides
// @Singleton
// OauthParams oauthParams() {
// return oauthParams;
// }
// }
//
// Path: app/src/main/java/info/izumin/android/sunazuri/infrastructure/cache/CacheModule.java
// @Module
// public class CacheModule {
// public static final String TAG = CacheModule.class.getSimpleName();
//
// @Provides
// @Singleton
// LoginCache loginCache(LoginCacheImpl cache) {
// return cache;
// }
// }
//
// Path: app/src/main/java/info/izumin/android/sunazuri/infrastructure/entity/OauthParams.java
// public class OauthParams {
// public static final String TAG = OauthParams.class.getSimpleName();
//
// public final String endpoint;
// public final String clientId;
// public final String clientSecret;
// public final String redirectUri;
// public final String scope;
// public final String responseType;
// public final String authorizePath;
// public final String grantType;
//
// public OauthParams(String endpoint, String clientId, String clientSecret, String redirectUri, String scope, String responseType, String authorizePath, String grantType) {
// this.endpoint = endpoint;
// this.clientId = clientId;
// this.clientSecret = clientSecret;
// this.redirectUri = redirectUri;
// this.scope = scope;
// this.responseType = responseType;
// this.authorizePath = authorizePath;
// this.grantType = grantType;
// }
//
// public String getAuthorizeUri() {
// return endpoint + authorizePath
// + "?client_id=" + clientId
// + "&redirect_uri=" + redirectUri
// + "&scope=" + scope
// + "&response_type=" + responseType;
// }
// }
//
// Path: app/src/main/java/info/izumin/android/sunazuri/infrastructure/repository/RepositoryModule.java
// @Module(
// includes = {
// OauthRepositoryModule.class,
// TeamsRepositoryModule.class
// }
// )
// public class RepositoryModule {
// public static final String TAG = RepositoryModule.class.getSimpleName();
//
// @Provides
// @Singleton
// UsersRepository usersRepository(UsersRepositoryImpl repo) {
// return repo;
// }
// }
| import dagger.Component;
import info.izumin.android.sunazuri.domain.repository.OauthRepository;
import info.izumin.android.sunazuri.domain.repository.TeamsRepository;
import info.izumin.android.sunazuri.domain.repository.UsersRepository;
import info.izumin.android.sunazuri.infrastructure.api.ApiModule;
import info.izumin.android.sunazuri.infrastructure.cache.CacheModule;
import info.izumin.android.sunazuri.infrastructure.entity.OauthParams;
import info.izumin.android.sunazuri.infrastructure.repository.RepositoryModule;
import okhttp3.OkHttpClient;
import javax.inject.Singleton; | package info.izumin.android.sunazuri.infrastructure;
/**
* Created by izumin on 5/13/2016 AD.
*/
@Singleton
@Component(
modules = {
InfrastructureModule.class,
RepositoryModule.class,
HttpClientModule.class,
ApiModule.class,
CacheModule.class
}
)
public interface InfrastructureComponent { | // Path: app/src/main/java/info/izumin/android/sunazuri/domain/repository/OauthRepository.java
// public interface OauthRepository {
// Single<AuthorizedUser> getToken(String code);
// }
//
// Path: app/src/main/java/info/izumin/android/sunazuri/domain/repository/TeamsRepository.java
// public interface TeamsRepository {
// Single<List<Team>> get(AuthorizedUser user);
// }
//
// Path: app/src/main/java/info/izumin/android/sunazuri/domain/repository/UsersRepository.java
// public interface UsersRepository {
// Observable<AuthorizedUser> getCurrentUser();
// Single<List<AuthorizedUser>> getAuthorizedUsers();
// Observable<LoginInfo> getLoginInfo();
// }
//
// Path: app/src/main/java/info/izumin/android/sunazuri/infrastructure/api/ApiModule.java
// @Module
// public class ApiModule {
// public static final String TAG = ApiModule.class.getSimpleName();
//
// private final String apiEndpoint;
// private final OauthParams oauthParams;
// private final List<String> responseEnvelopKeys;
//
// public ApiModule(String apiEndpoint, OauthParams oauthParams, List<String> responseEnvelopKeys) {
// this.apiEndpoint = apiEndpoint;
// this.oauthParams = oauthParams;
// this.responseEnvelopKeys = responseEnvelopKeys;
// }
//
// @Provides
// @Singleton
// EnvelopeTypeAdapterFactory envelopeTypeAdapterFactory() {
// return new EnvelopeTypeAdapterFactory(responseEnvelopKeys);
// }
//
// @Provides
// @Singleton
// Gson gson(EnvelopeTypeAdapterFactory envelopeTypeAdapterFactory) {
// return new GsonBuilder()
// .registerTypeAdapterFactory(StaticGsonTypeAdapterFactory.newInstance())
// .registerTypeAdapterFactory(envelopeTypeAdapterFactory)
// .create();
// }
//
// @Provides
// @Singleton
// Retrofit retrofit(OkHttpClient client, Gson gson) {
// return new Retrofit.Builder()
// .client(client)
// .baseUrl(apiEndpoint)
// .addCallAdapterFactory(RxJavaCallAdapterFactory.create())
// .addConverterFactory(GsonConverterFactory.create(gson))
// .build();
// }
//
// @Provides
// @Singleton
// OauthApi oauthApi(Retrofit retrofit) {
// return retrofit.create(OauthApi.class);
// }
//
// @Provides
// @Singleton
// TeamsApi teamsApi(Retrofit retrofit) {
// return retrofit.create(TeamsApi.class);
// }
//
// @Provides
// @Singleton
// UsersApi usersApi(Retrofit retrofit) {
// return retrofit.create(UsersApi.class);
// }
//
// @Provides
// @Singleton
// OauthParams oauthParams() {
// return oauthParams;
// }
// }
//
// Path: app/src/main/java/info/izumin/android/sunazuri/infrastructure/cache/CacheModule.java
// @Module
// public class CacheModule {
// public static final String TAG = CacheModule.class.getSimpleName();
//
// @Provides
// @Singleton
// LoginCache loginCache(LoginCacheImpl cache) {
// return cache;
// }
// }
//
// Path: app/src/main/java/info/izumin/android/sunazuri/infrastructure/entity/OauthParams.java
// public class OauthParams {
// public static final String TAG = OauthParams.class.getSimpleName();
//
// public final String endpoint;
// public final String clientId;
// public final String clientSecret;
// public final String redirectUri;
// public final String scope;
// public final String responseType;
// public final String authorizePath;
// public final String grantType;
//
// public OauthParams(String endpoint, String clientId, String clientSecret, String redirectUri, String scope, String responseType, String authorizePath, String grantType) {
// this.endpoint = endpoint;
// this.clientId = clientId;
// this.clientSecret = clientSecret;
// this.redirectUri = redirectUri;
// this.scope = scope;
// this.responseType = responseType;
// this.authorizePath = authorizePath;
// this.grantType = grantType;
// }
//
// public String getAuthorizeUri() {
// return endpoint + authorizePath
// + "?client_id=" + clientId
// + "&redirect_uri=" + redirectUri
// + "&scope=" + scope
// + "&response_type=" + responseType;
// }
// }
//
// Path: app/src/main/java/info/izumin/android/sunazuri/infrastructure/repository/RepositoryModule.java
// @Module(
// includes = {
// OauthRepositoryModule.class,
// TeamsRepositoryModule.class
// }
// )
// public class RepositoryModule {
// public static final String TAG = RepositoryModule.class.getSimpleName();
//
// @Provides
// @Singleton
// UsersRepository usersRepository(UsersRepositoryImpl repo) {
// return repo;
// }
// }
// Path: app/src/main/java/info/izumin/android/sunazuri/infrastructure/InfrastructureComponent.java
import dagger.Component;
import info.izumin.android.sunazuri.domain.repository.OauthRepository;
import info.izumin.android.sunazuri.domain.repository.TeamsRepository;
import info.izumin.android.sunazuri.domain.repository.UsersRepository;
import info.izumin.android.sunazuri.infrastructure.api.ApiModule;
import info.izumin.android.sunazuri.infrastructure.cache.CacheModule;
import info.izumin.android.sunazuri.infrastructure.entity.OauthParams;
import info.izumin.android.sunazuri.infrastructure.repository.RepositoryModule;
import okhttp3.OkHttpClient;
import javax.inject.Singleton;
package info.izumin.android.sunazuri.infrastructure;
/**
* Created by izumin on 5/13/2016 AD.
*/
@Singleton
@Component(
modules = {
InfrastructureModule.class,
RepositoryModule.class,
HttpClientModule.class,
ApiModule.class,
CacheModule.class
}
)
public interface InfrastructureComponent { | TeamsRepository teamsRepository(); |
izumin5210/Sunazuri | app/src/main/java/info/izumin/android/sunazuri/infrastructure/InfrastructureComponent.java | // Path: app/src/main/java/info/izumin/android/sunazuri/domain/repository/OauthRepository.java
// public interface OauthRepository {
// Single<AuthorizedUser> getToken(String code);
// }
//
// Path: app/src/main/java/info/izumin/android/sunazuri/domain/repository/TeamsRepository.java
// public interface TeamsRepository {
// Single<List<Team>> get(AuthorizedUser user);
// }
//
// Path: app/src/main/java/info/izumin/android/sunazuri/domain/repository/UsersRepository.java
// public interface UsersRepository {
// Observable<AuthorizedUser> getCurrentUser();
// Single<List<AuthorizedUser>> getAuthorizedUsers();
// Observable<LoginInfo> getLoginInfo();
// }
//
// Path: app/src/main/java/info/izumin/android/sunazuri/infrastructure/api/ApiModule.java
// @Module
// public class ApiModule {
// public static final String TAG = ApiModule.class.getSimpleName();
//
// private final String apiEndpoint;
// private final OauthParams oauthParams;
// private final List<String> responseEnvelopKeys;
//
// public ApiModule(String apiEndpoint, OauthParams oauthParams, List<String> responseEnvelopKeys) {
// this.apiEndpoint = apiEndpoint;
// this.oauthParams = oauthParams;
// this.responseEnvelopKeys = responseEnvelopKeys;
// }
//
// @Provides
// @Singleton
// EnvelopeTypeAdapterFactory envelopeTypeAdapterFactory() {
// return new EnvelopeTypeAdapterFactory(responseEnvelopKeys);
// }
//
// @Provides
// @Singleton
// Gson gson(EnvelopeTypeAdapterFactory envelopeTypeAdapterFactory) {
// return new GsonBuilder()
// .registerTypeAdapterFactory(StaticGsonTypeAdapterFactory.newInstance())
// .registerTypeAdapterFactory(envelopeTypeAdapterFactory)
// .create();
// }
//
// @Provides
// @Singleton
// Retrofit retrofit(OkHttpClient client, Gson gson) {
// return new Retrofit.Builder()
// .client(client)
// .baseUrl(apiEndpoint)
// .addCallAdapterFactory(RxJavaCallAdapterFactory.create())
// .addConverterFactory(GsonConverterFactory.create(gson))
// .build();
// }
//
// @Provides
// @Singleton
// OauthApi oauthApi(Retrofit retrofit) {
// return retrofit.create(OauthApi.class);
// }
//
// @Provides
// @Singleton
// TeamsApi teamsApi(Retrofit retrofit) {
// return retrofit.create(TeamsApi.class);
// }
//
// @Provides
// @Singleton
// UsersApi usersApi(Retrofit retrofit) {
// return retrofit.create(UsersApi.class);
// }
//
// @Provides
// @Singleton
// OauthParams oauthParams() {
// return oauthParams;
// }
// }
//
// Path: app/src/main/java/info/izumin/android/sunazuri/infrastructure/cache/CacheModule.java
// @Module
// public class CacheModule {
// public static final String TAG = CacheModule.class.getSimpleName();
//
// @Provides
// @Singleton
// LoginCache loginCache(LoginCacheImpl cache) {
// return cache;
// }
// }
//
// Path: app/src/main/java/info/izumin/android/sunazuri/infrastructure/entity/OauthParams.java
// public class OauthParams {
// public static final String TAG = OauthParams.class.getSimpleName();
//
// public final String endpoint;
// public final String clientId;
// public final String clientSecret;
// public final String redirectUri;
// public final String scope;
// public final String responseType;
// public final String authorizePath;
// public final String grantType;
//
// public OauthParams(String endpoint, String clientId, String clientSecret, String redirectUri, String scope, String responseType, String authorizePath, String grantType) {
// this.endpoint = endpoint;
// this.clientId = clientId;
// this.clientSecret = clientSecret;
// this.redirectUri = redirectUri;
// this.scope = scope;
// this.responseType = responseType;
// this.authorizePath = authorizePath;
// this.grantType = grantType;
// }
//
// public String getAuthorizeUri() {
// return endpoint + authorizePath
// + "?client_id=" + clientId
// + "&redirect_uri=" + redirectUri
// + "&scope=" + scope
// + "&response_type=" + responseType;
// }
// }
//
// Path: app/src/main/java/info/izumin/android/sunazuri/infrastructure/repository/RepositoryModule.java
// @Module(
// includes = {
// OauthRepositoryModule.class,
// TeamsRepositoryModule.class
// }
// )
// public class RepositoryModule {
// public static final String TAG = RepositoryModule.class.getSimpleName();
//
// @Provides
// @Singleton
// UsersRepository usersRepository(UsersRepositoryImpl repo) {
// return repo;
// }
// }
| import dagger.Component;
import info.izumin.android.sunazuri.domain.repository.OauthRepository;
import info.izumin.android.sunazuri.domain.repository.TeamsRepository;
import info.izumin.android.sunazuri.domain.repository.UsersRepository;
import info.izumin.android.sunazuri.infrastructure.api.ApiModule;
import info.izumin.android.sunazuri.infrastructure.cache.CacheModule;
import info.izumin.android.sunazuri.infrastructure.entity.OauthParams;
import info.izumin.android.sunazuri.infrastructure.repository.RepositoryModule;
import okhttp3.OkHttpClient;
import javax.inject.Singleton; | package info.izumin.android.sunazuri.infrastructure;
/**
* Created by izumin on 5/13/2016 AD.
*/
@Singleton
@Component(
modules = {
InfrastructureModule.class,
RepositoryModule.class,
HttpClientModule.class,
ApiModule.class,
CacheModule.class
}
)
public interface InfrastructureComponent {
TeamsRepository teamsRepository(); | // Path: app/src/main/java/info/izumin/android/sunazuri/domain/repository/OauthRepository.java
// public interface OauthRepository {
// Single<AuthorizedUser> getToken(String code);
// }
//
// Path: app/src/main/java/info/izumin/android/sunazuri/domain/repository/TeamsRepository.java
// public interface TeamsRepository {
// Single<List<Team>> get(AuthorizedUser user);
// }
//
// Path: app/src/main/java/info/izumin/android/sunazuri/domain/repository/UsersRepository.java
// public interface UsersRepository {
// Observable<AuthorizedUser> getCurrentUser();
// Single<List<AuthorizedUser>> getAuthorizedUsers();
// Observable<LoginInfo> getLoginInfo();
// }
//
// Path: app/src/main/java/info/izumin/android/sunazuri/infrastructure/api/ApiModule.java
// @Module
// public class ApiModule {
// public static final String TAG = ApiModule.class.getSimpleName();
//
// private final String apiEndpoint;
// private final OauthParams oauthParams;
// private final List<String> responseEnvelopKeys;
//
// public ApiModule(String apiEndpoint, OauthParams oauthParams, List<String> responseEnvelopKeys) {
// this.apiEndpoint = apiEndpoint;
// this.oauthParams = oauthParams;
// this.responseEnvelopKeys = responseEnvelopKeys;
// }
//
// @Provides
// @Singleton
// EnvelopeTypeAdapterFactory envelopeTypeAdapterFactory() {
// return new EnvelopeTypeAdapterFactory(responseEnvelopKeys);
// }
//
// @Provides
// @Singleton
// Gson gson(EnvelopeTypeAdapterFactory envelopeTypeAdapterFactory) {
// return new GsonBuilder()
// .registerTypeAdapterFactory(StaticGsonTypeAdapterFactory.newInstance())
// .registerTypeAdapterFactory(envelopeTypeAdapterFactory)
// .create();
// }
//
// @Provides
// @Singleton
// Retrofit retrofit(OkHttpClient client, Gson gson) {
// return new Retrofit.Builder()
// .client(client)
// .baseUrl(apiEndpoint)
// .addCallAdapterFactory(RxJavaCallAdapterFactory.create())
// .addConverterFactory(GsonConverterFactory.create(gson))
// .build();
// }
//
// @Provides
// @Singleton
// OauthApi oauthApi(Retrofit retrofit) {
// return retrofit.create(OauthApi.class);
// }
//
// @Provides
// @Singleton
// TeamsApi teamsApi(Retrofit retrofit) {
// return retrofit.create(TeamsApi.class);
// }
//
// @Provides
// @Singleton
// UsersApi usersApi(Retrofit retrofit) {
// return retrofit.create(UsersApi.class);
// }
//
// @Provides
// @Singleton
// OauthParams oauthParams() {
// return oauthParams;
// }
// }
//
// Path: app/src/main/java/info/izumin/android/sunazuri/infrastructure/cache/CacheModule.java
// @Module
// public class CacheModule {
// public static final String TAG = CacheModule.class.getSimpleName();
//
// @Provides
// @Singleton
// LoginCache loginCache(LoginCacheImpl cache) {
// return cache;
// }
// }
//
// Path: app/src/main/java/info/izumin/android/sunazuri/infrastructure/entity/OauthParams.java
// public class OauthParams {
// public static final String TAG = OauthParams.class.getSimpleName();
//
// public final String endpoint;
// public final String clientId;
// public final String clientSecret;
// public final String redirectUri;
// public final String scope;
// public final String responseType;
// public final String authorizePath;
// public final String grantType;
//
// public OauthParams(String endpoint, String clientId, String clientSecret, String redirectUri, String scope, String responseType, String authorizePath, String grantType) {
// this.endpoint = endpoint;
// this.clientId = clientId;
// this.clientSecret = clientSecret;
// this.redirectUri = redirectUri;
// this.scope = scope;
// this.responseType = responseType;
// this.authorizePath = authorizePath;
// this.grantType = grantType;
// }
//
// public String getAuthorizeUri() {
// return endpoint + authorizePath
// + "?client_id=" + clientId
// + "&redirect_uri=" + redirectUri
// + "&scope=" + scope
// + "&response_type=" + responseType;
// }
// }
//
// Path: app/src/main/java/info/izumin/android/sunazuri/infrastructure/repository/RepositoryModule.java
// @Module(
// includes = {
// OauthRepositoryModule.class,
// TeamsRepositoryModule.class
// }
// )
// public class RepositoryModule {
// public static final String TAG = RepositoryModule.class.getSimpleName();
//
// @Provides
// @Singleton
// UsersRepository usersRepository(UsersRepositoryImpl repo) {
// return repo;
// }
// }
// Path: app/src/main/java/info/izumin/android/sunazuri/infrastructure/InfrastructureComponent.java
import dagger.Component;
import info.izumin.android.sunazuri.domain.repository.OauthRepository;
import info.izumin.android.sunazuri.domain.repository.TeamsRepository;
import info.izumin.android.sunazuri.domain.repository.UsersRepository;
import info.izumin.android.sunazuri.infrastructure.api.ApiModule;
import info.izumin.android.sunazuri.infrastructure.cache.CacheModule;
import info.izumin.android.sunazuri.infrastructure.entity.OauthParams;
import info.izumin.android.sunazuri.infrastructure.repository.RepositoryModule;
import okhttp3.OkHttpClient;
import javax.inject.Singleton;
package info.izumin.android.sunazuri.infrastructure;
/**
* Created by izumin on 5/13/2016 AD.
*/
@Singleton
@Component(
modules = {
InfrastructureModule.class,
RepositoryModule.class,
HttpClientModule.class,
ApiModule.class,
CacheModule.class
}
)
public interface InfrastructureComponent {
TeamsRepository teamsRepository(); | OauthRepository oauthRepository(); |
izumin5210/Sunazuri | app/src/main/java/info/izumin/android/sunazuri/infrastructure/InfrastructureComponent.java | // Path: app/src/main/java/info/izumin/android/sunazuri/domain/repository/OauthRepository.java
// public interface OauthRepository {
// Single<AuthorizedUser> getToken(String code);
// }
//
// Path: app/src/main/java/info/izumin/android/sunazuri/domain/repository/TeamsRepository.java
// public interface TeamsRepository {
// Single<List<Team>> get(AuthorizedUser user);
// }
//
// Path: app/src/main/java/info/izumin/android/sunazuri/domain/repository/UsersRepository.java
// public interface UsersRepository {
// Observable<AuthorizedUser> getCurrentUser();
// Single<List<AuthorizedUser>> getAuthorizedUsers();
// Observable<LoginInfo> getLoginInfo();
// }
//
// Path: app/src/main/java/info/izumin/android/sunazuri/infrastructure/api/ApiModule.java
// @Module
// public class ApiModule {
// public static final String TAG = ApiModule.class.getSimpleName();
//
// private final String apiEndpoint;
// private final OauthParams oauthParams;
// private final List<String> responseEnvelopKeys;
//
// public ApiModule(String apiEndpoint, OauthParams oauthParams, List<String> responseEnvelopKeys) {
// this.apiEndpoint = apiEndpoint;
// this.oauthParams = oauthParams;
// this.responseEnvelopKeys = responseEnvelopKeys;
// }
//
// @Provides
// @Singleton
// EnvelopeTypeAdapterFactory envelopeTypeAdapterFactory() {
// return new EnvelopeTypeAdapterFactory(responseEnvelopKeys);
// }
//
// @Provides
// @Singleton
// Gson gson(EnvelopeTypeAdapterFactory envelopeTypeAdapterFactory) {
// return new GsonBuilder()
// .registerTypeAdapterFactory(StaticGsonTypeAdapterFactory.newInstance())
// .registerTypeAdapterFactory(envelopeTypeAdapterFactory)
// .create();
// }
//
// @Provides
// @Singleton
// Retrofit retrofit(OkHttpClient client, Gson gson) {
// return new Retrofit.Builder()
// .client(client)
// .baseUrl(apiEndpoint)
// .addCallAdapterFactory(RxJavaCallAdapterFactory.create())
// .addConverterFactory(GsonConverterFactory.create(gson))
// .build();
// }
//
// @Provides
// @Singleton
// OauthApi oauthApi(Retrofit retrofit) {
// return retrofit.create(OauthApi.class);
// }
//
// @Provides
// @Singleton
// TeamsApi teamsApi(Retrofit retrofit) {
// return retrofit.create(TeamsApi.class);
// }
//
// @Provides
// @Singleton
// UsersApi usersApi(Retrofit retrofit) {
// return retrofit.create(UsersApi.class);
// }
//
// @Provides
// @Singleton
// OauthParams oauthParams() {
// return oauthParams;
// }
// }
//
// Path: app/src/main/java/info/izumin/android/sunazuri/infrastructure/cache/CacheModule.java
// @Module
// public class CacheModule {
// public static final String TAG = CacheModule.class.getSimpleName();
//
// @Provides
// @Singleton
// LoginCache loginCache(LoginCacheImpl cache) {
// return cache;
// }
// }
//
// Path: app/src/main/java/info/izumin/android/sunazuri/infrastructure/entity/OauthParams.java
// public class OauthParams {
// public static final String TAG = OauthParams.class.getSimpleName();
//
// public final String endpoint;
// public final String clientId;
// public final String clientSecret;
// public final String redirectUri;
// public final String scope;
// public final String responseType;
// public final String authorizePath;
// public final String grantType;
//
// public OauthParams(String endpoint, String clientId, String clientSecret, String redirectUri, String scope, String responseType, String authorizePath, String grantType) {
// this.endpoint = endpoint;
// this.clientId = clientId;
// this.clientSecret = clientSecret;
// this.redirectUri = redirectUri;
// this.scope = scope;
// this.responseType = responseType;
// this.authorizePath = authorizePath;
// this.grantType = grantType;
// }
//
// public String getAuthorizeUri() {
// return endpoint + authorizePath
// + "?client_id=" + clientId
// + "&redirect_uri=" + redirectUri
// + "&scope=" + scope
// + "&response_type=" + responseType;
// }
// }
//
// Path: app/src/main/java/info/izumin/android/sunazuri/infrastructure/repository/RepositoryModule.java
// @Module(
// includes = {
// OauthRepositoryModule.class,
// TeamsRepositoryModule.class
// }
// )
// public class RepositoryModule {
// public static final String TAG = RepositoryModule.class.getSimpleName();
//
// @Provides
// @Singleton
// UsersRepository usersRepository(UsersRepositoryImpl repo) {
// return repo;
// }
// }
| import dagger.Component;
import info.izumin.android.sunazuri.domain.repository.OauthRepository;
import info.izumin.android.sunazuri.domain.repository.TeamsRepository;
import info.izumin.android.sunazuri.domain.repository.UsersRepository;
import info.izumin.android.sunazuri.infrastructure.api.ApiModule;
import info.izumin.android.sunazuri.infrastructure.cache.CacheModule;
import info.izumin.android.sunazuri.infrastructure.entity.OauthParams;
import info.izumin.android.sunazuri.infrastructure.repository.RepositoryModule;
import okhttp3.OkHttpClient;
import javax.inject.Singleton; | package info.izumin.android.sunazuri.infrastructure;
/**
* Created by izumin on 5/13/2016 AD.
*/
@Singleton
@Component(
modules = {
InfrastructureModule.class,
RepositoryModule.class,
HttpClientModule.class,
ApiModule.class,
CacheModule.class
}
)
public interface InfrastructureComponent {
TeamsRepository teamsRepository();
OauthRepository oauthRepository(); | // Path: app/src/main/java/info/izumin/android/sunazuri/domain/repository/OauthRepository.java
// public interface OauthRepository {
// Single<AuthorizedUser> getToken(String code);
// }
//
// Path: app/src/main/java/info/izumin/android/sunazuri/domain/repository/TeamsRepository.java
// public interface TeamsRepository {
// Single<List<Team>> get(AuthorizedUser user);
// }
//
// Path: app/src/main/java/info/izumin/android/sunazuri/domain/repository/UsersRepository.java
// public interface UsersRepository {
// Observable<AuthorizedUser> getCurrentUser();
// Single<List<AuthorizedUser>> getAuthorizedUsers();
// Observable<LoginInfo> getLoginInfo();
// }
//
// Path: app/src/main/java/info/izumin/android/sunazuri/infrastructure/api/ApiModule.java
// @Module
// public class ApiModule {
// public static final String TAG = ApiModule.class.getSimpleName();
//
// private final String apiEndpoint;
// private final OauthParams oauthParams;
// private final List<String> responseEnvelopKeys;
//
// public ApiModule(String apiEndpoint, OauthParams oauthParams, List<String> responseEnvelopKeys) {
// this.apiEndpoint = apiEndpoint;
// this.oauthParams = oauthParams;
// this.responseEnvelopKeys = responseEnvelopKeys;
// }
//
// @Provides
// @Singleton
// EnvelopeTypeAdapterFactory envelopeTypeAdapterFactory() {
// return new EnvelopeTypeAdapterFactory(responseEnvelopKeys);
// }
//
// @Provides
// @Singleton
// Gson gson(EnvelopeTypeAdapterFactory envelopeTypeAdapterFactory) {
// return new GsonBuilder()
// .registerTypeAdapterFactory(StaticGsonTypeAdapterFactory.newInstance())
// .registerTypeAdapterFactory(envelopeTypeAdapterFactory)
// .create();
// }
//
// @Provides
// @Singleton
// Retrofit retrofit(OkHttpClient client, Gson gson) {
// return new Retrofit.Builder()
// .client(client)
// .baseUrl(apiEndpoint)
// .addCallAdapterFactory(RxJavaCallAdapterFactory.create())
// .addConverterFactory(GsonConverterFactory.create(gson))
// .build();
// }
//
// @Provides
// @Singleton
// OauthApi oauthApi(Retrofit retrofit) {
// return retrofit.create(OauthApi.class);
// }
//
// @Provides
// @Singleton
// TeamsApi teamsApi(Retrofit retrofit) {
// return retrofit.create(TeamsApi.class);
// }
//
// @Provides
// @Singleton
// UsersApi usersApi(Retrofit retrofit) {
// return retrofit.create(UsersApi.class);
// }
//
// @Provides
// @Singleton
// OauthParams oauthParams() {
// return oauthParams;
// }
// }
//
// Path: app/src/main/java/info/izumin/android/sunazuri/infrastructure/cache/CacheModule.java
// @Module
// public class CacheModule {
// public static final String TAG = CacheModule.class.getSimpleName();
//
// @Provides
// @Singleton
// LoginCache loginCache(LoginCacheImpl cache) {
// return cache;
// }
// }
//
// Path: app/src/main/java/info/izumin/android/sunazuri/infrastructure/entity/OauthParams.java
// public class OauthParams {
// public static final String TAG = OauthParams.class.getSimpleName();
//
// public final String endpoint;
// public final String clientId;
// public final String clientSecret;
// public final String redirectUri;
// public final String scope;
// public final String responseType;
// public final String authorizePath;
// public final String grantType;
//
// public OauthParams(String endpoint, String clientId, String clientSecret, String redirectUri, String scope, String responseType, String authorizePath, String grantType) {
// this.endpoint = endpoint;
// this.clientId = clientId;
// this.clientSecret = clientSecret;
// this.redirectUri = redirectUri;
// this.scope = scope;
// this.responseType = responseType;
// this.authorizePath = authorizePath;
// this.grantType = grantType;
// }
//
// public String getAuthorizeUri() {
// return endpoint + authorizePath
// + "?client_id=" + clientId
// + "&redirect_uri=" + redirectUri
// + "&scope=" + scope
// + "&response_type=" + responseType;
// }
// }
//
// Path: app/src/main/java/info/izumin/android/sunazuri/infrastructure/repository/RepositoryModule.java
// @Module(
// includes = {
// OauthRepositoryModule.class,
// TeamsRepositoryModule.class
// }
// )
// public class RepositoryModule {
// public static final String TAG = RepositoryModule.class.getSimpleName();
//
// @Provides
// @Singleton
// UsersRepository usersRepository(UsersRepositoryImpl repo) {
// return repo;
// }
// }
// Path: app/src/main/java/info/izumin/android/sunazuri/infrastructure/InfrastructureComponent.java
import dagger.Component;
import info.izumin.android.sunazuri.domain.repository.OauthRepository;
import info.izumin.android.sunazuri.domain.repository.TeamsRepository;
import info.izumin.android.sunazuri.domain.repository.UsersRepository;
import info.izumin.android.sunazuri.infrastructure.api.ApiModule;
import info.izumin.android.sunazuri.infrastructure.cache.CacheModule;
import info.izumin.android.sunazuri.infrastructure.entity.OauthParams;
import info.izumin.android.sunazuri.infrastructure.repository.RepositoryModule;
import okhttp3.OkHttpClient;
import javax.inject.Singleton;
package info.izumin.android.sunazuri.infrastructure;
/**
* Created by izumin on 5/13/2016 AD.
*/
@Singleton
@Component(
modules = {
InfrastructureModule.class,
RepositoryModule.class,
HttpClientModule.class,
ApiModule.class,
CacheModule.class
}
)
public interface InfrastructureComponent {
TeamsRepository teamsRepository();
OauthRepository oauthRepository(); | UsersRepository usersRepository(); |
izumin5210/Sunazuri | app/src/main/java/info/izumin/android/sunazuri/infrastructure/InfrastructureComponent.java | // Path: app/src/main/java/info/izumin/android/sunazuri/domain/repository/OauthRepository.java
// public interface OauthRepository {
// Single<AuthorizedUser> getToken(String code);
// }
//
// Path: app/src/main/java/info/izumin/android/sunazuri/domain/repository/TeamsRepository.java
// public interface TeamsRepository {
// Single<List<Team>> get(AuthorizedUser user);
// }
//
// Path: app/src/main/java/info/izumin/android/sunazuri/domain/repository/UsersRepository.java
// public interface UsersRepository {
// Observable<AuthorizedUser> getCurrentUser();
// Single<List<AuthorizedUser>> getAuthorizedUsers();
// Observable<LoginInfo> getLoginInfo();
// }
//
// Path: app/src/main/java/info/izumin/android/sunazuri/infrastructure/api/ApiModule.java
// @Module
// public class ApiModule {
// public static final String TAG = ApiModule.class.getSimpleName();
//
// private final String apiEndpoint;
// private final OauthParams oauthParams;
// private final List<String> responseEnvelopKeys;
//
// public ApiModule(String apiEndpoint, OauthParams oauthParams, List<String> responseEnvelopKeys) {
// this.apiEndpoint = apiEndpoint;
// this.oauthParams = oauthParams;
// this.responseEnvelopKeys = responseEnvelopKeys;
// }
//
// @Provides
// @Singleton
// EnvelopeTypeAdapterFactory envelopeTypeAdapterFactory() {
// return new EnvelopeTypeAdapterFactory(responseEnvelopKeys);
// }
//
// @Provides
// @Singleton
// Gson gson(EnvelopeTypeAdapterFactory envelopeTypeAdapterFactory) {
// return new GsonBuilder()
// .registerTypeAdapterFactory(StaticGsonTypeAdapterFactory.newInstance())
// .registerTypeAdapterFactory(envelopeTypeAdapterFactory)
// .create();
// }
//
// @Provides
// @Singleton
// Retrofit retrofit(OkHttpClient client, Gson gson) {
// return new Retrofit.Builder()
// .client(client)
// .baseUrl(apiEndpoint)
// .addCallAdapterFactory(RxJavaCallAdapterFactory.create())
// .addConverterFactory(GsonConverterFactory.create(gson))
// .build();
// }
//
// @Provides
// @Singleton
// OauthApi oauthApi(Retrofit retrofit) {
// return retrofit.create(OauthApi.class);
// }
//
// @Provides
// @Singleton
// TeamsApi teamsApi(Retrofit retrofit) {
// return retrofit.create(TeamsApi.class);
// }
//
// @Provides
// @Singleton
// UsersApi usersApi(Retrofit retrofit) {
// return retrofit.create(UsersApi.class);
// }
//
// @Provides
// @Singleton
// OauthParams oauthParams() {
// return oauthParams;
// }
// }
//
// Path: app/src/main/java/info/izumin/android/sunazuri/infrastructure/cache/CacheModule.java
// @Module
// public class CacheModule {
// public static final String TAG = CacheModule.class.getSimpleName();
//
// @Provides
// @Singleton
// LoginCache loginCache(LoginCacheImpl cache) {
// return cache;
// }
// }
//
// Path: app/src/main/java/info/izumin/android/sunazuri/infrastructure/entity/OauthParams.java
// public class OauthParams {
// public static final String TAG = OauthParams.class.getSimpleName();
//
// public final String endpoint;
// public final String clientId;
// public final String clientSecret;
// public final String redirectUri;
// public final String scope;
// public final String responseType;
// public final String authorizePath;
// public final String grantType;
//
// public OauthParams(String endpoint, String clientId, String clientSecret, String redirectUri, String scope, String responseType, String authorizePath, String grantType) {
// this.endpoint = endpoint;
// this.clientId = clientId;
// this.clientSecret = clientSecret;
// this.redirectUri = redirectUri;
// this.scope = scope;
// this.responseType = responseType;
// this.authorizePath = authorizePath;
// this.grantType = grantType;
// }
//
// public String getAuthorizeUri() {
// return endpoint + authorizePath
// + "?client_id=" + clientId
// + "&redirect_uri=" + redirectUri
// + "&scope=" + scope
// + "&response_type=" + responseType;
// }
// }
//
// Path: app/src/main/java/info/izumin/android/sunazuri/infrastructure/repository/RepositoryModule.java
// @Module(
// includes = {
// OauthRepositoryModule.class,
// TeamsRepositoryModule.class
// }
// )
// public class RepositoryModule {
// public static final String TAG = RepositoryModule.class.getSimpleName();
//
// @Provides
// @Singleton
// UsersRepository usersRepository(UsersRepositoryImpl repo) {
// return repo;
// }
// }
| import dagger.Component;
import info.izumin.android.sunazuri.domain.repository.OauthRepository;
import info.izumin.android.sunazuri.domain.repository.TeamsRepository;
import info.izumin.android.sunazuri.domain.repository.UsersRepository;
import info.izumin.android.sunazuri.infrastructure.api.ApiModule;
import info.izumin.android.sunazuri.infrastructure.cache.CacheModule;
import info.izumin.android.sunazuri.infrastructure.entity.OauthParams;
import info.izumin.android.sunazuri.infrastructure.repository.RepositoryModule;
import okhttp3.OkHttpClient;
import javax.inject.Singleton; | package info.izumin.android.sunazuri.infrastructure;
/**
* Created by izumin on 5/13/2016 AD.
*/
@Singleton
@Component(
modules = {
InfrastructureModule.class,
RepositoryModule.class,
HttpClientModule.class,
ApiModule.class,
CacheModule.class
}
)
public interface InfrastructureComponent {
TeamsRepository teamsRepository();
OauthRepository oauthRepository();
UsersRepository usersRepository();
| // Path: app/src/main/java/info/izumin/android/sunazuri/domain/repository/OauthRepository.java
// public interface OauthRepository {
// Single<AuthorizedUser> getToken(String code);
// }
//
// Path: app/src/main/java/info/izumin/android/sunazuri/domain/repository/TeamsRepository.java
// public interface TeamsRepository {
// Single<List<Team>> get(AuthorizedUser user);
// }
//
// Path: app/src/main/java/info/izumin/android/sunazuri/domain/repository/UsersRepository.java
// public interface UsersRepository {
// Observable<AuthorizedUser> getCurrentUser();
// Single<List<AuthorizedUser>> getAuthorizedUsers();
// Observable<LoginInfo> getLoginInfo();
// }
//
// Path: app/src/main/java/info/izumin/android/sunazuri/infrastructure/api/ApiModule.java
// @Module
// public class ApiModule {
// public static final String TAG = ApiModule.class.getSimpleName();
//
// private final String apiEndpoint;
// private final OauthParams oauthParams;
// private final List<String> responseEnvelopKeys;
//
// public ApiModule(String apiEndpoint, OauthParams oauthParams, List<String> responseEnvelopKeys) {
// this.apiEndpoint = apiEndpoint;
// this.oauthParams = oauthParams;
// this.responseEnvelopKeys = responseEnvelopKeys;
// }
//
// @Provides
// @Singleton
// EnvelopeTypeAdapterFactory envelopeTypeAdapterFactory() {
// return new EnvelopeTypeAdapterFactory(responseEnvelopKeys);
// }
//
// @Provides
// @Singleton
// Gson gson(EnvelopeTypeAdapterFactory envelopeTypeAdapterFactory) {
// return new GsonBuilder()
// .registerTypeAdapterFactory(StaticGsonTypeAdapterFactory.newInstance())
// .registerTypeAdapterFactory(envelopeTypeAdapterFactory)
// .create();
// }
//
// @Provides
// @Singleton
// Retrofit retrofit(OkHttpClient client, Gson gson) {
// return new Retrofit.Builder()
// .client(client)
// .baseUrl(apiEndpoint)
// .addCallAdapterFactory(RxJavaCallAdapterFactory.create())
// .addConverterFactory(GsonConverterFactory.create(gson))
// .build();
// }
//
// @Provides
// @Singleton
// OauthApi oauthApi(Retrofit retrofit) {
// return retrofit.create(OauthApi.class);
// }
//
// @Provides
// @Singleton
// TeamsApi teamsApi(Retrofit retrofit) {
// return retrofit.create(TeamsApi.class);
// }
//
// @Provides
// @Singleton
// UsersApi usersApi(Retrofit retrofit) {
// return retrofit.create(UsersApi.class);
// }
//
// @Provides
// @Singleton
// OauthParams oauthParams() {
// return oauthParams;
// }
// }
//
// Path: app/src/main/java/info/izumin/android/sunazuri/infrastructure/cache/CacheModule.java
// @Module
// public class CacheModule {
// public static final String TAG = CacheModule.class.getSimpleName();
//
// @Provides
// @Singleton
// LoginCache loginCache(LoginCacheImpl cache) {
// return cache;
// }
// }
//
// Path: app/src/main/java/info/izumin/android/sunazuri/infrastructure/entity/OauthParams.java
// public class OauthParams {
// public static final String TAG = OauthParams.class.getSimpleName();
//
// public final String endpoint;
// public final String clientId;
// public final String clientSecret;
// public final String redirectUri;
// public final String scope;
// public final String responseType;
// public final String authorizePath;
// public final String grantType;
//
// public OauthParams(String endpoint, String clientId, String clientSecret, String redirectUri, String scope, String responseType, String authorizePath, String grantType) {
// this.endpoint = endpoint;
// this.clientId = clientId;
// this.clientSecret = clientSecret;
// this.redirectUri = redirectUri;
// this.scope = scope;
// this.responseType = responseType;
// this.authorizePath = authorizePath;
// this.grantType = grantType;
// }
//
// public String getAuthorizeUri() {
// return endpoint + authorizePath
// + "?client_id=" + clientId
// + "&redirect_uri=" + redirectUri
// + "&scope=" + scope
// + "&response_type=" + responseType;
// }
// }
//
// Path: app/src/main/java/info/izumin/android/sunazuri/infrastructure/repository/RepositoryModule.java
// @Module(
// includes = {
// OauthRepositoryModule.class,
// TeamsRepositoryModule.class
// }
// )
// public class RepositoryModule {
// public static final String TAG = RepositoryModule.class.getSimpleName();
//
// @Provides
// @Singleton
// UsersRepository usersRepository(UsersRepositoryImpl repo) {
// return repo;
// }
// }
// Path: app/src/main/java/info/izumin/android/sunazuri/infrastructure/InfrastructureComponent.java
import dagger.Component;
import info.izumin.android.sunazuri.domain.repository.OauthRepository;
import info.izumin.android.sunazuri.domain.repository.TeamsRepository;
import info.izumin.android.sunazuri.domain.repository.UsersRepository;
import info.izumin.android.sunazuri.infrastructure.api.ApiModule;
import info.izumin.android.sunazuri.infrastructure.cache.CacheModule;
import info.izumin.android.sunazuri.infrastructure.entity.OauthParams;
import info.izumin.android.sunazuri.infrastructure.repository.RepositoryModule;
import okhttp3.OkHttpClient;
import javax.inject.Singleton;
package info.izumin.android.sunazuri.infrastructure;
/**
* Created by izumin on 5/13/2016 AD.
*/
@Singleton
@Component(
modules = {
InfrastructureModule.class,
RepositoryModule.class,
HttpClientModule.class,
ApiModule.class,
CacheModule.class
}
)
public interface InfrastructureComponent {
TeamsRepository teamsRepository();
OauthRepository oauthRepository();
UsersRepository usersRepository();
| OauthParams oauthParams(); |
izumin5210/Sunazuri | app/src/main/java/info/izumin/android/sunazuri/infrastructure/repository/RepositoryModule.java | // Path: app/src/main/java/info/izumin/android/sunazuri/domain/repository/UsersRepository.java
// public interface UsersRepository {
// Observable<AuthorizedUser> getCurrentUser();
// Single<List<AuthorizedUser>> getAuthorizedUsers();
// Observable<LoginInfo> getLoginInfo();
// }
//
// Path: app/src/main/java/info/izumin/android/sunazuri/infrastructure/repository/source/oauth/OauthRepositoryModule.java
// @Module
// public class OauthRepositoryModule {
// public static final String TAG = OauthRepositoryModule.class.getSimpleName();
//
// @Provides
// @Singleton
// OauthRepository oauthRepository(OauthRepositoryImpl repo) {
// return repo;
// }
//
// @Provides
// @Singleton
// OauthDataSourceFactory oauthDataSourceFactory(OauthDataSourceFactoryImpl dataSourceFactory) {
// return dataSourceFactory;
// }
// }
//
// Path: app/src/main/java/info/izumin/android/sunazuri/infrastructure/repository/source/team/TeamsRepositoryModule.java
// @Module
// public class TeamsRepositoryModule {
// public static final String TAG = TeamsRepositoryModule.class.getSimpleName();
//
// @Provides
// @Singleton
// TeamsRepository teamsRepository(TeamsRepositoryImpl repo) {
// return repo;
// }
//
// @Provides
// @Singleton
// TeamsDataSourceFactory teamsDataSourceFactory(TeamsDataSourceFactoryImpl dataSourceFactory) {
// return dataSourceFactory;
// }
// }
| import dagger.Module;
import dagger.Provides;
import info.izumin.android.sunazuri.domain.repository.UsersRepository;
import info.izumin.android.sunazuri.infrastructure.repository.source.oauth.OauthRepositoryModule;
import info.izumin.android.sunazuri.infrastructure.repository.source.team.TeamsRepositoryModule;
import javax.inject.Singleton; | package info.izumin.android.sunazuri.infrastructure.repository;
/**
* Created by izumin on 5/13/2016 AD.
*/
@Module(
includes = { | // Path: app/src/main/java/info/izumin/android/sunazuri/domain/repository/UsersRepository.java
// public interface UsersRepository {
// Observable<AuthorizedUser> getCurrentUser();
// Single<List<AuthorizedUser>> getAuthorizedUsers();
// Observable<LoginInfo> getLoginInfo();
// }
//
// Path: app/src/main/java/info/izumin/android/sunazuri/infrastructure/repository/source/oauth/OauthRepositoryModule.java
// @Module
// public class OauthRepositoryModule {
// public static final String TAG = OauthRepositoryModule.class.getSimpleName();
//
// @Provides
// @Singleton
// OauthRepository oauthRepository(OauthRepositoryImpl repo) {
// return repo;
// }
//
// @Provides
// @Singleton
// OauthDataSourceFactory oauthDataSourceFactory(OauthDataSourceFactoryImpl dataSourceFactory) {
// return dataSourceFactory;
// }
// }
//
// Path: app/src/main/java/info/izumin/android/sunazuri/infrastructure/repository/source/team/TeamsRepositoryModule.java
// @Module
// public class TeamsRepositoryModule {
// public static final String TAG = TeamsRepositoryModule.class.getSimpleName();
//
// @Provides
// @Singleton
// TeamsRepository teamsRepository(TeamsRepositoryImpl repo) {
// return repo;
// }
//
// @Provides
// @Singleton
// TeamsDataSourceFactory teamsDataSourceFactory(TeamsDataSourceFactoryImpl dataSourceFactory) {
// return dataSourceFactory;
// }
// }
// Path: app/src/main/java/info/izumin/android/sunazuri/infrastructure/repository/RepositoryModule.java
import dagger.Module;
import dagger.Provides;
import info.izumin.android.sunazuri.domain.repository.UsersRepository;
import info.izumin.android.sunazuri.infrastructure.repository.source.oauth.OauthRepositoryModule;
import info.izumin.android.sunazuri.infrastructure.repository.source.team.TeamsRepositoryModule;
import javax.inject.Singleton;
package info.izumin.android.sunazuri.infrastructure.repository;
/**
* Created by izumin on 5/13/2016 AD.
*/
@Module(
includes = { | OauthRepositoryModule.class, |
izumin5210/Sunazuri | app/src/main/java/info/izumin/android/sunazuri/infrastructure/repository/RepositoryModule.java | // Path: app/src/main/java/info/izumin/android/sunazuri/domain/repository/UsersRepository.java
// public interface UsersRepository {
// Observable<AuthorizedUser> getCurrentUser();
// Single<List<AuthorizedUser>> getAuthorizedUsers();
// Observable<LoginInfo> getLoginInfo();
// }
//
// Path: app/src/main/java/info/izumin/android/sunazuri/infrastructure/repository/source/oauth/OauthRepositoryModule.java
// @Module
// public class OauthRepositoryModule {
// public static final String TAG = OauthRepositoryModule.class.getSimpleName();
//
// @Provides
// @Singleton
// OauthRepository oauthRepository(OauthRepositoryImpl repo) {
// return repo;
// }
//
// @Provides
// @Singleton
// OauthDataSourceFactory oauthDataSourceFactory(OauthDataSourceFactoryImpl dataSourceFactory) {
// return dataSourceFactory;
// }
// }
//
// Path: app/src/main/java/info/izumin/android/sunazuri/infrastructure/repository/source/team/TeamsRepositoryModule.java
// @Module
// public class TeamsRepositoryModule {
// public static final String TAG = TeamsRepositoryModule.class.getSimpleName();
//
// @Provides
// @Singleton
// TeamsRepository teamsRepository(TeamsRepositoryImpl repo) {
// return repo;
// }
//
// @Provides
// @Singleton
// TeamsDataSourceFactory teamsDataSourceFactory(TeamsDataSourceFactoryImpl dataSourceFactory) {
// return dataSourceFactory;
// }
// }
| import dagger.Module;
import dagger.Provides;
import info.izumin.android.sunazuri.domain.repository.UsersRepository;
import info.izumin.android.sunazuri.infrastructure.repository.source.oauth.OauthRepositoryModule;
import info.izumin.android.sunazuri.infrastructure.repository.source.team.TeamsRepositoryModule;
import javax.inject.Singleton; | package info.izumin.android.sunazuri.infrastructure.repository;
/**
* Created by izumin on 5/13/2016 AD.
*/
@Module(
includes = {
OauthRepositoryModule.class, | // Path: app/src/main/java/info/izumin/android/sunazuri/domain/repository/UsersRepository.java
// public interface UsersRepository {
// Observable<AuthorizedUser> getCurrentUser();
// Single<List<AuthorizedUser>> getAuthorizedUsers();
// Observable<LoginInfo> getLoginInfo();
// }
//
// Path: app/src/main/java/info/izumin/android/sunazuri/infrastructure/repository/source/oauth/OauthRepositoryModule.java
// @Module
// public class OauthRepositoryModule {
// public static final String TAG = OauthRepositoryModule.class.getSimpleName();
//
// @Provides
// @Singleton
// OauthRepository oauthRepository(OauthRepositoryImpl repo) {
// return repo;
// }
//
// @Provides
// @Singleton
// OauthDataSourceFactory oauthDataSourceFactory(OauthDataSourceFactoryImpl dataSourceFactory) {
// return dataSourceFactory;
// }
// }
//
// Path: app/src/main/java/info/izumin/android/sunazuri/infrastructure/repository/source/team/TeamsRepositoryModule.java
// @Module
// public class TeamsRepositoryModule {
// public static final String TAG = TeamsRepositoryModule.class.getSimpleName();
//
// @Provides
// @Singleton
// TeamsRepository teamsRepository(TeamsRepositoryImpl repo) {
// return repo;
// }
//
// @Provides
// @Singleton
// TeamsDataSourceFactory teamsDataSourceFactory(TeamsDataSourceFactoryImpl dataSourceFactory) {
// return dataSourceFactory;
// }
// }
// Path: app/src/main/java/info/izumin/android/sunazuri/infrastructure/repository/RepositoryModule.java
import dagger.Module;
import dagger.Provides;
import info.izumin.android.sunazuri.domain.repository.UsersRepository;
import info.izumin.android.sunazuri.infrastructure.repository.source.oauth.OauthRepositoryModule;
import info.izumin.android.sunazuri.infrastructure.repository.source.team.TeamsRepositoryModule;
import javax.inject.Singleton;
package info.izumin.android.sunazuri.infrastructure.repository;
/**
* Created by izumin on 5/13/2016 AD.
*/
@Module(
includes = {
OauthRepositoryModule.class, | TeamsRepositoryModule.class |
izumin5210/Sunazuri | app/src/main/java/info/izumin/android/sunazuri/infrastructure/repository/RepositoryModule.java | // Path: app/src/main/java/info/izumin/android/sunazuri/domain/repository/UsersRepository.java
// public interface UsersRepository {
// Observable<AuthorizedUser> getCurrentUser();
// Single<List<AuthorizedUser>> getAuthorizedUsers();
// Observable<LoginInfo> getLoginInfo();
// }
//
// Path: app/src/main/java/info/izumin/android/sunazuri/infrastructure/repository/source/oauth/OauthRepositoryModule.java
// @Module
// public class OauthRepositoryModule {
// public static final String TAG = OauthRepositoryModule.class.getSimpleName();
//
// @Provides
// @Singleton
// OauthRepository oauthRepository(OauthRepositoryImpl repo) {
// return repo;
// }
//
// @Provides
// @Singleton
// OauthDataSourceFactory oauthDataSourceFactory(OauthDataSourceFactoryImpl dataSourceFactory) {
// return dataSourceFactory;
// }
// }
//
// Path: app/src/main/java/info/izumin/android/sunazuri/infrastructure/repository/source/team/TeamsRepositoryModule.java
// @Module
// public class TeamsRepositoryModule {
// public static final String TAG = TeamsRepositoryModule.class.getSimpleName();
//
// @Provides
// @Singleton
// TeamsRepository teamsRepository(TeamsRepositoryImpl repo) {
// return repo;
// }
//
// @Provides
// @Singleton
// TeamsDataSourceFactory teamsDataSourceFactory(TeamsDataSourceFactoryImpl dataSourceFactory) {
// return dataSourceFactory;
// }
// }
| import dagger.Module;
import dagger.Provides;
import info.izumin.android.sunazuri.domain.repository.UsersRepository;
import info.izumin.android.sunazuri.infrastructure.repository.source.oauth.OauthRepositoryModule;
import info.izumin.android.sunazuri.infrastructure.repository.source.team.TeamsRepositoryModule;
import javax.inject.Singleton; | package info.izumin.android.sunazuri.infrastructure.repository;
/**
* Created by izumin on 5/13/2016 AD.
*/
@Module(
includes = {
OauthRepositoryModule.class,
TeamsRepositoryModule.class
}
)
public class RepositoryModule {
public static final String TAG = RepositoryModule.class.getSimpleName();
@Provides
@Singleton | // Path: app/src/main/java/info/izumin/android/sunazuri/domain/repository/UsersRepository.java
// public interface UsersRepository {
// Observable<AuthorizedUser> getCurrentUser();
// Single<List<AuthorizedUser>> getAuthorizedUsers();
// Observable<LoginInfo> getLoginInfo();
// }
//
// Path: app/src/main/java/info/izumin/android/sunazuri/infrastructure/repository/source/oauth/OauthRepositoryModule.java
// @Module
// public class OauthRepositoryModule {
// public static final String TAG = OauthRepositoryModule.class.getSimpleName();
//
// @Provides
// @Singleton
// OauthRepository oauthRepository(OauthRepositoryImpl repo) {
// return repo;
// }
//
// @Provides
// @Singleton
// OauthDataSourceFactory oauthDataSourceFactory(OauthDataSourceFactoryImpl dataSourceFactory) {
// return dataSourceFactory;
// }
// }
//
// Path: app/src/main/java/info/izumin/android/sunazuri/infrastructure/repository/source/team/TeamsRepositoryModule.java
// @Module
// public class TeamsRepositoryModule {
// public static final String TAG = TeamsRepositoryModule.class.getSimpleName();
//
// @Provides
// @Singleton
// TeamsRepository teamsRepository(TeamsRepositoryImpl repo) {
// return repo;
// }
//
// @Provides
// @Singleton
// TeamsDataSourceFactory teamsDataSourceFactory(TeamsDataSourceFactoryImpl dataSourceFactory) {
// return dataSourceFactory;
// }
// }
// Path: app/src/main/java/info/izumin/android/sunazuri/infrastructure/repository/RepositoryModule.java
import dagger.Module;
import dagger.Provides;
import info.izumin.android.sunazuri.domain.repository.UsersRepository;
import info.izumin.android.sunazuri.infrastructure.repository.source.oauth.OauthRepositoryModule;
import info.izumin.android.sunazuri.infrastructure.repository.source.team.TeamsRepositoryModule;
import javax.inject.Singleton;
package info.izumin.android.sunazuri.infrastructure.repository;
/**
* Created by izumin on 5/13/2016 AD.
*/
@Module(
includes = {
OauthRepositoryModule.class,
TeamsRepositoryModule.class
}
)
public class RepositoryModule {
public static final String TAG = RepositoryModule.class.getSimpleName();
@Provides
@Singleton | UsersRepository usersRepository(UsersRepositoryImpl repo) { |
izumin5210/Sunazuri | app/src/main/java/info/izumin/android/sunazuri/infrastructure/api/OauthApi.java | // Path: app/src/main/java/info/izumin/android/sunazuri/infrastructure/entity/AccessTokenEntity.java
// @Table
// @JsonSerializable(fieldNamingPolicy = FieldNamingPolicy.LOWER_CASE_WITH_UNDERSCORES)
// public class AccessTokenEntity {
// public static final String TAG = AccessTokenEntity.class.getSimpleName();
//
// @Column
// public String accessToken;
//
// @Column
// public String tokenType;
//
// @Column
// public String scope;
//
// @PrimaryKey(auto = false)
// @Column
// public AuthorizedUserEntity user;
// }
| import info.izumin.android.sunazuri.infrastructure.entity.AccessTokenEntity;
import retrofit2.http.Header;
import retrofit2.http.POST;
import retrofit2.http.Query;
import rx.Completable;
import rx.Single; | package info.izumin.android.sunazuri.infrastructure.api;
/**
* Created by izumin on 5/13/2016 AD.
*/
public interface OauthApi {
@POST("/oauth/token") | // Path: app/src/main/java/info/izumin/android/sunazuri/infrastructure/entity/AccessTokenEntity.java
// @Table
// @JsonSerializable(fieldNamingPolicy = FieldNamingPolicy.LOWER_CASE_WITH_UNDERSCORES)
// public class AccessTokenEntity {
// public static final String TAG = AccessTokenEntity.class.getSimpleName();
//
// @Column
// public String accessToken;
//
// @Column
// public String tokenType;
//
// @Column
// public String scope;
//
// @PrimaryKey(auto = false)
// @Column
// public AuthorizedUserEntity user;
// }
// Path: app/src/main/java/info/izumin/android/sunazuri/infrastructure/api/OauthApi.java
import info.izumin.android.sunazuri.infrastructure.entity.AccessTokenEntity;
import retrofit2.http.Header;
import retrofit2.http.POST;
import retrofit2.http.Query;
import rx.Completable;
import rx.Single;
package info.izumin.android.sunazuri.infrastructure.api;
/**
* Created by izumin on 5/13/2016 AD.
*/
public interface OauthApi {
@POST("/oauth/token") | Single<AccessTokenEntity> fetchToken( |
izumin5210/Sunazuri | app/src/main/java/info/izumin/android/sunazuri/data/DataComponent.java | // Path: app/src/main/java/info/izumin/android/sunazuri/data/action/ActionModule.java
// @Module
// public class ActionModule {
// public static final String TAG = ActionModule.class.getSimpleName();
//
// @Provides
// UserActionCreator userActionCreator(OauthRepository oauthRepo,
// UsersRepository usersRepo,
// TeamActionCreator teamActionCreator) {
// return new UserActionCreator(oauthRepo, usersRepo, teamActionCreator);
// }
//
// @Provides
// TeamActionCreator teamActionCreator(TeamsRepository teamsRepo) {
// return new TeamActionCreator(teamsRepo);
// }
// }
//
// Path: app/src/main/java/info/izumin/android/sunazuri/domain/RootStore.java
// @Store({
// AuthorizedUsersReducer.class,
// LoginInfoReducer.class,
// TeamsReducer.class
// })
// public interface RootStore extends BaseStore {
// AuthorizedUsers getAuthorizedUsers();
// Teams getTeams();
// LoginInfo getLoginInfo();
// }
//
// Path: app/src/main/java/info/izumin/android/sunazuri/infrastructure/InfrastructureComponent.java
// @Singleton
// @Component(
// modules = {
// InfrastructureModule.class,
// RepositoryModule.class,
// HttpClientModule.class,
// ApiModule.class,
// CacheModule.class
// }
// )
// public interface InfrastructureComponent {
// TeamsRepository teamsRepository();
// OauthRepository oauthRepository();
// UsersRepository usersRepository();
//
// OauthParams oauthParams();
//
// // for Picasso
// OkHttpClient okHttpClient();
// }
//
// Path: app/src/main/java/info/izumin/android/sunazuri/infrastructure/entity/OauthParams.java
// public class OauthParams {
// public static final String TAG = OauthParams.class.getSimpleName();
//
// public final String endpoint;
// public final String clientId;
// public final String clientSecret;
// public final String redirectUri;
// public final String scope;
// public final String responseType;
// public final String authorizePath;
// public final String grantType;
//
// public OauthParams(String endpoint, String clientId, String clientSecret, String redirectUri, String scope, String responseType, String authorizePath, String grantType) {
// this.endpoint = endpoint;
// this.clientId = clientId;
// this.clientSecret = clientSecret;
// this.redirectUri = redirectUri;
// this.scope = scope;
// this.responseType = responseType;
// this.authorizePath = authorizePath;
// this.grantType = grantType;
// }
//
// public String getAuthorizeUri() {
// return endpoint + authorizePath
// + "?client_id=" + clientId
// + "&redirect_uri=" + redirectUri
// + "&scope=" + scope
// + "&response_type=" + responseType;
// }
// }
| import dagger.Component;
import info.izumin.android.sunazuri.data.action.ActionModule;
import info.izumin.android.sunazuri.data.action.team.TeamActionCreator;
import info.izumin.android.sunazuri.data.action.user.UserActionCreator;
import info.izumin.android.sunazuri.domain.RootStore;
import info.izumin.android.sunazuri.infrastructure.InfrastructureComponent;
import info.izumin.android.sunazuri.infrastructure.entity.OauthParams;
import okhttp3.OkHttpClient; | package info.izumin.android.sunazuri.data;
/**
* Created by izumin on 5/13/2016 AD.
*/
@DataScope
@Component(
dependencies = { | // Path: app/src/main/java/info/izumin/android/sunazuri/data/action/ActionModule.java
// @Module
// public class ActionModule {
// public static final String TAG = ActionModule.class.getSimpleName();
//
// @Provides
// UserActionCreator userActionCreator(OauthRepository oauthRepo,
// UsersRepository usersRepo,
// TeamActionCreator teamActionCreator) {
// return new UserActionCreator(oauthRepo, usersRepo, teamActionCreator);
// }
//
// @Provides
// TeamActionCreator teamActionCreator(TeamsRepository teamsRepo) {
// return new TeamActionCreator(teamsRepo);
// }
// }
//
// Path: app/src/main/java/info/izumin/android/sunazuri/domain/RootStore.java
// @Store({
// AuthorizedUsersReducer.class,
// LoginInfoReducer.class,
// TeamsReducer.class
// })
// public interface RootStore extends BaseStore {
// AuthorizedUsers getAuthorizedUsers();
// Teams getTeams();
// LoginInfo getLoginInfo();
// }
//
// Path: app/src/main/java/info/izumin/android/sunazuri/infrastructure/InfrastructureComponent.java
// @Singleton
// @Component(
// modules = {
// InfrastructureModule.class,
// RepositoryModule.class,
// HttpClientModule.class,
// ApiModule.class,
// CacheModule.class
// }
// )
// public interface InfrastructureComponent {
// TeamsRepository teamsRepository();
// OauthRepository oauthRepository();
// UsersRepository usersRepository();
//
// OauthParams oauthParams();
//
// // for Picasso
// OkHttpClient okHttpClient();
// }
//
// Path: app/src/main/java/info/izumin/android/sunazuri/infrastructure/entity/OauthParams.java
// public class OauthParams {
// public static final String TAG = OauthParams.class.getSimpleName();
//
// public final String endpoint;
// public final String clientId;
// public final String clientSecret;
// public final String redirectUri;
// public final String scope;
// public final String responseType;
// public final String authorizePath;
// public final String grantType;
//
// public OauthParams(String endpoint, String clientId, String clientSecret, String redirectUri, String scope, String responseType, String authorizePath, String grantType) {
// this.endpoint = endpoint;
// this.clientId = clientId;
// this.clientSecret = clientSecret;
// this.redirectUri = redirectUri;
// this.scope = scope;
// this.responseType = responseType;
// this.authorizePath = authorizePath;
// this.grantType = grantType;
// }
//
// public String getAuthorizeUri() {
// return endpoint + authorizePath
// + "?client_id=" + clientId
// + "&redirect_uri=" + redirectUri
// + "&scope=" + scope
// + "&response_type=" + responseType;
// }
// }
// Path: app/src/main/java/info/izumin/android/sunazuri/data/DataComponent.java
import dagger.Component;
import info.izumin.android.sunazuri.data.action.ActionModule;
import info.izumin.android.sunazuri.data.action.team.TeamActionCreator;
import info.izumin.android.sunazuri.data.action.user.UserActionCreator;
import info.izumin.android.sunazuri.domain.RootStore;
import info.izumin.android.sunazuri.infrastructure.InfrastructureComponent;
import info.izumin.android.sunazuri.infrastructure.entity.OauthParams;
import okhttp3.OkHttpClient;
package info.izumin.android.sunazuri.data;
/**
* Created by izumin on 5/13/2016 AD.
*/
@DataScope
@Component(
dependencies = { | InfrastructureComponent.class |
izumin5210/Sunazuri | app/src/main/java/info/izumin/android/sunazuri/data/DataComponent.java | // Path: app/src/main/java/info/izumin/android/sunazuri/data/action/ActionModule.java
// @Module
// public class ActionModule {
// public static final String TAG = ActionModule.class.getSimpleName();
//
// @Provides
// UserActionCreator userActionCreator(OauthRepository oauthRepo,
// UsersRepository usersRepo,
// TeamActionCreator teamActionCreator) {
// return new UserActionCreator(oauthRepo, usersRepo, teamActionCreator);
// }
//
// @Provides
// TeamActionCreator teamActionCreator(TeamsRepository teamsRepo) {
// return new TeamActionCreator(teamsRepo);
// }
// }
//
// Path: app/src/main/java/info/izumin/android/sunazuri/domain/RootStore.java
// @Store({
// AuthorizedUsersReducer.class,
// LoginInfoReducer.class,
// TeamsReducer.class
// })
// public interface RootStore extends BaseStore {
// AuthorizedUsers getAuthorizedUsers();
// Teams getTeams();
// LoginInfo getLoginInfo();
// }
//
// Path: app/src/main/java/info/izumin/android/sunazuri/infrastructure/InfrastructureComponent.java
// @Singleton
// @Component(
// modules = {
// InfrastructureModule.class,
// RepositoryModule.class,
// HttpClientModule.class,
// ApiModule.class,
// CacheModule.class
// }
// )
// public interface InfrastructureComponent {
// TeamsRepository teamsRepository();
// OauthRepository oauthRepository();
// UsersRepository usersRepository();
//
// OauthParams oauthParams();
//
// // for Picasso
// OkHttpClient okHttpClient();
// }
//
// Path: app/src/main/java/info/izumin/android/sunazuri/infrastructure/entity/OauthParams.java
// public class OauthParams {
// public static final String TAG = OauthParams.class.getSimpleName();
//
// public final String endpoint;
// public final String clientId;
// public final String clientSecret;
// public final String redirectUri;
// public final String scope;
// public final String responseType;
// public final String authorizePath;
// public final String grantType;
//
// public OauthParams(String endpoint, String clientId, String clientSecret, String redirectUri, String scope, String responseType, String authorizePath, String grantType) {
// this.endpoint = endpoint;
// this.clientId = clientId;
// this.clientSecret = clientSecret;
// this.redirectUri = redirectUri;
// this.scope = scope;
// this.responseType = responseType;
// this.authorizePath = authorizePath;
// this.grantType = grantType;
// }
//
// public String getAuthorizeUri() {
// return endpoint + authorizePath
// + "?client_id=" + clientId
// + "&redirect_uri=" + redirectUri
// + "&scope=" + scope
// + "&response_type=" + responseType;
// }
// }
| import dagger.Component;
import info.izumin.android.sunazuri.data.action.ActionModule;
import info.izumin.android.sunazuri.data.action.team.TeamActionCreator;
import info.izumin.android.sunazuri.data.action.user.UserActionCreator;
import info.izumin.android.sunazuri.domain.RootStore;
import info.izumin.android.sunazuri.infrastructure.InfrastructureComponent;
import info.izumin.android.sunazuri.infrastructure.entity.OauthParams;
import okhttp3.OkHttpClient; | package info.izumin.android.sunazuri.data;
/**
* Created by izumin on 5/13/2016 AD.
*/
@DataScope
@Component(
dependencies = {
InfrastructureComponent.class
},
modules = { | // Path: app/src/main/java/info/izumin/android/sunazuri/data/action/ActionModule.java
// @Module
// public class ActionModule {
// public static final String TAG = ActionModule.class.getSimpleName();
//
// @Provides
// UserActionCreator userActionCreator(OauthRepository oauthRepo,
// UsersRepository usersRepo,
// TeamActionCreator teamActionCreator) {
// return new UserActionCreator(oauthRepo, usersRepo, teamActionCreator);
// }
//
// @Provides
// TeamActionCreator teamActionCreator(TeamsRepository teamsRepo) {
// return new TeamActionCreator(teamsRepo);
// }
// }
//
// Path: app/src/main/java/info/izumin/android/sunazuri/domain/RootStore.java
// @Store({
// AuthorizedUsersReducer.class,
// LoginInfoReducer.class,
// TeamsReducer.class
// })
// public interface RootStore extends BaseStore {
// AuthorizedUsers getAuthorizedUsers();
// Teams getTeams();
// LoginInfo getLoginInfo();
// }
//
// Path: app/src/main/java/info/izumin/android/sunazuri/infrastructure/InfrastructureComponent.java
// @Singleton
// @Component(
// modules = {
// InfrastructureModule.class,
// RepositoryModule.class,
// HttpClientModule.class,
// ApiModule.class,
// CacheModule.class
// }
// )
// public interface InfrastructureComponent {
// TeamsRepository teamsRepository();
// OauthRepository oauthRepository();
// UsersRepository usersRepository();
//
// OauthParams oauthParams();
//
// // for Picasso
// OkHttpClient okHttpClient();
// }
//
// Path: app/src/main/java/info/izumin/android/sunazuri/infrastructure/entity/OauthParams.java
// public class OauthParams {
// public static final String TAG = OauthParams.class.getSimpleName();
//
// public final String endpoint;
// public final String clientId;
// public final String clientSecret;
// public final String redirectUri;
// public final String scope;
// public final String responseType;
// public final String authorizePath;
// public final String grantType;
//
// public OauthParams(String endpoint, String clientId, String clientSecret, String redirectUri, String scope, String responseType, String authorizePath, String grantType) {
// this.endpoint = endpoint;
// this.clientId = clientId;
// this.clientSecret = clientSecret;
// this.redirectUri = redirectUri;
// this.scope = scope;
// this.responseType = responseType;
// this.authorizePath = authorizePath;
// this.grantType = grantType;
// }
//
// public String getAuthorizeUri() {
// return endpoint + authorizePath
// + "?client_id=" + clientId
// + "&redirect_uri=" + redirectUri
// + "&scope=" + scope
// + "&response_type=" + responseType;
// }
// }
// Path: app/src/main/java/info/izumin/android/sunazuri/data/DataComponent.java
import dagger.Component;
import info.izumin.android.sunazuri.data.action.ActionModule;
import info.izumin.android.sunazuri.data.action.team.TeamActionCreator;
import info.izumin.android.sunazuri.data.action.user.UserActionCreator;
import info.izumin.android.sunazuri.domain.RootStore;
import info.izumin.android.sunazuri.infrastructure.InfrastructureComponent;
import info.izumin.android.sunazuri.infrastructure.entity.OauthParams;
import okhttp3.OkHttpClient;
package info.izumin.android.sunazuri.data;
/**
* Created by izumin on 5/13/2016 AD.
*/
@DataScope
@Component(
dependencies = {
InfrastructureComponent.class
},
modules = { | ActionModule.class, |
izumin5210/Sunazuri | app/src/main/java/info/izumin/android/sunazuri/data/DataComponent.java | // Path: app/src/main/java/info/izumin/android/sunazuri/data/action/ActionModule.java
// @Module
// public class ActionModule {
// public static final String TAG = ActionModule.class.getSimpleName();
//
// @Provides
// UserActionCreator userActionCreator(OauthRepository oauthRepo,
// UsersRepository usersRepo,
// TeamActionCreator teamActionCreator) {
// return new UserActionCreator(oauthRepo, usersRepo, teamActionCreator);
// }
//
// @Provides
// TeamActionCreator teamActionCreator(TeamsRepository teamsRepo) {
// return new TeamActionCreator(teamsRepo);
// }
// }
//
// Path: app/src/main/java/info/izumin/android/sunazuri/domain/RootStore.java
// @Store({
// AuthorizedUsersReducer.class,
// LoginInfoReducer.class,
// TeamsReducer.class
// })
// public interface RootStore extends BaseStore {
// AuthorizedUsers getAuthorizedUsers();
// Teams getTeams();
// LoginInfo getLoginInfo();
// }
//
// Path: app/src/main/java/info/izumin/android/sunazuri/infrastructure/InfrastructureComponent.java
// @Singleton
// @Component(
// modules = {
// InfrastructureModule.class,
// RepositoryModule.class,
// HttpClientModule.class,
// ApiModule.class,
// CacheModule.class
// }
// )
// public interface InfrastructureComponent {
// TeamsRepository teamsRepository();
// OauthRepository oauthRepository();
// UsersRepository usersRepository();
//
// OauthParams oauthParams();
//
// // for Picasso
// OkHttpClient okHttpClient();
// }
//
// Path: app/src/main/java/info/izumin/android/sunazuri/infrastructure/entity/OauthParams.java
// public class OauthParams {
// public static final String TAG = OauthParams.class.getSimpleName();
//
// public final String endpoint;
// public final String clientId;
// public final String clientSecret;
// public final String redirectUri;
// public final String scope;
// public final String responseType;
// public final String authorizePath;
// public final String grantType;
//
// public OauthParams(String endpoint, String clientId, String clientSecret, String redirectUri, String scope, String responseType, String authorizePath, String grantType) {
// this.endpoint = endpoint;
// this.clientId = clientId;
// this.clientSecret = clientSecret;
// this.redirectUri = redirectUri;
// this.scope = scope;
// this.responseType = responseType;
// this.authorizePath = authorizePath;
// this.grantType = grantType;
// }
//
// public String getAuthorizeUri() {
// return endpoint + authorizePath
// + "?client_id=" + clientId
// + "&redirect_uri=" + redirectUri
// + "&scope=" + scope
// + "&response_type=" + responseType;
// }
// }
| import dagger.Component;
import info.izumin.android.sunazuri.data.action.ActionModule;
import info.izumin.android.sunazuri.data.action.team.TeamActionCreator;
import info.izumin.android.sunazuri.data.action.user.UserActionCreator;
import info.izumin.android.sunazuri.domain.RootStore;
import info.izumin.android.sunazuri.infrastructure.InfrastructureComponent;
import info.izumin.android.sunazuri.infrastructure.entity.OauthParams;
import okhttp3.OkHttpClient; | package info.izumin.android.sunazuri.data;
/**
* Created by izumin on 5/13/2016 AD.
*/
@DataScope
@Component(
dependencies = {
InfrastructureComponent.class
},
modules = {
ActionModule.class,
DataModule.class
}
)
public interface DataComponent { | // Path: app/src/main/java/info/izumin/android/sunazuri/data/action/ActionModule.java
// @Module
// public class ActionModule {
// public static final String TAG = ActionModule.class.getSimpleName();
//
// @Provides
// UserActionCreator userActionCreator(OauthRepository oauthRepo,
// UsersRepository usersRepo,
// TeamActionCreator teamActionCreator) {
// return new UserActionCreator(oauthRepo, usersRepo, teamActionCreator);
// }
//
// @Provides
// TeamActionCreator teamActionCreator(TeamsRepository teamsRepo) {
// return new TeamActionCreator(teamsRepo);
// }
// }
//
// Path: app/src/main/java/info/izumin/android/sunazuri/domain/RootStore.java
// @Store({
// AuthorizedUsersReducer.class,
// LoginInfoReducer.class,
// TeamsReducer.class
// })
// public interface RootStore extends BaseStore {
// AuthorizedUsers getAuthorizedUsers();
// Teams getTeams();
// LoginInfo getLoginInfo();
// }
//
// Path: app/src/main/java/info/izumin/android/sunazuri/infrastructure/InfrastructureComponent.java
// @Singleton
// @Component(
// modules = {
// InfrastructureModule.class,
// RepositoryModule.class,
// HttpClientModule.class,
// ApiModule.class,
// CacheModule.class
// }
// )
// public interface InfrastructureComponent {
// TeamsRepository teamsRepository();
// OauthRepository oauthRepository();
// UsersRepository usersRepository();
//
// OauthParams oauthParams();
//
// // for Picasso
// OkHttpClient okHttpClient();
// }
//
// Path: app/src/main/java/info/izumin/android/sunazuri/infrastructure/entity/OauthParams.java
// public class OauthParams {
// public static final String TAG = OauthParams.class.getSimpleName();
//
// public final String endpoint;
// public final String clientId;
// public final String clientSecret;
// public final String redirectUri;
// public final String scope;
// public final String responseType;
// public final String authorizePath;
// public final String grantType;
//
// public OauthParams(String endpoint, String clientId, String clientSecret, String redirectUri, String scope, String responseType, String authorizePath, String grantType) {
// this.endpoint = endpoint;
// this.clientId = clientId;
// this.clientSecret = clientSecret;
// this.redirectUri = redirectUri;
// this.scope = scope;
// this.responseType = responseType;
// this.authorizePath = authorizePath;
// this.grantType = grantType;
// }
//
// public String getAuthorizeUri() {
// return endpoint + authorizePath
// + "?client_id=" + clientId
// + "&redirect_uri=" + redirectUri
// + "&scope=" + scope
// + "&response_type=" + responseType;
// }
// }
// Path: app/src/main/java/info/izumin/android/sunazuri/data/DataComponent.java
import dagger.Component;
import info.izumin.android.sunazuri.data.action.ActionModule;
import info.izumin.android.sunazuri.data.action.team.TeamActionCreator;
import info.izumin.android.sunazuri.data.action.user.UserActionCreator;
import info.izumin.android.sunazuri.domain.RootStore;
import info.izumin.android.sunazuri.infrastructure.InfrastructureComponent;
import info.izumin.android.sunazuri.infrastructure.entity.OauthParams;
import okhttp3.OkHttpClient;
package info.izumin.android.sunazuri.data;
/**
* Created by izumin on 5/13/2016 AD.
*/
@DataScope
@Component(
dependencies = {
InfrastructureComponent.class
},
modules = {
ActionModule.class,
DataModule.class
}
)
public interface DataComponent { | RootStore rootStore(); |
izumin5210/Sunazuri | app/src/main/java/info/izumin/android/sunazuri/data/DataComponent.java | // Path: app/src/main/java/info/izumin/android/sunazuri/data/action/ActionModule.java
// @Module
// public class ActionModule {
// public static final String TAG = ActionModule.class.getSimpleName();
//
// @Provides
// UserActionCreator userActionCreator(OauthRepository oauthRepo,
// UsersRepository usersRepo,
// TeamActionCreator teamActionCreator) {
// return new UserActionCreator(oauthRepo, usersRepo, teamActionCreator);
// }
//
// @Provides
// TeamActionCreator teamActionCreator(TeamsRepository teamsRepo) {
// return new TeamActionCreator(teamsRepo);
// }
// }
//
// Path: app/src/main/java/info/izumin/android/sunazuri/domain/RootStore.java
// @Store({
// AuthorizedUsersReducer.class,
// LoginInfoReducer.class,
// TeamsReducer.class
// })
// public interface RootStore extends BaseStore {
// AuthorizedUsers getAuthorizedUsers();
// Teams getTeams();
// LoginInfo getLoginInfo();
// }
//
// Path: app/src/main/java/info/izumin/android/sunazuri/infrastructure/InfrastructureComponent.java
// @Singleton
// @Component(
// modules = {
// InfrastructureModule.class,
// RepositoryModule.class,
// HttpClientModule.class,
// ApiModule.class,
// CacheModule.class
// }
// )
// public interface InfrastructureComponent {
// TeamsRepository teamsRepository();
// OauthRepository oauthRepository();
// UsersRepository usersRepository();
//
// OauthParams oauthParams();
//
// // for Picasso
// OkHttpClient okHttpClient();
// }
//
// Path: app/src/main/java/info/izumin/android/sunazuri/infrastructure/entity/OauthParams.java
// public class OauthParams {
// public static final String TAG = OauthParams.class.getSimpleName();
//
// public final String endpoint;
// public final String clientId;
// public final String clientSecret;
// public final String redirectUri;
// public final String scope;
// public final String responseType;
// public final String authorizePath;
// public final String grantType;
//
// public OauthParams(String endpoint, String clientId, String clientSecret, String redirectUri, String scope, String responseType, String authorizePath, String grantType) {
// this.endpoint = endpoint;
// this.clientId = clientId;
// this.clientSecret = clientSecret;
// this.redirectUri = redirectUri;
// this.scope = scope;
// this.responseType = responseType;
// this.authorizePath = authorizePath;
// this.grantType = grantType;
// }
//
// public String getAuthorizeUri() {
// return endpoint + authorizePath
// + "?client_id=" + clientId
// + "&redirect_uri=" + redirectUri
// + "&scope=" + scope
// + "&response_type=" + responseType;
// }
// }
| import dagger.Component;
import info.izumin.android.sunazuri.data.action.ActionModule;
import info.izumin.android.sunazuri.data.action.team.TeamActionCreator;
import info.izumin.android.sunazuri.data.action.user.UserActionCreator;
import info.izumin.android.sunazuri.domain.RootStore;
import info.izumin.android.sunazuri.infrastructure.InfrastructureComponent;
import info.izumin.android.sunazuri.infrastructure.entity.OauthParams;
import okhttp3.OkHttpClient; | package info.izumin.android.sunazuri.data;
/**
* Created by izumin on 5/13/2016 AD.
*/
@DataScope
@Component(
dependencies = {
InfrastructureComponent.class
},
modules = {
ActionModule.class,
DataModule.class
}
)
public interface DataComponent {
RootStore rootStore(); | // Path: app/src/main/java/info/izumin/android/sunazuri/data/action/ActionModule.java
// @Module
// public class ActionModule {
// public static final String TAG = ActionModule.class.getSimpleName();
//
// @Provides
// UserActionCreator userActionCreator(OauthRepository oauthRepo,
// UsersRepository usersRepo,
// TeamActionCreator teamActionCreator) {
// return new UserActionCreator(oauthRepo, usersRepo, teamActionCreator);
// }
//
// @Provides
// TeamActionCreator teamActionCreator(TeamsRepository teamsRepo) {
// return new TeamActionCreator(teamsRepo);
// }
// }
//
// Path: app/src/main/java/info/izumin/android/sunazuri/domain/RootStore.java
// @Store({
// AuthorizedUsersReducer.class,
// LoginInfoReducer.class,
// TeamsReducer.class
// })
// public interface RootStore extends BaseStore {
// AuthorizedUsers getAuthorizedUsers();
// Teams getTeams();
// LoginInfo getLoginInfo();
// }
//
// Path: app/src/main/java/info/izumin/android/sunazuri/infrastructure/InfrastructureComponent.java
// @Singleton
// @Component(
// modules = {
// InfrastructureModule.class,
// RepositoryModule.class,
// HttpClientModule.class,
// ApiModule.class,
// CacheModule.class
// }
// )
// public interface InfrastructureComponent {
// TeamsRepository teamsRepository();
// OauthRepository oauthRepository();
// UsersRepository usersRepository();
//
// OauthParams oauthParams();
//
// // for Picasso
// OkHttpClient okHttpClient();
// }
//
// Path: app/src/main/java/info/izumin/android/sunazuri/infrastructure/entity/OauthParams.java
// public class OauthParams {
// public static final String TAG = OauthParams.class.getSimpleName();
//
// public final String endpoint;
// public final String clientId;
// public final String clientSecret;
// public final String redirectUri;
// public final String scope;
// public final String responseType;
// public final String authorizePath;
// public final String grantType;
//
// public OauthParams(String endpoint, String clientId, String clientSecret, String redirectUri, String scope, String responseType, String authorizePath, String grantType) {
// this.endpoint = endpoint;
// this.clientId = clientId;
// this.clientSecret = clientSecret;
// this.redirectUri = redirectUri;
// this.scope = scope;
// this.responseType = responseType;
// this.authorizePath = authorizePath;
// this.grantType = grantType;
// }
//
// public String getAuthorizeUri() {
// return endpoint + authorizePath
// + "?client_id=" + clientId
// + "&redirect_uri=" + redirectUri
// + "&scope=" + scope
// + "&response_type=" + responseType;
// }
// }
// Path: app/src/main/java/info/izumin/android/sunazuri/data/DataComponent.java
import dagger.Component;
import info.izumin.android.sunazuri.data.action.ActionModule;
import info.izumin.android.sunazuri.data.action.team.TeamActionCreator;
import info.izumin.android.sunazuri.data.action.user.UserActionCreator;
import info.izumin.android.sunazuri.domain.RootStore;
import info.izumin.android.sunazuri.infrastructure.InfrastructureComponent;
import info.izumin.android.sunazuri.infrastructure.entity.OauthParams;
import okhttp3.OkHttpClient;
package info.izumin.android.sunazuri.data;
/**
* Created by izumin on 5/13/2016 AD.
*/
@DataScope
@Component(
dependencies = {
InfrastructureComponent.class
},
modules = {
ActionModule.class,
DataModule.class
}
)
public interface DataComponent {
RootStore rootStore(); | OauthParams oauthParams(); |
izumin5210/Sunazuri | app/src/main/java/info/izumin/android/sunazuri/presentation/fragment/welcome/WelcomeFragment.java | // Path: app/src/main/java/info/izumin/android/sunazuri/RequestCode.java
// public class RequestCode {
// private RequestCode() {
// throw new AssertionError("constructor of the constants class should not be called");
// }
//
// public static final int OAUTH = 100;
// }
//
// Path: app/src/main/java/info/izumin/android/sunazuri/presentation/activity/main/MainContract.java
// public interface MainContract {
// interface View {
// void setFragment(Fragment fragment);
// Context getActivityContext();
// MainComponent getMainComponent();
// }
// }
//
// Path: app/src/main/java/info/izumin/android/sunazuri/presentation/activity/oauth/OauthActivity.java
// public class OauthActivity extends AppCompatActivity {
// public static final String TAG = OauthActivity.class.getSimpleName();
//
// @Inject RootStore store;
// @Inject OauthParams oauthParams;
// @Inject UserActionCreator userActionCreator;
//
// @Override
// protected void onCreate(Bundle savedInstanceState) {
// super.onCreate(savedInstanceState);
// setContentView(R.layout.activity_oauth);
// inject();
//
// if (store.getAuthorizedUsers().isEmpty()) {
// CustomTabsIntent intent = new CustomTabsIntent.Builder().build();
// intent.launchUrl(this, Uri.parse(oauthParams.getAuthorizeUri()));
// }
// }
//
// @Override
// protected void onNewIntent(Intent intent) {
// super.onNewIntent(intent);
// inject();
// store.dispatch(userActionCreator.createAuthAction(intent.getDataString()))
// .subscribeOn(Schedulers.io())
// .observeOn(AndroidSchedulers.mainThread())
// .subscribe(
// _a -> returnToMain(),
// this::returnToMain
// );
// }
//
// private void returnToMain() {
// setResult(Activity.RESULT_OK);
// finish();
// }
//
// private void returnToMain(Throwable throwable) {
// setResult(Activity.RESULT_CANCELED);
// finish();
// }
//
// private void inject() {
// Sunazuri.get(this).getComponent().inject(this);
// }
// }
//
// Path: app/src/main/java/info/izumin/android/sunazuri/presentation/fragment/posts/PostsFragment.java
// public class PostsFragment extends Fragment {
//
//
// public PostsFragment() {
// // Required empty public constructor
// }
//
//
// @Override
// public View onCreateView(LayoutInflater inflater, ViewGroup container,
// Bundle savedInstanceState) {
// // Inflate the layout for this fragment
// return inflater.inflate(R.layout.fragment_posts, container, false);
// }
//
// }
| import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import info.izumin.android.sunazuri.R;
import info.izumin.android.sunazuri.RequestCode;
import info.izumin.android.sunazuri.databinding.FragmentWelcomeBinding;
import info.izumin.android.sunazuri.presentation.activity.main.MainContract;
import info.izumin.android.sunazuri.presentation.activity.oauth.OauthActivity;
import info.izumin.android.sunazuri.presentation.fragment.posts.PostsFragment;
import onactivityresult.ActivityResult;
import javax.inject.Inject; | package info.izumin.android.sunazuri.presentation.fragment.welcome;
/**
* A simple {@link Fragment} subclass.
*/
public class WelcomeFragment extends Fragment implements WelcomeContract.View {
public static final String TAG = WelcomeFragment.class.getSimpleName();
public WelcomeFragment() {
// Required empty public constructor
}
private FragmentWelcomeBinding binding;
private WelcomeComponent component; | // Path: app/src/main/java/info/izumin/android/sunazuri/RequestCode.java
// public class RequestCode {
// private RequestCode() {
// throw new AssertionError("constructor of the constants class should not be called");
// }
//
// public static final int OAUTH = 100;
// }
//
// Path: app/src/main/java/info/izumin/android/sunazuri/presentation/activity/main/MainContract.java
// public interface MainContract {
// interface View {
// void setFragment(Fragment fragment);
// Context getActivityContext();
// MainComponent getMainComponent();
// }
// }
//
// Path: app/src/main/java/info/izumin/android/sunazuri/presentation/activity/oauth/OauthActivity.java
// public class OauthActivity extends AppCompatActivity {
// public static final String TAG = OauthActivity.class.getSimpleName();
//
// @Inject RootStore store;
// @Inject OauthParams oauthParams;
// @Inject UserActionCreator userActionCreator;
//
// @Override
// protected void onCreate(Bundle savedInstanceState) {
// super.onCreate(savedInstanceState);
// setContentView(R.layout.activity_oauth);
// inject();
//
// if (store.getAuthorizedUsers().isEmpty()) {
// CustomTabsIntent intent = new CustomTabsIntent.Builder().build();
// intent.launchUrl(this, Uri.parse(oauthParams.getAuthorizeUri()));
// }
// }
//
// @Override
// protected void onNewIntent(Intent intent) {
// super.onNewIntent(intent);
// inject();
// store.dispatch(userActionCreator.createAuthAction(intent.getDataString()))
// .subscribeOn(Schedulers.io())
// .observeOn(AndroidSchedulers.mainThread())
// .subscribe(
// _a -> returnToMain(),
// this::returnToMain
// );
// }
//
// private void returnToMain() {
// setResult(Activity.RESULT_OK);
// finish();
// }
//
// private void returnToMain(Throwable throwable) {
// setResult(Activity.RESULT_CANCELED);
// finish();
// }
//
// private void inject() {
// Sunazuri.get(this).getComponent().inject(this);
// }
// }
//
// Path: app/src/main/java/info/izumin/android/sunazuri/presentation/fragment/posts/PostsFragment.java
// public class PostsFragment extends Fragment {
//
//
// public PostsFragment() {
// // Required empty public constructor
// }
//
//
// @Override
// public View onCreateView(LayoutInflater inflater, ViewGroup container,
// Bundle savedInstanceState) {
// // Inflate the layout for this fragment
// return inflater.inflate(R.layout.fragment_posts, container, false);
// }
//
// }
// Path: app/src/main/java/info/izumin/android/sunazuri/presentation/fragment/welcome/WelcomeFragment.java
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import info.izumin.android.sunazuri.R;
import info.izumin.android.sunazuri.RequestCode;
import info.izumin.android.sunazuri.databinding.FragmentWelcomeBinding;
import info.izumin.android.sunazuri.presentation.activity.main.MainContract;
import info.izumin.android.sunazuri.presentation.activity.oauth.OauthActivity;
import info.izumin.android.sunazuri.presentation.fragment.posts.PostsFragment;
import onactivityresult.ActivityResult;
import javax.inject.Inject;
package info.izumin.android.sunazuri.presentation.fragment.welcome;
/**
* A simple {@link Fragment} subclass.
*/
public class WelcomeFragment extends Fragment implements WelcomeContract.View {
public static final String TAG = WelcomeFragment.class.getSimpleName();
public WelcomeFragment() {
// Required empty public constructor
}
private FragmentWelcomeBinding binding;
private WelcomeComponent component; | private MainContract.View mainView; |
izumin5210/Sunazuri | app/src/main/java/info/izumin/android/sunazuri/presentation/fragment/welcome/WelcomeFragment.java | // Path: app/src/main/java/info/izumin/android/sunazuri/RequestCode.java
// public class RequestCode {
// private RequestCode() {
// throw new AssertionError("constructor of the constants class should not be called");
// }
//
// public static final int OAUTH = 100;
// }
//
// Path: app/src/main/java/info/izumin/android/sunazuri/presentation/activity/main/MainContract.java
// public interface MainContract {
// interface View {
// void setFragment(Fragment fragment);
// Context getActivityContext();
// MainComponent getMainComponent();
// }
// }
//
// Path: app/src/main/java/info/izumin/android/sunazuri/presentation/activity/oauth/OauthActivity.java
// public class OauthActivity extends AppCompatActivity {
// public static final String TAG = OauthActivity.class.getSimpleName();
//
// @Inject RootStore store;
// @Inject OauthParams oauthParams;
// @Inject UserActionCreator userActionCreator;
//
// @Override
// protected void onCreate(Bundle savedInstanceState) {
// super.onCreate(savedInstanceState);
// setContentView(R.layout.activity_oauth);
// inject();
//
// if (store.getAuthorizedUsers().isEmpty()) {
// CustomTabsIntent intent = new CustomTabsIntent.Builder().build();
// intent.launchUrl(this, Uri.parse(oauthParams.getAuthorizeUri()));
// }
// }
//
// @Override
// protected void onNewIntent(Intent intent) {
// super.onNewIntent(intent);
// inject();
// store.dispatch(userActionCreator.createAuthAction(intent.getDataString()))
// .subscribeOn(Schedulers.io())
// .observeOn(AndroidSchedulers.mainThread())
// .subscribe(
// _a -> returnToMain(),
// this::returnToMain
// );
// }
//
// private void returnToMain() {
// setResult(Activity.RESULT_OK);
// finish();
// }
//
// private void returnToMain(Throwable throwable) {
// setResult(Activity.RESULT_CANCELED);
// finish();
// }
//
// private void inject() {
// Sunazuri.get(this).getComponent().inject(this);
// }
// }
//
// Path: app/src/main/java/info/izumin/android/sunazuri/presentation/fragment/posts/PostsFragment.java
// public class PostsFragment extends Fragment {
//
//
// public PostsFragment() {
// // Required empty public constructor
// }
//
//
// @Override
// public View onCreateView(LayoutInflater inflater, ViewGroup container,
// Bundle savedInstanceState) {
// // Inflate the layout for this fragment
// return inflater.inflate(R.layout.fragment_posts, container, false);
// }
//
// }
| import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import info.izumin.android.sunazuri.R;
import info.izumin.android.sunazuri.RequestCode;
import info.izumin.android.sunazuri.databinding.FragmentWelcomeBinding;
import info.izumin.android.sunazuri.presentation.activity.main.MainContract;
import info.izumin.android.sunazuri.presentation.activity.oauth.OauthActivity;
import info.izumin.android.sunazuri.presentation.fragment.posts.PostsFragment;
import onactivityresult.ActivityResult;
import javax.inject.Inject; | public void onAttach(Context context) {
super.onAttach(context);
if (getActivity() instanceof MainContract.View) {
mainView = (MainContract.View) getActivity();
}
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
// Inflate the layout for this fragment
return inflater.inflate(R.layout.fragment_welcome, container, false);
}
@Override
public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
setupComponent();
binding = FragmentWelcomeBinding.bind(view);
binding.setController(controller);
}
@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
ActivityResult.onResult(requestCode, resultCode, data).into(controller);
}
@Override
public void showOauthUi() { | // Path: app/src/main/java/info/izumin/android/sunazuri/RequestCode.java
// public class RequestCode {
// private RequestCode() {
// throw new AssertionError("constructor of the constants class should not be called");
// }
//
// public static final int OAUTH = 100;
// }
//
// Path: app/src/main/java/info/izumin/android/sunazuri/presentation/activity/main/MainContract.java
// public interface MainContract {
// interface View {
// void setFragment(Fragment fragment);
// Context getActivityContext();
// MainComponent getMainComponent();
// }
// }
//
// Path: app/src/main/java/info/izumin/android/sunazuri/presentation/activity/oauth/OauthActivity.java
// public class OauthActivity extends AppCompatActivity {
// public static final String TAG = OauthActivity.class.getSimpleName();
//
// @Inject RootStore store;
// @Inject OauthParams oauthParams;
// @Inject UserActionCreator userActionCreator;
//
// @Override
// protected void onCreate(Bundle savedInstanceState) {
// super.onCreate(savedInstanceState);
// setContentView(R.layout.activity_oauth);
// inject();
//
// if (store.getAuthorizedUsers().isEmpty()) {
// CustomTabsIntent intent = new CustomTabsIntent.Builder().build();
// intent.launchUrl(this, Uri.parse(oauthParams.getAuthorizeUri()));
// }
// }
//
// @Override
// protected void onNewIntent(Intent intent) {
// super.onNewIntent(intent);
// inject();
// store.dispatch(userActionCreator.createAuthAction(intent.getDataString()))
// .subscribeOn(Schedulers.io())
// .observeOn(AndroidSchedulers.mainThread())
// .subscribe(
// _a -> returnToMain(),
// this::returnToMain
// );
// }
//
// private void returnToMain() {
// setResult(Activity.RESULT_OK);
// finish();
// }
//
// private void returnToMain(Throwable throwable) {
// setResult(Activity.RESULT_CANCELED);
// finish();
// }
//
// private void inject() {
// Sunazuri.get(this).getComponent().inject(this);
// }
// }
//
// Path: app/src/main/java/info/izumin/android/sunazuri/presentation/fragment/posts/PostsFragment.java
// public class PostsFragment extends Fragment {
//
//
// public PostsFragment() {
// // Required empty public constructor
// }
//
//
// @Override
// public View onCreateView(LayoutInflater inflater, ViewGroup container,
// Bundle savedInstanceState) {
// // Inflate the layout for this fragment
// return inflater.inflate(R.layout.fragment_posts, container, false);
// }
//
// }
// Path: app/src/main/java/info/izumin/android/sunazuri/presentation/fragment/welcome/WelcomeFragment.java
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import info.izumin.android.sunazuri.R;
import info.izumin.android.sunazuri.RequestCode;
import info.izumin.android.sunazuri.databinding.FragmentWelcomeBinding;
import info.izumin.android.sunazuri.presentation.activity.main.MainContract;
import info.izumin.android.sunazuri.presentation.activity.oauth.OauthActivity;
import info.izumin.android.sunazuri.presentation.fragment.posts.PostsFragment;
import onactivityresult.ActivityResult;
import javax.inject.Inject;
public void onAttach(Context context) {
super.onAttach(context);
if (getActivity() instanceof MainContract.View) {
mainView = (MainContract.View) getActivity();
}
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
// Inflate the layout for this fragment
return inflater.inflate(R.layout.fragment_welcome, container, false);
}
@Override
public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
setupComponent();
binding = FragmentWelcomeBinding.bind(view);
binding.setController(controller);
}
@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
ActivityResult.onResult(requestCode, resultCode, data).into(controller);
}
@Override
public void showOauthUi() { | startActivityForResult(new Intent(getActivity(), OauthActivity.class), RequestCode.OAUTH); |
izumin5210/Sunazuri | app/src/main/java/info/izumin/android/sunazuri/presentation/fragment/welcome/WelcomeFragment.java | // Path: app/src/main/java/info/izumin/android/sunazuri/RequestCode.java
// public class RequestCode {
// private RequestCode() {
// throw new AssertionError("constructor of the constants class should not be called");
// }
//
// public static final int OAUTH = 100;
// }
//
// Path: app/src/main/java/info/izumin/android/sunazuri/presentation/activity/main/MainContract.java
// public interface MainContract {
// interface View {
// void setFragment(Fragment fragment);
// Context getActivityContext();
// MainComponent getMainComponent();
// }
// }
//
// Path: app/src/main/java/info/izumin/android/sunazuri/presentation/activity/oauth/OauthActivity.java
// public class OauthActivity extends AppCompatActivity {
// public static final String TAG = OauthActivity.class.getSimpleName();
//
// @Inject RootStore store;
// @Inject OauthParams oauthParams;
// @Inject UserActionCreator userActionCreator;
//
// @Override
// protected void onCreate(Bundle savedInstanceState) {
// super.onCreate(savedInstanceState);
// setContentView(R.layout.activity_oauth);
// inject();
//
// if (store.getAuthorizedUsers().isEmpty()) {
// CustomTabsIntent intent = new CustomTabsIntent.Builder().build();
// intent.launchUrl(this, Uri.parse(oauthParams.getAuthorizeUri()));
// }
// }
//
// @Override
// protected void onNewIntent(Intent intent) {
// super.onNewIntent(intent);
// inject();
// store.dispatch(userActionCreator.createAuthAction(intent.getDataString()))
// .subscribeOn(Schedulers.io())
// .observeOn(AndroidSchedulers.mainThread())
// .subscribe(
// _a -> returnToMain(),
// this::returnToMain
// );
// }
//
// private void returnToMain() {
// setResult(Activity.RESULT_OK);
// finish();
// }
//
// private void returnToMain(Throwable throwable) {
// setResult(Activity.RESULT_CANCELED);
// finish();
// }
//
// private void inject() {
// Sunazuri.get(this).getComponent().inject(this);
// }
// }
//
// Path: app/src/main/java/info/izumin/android/sunazuri/presentation/fragment/posts/PostsFragment.java
// public class PostsFragment extends Fragment {
//
//
// public PostsFragment() {
// // Required empty public constructor
// }
//
//
// @Override
// public View onCreateView(LayoutInflater inflater, ViewGroup container,
// Bundle savedInstanceState) {
// // Inflate the layout for this fragment
// return inflater.inflate(R.layout.fragment_posts, container, false);
// }
//
// }
| import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import info.izumin.android.sunazuri.R;
import info.izumin.android.sunazuri.RequestCode;
import info.izumin.android.sunazuri.databinding.FragmentWelcomeBinding;
import info.izumin.android.sunazuri.presentation.activity.main.MainContract;
import info.izumin.android.sunazuri.presentation.activity.oauth.OauthActivity;
import info.izumin.android.sunazuri.presentation.fragment.posts.PostsFragment;
import onactivityresult.ActivityResult;
import javax.inject.Inject; | public void onAttach(Context context) {
super.onAttach(context);
if (getActivity() instanceof MainContract.View) {
mainView = (MainContract.View) getActivity();
}
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
// Inflate the layout for this fragment
return inflater.inflate(R.layout.fragment_welcome, container, false);
}
@Override
public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
setupComponent();
binding = FragmentWelcomeBinding.bind(view);
binding.setController(controller);
}
@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
ActivityResult.onResult(requestCode, resultCode, data).into(controller);
}
@Override
public void showOauthUi() { | // Path: app/src/main/java/info/izumin/android/sunazuri/RequestCode.java
// public class RequestCode {
// private RequestCode() {
// throw new AssertionError("constructor of the constants class should not be called");
// }
//
// public static final int OAUTH = 100;
// }
//
// Path: app/src/main/java/info/izumin/android/sunazuri/presentation/activity/main/MainContract.java
// public interface MainContract {
// interface View {
// void setFragment(Fragment fragment);
// Context getActivityContext();
// MainComponent getMainComponent();
// }
// }
//
// Path: app/src/main/java/info/izumin/android/sunazuri/presentation/activity/oauth/OauthActivity.java
// public class OauthActivity extends AppCompatActivity {
// public static final String TAG = OauthActivity.class.getSimpleName();
//
// @Inject RootStore store;
// @Inject OauthParams oauthParams;
// @Inject UserActionCreator userActionCreator;
//
// @Override
// protected void onCreate(Bundle savedInstanceState) {
// super.onCreate(savedInstanceState);
// setContentView(R.layout.activity_oauth);
// inject();
//
// if (store.getAuthorizedUsers().isEmpty()) {
// CustomTabsIntent intent = new CustomTabsIntent.Builder().build();
// intent.launchUrl(this, Uri.parse(oauthParams.getAuthorizeUri()));
// }
// }
//
// @Override
// protected void onNewIntent(Intent intent) {
// super.onNewIntent(intent);
// inject();
// store.dispatch(userActionCreator.createAuthAction(intent.getDataString()))
// .subscribeOn(Schedulers.io())
// .observeOn(AndroidSchedulers.mainThread())
// .subscribe(
// _a -> returnToMain(),
// this::returnToMain
// );
// }
//
// private void returnToMain() {
// setResult(Activity.RESULT_OK);
// finish();
// }
//
// private void returnToMain(Throwable throwable) {
// setResult(Activity.RESULT_CANCELED);
// finish();
// }
//
// private void inject() {
// Sunazuri.get(this).getComponent().inject(this);
// }
// }
//
// Path: app/src/main/java/info/izumin/android/sunazuri/presentation/fragment/posts/PostsFragment.java
// public class PostsFragment extends Fragment {
//
//
// public PostsFragment() {
// // Required empty public constructor
// }
//
//
// @Override
// public View onCreateView(LayoutInflater inflater, ViewGroup container,
// Bundle savedInstanceState) {
// // Inflate the layout for this fragment
// return inflater.inflate(R.layout.fragment_posts, container, false);
// }
//
// }
// Path: app/src/main/java/info/izumin/android/sunazuri/presentation/fragment/welcome/WelcomeFragment.java
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import info.izumin.android.sunazuri.R;
import info.izumin.android.sunazuri.RequestCode;
import info.izumin.android.sunazuri.databinding.FragmentWelcomeBinding;
import info.izumin.android.sunazuri.presentation.activity.main.MainContract;
import info.izumin.android.sunazuri.presentation.activity.oauth.OauthActivity;
import info.izumin.android.sunazuri.presentation.fragment.posts.PostsFragment;
import onactivityresult.ActivityResult;
import javax.inject.Inject;
public void onAttach(Context context) {
super.onAttach(context);
if (getActivity() instanceof MainContract.View) {
mainView = (MainContract.View) getActivity();
}
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
// Inflate the layout for this fragment
return inflater.inflate(R.layout.fragment_welcome, container, false);
}
@Override
public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
setupComponent();
binding = FragmentWelcomeBinding.bind(view);
binding.setController(controller);
}
@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
ActivityResult.onResult(requestCode, resultCode, data).into(controller);
}
@Override
public void showOauthUi() { | startActivityForResult(new Intent(getActivity(), OauthActivity.class), RequestCode.OAUTH); |
izumin5210/Sunazuri | app/src/main/java/info/izumin/android/sunazuri/presentation/fragment/welcome/WelcomeFragment.java | // Path: app/src/main/java/info/izumin/android/sunazuri/RequestCode.java
// public class RequestCode {
// private RequestCode() {
// throw new AssertionError("constructor of the constants class should not be called");
// }
//
// public static final int OAUTH = 100;
// }
//
// Path: app/src/main/java/info/izumin/android/sunazuri/presentation/activity/main/MainContract.java
// public interface MainContract {
// interface View {
// void setFragment(Fragment fragment);
// Context getActivityContext();
// MainComponent getMainComponent();
// }
// }
//
// Path: app/src/main/java/info/izumin/android/sunazuri/presentation/activity/oauth/OauthActivity.java
// public class OauthActivity extends AppCompatActivity {
// public static final String TAG = OauthActivity.class.getSimpleName();
//
// @Inject RootStore store;
// @Inject OauthParams oauthParams;
// @Inject UserActionCreator userActionCreator;
//
// @Override
// protected void onCreate(Bundle savedInstanceState) {
// super.onCreate(savedInstanceState);
// setContentView(R.layout.activity_oauth);
// inject();
//
// if (store.getAuthorizedUsers().isEmpty()) {
// CustomTabsIntent intent = new CustomTabsIntent.Builder().build();
// intent.launchUrl(this, Uri.parse(oauthParams.getAuthorizeUri()));
// }
// }
//
// @Override
// protected void onNewIntent(Intent intent) {
// super.onNewIntent(intent);
// inject();
// store.dispatch(userActionCreator.createAuthAction(intent.getDataString()))
// .subscribeOn(Schedulers.io())
// .observeOn(AndroidSchedulers.mainThread())
// .subscribe(
// _a -> returnToMain(),
// this::returnToMain
// );
// }
//
// private void returnToMain() {
// setResult(Activity.RESULT_OK);
// finish();
// }
//
// private void returnToMain(Throwable throwable) {
// setResult(Activity.RESULT_CANCELED);
// finish();
// }
//
// private void inject() {
// Sunazuri.get(this).getComponent().inject(this);
// }
// }
//
// Path: app/src/main/java/info/izumin/android/sunazuri/presentation/fragment/posts/PostsFragment.java
// public class PostsFragment extends Fragment {
//
//
// public PostsFragment() {
// // Required empty public constructor
// }
//
//
// @Override
// public View onCreateView(LayoutInflater inflater, ViewGroup container,
// Bundle savedInstanceState) {
// // Inflate the layout for this fragment
// return inflater.inflate(R.layout.fragment_posts, container, false);
// }
//
// }
| import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import info.izumin.android.sunazuri.R;
import info.izumin.android.sunazuri.RequestCode;
import info.izumin.android.sunazuri.databinding.FragmentWelcomeBinding;
import info.izumin.android.sunazuri.presentation.activity.main.MainContract;
import info.izumin.android.sunazuri.presentation.activity.oauth.OauthActivity;
import info.izumin.android.sunazuri.presentation.fragment.posts.PostsFragment;
import onactivityresult.ActivityResult;
import javax.inject.Inject; | }
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
// Inflate the layout for this fragment
return inflater.inflate(R.layout.fragment_welcome, container, false);
}
@Override
public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
setupComponent();
binding = FragmentWelcomeBinding.bind(view);
binding.setController(controller);
}
@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
ActivityResult.onResult(requestCode, resultCode, data).into(controller);
}
@Override
public void showOauthUi() {
startActivityForResult(new Intent(getActivity(), OauthActivity.class), RequestCode.OAUTH);
}
@Override
public void showPostsUi() { | // Path: app/src/main/java/info/izumin/android/sunazuri/RequestCode.java
// public class RequestCode {
// private RequestCode() {
// throw new AssertionError("constructor of the constants class should not be called");
// }
//
// public static final int OAUTH = 100;
// }
//
// Path: app/src/main/java/info/izumin/android/sunazuri/presentation/activity/main/MainContract.java
// public interface MainContract {
// interface View {
// void setFragment(Fragment fragment);
// Context getActivityContext();
// MainComponent getMainComponent();
// }
// }
//
// Path: app/src/main/java/info/izumin/android/sunazuri/presentation/activity/oauth/OauthActivity.java
// public class OauthActivity extends AppCompatActivity {
// public static final String TAG = OauthActivity.class.getSimpleName();
//
// @Inject RootStore store;
// @Inject OauthParams oauthParams;
// @Inject UserActionCreator userActionCreator;
//
// @Override
// protected void onCreate(Bundle savedInstanceState) {
// super.onCreate(savedInstanceState);
// setContentView(R.layout.activity_oauth);
// inject();
//
// if (store.getAuthorizedUsers().isEmpty()) {
// CustomTabsIntent intent = new CustomTabsIntent.Builder().build();
// intent.launchUrl(this, Uri.parse(oauthParams.getAuthorizeUri()));
// }
// }
//
// @Override
// protected void onNewIntent(Intent intent) {
// super.onNewIntent(intent);
// inject();
// store.dispatch(userActionCreator.createAuthAction(intent.getDataString()))
// .subscribeOn(Schedulers.io())
// .observeOn(AndroidSchedulers.mainThread())
// .subscribe(
// _a -> returnToMain(),
// this::returnToMain
// );
// }
//
// private void returnToMain() {
// setResult(Activity.RESULT_OK);
// finish();
// }
//
// private void returnToMain(Throwable throwable) {
// setResult(Activity.RESULT_CANCELED);
// finish();
// }
//
// private void inject() {
// Sunazuri.get(this).getComponent().inject(this);
// }
// }
//
// Path: app/src/main/java/info/izumin/android/sunazuri/presentation/fragment/posts/PostsFragment.java
// public class PostsFragment extends Fragment {
//
//
// public PostsFragment() {
// // Required empty public constructor
// }
//
//
// @Override
// public View onCreateView(LayoutInflater inflater, ViewGroup container,
// Bundle savedInstanceState) {
// // Inflate the layout for this fragment
// return inflater.inflate(R.layout.fragment_posts, container, false);
// }
//
// }
// Path: app/src/main/java/info/izumin/android/sunazuri/presentation/fragment/welcome/WelcomeFragment.java
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import info.izumin.android.sunazuri.R;
import info.izumin.android.sunazuri.RequestCode;
import info.izumin.android.sunazuri.databinding.FragmentWelcomeBinding;
import info.izumin.android.sunazuri.presentation.activity.main.MainContract;
import info.izumin.android.sunazuri.presentation.activity.oauth.OauthActivity;
import info.izumin.android.sunazuri.presentation.fragment.posts.PostsFragment;
import onactivityresult.ActivityResult;
import javax.inject.Inject;
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
// Inflate the layout for this fragment
return inflater.inflate(R.layout.fragment_welcome, container, false);
}
@Override
public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
setupComponent();
binding = FragmentWelcomeBinding.bind(view);
binding.setController(controller);
}
@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
ActivityResult.onResult(requestCode, resultCode, data).into(controller);
}
@Override
public void showOauthUi() {
startActivityForResult(new Intent(getActivity(), OauthActivity.class), RequestCode.OAUTH);
}
@Override
public void showPostsUi() { | mainView.setFragment(new PostsFragment()); |
izumin5210/Sunazuri | app/src/main/java/info/izumin/android/sunazuri/infrastructure/repository/source/oauth/OauthRepositoryImpl.java | // Path: app/src/main/java/info/izumin/android/sunazuri/domain/entity/AuthorizedUser.java
// public class AuthorizedUser {
// public static final String TAG = AuthorizedUser.class.getSimpleName();
//
// public final long id;
// public final String name;
// public final String screenName;
// public final Date createdAt;
// public final Date updatedAt;
// public final String icon;
// public final String email;
//
// public final AccessToken token;
//
// public AuthorizedUser(long id,
// String name,
// String screenName,
// Date createdAt,
// Date updatedAt,
// String icon,
// String email,
// AccessToken token) {
// this.id = id;
// this.name = name;
// this.screenName = screenName;
// this.createdAt = createdAt;
// this.updatedAt = updatedAt;
// this.icon = icon;
// this.email = email;
// this.token = token;
// }
// }
//
// Path: app/src/main/java/info/izumin/android/sunazuri/domain/repository/OauthRepository.java
// public interface OauthRepository {
// Single<AuthorizedUser> getToken(String code);
// }
| import info.izumin.android.sunazuri.domain.entity.AuthorizedUser;
import info.izumin.android.sunazuri.domain.repository.OauthRepository;
import info.izumin.android.sunazuri.infrastructure.entity.mapper.AuthorizedUserMapper;
import rx.Single;
import javax.inject.Inject;
import javax.inject.Singleton; | package info.izumin.android.sunazuri.infrastructure.repository.source.oauth;
/**
* Created by izumin on 5/13/2016 AD.
*/
@Singleton
class OauthRepositoryImpl implements OauthRepository {
public static final String TAG = OauthRepositoryImpl.class.getSimpleName();
private final OauthDataSourceFactory dataSourceFactory;
private final AuthorizedUserMapper authorizedUserMapper;
@Inject
OauthRepositoryImpl(OauthDataSourceFactory dataSourceFactory,
AuthorizedUserMapper authorizedUserMapper) {
this.dataSourceFactory = dataSourceFactory;
this.authorizedUserMapper = authorizedUserMapper;
}
@Override | // Path: app/src/main/java/info/izumin/android/sunazuri/domain/entity/AuthorizedUser.java
// public class AuthorizedUser {
// public static final String TAG = AuthorizedUser.class.getSimpleName();
//
// public final long id;
// public final String name;
// public final String screenName;
// public final Date createdAt;
// public final Date updatedAt;
// public final String icon;
// public final String email;
//
// public final AccessToken token;
//
// public AuthorizedUser(long id,
// String name,
// String screenName,
// Date createdAt,
// Date updatedAt,
// String icon,
// String email,
// AccessToken token) {
// this.id = id;
// this.name = name;
// this.screenName = screenName;
// this.createdAt = createdAt;
// this.updatedAt = updatedAt;
// this.icon = icon;
// this.email = email;
// this.token = token;
// }
// }
//
// Path: app/src/main/java/info/izumin/android/sunazuri/domain/repository/OauthRepository.java
// public interface OauthRepository {
// Single<AuthorizedUser> getToken(String code);
// }
// Path: app/src/main/java/info/izumin/android/sunazuri/infrastructure/repository/source/oauth/OauthRepositoryImpl.java
import info.izumin.android.sunazuri.domain.entity.AuthorizedUser;
import info.izumin.android.sunazuri.domain.repository.OauthRepository;
import info.izumin.android.sunazuri.infrastructure.entity.mapper.AuthorizedUserMapper;
import rx.Single;
import javax.inject.Inject;
import javax.inject.Singleton;
package info.izumin.android.sunazuri.infrastructure.repository.source.oauth;
/**
* Created by izumin on 5/13/2016 AD.
*/
@Singleton
class OauthRepositoryImpl implements OauthRepository {
public static final String TAG = OauthRepositoryImpl.class.getSimpleName();
private final OauthDataSourceFactory dataSourceFactory;
private final AuthorizedUserMapper authorizedUserMapper;
@Inject
OauthRepositoryImpl(OauthDataSourceFactory dataSourceFactory,
AuthorizedUserMapper authorizedUserMapper) {
this.dataSourceFactory = dataSourceFactory;
this.authorizedUserMapper = authorizedUserMapper;
}
@Override | public Single<AuthorizedUser> getToken(String code) { |
izumin5210/Sunazuri | app/src/main/java/info/izumin/android/sunazuri/infrastructure/repository/source/oauth/OauthRepositoryModule.java | // Path: app/src/main/java/info/izumin/android/sunazuri/domain/repository/OauthRepository.java
// public interface OauthRepository {
// Single<AuthorizedUser> getToken(String code);
// }
| import dagger.Module;
import dagger.Provides;
import info.izumin.android.sunazuri.domain.repository.OauthRepository;
import javax.inject.Singleton; | package info.izumin.android.sunazuri.infrastructure.repository.source.oauth;
/**
* Created by izumin on 5/28/2016 AD.
*/
@Module
public class OauthRepositoryModule {
public static final String TAG = OauthRepositoryModule.class.getSimpleName();
@Provides
@Singleton | // Path: app/src/main/java/info/izumin/android/sunazuri/domain/repository/OauthRepository.java
// public interface OauthRepository {
// Single<AuthorizedUser> getToken(String code);
// }
// Path: app/src/main/java/info/izumin/android/sunazuri/infrastructure/repository/source/oauth/OauthRepositoryModule.java
import dagger.Module;
import dagger.Provides;
import info.izumin.android.sunazuri.domain.repository.OauthRepository;
import javax.inject.Singleton;
package info.izumin.android.sunazuri.infrastructure.repository.source.oauth;
/**
* Created by izumin on 5/28/2016 AD.
*/
@Module
public class OauthRepositoryModule {
public static final String TAG = OauthRepositoryModule.class.getSimpleName();
@Provides
@Singleton | OauthRepository oauthRepository(OauthRepositoryImpl repo) { |
izumin5210/Sunazuri | app/src/main/java/info/izumin/android/sunazuri/infrastructure/repository/UsersRepositoryImpl.java | // Path: app/src/main/java/info/izumin/android/sunazuri/domain/entity/AuthorizedUser.java
// public class AuthorizedUser {
// public static final String TAG = AuthorizedUser.class.getSimpleName();
//
// public final long id;
// public final String name;
// public final String screenName;
// public final Date createdAt;
// public final Date updatedAt;
// public final String icon;
// public final String email;
//
// public final AccessToken token;
//
// public AuthorizedUser(long id,
// String name,
// String screenName,
// Date createdAt,
// Date updatedAt,
// String icon,
// String email,
// AccessToken token) {
// this.id = id;
// this.name = name;
// this.screenName = screenName;
// this.createdAt = createdAt;
// this.updatedAt = updatedAt;
// this.icon = icon;
// this.email = email;
// this.token = token;
// }
// }
//
// Path: app/src/main/java/info/izumin/android/sunazuri/domain/entity/LoginInfo.java
// public class LoginInfo {
// public static final String TAG = LoginInfo.class.getSimpleName();
//
// public final AuthorizedUser user;
// public final Team team;
//
// public LoginInfo(AuthorizedUser user, Team team) {
// this.user = user;
// this.team = team;
// }
// }
//
// Path: app/src/main/java/info/izumin/android/sunazuri/domain/repository/UsersRepository.java
// public interface UsersRepository {
// Observable<AuthorizedUser> getCurrentUser();
// Single<List<AuthorizedUser>> getAuthorizedUsers();
// Observable<LoginInfo> getLoginInfo();
// }
//
// Path: app/src/main/java/info/izumin/android/sunazuri/infrastructure/repository/source/oauth/OauthDataSourceFactory.java
// public interface OauthDataSourceFactory {
// OauthDataSource createLocalDataSource();
// OauthDataSource createRemoteDataSource();
// }
//
// Path: app/src/main/java/info/izumin/android/sunazuri/infrastructure/repository/source/team/TeamsDataSourceFactory.java
// public interface TeamsDataSourceFactory {
// TeamsDataSource createLocalDataSource();
// TeamsDataSource createRemoteDataSource();
// }
| import info.izumin.android.sunazuri.domain.entity.AuthorizedUser;
import info.izumin.android.sunazuri.domain.entity.LoginInfo;
import info.izumin.android.sunazuri.domain.repository.UsersRepository;
import info.izumin.android.sunazuri.infrastructure.entity.mapper.AuthorizedUserMapper;
import info.izumin.android.sunazuri.infrastructure.entity.mapper.TeamMapper;
import info.izumin.android.sunazuri.infrastructure.repository.source.oauth.OauthDataSourceFactory;
import info.izumin.android.sunazuri.infrastructure.repository.source.team.TeamsDataSourceFactory;
import rx.Observable;
import rx.Single;
import javax.inject.Inject;
import javax.inject.Singleton;
import java.util.List; | package info.izumin.android.sunazuri.infrastructure.repository;
/**
* Created by izumin on 5/24/2016 AD.
*/
@Singleton
class UsersRepositoryImpl implements UsersRepository {
public static final String TAG = UsersRepositoryImpl.class.getSimpleName();
| // Path: app/src/main/java/info/izumin/android/sunazuri/domain/entity/AuthorizedUser.java
// public class AuthorizedUser {
// public static final String TAG = AuthorizedUser.class.getSimpleName();
//
// public final long id;
// public final String name;
// public final String screenName;
// public final Date createdAt;
// public final Date updatedAt;
// public final String icon;
// public final String email;
//
// public final AccessToken token;
//
// public AuthorizedUser(long id,
// String name,
// String screenName,
// Date createdAt,
// Date updatedAt,
// String icon,
// String email,
// AccessToken token) {
// this.id = id;
// this.name = name;
// this.screenName = screenName;
// this.createdAt = createdAt;
// this.updatedAt = updatedAt;
// this.icon = icon;
// this.email = email;
// this.token = token;
// }
// }
//
// Path: app/src/main/java/info/izumin/android/sunazuri/domain/entity/LoginInfo.java
// public class LoginInfo {
// public static final String TAG = LoginInfo.class.getSimpleName();
//
// public final AuthorizedUser user;
// public final Team team;
//
// public LoginInfo(AuthorizedUser user, Team team) {
// this.user = user;
// this.team = team;
// }
// }
//
// Path: app/src/main/java/info/izumin/android/sunazuri/domain/repository/UsersRepository.java
// public interface UsersRepository {
// Observable<AuthorizedUser> getCurrentUser();
// Single<List<AuthorizedUser>> getAuthorizedUsers();
// Observable<LoginInfo> getLoginInfo();
// }
//
// Path: app/src/main/java/info/izumin/android/sunazuri/infrastructure/repository/source/oauth/OauthDataSourceFactory.java
// public interface OauthDataSourceFactory {
// OauthDataSource createLocalDataSource();
// OauthDataSource createRemoteDataSource();
// }
//
// Path: app/src/main/java/info/izumin/android/sunazuri/infrastructure/repository/source/team/TeamsDataSourceFactory.java
// public interface TeamsDataSourceFactory {
// TeamsDataSource createLocalDataSource();
// TeamsDataSource createRemoteDataSource();
// }
// Path: app/src/main/java/info/izumin/android/sunazuri/infrastructure/repository/UsersRepositoryImpl.java
import info.izumin.android.sunazuri.domain.entity.AuthorizedUser;
import info.izumin.android.sunazuri.domain.entity.LoginInfo;
import info.izumin.android.sunazuri.domain.repository.UsersRepository;
import info.izumin.android.sunazuri.infrastructure.entity.mapper.AuthorizedUserMapper;
import info.izumin.android.sunazuri.infrastructure.entity.mapper.TeamMapper;
import info.izumin.android.sunazuri.infrastructure.repository.source.oauth.OauthDataSourceFactory;
import info.izumin.android.sunazuri.infrastructure.repository.source.team.TeamsDataSourceFactory;
import rx.Observable;
import rx.Single;
import javax.inject.Inject;
import javax.inject.Singleton;
import java.util.List;
package info.izumin.android.sunazuri.infrastructure.repository;
/**
* Created by izumin on 5/24/2016 AD.
*/
@Singleton
class UsersRepositoryImpl implements UsersRepository {
public static final String TAG = UsersRepositoryImpl.class.getSimpleName();
| private final OauthDataSourceFactory oauthDataSourceFactory; |
izumin5210/Sunazuri | app/src/main/java/info/izumin/android/sunazuri/infrastructure/repository/UsersRepositoryImpl.java | // Path: app/src/main/java/info/izumin/android/sunazuri/domain/entity/AuthorizedUser.java
// public class AuthorizedUser {
// public static final String TAG = AuthorizedUser.class.getSimpleName();
//
// public final long id;
// public final String name;
// public final String screenName;
// public final Date createdAt;
// public final Date updatedAt;
// public final String icon;
// public final String email;
//
// public final AccessToken token;
//
// public AuthorizedUser(long id,
// String name,
// String screenName,
// Date createdAt,
// Date updatedAt,
// String icon,
// String email,
// AccessToken token) {
// this.id = id;
// this.name = name;
// this.screenName = screenName;
// this.createdAt = createdAt;
// this.updatedAt = updatedAt;
// this.icon = icon;
// this.email = email;
// this.token = token;
// }
// }
//
// Path: app/src/main/java/info/izumin/android/sunazuri/domain/entity/LoginInfo.java
// public class LoginInfo {
// public static final String TAG = LoginInfo.class.getSimpleName();
//
// public final AuthorizedUser user;
// public final Team team;
//
// public LoginInfo(AuthorizedUser user, Team team) {
// this.user = user;
// this.team = team;
// }
// }
//
// Path: app/src/main/java/info/izumin/android/sunazuri/domain/repository/UsersRepository.java
// public interface UsersRepository {
// Observable<AuthorizedUser> getCurrentUser();
// Single<List<AuthorizedUser>> getAuthorizedUsers();
// Observable<LoginInfo> getLoginInfo();
// }
//
// Path: app/src/main/java/info/izumin/android/sunazuri/infrastructure/repository/source/oauth/OauthDataSourceFactory.java
// public interface OauthDataSourceFactory {
// OauthDataSource createLocalDataSource();
// OauthDataSource createRemoteDataSource();
// }
//
// Path: app/src/main/java/info/izumin/android/sunazuri/infrastructure/repository/source/team/TeamsDataSourceFactory.java
// public interface TeamsDataSourceFactory {
// TeamsDataSource createLocalDataSource();
// TeamsDataSource createRemoteDataSource();
// }
| import info.izumin.android.sunazuri.domain.entity.AuthorizedUser;
import info.izumin.android.sunazuri.domain.entity.LoginInfo;
import info.izumin.android.sunazuri.domain.repository.UsersRepository;
import info.izumin.android.sunazuri.infrastructure.entity.mapper.AuthorizedUserMapper;
import info.izumin.android.sunazuri.infrastructure.entity.mapper.TeamMapper;
import info.izumin.android.sunazuri.infrastructure.repository.source.oauth.OauthDataSourceFactory;
import info.izumin.android.sunazuri.infrastructure.repository.source.team.TeamsDataSourceFactory;
import rx.Observable;
import rx.Single;
import javax.inject.Inject;
import javax.inject.Singleton;
import java.util.List; | package info.izumin.android.sunazuri.infrastructure.repository;
/**
* Created by izumin on 5/24/2016 AD.
*/
@Singleton
class UsersRepositoryImpl implements UsersRepository {
public static final String TAG = UsersRepositoryImpl.class.getSimpleName();
private final OauthDataSourceFactory oauthDataSourceFactory; | // Path: app/src/main/java/info/izumin/android/sunazuri/domain/entity/AuthorizedUser.java
// public class AuthorizedUser {
// public static final String TAG = AuthorizedUser.class.getSimpleName();
//
// public final long id;
// public final String name;
// public final String screenName;
// public final Date createdAt;
// public final Date updatedAt;
// public final String icon;
// public final String email;
//
// public final AccessToken token;
//
// public AuthorizedUser(long id,
// String name,
// String screenName,
// Date createdAt,
// Date updatedAt,
// String icon,
// String email,
// AccessToken token) {
// this.id = id;
// this.name = name;
// this.screenName = screenName;
// this.createdAt = createdAt;
// this.updatedAt = updatedAt;
// this.icon = icon;
// this.email = email;
// this.token = token;
// }
// }
//
// Path: app/src/main/java/info/izumin/android/sunazuri/domain/entity/LoginInfo.java
// public class LoginInfo {
// public static final String TAG = LoginInfo.class.getSimpleName();
//
// public final AuthorizedUser user;
// public final Team team;
//
// public LoginInfo(AuthorizedUser user, Team team) {
// this.user = user;
// this.team = team;
// }
// }
//
// Path: app/src/main/java/info/izumin/android/sunazuri/domain/repository/UsersRepository.java
// public interface UsersRepository {
// Observable<AuthorizedUser> getCurrentUser();
// Single<List<AuthorizedUser>> getAuthorizedUsers();
// Observable<LoginInfo> getLoginInfo();
// }
//
// Path: app/src/main/java/info/izumin/android/sunazuri/infrastructure/repository/source/oauth/OauthDataSourceFactory.java
// public interface OauthDataSourceFactory {
// OauthDataSource createLocalDataSource();
// OauthDataSource createRemoteDataSource();
// }
//
// Path: app/src/main/java/info/izumin/android/sunazuri/infrastructure/repository/source/team/TeamsDataSourceFactory.java
// public interface TeamsDataSourceFactory {
// TeamsDataSource createLocalDataSource();
// TeamsDataSource createRemoteDataSource();
// }
// Path: app/src/main/java/info/izumin/android/sunazuri/infrastructure/repository/UsersRepositoryImpl.java
import info.izumin.android.sunazuri.domain.entity.AuthorizedUser;
import info.izumin.android.sunazuri.domain.entity.LoginInfo;
import info.izumin.android.sunazuri.domain.repository.UsersRepository;
import info.izumin.android.sunazuri.infrastructure.entity.mapper.AuthorizedUserMapper;
import info.izumin.android.sunazuri.infrastructure.entity.mapper.TeamMapper;
import info.izumin.android.sunazuri.infrastructure.repository.source.oauth.OauthDataSourceFactory;
import info.izumin.android.sunazuri.infrastructure.repository.source.team.TeamsDataSourceFactory;
import rx.Observable;
import rx.Single;
import javax.inject.Inject;
import javax.inject.Singleton;
import java.util.List;
package info.izumin.android.sunazuri.infrastructure.repository;
/**
* Created by izumin on 5/24/2016 AD.
*/
@Singleton
class UsersRepositoryImpl implements UsersRepository {
public static final String TAG = UsersRepositoryImpl.class.getSimpleName();
private final OauthDataSourceFactory oauthDataSourceFactory; | private final TeamsDataSourceFactory teamsDataSourceFactory; |
izumin5210/Sunazuri | app/src/main/java/info/izumin/android/sunazuri/infrastructure/repository/UsersRepositoryImpl.java | // Path: app/src/main/java/info/izumin/android/sunazuri/domain/entity/AuthorizedUser.java
// public class AuthorizedUser {
// public static final String TAG = AuthorizedUser.class.getSimpleName();
//
// public final long id;
// public final String name;
// public final String screenName;
// public final Date createdAt;
// public final Date updatedAt;
// public final String icon;
// public final String email;
//
// public final AccessToken token;
//
// public AuthorizedUser(long id,
// String name,
// String screenName,
// Date createdAt,
// Date updatedAt,
// String icon,
// String email,
// AccessToken token) {
// this.id = id;
// this.name = name;
// this.screenName = screenName;
// this.createdAt = createdAt;
// this.updatedAt = updatedAt;
// this.icon = icon;
// this.email = email;
// this.token = token;
// }
// }
//
// Path: app/src/main/java/info/izumin/android/sunazuri/domain/entity/LoginInfo.java
// public class LoginInfo {
// public static final String TAG = LoginInfo.class.getSimpleName();
//
// public final AuthorizedUser user;
// public final Team team;
//
// public LoginInfo(AuthorizedUser user, Team team) {
// this.user = user;
// this.team = team;
// }
// }
//
// Path: app/src/main/java/info/izumin/android/sunazuri/domain/repository/UsersRepository.java
// public interface UsersRepository {
// Observable<AuthorizedUser> getCurrentUser();
// Single<List<AuthorizedUser>> getAuthorizedUsers();
// Observable<LoginInfo> getLoginInfo();
// }
//
// Path: app/src/main/java/info/izumin/android/sunazuri/infrastructure/repository/source/oauth/OauthDataSourceFactory.java
// public interface OauthDataSourceFactory {
// OauthDataSource createLocalDataSource();
// OauthDataSource createRemoteDataSource();
// }
//
// Path: app/src/main/java/info/izumin/android/sunazuri/infrastructure/repository/source/team/TeamsDataSourceFactory.java
// public interface TeamsDataSourceFactory {
// TeamsDataSource createLocalDataSource();
// TeamsDataSource createRemoteDataSource();
// }
| import info.izumin.android.sunazuri.domain.entity.AuthorizedUser;
import info.izumin.android.sunazuri.domain.entity.LoginInfo;
import info.izumin.android.sunazuri.domain.repository.UsersRepository;
import info.izumin.android.sunazuri.infrastructure.entity.mapper.AuthorizedUserMapper;
import info.izumin.android.sunazuri.infrastructure.entity.mapper.TeamMapper;
import info.izumin.android.sunazuri.infrastructure.repository.source.oauth.OauthDataSourceFactory;
import info.izumin.android.sunazuri.infrastructure.repository.source.team.TeamsDataSourceFactory;
import rx.Observable;
import rx.Single;
import javax.inject.Inject;
import javax.inject.Singleton;
import java.util.List; | package info.izumin.android.sunazuri.infrastructure.repository;
/**
* Created by izumin on 5/24/2016 AD.
*/
@Singleton
class UsersRepositoryImpl implements UsersRepository {
public static final String TAG = UsersRepositoryImpl.class.getSimpleName();
private final OauthDataSourceFactory oauthDataSourceFactory;
private final TeamsDataSourceFactory teamsDataSourceFactory;
private final AuthorizedUserMapper authorizedUserMapper;
private final TeamMapper teamMapper;
@Inject
UsersRepositoryImpl(OauthDataSourceFactory oauthDataSourceFactory,
TeamsDataSourceFactory teamsDataSourceFactory,
AuthorizedUserMapper authorizedUserMapper,
TeamMapper teamMapper) {
this.oauthDataSourceFactory = oauthDataSourceFactory;
this.teamsDataSourceFactory = teamsDataSourceFactory;
this.authorizedUserMapper = authorizedUserMapper;
this.teamMapper = teamMapper;
}
@Override | // Path: app/src/main/java/info/izumin/android/sunazuri/domain/entity/AuthorizedUser.java
// public class AuthorizedUser {
// public static final String TAG = AuthorizedUser.class.getSimpleName();
//
// public final long id;
// public final String name;
// public final String screenName;
// public final Date createdAt;
// public final Date updatedAt;
// public final String icon;
// public final String email;
//
// public final AccessToken token;
//
// public AuthorizedUser(long id,
// String name,
// String screenName,
// Date createdAt,
// Date updatedAt,
// String icon,
// String email,
// AccessToken token) {
// this.id = id;
// this.name = name;
// this.screenName = screenName;
// this.createdAt = createdAt;
// this.updatedAt = updatedAt;
// this.icon = icon;
// this.email = email;
// this.token = token;
// }
// }
//
// Path: app/src/main/java/info/izumin/android/sunazuri/domain/entity/LoginInfo.java
// public class LoginInfo {
// public static final String TAG = LoginInfo.class.getSimpleName();
//
// public final AuthorizedUser user;
// public final Team team;
//
// public LoginInfo(AuthorizedUser user, Team team) {
// this.user = user;
// this.team = team;
// }
// }
//
// Path: app/src/main/java/info/izumin/android/sunazuri/domain/repository/UsersRepository.java
// public interface UsersRepository {
// Observable<AuthorizedUser> getCurrentUser();
// Single<List<AuthorizedUser>> getAuthorizedUsers();
// Observable<LoginInfo> getLoginInfo();
// }
//
// Path: app/src/main/java/info/izumin/android/sunazuri/infrastructure/repository/source/oauth/OauthDataSourceFactory.java
// public interface OauthDataSourceFactory {
// OauthDataSource createLocalDataSource();
// OauthDataSource createRemoteDataSource();
// }
//
// Path: app/src/main/java/info/izumin/android/sunazuri/infrastructure/repository/source/team/TeamsDataSourceFactory.java
// public interface TeamsDataSourceFactory {
// TeamsDataSource createLocalDataSource();
// TeamsDataSource createRemoteDataSource();
// }
// Path: app/src/main/java/info/izumin/android/sunazuri/infrastructure/repository/UsersRepositoryImpl.java
import info.izumin.android.sunazuri.domain.entity.AuthorizedUser;
import info.izumin.android.sunazuri.domain.entity.LoginInfo;
import info.izumin.android.sunazuri.domain.repository.UsersRepository;
import info.izumin.android.sunazuri.infrastructure.entity.mapper.AuthorizedUserMapper;
import info.izumin.android.sunazuri.infrastructure.entity.mapper.TeamMapper;
import info.izumin.android.sunazuri.infrastructure.repository.source.oauth.OauthDataSourceFactory;
import info.izumin.android.sunazuri.infrastructure.repository.source.team.TeamsDataSourceFactory;
import rx.Observable;
import rx.Single;
import javax.inject.Inject;
import javax.inject.Singleton;
import java.util.List;
package info.izumin.android.sunazuri.infrastructure.repository;
/**
* Created by izumin on 5/24/2016 AD.
*/
@Singleton
class UsersRepositoryImpl implements UsersRepository {
public static final String TAG = UsersRepositoryImpl.class.getSimpleName();
private final OauthDataSourceFactory oauthDataSourceFactory;
private final TeamsDataSourceFactory teamsDataSourceFactory;
private final AuthorizedUserMapper authorizedUserMapper;
private final TeamMapper teamMapper;
@Inject
UsersRepositoryImpl(OauthDataSourceFactory oauthDataSourceFactory,
TeamsDataSourceFactory teamsDataSourceFactory,
AuthorizedUserMapper authorizedUserMapper,
TeamMapper teamMapper) {
this.oauthDataSourceFactory = oauthDataSourceFactory;
this.teamsDataSourceFactory = teamsDataSourceFactory;
this.authorizedUserMapper = authorizedUserMapper;
this.teamMapper = teamMapper;
}
@Override | public Observable<AuthorizedUser> getCurrentUser() { |
izumin5210/Sunazuri | app/src/main/java/info/izumin/android/sunazuri/infrastructure/repository/UsersRepositoryImpl.java | // Path: app/src/main/java/info/izumin/android/sunazuri/domain/entity/AuthorizedUser.java
// public class AuthorizedUser {
// public static final String TAG = AuthorizedUser.class.getSimpleName();
//
// public final long id;
// public final String name;
// public final String screenName;
// public final Date createdAt;
// public final Date updatedAt;
// public final String icon;
// public final String email;
//
// public final AccessToken token;
//
// public AuthorizedUser(long id,
// String name,
// String screenName,
// Date createdAt,
// Date updatedAt,
// String icon,
// String email,
// AccessToken token) {
// this.id = id;
// this.name = name;
// this.screenName = screenName;
// this.createdAt = createdAt;
// this.updatedAt = updatedAt;
// this.icon = icon;
// this.email = email;
// this.token = token;
// }
// }
//
// Path: app/src/main/java/info/izumin/android/sunazuri/domain/entity/LoginInfo.java
// public class LoginInfo {
// public static final String TAG = LoginInfo.class.getSimpleName();
//
// public final AuthorizedUser user;
// public final Team team;
//
// public LoginInfo(AuthorizedUser user, Team team) {
// this.user = user;
// this.team = team;
// }
// }
//
// Path: app/src/main/java/info/izumin/android/sunazuri/domain/repository/UsersRepository.java
// public interface UsersRepository {
// Observable<AuthorizedUser> getCurrentUser();
// Single<List<AuthorizedUser>> getAuthorizedUsers();
// Observable<LoginInfo> getLoginInfo();
// }
//
// Path: app/src/main/java/info/izumin/android/sunazuri/infrastructure/repository/source/oauth/OauthDataSourceFactory.java
// public interface OauthDataSourceFactory {
// OauthDataSource createLocalDataSource();
// OauthDataSource createRemoteDataSource();
// }
//
// Path: app/src/main/java/info/izumin/android/sunazuri/infrastructure/repository/source/team/TeamsDataSourceFactory.java
// public interface TeamsDataSourceFactory {
// TeamsDataSource createLocalDataSource();
// TeamsDataSource createRemoteDataSource();
// }
| import info.izumin.android.sunazuri.domain.entity.AuthorizedUser;
import info.izumin.android.sunazuri.domain.entity.LoginInfo;
import info.izumin.android.sunazuri.domain.repository.UsersRepository;
import info.izumin.android.sunazuri.infrastructure.entity.mapper.AuthorizedUserMapper;
import info.izumin.android.sunazuri.infrastructure.entity.mapper.TeamMapper;
import info.izumin.android.sunazuri.infrastructure.repository.source.oauth.OauthDataSourceFactory;
import info.izumin.android.sunazuri.infrastructure.repository.source.team.TeamsDataSourceFactory;
import rx.Observable;
import rx.Single;
import javax.inject.Inject;
import javax.inject.Singleton;
import java.util.List; | private final TeamsDataSourceFactory teamsDataSourceFactory;
private final AuthorizedUserMapper authorizedUserMapper;
private final TeamMapper teamMapper;
@Inject
UsersRepositoryImpl(OauthDataSourceFactory oauthDataSourceFactory,
TeamsDataSourceFactory teamsDataSourceFactory,
AuthorizedUserMapper authorizedUserMapper,
TeamMapper teamMapper) {
this.oauthDataSourceFactory = oauthDataSourceFactory;
this.teamsDataSourceFactory = teamsDataSourceFactory;
this.authorizedUserMapper = authorizedUserMapper;
this.teamMapper = teamMapper;
}
@Override
public Observable<AuthorizedUser> getCurrentUser() {
return oauthDataSourceFactory.createLocalDataSource()
.getCurrentToken()
.map(authorizedUserMapper::transform);
}
@Override
public Single<List<AuthorizedUser>> getAuthorizedUsers() {
return oauthDataSourceFactory.createLocalDataSource()
.getTokens()
.map(authorizedUserMapper::transform);
}
@Override | // Path: app/src/main/java/info/izumin/android/sunazuri/domain/entity/AuthorizedUser.java
// public class AuthorizedUser {
// public static final String TAG = AuthorizedUser.class.getSimpleName();
//
// public final long id;
// public final String name;
// public final String screenName;
// public final Date createdAt;
// public final Date updatedAt;
// public final String icon;
// public final String email;
//
// public final AccessToken token;
//
// public AuthorizedUser(long id,
// String name,
// String screenName,
// Date createdAt,
// Date updatedAt,
// String icon,
// String email,
// AccessToken token) {
// this.id = id;
// this.name = name;
// this.screenName = screenName;
// this.createdAt = createdAt;
// this.updatedAt = updatedAt;
// this.icon = icon;
// this.email = email;
// this.token = token;
// }
// }
//
// Path: app/src/main/java/info/izumin/android/sunazuri/domain/entity/LoginInfo.java
// public class LoginInfo {
// public static final String TAG = LoginInfo.class.getSimpleName();
//
// public final AuthorizedUser user;
// public final Team team;
//
// public LoginInfo(AuthorizedUser user, Team team) {
// this.user = user;
// this.team = team;
// }
// }
//
// Path: app/src/main/java/info/izumin/android/sunazuri/domain/repository/UsersRepository.java
// public interface UsersRepository {
// Observable<AuthorizedUser> getCurrentUser();
// Single<List<AuthorizedUser>> getAuthorizedUsers();
// Observable<LoginInfo> getLoginInfo();
// }
//
// Path: app/src/main/java/info/izumin/android/sunazuri/infrastructure/repository/source/oauth/OauthDataSourceFactory.java
// public interface OauthDataSourceFactory {
// OauthDataSource createLocalDataSource();
// OauthDataSource createRemoteDataSource();
// }
//
// Path: app/src/main/java/info/izumin/android/sunazuri/infrastructure/repository/source/team/TeamsDataSourceFactory.java
// public interface TeamsDataSourceFactory {
// TeamsDataSource createLocalDataSource();
// TeamsDataSource createRemoteDataSource();
// }
// Path: app/src/main/java/info/izumin/android/sunazuri/infrastructure/repository/UsersRepositoryImpl.java
import info.izumin.android.sunazuri.domain.entity.AuthorizedUser;
import info.izumin.android.sunazuri.domain.entity.LoginInfo;
import info.izumin.android.sunazuri.domain.repository.UsersRepository;
import info.izumin.android.sunazuri.infrastructure.entity.mapper.AuthorizedUserMapper;
import info.izumin.android.sunazuri.infrastructure.entity.mapper.TeamMapper;
import info.izumin.android.sunazuri.infrastructure.repository.source.oauth.OauthDataSourceFactory;
import info.izumin.android.sunazuri.infrastructure.repository.source.team.TeamsDataSourceFactory;
import rx.Observable;
import rx.Single;
import javax.inject.Inject;
import javax.inject.Singleton;
import java.util.List;
private final TeamsDataSourceFactory teamsDataSourceFactory;
private final AuthorizedUserMapper authorizedUserMapper;
private final TeamMapper teamMapper;
@Inject
UsersRepositoryImpl(OauthDataSourceFactory oauthDataSourceFactory,
TeamsDataSourceFactory teamsDataSourceFactory,
AuthorizedUserMapper authorizedUserMapper,
TeamMapper teamMapper) {
this.oauthDataSourceFactory = oauthDataSourceFactory;
this.teamsDataSourceFactory = teamsDataSourceFactory;
this.authorizedUserMapper = authorizedUserMapper;
this.teamMapper = teamMapper;
}
@Override
public Observable<AuthorizedUser> getCurrentUser() {
return oauthDataSourceFactory.createLocalDataSource()
.getCurrentToken()
.map(authorizedUserMapper::transform);
}
@Override
public Single<List<AuthorizedUser>> getAuthorizedUsers() {
return oauthDataSourceFactory.createLocalDataSource()
.getTokens()
.map(authorizedUserMapper::transform);
}
@Override | public Observable<LoginInfo> getLoginInfo() { |
groovy/gmaven | groovy-maven-plugin/src/test/java/org/codehaus/gmaven/plugin/ClassSourceFactoryTest.java | // Path: gmaven-adapter-api/src/main/java/org/codehaus/gmaven/adapter/ClassSource.java
// @SuppressWarnings("JavadocReference")
// public interface ClassSource
// {
// URL getUrl();
//
// File getFile();
//
// interface Inline
// {
// String getName();
//
// String getCodeBase();
//
// Reader getInput();
// }
//
// Inline getInline();
// }
| import java.io.File;
import java.net.URL;
import org.sonatype.sisu.litmus.testsupport.TestSupport;
import org.codehaus.gmaven.adapter.ClassSource;
import org.junit.Before;
import org.junit.Test;
import static org.hamcrest.Matchers.is;
import static org.hamcrest.Matchers.notNullValue;
import static org.hamcrest.Matchers.nullValue;
import static org.junit.Assert.assertThat; | /*
* Copyright (c) 2006-present the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.codehaus.gmaven.plugin;
/**
* Tests for {@link ClassSourceFactory}.
*/
public class ClassSourceFactoryTest
extends TestSupport
{
private ClassSourceFactory underTest;
@Before
public void setUp() throws Exception {
underTest = new ClassSourceFactory();
}
private String whitespace(final String text) {
return "\n\t " + text + "\n\t ";
}
private void assertUrl(final String url) throws Exception { | // Path: gmaven-adapter-api/src/main/java/org/codehaus/gmaven/adapter/ClassSource.java
// @SuppressWarnings("JavadocReference")
// public interface ClassSource
// {
// URL getUrl();
//
// File getFile();
//
// interface Inline
// {
// String getName();
//
// String getCodeBase();
//
// Reader getInput();
// }
//
// Inline getInline();
// }
// Path: groovy-maven-plugin/src/test/java/org/codehaus/gmaven/plugin/ClassSourceFactoryTest.java
import java.io.File;
import java.net.URL;
import org.sonatype.sisu.litmus.testsupport.TestSupport;
import org.codehaus.gmaven.adapter.ClassSource;
import org.junit.Before;
import org.junit.Test;
import static org.hamcrest.Matchers.is;
import static org.hamcrest.Matchers.notNullValue;
import static org.hamcrest.Matchers.nullValue;
import static org.junit.Assert.assertThat;
/*
* Copyright (c) 2006-present the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.codehaus.gmaven.plugin;
/**
* Tests for {@link ClassSourceFactory}.
*/
public class ClassSourceFactoryTest
extends TestSupport
{
private ClassSourceFactory underTest;
@Before
public void setUp() throws Exception {
underTest = new ClassSourceFactory();
}
private String whitespace(final String text) {
return "\n\t " + text + "\n\t ";
}
private void assertUrl(final String url) throws Exception { | ClassSource source = underTest.create(url); |
groovy/gmaven | groovy-maven-plugin/src/main/java/org/codehaus/gmaven/plugin/MojoResourceLoader.java | // Path: gmaven-adapter-api/src/main/java/org/codehaus/gmaven/adapter/ClassSource.java
// @SuppressWarnings("JavadocReference")
// public interface ClassSource
// {
// URL getUrl();
//
// File getFile();
//
// interface Inline
// {
// String getName();
//
// String getCodeBase();
//
// Reader getInput();
// }
//
// Inline getInline();
// }
//
// Path: gmaven-adapter-api/src/main/java/org/codehaus/gmaven/adapter/ResourceLoader.java
// @SuppressWarnings("JavadocReference")
// public interface ResourceLoader
// {
// @Nullable
// URL loadResource(String name) throws MalformedURLException;
// }
| import java.io.File;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.List;
import javax.annotation.Nullable;
import org.codehaus.gmaven.adapter.ClassSource;
import org.codehaus.gmaven.adapter.ResourceLoader; | /*
* Copyright (c) 2006-present the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.codehaus.gmaven.plugin;
/**
* Mojo {@link ResourceLoader}.
*
* @since 2.0
*/
public class MojoResourceLoader
extends BasicResourceLoader
{ | // Path: gmaven-adapter-api/src/main/java/org/codehaus/gmaven/adapter/ClassSource.java
// @SuppressWarnings("JavadocReference")
// public interface ClassSource
// {
// URL getUrl();
//
// File getFile();
//
// interface Inline
// {
// String getName();
//
// String getCodeBase();
//
// Reader getInput();
// }
//
// Inline getInline();
// }
//
// Path: gmaven-adapter-api/src/main/java/org/codehaus/gmaven/adapter/ResourceLoader.java
// @SuppressWarnings("JavadocReference")
// public interface ResourceLoader
// {
// @Nullable
// URL loadResource(String name) throws MalformedURLException;
// }
// Path: groovy-maven-plugin/src/main/java/org/codehaus/gmaven/plugin/MojoResourceLoader.java
import java.io.File;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.List;
import javax.annotation.Nullable;
import org.codehaus.gmaven.adapter.ClassSource;
import org.codehaus.gmaven.adapter.ResourceLoader;
/*
* Copyright (c) 2006-present the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.codehaus.gmaven.plugin;
/**
* Mojo {@link ResourceLoader}.
*
* @since 2.0
*/
public class MojoResourceLoader
extends BasicResourceLoader
{ | private final ClassSource classSource; |
groovy/gmaven | gmaven-testsuite/src/test/java/org/codehaus/gmaven/testsuite/suite/SuiteSupport.java | // Path: gmaven-testsuite/src/test/java/org/codehaus/gmaven/testsuite/tests/ExecuteBasics.java
// public class ExecuteBasics
// extends ITSupport
// {
// private MavenVerifier executeScript(final String source) throws Exception {
// return verifier("execute-script")
// .setProperty("source", source)
// .executeGoal(goal("execute"));
// }
//
// private MavenVerifier executeScriptFileName(final String fileName) throws Exception {
// return executeScript(new File(testIndex.getDirectory(), fileName).getAbsolutePath());
// }
//
// /**
// * Verifies all default context variables.
// */
// @Test
// public void defaultContext() throws Exception {
// executeScriptFileName("defaultContext.groovy")
// .errorFree()
// .logContains("ALL OK");
// }
//
// /**
// * Verify configured groovy runtime version matches what is detected.
// */
// @Test
// public void groovyVersion() throws Exception {
// executeScriptFileName("groovyVersion.groovy")
// .errorFree()
// .logContains(
// "Version: " + getGroovyVersion(),
// "ALL OK"
// );
// }
//
// /**
// * Verify execution of a simple inline-source script.
// */
// @Test
// public void simpleInlineSource() throws Exception {
// executeScript("println(12345+1)")
// .errorFree()
// .logContains("12346");
// }
//
// /**
// * Verify execution of a simple file-source script.
// */
// @Test
// public void simpleFileSource() throws Exception {
// File file = new File(testIndex.getDirectory(), "simple.groovy");
// executeScript(file.getAbsolutePath())
// .errorFree()
// .logContains("ALL OK");
// }
//
// /**
// * Verify execution of a simple url-source script.
// */
// @Test
// public void simpleUrlSource() throws Exception {
// URL url = new File(testIndex.getDirectory(), "simple.groovy").toURI().toURL();
// executeScript(url.toExternalForm())
// .errorFree()
// .logContains("ALL OK");
// }
// }
//
// Path: gmaven-testsuite/src/test/java/org/codehaus/gmaven/testsuite/tests/PropertyResolution.java
// public class PropertyResolution
// extends ITSupport
// {
// private MavenVerifier verifier() throws Exception {
// return verifier("property-resolution")
// .setProperty("source", "printResult.groovy")
// .addProfile(testName.getMethodName());
// }
//
// private void verify(final MavenVerifier verifier) throws Exception {
// verifier
// .errorFree()
// .logContains(
// "RESULT: OK",
// "ALL OK"
// );
// }
//
// private void verifyDefault() throws Exception {
// verify(
// verifier()
// .executeGoal(goal("execute"))
// );
// }
//
// @Test
// public void projectDefined() throws Exception {
// verifyDefault();
// }
//
// @Test
// public void defaultDefined() throws Exception {
// verifyDefault();
// }
//
// @Test
// public void defaultReferencesProjectProperty() throws Exception {
// verifyDefault();
// }
//
// @Test
// public void defaultReferencesSystemProperty() throws Exception {
// verify(
// verifier()
// .setProperty("foo", "OK")
// .executeGoal(goal("execute"))
// );
// }
//
// @Test
// public void overrideDefined() throws Exception {
// verifyDefault();
// }
//
// @Test
// public void overrideReferencesSystemProperty() throws Exception {
// verify(
// verifier()
// .setProperty("foo", "OK")
// .executeGoal(goal("execute"))
// );
// }
//
// @Test
// @Ignore("FIXME: This test has issues due to Maven interpolation before execution")
// public void overrideReferencesDefault() throws Exception {
// verifyDefault();
// }
// }
| import org.codehaus.gmaven.testsuite.tests.ExecuteBasics;
import org.codehaus.gmaven.testsuite.tests.PropertyResolution;
import org.junit.runners.Suite.SuiteClasses; | /*
* Copyright (c) 2006-present the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.codehaus.gmaven.testsuite.suite;
/**
* Support for suites.
*/
@SuiteClasses({
ExecuteBasics.class, | // Path: gmaven-testsuite/src/test/java/org/codehaus/gmaven/testsuite/tests/ExecuteBasics.java
// public class ExecuteBasics
// extends ITSupport
// {
// private MavenVerifier executeScript(final String source) throws Exception {
// return verifier("execute-script")
// .setProperty("source", source)
// .executeGoal(goal("execute"));
// }
//
// private MavenVerifier executeScriptFileName(final String fileName) throws Exception {
// return executeScript(new File(testIndex.getDirectory(), fileName).getAbsolutePath());
// }
//
// /**
// * Verifies all default context variables.
// */
// @Test
// public void defaultContext() throws Exception {
// executeScriptFileName("defaultContext.groovy")
// .errorFree()
// .logContains("ALL OK");
// }
//
// /**
// * Verify configured groovy runtime version matches what is detected.
// */
// @Test
// public void groovyVersion() throws Exception {
// executeScriptFileName("groovyVersion.groovy")
// .errorFree()
// .logContains(
// "Version: " + getGroovyVersion(),
// "ALL OK"
// );
// }
//
// /**
// * Verify execution of a simple inline-source script.
// */
// @Test
// public void simpleInlineSource() throws Exception {
// executeScript("println(12345+1)")
// .errorFree()
// .logContains("12346");
// }
//
// /**
// * Verify execution of a simple file-source script.
// */
// @Test
// public void simpleFileSource() throws Exception {
// File file = new File(testIndex.getDirectory(), "simple.groovy");
// executeScript(file.getAbsolutePath())
// .errorFree()
// .logContains("ALL OK");
// }
//
// /**
// * Verify execution of a simple url-source script.
// */
// @Test
// public void simpleUrlSource() throws Exception {
// URL url = new File(testIndex.getDirectory(), "simple.groovy").toURI().toURL();
// executeScript(url.toExternalForm())
// .errorFree()
// .logContains("ALL OK");
// }
// }
//
// Path: gmaven-testsuite/src/test/java/org/codehaus/gmaven/testsuite/tests/PropertyResolution.java
// public class PropertyResolution
// extends ITSupport
// {
// private MavenVerifier verifier() throws Exception {
// return verifier("property-resolution")
// .setProperty("source", "printResult.groovy")
// .addProfile(testName.getMethodName());
// }
//
// private void verify(final MavenVerifier verifier) throws Exception {
// verifier
// .errorFree()
// .logContains(
// "RESULT: OK",
// "ALL OK"
// );
// }
//
// private void verifyDefault() throws Exception {
// verify(
// verifier()
// .executeGoal(goal("execute"))
// );
// }
//
// @Test
// public void projectDefined() throws Exception {
// verifyDefault();
// }
//
// @Test
// public void defaultDefined() throws Exception {
// verifyDefault();
// }
//
// @Test
// public void defaultReferencesProjectProperty() throws Exception {
// verifyDefault();
// }
//
// @Test
// public void defaultReferencesSystemProperty() throws Exception {
// verify(
// verifier()
// .setProperty("foo", "OK")
// .executeGoal(goal("execute"))
// );
// }
//
// @Test
// public void overrideDefined() throws Exception {
// verifyDefault();
// }
//
// @Test
// public void overrideReferencesSystemProperty() throws Exception {
// verify(
// verifier()
// .setProperty("foo", "OK")
// .executeGoal(goal("execute"))
// );
// }
//
// @Test
// @Ignore("FIXME: This test has issues due to Maven interpolation before execution")
// public void overrideReferencesDefault() throws Exception {
// verifyDefault();
// }
// }
// Path: gmaven-testsuite/src/test/java/org/codehaus/gmaven/testsuite/suite/SuiteSupport.java
import org.codehaus.gmaven.testsuite.tests.ExecuteBasics;
import org.codehaus.gmaven.testsuite.tests.PropertyResolution;
import org.junit.runners.Suite.SuiteClasses;
/*
* Copyright (c) 2006-present the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.codehaus.gmaven.testsuite.suite;
/**
* Support for suites.
*/
@SuiteClasses({
ExecuteBasics.class, | PropertyResolution.class |
groovy/gmaven | gmaven-adapter-impl/src/main/java/org/codehaus/gmaven/adapter/impl/GroovyRuntimeImpl.java | // Path: gmaven-adapter-api/src/main/java/org/codehaus/gmaven/adapter/ClassSource.java
// @SuppressWarnings("JavadocReference")
// public interface ClassSource
// {
// URL getUrl();
//
// File getFile();
//
// interface Inline
// {
// String getName();
//
// String getCodeBase();
//
// Reader getInput();
// }
//
// Inline getInline();
// }
//
// Path: gmaven-adapter-api/src/main/java/org/codehaus/gmaven/adapter/ClassSource.java
// interface Inline
// {
// String getName();
//
// String getCodeBase();
//
// Reader getInput();
// }
//
// Path: gmaven-adapter-api/src/main/java/org/codehaus/gmaven/adapter/ClosureTarget.java
// @SuppressWarnings("JavadocReference")
// public interface ClosureTarget
// {
// @Nullable
// Object call(Object[] args) throws Exception;
// }
//
// Path: gmaven-adapter-api/src/main/java/org/codehaus/gmaven/adapter/ConsoleWindow.java
// @SuppressWarnings("JavadocReference")
// public interface ConsoleWindow
// {
// interface WindowHandle
// {
// void close();
//
// void await() throws InterruptedException;
// }
//
// WindowHandle open(ClassLoader classLoader,
// ResourceLoader resourceLoader,
// Map<String, Object> context,
// @Nullable Map<String, Object> options)
// throws Exception;
// }
//
// Path: gmaven-adapter-api/src/main/java/org/codehaus/gmaven/adapter/GroovyRuntime.java
// public interface GroovyRuntime
// {
// ScriptExecutor createScriptExecutor();
//
// ConsoleWindow createConsoleWindow();
//
// ShellRunner createShellRunner();
//
// void cleanup();
// }
//
// Path: gmaven-adapter-api/src/main/java/org/codehaus/gmaven/adapter/MagicContext.java
// public enum MagicContext
// {
// /**
// * Context value will be replaced by a {@link groovy.util.AntBuilder} instance.
// */
// @SuppressWarnings("JavadocReference")
// ANT_BUILDER
// }
//
// Path: gmaven-adapter-api/src/main/java/org/codehaus/gmaven/adapter/ResourceLoader.java
// @SuppressWarnings("JavadocReference")
// public interface ResourceLoader
// {
// @Nullable
// URL loadResource(String name) throws MalformedURLException;
// }
//
// Path: gmaven-adapter-api/src/main/java/org/codehaus/gmaven/adapter/ScriptExecutor.java
// @SuppressWarnings("JavadocReference")
// public interface ScriptExecutor
// {
// @Nullable
// Object execute(ClassSource classSource,
// ClassLoader classLoader,
// ResourceLoader resourceLoader,
// Map<String, Object> context,
// @Nullable Map<String, Object> options)
// throws Exception;
// }
//
// Path: gmaven-adapter-api/src/main/java/org/codehaus/gmaven/adapter/ShellRunner.java
// @SuppressWarnings("JavadocReference")
// public interface ShellRunner
// {
// void run(ClassLoader classLoader,
// ResourceLoader resourceLoader,
// Map<String, Object> context,
// @Nullable Map<String, Object> options)
// throws Exception;
// }
| import java.io.IOException;
import java.net.MalformedURLException;
import java.net.URL;
import java.security.AccessController;
import java.security.PrivilegedAction;
import java.util.Map;
import java.util.Map.Entry;
import com.google.common.base.Throwables;
import groovy.lang.Binding;
import groovy.lang.Closure;
import groovy.lang.GroovyClassLoader;
import groovy.lang.GroovyCodeSource;
import groovy.lang.GroovyResourceLoader;
import groovy.util.AntBuilder;
import org.apache.tools.ant.BuildLogger;
import org.codehaus.gmaven.adapter.ClassSource;
import org.codehaus.gmaven.adapter.ClassSource.Inline;
import org.codehaus.gmaven.adapter.ClosureTarget;
import org.codehaus.gmaven.adapter.ConsoleWindow;
import org.codehaus.gmaven.adapter.GroovyRuntime;
import org.codehaus.gmaven.adapter.MagicContext;
import org.codehaus.gmaven.adapter.ResourceLoader;
import org.codehaus.gmaven.adapter.ScriptExecutor;
import org.codehaus.gmaven.adapter.ShellRunner;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import static com.google.common.base.Preconditions.checkNotNull; | /*
* Copyright (c) 2006-present the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.codehaus.gmaven.adapter.impl;
/**
* Default {@link GroovyRuntime} implementation.
*
* @since 2.0
*/
public class GroovyRuntimeImpl
implements GroovyRuntime
{
private final Logger log = LoggerFactory.getLogger(getClass());
@Override | // Path: gmaven-adapter-api/src/main/java/org/codehaus/gmaven/adapter/ClassSource.java
// @SuppressWarnings("JavadocReference")
// public interface ClassSource
// {
// URL getUrl();
//
// File getFile();
//
// interface Inline
// {
// String getName();
//
// String getCodeBase();
//
// Reader getInput();
// }
//
// Inline getInline();
// }
//
// Path: gmaven-adapter-api/src/main/java/org/codehaus/gmaven/adapter/ClassSource.java
// interface Inline
// {
// String getName();
//
// String getCodeBase();
//
// Reader getInput();
// }
//
// Path: gmaven-adapter-api/src/main/java/org/codehaus/gmaven/adapter/ClosureTarget.java
// @SuppressWarnings("JavadocReference")
// public interface ClosureTarget
// {
// @Nullable
// Object call(Object[] args) throws Exception;
// }
//
// Path: gmaven-adapter-api/src/main/java/org/codehaus/gmaven/adapter/ConsoleWindow.java
// @SuppressWarnings("JavadocReference")
// public interface ConsoleWindow
// {
// interface WindowHandle
// {
// void close();
//
// void await() throws InterruptedException;
// }
//
// WindowHandle open(ClassLoader classLoader,
// ResourceLoader resourceLoader,
// Map<String, Object> context,
// @Nullable Map<String, Object> options)
// throws Exception;
// }
//
// Path: gmaven-adapter-api/src/main/java/org/codehaus/gmaven/adapter/GroovyRuntime.java
// public interface GroovyRuntime
// {
// ScriptExecutor createScriptExecutor();
//
// ConsoleWindow createConsoleWindow();
//
// ShellRunner createShellRunner();
//
// void cleanup();
// }
//
// Path: gmaven-adapter-api/src/main/java/org/codehaus/gmaven/adapter/MagicContext.java
// public enum MagicContext
// {
// /**
// * Context value will be replaced by a {@link groovy.util.AntBuilder} instance.
// */
// @SuppressWarnings("JavadocReference")
// ANT_BUILDER
// }
//
// Path: gmaven-adapter-api/src/main/java/org/codehaus/gmaven/adapter/ResourceLoader.java
// @SuppressWarnings("JavadocReference")
// public interface ResourceLoader
// {
// @Nullable
// URL loadResource(String name) throws MalformedURLException;
// }
//
// Path: gmaven-adapter-api/src/main/java/org/codehaus/gmaven/adapter/ScriptExecutor.java
// @SuppressWarnings("JavadocReference")
// public interface ScriptExecutor
// {
// @Nullable
// Object execute(ClassSource classSource,
// ClassLoader classLoader,
// ResourceLoader resourceLoader,
// Map<String, Object> context,
// @Nullable Map<String, Object> options)
// throws Exception;
// }
//
// Path: gmaven-adapter-api/src/main/java/org/codehaus/gmaven/adapter/ShellRunner.java
// @SuppressWarnings("JavadocReference")
// public interface ShellRunner
// {
// void run(ClassLoader classLoader,
// ResourceLoader resourceLoader,
// Map<String, Object> context,
// @Nullable Map<String, Object> options)
// throws Exception;
// }
// Path: gmaven-adapter-impl/src/main/java/org/codehaus/gmaven/adapter/impl/GroovyRuntimeImpl.java
import java.io.IOException;
import java.net.MalformedURLException;
import java.net.URL;
import java.security.AccessController;
import java.security.PrivilegedAction;
import java.util.Map;
import java.util.Map.Entry;
import com.google.common.base.Throwables;
import groovy.lang.Binding;
import groovy.lang.Closure;
import groovy.lang.GroovyClassLoader;
import groovy.lang.GroovyCodeSource;
import groovy.lang.GroovyResourceLoader;
import groovy.util.AntBuilder;
import org.apache.tools.ant.BuildLogger;
import org.codehaus.gmaven.adapter.ClassSource;
import org.codehaus.gmaven.adapter.ClassSource.Inline;
import org.codehaus.gmaven.adapter.ClosureTarget;
import org.codehaus.gmaven.adapter.ConsoleWindow;
import org.codehaus.gmaven.adapter.GroovyRuntime;
import org.codehaus.gmaven.adapter.MagicContext;
import org.codehaus.gmaven.adapter.ResourceLoader;
import org.codehaus.gmaven.adapter.ScriptExecutor;
import org.codehaus.gmaven.adapter.ShellRunner;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import static com.google.common.base.Preconditions.checkNotNull;
/*
* Copyright (c) 2006-present the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.codehaus.gmaven.adapter.impl;
/**
* Default {@link GroovyRuntime} implementation.
*
* @since 2.0
*/
public class GroovyRuntimeImpl
implements GroovyRuntime
{
private final Logger log = LoggerFactory.getLogger(getClass());
@Override | public ScriptExecutor createScriptExecutor() { |
groovy/gmaven | gmaven-adapter-impl/src/main/java/org/codehaus/gmaven/adapter/impl/GroovyRuntimeImpl.java | // Path: gmaven-adapter-api/src/main/java/org/codehaus/gmaven/adapter/ClassSource.java
// @SuppressWarnings("JavadocReference")
// public interface ClassSource
// {
// URL getUrl();
//
// File getFile();
//
// interface Inline
// {
// String getName();
//
// String getCodeBase();
//
// Reader getInput();
// }
//
// Inline getInline();
// }
//
// Path: gmaven-adapter-api/src/main/java/org/codehaus/gmaven/adapter/ClassSource.java
// interface Inline
// {
// String getName();
//
// String getCodeBase();
//
// Reader getInput();
// }
//
// Path: gmaven-adapter-api/src/main/java/org/codehaus/gmaven/adapter/ClosureTarget.java
// @SuppressWarnings("JavadocReference")
// public interface ClosureTarget
// {
// @Nullable
// Object call(Object[] args) throws Exception;
// }
//
// Path: gmaven-adapter-api/src/main/java/org/codehaus/gmaven/adapter/ConsoleWindow.java
// @SuppressWarnings("JavadocReference")
// public interface ConsoleWindow
// {
// interface WindowHandle
// {
// void close();
//
// void await() throws InterruptedException;
// }
//
// WindowHandle open(ClassLoader classLoader,
// ResourceLoader resourceLoader,
// Map<String, Object> context,
// @Nullable Map<String, Object> options)
// throws Exception;
// }
//
// Path: gmaven-adapter-api/src/main/java/org/codehaus/gmaven/adapter/GroovyRuntime.java
// public interface GroovyRuntime
// {
// ScriptExecutor createScriptExecutor();
//
// ConsoleWindow createConsoleWindow();
//
// ShellRunner createShellRunner();
//
// void cleanup();
// }
//
// Path: gmaven-adapter-api/src/main/java/org/codehaus/gmaven/adapter/MagicContext.java
// public enum MagicContext
// {
// /**
// * Context value will be replaced by a {@link groovy.util.AntBuilder} instance.
// */
// @SuppressWarnings("JavadocReference")
// ANT_BUILDER
// }
//
// Path: gmaven-adapter-api/src/main/java/org/codehaus/gmaven/adapter/ResourceLoader.java
// @SuppressWarnings("JavadocReference")
// public interface ResourceLoader
// {
// @Nullable
// URL loadResource(String name) throws MalformedURLException;
// }
//
// Path: gmaven-adapter-api/src/main/java/org/codehaus/gmaven/adapter/ScriptExecutor.java
// @SuppressWarnings("JavadocReference")
// public interface ScriptExecutor
// {
// @Nullable
// Object execute(ClassSource classSource,
// ClassLoader classLoader,
// ResourceLoader resourceLoader,
// Map<String, Object> context,
// @Nullable Map<String, Object> options)
// throws Exception;
// }
//
// Path: gmaven-adapter-api/src/main/java/org/codehaus/gmaven/adapter/ShellRunner.java
// @SuppressWarnings("JavadocReference")
// public interface ShellRunner
// {
// void run(ClassLoader classLoader,
// ResourceLoader resourceLoader,
// Map<String, Object> context,
// @Nullable Map<String, Object> options)
// throws Exception;
// }
| import java.io.IOException;
import java.net.MalformedURLException;
import java.net.URL;
import java.security.AccessController;
import java.security.PrivilegedAction;
import java.util.Map;
import java.util.Map.Entry;
import com.google.common.base.Throwables;
import groovy.lang.Binding;
import groovy.lang.Closure;
import groovy.lang.GroovyClassLoader;
import groovy.lang.GroovyCodeSource;
import groovy.lang.GroovyResourceLoader;
import groovy.util.AntBuilder;
import org.apache.tools.ant.BuildLogger;
import org.codehaus.gmaven.adapter.ClassSource;
import org.codehaus.gmaven.adapter.ClassSource.Inline;
import org.codehaus.gmaven.adapter.ClosureTarget;
import org.codehaus.gmaven.adapter.ConsoleWindow;
import org.codehaus.gmaven.adapter.GroovyRuntime;
import org.codehaus.gmaven.adapter.MagicContext;
import org.codehaus.gmaven.adapter.ResourceLoader;
import org.codehaus.gmaven.adapter.ScriptExecutor;
import org.codehaus.gmaven.adapter.ShellRunner;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import static com.google.common.base.Preconditions.checkNotNull; | /*
* Copyright (c) 2006-present the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.codehaus.gmaven.adapter.impl;
/**
* Default {@link GroovyRuntime} implementation.
*
* @since 2.0
*/
public class GroovyRuntimeImpl
implements GroovyRuntime
{
private final Logger log = LoggerFactory.getLogger(getClass());
@Override
public ScriptExecutor createScriptExecutor() {
return new ScriptExecutorImpl(this);
}
@Override | // Path: gmaven-adapter-api/src/main/java/org/codehaus/gmaven/adapter/ClassSource.java
// @SuppressWarnings("JavadocReference")
// public interface ClassSource
// {
// URL getUrl();
//
// File getFile();
//
// interface Inline
// {
// String getName();
//
// String getCodeBase();
//
// Reader getInput();
// }
//
// Inline getInline();
// }
//
// Path: gmaven-adapter-api/src/main/java/org/codehaus/gmaven/adapter/ClassSource.java
// interface Inline
// {
// String getName();
//
// String getCodeBase();
//
// Reader getInput();
// }
//
// Path: gmaven-adapter-api/src/main/java/org/codehaus/gmaven/adapter/ClosureTarget.java
// @SuppressWarnings("JavadocReference")
// public interface ClosureTarget
// {
// @Nullable
// Object call(Object[] args) throws Exception;
// }
//
// Path: gmaven-adapter-api/src/main/java/org/codehaus/gmaven/adapter/ConsoleWindow.java
// @SuppressWarnings("JavadocReference")
// public interface ConsoleWindow
// {
// interface WindowHandle
// {
// void close();
//
// void await() throws InterruptedException;
// }
//
// WindowHandle open(ClassLoader classLoader,
// ResourceLoader resourceLoader,
// Map<String, Object> context,
// @Nullable Map<String, Object> options)
// throws Exception;
// }
//
// Path: gmaven-adapter-api/src/main/java/org/codehaus/gmaven/adapter/GroovyRuntime.java
// public interface GroovyRuntime
// {
// ScriptExecutor createScriptExecutor();
//
// ConsoleWindow createConsoleWindow();
//
// ShellRunner createShellRunner();
//
// void cleanup();
// }
//
// Path: gmaven-adapter-api/src/main/java/org/codehaus/gmaven/adapter/MagicContext.java
// public enum MagicContext
// {
// /**
// * Context value will be replaced by a {@link groovy.util.AntBuilder} instance.
// */
// @SuppressWarnings("JavadocReference")
// ANT_BUILDER
// }
//
// Path: gmaven-adapter-api/src/main/java/org/codehaus/gmaven/adapter/ResourceLoader.java
// @SuppressWarnings("JavadocReference")
// public interface ResourceLoader
// {
// @Nullable
// URL loadResource(String name) throws MalformedURLException;
// }
//
// Path: gmaven-adapter-api/src/main/java/org/codehaus/gmaven/adapter/ScriptExecutor.java
// @SuppressWarnings("JavadocReference")
// public interface ScriptExecutor
// {
// @Nullable
// Object execute(ClassSource classSource,
// ClassLoader classLoader,
// ResourceLoader resourceLoader,
// Map<String, Object> context,
// @Nullable Map<String, Object> options)
// throws Exception;
// }
//
// Path: gmaven-adapter-api/src/main/java/org/codehaus/gmaven/adapter/ShellRunner.java
// @SuppressWarnings("JavadocReference")
// public interface ShellRunner
// {
// void run(ClassLoader classLoader,
// ResourceLoader resourceLoader,
// Map<String, Object> context,
// @Nullable Map<String, Object> options)
// throws Exception;
// }
// Path: gmaven-adapter-impl/src/main/java/org/codehaus/gmaven/adapter/impl/GroovyRuntimeImpl.java
import java.io.IOException;
import java.net.MalformedURLException;
import java.net.URL;
import java.security.AccessController;
import java.security.PrivilegedAction;
import java.util.Map;
import java.util.Map.Entry;
import com.google.common.base.Throwables;
import groovy.lang.Binding;
import groovy.lang.Closure;
import groovy.lang.GroovyClassLoader;
import groovy.lang.GroovyCodeSource;
import groovy.lang.GroovyResourceLoader;
import groovy.util.AntBuilder;
import org.apache.tools.ant.BuildLogger;
import org.codehaus.gmaven.adapter.ClassSource;
import org.codehaus.gmaven.adapter.ClassSource.Inline;
import org.codehaus.gmaven.adapter.ClosureTarget;
import org.codehaus.gmaven.adapter.ConsoleWindow;
import org.codehaus.gmaven.adapter.GroovyRuntime;
import org.codehaus.gmaven.adapter.MagicContext;
import org.codehaus.gmaven.adapter.ResourceLoader;
import org.codehaus.gmaven.adapter.ScriptExecutor;
import org.codehaus.gmaven.adapter.ShellRunner;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import static com.google.common.base.Preconditions.checkNotNull;
/*
* Copyright (c) 2006-present the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.codehaus.gmaven.adapter.impl;
/**
* Default {@link GroovyRuntime} implementation.
*
* @since 2.0
*/
public class GroovyRuntimeImpl
implements GroovyRuntime
{
private final Logger log = LoggerFactory.getLogger(getClass());
@Override
public ScriptExecutor createScriptExecutor() {
return new ScriptExecutorImpl(this);
}
@Override | public ConsoleWindow createConsoleWindow() { |
groovy/gmaven | gmaven-adapter-impl/src/main/java/org/codehaus/gmaven/adapter/impl/GroovyRuntimeImpl.java | // Path: gmaven-adapter-api/src/main/java/org/codehaus/gmaven/adapter/ClassSource.java
// @SuppressWarnings("JavadocReference")
// public interface ClassSource
// {
// URL getUrl();
//
// File getFile();
//
// interface Inline
// {
// String getName();
//
// String getCodeBase();
//
// Reader getInput();
// }
//
// Inline getInline();
// }
//
// Path: gmaven-adapter-api/src/main/java/org/codehaus/gmaven/adapter/ClassSource.java
// interface Inline
// {
// String getName();
//
// String getCodeBase();
//
// Reader getInput();
// }
//
// Path: gmaven-adapter-api/src/main/java/org/codehaus/gmaven/adapter/ClosureTarget.java
// @SuppressWarnings("JavadocReference")
// public interface ClosureTarget
// {
// @Nullable
// Object call(Object[] args) throws Exception;
// }
//
// Path: gmaven-adapter-api/src/main/java/org/codehaus/gmaven/adapter/ConsoleWindow.java
// @SuppressWarnings("JavadocReference")
// public interface ConsoleWindow
// {
// interface WindowHandle
// {
// void close();
//
// void await() throws InterruptedException;
// }
//
// WindowHandle open(ClassLoader classLoader,
// ResourceLoader resourceLoader,
// Map<String, Object> context,
// @Nullable Map<String, Object> options)
// throws Exception;
// }
//
// Path: gmaven-adapter-api/src/main/java/org/codehaus/gmaven/adapter/GroovyRuntime.java
// public interface GroovyRuntime
// {
// ScriptExecutor createScriptExecutor();
//
// ConsoleWindow createConsoleWindow();
//
// ShellRunner createShellRunner();
//
// void cleanup();
// }
//
// Path: gmaven-adapter-api/src/main/java/org/codehaus/gmaven/adapter/MagicContext.java
// public enum MagicContext
// {
// /**
// * Context value will be replaced by a {@link groovy.util.AntBuilder} instance.
// */
// @SuppressWarnings("JavadocReference")
// ANT_BUILDER
// }
//
// Path: gmaven-adapter-api/src/main/java/org/codehaus/gmaven/adapter/ResourceLoader.java
// @SuppressWarnings("JavadocReference")
// public interface ResourceLoader
// {
// @Nullable
// URL loadResource(String name) throws MalformedURLException;
// }
//
// Path: gmaven-adapter-api/src/main/java/org/codehaus/gmaven/adapter/ScriptExecutor.java
// @SuppressWarnings("JavadocReference")
// public interface ScriptExecutor
// {
// @Nullable
// Object execute(ClassSource classSource,
// ClassLoader classLoader,
// ResourceLoader resourceLoader,
// Map<String, Object> context,
// @Nullable Map<String, Object> options)
// throws Exception;
// }
//
// Path: gmaven-adapter-api/src/main/java/org/codehaus/gmaven/adapter/ShellRunner.java
// @SuppressWarnings("JavadocReference")
// public interface ShellRunner
// {
// void run(ClassLoader classLoader,
// ResourceLoader resourceLoader,
// Map<String, Object> context,
// @Nullable Map<String, Object> options)
// throws Exception;
// }
| import java.io.IOException;
import java.net.MalformedURLException;
import java.net.URL;
import java.security.AccessController;
import java.security.PrivilegedAction;
import java.util.Map;
import java.util.Map.Entry;
import com.google.common.base.Throwables;
import groovy.lang.Binding;
import groovy.lang.Closure;
import groovy.lang.GroovyClassLoader;
import groovy.lang.GroovyCodeSource;
import groovy.lang.GroovyResourceLoader;
import groovy.util.AntBuilder;
import org.apache.tools.ant.BuildLogger;
import org.codehaus.gmaven.adapter.ClassSource;
import org.codehaus.gmaven.adapter.ClassSource.Inline;
import org.codehaus.gmaven.adapter.ClosureTarget;
import org.codehaus.gmaven.adapter.ConsoleWindow;
import org.codehaus.gmaven.adapter.GroovyRuntime;
import org.codehaus.gmaven.adapter.MagicContext;
import org.codehaus.gmaven.adapter.ResourceLoader;
import org.codehaus.gmaven.adapter.ScriptExecutor;
import org.codehaus.gmaven.adapter.ShellRunner;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import static com.google.common.base.Preconditions.checkNotNull; | /*
* Copyright (c) 2006-present the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.codehaus.gmaven.adapter.impl;
/**
* Default {@link GroovyRuntime} implementation.
*
* @since 2.0
*/
public class GroovyRuntimeImpl
implements GroovyRuntime
{
private final Logger log = LoggerFactory.getLogger(getClass());
@Override
public ScriptExecutor createScriptExecutor() {
return new ScriptExecutorImpl(this);
}
@Override
public ConsoleWindow createConsoleWindow() {
return new ConsoleWindowImpl(this);
}
@Override | // Path: gmaven-adapter-api/src/main/java/org/codehaus/gmaven/adapter/ClassSource.java
// @SuppressWarnings("JavadocReference")
// public interface ClassSource
// {
// URL getUrl();
//
// File getFile();
//
// interface Inline
// {
// String getName();
//
// String getCodeBase();
//
// Reader getInput();
// }
//
// Inline getInline();
// }
//
// Path: gmaven-adapter-api/src/main/java/org/codehaus/gmaven/adapter/ClassSource.java
// interface Inline
// {
// String getName();
//
// String getCodeBase();
//
// Reader getInput();
// }
//
// Path: gmaven-adapter-api/src/main/java/org/codehaus/gmaven/adapter/ClosureTarget.java
// @SuppressWarnings("JavadocReference")
// public interface ClosureTarget
// {
// @Nullable
// Object call(Object[] args) throws Exception;
// }
//
// Path: gmaven-adapter-api/src/main/java/org/codehaus/gmaven/adapter/ConsoleWindow.java
// @SuppressWarnings("JavadocReference")
// public interface ConsoleWindow
// {
// interface WindowHandle
// {
// void close();
//
// void await() throws InterruptedException;
// }
//
// WindowHandle open(ClassLoader classLoader,
// ResourceLoader resourceLoader,
// Map<String, Object> context,
// @Nullable Map<String, Object> options)
// throws Exception;
// }
//
// Path: gmaven-adapter-api/src/main/java/org/codehaus/gmaven/adapter/GroovyRuntime.java
// public interface GroovyRuntime
// {
// ScriptExecutor createScriptExecutor();
//
// ConsoleWindow createConsoleWindow();
//
// ShellRunner createShellRunner();
//
// void cleanup();
// }
//
// Path: gmaven-adapter-api/src/main/java/org/codehaus/gmaven/adapter/MagicContext.java
// public enum MagicContext
// {
// /**
// * Context value will be replaced by a {@link groovy.util.AntBuilder} instance.
// */
// @SuppressWarnings("JavadocReference")
// ANT_BUILDER
// }
//
// Path: gmaven-adapter-api/src/main/java/org/codehaus/gmaven/adapter/ResourceLoader.java
// @SuppressWarnings("JavadocReference")
// public interface ResourceLoader
// {
// @Nullable
// URL loadResource(String name) throws MalformedURLException;
// }
//
// Path: gmaven-adapter-api/src/main/java/org/codehaus/gmaven/adapter/ScriptExecutor.java
// @SuppressWarnings("JavadocReference")
// public interface ScriptExecutor
// {
// @Nullable
// Object execute(ClassSource classSource,
// ClassLoader classLoader,
// ResourceLoader resourceLoader,
// Map<String, Object> context,
// @Nullable Map<String, Object> options)
// throws Exception;
// }
//
// Path: gmaven-adapter-api/src/main/java/org/codehaus/gmaven/adapter/ShellRunner.java
// @SuppressWarnings("JavadocReference")
// public interface ShellRunner
// {
// void run(ClassLoader classLoader,
// ResourceLoader resourceLoader,
// Map<String, Object> context,
// @Nullable Map<String, Object> options)
// throws Exception;
// }
// Path: gmaven-adapter-impl/src/main/java/org/codehaus/gmaven/adapter/impl/GroovyRuntimeImpl.java
import java.io.IOException;
import java.net.MalformedURLException;
import java.net.URL;
import java.security.AccessController;
import java.security.PrivilegedAction;
import java.util.Map;
import java.util.Map.Entry;
import com.google.common.base.Throwables;
import groovy.lang.Binding;
import groovy.lang.Closure;
import groovy.lang.GroovyClassLoader;
import groovy.lang.GroovyCodeSource;
import groovy.lang.GroovyResourceLoader;
import groovy.util.AntBuilder;
import org.apache.tools.ant.BuildLogger;
import org.codehaus.gmaven.adapter.ClassSource;
import org.codehaus.gmaven.adapter.ClassSource.Inline;
import org.codehaus.gmaven.adapter.ClosureTarget;
import org.codehaus.gmaven.adapter.ConsoleWindow;
import org.codehaus.gmaven.adapter.GroovyRuntime;
import org.codehaus.gmaven.adapter.MagicContext;
import org.codehaus.gmaven.adapter.ResourceLoader;
import org.codehaus.gmaven.adapter.ScriptExecutor;
import org.codehaus.gmaven.adapter.ShellRunner;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import static com.google.common.base.Preconditions.checkNotNull;
/*
* Copyright (c) 2006-present the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.codehaus.gmaven.adapter.impl;
/**
* Default {@link GroovyRuntime} implementation.
*
* @since 2.0
*/
public class GroovyRuntimeImpl
implements GroovyRuntime
{
private final Logger log = LoggerFactory.getLogger(getClass());
@Override
public ScriptExecutor createScriptExecutor() {
return new ScriptExecutorImpl(this);
}
@Override
public ConsoleWindow createConsoleWindow() {
return new ConsoleWindowImpl(this);
}
@Override | public ShellRunner createShellRunner() { |
groovy/gmaven | gmaven-adapter-impl/src/main/java/org/codehaus/gmaven/adapter/impl/GroovyRuntimeImpl.java | // Path: gmaven-adapter-api/src/main/java/org/codehaus/gmaven/adapter/ClassSource.java
// @SuppressWarnings("JavadocReference")
// public interface ClassSource
// {
// URL getUrl();
//
// File getFile();
//
// interface Inline
// {
// String getName();
//
// String getCodeBase();
//
// Reader getInput();
// }
//
// Inline getInline();
// }
//
// Path: gmaven-adapter-api/src/main/java/org/codehaus/gmaven/adapter/ClassSource.java
// interface Inline
// {
// String getName();
//
// String getCodeBase();
//
// Reader getInput();
// }
//
// Path: gmaven-adapter-api/src/main/java/org/codehaus/gmaven/adapter/ClosureTarget.java
// @SuppressWarnings("JavadocReference")
// public interface ClosureTarget
// {
// @Nullable
// Object call(Object[] args) throws Exception;
// }
//
// Path: gmaven-adapter-api/src/main/java/org/codehaus/gmaven/adapter/ConsoleWindow.java
// @SuppressWarnings("JavadocReference")
// public interface ConsoleWindow
// {
// interface WindowHandle
// {
// void close();
//
// void await() throws InterruptedException;
// }
//
// WindowHandle open(ClassLoader classLoader,
// ResourceLoader resourceLoader,
// Map<String, Object> context,
// @Nullable Map<String, Object> options)
// throws Exception;
// }
//
// Path: gmaven-adapter-api/src/main/java/org/codehaus/gmaven/adapter/GroovyRuntime.java
// public interface GroovyRuntime
// {
// ScriptExecutor createScriptExecutor();
//
// ConsoleWindow createConsoleWindow();
//
// ShellRunner createShellRunner();
//
// void cleanup();
// }
//
// Path: gmaven-adapter-api/src/main/java/org/codehaus/gmaven/adapter/MagicContext.java
// public enum MagicContext
// {
// /**
// * Context value will be replaced by a {@link groovy.util.AntBuilder} instance.
// */
// @SuppressWarnings("JavadocReference")
// ANT_BUILDER
// }
//
// Path: gmaven-adapter-api/src/main/java/org/codehaus/gmaven/adapter/ResourceLoader.java
// @SuppressWarnings("JavadocReference")
// public interface ResourceLoader
// {
// @Nullable
// URL loadResource(String name) throws MalformedURLException;
// }
//
// Path: gmaven-adapter-api/src/main/java/org/codehaus/gmaven/adapter/ScriptExecutor.java
// @SuppressWarnings("JavadocReference")
// public interface ScriptExecutor
// {
// @Nullable
// Object execute(ClassSource classSource,
// ClassLoader classLoader,
// ResourceLoader resourceLoader,
// Map<String, Object> context,
// @Nullable Map<String, Object> options)
// throws Exception;
// }
//
// Path: gmaven-adapter-api/src/main/java/org/codehaus/gmaven/adapter/ShellRunner.java
// @SuppressWarnings("JavadocReference")
// public interface ShellRunner
// {
// void run(ClassLoader classLoader,
// ResourceLoader resourceLoader,
// Map<String, Object> context,
// @Nullable Map<String, Object> options)
// throws Exception;
// }
| import java.io.IOException;
import java.net.MalformedURLException;
import java.net.URL;
import java.security.AccessController;
import java.security.PrivilegedAction;
import java.util.Map;
import java.util.Map.Entry;
import com.google.common.base.Throwables;
import groovy.lang.Binding;
import groovy.lang.Closure;
import groovy.lang.GroovyClassLoader;
import groovy.lang.GroovyCodeSource;
import groovy.lang.GroovyResourceLoader;
import groovy.util.AntBuilder;
import org.apache.tools.ant.BuildLogger;
import org.codehaus.gmaven.adapter.ClassSource;
import org.codehaus.gmaven.adapter.ClassSource.Inline;
import org.codehaus.gmaven.adapter.ClosureTarget;
import org.codehaus.gmaven.adapter.ConsoleWindow;
import org.codehaus.gmaven.adapter.GroovyRuntime;
import org.codehaus.gmaven.adapter.MagicContext;
import org.codehaus.gmaven.adapter.ResourceLoader;
import org.codehaus.gmaven.adapter.ScriptExecutor;
import org.codehaus.gmaven.adapter.ShellRunner;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import static com.google.common.base.Preconditions.checkNotNull; | /*
* Copyright (c) 2006-present the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.codehaus.gmaven.adapter.impl;
/**
* Default {@link GroovyRuntime} implementation.
*
* @since 2.0
*/
public class GroovyRuntimeImpl
implements GroovyRuntime
{
private final Logger log = LoggerFactory.getLogger(getClass());
@Override
public ScriptExecutor createScriptExecutor() {
return new ScriptExecutorImpl(this);
}
@Override
public ConsoleWindow createConsoleWindow() {
return new ConsoleWindowImpl(this);
}
@Override
public ShellRunner createShellRunner() {
return new ShellRunnerImpl(this);
}
@Override
public void cleanup() {
// nothing atm
}
//
// Internal
//
/**
* Create a {@link GroovyClassLoader} from given {@link ClassLoader} and {@link ResourceLoader}.
*/ | // Path: gmaven-adapter-api/src/main/java/org/codehaus/gmaven/adapter/ClassSource.java
// @SuppressWarnings("JavadocReference")
// public interface ClassSource
// {
// URL getUrl();
//
// File getFile();
//
// interface Inline
// {
// String getName();
//
// String getCodeBase();
//
// Reader getInput();
// }
//
// Inline getInline();
// }
//
// Path: gmaven-adapter-api/src/main/java/org/codehaus/gmaven/adapter/ClassSource.java
// interface Inline
// {
// String getName();
//
// String getCodeBase();
//
// Reader getInput();
// }
//
// Path: gmaven-adapter-api/src/main/java/org/codehaus/gmaven/adapter/ClosureTarget.java
// @SuppressWarnings("JavadocReference")
// public interface ClosureTarget
// {
// @Nullable
// Object call(Object[] args) throws Exception;
// }
//
// Path: gmaven-adapter-api/src/main/java/org/codehaus/gmaven/adapter/ConsoleWindow.java
// @SuppressWarnings("JavadocReference")
// public interface ConsoleWindow
// {
// interface WindowHandle
// {
// void close();
//
// void await() throws InterruptedException;
// }
//
// WindowHandle open(ClassLoader classLoader,
// ResourceLoader resourceLoader,
// Map<String, Object> context,
// @Nullable Map<String, Object> options)
// throws Exception;
// }
//
// Path: gmaven-adapter-api/src/main/java/org/codehaus/gmaven/adapter/GroovyRuntime.java
// public interface GroovyRuntime
// {
// ScriptExecutor createScriptExecutor();
//
// ConsoleWindow createConsoleWindow();
//
// ShellRunner createShellRunner();
//
// void cleanup();
// }
//
// Path: gmaven-adapter-api/src/main/java/org/codehaus/gmaven/adapter/MagicContext.java
// public enum MagicContext
// {
// /**
// * Context value will be replaced by a {@link groovy.util.AntBuilder} instance.
// */
// @SuppressWarnings("JavadocReference")
// ANT_BUILDER
// }
//
// Path: gmaven-adapter-api/src/main/java/org/codehaus/gmaven/adapter/ResourceLoader.java
// @SuppressWarnings("JavadocReference")
// public interface ResourceLoader
// {
// @Nullable
// URL loadResource(String name) throws MalformedURLException;
// }
//
// Path: gmaven-adapter-api/src/main/java/org/codehaus/gmaven/adapter/ScriptExecutor.java
// @SuppressWarnings("JavadocReference")
// public interface ScriptExecutor
// {
// @Nullable
// Object execute(ClassSource classSource,
// ClassLoader classLoader,
// ResourceLoader resourceLoader,
// Map<String, Object> context,
// @Nullable Map<String, Object> options)
// throws Exception;
// }
//
// Path: gmaven-adapter-api/src/main/java/org/codehaus/gmaven/adapter/ShellRunner.java
// @SuppressWarnings("JavadocReference")
// public interface ShellRunner
// {
// void run(ClassLoader classLoader,
// ResourceLoader resourceLoader,
// Map<String, Object> context,
// @Nullable Map<String, Object> options)
// throws Exception;
// }
// Path: gmaven-adapter-impl/src/main/java/org/codehaus/gmaven/adapter/impl/GroovyRuntimeImpl.java
import java.io.IOException;
import java.net.MalformedURLException;
import java.net.URL;
import java.security.AccessController;
import java.security.PrivilegedAction;
import java.util.Map;
import java.util.Map.Entry;
import com.google.common.base.Throwables;
import groovy.lang.Binding;
import groovy.lang.Closure;
import groovy.lang.GroovyClassLoader;
import groovy.lang.GroovyCodeSource;
import groovy.lang.GroovyResourceLoader;
import groovy.util.AntBuilder;
import org.apache.tools.ant.BuildLogger;
import org.codehaus.gmaven.adapter.ClassSource;
import org.codehaus.gmaven.adapter.ClassSource.Inline;
import org.codehaus.gmaven.adapter.ClosureTarget;
import org.codehaus.gmaven.adapter.ConsoleWindow;
import org.codehaus.gmaven.adapter.GroovyRuntime;
import org.codehaus.gmaven.adapter.MagicContext;
import org.codehaus.gmaven.adapter.ResourceLoader;
import org.codehaus.gmaven.adapter.ScriptExecutor;
import org.codehaus.gmaven.adapter.ShellRunner;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import static com.google.common.base.Preconditions.checkNotNull;
/*
* Copyright (c) 2006-present the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.codehaus.gmaven.adapter.impl;
/**
* Default {@link GroovyRuntime} implementation.
*
* @since 2.0
*/
public class GroovyRuntimeImpl
implements GroovyRuntime
{
private final Logger log = LoggerFactory.getLogger(getClass());
@Override
public ScriptExecutor createScriptExecutor() {
return new ScriptExecutorImpl(this);
}
@Override
public ConsoleWindow createConsoleWindow() {
return new ConsoleWindowImpl(this);
}
@Override
public ShellRunner createShellRunner() {
return new ShellRunnerImpl(this);
}
@Override
public void cleanup() {
// nothing atm
}
//
// Internal
//
/**
* Create a {@link GroovyClassLoader} from given {@link ClassLoader} and {@link ResourceLoader}.
*/ | public GroovyClassLoader createGroovyClassLoader(final ClassLoader classLoader, final ResourceLoader resourceLoader) { |
groovy/gmaven | gmaven-adapter-impl/src/main/java/org/codehaus/gmaven/adapter/impl/GroovyRuntimeImpl.java | // Path: gmaven-adapter-api/src/main/java/org/codehaus/gmaven/adapter/ClassSource.java
// @SuppressWarnings("JavadocReference")
// public interface ClassSource
// {
// URL getUrl();
//
// File getFile();
//
// interface Inline
// {
// String getName();
//
// String getCodeBase();
//
// Reader getInput();
// }
//
// Inline getInline();
// }
//
// Path: gmaven-adapter-api/src/main/java/org/codehaus/gmaven/adapter/ClassSource.java
// interface Inline
// {
// String getName();
//
// String getCodeBase();
//
// Reader getInput();
// }
//
// Path: gmaven-adapter-api/src/main/java/org/codehaus/gmaven/adapter/ClosureTarget.java
// @SuppressWarnings("JavadocReference")
// public interface ClosureTarget
// {
// @Nullable
// Object call(Object[] args) throws Exception;
// }
//
// Path: gmaven-adapter-api/src/main/java/org/codehaus/gmaven/adapter/ConsoleWindow.java
// @SuppressWarnings("JavadocReference")
// public interface ConsoleWindow
// {
// interface WindowHandle
// {
// void close();
//
// void await() throws InterruptedException;
// }
//
// WindowHandle open(ClassLoader classLoader,
// ResourceLoader resourceLoader,
// Map<String, Object> context,
// @Nullable Map<String, Object> options)
// throws Exception;
// }
//
// Path: gmaven-adapter-api/src/main/java/org/codehaus/gmaven/adapter/GroovyRuntime.java
// public interface GroovyRuntime
// {
// ScriptExecutor createScriptExecutor();
//
// ConsoleWindow createConsoleWindow();
//
// ShellRunner createShellRunner();
//
// void cleanup();
// }
//
// Path: gmaven-adapter-api/src/main/java/org/codehaus/gmaven/adapter/MagicContext.java
// public enum MagicContext
// {
// /**
// * Context value will be replaced by a {@link groovy.util.AntBuilder} instance.
// */
// @SuppressWarnings("JavadocReference")
// ANT_BUILDER
// }
//
// Path: gmaven-adapter-api/src/main/java/org/codehaus/gmaven/adapter/ResourceLoader.java
// @SuppressWarnings("JavadocReference")
// public interface ResourceLoader
// {
// @Nullable
// URL loadResource(String name) throws MalformedURLException;
// }
//
// Path: gmaven-adapter-api/src/main/java/org/codehaus/gmaven/adapter/ScriptExecutor.java
// @SuppressWarnings("JavadocReference")
// public interface ScriptExecutor
// {
// @Nullable
// Object execute(ClassSource classSource,
// ClassLoader classLoader,
// ResourceLoader resourceLoader,
// Map<String, Object> context,
// @Nullable Map<String, Object> options)
// throws Exception;
// }
//
// Path: gmaven-adapter-api/src/main/java/org/codehaus/gmaven/adapter/ShellRunner.java
// @SuppressWarnings("JavadocReference")
// public interface ShellRunner
// {
// void run(ClassLoader classLoader,
// ResourceLoader resourceLoader,
// Map<String, Object> context,
// @Nullable Map<String, Object> options)
// throws Exception;
// }
| import java.io.IOException;
import java.net.MalformedURLException;
import java.net.URL;
import java.security.AccessController;
import java.security.PrivilegedAction;
import java.util.Map;
import java.util.Map.Entry;
import com.google.common.base.Throwables;
import groovy.lang.Binding;
import groovy.lang.Closure;
import groovy.lang.GroovyClassLoader;
import groovy.lang.GroovyCodeSource;
import groovy.lang.GroovyResourceLoader;
import groovy.util.AntBuilder;
import org.apache.tools.ant.BuildLogger;
import org.codehaus.gmaven.adapter.ClassSource;
import org.codehaus.gmaven.adapter.ClassSource.Inline;
import org.codehaus.gmaven.adapter.ClosureTarget;
import org.codehaus.gmaven.adapter.ConsoleWindow;
import org.codehaus.gmaven.adapter.GroovyRuntime;
import org.codehaus.gmaven.adapter.MagicContext;
import org.codehaus.gmaven.adapter.ResourceLoader;
import org.codehaus.gmaven.adapter.ScriptExecutor;
import org.codehaus.gmaven.adapter.ShellRunner;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import static com.google.common.base.Preconditions.checkNotNull; | public GroovyClassLoader createGroovyClassLoader(final ClassLoader classLoader, final ResourceLoader resourceLoader) {
return AccessController.doPrivileged(new PrivilegedAction<GroovyClassLoader>()
{
@Override
public GroovyClassLoader run() {
GroovyClassLoader gcl = new GroovyClassLoader(classLoader);
gcl.setResourceLoader(createGroovyResourceLoader(resourceLoader));
return gcl;
}
});
}
/**
* Creates a {@link GroovyResourceLoader} from a {@link ResourceLoader}.
*/
public GroovyResourceLoader createGroovyResourceLoader(final ResourceLoader resourceLoader) {
checkNotNull(resourceLoader);
return new GroovyResourceLoader()
{
@Override
public URL loadGroovySource(final String name) throws MalformedURLException {
return resourceLoader.loadResource(name);
}
};
}
/**
* Creates a {@link GroovyCodeSource} from a {@link ClassSource}.
*/ | // Path: gmaven-adapter-api/src/main/java/org/codehaus/gmaven/adapter/ClassSource.java
// @SuppressWarnings("JavadocReference")
// public interface ClassSource
// {
// URL getUrl();
//
// File getFile();
//
// interface Inline
// {
// String getName();
//
// String getCodeBase();
//
// Reader getInput();
// }
//
// Inline getInline();
// }
//
// Path: gmaven-adapter-api/src/main/java/org/codehaus/gmaven/adapter/ClassSource.java
// interface Inline
// {
// String getName();
//
// String getCodeBase();
//
// Reader getInput();
// }
//
// Path: gmaven-adapter-api/src/main/java/org/codehaus/gmaven/adapter/ClosureTarget.java
// @SuppressWarnings("JavadocReference")
// public interface ClosureTarget
// {
// @Nullable
// Object call(Object[] args) throws Exception;
// }
//
// Path: gmaven-adapter-api/src/main/java/org/codehaus/gmaven/adapter/ConsoleWindow.java
// @SuppressWarnings("JavadocReference")
// public interface ConsoleWindow
// {
// interface WindowHandle
// {
// void close();
//
// void await() throws InterruptedException;
// }
//
// WindowHandle open(ClassLoader classLoader,
// ResourceLoader resourceLoader,
// Map<String, Object> context,
// @Nullable Map<String, Object> options)
// throws Exception;
// }
//
// Path: gmaven-adapter-api/src/main/java/org/codehaus/gmaven/adapter/GroovyRuntime.java
// public interface GroovyRuntime
// {
// ScriptExecutor createScriptExecutor();
//
// ConsoleWindow createConsoleWindow();
//
// ShellRunner createShellRunner();
//
// void cleanup();
// }
//
// Path: gmaven-adapter-api/src/main/java/org/codehaus/gmaven/adapter/MagicContext.java
// public enum MagicContext
// {
// /**
// * Context value will be replaced by a {@link groovy.util.AntBuilder} instance.
// */
// @SuppressWarnings("JavadocReference")
// ANT_BUILDER
// }
//
// Path: gmaven-adapter-api/src/main/java/org/codehaus/gmaven/adapter/ResourceLoader.java
// @SuppressWarnings("JavadocReference")
// public interface ResourceLoader
// {
// @Nullable
// URL loadResource(String name) throws MalformedURLException;
// }
//
// Path: gmaven-adapter-api/src/main/java/org/codehaus/gmaven/adapter/ScriptExecutor.java
// @SuppressWarnings("JavadocReference")
// public interface ScriptExecutor
// {
// @Nullable
// Object execute(ClassSource classSource,
// ClassLoader classLoader,
// ResourceLoader resourceLoader,
// Map<String, Object> context,
// @Nullable Map<String, Object> options)
// throws Exception;
// }
//
// Path: gmaven-adapter-api/src/main/java/org/codehaus/gmaven/adapter/ShellRunner.java
// @SuppressWarnings("JavadocReference")
// public interface ShellRunner
// {
// void run(ClassLoader classLoader,
// ResourceLoader resourceLoader,
// Map<String, Object> context,
// @Nullable Map<String, Object> options)
// throws Exception;
// }
// Path: gmaven-adapter-impl/src/main/java/org/codehaus/gmaven/adapter/impl/GroovyRuntimeImpl.java
import java.io.IOException;
import java.net.MalformedURLException;
import java.net.URL;
import java.security.AccessController;
import java.security.PrivilegedAction;
import java.util.Map;
import java.util.Map.Entry;
import com.google.common.base.Throwables;
import groovy.lang.Binding;
import groovy.lang.Closure;
import groovy.lang.GroovyClassLoader;
import groovy.lang.GroovyCodeSource;
import groovy.lang.GroovyResourceLoader;
import groovy.util.AntBuilder;
import org.apache.tools.ant.BuildLogger;
import org.codehaus.gmaven.adapter.ClassSource;
import org.codehaus.gmaven.adapter.ClassSource.Inline;
import org.codehaus.gmaven.adapter.ClosureTarget;
import org.codehaus.gmaven.adapter.ConsoleWindow;
import org.codehaus.gmaven.adapter.GroovyRuntime;
import org.codehaus.gmaven.adapter.MagicContext;
import org.codehaus.gmaven.adapter.ResourceLoader;
import org.codehaus.gmaven.adapter.ScriptExecutor;
import org.codehaus.gmaven.adapter.ShellRunner;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import static com.google.common.base.Preconditions.checkNotNull;
public GroovyClassLoader createGroovyClassLoader(final ClassLoader classLoader, final ResourceLoader resourceLoader) {
return AccessController.doPrivileged(new PrivilegedAction<GroovyClassLoader>()
{
@Override
public GroovyClassLoader run() {
GroovyClassLoader gcl = new GroovyClassLoader(classLoader);
gcl.setResourceLoader(createGroovyResourceLoader(resourceLoader));
return gcl;
}
});
}
/**
* Creates a {@link GroovyResourceLoader} from a {@link ResourceLoader}.
*/
public GroovyResourceLoader createGroovyResourceLoader(final ResourceLoader resourceLoader) {
checkNotNull(resourceLoader);
return new GroovyResourceLoader()
{
@Override
public URL loadGroovySource(final String name) throws MalformedURLException {
return resourceLoader.loadResource(name);
}
};
}
/**
* Creates a {@link GroovyCodeSource} from a {@link ClassSource}.
*/ | public GroovyCodeSource createGroovyCodeSource(final ClassSource source) throws IOException { |
groovy/gmaven | gmaven-adapter-impl/src/main/java/org/codehaus/gmaven/adapter/impl/GroovyRuntimeImpl.java | // Path: gmaven-adapter-api/src/main/java/org/codehaus/gmaven/adapter/ClassSource.java
// @SuppressWarnings("JavadocReference")
// public interface ClassSource
// {
// URL getUrl();
//
// File getFile();
//
// interface Inline
// {
// String getName();
//
// String getCodeBase();
//
// Reader getInput();
// }
//
// Inline getInline();
// }
//
// Path: gmaven-adapter-api/src/main/java/org/codehaus/gmaven/adapter/ClassSource.java
// interface Inline
// {
// String getName();
//
// String getCodeBase();
//
// Reader getInput();
// }
//
// Path: gmaven-adapter-api/src/main/java/org/codehaus/gmaven/adapter/ClosureTarget.java
// @SuppressWarnings("JavadocReference")
// public interface ClosureTarget
// {
// @Nullable
// Object call(Object[] args) throws Exception;
// }
//
// Path: gmaven-adapter-api/src/main/java/org/codehaus/gmaven/adapter/ConsoleWindow.java
// @SuppressWarnings("JavadocReference")
// public interface ConsoleWindow
// {
// interface WindowHandle
// {
// void close();
//
// void await() throws InterruptedException;
// }
//
// WindowHandle open(ClassLoader classLoader,
// ResourceLoader resourceLoader,
// Map<String, Object> context,
// @Nullable Map<String, Object> options)
// throws Exception;
// }
//
// Path: gmaven-adapter-api/src/main/java/org/codehaus/gmaven/adapter/GroovyRuntime.java
// public interface GroovyRuntime
// {
// ScriptExecutor createScriptExecutor();
//
// ConsoleWindow createConsoleWindow();
//
// ShellRunner createShellRunner();
//
// void cleanup();
// }
//
// Path: gmaven-adapter-api/src/main/java/org/codehaus/gmaven/adapter/MagicContext.java
// public enum MagicContext
// {
// /**
// * Context value will be replaced by a {@link groovy.util.AntBuilder} instance.
// */
// @SuppressWarnings("JavadocReference")
// ANT_BUILDER
// }
//
// Path: gmaven-adapter-api/src/main/java/org/codehaus/gmaven/adapter/ResourceLoader.java
// @SuppressWarnings("JavadocReference")
// public interface ResourceLoader
// {
// @Nullable
// URL loadResource(String name) throws MalformedURLException;
// }
//
// Path: gmaven-adapter-api/src/main/java/org/codehaus/gmaven/adapter/ScriptExecutor.java
// @SuppressWarnings("JavadocReference")
// public interface ScriptExecutor
// {
// @Nullable
// Object execute(ClassSource classSource,
// ClassLoader classLoader,
// ResourceLoader resourceLoader,
// Map<String, Object> context,
// @Nullable Map<String, Object> options)
// throws Exception;
// }
//
// Path: gmaven-adapter-api/src/main/java/org/codehaus/gmaven/adapter/ShellRunner.java
// @SuppressWarnings("JavadocReference")
// public interface ShellRunner
// {
// void run(ClassLoader classLoader,
// ResourceLoader resourceLoader,
// Map<String, Object> context,
// @Nullable Map<String, Object> options)
// throws Exception;
// }
| import java.io.IOException;
import java.net.MalformedURLException;
import java.net.URL;
import java.security.AccessController;
import java.security.PrivilegedAction;
import java.util.Map;
import java.util.Map.Entry;
import com.google.common.base.Throwables;
import groovy.lang.Binding;
import groovy.lang.Closure;
import groovy.lang.GroovyClassLoader;
import groovy.lang.GroovyCodeSource;
import groovy.lang.GroovyResourceLoader;
import groovy.util.AntBuilder;
import org.apache.tools.ant.BuildLogger;
import org.codehaus.gmaven.adapter.ClassSource;
import org.codehaus.gmaven.adapter.ClassSource.Inline;
import org.codehaus.gmaven.adapter.ClosureTarget;
import org.codehaus.gmaven.adapter.ConsoleWindow;
import org.codehaus.gmaven.adapter.GroovyRuntime;
import org.codehaus.gmaven.adapter.MagicContext;
import org.codehaus.gmaven.adapter.ResourceLoader;
import org.codehaus.gmaven.adapter.ScriptExecutor;
import org.codehaus.gmaven.adapter.ShellRunner;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import static com.google.common.base.Preconditions.checkNotNull; | }
/**
* Creates a {@link GroovyResourceLoader} from a {@link ResourceLoader}.
*/
public GroovyResourceLoader createGroovyResourceLoader(final ResourceLoader resourceLoader) {
checkNotNull(resourceLoader);
return new GroovyResourceLoader()
{
@Override
public URL loadGroovySource(final String name) throws MalformedURLException {
return resourceLoader.loadResource(name);
}
};
}
/**
* Creates a {@link GroovyCodeSource} from a {@link ClassSource}.
*/
public GroovyCodeSource createGroovyCodeSource(final ClassSource source) throws IOException {
checkNotNull(source);
if (source.getUrl() != null) {
return new GroovyCodeSource(source.getUrl());
}
if (source.getFile() != null) {
return new GroovyCodeSource(source.getFile());
}
if (source.getInline() != null) { | // Path: gmaven-adapter-api/src/main/java/org/codehaus/gmaven/adapter/ClassSource.java
// @SuppressWarnings("JavadocReference")
// public interface ClassSource
// {
// URL getUrl();
//
// File getFile();
//
// interface Inline
// {
// String getName();
//
// String getCodeBase();
//
// Reader getInput();
// }
//
// Inline getInline();
// }
//
// Path: gmaven-adapter-api/src/main/java/org/codehaus/gmaven/adapter/ClassSource.java
// interface Inline
// {
// String getName();
//
// String getCodeBase();
//
// Reader getInput();
// }
//
// Path: gmaven-adapter-api/src/main/java/org/codehaus/gmaven/adapter/ClosureTarget.java
// @SuppressWarnings("JavadocReference")
// public interface ClosureTarget
// {
// @Nullable
// Object call(Object[] args) throws Exception;
// }
//
// Path: gmaven-adapter-api/src/main/java/org/codehaus/gmaven/adapter/ConsoleWindow.java
// @SuppressWarnings("JavadocReference")
// public interface ConsoleWindow
// {
// interface WindowHandle
// {
// void close();
//
// void await() throws InterruptedException;
// }
//
// WindowHandle open(ClassLoader classLoader,
// ResourceLoader resourceLoader,
// Map<String, Object> context,
// @Nullable Map<String, Object> options)
// throws Exception;
// }
//
// Path: gmaven-adapter-api/src/main/java/org/codehaus/gmaven/adapter/GroovyRuntime.java
// public interface GroovyRuntime
// {
// ScriptExecutor createScriptExecutor();
//
// ConsoleWindow createConsoleWindow();
//
// ShellRunner createShellRunner();
//
// void cleanup();
// }
//
// Path: gmaven-adapter-api/src/main/java/org/codehaus/gmaven/adapter/MagicContext.java
// public enum MagicContext
// {
// /**
// * Context value will be replaced by a {@link groovy.util.AntBuilder} instance.
// */
// @SuppressWarnings("JavadocReference")
// ANT_BUILDER
// }
//
// Path: gmaven-adapter-api/src/main/java/org/codehaus/gmaven/adapter/ResourceLoader.java
// @SuppressWarnings("JavadocReference")
// public interface ResourceLoader
// {
// @Nullable
// URL loadResource(String name) throws MalformedURLException;
// }
//
// Path: gmaven-adapter-api/src/main/java/org/codehaus/gmaven/adapter/ScriptExecutor.java
// @SuppressWarnings("JavadocReference")
// public interface ScriptExecutor
// {
// @Nullable
// Object execute(ClassSource classSource,
// ClassLoader classLoader,
// ResourceLoader resourceLoader,
// Map<String, Object> context,
// @Nullable Map<String, Object> options)
// throws Exception;
// }
//
// Path: gmaven-adapter-api/src/main/java/org/codehaus/gmaven/adapter/ShellRunner.java
// @SuppressWarnings("JavadocReference")
// public interface ShellRunner
// {
// void run(ClassLoader classLoader,
// ResourceLoader resourceLoader,
// Map<String, Object> context,
// @Nullable Map<String, Object> options)
// throws Exception;
// }
// Path: gmaven-adapter-impl/src/main/java/org/codehaus/gmaven/adapter/impl/GroovyRuntimeImpl.java
import java.io.IOException;
import java.net.MalformedURLException;
import java.net.URL;
import java.security.AccessController;
import java.security.PrivilegedAction;
import java.util.Map;
import java.util.Map.Entry;
import com.google.common.base.Throwables;
import groovy.lang.Binding;
import groovy.lang.Closure;
import groovy.lang.GroovyClassLoader;
import groovy.lang.GroovyCodeSource;
import groovy.lang.GroovyResourceLoader;
import groovy.util.AntBuilder;
import org.apache.tools.ant.BuildLogger;
import org.codehaus.gmaven.adapter.ClassSource;
import org.codehaus.gmaven.adapter.ClassSource.Inline;
import org.codehaus.gmaven.adapter.ClosureTarget;
import org.codehaus.gmaven.adapter.ConsoleWindow;
import org.codehaus.gmaven.adapter.GroovyRuntime;
import org.codehaus.gmaven.adapter.MagicContext;
import org.codehaus.gmaven.adapter.ResourceLoader;
import org.codehaus.gmaven.adapter.ScriptExecutor;
import org.codehaus.gmaven.adapter.ShellRunner;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import static com.google.common.base.Preconditions.checkNotNull;
}
/**
* Creates a {@link GroovyResourceLoader} from a {@link ResourceLoader}.
*/
public GroovyResourceLoader createGroovyResourceLoader(final ResourceLoader resourceLoader) {
checkNotNull(resourceLoader);
return new GroovyResourceLoader()
{
@Override
public URL loadGroovySource(final String name) throws MalformedURLException {
return resourceLoader.loadResource(name);
}
};
}
/**
* Creates a {@link GroovyCodeSource} from a {@link ClassSource}.
*/
public GroovyCodeSource createGroovyCodeSource(final ClassSource source) throws IOException {
checkNotNull(source);
if (source.getUrl() != null) {
return new GroovyCodeSource(source.getUrl());
}
if (source.getFile() != null) {
return new GroovyCodeSource(source.getFile());
}
if (source.getInline() != null) { | Inline inline = source.getInline(); |
groovy/gmaven | gmaven-adapter-impl/src/main/java/org/codehaus/gmaven/adapter/impl/GroovyRuntimeImpl.java | // Path: gmaven-adapter-api/src/main/java/org/codehaus/gmaven/adapter/ClassSource.java
// @SuppressWarnings("JavadocReference")
// public interface ClassSource
// {
// URL getUrl();
//
// File getFile();
//
// interface Inline
// {
// String getName();
//
// String getCodeBase();
//
// Reader getInput();
// }
//
// Inline getInline();
// }
//
// Path: gmaven-adapter-api/src/main/java/org/codehaus/gmaven/adapter/ClassSource.java
// interface Inline
// {
// String getName();
//
// String getCodeBase();
//
// Reader getInput();
// }
//
// Path: gmaven-adapter-api/src/main/java/org/codehaus/gmaven/adapter/ClosureTarget.java
// @SuppressWarnings("JavadocReference")
// public interface ClosureTarget
// {
// @Nullable
// Object call(Object[] args) throws Exception;
// }
//
// Path: gmaven-adapter-api/src/main/java/org/codehaus/gmaven/adapter/ConsoleWindow.java
// @SuppressWarnings("JavadocReference")
// public interface ConsoleWindow
// {
// interface WindowHandle
// {
// void close();
//
// void await() throws InterruptedException;
// }
//
// WindowHandle open(ClassLoader classLoader,
// ResourceLoader resourceLoader,
// Map<String, Object> context,
// @Nullable Map<String, Object> options)
// throws Exception;
// }
//
// Path: gmaven-adapter-api/src/main/java/org/codehaus/gmaven/adapter/GroovyRuntime.java
// public interface GroovyRuntime
// {
// ScriptExecutor createScriptExecutor();
//
// ConsoleWindow createConsoleWindow();
//
// ShellRunner createShellRunner();
//
// void cleanup();
// }
//
// Path: gmaven-adapter-api/src/main/java/org/codehaus/gmaven/adapter/MagicContext.java
// public enum MagicContext
// {
// /**
// * Context value will be replaced by a {@link groovy.util.AntBuilder} instance.
// */
// @SuppressWarnings("JavadocReference")
// ANT_BUILDER
// }
//
// Path: gmaven-adapter-api/src/main/java/org/codehaus/gmaven/adapter/ResourceLoader.java
// @SuppressWarnings("JavadocReference")
// public interface ResourceLoader
// {
// @Nullable
// URL loadResource(String name) throws MalformedURLException;
// }
//
// Path: gmaven-adapter-api/src/main/java/org/codehaus/gmaven/adapter/ScriptExecutor.java
// @SuppressWarnings("JavadocReference")
// public interface ScriptExecutor
// {
// @Nullable
// Object execute(ClassSource classSource,
// ClassLoader classLoader,
// ResourceLoader resourceLoader,
// Map<String, Object> context,
// @Nullable Map<String, Object> options)
// throws Exception;
// }
//
// Path: gmaven-adapter-api/src/main/java/org/codehaus/gmaven/adapter/ShellRunner.java
// @SuppressWarnings("JavadocReference")
// public interface ShellRunner
// {
// void run(ClassLoader classLoader,
// ResourceLoader resourceLoader,
// Map<String, Object> context,
// @Nullable Map<String, Object> options)
// throws Exception;
// }
| import java.io.IOException;
import java.net.MalformedURLException;
import java.net.URL;
import java.security.AccessController;
import java.security.PrivilegedAction;
import java.util.Map;
import java.util.Map.Entry;
import com.google.common.base.Throwables;
import groovy.lang.Binding;
import groovy.lang.Closure;
import groovy.lang.GroovyClassLoader;
import groovy.lang.GroovyCodeSource;
import groovy.lang.GroovyResourceLoader;
import groovy.util.AntBuilder;
import org.apache.tools.ant.BuildLogger;
import org.codehaus.gmaven.adapter.ClassSource;
import org.codehaus.gmaven.adapter.ClassSource.Inline;
import org.codehaus.gmaven.adapter.ClosureTarget;
import org.codehaus.gmaven.adapter.ConsoleWindow;
import org.codehaus.gmaven.adapter.GroovyRuntime;
import org.codehaus.gmaven.adapter.MagicContext;
import org.codehaus.gmaven.adapter.ResourceLoader;
import org.codehaus.gmaven.adapter.ScriptExecutor;
import org.codehaus.gmaven.adapter.ShellRunner;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import static com.google.common.base.Preconditions.checkNotNull; | @Override
public URL loadGroovySource(final String name) throws MalformedURLException {
return resourceLoader.loadResource(name);
}
};
}
/**
* Creates a {@link GroovyCodeSource} from a {@link ClassSource}.
*/
public GroovyCodeSource createGroovyCodeSource(final ClassSource source) throws IOException {
checkNotNull(source);
if (source.getUrl() != null) {
return new GroovyCodeSource(source.getUrl());
}
if (source.getFile() != null) {
return new GroovyCodeSource(source.getFile());
}
if (source.getInline() != null) {
Inline inline = source.getInline();
return new GroovyCodeSource(inline.getInput(), inline.getName(), inline.getCodeBase());
}
throw new Error("Unable to create GroovyCodeSource from: " + source);
}
/**
* Creates a {@link Closure} from a {@link ClosureTarget}.
*/ | // Path: gmaven-adapter-api/src/main/java/org/codehaus/gmaven/adapter/ClassSource.java
// @SuppressWarnings("JavadocReference")
// public interface ClassSource
// {
// URL getUrl();
//
// File getFile();
//
// interface Inline
// {
// String getName();
//
// String getCodeBase();
//
// Reader getInput();
// }
//
// Inline getInline();
// }
//
// Path: gmaven-adapter-api/src/main/java/org/codehaus/gmaven/adapter/ClassSource.java
// interface Inline
// {
// String getName();
//
// String getCodeBase();
//
// Reader getInput();
// }
//
// Path: gmaven-adapter-api/src/main/java/org/codehaus/gmaven/adapter/ClosureTarget.java
// @SuppressWarnings("JavadocReference")
// public interface ClosureTarget
// {
// @Nullable
// Object call(Object[] args) throws Exception;
// }
//
// Path: gmaven-adapter-api/src/main/java/org/codehaus/gmaven/adapter/ConsoleWindow.java
// @SuppressWarnings("JavadocReference")
// public interface ConsoleWindow
// {
// interface WindowHandle
// {
// void close();
//
// void await() throws InterruptedException;
// }
//
// WindowHandle open(ClassLoader classLoader,
// ResourceLoader resourceLoader,
// Map<String, Object> context,
// @Nullable Map<String, Object> options)
// throws Exception;
// }
//
// Path: gmaven-adapter-api/src/main/java/org/codehaus/gmaven/adapter/GroovyRuntime.java
// public interface GroovyRuntime
// {
// ScriptExecutor createScriptExecutor();
//
// ConsoleWindow createConsoleWindow();
//
// ShellRunner createShellRunner();
//
// void cleanup();
// }
//
// Path: gmaven-adapter-api/src/main/java/org/codehaus/gmaven/adapter/MagicContext.java
// public enum MagicContext
// {
// /**
// * Context value will be replaced by a {@link groovy.util.AntBuilder} instance.
// */
// @SuppressWarnings("JavadocReference")
// ANT_BUILDER
// }
//
// Path: gmaven-adapter-api/src/main/java/org/codehaus/gmaven/adapter/ResourceLoader.java
// @SuppressWarnings("JavadocReference")
// public interface ResourceLoader
// {
// @Nullable
// URL loadResource(String name) throws MalformedURLException;
// }
//
// Path: gmaven-adapter-api/src/main/java/org/codehaus/gmaven/adapter/ScriptExecutor.java
// @SuppressWarnings("JavadocReference")
// public interface ScriptExecutor
// {
// @Nullable
// Object execute(ClassSource classSource,
// ClassLoader classLoader,
// ResourceLoader resourceLoader,
// Map<String, Object> context,
// @Nullable Map<String, Object> options)
// throws Exception;
// }
//
// Path: gmaven-adapter-api/src/main/java/org/codehaus/gmaven/adapter/ShellRunner.java
// @SuppressWarnings("JavadocReference")
// public interface ShellRunner
// {
// void run(ClassLoader classLoader,
// ResourceLoader resourceLoader,
// Map<String, Object> context,
// @Nullable Map<String, Object> options)
// throws Exception;
// }
// Path: gmaven-adapter-impl/src/main/java/org/codehaus/gmaven/adapter/impl/GroovyRuntimeImpl.java
import java.io.IOException;
import java.net.MalformedURLException;
import java.net.URL;
import java.security.AccessController;
import java.security.PrivilegedAction;
import java.util.Map;
import java.util.Map.Entry;
import com.google.common.base.Throwables;
import groovy.lang.Binding;
import groovy.lang.Closure;
import groovy.lang.GroovyClassLoader;
import groovy.lang.GroovyCodeSource;
import groovy.lang.GroovyResourceLoader;
import groovy.util.AntBuilder;
import org.apache.tools.ant.BuildLogger;
import org.codehaus.gmaven.adapter.ClassSource;
import org.codehaus.gmaven.adapter.ClassSource.Inline;
import org.codehaus.gmaven.adapter.ClosureTarget;
import org.codehaus.gmaven.adapter.ConsoleWindow;
import org.codehaus.gmaven.adapter.GroovyRuntime;
import org.codehaus.gmaven.adapter.MagicContext;
import org.codehaus.gmaven.adapter.ResourceLoader;
import org.codehaus.gmaven.adapter.ScriptExecutor;
import org.codehaus.gmaven.adapter.ShellRunner;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import static com.google.common.base.Preconditions.checkNotNull;
@Override
public URL loadGroovySource(final String name) throws MalformedURLException {
return resourceLoader.loadResource(name);
}
};
}
/**
* Creates a {@link GroovyCodeSource} from a {@link ClassSource}.
*/
public GroovyCodeSource createGroovyCodeSource(final ClassSource source) throws IOException {
checkNotNull(source);
if (source.getUrl() != null) {
return new GroovyCodeSource(source.getUrl());
}
if (source.getFile() != null) {
return new GroovyCodeSource(source.getFile());
}
if (source.getInline() != null) {
Inline inline = source.getInline();
return new GroovyCodeSource(inline.getInput(), inline.getName(), inline.getCodeBase());
}
throw new Error("Unable to create GroovyCodeSource from: " + source);
}
/**
* Creates a {@link Closure} from a {@link ClosureTarget}.
*/ | public Closure createClosure(final Object owner, final ClosureTarget target) { |
groovy/gmaven | gmaven-adapter-impl/src/main/java/org/codehaus/gmaven/adapter/impl/GroovyRuntimeImpl.java | // Path: gmaven-adapter-api/src/main/java/org/codehaus/gmaven/adapter/ClassSource.java
// @SuppressWarnings("JavadocReference")
// public interface ClassSource
// {
// URL getUrl();
//
// File getFile();
//
// interface Inline
// {
// String getName();
//
// String getCodeBase();
//
// Reader getInput();
// }
//
// Inline getInline();
// }
//
// Path: gmaven-adapter-api/src/main/java/org/codehaus/gmaven/adapter/ClassSource.java
// interface Inline
// {
// String getName();
//
// String getCodeBase();
//
// Reader getInput();
// }
//
// Path: gmaven-adapter-api/src/main/java/org/codehaus/gmaven/adapter/ClosureTarget.java
// @SuppressWarnings("JavadocReference")
// public interface ClosureTarget
// {
// @Nullable
// Object call(Object[] args) throws Exception;
// }
//
// Path: gmaven-adapter-api/src/main/java/org/codehaus/gmaven/adapter/ConsoleWindow.java
// @SuppressWarnings("JavadocReference")
// public interface ConsoleWindow
// {
// interface WindowHandle
// {
// void close();
//
// void await() throws InterruptedException;
// }
//
// WindowHandle open(ClassLoader classLoader,
// ResourceLoader resourceLoader,
// Map<String, Object> context,
// @Nullable Map<String, Object> options)
// throws Exception;
// }
//
// Path: gmaven-adapter-api/src/main/java/org/codehaus/gmaven/adapter/GroovyRuntime.java
// public interface GroovyRuntime
// {
// ScriptExecutor createScriptExecutor();
//
// ConsoleWindow createConsoleWindow();
//
// ShellRunner createShellRunner();
//
// void cleanup();
// }
//
// Path: gmaven-adapter-api/src/main/java/org/codehaus/gmaven/adapter/MagicContext.java
// public enum MagicContext
// {
// /**
// * Context value will be replaced by a {@link groovy.util.AntBuilder} instance.
// */
// @SuppressWarnings("JavadocReference")
// ANT_BUILDER
// }
//
// Path: gmaven-adapter-api/src/main/java/org/codehaus/gmaven/adapter/ResourceLoader.java
// @SuppressWarnings("JavadocReference")
// public interface ResourceLoader
// {
// @Nullable
// URL loadResource(String name) throws MalformedURLException;
// }
//
// Path: gmaven-adapter-api/src/main/java/org/codehaus/gmaven/adapter/ScriptExecutor.java
// @SuppressWarnings("JavadocReference")
// public interface ScriptExecutor
// {
// @Nullable
// Object execute(ClassSource classSource,
// ClassLoader classLoader,
// ResourceLoader resourceLoader,
// Map<String, Object> context,
// @Nullable Map<String, Object> options)
// throws Exception;
// }
//
// Path: gmaven-adapter-api/src/main/java/org/codehaus/gmaven/adapter/ShellRunner.java
// @SuppressWarnings("JavadocReference")
// public interface ShellRunner
// {
// void run(ClassLoader classLoader,
// ResourceLoader resourceLoader,
// Map<String, Object> context,
// @Nullable Map<String, Object> options)
// throws Exception;
// }
| import java.io.IOException;
import java.net.MalformedURLException;
import java.net.URL;
import java.security.AccessController;
import java.security.PrivilegedAction;
import java.util.Map;
import java.util.Map.Entry;
import com.google.common.base.Throwables;
import groovy.lang.Binding;
import groovy.lang.Closure;
import groovy.lang.GroovyClassLoader;
import groovy.lang.GroovyCodeSource;
import groovy.lang.GroovyResourceLoader;
import groovy.util.AntBuilder;
import org.apache.tools.ant.BuildLogger;
import org.codehaus.gmaven.adapter.ClassSource;
import org.codehaus.gmaven.adapter.ClassSource.Inline;
import org.codehaus.gmaven.adapter.ClosureTarget;
import org.codehaus.gmaven.adapter.ConsoleWindow;
import org.codehaus.gmaven.adapter.GroovyRuntime;
import org.codehaus.gmaven.adapter.MagicContext;
import org.codehaus.gmaven.adapter.ResourceLoader;
import org.codehaus.gmaven.adapter.ScriptExecutor;
import org.codehaus.gmaven.adapter.ShellRunner;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import static com.google.common.base.Preconditions.checkNotNull; |
/**
* Creates a {@link Closure} from a {@link ClosureTarget}.
*/
public Closure createClosure(final Object owner, final ClosureTarget target) {
checkNotNull(owner);
checkNotNull(target);
return new Closure(owner)
{
@Override
public Object call(final Object[] args) {
try {
return target.call(args);
}
catch (Exception e) {
throw Throwables.propagate(e);
}
}
@Override
public String toString() {
return Closure.class.getSimpleName() + "{owner=" + owner + ", target=" + target + "}";
}
};
}
/**
* Create an object for a {@link MagicContext} entry.
*/ | // Path: gmaven-adapter-api/src/main/java/org/codehaus/gmaven/adapter/ClassSource.java
// @SuppressWarnings("JavadocReference")
// public interface ClassSource
// {
// URL getUrl();
//
// File getFile();
//
// interface Inline
// {
// String getName();
//
// String getCodeBase();
//
// Reader getInput();
// }
//
// Inline getInline();
// }
//
// Path: gmaven-adapter-api/src/main/java/org/codehaus/gmaven/adapter/ClassSource.java
// interface Inline
// {
// String getName();
//
// String getCodeBase();
//
// Reader getInput();
// }
//
// Path: gmaven-adapter-api/src/main/java/org/codehaus/gmaven/adapter/ClosureTarget.java
// @SuppressWarnings("JavadocReference")
// public interface ClosureTarget
// {
// @Nullable
// Object call(Object[] args) throws Exception;
// }
//
// Path: gmaven-adapter-api/src/main/java/org/codehaus/gmaven/adapter/ConsoleWindow.java
// @SuppressWarnings("JavadocReference")
// public interface ConsoleWindow
// {
// interface WindowHandle
// {
// void close();
//
// void await() throws InterruptedException;
// }
//
// WindowHandle open(ClassLoader classLoader,
// ResourceLoader resourceLoader,
// Map<String, Object> context,
// @Nullable Map<String, Object> options)
// throws Exception;
// }
//
// Path: gmaven-adapter-api/src/main/java/org/codehaus/gmaven/adapter/GroovyRuntime.java
// public interface GroovyRuntime
// {
// ScriptExecutor createScriptExecutor();
//
// ConsoleWindow createConsoleWindow();
//
// ShellRunner createShellRunner();
//
// void cleanup();
// }
//
// Path: gmaven-adapter-api/src/main/java/org/codehaus/gmaven/adapter/MagicContext.java
// public enum MagicContext
// {
// /**
// * Context value will be replaced by a {@link groovy.util.AntBuilder} instance.
// */
// @SuppressWarnings("JavadocReference")
// ANT_BUILDER
// }
//
// Path: gmaven-adapter-api/src/main/java/org/codehaus/gmaven/adapter/ResourceLoader.java
// @SuppressWarnings("JavadocReference")
// public interface ResourceLoader
// {
// @Nullable
// URL loadResource(String name) throws MalformedURLException;
// }
//
// Path: gmaven-adapter-api/src/main/java/org/codehaus/gmaven/adapter/ScriptExecutor.java
// @SuppressWarnings("JavadocReference")
// public interface ScriptExecutor
// {
// @Nullable
// Object execute(ClassSource classSource,
// ClassLoader classLoader,
// ResourceLoader resourceLoader,
// Map<String, Object> context,
// @Nullable Map<String, Object> options)
// throws Exception;
// }
//
// Path: gmaven-adapter-api/src/main/java/org/codehaus/gmaven/adapter/ShellRunner.java
// @SuppressWarnings("JavadocReference")
// public interface ShellRunner
// {
// void run(ClassLoader classLoader,
// ResourceLoader resourceLoader,
// Map<String, Object> context,
// @Nullable Map<String, Object> options)
// throws Exception;
// }
// Path: gmaven-adapter-impl/src/main/java/org/codehaus/gmaven/adapter/impl/GroovyRuntimeImpl.java
import java.io.IOException;
import java.net.MalformedURLException;
import java.net.URL;
import java.security.AccessController;
import java.security.PrivilegedAction;
import java.util.Map;
import java.util.Map.Entry;
import com.google.common.base.Throwables;
import groovy.lang.Binding;
import groovy.lang.Closure;
import groovy.lang.GroovyClassLoader;
import groovy.lang.GroovyCodeSource;
import groovy.lang.GroovyResourceLoader;
import groovy.util.AntBuilder;
import org.apache.tools.ant.BuildLogger;
import org.codehaus.gmaven.adapter.ClassSource;
import org.codehaus.gmaven.adapter.ClassSource.Inline;
import org.codehaus.gmaven.adapter.ClosureTarget;
import org.codehaus.gmaven.adapter.ConsoleWindow;
import org.codehaus.gmaven.adapter.GroovyRuntime;
import org.codehaus.gmaven.adapter.MagicContext;
import org.codehaus.gmaven.adapter.ResourceLoader;
import org.codehaus.gmaven.adapter.ScriptExecutor;
import org.codehaus.gmaven.adapter.ShellRunner;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import static com.google.common.base.Preconditions.checkNotNull;
/**
* Creates a {@link Closure} from a {@link ClosureTarget}.
*/
public Closure createClosure(final Object owner, final ClosureTarget target) {
checkNotNull(owner);
checkNotNull(target);
return new Closure(owner)
{
@Override
public Object call(final Object[] args) {
try {
return target.call(args);
}
catch (Exception e) {
throw Throwables.propagate(e);
}
}
@Override
public String toString() {
return Closure.class.getSimpleName() + "{owner=" + owner + ", target=" + target + "}";
}
};
}
/**
* Create an object for a {@link MagicContext} entry.
*/ | public Object createMagicContextValue(final MagicContext magic) { |
groovy/gmaven | gmaven-adapter-impl/src/main/java/org/codehaus/gmaven/adapter/impl/ScriptExecutorImpl.java | // Path: gmaven-adapter-api/src/main/java/org/codehaus/gmaven/adapter/ClassSource.java
// @SuppressWarnings("JavadocReference")
// public interface ClassSource
// {
// URL getUrl();
//
// File getFile();
//
// interface Inline
// {
// String getName();
//
// String getCodeBase();
//
// Reader getInput();
// }
//
// Inline getInline();
// }
//
// Path: gmaven-adapter-api/src/main/java/org/codehaus/gmaven/adapter/ResourceLoader.java
// @SuppressWarnings("JavadocReference")
// public interface ResourceLoader
// {
// @Nullable
// URL loadResource(String name) throws MalformedURLException;
// }
//
// Path: gmaven-adapter-api/src/main/java/org/codehaus/gmaven/adapter/ScriptExecutor.java
// @SuppressWarnings("JavadocReference")
// public interface ScriptExecutor
// {
// @Nullable
// Object execute(ClassSource classSource,
// ClassLoader classLoader,
// ResourceLoader resourceLoader,
// Map<String, Object> context,
// @Nullable Map<String, Object> options)
// throws Exception;
// }
| import static com.google.common.base.Preconditions.checkNotNull;
import java.util.Map;
import javax.annotation.Nullable;
import groovy.lang.Binding;
import groovy.lang.GroovyClassLoader;
import groovy.lang.GroovyCodeSource;
import groovy.lang.GroovyShell;
import org.codehaus.gmaven.adapter.ClassSource;
import org.codehaus.gmaven.adapter.ResourceLoader;
import org.codehaus.gmaven.adapter.ScriptExecutor;
import org.codehaus.groovy.control.CompilerConfiguration;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory; | /*
* Copyright (c) 2006-present the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.codehaus.gmaven.adapter.impl;
/**
* Default {@link ScriptExecutor} implementation.
*
* @since 2.0
*/
public class ScriptExecutorImpl
implements ScriptExecutor
{
private final Logger log = LoggerFactory.getLogger(getClass());
private final GroovyRuntimeImpl runtime;
ScriptExecutorImpl(final GroovyRuntimeImpl runtime) {
this.runtime = checkNotNull(runtime);
}
@Override
@Nullable | // Path: gmaven-adapter-api/src/main/java/org/codehaus/gmaven/adapter/ClassSource.java
// @SuppressWarnings("JavadocReference")
// public interface ClassSource
// {
// URL getUrl();
//
// File getFile();
//
// interface Inline
// {
// String getName();
//
// String getCodeBase();
//
// Reader getInput();
// }
//
// Inline getInline();
// }
//
// Path: gmaven-adapter-api/src/main/java/org/codehaus/gmaven/adapter/ResourceLoader.java
// @SuppressWarnings("JavadocReference")
// public interface ResourceLoader
// {
// @Nullable
// URL loadResource(String name) throws MalformedURLException;
// }
//
// Path: gmaven-adapter-api/src/main/java/org/codehaus/gmaven/adapter/ScriptExecutor.java
// @SuppressWarnings("JavadocReference")
// public interface ScriptExecutor
// {
// @Nullable
// Object execute(ClassSource classSource,
// ClassLoader classLoader,
// ResourceLoader resourceLoader,
// Map<String, Object> context,
// @Nullable Map<String, Object> options)
// throws Exception;
// }
// Path: gmaven-adapter-impl/src/main/java/org/codehaus/gmaven/adapter/impl/ScriptExecutorImpl.java
import static com.google.common.base.Preconditions.checkNotNull;
import java.util.Map;
import javax.annotation.Nullable;
import groovy.lang.Binding;
import groovy.lang.GroovyClassLoader;
import groovy.lang.GroovyCodeSource;
import groovy.lang.GroovyShell;
import org.codehaus.gmaven.adapter.ClassSource;
import org.codehaus.gmaven.adapter.ResourceLoader;
import org.codehaus.gmaven.adapter.ScriptExecutor;
import org.codehaus.groovy.control.CompilerConfiguration;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/*
* Copyright (c) 2006-present the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.codehaus.gmaven.adapter.impl;
/**
* Default {@link ScriptExecutor} implementation.
*
* @since 2.0
*/
public class ScriptExecutorImpl
implements ScriptExecutor
{
private final Logger log = LoggerFactory.getLogger(getClass());
private final GroovyRuntimeImpl runtime;
ScriptExecutorImpl(final GroovyRuntimeImpl runtime) {
this.runtime = checkNotNull(runtime);
}
@Override
@Nullable | public Object execute(final ClassSource classSource, |
groovy/gmaven | gmaven-adapter-impl/src/main/java/org/codehaus/gmaven/adapter/impl/ScriptExecutorImpl.java | // Path: gmaven-adapter-api/src/main/java/org/codehaus/gmaven/adapter/ClassSource.java
// @SuppressWarnings("JavadocReference")
// public interface ClassSource
// {
// URL getUrl();
//
// File getFile();
//
// interface Inline
// {
// String getName();
//
// String getCodeBase();
//
// Reader getInput();
// }
//
// Inline getInline();
// }
//
// Path: gmaven-adapter-api/src/main/java/org/codehaus/gmaven/adapter/ResourceLoader.java
// @SuppressWarnings("JavadocReference")
// public interface ResourceLoader
// {
// @Nullable
// URL loadResource(String name) throws MalformedURLException;
// }
//
// Path: gmaven-adapter-api/src/main/java/org/codehaus/gmaven/adapter/ScriptExecutor.java
// @SuppressWarnings("JavadocReference")
// public interface ScriptExecutor
// {
// @Nullable
// Object execute(ClassSource classSource,
// ClassLoader classLoader,
// ResourceLoader resourceLoader,
// Map<String, Object> context,
// @Nullable Map<String, Object> options)
// throws Exception;
// }
| import static com.google.common.base.Preconditions.checkNotNull;
import java.util.Map;
import javax.annotation.Nullable;
import groovy.lang.Binding;
import groovy.lang.GroovyClassLoader;
import groovy.lang.GroovyCodeSource;
import groovy.lang.GroovyShell;
import org.codehaus.gmaven.adapter.ClassSource;
import org.codehaus.gmaven.adapter.ResourceLoader;
import org.codehaus.gmaven.adapter.ScriptExecutor;
import org.codehaus.groovy.control.CompilerConfiguration;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory; | /*
* Copyright (c) 2006-present the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.codehaus.gmaven.adapter.impl;
/**
* Default {@link ScriptExecutor} implementation.
*
* @since 2.0
*/
public class ScriptExecutorImpl
implements ScriptExecutor
{
private final Logger log = LoggerFactory.getLogger(getClass());
private final GroovyRuntimeImpl runtime;
ScriptExecutorImpl(final GroovyRuntimeImpl runtime) {
this.runtime = checkNotNull(runtime);
}
@Override
@Nullable
public Object execute(final ClassSource classSource,
final ClassLoader classLoader, | // Path: gmaven-adapter-api/src/main/java/org/codehaus/gmaven/adapter/ClassSource.java
// @SuppressWarnings("JavadocReference")
// public interface ClassSource
// {
// URL getUrl();
//
// File getFile();
//
// interface Inline
// {
// String getName();
//
// String getCodeBase();
//
// Reader getInput();
// }
//
// Inline getInline();
// }
//
// Path: gmaven-adapter-api/src/main/java/org/codehaus/gmaven/adapter/ResourceLoader.java
// @SuppressWarnings("JavadocReference")
// public interface ResourceLoader
// {
// @Nullable
// URL loadResource(String name) throws MalformedURLException;
// }
//
// Path: gmaven-adapter-api/src/main/java/org/codehaus/gmaven/adapter/ScriptExecutor.java
// @SuppressWarnings("JavadocReference")
// public interface ScriptExecutor
// {
// @Nullable
// Object execute(ClassSource classSource,
// ClassLoader classLoader,
// ResourceLoader resourceLoader,
// Map<String, Object> context,
// @Nullable Map<String, Object> options)
// throws Exception;
// }
// Path: gmaven-adapter-impl/src/main/java/org/codehaus/gmaven/adapter/impl/ScriptExecutorImpl.java
import static com.google.common.base.Preconditions.checkNotNull;
import java.util.Map;
import javax.annotation.Nullable;
import groovy.lang.Binding;
import groovy.lang.GroovyClassLoader;
import groovy.lang.GroovyCodeSource;
import groovy.lang.GroovyShell;
import org.codehaus.gmaven.adapter.ClassSource;
import org.codehaus.gmaven.adapter.ResourceLoader;
import org.codehaus.gmaven.adapter.ScriptExecutor;
import org.codehaus.groovy.control.CompilerConfiguration;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/*
* Copyright (c) 2006-present the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.codehaus.gmaven.adapter.impl;
/**
* Default {@link ScriptExecutor} implementation.
*
* @since 2.0
*/
public class ScriptExecutorImpl
implements ScriptExecutor
{
private final Logger log = LoggerFactory.getLogger(getClass());
private final GroovyRuntimeImpl runtime;
ScriptExecutorImpl(final GroovyRuntimeImpl runtime) {
this.runtime = checkNotNull(runtime);
}
@Override
@Nullable
public Object execute(final ClassSource classSource,
final ClassLoader classLoader, | final ResourceLoader resourceLoader, |
groovy/gmaven | groovy-maven-plugin/src/test/java/org/codehaus/gmaven/plugin/GroovyRuntimeFactoryTest.java | // Path: gmaven-adapter-api/src/main/java/org/codehaus/gmaven/adapter/GroovyRuntime.java
// public interface GroovyRuntime
// {
// ScriptExecutor createScriptExecutor();
//
// ConsoleWindow createConsoleWindow();
//
// ShellRunner createShellRunner();
//
// void cleanup();
// }
| import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import org.sonatype.sisu.litmus.testsupport.TestSupport;
import org.codehaus.gmaven.adapter.GroovyRuntime;
import org.junit.Before;
import org.junit.Test;
import org.mockito.Mock;
import static org.hamcrest.Matchers.notNullValue;
import static org.junit.Assert.assertThat;
import static org.junit.Assert.fail;
import static org.mockito.Mockito.mock; | /*
* Copyright (c) 2006-present the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.codehaus.gmaven.plugin;
/**
* Tests for {@link GroovyRuntimeFactory}.
*
* These tests assume that the underlying {@link java.util.ServiceLoader} functions,
* so we by-pass it and only validate the handling around the loader.
*/
public class GroovyRuntimeFactoryTest
extends TestSupport
{
private GroovyRuntimeFactory underTest;
@Mock
private ClassLoader classLoader;
| // Path: gmaven-adapter-api/src/main/java/org/codehaus/gmaven/adapter/GroovyRuntime.java
// public interface GroovyRuntime
// {
// ScriptExecutor createScriptExecutor();
//
// ConsoleWindow createConsoleWindow();
//
// ShellRunner createShellRunner();
//
// void cleanup();
// }
// Path: groovy-maven-plugin/src/test/java/org/codehaus/gmaven/plugin/GroovyRuntimeFactoryTest.java
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import org.sonatype.sisu.litmus.testsupport.TestSupport;
import org.codehaus.gmaven.adapter.GroovyRuntime;
import org.junit.Before;
import org.junit.Test;
import org.mockito.Mock;
import static org.hamcrest.Matchers.notNullValue;
import static org.junit.Assert.assertThat;
import static org.junit.Assert.fail;
import static org.mockito.Mockito.mock;
/*
* Copyright (c) 2006-present the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.codehaus.gmaven.plugin;
/**
* Tests for {@link GroovyRuntimeFactory}.
*
* These tests assume that the underlying {@link java.util.ServiceLoader} functions,
* so we by-pass it and only validate the handling around the loader.
*/
public class GroovyRuntimeFactoryTest
extends TestSupport
{
private GroovyRuntimeFactory underTest;
@Mock
private ClassLoader classLoader;
| private List<GroovyRuntime> services; |
groovy/gmaven | groovy-maven-plugin/src/main/java/org/codehaus/gmaven/plugin/ClassSourceFactory.java | // Path: gmaven-adapter-api/src/main/java/org/codehaus/gmaven/adapter/ClassSource.java
// @SuppressWarnings("JavadocReference")
// public interface ClassSource
// {
// URL getUrl();
//
// File getFile();
//
// interface Inline
// {
// String getName();
//
// String getCodeBase();
//
// Reader getInput();
// }
//
// Inline getInline();
// }
//
// Path: gmaven-adapter-api/src/main/java/org/codehaus/gmaven/adapter/ClassSource.java
// interface Inline
// {
// String getName();
//
// String getCodeBase();
//
// Reader getInput();
// }
| import org.slf4j.LoggerFactory;
import static com.google.common.base.Preconditions.checkNotNull;
import java.io.File;
import java.io.IOException;
import java.io.Reader;
import java.io.StringReader;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.concurrent.atomic.AtomicInteger;
import javax.annotation.Nullable;
import com.google.common.annotations.VisibleForTesting;
import org.codehaus.gmaven.adapter.ClassSource;
import org.codehaus.gmaven.adapter.ClassSource.Inline;
import org.codehaus.plexus.component.annotations.Component;
import org.slf4j.Logger; | /*
* Copyright (c) 2006-present the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.codehaus.gmaven.plugin;
/**
* Creates {@link ClassSource} instances
*
* @since 2.0
*/
@Component(role = ClassSourceFactory.class)
public class ClassSourceFactory
{
private final Logger log = LoggerFactory.getLogger(getClass());
private static final class ClassSourceImpl | // Path: gmaven-adapter-api/src/main/java/org/codehaus/gmaven/adapter/ClassSource.java
// @SuppressWarnings("JavadocReference")
// public interface ClassSource
// {
// URL getUrl();
//
// File getFile();
//
// interface Inline
// {
// String getName();
//
// String getCodeBase();
//
// Reader getInput();
// }
//
// Inline getInline();
// }
//
// Path: gmaven-adapter-api/src/main/java/org/codehaus/gmaven/adapter/ClassSource.java
// interface Inline
// {
// String getName();
//
// String getCodeBase();
//
// Reader getInput();
// }
// Path: groovy-maven-plugin/src/main/java/org/codehaus/gmaven/plugin/ClassSourceFactory.java
import org.slf4j.LoggerFactory;
import static com.google.common.base.Preconditions.checkNotNull;
import java.io.File;
import java.io.IOException;
import java.io.Reader;
import java.io.StringReader;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.concurrent.atomic.AtomicInteger;
import javax.annotation.Nullable;
import com.google.common.annotations.VisibleForTesting;
import org.codehaus.gmaven.adapter.ClassSource;
import org.codehaus.gmaven.adapter.ClassSource.Inline;
import org.codehaus.plexus.component.annotations.Component;
import org.slf4j.Logger;
/*
* Copyright (c) 2006-present the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.codehaus.gmaven.plugin;
/**
* Creates {@link ClassSource} instances
*
* @since 2.0
*/
@Component(role = ClassSourceFactory.class)
public class ClassSourceFactory
{
private final Logger log = LoggerFactory.getLogger(getClass());
private static final class ClassSourceImpl | implements ClassSource |
groovy/gmaven | groovy-maven-plugin/src/main/java/org/codehaus/gmaven/plugin/ClassSourceFactory.java | // Path: gmaven-adapter-api/src/main/java/org/codehaus/gmaven/adapter/ClassSource.java
// @SuppressWarnings("JavadocReference")
// public interface ClassSource
// {
// URL getUrl();
//
// File getFile();
//
// interface Inline
// {
// String getName();
//
// String getCodeBase();
//
// Reader getInput();
// }
//
// Inline getInline();
// }
//
// Path: gmaven-adapter-api/src/main/java/org/codehaus/gmaven/adapter/ClassSource.java
// interface Inline
// {
// String getName();
//
// String getCodeBase();
//
// Reader getInput();
// }
| import org.slf4j.LoggerFactory;
import static com.google.common.base.Preconditions.checkNotNull;
import java.io.File;
import java.io.IOException;
import java.io.Reader;
import java.io.StringReader;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.concurrent.atomic.AtomicInteger;
import javax.annotation.Nullable;
import com.google.common.annotations.VisibleForTesting;
import org.codehaus.gmaven.adapter.ClassSource;
import org.codehaus.gmaven.adapter.ClassSource.Inline;
import org.codehaus.plexus.component.annotations.Component;
import org.slf4j.Logger; | /*
* Copyright (c) 2006-present the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.codehaus.gmaven.plugin;
/**
* Creates {@link ClassSource} instances
*
* @since 2.0
*/
@Component(role = ClassSourceFactory.class)
public class ClassSourceFactory
{
private final Logger log = LoggerFactory.getLogger(getClass());
private static final class ClassSourceImpl
implements ClassSource
{
private final URL url;
private final File file;
| // Path: gmaven-adapter-api/src/main/java/org/codehaus/gmaven/adapter/ClassSource.java
// @SuppressWarnings("JavadocReference")
// public interface ClassSource
// {
// URL getUrl();
//
// File getFile();
//
// interface Inline
// {
// String getName();
//
// String getCodeBase();
//
// Reader getInput();
// }
//
// Inline getInline();
// }
//
// Path: gmaven-adapter-api/src/main/java/org/codehaus/gmaven/adapter/ClassSource.java
// interface Inline
// {
// String getName();
//
// String getCodeBase();
//
// Reader getInput();
// }
// Path: groovy-maven-plugin/src/main/java/org/codehaus/gmaven/plugin/ClassSourceFactory.java
import org.slf4j.LoggerFactory;
import static com.google.common.base.Preconditions.checkNotNull;
import java.io.File;
import java.io.IOException;
import java.io.Reader;
import java.io.StringReader;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.concurrent.atomic.AtomicInteger;
import javax.annotation.Nullable;
import com.google.common.annotations.VisibleForTesting;
import org.codehaus.gmaven.adapter.ClassSource;
import org.codehaus.gmaven.adapter.ClassSource.Inline;
import org.codehaus.plexus.component.annotations.Component;
import org.slf4j.Logger;
/*
* Copyright (c) 2006-present the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.codehaus.gmaven.plugin;
/**
* Creates {@link ClassSource} instances
*
* @since 2.0
*/
@Component(role = ClassSourceFactory.class)
public class ClassSourceFactory
{
private final Logger log = LoggerFactory.getLogger(getClass());
private static final class ClassSourceImpl
implements ClassSource
{
private final URL url;
private final File file;
| private final Inline inline; |
groovy/gmaven | groovy-maven-plugin/src/main/java/org/codehaus/gmaven/plugin/ShellMojo.java | // Path: gmaven-adapter-api/src/main/java/org/codehaus/gmaven/adapter/ResourceLoader.java
// @SuppressWarnings("JavadocReference")
// public interface ResourceLoader
// {
// @Nullable
// URL loadResource(String name) throws MalformedURLException;
// }
//
// Path: gmaven-adapter-api/src/main/java/org/codehaus/gmaven/adapter/ShellRunner.java
// @SuppressWarnings("JavadocReference")
// public interface ShellRunner
// {
// void run(ClassLoader classLoader,
// ResourceLoader resourceLoader,
// Map<String, Object> context,
// @Nullable Map<String, Object> options)
// throws Exception;
// }
| import java.util.HashMap;
import java.util.Map;
import org.apache.maven.plugins.annotations.Mojo;
import org.codehaus.gmaven.adapter.ResourceLoader;
import org.codehaus.gmaven.adapter.ShellRunner;
import static org.apache.maven.plugins.annotations.ResolutionScope.TEST; | /*
* Copyright (c) 2006-present the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.codehaus.gmaven.plugin;
/**
* Run {@code groovysh} shell.
*
* <br/>
* See <a href="shell.html">usage</a> for more details.
*
* @since 2.0
*/
@Mojo(name = "shell", requiresProject = false, requiresDependencyResolution = TEST, aggregator = true)
public class ShellMojo
extends RuntimeMojoSupport
{
// TODO: Expose groovysh options
@Override
protected void run() throws Exception { | // Path: gmaven-adapter-api/src/main/java/org/codehaus/gmaven/adapter/ResourceLoader.java
// @SuppressWarnings("JavadocReference")
// public interface ResourceLoader
// {
// @Nullable
// URL loadResource(String name) throws MalformedURLException;
// }
//
// Path: gmaven-adapter-api/src/main/java/org/codehaus/gmaven/adapter/ShellRunner.java
// @SuppressWarnings("JavadocReference")
// public interface ShellRunner
// {
// void run(ClassLoader classLoader,
// ResourceLoader resourceLoader,
// Map<String, Object> context,
// @Nullable Map<String, Object> options)
// throws Exception;
// }
// Path: groovy-maven-plugin/src/main/java/org/codehaus/gmaven/plugin/ShellMojo.java
import java.util.HashMap;
import java.util.Map;
import org.apache.maven.plugins.annotations.Mojo;
import org.codehaus.gmaven.adapter.ResourceLoader;
import org.codehaus.gmaven.adapter.ShellRunner;
import static org.apache.maven.plugins.annotations.ResolutionScope.TEST;
/*
* Copyright (c) 2006-present the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.codehaus.gmaven.plugin;
/**
* Run {@code groovysh} shell.
*
* <br/>
* See <a href="shell.html">usage</a> for more details.
*
* @since 2.0
*/
@Mojo(name = "shell", requiresProject = false, requiresDependencyResolution = TEST, aggregator = true)
public class ShellMojo
extends RuntimeMojoSupport
{
// TODO: Expose groovysh options
@Override
protected void run() throws Exception { | final ResourceLoader resourceLoader = new MojoResourceLoader(getRuntimeRealm(), getScriptpath()); |
groovy/gmaven | groovy-maven-plugin/src/main/java/org/codehaus/gmaven/plugin/ShellMojo.java | // Path: gmaven-adapter-api/src/main/java/org/codehaus/gmaven/adapter/ResourceLoader.java
// @SuppressWarnings("JavadocReference")
// public interface ResourceLoader
// {
// @Nullable
// URL loadResource(String name) throws MalformedURLException;
// }
//
// Path: gmaven-adapter-api/src/main/java/org/codehaus/gmaven/adapter/ShellRunner.java
// @SuppressWarnings("JavadocReference")
// public interface ShellRunner
// {
// void run(ClassLoader classLoader,
// ResourceLoader resourceLoader,
// Map<String, Object> context,
// @Nullable Map<String, Object> options)
// throws Exception;
// }
| import java.util.HashMap;
import java.util.Map;
import org.apache.maven.plugins.annotations.Mojo;
import org.codehaus.gmaven.adapter.ResourceLoader;
import org.codehaus.gmaven.adapter.ShellRunner;
import static org.apache.maven.plugins.annotations.ResolutionScope.TEST; | /*
* Copyright (c) 2006-present the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.codehaus.gmaven.plugin;
/**
* Run {@code groovysh} shell.
*
* <br/>
* See <a href="shell.html">usage</a> for more details.
*
* @since 2.0
*/
@Mojo(name = "shell", requiresProject = false, requiresDependencyResolution = TEST, aggregator = true)
public class ShellMojo
extends RuntimeMojoSupport
{
// TODO: Expose groovysh options
@Override
protected void run() throws Exception {
final ResourceLoader resourceLoader = new MojoResourceLoader(getRuntimeRealm(), getScriptpath());
final Map<String, Object> context = createContext();
final Map<String, Object> options = new HashMap<String, Object>(); | // Path: gmaven-adapter-api/src/main/java/org/codehaus/gmaven/adapter/ResourceLoader.java
// @SuppressWarnings("JavadocReference")
// public interface ResourceLoader
// {
// @Nullable
// URL loadResource(String name) throws MalformedURLException;
// }
//
// Path: gmaven-adapter-api/src/main/java/org/codehaus/gmaven/adapter/ShellRunner.java
// @SuppressWarnings("JavadocReference")
// public interface ShellRunner
// {
// void run(ClassLoader classLoader,
// ResourceLoader resourceLoader,
// Map<String, Object> context,
// @Nullable Map<String, Object> options)
// throws Exception;
// }
// Path: groovy-maven-plugin/src/main/java/org/codehaus/gmaven/plugin/ShellMojo.java
import java.util.HashMap;
import java.util.Map;
import org.apache.maven.plugins.annotations.Mojo;
import org.codehaus.gmaven.adapter.ResourceLoader;
import org.codehaus.gmaven.adapter.ShellRunner;
import static org.apache.maven.plugins.annotations.ResolutionScope.TEST;
/*
* Copyright (c) 2006-present the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.codehaus.gmaven.plugin;
/**
* Run {@code groovysh} shell.
*
* <br/>
* See <a href="shell.html">usage</a> for more details.
*
* @since 2.0
*/
@Mojo(name = "shell", requiresProject = false, requiresDependencyResolution = TEST, aggregator = true)
public class ShellMojo
extends RuntimeMojoSupport
{
// TODO: Expose groovysh options
@Override
protected void run() throws Exception {
final ResourceLoader resourceLoader = new MojoResourceLoader(getRuntimeRealm(), getScriptpath());
final Map<String, Object> context = createContext();
final Map<String, Object> options = new HashMap<String, Object>(); | final ShellRunner shell = getRuntime().createShellRunner(); |
groovy/gmaven | gmaven-adapter-impl/src/main/java/org/codehaus/gmaven/adapter/impl/ConsoleWindowImpl.java | // Path: gmaven-adapter-api/src/main/java/org/codehaus/gmaven/adapter/ConsoleWindow.java
// @SuppressWarnings("JavadocReference")
// public interface ConsoleWindow
// {
// interface WindowHandle
// {
// void close();
//
// void await() throws InterruptedException;
// }
//
// WindowHandle open(ClassLoader classLoader,
// ResourceLoader resourceLoader,
// Map<String, Object> context,
// @Nullable Map<String, Object> options)
// throws Exception;
// }
//
// Path: gmaven-adapter-api/src/main/java/org/codehaus/gmaven/adapter/ResourceLoader.java
// @SuppressWarnings("JavadocReference")
// public interface ResourceLoader
// {
// @Nullable
// URL loadResource(String name) throws MalformedURLException;
// }
| import java.util.EventObject;
import java.util.Map;
import javax.annotation.Nullable;
import groovy.lang.Binding;
import groovy.lang.GroovyClassLoader;
import groovy.ui.Console;
import org.codehaus.gmaven.adapter.ConsoleWindow;
import org.codehaus.gmaven.adapter.ResourceLoader;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import static com.google.common.base.Preconditions.checkNotNull; | /*
* Copyright (c) 2006-present the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.codehaus.gmaven.adapter.impl;
/**
* Default {@link ConsoleWindow} implementation.
*
* @since 2.0
*/
public class ConsoleWindowImpl
implements ConsoleWindow
{
private final Logger log = LoggerFactory.getLogger(getClass());
private final GroovyRuntimeImpl runtime;
private final Object lock = new Object();
ConsoleWindowImpl(final GroovyRuntimeImpl runtime) {
this.runtime = checkNotNull(runtime);
}
@Override
public WindowHandle open(final ClassLoader classLoader, | // Path: gmaven-adapter-api/src/main/java/org/codehaus/gmaven/adapter/ConsoleWindow.java
// @SuppressWarnings("JavadocReference")
// public interface ConsoleWindow
// {
// interface WindowHandle
// {
// void close();
//
// void await() throws InterruptedException;
// }
//
// WindowHandle open(ClassLoader classLoader,
// ResourceLoader resourceLoader,
// Map<String, Object> context,
// @Nullable Map<String, Object> options)
// throws Exception;
// }
//
// Path: gmaven-adapter-api/src/main/java/org/codehaus/gmaven/adapter/ResourceLoader.java
// @SuppressWarnings("JavadocReference")
// public interface ResourceLoader
// {
// @Nullable
// URL loadResource(String name) throws MalformedURLException;
// }
// Path: gmaven-adapter-impl/src/main/java/org/codehaus/gmaven/adapter/impl/ConsoleWindowImpl.java
import java.util.EventObject;
import java.util.Map;
import javax.annotation.Nullable;
import groovy.lang.Binding;
import groovy.lang.GroovyClassLoader;
import groovy.ui.Console;
import org.codehaus.gmaven.adapter.ConsoleWindow;
import org.codehaus.gmaven.adapter.ResourceLoader;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import static com.google.common.base.Preconditions.checkNotNull;
/*
* Copyright (c) 2006-present the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.codehaus.gmaven.adapter.impl;
/**
* Default {@link ConsoleWindow} implementation.
*
* @since 2.0
*/
public class ConsoleWindowImpl
implements ConsoleWindow
{
private final Logger log = LoggerFactory.getLogger(getClass());
private final GroovyRuntimeImpl runtime;
private final Object lock = new Object();
ConsoleWindowImpl(final GroovyRuntimeImpl runtime) {
this.runtime = checkNotNull(runtime);
}
@Override
public WindowHandle open(final ClassLoader classLoader, | final ResourceLoader resourceLoader, |
groovy/gmaven | groovy-maven-plugin/src/main/java/org/codehaus/gmaven/plugin/ConsoleMojo.java | // Path: gmaven-adapter-api/src/main/java/org/codehaus/gmaven/adapter/ConsoleWindow.java
// @SuppressWarnings("JavadocReference")
// public interface ConsoleWindow
// {
// interface WindowHandle
// {
// void close();
//
// void await() throws InterruptedException;
// }
//
// WindowHandle open(ClassLoader classLoader,
// ResourceLoader resourceLoader,
// Map<String, Object> context,
// @Nullable Map<String, Object> options)
// throws Exception;
// }
//
// Path: gmaven-adapter-api/src/main/java/org/codehaus/gmaven/adapter/ConsoleWindow.java
// interface WindowHandle
// {
// void close();
//
// void await() throws InterruptedException;
// }
//
// Path: gmaven-adapter-api/src/main/java/org/codehaus/gmaven/adapter/ResourceLoader.java
// @SuppressWarnings("JavadocReference")
// public interface ResourceLoader
// {
// @Nullable
// URL loadResource(String name) throws MalformedURLException;
// }
| import java.util.HashMap;
import java.util.Map;
import org.apache.maven.plugins.annotations.Mojo;
import org.codehaus.gmaven.adapter.ConsoleWindow;
import org.codehaus.gmaven.adapter.ConsoleWindow.WindowHandle;
import org.codehaus.gmaven.adapter.ResourceLoader;
import static org.apache.maven.plugins.annotations.ResolutionScope.TEST; | /*
* Copyright (c) 2006-present the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.codehaus.gmaven.plugin;
/**
* Open a Groovy console window.
*
* <br/>
* See <a href="console.html">usage</a> for more details.
*
* @since 2.0
*/
@Mojo(name = "console", requiresProject = false, requiresDependencyResolution = TEST, aggregator = true)
public class ConsoleMojo
extends RuntimeMojoSupport
{
// TODO: Expose console options
@Override
protected void run() throws Exception { | // Path: gmaven-adapter-api/src/main/java/org/codehaus/gmaven/adapter/ConsoleWindow.java
// @SuppressWarnings("JavadocReference")
// public interface ConsoleWindow
// {
// interface WindowHandle
// {
// void close();
//
// void await() throws InterruptedException;
// }
//
// WindowHandle open(ClassLoader classLoader,
// ResourceLoader resourceLoader,
// Map<String, Object> context,
// @Nullable Map<String, Object> options)
// throws Exception;
// }
//
// Path: gmaven-adapter-api/src/main/java/org/codehaus/gmaven/adapter/ConsoleWindow.java
// interface WindowHandle
// {
// void close();
//
// void await() throws InterruptedException;
// }
//
// Path: gmaven-adapter-api/src/main/java/org/codehaus/gmaven/adapter/ResourceLoader.java
// @SuppressWarnings("JavadocReference")
// public interface ResourceLoader
// {
// @Nullable
// URL loadResource(String name) throws MalformedURLException;
// }
// Path: groovy-maven-plugin/src/main/java/org/codehaus/gmaven/plugin/ConsoleMojo.java
import java.util.HashMap;
import java.util.Map;
import org.apache.maven.plugins.annotations.Mojo;
import org.codehaus.gmaven.adapter.ConsoleWindow;
import org.codehaus.gmaven.adapter.ConsoleWindow.WindowHandle;
import org.codehaus.gmaven.adapter.ResourceLoader;
import static org.apache.maven.plugins.annotations.ResolutionScope.TEST;
/*
* Copyright (c) 2006-present the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.codehaus.gmaven.plugin;
/**
* Open a Groovy console window.
*
* <br/>
* See <a href="console.html">usage</a> for more details.
*
* @since 2.0
*/
@Mojo(name = "console", requiresProject = false, requiresDependencyResolution = TEST, aggregator = true)
public class ConsoleMojo
extends RuntimeMojoSupport
{
// TODO: Expose console options
@Override
protected void run() throws Exception { | final ResourceLoader resourceLoader = new MojoResourceLoader(getRuntimeRealm(), getScriptpath()); |
groovy/gmaven | groovy-maven-plugin/src/main/java/org/codehaus/gmaven/plugin/ConsoleMojo.java | // Path: gmaven-adapter-api/src/main/java/org/codehaus/gmaven/adapter/ConsoleWindow.java
// @SuppressWarnings("JavadocReference")
// public interface ConsoleWindow
// {
// interface WindowHandle
// {
// void close();
//
// void await() throws InterruptedException;
// }
//
// WindowHandle open(ClassLoader classLoader,
// ResourceLoader resourceLoader,
// Map<String, Object> context,
// @Nullable Map<String, Object> options)
// throws Exception;
// }
//
// Path: gmaven-adapter-api/src/main/java/org/codehaus/gmaven/adapter/ConsoleWindow.java
// interface WindowHandle
// {
// void close();
//
// void await() throws InterruptedException;
// }
//
// Path: gmaven-adapter-api/src/main/java/org/codehaus/gmaven/adapter/ResourceLoader.java
// @SuppressWarnings("JavadocReference")
// public interface ResourceLoader
// {
// @Nullable
// URL loadResource(String name) throws MalformedURLException;
// }
| import java.util.HashMap;
import java.util.Map;
import org.apache.maven.plugins.annotations.Mojo;
import org.codehaus.gmaven.adapter.ConsoleWindow;
import org.codehaus.gmaven.adapter.ConsoleWindow.WindowHandle;
import org.codehaus.gmaven.adapter.ResourceLoader;
import static org.apache.maven.plugins.annotations.ResolutionScope.TEST; | /*
* Copyright (c) 2006-present the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.codehaus.gmaven.plugin;
/**
* Open a Groovy console window.
*
* <br/>
* See <a href="console.html">usage</a> for more details.
*
* @since 2.0
*/
@Mojo(name = "console", requiresProject = false, requiresDependencyResolution = TEST, aggregator = true)
public class ConsoleMojo
extends RuntimeMojoSupport
{
// TODO: Expose console options
@Override
protected void run() throws Exception {
final ResourceLoader resourceLoader = new MojoResourceLoader(getRuntimeRealm(), getScriptpath());
final Map<String, Object> context = createContext();
final Map<String, Object> options = new HashMap<String, Object>(); | // Path: gmaven-adapter-api/src/main/java/org/codehaus/gmaven/adapter/ConsoleWindow.java
// @SuppressWarnings("JavadocReference")
// public interface ConsoleWindow
// {
// interface WindowHandle
// {
// void close();
//
// void await() throws InterruptedException;
// }
//
// WindowHandle open(ClassLoader classLoader,
// ResourceLoader resourceLoader,
// Map<String, Object> context,
// @Nullable Map<String, Object> options)
// throws Exception;
// }
//
// Path: gmaven-adapter-api/src/main/java/org/codehaus/gmaven/adapter/ConsoleWindow.java
// interface WindowHandle
// {
// void close();
//
// void await() throws InterruptedException;
// }
//
// Path: gmaven-adapter-api/src/main/java/org/codehaus/gmaven/adapter/ResourceLoader.java
// @SuppressWarnings("JavadocReference")
// public interface ResourceLoader
// {
// @Nullable
// URL loadResource(String name) throws MalformedURLException;
// }
// Path: groovy-maven-plugin/src/main/java/org/codehaus/gmaven/plugin/ConsoleMojo.java
import java.util.HashMap;
import java.util.Map;
import org.apache.maven.plugins.annotations.Mojo;
import org.codehaus.gmaven.adapter.ConsoleWindow;
import org.codehaus.gmaven.adapter.ConsoleWindow.WindowHandle;
import org.codehaus.gmaven.adapter.ResourceLoader;
import static org.apache.maven.plugins.annotations.ResolutionScope.TEST;
/*
* Copyright (c) 2006-present the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.codehaus.gmaven.plugin;
/**
* Open a Groovy console window.
*
* <br/>
* See <a href="console.html">usage</a> for more details.
*
* @since 2.0
*/
@Mojo(name = "console", requiresProject = false, requiresDependencyResolution = TEST, aggregator = true)
public class ConsoleMojo
extends RuntimeMojoSupport
{
// TODO: Expose console options
@Override
protected void run() throws Exception {
final ResourceLoader resourceLoader = new MojoResourceLoader(getRuntimeRealm(), getScriptpath());
final Map<String, Object> context = createContext();
final Map<String, Object> options = new HashMap<String, Object>(); | final ConsoleWindow console = getRuntime().createConsoleWindow(); |
groovy/gmaven | groovy-maven-plugin/src/main/java/org/codehaus/gmaven/plugin/ConsoleMojo.java | // Path: gmaven-adapter-api/src/main/java/org/codehaus/gmaven/adapter/ConsoleWindow.java
// @SuppressWarnings("JavadocReference")
// public interface ConsoleWindow
// {
// interface WindowHandle
// {
// void close();
//
// void await() throws InterruptedException;
// }
//
// WindowHandle open(ClassLoader classLoader,
// ResourceLoader resourceLoader,
// Map<String, Object> context,
// @Nullable Map<String, Object> options)
// throws Exception;
// }
//
// Path: gmaven-adapter-api/src/main/java/org/codehaus/gmaven/adapter/ConsoleWindow.java
// interface WindowHandle
// {
// void close();
//
// void await() throws InterruptedException;
// }
//
// Path: gmaven-adapter-api/src/main/java/org/codehaus/gmaven/adapter/ResourceLoader.java
// @SuppressWarnings("JavadocReference")
// public interface ResourceLoader
// {
// @Nullable
// URL loadResource(String name) throws MalformedURLException;
// }
| import java.util.HashMap;
import java.util.Map;
import org.apache.maven.plugins.annotations.Mojo;
import org.codehaus.gmaven.adapter.ConsoleWindow;
import org.codehaus.gmaven.adapter.ConsoleWindow.WindowHandle;
import org.codehaus.gmaven.adapter.ResourceLoader;
import static org.apache.maven.plugins.annotations.ResolutionScope.TEST; | /*
* Copyright (c) 2006-present the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.codehaus.gmaven.plugin;
/**
* Open a Groovy console window.
*
* <br/>
* See <a href="console.html">usage</a> for more details.
*
* @since 2.0
*/
@Mojo(name = "console", requiresProject = false, requiresDependencyResolution = TEST, aggregator = true)
public class ConsoleMojo
extends RuntimeMojoSupport
{
// TODO: Expose console options
@Override
protected void run() throws Exception {
final ResourceLoader resourceLoader = new MojoResourceLoader(getRuntimeRealm(), getScriptpath());
final Map<String, Object> context = createContext();
final Map<String, Object> options = new HashMap<String, Object>();
final ConsoleWindow console = getRuntime().createConsoleWindow();
| // Path: gmaven-adapter-api/src/main/java/org/codehaus/gmaven/adapter/ConsoleWindow.java
// @SuppressWarnings("JavadocReference")
// public interface ConsoleWindow
// {
// interface WindowHandle
// {
// void close();
//
// void await() throws InterruptedException;
// }
//
// WindowHandle open(ClassLoader classLoader,
// ResourceLoader resourceLoader,
// Map<String, Object> context,
// @Nullable Map<String, Object> options)
// throws Exception;
// }
//
// Path: gmaven-adapter-api/src/main/java/org/codehaus/gmaven/adapter/ConsoleWindow.java
// interface WindowHandle
// {
// void close();
//
// void await() throws InterruptedException;
// }
//
// Path: gmaven-adapter-api/src/main/java/org/codehaus/gmaven/adapter/ResourceLoader.java
// @SuppressWarnings("JavadocReference")
// public interface ResourceLoader
// {
// @Nullable
// URL loadResource(String name) throws MalformedURLException;
// }
// Path: groovy-maven-plugin/src/main/java/org/codehaus/gmaven/plugin/ConsoleMojo.java
import java.util.HashMap;
import java.util.Map;
import org.apache.maven.plugins.annotations.Mojo;
import org.codehaus.gmaven.adapter.ConsoleWindow;
import org.codehaus.gmaven.adapter.ConsoleWindow.WindowHandle;
import org.codehaus.gmaven.adapter.ResourceLoader;
import static org.apache.maven.plugins.annotations.ResolutionScope.TEST;
/*
* Copyright (c) 2006-present the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.codehaus.gmaven.plugin;
/**
* Open a Groovy console window.
*
* <br/>
* See <a href="console.html">usage</a> for more details.
*
* @since 2.0
*/
@Mojo(name = "console", requiresProject = false, requiresDependencyResolution = TEST, aggregator = true)
public class ConsoleMojo
extends RuntimeMojoSupport
{
// TODO: Expose console options
@Override
protected void run() throws Exception {
final ResourceLoader resourceLoader = new MojoResourceLoader(getRuntimeRealm(), getScriptpath());
final Map<String, Object> context = createContext();
final Map<String, Object> options = new HashMap<String, Object>();
final ConsoleWindow console = getRuntime().createConsoleWindow();
| WindowHandle handle = console.open(getRuntimeRealm(), resourceLoader, context, options); |
groovy/gmaven | gmaven-adapter-impl/src/main/java/org/codehaus/gmaven/adapter/impl/ShellRunnerImpl.java | // Path: gmaven-adapter-api/src/main/java/org/codehaus/gmaven/adapter/ResourceLoader.java
// @SuppressWarnings("JavadocReference")
// public interface ResourceLoader
// {
// @Nullable
// URL loadResource(String name) throws MalformedURLException;
// }
//
// Path: gmaven-adapter-api/src/main/java/org/codehaus/gmaven/adapter/ShellRunner.java
// @SuppressWarnings("JavadocReference")
// public interface ShellRunner
// {
// void run(ClassLoader classLoader,
// ResourceLoader resourceLoader,
// Map<String, Object> context,
// @Nullable Map<String, Object> options)
// throws Exception;
// }
| import java.util.Map;
import javax.annotation.Nullable;
import groovy.lang.Binding;
import groovy.lang.GroovyClassLoader;
import org.codehaus.gmaven.adapter.ResourceLoader;
import org.codehaus.gmaven.adapter.ShellRunner;
import org.codehaus.groovy.tools.shell.Groovysh;
import org.codehaus.groovy.tools.shell.IO;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import static com.google.common.base.Preconditions.checkNotNull; | /*
* Copyright (c) 2006-present the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.codehaus.gmaven.adapter.impl;
/**
* Default {@link ShellRunner} implementation.
*
* @since 2.0
*/
public class ShellRunnerImpl
implements ShellRunner
{
private final Logger log = LoggerFactory.getLogger(getClass());
private final GroovyRuntimeImpl runtime;
ShellRunnerImpl(final GroovyRuntimeImpl runtime) {
this.runtime = checkNotNull(runtime);
}
@Override
public void run(final ClassLoader classLoader, | // Path: gmaven-adapter-api/src/main/java/org/codehaus/gmaven/adapter/ResourceLoader.java
// @SuppressWarnings("JavadocReference")
// public interface ResourceLoader
// {
// @Nullable
// URL loadResource(String name) throws MalformedURLException;
// }
//
// Path: gmaven-adapter-api/src/main/java/org/codehaus/gmaven/adapter/ShellRunner.java
// @SuppressWarnings("JavadocReference")
// public interface ShellRunner
// {
// void run(ClassLoader classLoader,
// ResourceLoader resourceLoader,
// Map<String, Object> context,
// @Nullable Map<String, Object> options)
// throws Exception;
// }
// Path: gmaven-adapter-impl/src/main/java/org/codehaus/gmaven/adapter/impl/ShellRunnerImpl.java
import java.util.Map;
import javax.annotation.Nullable;
import groovy.lang.Binding;
import groovy.lang.GroovyClassLoader;
import org.codehaus.gmaven.adapter.ResourceLoader;
import org.codehaus.gmaven.adapter.ShellRunner;
import org.codehaus.groovy.tools.shell.Groovysh;
import org.codehaus.groovy.tools.shell.IO;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import static com.google.common.base.Preconditions.checkNotNull;
/*
* Copyright (c) 2006-present the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.codehaus.gmaven.adapter.impl;
/**
* Default {@link ShellRunner} implementation.
*
* @since 2.0
*/
public class ShellRunnerImpl
implements ShellRunner
{
private final Logger log = LoggerFactory.getLogger(getClass());
private final GroovyRuntimeImpl runtime;
ShellRunnerImpl(final GroovyRuntimeImpl runtime) {
this.runtime = checkNotNull(runtime);
}
@Override
public void run(final ClassLoader classLoader, | final ResourceLoader resourceLoader, |
groovy/gmaven | groovy-maven-plugin/src/main/java/org/codehaus/gmaven/plugin/GroovyRuntimeFactory.java | // Path: gmaven-adapter-api/src/main/java/org/codehaus/gmaven/adapter/GroovyRuntime.java
// public interface GroovyRuntime
// {
// ScriptExecutor createScriptExecutor();
//
// ConsoleWindow createConsoleWindow();
//
// ShellRunner createShellRunner();
//
// void cleanup();
// }
| import java.util.Iterator;
import java.util.ServiceLoader;
import com.google.common.annotations.VisibleForTesting;
import org.codehaus.gmaven.adapter.GroovyRuntime;
import org.codehaus.plexus.component.annotations.Component;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import static com.google.common.base.Preconditions.checkNotNull;
import static com.google.common.base.Preconditions.checkState; | /*
* Copyright (c) 2006-present the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.codehaus.gmaven.plugin;
/**
* Creates {@link GroovyRuntime} instances.
*
* @since 2.0
*/
@Component(role=GroovyRuntimeFactory.class)
public class GroovyRuntimeFactory
{
private final Logger log = LoggerFactory.getLogger(getClass());
| // Path: gmaven-adapter-api/src/main/java/org/codehaus/gmaven/adapter/GroovyRuntime.java
// public interface GroovyRuntime
// {
// ScriptExecutor createScriptExecutor();
//
// ConsoleWindow createConsoleWindow();
//
// ShellRunner createShellRunner();
//
// void cleanup();
// }
// Path: groovy-maven-plugin/src/main/java/org/codehaus/gmaven/plugin/GroovyRuntimeFactory.java
import java.util.Iterator;
import java.util.ServiceLoader;
import com.google.common.annotations.VisibleForTesting;
import org.codehaus.gmaven.adapter.GroovyRuntime;
import org.codehaus.plexus.component.annotations.Component;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import static com.google.common.base.Preconditions.checkNotNull;
import static com.google.common.base.Preconditions.checkState;
/*
* Copyright (c) 2006-present the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.codehaus.gmaven.plugin;
/**
* Creates {@link GroovyRuntime} instances.
*
* @since 2.0
*/
@Component(role=GroovyRuntimeFactory.class)
public class GroovyRuntimeFactory
{
private final Logger log = LoggerFactory.getLogger(getClass());
| public GroovyRuntime create(final ClassLoader classLoader) { |
TrumanDu/AutoProgramming | src/main/java/com/aibibang/web/system/service/impl/SysOrgServiceImpl.java | // Path: src/main/java/com/aibibang/web/system/dao/SysOrgDao.java
// public interface SysOrgDao extends BaseDao<SysOrg, Long> {
//
// public List<SysOrg> findForTreeTable(Long parentId);
//
// public void deleteByParentId(Long parentId);
//
// public String getMaxCode(Long parentId);
// }
//
// Path: src/main/java/com/aibibang/web/system/entity/SysOrg.java
// public class SysOrg extends BaseEntity implements Serializable {
//
// private static final long serialVersionUID = 1L;
//
// /** 组织编码 */
// private String orgCode;
// /** 组织名称 */
// private String orgName;
// /** 备注 */
// private String description;
// /** 上级组织ID */
// private Long parentId;
//
// /** 下级组织数量 */
// private Integer childNum;
// /** 上级组织 */
// private SysOrg parentOrg;
// /** 下级组织 */
// private List<SysOrg> children = new ArrayList<SysOrg>();
//
// public String getOrgCode() {
// return orgCode;
// }
// public void setOrgCode(String orgCode) {
// this.orgCode = orgCode;
// }
// public String getOrgName() {
// return orgName;
// }
// public void setOrgName(String orgName) {
// this.orgName = orgName;
// }
// public String getDescription() {
// return description;
// }
// public void setDescription(String description) {
// this.description = description;
// }
// public Long getParentId() {
// return parentId;
// }
// public void setParentId(Long parentId) {
// this.parentId = parentId;
// }
//
// public Integer getChildNum() {
// return childNum;
// }
// public void setChildNum(Integer childNum) {
// this.childNum = childNum;
// }
// public SysOrg getParentOrg() {
// return parentOrg;
// }
// public void setParentOrg(SysOrg parentOrg) {
// this.parentOrg = parentOrg;
// }
// public List<SysOrg> getChildren() {
// return children;
// }
// public void setChildren(List<SysOrg> children) {
// this.children = children;
// }
//
// }
//
// Path: src/main/java/com/aibibang/web/system/service/SysOrgService.java
// public interface SysOrgService {
//
// public List<SysOrg> find(SysOrg org);
//
// public List<SysOrg> findForTreeTable(Long parentId);
//
// public SysOrg getById(Long id);
//
// public void add(SysOrg org);
//
// public void update(SysOrg org);
//
// public void delete(Long id);
// }
| import java.text.DecimalFormat;
import java.util.List;
import javax.annotation.Resource;
import org.apache.commons.lang.StringUtils;
import org.springframework.stereotype.Service;
import com.aibibang.web.system.dao.SysOrgDao;
import com.aibibang.web.system.entity.SysOrg;
import com.aibibang.web.system.service.SysOrgService;
| package com.aibibang.web.system.service.impl;
@Service("SysOrgService")
public class SysOrgServiceImpl implements SysOrgService {
@Resource
| // Path: src/main/java/com/aibibang/web/system/dao/SysOrgDao.java
// public interface SysOrgDao extends BaseDao<SysOrg, Long> {
//
// public List<SysOrg> findForTreeTable(Long parentId);
//
// public void deleteByParentId(Long parentId);
//
// public String getMaxCode(Long parentId);
// }
//
// Path: src/main/java/com/aibibang/web/system/entity/SysOrg.java
// public class SysOrg extends BaseEntity implements Serializable {
//
// private static final long serialVersionUID = 1L;
//
// /** 组织编码 */
// private String orgCode;
// /** 组织名称 */
// private String orgName;
// /** 备注 */
// private String description;
// /** 上级组织ID */
// private Long parentId;
//
// /** 下级组织数量 */
// private Integer childNum;
// /** 上级组织 */
// private SysOrg parentOrg;
// /** 下级组织 */
// private List<SysOrg> children = new ArrayList<SysOrg>();
//
// public String getOrgCode() {
// return orgCode;
// }
// public void setOrgCode(String orgCode) {
// this.orgCode = orgCode;
// }
// public String getOrgName() {
// return orgName;
// }
// public void setOrgName(String orgName) {
// this.orgName = orgName;
// }
// public String getDescription() {
// return description;
// }
// public void setDescription(String description) {
// this.description = description;
// }
// public Long getParentId() {
// return parentId;
// }
// public void setParentId(Long parentId) {
// this.parentId = parentId;
// }
//
// public Integer getChildNum() {
// return childNum;
// }
// public void setChildNum(Integer childNum) {
// this.childNum = childNum;
// }
// public SysOrg getParentOrg() {
// return parentOrg;
// }
// public void setParentOrg(SysOrg parentOrg) {
// this.parentOrg = parentOrg;
// }
// public List<SysOrg> getChildren() {
// return children;
// }
// public void setChildren(List<SysOrg> children) {
// this.children = children;
// }
//
// }
//
// Path: src/main/java/com/aibibang/web/system/service/SysOrgService.java
// public interface SysOrgService {
//
// public List<SysOrg> find(SysOrg org);
//
// public List<SysOrg> findForTreeTable(Long parentId);
//
// public SysOrg getById(Long id);
//
// public void add(SysOrg org);
//
// public void update(SysOrg org);
//
// public void delete(Long id);
// }
// Path: src/main/java/com/aibibang/web/system/service/impl/SysOrgServiceImpl.java
import java.text.DecimalFormat;
import java.util.List;
import javax.annotation.Resource;
import org.apache.commons.lang.StringUtils;
import org.springframework.stereotype.Service;
import com.aibibang.web.system.dao.SysOrgDao;
import com.aibibang.web.system.entity.SysOrg;
import com.aibibang.web.system.service.SysOrgService;
package com.aibibang.web.system.service.impl;
@Service("SysOrgService")
public class SysOrgServiceImpl implements SysOrgService {
@Resource
| private SysOrgDao sysOrgDao;
|
TrumanDu/AutoProgramming | src/main/java/com/aibibang/web/system/service/impl/SysOrgServiceImpl.java | // Path: src/main/java/com/aibibang/web/system/dao/SysOrgDao.java
// public interface SysOrgDao extends BaseDao<SysOrg, Long> {
//
// public List<SysOrg> findForTreeTable(Long parentId);
//
// public void deleteByParentId(Long parentId);
//
// public String getMaxCode(Long parentId);
// }
//
// Path: src/main/java/com/aibibang/web/system/entity/SysOrg.java
// public class SysOrg extends BaseEntity implements Serializable {
//
// private static final long serialVersionUID = 1L;
//
// /** 组织编码 */
// private String orgCode;
// /** 组织名称 */
// private String orgName;
// /** 备注 */
// private String description;
// /** 上级组织ID */
// private Long parentId;
//
// /** 下级组织数量 */
// private Integer childNum;
// /** 上级组织 */
// private SysOrg parentOrg;
// /** 下级组织 */
// private List<SysOrg> children = new ArrayList<SysOrg>();
//
// public String getOrgCode() {
// return orgCode;
// }
// public void setOrgCode(String orgCode) {
// this.orgCode = orgCode;
// }
// public String getOrgName() {
// return orgName;
// }
// public void setOrgName(String orgName) {
// this.orgName = orgName;
// }
// public String getDescription() {
// return description;
// }
// public void setDescription(String description) {
// this.description = description;
// }
// public Long getParentId() {
// return parentId;
// }
// public void setParentId(Long parentId) {
// this.parentId = parentId;
// }
//
// public Integer getChildNum() {
// return childNum;
// }
// public void setChildNum(Integer childNum) {
// this.childNum = childNum;
// }
// public SysOrg getParentOrg() {
// return parentOrg;
// }
// public void setParentOrg(SysOrg parentOrg) {
// this.parentOrg = parentOrg;
// }
// public List<SysOrg> getChildren() {
// return children;
// }
// public void setChildren(List<SysOrg> children) {
// this.children = children;
// }
//
// }
//
// Path: src/main/java/com/aibibang/web/system/service/SysOrgService.java
// public interface SysOrgService {
//
// public List<SysOrg> find(SysOrg org);
//
// public List<SysOrg> findForTreeTable(Long parentId);
//
// public SysOrg getById(Long id);
//
// public void add(SysOrg org);
//
// public void update(SysOrg org);
//
// public void delete(Long id);
// }
| import java.text.DecimalFormat;
import java.util.List;
import javax.annotation.Resource;
import org.apache.commons.lang.StringUtils;
import org.springframework.stereotype.Service;
import com.aibibang.web.system.dao.SysOrgDao;
import com.aibibang.web.system.entity.SysOrg;
import com.aibibang.web.system.service.SysOrgService;
| package com.aibibang.web.system.service.impl;
@Service("SysOrgService")
public class SysOrgServiceImpl implements SysOrgService {
@Resource
private SysOrgDao sysOrgDao;
@Override
| // Path: src/main/java/com/aibibang/web/system/dao/SysOrgDao.java
// public interface SysOrgDao extends BaseDao<SysOrg, Long> {
//
// public List<SysOrg> findForTreeTable(Long parentId);
//
// public void deleteByParentId(Long parentId);
//
// public String getMaxCode(Long parentId);
// }
//
// Path: src/main/java/com/aibibang/web/system/entity/SysOrg.java
// public class SysOrg extends BaseEntity implements Serializable {
//
// private static final long serialVersionUID = 1L;
//
// /** 组织编码 */
// private String orgCode;
// /** 组织名称 */
// private String orgName;
// /** 备注 */
// private String description;
// /** 上级组织ID */
// private Long parentId;
//
// /** 下级组织数量 */
// private Integer childNum;
// /** 上级组织 */
// private SysOrg parentOrg;
// /** 下级组织 */
// private List<SysOrg> children = new ArrayList<SysOrg>();
//
// public String getOrgCode() {
// return orgCode;
// }
// public void setOrgCode(String orgCode) {
// this.orgCode = orgCode;
// }
// public String getOrgName() {
// return orgName;
// }
// public void setOrgName(String orgName) {
// this.orgName = orgName;
// }
// public String getDescription() {
// return description;
// }
// public void setDescription(String description) {
// this.description = description;
// }
// public Long getParentId() {
// return parentId;
// }
// public void setParentId(Long parentId) {
// this.parentId = parentId;
// }
//
// public Integer getChildNum() {
// return childNum;
// }
// public void setChildNum(Integer childNum) {
// this.childNum = childNum;
// }
// public SysOrg getParentOrg() {
// return parentOrg;
// }
// public void setParentOrg(SysOrg parentOrg) {
// this.parentOrg = parentOrg;
// }
// public List<SysOrg> getChildren() {
// return children;
// }
// public void setChildren(List<SysOrg> children) {
// this.children = children;
// }
//
// }
//
// Path: src/main/java/com/aibibang/web/system/service/SysOrgService.java
// public interface SysOrgService {
//
// public List<SysOrg> find(SysOrg org);
//
// public List<SysOrg> findForTreeTable(Long parentId);
//
// public SysOrg getById(Long id);
//
// public void add(SysOrg org);
//
// public void update(SysOrg org);
//
// public void delete(Long id);
// }
// Path: src/main/java/com/aibibang/web/system/service/impl/SysOrgServiceImpl.java
import java.text.DecimalFormat;
import java.util.List;
import javax.annotation.Resource;
import org.apache.commons.lang.StringUtils;
import org.springframework.stereotype.Service;
import com.aibibang.web.system.dao.SysOrgDao;
import com.aibibang.web.system.entity.SysOrg;
import com.aibibang.web.system.service.SysOrgService;
package com.aibibang.web.system.service.impl;
@Service("SysOrgService")
public class SysOrgServiceImpl implements SysOrgService {
@Resource
private SysOrgDao sysOrgDao;
@Override
| public List<SysOrg> find(SysOrg org) {
|
TrumanDu/AutoProgramming | src/main/java/com/aibibang/common/persistence/PaginationInterceptor.java | // Path: src/main/java/com/aibibang/common/persistence/dialect/Dialect.java
// public interface Dialect {
//
// /**
// * 数据库本身是否支持分页当前的分页查询方式
// * 如果数据库不支持的话,则不进行数据库分页
// *
// * @return true:支持当前的分页查询方式
// */
// public boolean supportsLimit();
//
// /**
// * 将sql转换为分页SQL,分别调用分页sql
// *
// * @param sql SQL语句
// * @param offset 开始条数
// * @param limit 每页显示多少纪录条数
// * @return 分页查询的sql
// */
// public String getLimitString(String sql, int offset, int limit);
//
// }
//
// Path: src/main/java/com/aibibang/common/persistence/dialect/DialectFactory.java
// public class DialectFactory {
//
// public static Dialect getDialect(Connection connection) {
//
// Dialect dialect = null;
//
// try {
//
// DatabaseMetaData md = connection.getMetaData();
// String dbType = md.getDatabaseProductName().toLowerCase();
// if ("db2".equals(dbType)){
// dialect = new DB2Dialect();
// }else if("derby".equals(dbType)){
// dialect = new DerbyDialect();
// }else if("h2".equals(dbType)){
// dialect = new H2Dialect();
// }else if("hsql".equals(dbType)){
// dialect = new HSQLDialect();
// }else if("mysql".equals(dbType)){
// dialect = new MySQLDialect();
// }else if("oracle".equals(dbType)){
// dialect = new OracleDialect();
// }else if("postgre".equals(dbType)){
// dialect = new PostgreSQLDialect();
// }else if("mssql".equals(dbType) || "sqlserver".equals(dbType)){
// dialect = new SQLServer2005Dialect();
// }else if("sybase".equals(dbType)){
// dialect = new SybaseDialect();
// }
// if (dialect == null) {
// throw new RuntimeException("mybatis dialect error.");
// }
// } catch (Exception e) {
//
// e.printStackTrace();
// }
//
// return dialect;
// }
// }
| import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.util.Properties;
import org.apache.ibatis.executor.parameter.ParameterHandler;
import org.apache.ibatis.executor.statement.StatementHandler;
import org.apache.ibatis.mapping.BoundSql;
import org.apache.ibatis.plugin.Interceptor;
import org.apache.ibatis.plugin.Intercepts;
import org.apache.ibatis.plugin.Invocation;
import org.apache.ibatis.plugin.Plugin;
import org.apache.ibatis.plugin.Signature;
import org.apache.ibatis.reflection.MetaObject;
import org.apache.ibatis.reflection.factory.DefaultObjectFactory;
import org.apache.ibatis.reflection.factory.ObjectFactory;
import org.apache.ibatis.reflection.wrapper.DefaultObjectWrapperFactory;
import org.apache.ibatis.reflection.wrapper.ObjectWrapperFactory;
import org.apache.ibatis.session.RowBounds;
import org.apache.log4j.Logger;
import com.aibibang.common.persistence.dialect.Dialect;
import com.aibibang.common.persistence.dialect.DialectFactory; | package com.aibibang.common.persistence;
/**
* 分页拦截器
*
* @author King
*
*/
@Intercepts({ @Signature(type = StatementHandler.class, method = "prepare", args = { Connection.class }) })
public class PaginationInterceptor implements Interceptor {
private final static Logger logger = Logger.getLogger(PaginationInterceptor.class);
private static final ObjectFactory DEFAULT_OBJECT_FACTORY = new DefaultObjectFactory();
private static final ObjectWrapperFactory DEFAULT_OBJECT_WRAPPER_FACTORY = new DefaultObjectWrapperFactory();
@Override
public Object intercept(Invocation invocation) throws Throwable {
StatementHandler statementHandler = (StatementHandler) invocation.getTarget();
ParameterHandler parameterHandler = statementHandler.getParameterHandler();
BoundSql boundSql = statementHandler.getBoundSql();
MetaObject metaStatementHandler = MetaObject.forObject(statementHandler, DEFAULT_OBJECT_FACTORY, DEFAULT_OBJECT_WRAPPER_FACTORY);
RowBounds rowBounds = (RowBounds) metaStatementHandler.getValue("delegate.rowBounds");
String originalSql = (String) metaStatementHandler.getValue("delegate.boundSql.sql");
logger.info("SQL : " + CountSqlHelper.getLineSql(originalSql));
// 没有分页参数
if (rowBounds == null || rowBounds == RowBounds.DEFAULT) {
return invocation.proceed();
}
// 获取总记录数
Page<?> page = (Page<?>) rowBounds;
//Configuration configuration = (Configuration) metaStatementHandler.getValue("delegate.configuration");
//Dialect dialect = DialectFactory.buildDialect(configuration);
//String countSql = dialect.getCountString(originalSql);
Connection connection = (Connection) invocation.getArgs()[0]; | // Path: src/main/java/com/aibibang/common/persistence/dialect/Dialect.java
// public interface Dialect {
//
// /**
// * 数据库本身是否支持分页当前的分页查询方式
// * 如果数据库不支持的话,则不进行数据库分页
// *
// * @return true:支持当前的分页查询方式
// */
// public boolean supportsLimit();
//
// /**
// * 将sql转换为分页SQL,分别调用分页sql
// *
// * @param sql SQL语句
// * @param offset 开始条数
// * @param limit 每页显示多少纪录条数
// * @return 分页查询的sql
// */
// public String getLimitString(String sql, int offset, int limit);
//
// }
//
// Path: src/main/java/com/aibibang/common/persistence/dialect/DialectFactory.java
// public class DialectFactory {
//
// public static Dialect getDialect(Connection connection) {
//
// Dialect dialect = null;
//
// try {
//
// DatabaseMetaData md = connection.getMetaData();
// String dbType = md.getDatabaseProductName().toLowerCase();
// if ("db2".equals(dbType)){
// dialect = new DB2Dialect();
// }else if("derby".equals(dbType)){
// dialect = new DerbyDialect();
// }else if("h2".equals(dbType)){
// dialect = new H2Dialect();
// }else if("hsql".equals(dbType)){
// dialect = new HSQLDialect();
// }else if("mysql".equals(dbType)){
// dialect = new MySQLDialect();
// }else if("oracle".equals(dbType)){
// dialect = new OracleDialect();
// }else if("postgre".equals(dbType)){
// dialect = new PostgreSQLDialect();
// }else if("mssql".equals(dbType) || "sqlserver".equals(dbType)){
// dialect = new SQLServer2005Dialect();
// }else if("sybase".equals(dbType)){
// dialect = new SybaseDialect();
// }
// if (dialect == null) {
// throw new RuntimeException("mybatis dialect error.");
// }
// } catch (Exception e) {
//
// e.printStackTrace();
// }
//
// return dialect;
// }
// }
// Path: src/main/java/com/aibibang/common/persistence/PaginationInterceptor.java
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.util.Properties;
import org.apache.ibatis.executor.parameter.ParameterHandler;
import org.apache.ibatis.executor.statement.StatementHandler;
import org.apache.ibatis.mapping.BoundSql;
import org.apache.ibatis.plugin.Interceptor;
import org.apache.ibatis.plugin.Intercepts;
import org.apache.ibatis.plugin.Invocation;
import org.apache.ibatis.plugin.Plugin;
import org.apache.ibatis.plugin.Signature;
import org.apache.ibatis.reflection.MetaObject;
import org.apache.ibatis.reflection.factory.DefaultObjectFactory;
import org.apache.ibatis.reflection.factory.ObjectFactory;
import org.apache.ibatis.reflection.wrapper.DefaultObjectWrapperFactory;
import org.apache.ibatis.reflection.wrapper.ObjectWrapperFactory;
import org.apache.ibatis.session.RowBounds;
import org.apache.log4j.Logger;
import com.aibibang.common.persistence.dialect.Dialect;
import com.aibibang.common.persistence.dialect.DialectFactory;
package com.aibibang.common.persistence;
/**
* 分页拦截器
*
* @author King
*
*/
@Intercepts({ @Signature(type = StatementHandler.class, method = "prepare", args = { Connection.class }) })
public class PaginationInterceptor implements Interceptor {
private final static Logger logger = Logger.getLogger(PaginationInterceptor.class);
private static final ObjectFactory DEFAULT_OBJECT_FACTORY = new DefaultObjectFactory();
private static final ObjectWrapperFactory DEFAULT_OBJECT_WRAPPER_FACTORY = new DefaultObjectWrapperFactory();
@Override
public Object intercept(Invocation invocation) throws Throwable {
StatementHandler statementHandler = (StatementHandler) invocation.getTarget();
ParameterHandler parameterHandler = statementHandler.getParameterHandler();
BoundSql boundSql = statementHandler.getBoundSql();
MetaObject metaStatementHandler = MetaObject.forObject(statementHandler, DEFAULT_OBJECT_FACTORY, DEFAULT_OBJECT_WRAPPER_FACTORY);
RowBounds rowBounds = (RowBounds) metaStatementHandler.getValue("delegate.rowBounds");
String originalSql = (String) metaStatementHandler.getValue("delegate.boundSql.sql");
logger.info("SQL : " + CountSqlHelper.getLineSql(originalSql));
// 没有分页参数
if (rowBounds == null || rowBounds == RowBounds.DEFAULT) {
return invocation.proceed();
}
// 获取总记录数
Page<?> page = (Page<?>) rowBounds;
//Configuration configuration = (Configuration) metaStatementHandler.getValue("delegate.configuration");
//Dialect dialect = DialectFactory.buildDialect(configuration);
//String countSql = dialect.getCountString(originalSql);
Connection connection = (Connection) invocation.getArgs()[0]; | Dialect dialect = DialectFactory.getDialect(connection); |
TrumanDu/AutoProgramming | src/main/java/com/aibibang/common/persistence/PaginationInterceptor.java | // Path: src/main/java/com/aibibang/common/persistence/dialect/Dialect.java
// public interface Dialect {
//
// /**
// * 数据库本身是否支持分页当前的分页查询方式
// * 如果数据库不支持的话,则不进行数据库分页
// *
// * @return true:支持当前的分页查询方式
// */
// public boolean supportsLimit();
//
// /**
// * 将sql转换为分页SQL,分别调用分页sql
// *
// * @param sql SQL语句
// * @param offset 开始条数
// * @param limit 每页显示多少纪录条数
// * @return 分页查询的sql
// */
// public String getLimitString(String sql, int offset, int limit);
//
// }
//
// Path: src/main/java/com/aibibang/common/persistence/dialect/DialectFactory.java
// public class DialectFactory {
//
// public static Dialect getDialect(Connection connection) {
//
// Dialect dialect = null;
//
// try {
//
// DatabaseMetaData md = connection.getMetaData();
// String dbType = md.getDatabaseProductName().toLowerCase();
// if ("db2".equals(dbType)){
// dialect = new DB2Dialect();
// }else if("derby".equals(dbType)){
// dialect = new DerbyDialect();
// }else if("h2".equals(dbType)){
// dialect = new H2Dialect();
// }else if("hsql".equals(dbType)){
// dialect = new HSQLDialect();
// }else if("mysql".equals(dbType)){
// dialect = new MySQLDialect();
// }else if("oracle".equals(dbType)){
// dialect = new OracleDialect();
// }else if("postgre".equals(dbType)){
// dialect = new PostgreSQLDialect();
// }else if("mssql".equals(dbType) || "sqlserver".equals(dbType)){
// dialect = new SQLServer2005Dialect();
// }else if("sybase".equals(dbType)){
// dialect = new SybaseDialect();
// }
// if (dialect == null) {
// throw new RuntimeException("mybatis dialect error.");
// }
// } catch (Exception e) {
//
// e.printStackTrace();
// }
//
// return dialect;
// }
// }
| import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.util.Properties;
import org.apache.ibatis.executor.parameter.ParameterHandler;
import org.apache.ibatis.executor.statement.StatementHandler;
import org.apache.ibatis.mapping.BoundSql;
import org.apache.ibatis.plugin.Interceptor;
import org.apache.ibatis.plugin.Intercepts;
import org.apache.ibatis.plugin.Invocation;
import org.apache.ibatis.plugin.Plugin;
import org.apache.ibatis.plugin.Signature;
import org.apache.ibatis.reflection.MetaObject;
import org.apache.ibatis.reflection.factory.DefaultObjectFactory;
import org.apache.ibatis.reflection.factory.ObjectFactory;
import org.apache.ibatis.reflection.wrapper.DefaultObjectWrapperFactory;
import org.apache.ibatis.reflection.wrapper.ObjectWrapperFactory;
import org.apache.ibatis.session.RowBounds;
import org.apache.log4j.Logger;
import com.aibibang.common.persistence.dialect.Dialect;
import com.aibibang.common.persistence.dialect.DialectFactory; | package com.aibibang.common.persistence;
/**
* 分页拦截器
*
* @author King
*
*/
@Intercepts({ @Signature(type = StatementHandler.class, method = "prepare", args = { Connection.class }) })
public class PaginationInterceptor implements Interceptor {
private final static Logger logger = Logger.getLogger(PaginationInterceptor.class);
private static final ObjectFactory DEFAULT_OBJECT_FACTORY = new DefaultObjectFactory();
private static final ObjectWrapperFactory DEFAULT_OBJECT_WRAPPER_FACTORY = new DefaultObjectWrapperFactory();
@Override
public Object intercept(Invocation invocation) throws Throwable {
StatementHandler statementHandler = (StatementHandler) invocation.getTarget();
ParameterHandler parameterHandler = statementHandler.getParameterHandler();
BoundSql boundSql = statementHandler.getBoundSql();
MetaObject metaStatementHandler = MetaObject.forObject(statementHandler, DEFAULT_OBJECT_FACTORY, DEFAULT_OBJECT_WRAPPER_FACTORY);
RowBounds rowBounds = (RowBounds) metaStatementHandler.getValue("delegate.rowBounds");
String originalSql = (String) metaStatementHandler.getValue("delegate.boundSql.sql");
logger.info("SQL : " + CountSqlHelper.getLineSql(originalSql));
// 没有分页参数
if (rowBounds == null || rowBounds == RowBounds.DEFAULT) {
return invocation.proceed();
}
// 获取总记录数
Page<?> page = (Page<?>) rowBounds;
//Configuration configuration = (Configuration) metaStatementHandler.getValue("delegate.configuration");
//Dialect dialect = DialectFactory.buildDialect(configuration);
//String countSql = dialect.getCountString(originalSql);
Connection connection = (Connection) invocation.getArgs()[0]; | // Path: src/main/java/com/aibibang/common/persistence/dialect/Dialect.java
// public interface Dialect {
//
// /**
// * 数据库本身是否支持分页当前的分页查询方式
// * 如果数据库不支持的话,则不进行数据库分页
// *
// * @return true:支持当前的分页查询方式
// */
// public boolean supportsLimit();
//
// /**
// * 将sql转换为分页SQL,分别调用分页sql
// *
// * @param sql SQL语句
// * @param offset 开始条数
// * @param limit 每页显示多少纪录条数
// * @return 分页查询的sql
// */
// public String getLimitString(String sql, int offset, int limit);
//
// }
//
// Path: src/main/java/com/aibibang/common/persistence/dialect/DialectFactory.java
// public class DialectFactory {
//
// public static Dialect getDialect(Connection connection) {
//
// Dialect dialect = null;
//
// try {
//
// DatabaseMetaData md = connection.getMetaData();
// String dbType = md.getDatabaseProductName().toLowerCase();
// if ("db2".equals(dbType)){
// dialect = new DB2Dialect();
// }else if("derby".equals(dbType)){
// dialect = new DerbyDialect();
// }else if("h2".equals(dbType)){
// dialect = new H2Dialect();
// }else if("hsql".equals(dbType)){
// dialect = new HSQLDialect();
// }else if("mysql".equals(dbType)){
// dialect = new MySQLDialect();
// }else if("oracle".equals(dbType)){
// dialect = new OracleDialect();
// }else if("postgre".equals(dbType)){
// dialect = new PostgreSQLDialect();
// }else if("mssql".equals(dbType) || "sqlserver".equals(dbType)){
// dialect = new SQLServer2005Dialect();
// }else if("sybase".equals(dbType)){
// dialect = new SybaseDialect();
// }
// if (dialect == null) {
// throw new RuntimeException("mybatis dialect error.");
// }
// } catch (Exception e) {
//
// e.printStackTrace();
// }
//
// return dialect;
// }
// }
// Path: src/main/java/com/aibibang/common/persistence/PaginationInterceptor.java
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.util.Properties;
import org.apache.ibatis.executor.parameter.ParameterHandler;
import org.apache.ibatis.executor.statement.StatementHandler;
import org.apache.ibatis.mapping.BoundSql;
import org.apache.ibatis.plugin.Interceptor;
import org.apache.ibatis.plugin.Intercepts;
import org.apache.ibatis.plugin.Invocation;
import org.apache.ibatis.plugin.Plugin;
import org.apache.ibatis.plugin.Signature;
import org.apache.ibatis.reflection.MetaObject;
import org.apache.ibatis.reflection.factory.DefaultObjectFactory;
import org.apache.ibatis.reflection.factory.ObjectFactory;
import org.apache.ibatis.reflection.wrapper.DefaultObjectWrapperFactory;
import org.apache.ibatis.reflection.wrapper.ObjectWrapperFactory;
import org.apache.ibatis.session.RowBounds;
import org.apache.log4j.Logger;
import com.aibibang.common.persistence.dialect.Dialect;
import com.aibibang.common.persistence.dialect.DialectFactory;
package com.aibibang.common.persistence;
/**
* 分页拦截器
*
* @author King
*
*/
@Intercepts({ @Signature(type = StatementHandler.class, method = "prepare", args = { Connection.class }) })
public class PaginationInterceptor implements Interceptor {
private final static Logger logger = Logger.getLogger(PaginationInterceptor.class);
private static final ObjectFactory DEFAULT_OBJECT_FACTORY = new DefaultObjectFactory();
private static final ObjectWrapperFactory DEFAULT_OBJECT_WRAPPER_FACTORY = new DefaultObjectWrapperFactory();
@Override
public Object intercept(Invocation invocation) throws Throwable {
StatementHandler statementHandler = (StatementHandler) invocation.getTarget();
ParameterHandler parameterHandler = statementHandler.getParameterHandler();
BoundSql boundSql = statementHandler.getBoundSql();
MetaObject metaStatementHandler = MetaObject.forObject(statementHandler, DEFAULT_OBJECT_FACTORY, DEFAULT_OBJECT_WRAPPER_FACTORY);
RowBounds rowBounds = (RowBounds) metaStatementHandler.getValue("delegate.rowBounds");
String originalSql = (String) metaStatementHandler.getValue("delegate.boundSql.sql");
logger.info("SQL : " + CountSqlHelper.getLineSql(originalSql));
// 没有分页参数
if (rowBounds == null || rowBounds == RowBounds.DEFAULT) {
return invocation.proceed();
}
// 获取总记录数
Page<?> page = (Page<?>) rowBounds;
//Configuration configuration = (Configuration) metaStatementHandler.getValue("delegate.configuration");
//Dialect dialect = DialectFactory.buildDialect(configuration);
//String countSql = dialect.getCountString(originalSql);
Connection connection = (Connection) invocation.getArgs()[0]; | Dialect dialect = DialectFactory.getDialect(connection); |
TrumanDu/AutoProgramming | src/main/java/com/aibibang/common/base/BaseEntity.java | // Path: src/main/java/com/aibibang/common/constant/Globals.java
// public final class Globals {
//
// /**
// * 用户类型:正常
// */
// public static String USER_TYPE_NORMAL = "0";
// /**
// * 用户类型:删除
// */
// public static String USER_TYPE_DEL = "1";
// /**
// * 用户类型:超级管理员
// */
// public static String USER_TYPE_ADMIN = "-1";
//
// }
| import java.io.Serializable;
import java.util.Date;
import com.aibibang.common.constant.Globals;
| package com.aibibang.common.base;
/**
* Entity基础类
*
* @author King
*
*/
public class BaseEntity implements Serializable {
private static final long serialVersionUID = 1L;
/** 主键ID */
private Long id;
/** 创建人 */
private Long createUser;
/** 创建日期 */
private Date createDate;
/** 修改人 */
private Long updateUser;
/** 修改日期 */
private Date updateDate;
/** 删除标识(0:正常;1:删除)默认正常 */
| // Path: src/main/java/com/aibibang/common/constant/Globals.java
// public final class Globals {
//
// /**
// * 用户类型:正常
// */
// public static String USER_TYPE_NORMAL = "0";
// /**
// * 用户类型:删除
// */
// public static String USER_TYPE_DEL = "1";
// /**
// * 用户类型:超级管理员
// */
// public static String USER_TYPE_ADMIN = "-1";
//
// }
// Path: src/main/java/com/aibibang/common/base/BaseEntity.java
import java.io.Serializable;
import java.util.Date;
import com.aibibang.common.constant.Globals;
package com.aibibang.common.base;
/**
* Entity基础类
*
* @author King
*
*/
public class BaseEntity implements Serializable {
private static final long serialVersionUID = 1L;
/** 主键ID */
private Long id;
/** 创建人 */
private Long createUser;
/** 创建日期 */
private Date createDate;
/** 修改人 */
private Long updateUser;
/** 修改日期 */
private Date updateDate;
/** 删除标识(0:正常;1:删除)默认正常 */
| private String delFlag = Globals.USER_TYPE_NORMAL;
|
TrumanDu/AutoProgramming | src/main/java/com/aibibang/web/system/service/impl/SysMenuServiceImpl.java | // Path: src/main/java/com/aibibang/web/system/dao/SysMenuDao.java
// public interface SysMenuDao extends BaseDao<SysMenu, Long> {
//
// public List<SysMenu> getByParentId(Long parentId);
//
// public void deleteByParentId(Long parentId);
//
// public List<SysMenu> findForTreeTable(Long parentId);
//
// }
//
// Path: src/main/java/com/aibibang/web/system/entity/SysMenu.java
// public class SysMenu extends BaseEntity implements Serializable {
//
// private static final long serialVersionUID = 1L;
//
// /** 菜单名称 */
// private String menuName;
// /** 菜单路径 */
// private String menuUrl;
// /** 菜单图标 */
// private String menuIcon;
// /** 父级菜单ID */
// private Long parentId;
// /** 排序 */
// private Integer sort;
//
// /** 记录下级菜单的数量 */
// private Integer childNum;
// /** 父级菜单 */
// private SysMenu parentMenu;
// /** 子菜单集合 */
// private List<SysMenu> children = new ArrayList<SysMenu>();
//
// public String getMenuName() {
// return menuName;
// }
// public void setMenuName(String menuName) {
// this.menuName = menuName;
// }
// public String getMenuUrl() {
// return menuUrl;
// }
// public void setMenuUrl(String menuUrl) {
// this.menuUrl = menuUrl;
// }
// public String getMenuIcon() {
// return menuIcon;
// }
// public void setMenuIcon(String menuIcon) {
// this.menuIcon = menuIcon;
// }
// public Long getParentId() {
// return parentId;
// }
// public void setParentId(Long parentId) {
// this.parentId = parentId;
// }
// public Integer getSort() {
// return sort;
// }
// public void setSort(Integer sort) {
// this.sort = sort;
// }
//
// public Integer getChildNum() {
// return childNum;
// }
// public void setChildNum(Integer childNum) {
// this.childNum = childNum;
// }
//
// public SysMenu getParentMenu() {
// return parentMenu;
// }
// public void setParentMenu(SysMenu parentMenu) {
// this.parentMenu = parentMenu;
// }
// public List<SysMenu> getChildren() {
// return children;
// }
// public void setChildren(List<SysMenu> children) {
// this.children = children;
// }
//
// }
//
// Path: src/main/java/com/aibibang/web/system/service/SysMenuService.java
// public interface SysMenuService {
//
// public List<SysMenu> find(SysMenu menu);
//
// public List<SysMenu> getByParentId(Long parentId);
//
// public SysMenu getById(Long id);
//
// public void add(SysMenu menu);
//
// public void update(SysMenu menu);
//
// public void delete(Long id);
//
// public List<SysMenu> findForTreeTable(Long parentId);
//
// }
| import java.util.List;
import javax.annotation.Resource;
import org.springframework.stereotype.Service;
import com.aibibang.web.system.dao.SysMenuDao;
import com.aibibang.web.system.entity.SysMenu;
import com.aibibang.web.system.service.SysMenuService;
| package com.aibibang.web.system.service.impl;
@Service("SysMenuService")
public class SysMenuServiceImpl implements SysMenuService {
@Resource
| // Path: src/main/java/com/aibibang/web/system/dao/SysMenuDao.java
// public interface SysMenuDao extends BaseDao<SysMenu, Long> {
//
// public List<SysMenu> getByParentId(Long parentId);
//
// public void deleteByParentId(Long parentId);
//
// public List<SysMenu> findForTreeTable(Long parentId);
//
// }
//
// Path: src/main/java/com/aibibang/web/system/entity/SysMenu.java
// public class SysMenu extends BaseEntity implements Serializable {
//
// private static final long serialVersionUID = 1L;
//
// /** 菜单名称 */
// private String menuName;
// /** 菜单路径 */
// private String menuUrl;
// /** 菜单图标 */
// private String menuIcon;
// /** 父级菜单ID */
// private Long parentId;
// /** 排序 */
// private Integer sort;
//
// /** 记录下级菜单的数量 */
// private Integer childNum;
// /** 父级菜单 */
// private SysMenu parentMenu;
// /** 子菜单集合 */
// private List<SysMenu> children = new ArrayList<SysMenu>();
//
// public String getMenuName() {
// return menuName;
// }
// public void setMenuName(String menuName) {
// this.menuName = menuName;
// }
// public String getMenuUrl() {
// return menuUrl;
// }
// public void setMenuUrl(String menuUrl) {
// this.menuUrl = menuUrl;
// }
// public String getMenuIcon() {
// return menuIcon;
// }
// public void setMenuIcon(String menuIcon) {
// this.menuIcon = menuIcon;
// }
// public Long getParentId() {
// return parentId;
// }
// public void setParentId(Long parentId) {
// this.parentId = parentId;
// }
// public Integer getSort() {
// return sort;
// }
// public void setSort(Integer sort) {
// this.sort = sort;
// }
//
// public Integer getChildNum() {
// return childNum;
// }
// public void setChildNum(Integer childNum) {
// this.childNum = childNum;
// }
//
// public SysMenu getParentMenu() {
// return parentMenu;
// }
// public void setParentMenu(SysMenu parentMenu) {
// this.parentMenu = parentMenu;
// }
// public List<SysMenu> getChildren() {
// return children;
// }
// public void setChildren(List<SysMenu> children) {
// this.children = children;
// }
//
// }
//
// Path: src/main/java/com/aibibang/web/system/service/SysMenuService.java
// public interface SysMenuService {
//
// public List<SysMenu> find(SysMenu menu);
//
// public List<SysMenu> getByParentId(Long parentId);
//
// public SysMenu getById(Long id);
//
// public void add(SysMenu menu);
//
// public void update(SysMenu menu);
//
// public void delete(Long id);
//
// public List<SysMenu> findForTreeTable(Long parentId);
//
// }
// Path: src/main/java/com/aibibang/web/system/service/impl/SysMenuServiceImpl.java
import java.util.List;
import javax.annotation.Resource;
import org.springframework.stereotype.Service;
import com.aibibang.web.system.dao.SysMenuDao;
import com.aibibang.web.system.entity.SysMenu;
import com.aibibang.web.system.service.SysMenuService;
package com.aibibang.web.system.service.impl;
@Service("SysMenuService")
public class SysMenuServiceImpl implements SysMenuService {
@Resource
| private SysMenuDao sysMenuDao;
|
TrumanDu/AutoProgramming | src/main/java/com/aibibang/web/system/service/impl/SysMenuServiceImpl.java | // Path: src/main/java/com/aibibang/web/system/dao/SysMenuDao.java
// public interface SysMenuDao extends BaseDao<SysMenu, Long> {
//
// public List<SysMenu> getByParentId(Long parentId);
//
// public void deleteByParentId(Long parentId);
//
// public List<SysMenu> findForTreeTable(Long parentId);
//
// }
//
// Path: src/main/java/com/aibibang/web/system/entity/SysMenu.java
// public class SysMenu extends BaseEntity implements Serializable {
//
// private static final long serialVersionUID = 1L;
//
// /** 菜单名称 */
// private String menuName;
// /** 菜单路径 */
// private String menuUrl;
// /** 菜单图标 */
// private String menuIcon;
// /** 父级菜单ID */
// private Long parentId;
// /** 排序 */
// private Integer sort;
//
// /** 记录下级菜单的数量 */
// private Integer childNum;
// /** 父级菜单 */
// private SysMenu parentMenu;
// /** 子菜单集合 */
// private List<SysMenu> children = new ArrayList<SysMenu>();
//
// public String getMenuName() {
// return menuName;
// }
// public void setMenuName(String menuName) {
// this.menuName = menuName;
// }
// public String getMenuUrl() {
// return menuUrl;
// }
// public void setMenuUrl(String menuUrl) {
// this.menuUrl = menuUrl;
// }
// public String getMenuIcon() {
// return menuIcon;
// }
// public void setMenuIcon(String menuIcon) {
// this.menuIcon = menuIcon;
// }
// public Long getParentId() {
// return parentId;
// }
// public void setParentId(Long parentId) {
// this.parentId = parentId;
// }
// public Integer getSort() {
// return sort;
// }
// public void setSort(Integer sort) {
// this.sort = sort;
// }
//
// public Integer getChildNum() {
// return childNum;
// }
// public void setChildNum(Integer childNum) {
// this.childNum = childNum;
// }
//
// public SysMenu getParentMenu() {
// return parentMenu;
// }
// public void setParentMenu(SysMenu parentMenu) {
// this.parentMenu = parentMenu;
// }
// public List<SysMenu> getChildren() {
// return children;
// }
// public void setChildren(List<SysMenu> children) {
// this.children = children;
// }
//
// }
//
// Path: src/main/java/com/aibibang/web/system/service/SysMenuService.java
// public interface SysMenuService {
//
// public List<SysMenu> find(SysMenu menu);
//
// public List<SysMenu> getByParentId(Long parentId);
//
// public SysMenu getById(Long id);
//
// public void add(SysMenu menu);
//
// public void update(SysMenu menu);
//
// public void delete(Long id);
//
// public List<SysMenu> findForTreeTable(Long parentId);
//
// }
| import java.util.List;
import javax.annotation.Resource;
import org.springframework.stereotype.Service;
import com.aibibang.web.system.dao.SysMenuDao;
import com.aibibang.web.system.entity.SysMenu;
import com.aibibang.web.system.service.SysMenuService;
| package com.aibibang.web.system.service.impl;
@Service("SysMenuService")
public class SysMenuServiceImpl implements SysMenuService {
@Resource
private SysMenuDao sysMenuDao;
@Override
| // Path: src/main/java/com/aibibang/web/system/dao/SysMenuDao.java
// public interface SysMenuDao extends BaseDao<SysMenu, Long> {
//
// public List<SysMenu> getByParentId(Long parentId);
//
// public void deleteByParentId(Long parentId);
//
// public List<SysMenu> findForTreeTable(Long parentId);
//
// }
//
// Path: src/main/java/com/aibibang/web/system/entity/SysMenu.java
// public class SysMenu extends BaseEntity implements Serializable {
//
// private static final long serialVersionUID = 1L;
//
// /** 菜单名称 */
// private String menuName;
// /** 菜单路径 */
// private String menuUrl;
// /** 菜单图标 */
// private String menuIcon;
// /** 父级菜单ID */
// private Long parentId;
// /** 排序 */
// private Integer sort;
//
// /** 记录下级菜单的数量 */
// private Integer childNum;
// /** 父级菜单 */
// private SysMenu parentMenu;
// /** 子菜单集合 */
// private List<SysMenu> children = new ArrayList<SysMenu>();
//
// public String getMenuName() {
// return menuName;
// }
// public void setMenuName(String menuName) {
// this.menuName = menuName;
// }
// public String getMenuUrl() {
// return menuUrl;
// }
// public void setMenuUrl(String menuUrl) {
// this.menuUrl = menuUrl;
// }
// public String getMenuIcon() {
// return menuIcon;
// }
// public void setMenuIcon(String menuIcon) {
// this.menuIcon = menuIcon;
// }
// public Long getParentId() {
// return parentId;
// }
// public void setParentId(Long parentId) {
// this.parentId = parentId;
// }
// public Integer getSort() {
// return sort;
// }
// public void setSort(Integer sort) {
// this.sort = sort;
// }
//
// public Integer getChildNum() {
// return childNum;
// }
// public void setChildNum(Integer childNum) {
// this.childNum = childNum;
// }
//
// public SysMenu getParentMenu() {
// return parentMenu;
// }
// public void setParentMenu(SysMenu parentMenu) {
// this.parentMenu = parentMenu;
// }
// public List<SysMenu> getChildren() {
// return children;
// }
// public void setChildren(List<SysMenu> children) {
// this.children = children;
// }
//
// }
//
// Path: src/main/java/com/aibibang/web/system/service/SysMenuService.java
// public interface SysMenuService {
//
// public List<SysMenu> find(SysMenu menu);
//
// public List<SysMenu> getByParentId(Long parentId);
//
// public SysMenu getById(Long id);
//
// public void add(SysMenu menu);
//
// public void update(SysMenu menu);
//
// public void delete(Long id);
//
// public List<SysMenu> findForTreeTable(Long parentId);
//
// }
// Path: src/main/java/com/aibibang/web/system/service/impl/SysMenuServiceImpl.java
import java.util.List;
import javax.annotation.Resource;
import org.springframework.stereotype.Service;
import com.aibibang.web.system.dao.SysMenuDao;
import com.aibibang.web.system.entity.SysMenu;
import com.aibibang.web.system.service.SysMenuService;
package com.aibibang.web.system.service.impl;
@Service("SysMenuService")
public class SysMenuServiceImpl implements SysMenuService {
@Resource
private SysMenuDao sysMenuDao;
@Override
| public List<SysMenu> find(SysMenu menu) {
|
TrumanDu/AutoProgramming | src/main/java/com/aibibang/web/system/controller/IndexController.java | // Path: src/main/java/com/aibibang/common/base/BaseController.java
// public class BaseController {
//
// /**
// * 将前台传递过来的日期格式的字符串,自动转化为Date类型
// *
// * @param binder
// */
// @InitBinder
// public void initBinder(ServletRequestDataBinder binder) {
//
// binder.registerCustomEditor(Date.class, new DateConvertEditor());
// }
//
// /**
// * 抽取由逗号分隔的主键列表
// *
// * @param ids
// * @return
// */
// protected List<String> extractIdListByComma(String ids) {
// List<String> result = new ArrayList<String>();
// if (StringUtils.hasText(ids)) {
// for (String id : ids.split(",")) {
// if (StringUtils.hasLength(id)) {
// result.add(id.trim());
// }
// }
// }
//
// return result;
// }
//
// /**
// * 获取登录的当前用户信息
// *
// * @return
// */
// public SysUser getCurrentUser(){
//
// HttpSession session = ContextHolderUtil.getSession();
// SysUser user = (SysUser)session.getAttribute(SessionAttr.USER_LOGIN.getValue());
//
// return user;
// }
// }
//
// Path: src/main/java/com/aibibang/common/constant/SessionAttr.java
// public enum SessionAttr {
//
// USER_LOGIN("USER_LOGIN"),
// USER_ROLES("USER_ROLES"),
// USER_MENUS("USER_MENUS");
//
// private SessionAttr(String name) {
// this.name = name;
// }
//
// private String name;
//
// public String getValue() {
//
// return this.name;
// }
//
//
// }
| import javax.servlet.http.HttpServletRequest;
import org.apache.commons.lang.StringUtils;
import org.apache.log4j.Logger;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import com.aibibang.common.base.BaseController;
import com.aibibang.common.constant.SessionAttr;
| package com.aibibang.web.system.controller;
@Controller
@RequestMapping("/index")
| // Path: src/main/java/com/aibibang/common/base/BaseController.java
// public class BaseController {
//
// /**
// * 将前台传递过来的日期格式的字符串,自动转化为Date类型
// *
// * @param binder
// */
// @InitBinder
// public void initBinder(ServletRequestDataBinder binder) {
//
// binder.registerCustomEditor(Date.class, new DateConvertEditor());
// }
//
// /**
// * 抽取由逗号分隔的主键列表
// *
// * @param ids
// * @return
// */
// protected List<String> extractIdListByComma(String ids) {
// List<String> result = new ArrayList<String>();
// if (StringUtils.hasText(ids)) {
// for (String id : ids.split(",")) {
// if (StringUtils.hasLength(id)) {
// result.add(id.trim());
// }
// }
// }
//
// return result;
// }
//
// /**
// * 获取登录的当前用户信息
// *
// * @return
// */
// public SysUser getCurrentUser(){
//
// HttpSession session = ContextHolderUtil.getSession();
// SysUser user = (SysUser)session.getAttribute(SessionAttr.USER_LOGIN.getValue());
//
// return user;
// }
// }
//
// Path: src/main/java/com/aibibang/common/constant/SessionAttr.java
// public enum SessionAttr {
//
// USER_LOGIN("USER_LOGIN"),
// USER_ROLES("USER_ROLES"),
// USER_MENUS("USER_MENUS");
//
// private SessionAttr(String name) {
// this.name = name;
// }
//
// private String name;
//
// public String getValue() {
//
// return this.name;
// }
//
//
// }
// Path: src/main/java/com/aibibang/web/system/controller/IndexController.java
import javax.servlet.http.HttpServletRequest;
import org.apache.commons.lang.StringUtils;
import org.apache.log4j.Logger;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import com.aibibang.common.base.BaseController;
import com.aibibang.common.constant.SessionAttr;
package com.aibibang.web.system.controller;
@Controller
@RequestMapping("/index")
| public class IndexController extends BaseController {
|
TrumanDu/AutoProgramming | src/main/java/com/aibibang/web/system/controller/IndexController.java | // Path: src/main/java/com/aibibang/common/base/BaseController.java
// public class BaseController {
//
// /**
// * 将前台传递过来的日期格式的字符串,自动转化为Date类型
// *
// * @param binder
// */
// @InitBinder
// public void initBinder(ServletRequestDataBinder binder) {
//
// binder.registerCustomEditor(Date.class, new DateConvertEditor());
// }
//
// /**
// * 抽取由逗号分隔的主键列表
// *
// * @param ids
// * @return
// */
// protected List<String> extractIdListByComma(String ids) {
// List<String> result = new ArrayList<String>();
// if (StringUtils.hasText(ids)) {
// for (String id : ids.split(",")) {
// if (StringUtils.hasLength(id)) {
// result.add(id.trim());
// }
// }
// }
//
// return result;
// }
//
// /**
// * 获取登录的当前用户信息
// *
// * @return
// */
// public SysUser getCurrentUser(){
//
// HttpSession session = ContextHolderUtil.getSession();
// SysUser user = (SysUser)session.getAttribute(SessionAttr.USER_LOGIN.getValue());
//
// return user;
// }
// }
//
// Path: src/main/java/com/aibibang/common/constant/SessionAttr.java
// public enum SessionAttr {
//
// USER_LOGIN("USER_LOGIN"),
// USER_ROLES("USER_ROLES"),
// USER_MENUS("USER_MENUS");
//
// private SessionAttr(String name) {
// this.name = name;
// }
//
// private String name;
//
// public String getValue() {
//
// return this.name;
// }
//
//
// }
| import javax.servlet.http.HttpServletRequest;
import org.apache.commons.lang.StringUtils;
import org.apache.log4j.Logger;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import com.aibibang.common.base.BaseController;
import com.aibibang.common.constant.SessionAttr;
| package com.aibibang.web.system.controller;
@Controller
@RequestMapping("/index")
public class IndexController extends BaseController {
private Logger logger = Logger.getLogger(IndexController.class);
@RequestMapping("")
public String login(String theme,HttpServletRequest request){
| // Path: src/main/java/com/aibibang/common/base/BaseController.java
// public class BaseController {
//
// /**
// * 将前台传递过来的日期格式的字符串,自动转化为Date类型
// *
// * @param binder
// */
// @InitBinder
// public void initBinder(ServletRequestDataBinder binder) {
//
// binder.registerCustomEditor(Date.class, new DateConvertEditor());
// }
//
// /**
// * 抽取由逗号分隔的主键列表
// *
// * @param ids
// * @return
// */
// protected List<String> extractIdListByComma(String ids) {
// List<String> result = new ArrayList<String>();
// if (StringUtils.hasText(ids)) {
// for (String id : ids.split(",")) {
// if (StringUtils.hasLength(id)) {
// result.add(id.trim());
// }
// }
// }
//
// return result;
// }
//
// /**
// * 获取登录的当前用户信息
// *
// * @return
// */
// public SysUser getCurrentUser(){
//
// HttpSession session = ContextHolderUtil.getSession();
// SysUser user = (SysUser)session.getAttribute(SessionAttr.USER_LOGIN.getValue());
//
// return user;
// }
// }
//
// Path: src/main/java/com/aibibang/common/constant/SessionAttr.java
// public enum SessionAttr {
//
// USER_LOGIN("USER_LOGIN"),
// USER_ROLES("USER_ROLES"),
// USER_MENUS("USER_MENUS");
//
// private SessionAttr(String name) {
// this.name = name;
// }
//
// private String name;
//
// public String getValue() {
//
// return this.name;
// }
//
//
// }
// Path: src/main/java/com/aibibang/web/system/controller/IndexController.java
import javax.servlet.http.HttpServletRequest;
import org.apache.commons.lang.StringUtils;
import org.apache.log4j.Logger;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import com.aibibang.common.base.BaseController;
import com.aibibang.common.constant.SessionAttr;
package com.aibibang.web.system.controller;
@Controller
@RequestMapping("/index")
public class IndexController extends BaseController {
private Logger logger = Logger.getLogger(IndexController.class);
@RequestMapping("")
public String login(String theme,HttpServletRequest request){
| String userMenu = (String)request.getSession().getAttribute(SessionAttr.USER_MENUS.getValue());
|
milesibastos/jTDS | src/main/net/sourceforge/jtds/jdbc/TdsCore.java | // Path: src/main/net/sourceforge/jtds/ssl/Ssl.java
// public interface Ssl {
// /**
// * SSL is not used.
// */
// String SSL_OFF = "off";
// /**
// * SSL is requested; a plain socket is used if SSL is not available.
// */
// String SSL_REQUEST = "request";
// /**
// * SSL is required; an exception if thrown if SSL is not available.
// */
// String SSL_REQUIRE = "require";
// /**
// * SSL is required and the server must return a certificate signed by a
// * client-trusted authority.
// */
// String SSL_AUTHENTICATE = "authenticate";
// /** Size of TLS record header. */
// int TLS_HEADER_SIZE = 5;
// /** TLS Change Cipher Spec record type. */
// byte TYPE_CHANGECIPHERSPEC = 20;
// /** TLS Alert record type. */
// byte TYPE_ALERT = 21;
// /** TLS Handshake record. */
// byte TYPE_HANDSHAKE = 22;
// /** TLS Application data record. */
// byte TYPE_APPLICATIONDATA = 23;
// /** TLS Hand shake Header Size. */
// int HS_HEADER_SIZE = 4;
// /** TLS Hand shake client key exchange sub type. */
// int TYPE_CLIENTKEYEXCHANGE = 16;
// /** TLS Hand shake client hello sub type. */
// int TYPE_CLIENTHELLO = 1;
//
// }
| import java.io.IOException;
import java.net.InetAddress;
import java.net.UnknownHostException;
import java.sql.ResultSetMetaData;
import java.sql.SQLException;
import java.sql.SQLTimeoutException;
import java.sql.SQLWarning;
import java.sql.Types;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Random;
import org.ietf.jgss.GSSContext;
import org.ietf.jgss.GSSException;
import org.ietf.jgss.GSSManager;
import org.ietf.jgss.GSSName;
import org.ietf.jgss.Oid;
import net.sourceforge.jtds.ssl.Ssl;
import net.sourceforge.jtds.util.Logger;
import net.sourceforge.jtds.util.SSPIJNIClient;
import net.sourceforge.jtds.util.TimerThread; | }
return EMPTY_PARAMETER_INFO;
}
/**
* Retrieve the current result set data items.
*
* @return the row data as an <code>Object</code> array
*/
Object[] getRowData() {
return rowData;
}
/**
* Negotiate SSL settings with SQL 2000+ server.
* <p/>
* Server returns the following values for SSL mode:
* <ol>
* <ll>0 = Certificate installed encrypt login packet only.
* <li>1 = Certificate installed client requests force encryption.
* <li>2 = No certificate no encryption possible.
* <li>3 = Server requests force encryption.
* </ol>
* @param instance The server instance name.
* @param ssl The SSL URL property value.
* @throws IOException
*/
void negotiateSSL(String instance, String ssl)
throws IOException, SQLException { | // Path: src/main/net/sourceforge/jtds/ssl/Ssl.java
// public interface Ssl {
// /**
// * SSL is not used.
// */
// String SSL_OFF = "off";
// /**
// * SSL is requested; a plain socket is used if SSL is not available.
// */
// String SSL_REQUEST = "request";
// /**
// * SSL is required; an exception if thrown if SSL is not available.
// */
// String SSL_REQUIRE = "require";
// /**
// * SSL is required and the server must return a certificate signed by a
// * client-trusted authority.
// */
// String SSL_AUTHENTICATE = "authenticate";
// /** Size of TLS record header. */
// int TLS_HEADER_SIZE = 5;
// /** TLS Change Cipher Spec record type. */
// byte TYPE_CHANGECIPHERSPEC = 20;
// /** TLS Alert record type. */
// byte TYPE_ALERT = 21;
// /** TLS Handshake record. */
// byte TYPE_HANDSHAKE = 22;
// /** TLS Application data record. */
// byte TYPE_APPLICATIONDATA = 23;
// /** TLS Hand shake Header Size. */
// int HS_HEADER_SIZE = 4;
// /** TLS Hand shake client key exchange sub type. */
// int TYPE_CLIENTKEYEXCHANGE = 16;
// /** TLS Hand shake client hello sub type. */
// int TYPE_CLIENTHELLO = 1;
//
// }
// Path: src/main/net/sourceforge/jtds/jdbc/TdsCore.java
import java.io.IOException;
import java.net.InetAddress;
import java.net.UnknownHostException;
import java.sql.ResultSetMetaData;
import java.sql.SQLException;
import java.sql.SQLTimeoutException;
import java.sql.SQLWarning;
import java.sql.Types;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Random;
import org.ietf.jgss.GSSContext;
import org.ietf.jgss.GSSException;
import org.ietf.jgss.GSSManager;
import org.ietf.jgss.GSSName;
import org.ietf.jgss.Oid;
import net.sourceforge.jtds.ssl.Ssl;
import net.sourceforge.jtds.util.Logger;
import net.sourceforge.jtds.util.SSPIJNIClient;
import net.sourceforge.jtds.util.TimerThread;
}
return EMPTY_PARAMETER_INFO;
}
/**
* Retrieve the current result set data items.
*
* @return the row data as an <code>Object</code> array
*/
Object[] getRowData() {
return rowData;
}
/**
* Negotiate SSL settings with SQL 2000+ server.
* <p/>
* Server returns the following values for SSL mode:
* <ol>
* <ll>0 = Certificate installed encrypt login packet only.
* <li>1 = Certificate installed client requests force encryption.
* <li>2 = No certificate no encryption possible.
* <li>3 = Server requests force encryption.
* </ol>
* @param instance The server instance name.
* @param ssl The SSL URL property value.
* @throws IOException
*/
void negotiateSSL(String instance, String ssl)
throws IOException, SQLException { | if (!ssl.equalsIgnoreCase(Ssl.SSL_OFF)) { |
milesibastos/jTDS | src/main/net/sourceforge/jtds/jdbc/Driver.java | // Path: src/main/net/sourceforge/jtds/ssl/Ssl.java
// public interface Ssl {
// /**
// * SSL is not used.
// */
// String SSL_OFF = "off";
// /**
// * SSL is requested; a plain socket is used if SSL is not available.
// */
// String SSL_REQUEST = "request";
// /**
// * SSL is required; an exception if thrown if SSL is not available.
// */
// String SSL_REQUIRE = "require";
// /**
// * SSL is required and the server must return a certificate signed by a
// * client-trusted authority.
// */
// String SSL_AUTHENTICATE = "authenticate";
// /** Size of TLS record header. */
// int TLS_HEADER_SIZE = 5;
// /** TLS Change Cipher Spec record type. */
// byte TYPE_CHANGECIPHERSPEC = 20;
// /** TLS Alert record type. */
// byte TYPE_ALERT = 21;
// /** TLS Handshake record. */
// byte TYPE_HANDSHAKE = 22;
// /** TLS Application data record. */
// byte TYPE_APPLICATIONDATA = 23;
// /** TLS Hand shake Header Size. */
// int HS_HEADER_SIZE = 4;
// /** TLS Hand shake client key exchange sub type. */
// int TYPE_CLIENTKEYEXCHANGE = 16;
// /** TLS Hand shake client hello sub type. */
// int TYPE_CLIENTHELLO = 1;
//
// }
| import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.DriverPropertyInfo;
import java.sql.SQLException;
import java.util.Enumeration;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
import java.util.Properties;
import net.sourceforge.jtds.ssl.Ssl; | choicesMap.put(Messages.get(Driver.NAMEDPIPE), booleanChoices);
choicesMap.put(Messages.get(Driver.TCPNODELAY), booleanChoices);
choicesMap.put(Messages.get(Driver.SENDSTRINGPARAMETERSASUNICODE), booleanChoices);
choicesMap.put(Messages.get(Driver.USECURSORS), booleanChoices);
choicesMap.put(Messages.get(Driver.USELOBS), booleanChoices);
choicesMap.put(Messages.get(Driver.XAEMULATION), booleanChoices);
final String[] prepareSqlChoices = new String[]{
String.valueOf(TdsCore.UNPREPARED),
String.valueOf(TdsCore.TEMPORARY_STORED_PROCEDURES),
String.valueOf(TdsCore.EXECUTE_SQL),
String.valueOf(TdsCore.PREPARE),
};
choicesMap.put(Messages.get(Driver.PREPARESQL), prepareSqlChoices);
final String[] serverTypeChoices = new String[]{
String.valueOf(SQLSERVER),
String.valueOf(SYBASE),
};
choicesMap.put(Messages.get(Driver.SERVERTYPE), serverTypeChoices);
final String[] tdsChoices = new String[]{
DefaultProperties.TDS_VERSION_42,
DefaultProperties.TDS_VERSION_50,
DefaultProperties.TDS_VERSION_70,
DefaultProperties.TDS_VERSION_80,
};
choicesMap.put(Messages.get(Driver.TDS), tdsChoices);
final String[] sslChoices = new String[]{ | // Path: src/main/net/sourceforge/jtds/ssl/Ssl.java
// public interface Ssl {
// /**
// * SSL is not used.
// */
// String SSL_OFF = "off";
// /**
// * SSL is requested; a plain socket is used if SSL is not available.
// */
// String SSL_REQUEST = "request";
// /**
// * SSL is required; an exception if thrown if SSL is not available.
// */
// String SSL_REQUIRE = "require";
// /**
// * SSL is required and the server must return a certificate signed by a
// * client-trusted authority.
// */
// String SSL_AUTHENTICATE = "authenticate";
// /** Size of TLS record header. */
// int TLS_HEADER_SIZE = 5;
// /** TLS Change Cipher Spec record type. */
// byte TYPE_CHANGECIPHERSPEC = 20;
// /** TLS Alert record type. */
// byte TYPE_ALERT = 21;
// /** TLS Handshake record. */
// byte TYPE_HANDSHAKE = 22;
// /** TLS Application data record. */
// byte TYPE_APPLICATIONDATA = 23;
// /** TLS Hand shake Header Size. */
// int HS_HEADER_SIZE = 4;
// /** TLS Hand shake client key exchange sub type. */
// int TYPE_CLIENTKEYEXCHANGE = 16;
// /** TLS Hand shake client hello sub type. */
// int TYPE_CLIENTHELLO = 1;
//
// }
// Path: src/main/net/sourceforge/jtds/jdbc/Driver.java
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.DriverPropertyInfo;
import java.sql.SQLException;
import java.util.Enumeration;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
import java.util.Properties;
import net.sourceforge.jtds.ssl.Ssl;
choicesMap.put(Messages.get(Driver.NAMEDPIPE), booleanChoices);
choicesMap.put(Messages.get(Driver.TCPNODELAY), booleanChoices);
choicesMap.put(Messages.get(Driver.SENDSTRINGPARAMETERSASUNICODE), booleanChoices);
choicesMap.put(Messages.get(Driver.USECURSORS), booleanChoices);
choicesMap.put(Messages.get(Driver.USELOBS), booleanChoices);
choicesMap.put(Messages.get(Driver.XAEMULATION), booleanChoices);
final String[] prepareSqlChoices = new String[]{
String.valueOf(TdsCore.UNPREPARED),
String.valueOf(TdsCore.TEMPORARY_STORED_PROCEDURES),
String.valueOf(TdsCore.EXECUTE_SQL),
String.valueOf(TdsCore.PREPARE),
};
choicesMap.put(Messages.get(Driver.PREPARESQL), prepareSqlChoices);
final String[] serverTypeChoices = new String[]{
String.valueOf(SQLSERVER),
String.valueOf(SYBASE),
};
choicesMap.put(Messages.get(Driver.SERVERTYPE), serverTypeChoices);
final String[] tdsChoices = new String[]{
DefaultProperties.TDS_VERSION_42,
DefaultProperties.TDS_VERSION_50,
DefaultProperties.TDS_VERSION_70,
DefaultProperties.TDS_VERSION_80,
};
choicesMap.put(Messages.get(Driver.TDS), tdsChoices);
final String[] sslChoices = new String[]{ | Ssl.SSL_OFF, |
stefanhaustein/HtmlView2 | htmlview2/src/main/java/org/kobjects/htmlview2/Hv2DomDocument.java | // Path: htmlview2/src/main/java/org/kobjects/dom/Document.java
// public interface Document extends Node {
// Element createElement(String name);
// Text createTextNode(String text);
//
// Element getDocumentElement();
// }
//
// Path: htmlview2/src/main/java/org/kobjects/dom/Element.java
// public interface Element extends Node {
// String getLocalName();
// void setAttribute(String name, String value);
// String getAttribute(String name);
//
// Element getFirstElementChild();
// Element getLastElementChild();
// Element getNextElementSibling();
// Element getPreviousElementSibling();
//
// CSSStyleDeclaration getStyle();
// CSSStyleDeclaration getComputedStyle();
// }
//
// Path: htmlview2/src/main/java/org/kobjects/dom/Node.java
// public interface Node {
// Node getParentNode();
// Element getParentElement();
// Document getOwnerDocument();
//
// Node getFirstChild();
// Node getLastChild();
// Node getNextSibling();
// Node getPreviousSibling();
//
// Node appendChild(Node node);
//
// String getTextContent();
// }
| import org.kobjects.dom.Document;
import org.kobjects.dom.Element;
import org.kobjects.dom.Node; | package org.kobjects.htmlview2;
class Hv2DomDocument extends Hv2DomContainer implements Document {
protected final HtmlView htmlContext;
protected Hv2DomDocument(HtmlView context) {
super(null, ComponentType.PHYSICAL_CONTAINER);
this.htmlContext = context;
}
public Hv2DomElement createElement(String name) {
return new Hv2DomElement(this, name, null);
}
@Override
public Hv2DomText createTextNode(String text) {
return new Hv2DomText(this, text);
}
@Override | // Path: htmlview2/src/main/java/org/kobjects/dom/Document.java
// public interface Document extends Node {
// Element createElement(String name);
// Text createTextNode(String text);
//
// Element getDocumentElement();
// }
//
// Path: htmlview2/src/main/java/org/kobjects/dom/Element.java
// public interface Element extends Node {
// String getLocalName();
// void setAttribute(String name, String value);
// String getAttribute(String name);
//
// Element getFirstElementChild();
// Element getLastElementChild();
// Element getNextElementSibling();
// Element getPreviousElementSibling();
//
// CSSStyleDeclaration getStyle();
// CSSStyleDeclaration getComputedStyle();
// }
//
// Path: htmlview2/src/main/java/org/kobjects/dom/Node.java
// public interface Node {
// Node getParentNode();
// Element getParentElement();
// Document getOwnerDocument();
//
// Node getFirstChild();
// Node getLastChild();
// Node getNextSibling();
// Node getPreviousSibling();
//
// Node appendChild(Node node);
//
// String getTextContent();
// }
// Path: htmlview2/src/main/java/org/kobjects/htmlview2/Hv2DomDocument.java
import org.kobjects.dom.Document;
import org.kobjects.dom.Element;
import org.kobjects.dom.Node;
package org.kobjects.htmlview2;
class Hv2DomDocument extends Hv2DomContainer implements Document {
protected final HtmlView htmlContext;
protected Hv2DomDocument(HtmlView context) {
super(null, ComponentType.PHYSICAL_CONTAINER);
this.htmlContext = context;
}
public Hv2DomElement createElement(String name) {
return new Hv2DomElement(this, name, null);
}
@Override
public Hv2DomText createTextNode(String text) {
return new Hv2DomText(this, text);
}
@Override | public Element getDocumentElement() { |
stefanhaustein/HtmlView2 | htmlview2/src/main/java/org/kobjects/htmlview2/Hv2DomDocument.java | // Path: htmlview2/src/main/java/org/kobjects/dom/Document.java
// public interface Document extends Node {
// Element createElement(String name);
// Text createTextNode(String text);
//
// Element getDocumentElement();
// }
//
// Path: htmlview2/src/main/java/org/kobjects/dom/Element.java
// public interface Element extends Node {
// String getLocalName();
// void setAttribute(String name, String value);
// String getAttribute(String name);
//
// Element getFirstElementChild();
// Element getLastElementChild();
// Element getNextElementSibling();
// Element getPreviousElementSibling();
//
// CSSStyleDeclaration getStyle();
// CSSStyleDeclaration getComputedStyle();
// }
//
// Path: htmlview2/src/main/java/org/kobjects/dom/Node.java
// public interface Node {
// Node getParentNode();
// Element getParentElement();
// Document getOwnerDocument();
//
// Node getFirstChild();
// Node getLastChild();
// Node getNextSibling();
// Node getPreviousSibling();
//
// Node appendChild(Node node);
//
// String getTextContent();
// }
| import org.kobjects.dom.Document;
import org.kobjects.dom.Element;
import org.kobjects.dom.Node; | package org.kobjects.htmlview2;
class Hv2DomDocument extends Hv2DomContainer implements Document {
protected final HtmlView htmlContext;
protected Hv2DomDocument(HtmlView context) {
super(null, ComponentType.PHYSICAL_CONTAINER);
this.htmlContext = context;
}
public Hv2DomElement createElement(String name) {
return new Hv2DomElement(this, name, null);
}
@Override
public Hv2DomText createTextNode(String text) {
return new Hv2DomText(this, text);
}
@Override
public Element getDocumentElement() { | // Path: htmlview2/src/main/java/org/kobjects/dom/Document.java
// public interface Document extends Node {
// Element createElement(String name);
// Text createTextNode(String text);
//
// Element getDocumentElement();
// }
//
// Path: htmlview2/src/main/java/org/kobjects/dom/Element.java
// public interface Element extends Node {
// String getLocalName();
// void setAttribute(String name, String value);
// String getAttribute(String name);
//
// Element getFirstElementChild();
// Element getLastElementChild();
// Element getNextElementSibling();
// Element getPreviousElementSibling();
//
// CSSStyleDeclaration getStyle();
// CSSStyleDeclaration getComputedStyle();
// }
//
// Path: htmlview2/src/main/java/org/kobjects/dom/Node.java
// public interface Node {
// Node getParentNode();
// Element getParentElement();
// Document getOwnerDocument();
//
// Node getFirstChild();
// Node getLastChild();
// Node getNextSibling();
// Node getPreviousSibling();
//
// Node appendChild(Node node);
//
// String getTextContent();
// }
// Path: htmlview2/src/main/java/org/kobjects/htmlview2/Hv2DomDocument.java
import org.kobjects.dom.Document;
import org.kobjects.dom.Element;
import org.kobjects.dom.Node;
package org.kobjects.htmlview2;
class Hv2DomDocument extends Hv2DomContainer implements Document {
protected final HtmlView htmlContext;
protected Hv2DomDocument(HtmlView context) {
super(null, ComponentType.PHYSICAL_CONTAINER);
this.htmlContext = context;
}
public Hv2DomElement createElement(String name) {
return new Hv2DomElement(this, name, null);
}
@Override
public Hv2DomText createTextNode(String text) {
return new Hv2DomText(this, text);
}
@Override
public Element getDocumentElement() { | Node result = getFirstChild(); |
stefanhaustein/HtmlView2 | htmlview2/src/main/java/org/kobjects/htmlview2/Hv2DomContainer.java | // Path: htmlview2/src/main/java/org/kobjects/dom/Node.java
// public interface Node {
// Node getParentNode();
// Element getParentElement();
// Document getOwnerDocument();
//
// Node getFirstChild();
// Node getLastChild();
// Node getNextSibling();
// Node getPreviousSibling();
//
// Node appendChild(Node node);
//
// String getTextContent();
// }
| import org.kobjects.dom.Node; | package org.kobjects.htmlview2;
abstract class Hv2DomContainer extends Hv2DomNode {
enum SyncState {
SYNCED, CHILD_INVALID, INVALID
}
enum ComponentType {
TEXT, // span, b, i, ...
PHYSICAL_CONTAINER, // div, p, all other elements
LOGICAL_CONTAINER, // tr, tbody
INVISIBLE, // head, title, ...
IMAGE, // img
LEAF_COMPONENT // input, select, ...
}
ComponentType componentType;
SyncState syncState;
Hv2DomNode firstChild;
Hv2DomNode lastChild;
Hv2DomContainer(Hv2DomDocument ownerDocument, ComponentType componentType) {
super(ownerDocument);
this.componentType = componentType;
}
public Hv2DomNode getFirstChild() {
return firstChild;
}
public Hv2DomNode getLastChild() {
return lastChild;
}
| // Path: htmlview2/src/main/java/org/kobjects/dom/Node.java
// public interface Node {
// Node getParentNode();
// Element getParentElement();
// Document getOwnerDocument();
//
// Node getFirstChild();
// Node getLastChild();
// Node getNextSibling();
// Node getPreviousSibling();
//
// Node appendChild(Node node);
//
// String getTextContent();
// }
// Path: htmlview2/src/main/java/org/kobjects/htmlview2/Hv2DomContainer.java
import org.kobjects.dom.Node;
package org.kobjects.htmlview2;
abstract class Hv2DomContainer extends Hv2DomNode {
enum SyncState {
SYNCED, CHILD_INVALID, INVALID
}
enum ComponentType {
TEXT, // span, b, i, ...
PHYSICAL_CONTAINER, // div, p, all other elements
LOGICAL_CONTAINER, // tr, tbody
INVISIBLE, // head, title, ...
IMAGE, // img
LEAF_COMPONENT // input, select, ...
}
ComponentType componentType;
SyncState syncState;
Hv2DomNode firstChild;
Hv2DomNode lastChild;
Hv2DomContainer(Hv2DomDocument ownerDocument, ComponentType componentType) {
super(ownerDocument);
this.componentType = componentType;
}
public Hv2DomNode getFirstChild() {
return firstChild;
}
public Hv2DomNode getLastChild() {
return lastChild;
}
| public Hv2DomNode insertBefore(Node newNode, Node referenceNode) { |
stefanhaustein/HtmlView2 | htmlview2/src/main/java/org/kobjects/htmlview2/TreeSync.java | // Path: htmlview2/src/main/java/org/kobjects/dom/Node.java
// public interface Node {
// Node getParentNode();
// Element getParentElement();
// Document getOwnerDocument();
//
// Node getFirstChild();
// Node getLastChild();
// Node getNextSibling();
// Node getPreviousSibling();
//
// Node appendChild(Node node);
//
// String getTextContent();
// }
//
// Path: htmlview2/src/main/java/org/kobjects/dom/Text.java
// public interface Text extends Node {
// String getData();
// }
| import android.util.Log;
import android.view.View;
import android.widget.ArrayAdapter;
import android.widget.Spinner;
import org.kobjects.dom.Node;
import org.kobjects.dom.Text;
import java.net.URISyntaxException; | package org.kobjects.htmlview2;
/**
* Synchronizes the physical view hierarchy to the DOM.
*/
class TreeSync {
static void syncContainer(HtmlViewGroup physicalContainer, Hv2DomContainer logicalContainer, boolean clear) {
if (logicalContainer.syncState == Hv2DomContainer.SyncState.SYNCED) {
return;
}
logicalContainer.syncState = Hv2DomContainer.SyncState.SYNCED;
if (clear) {
physicalContainer.removeAllViews();
}
HtmlTextView pendingText = null; | // Path: htmlview2/src/main/java/org/kobjects/dom/Node.java
// public interface Node {
// Node getParentNode();
// Element getParentElement();
// Document getOwnerDocument();
//
// Node getFirstChild();
// Node getLastChild();
// Node getNextSibling();
// Node getPreviousSibling();
//
// Node appendChild(Node node);
//
// String getTextContent();
// }
//
// Path: htmlview2/src/main/java/org/kobjects/dom/Text.java
// public interface Text extends Node {
// String getData();
// }
// Path: htmlview2/src/main/java/org/kobjects/htmlview2/TreeSync.java
import android.util.Log;
import android.view.View;
import android.widget.ArrayAdapter;
import android.widget.Spinner;
import org.kobjects.dom.Node;
import org.kobjects.dom.Text;
import java.net.URISyntaxException;
package org.kobjects.htmlview2;
/**
* Synchronizes the physical view hierarchy to the DOM.
*/
class TreeSync {
static void syncContainer(HtmlViewGroup physicalContainer, Hv2DomContainer logicalContainer, boolean clear) {
if (logicalContainer.syncState == Hv2DomContainer.SyncState.SYNCED) {
return;
}
logicalContainer.syncState = Hv2DomContainer.SyncState.SYNCED;
if (clear) {
physicalContainer.removeAllViews();
}
HtmlTextView pendingText = null; | Node child = logicalContainer.getFirstChild(); |
stefanhaustein/HtmlView2 | htmlview2/src/main/java/org/kobjects/htmlview2/TreeSync.java | // Path: htmlview2/src/main/java/org/kobjects/dom/Node.java
// public interface Node {
// Node getParentNode();
// Element getParentElement();
// Document getOwnerDocument();
//
// Node getFirstChild();
// Node getLastChild();
// Node getNextSibling();
// Node getPreviousSibling();
//
// Node appendChild(Node node);
//
// String getTextContent();
// }
//
// Path: htmlview2/src/main/java/org/kobjects/dom/Text.java
// public interface Text extends Node {
// String getData();
// }
| import android.util.Log;
import android.view.View;
import android.widget.ArrayAdapter;
import android.widget.Spinner;
import org.kobjects.dom.Node;
import org.kobjects.dom.Text;
import java.net.URISyntaxException; | package org.kobjects.htmlview2;
/**
* Synchronizes the physical view hierarchy to the DOM.
*/
class TreeSync {
static void syncContainer(HtmlViewGroup physicalContainer, Hv2DomContainer logicalContainer, boolean clear) {
if (logicalContainer.syncState == Hv2DomContainer.SyncState.SYNCED) {
return;
}
logicalContainer.syncState = Hv2DomContainer.SyncState.SYNCED;
if (clear) {
physicalContainer.removeAllViews();
}
HtmlTextView pendingText = null;
Node child = logicalContainer.getFirstChild();
while (child != null) {
pendingText = syncChild(physicalContainer, child, pendingText);
child = child.getNextSibling();
}
}
static HtmlTextView syncChild(HtmlViewGroup physicalContainer, Node childNode, HtmlTextView pendingText) { | // Path: htmlview2/src/main/java/org/kobjects/dom/Node.java
// public interface Node {
// Node getParentNode();
// Element getParentElement();
// Document getOwnerDocument();
//
// Node getFirstChild();
// Node getLastChild();
// Node getNextSibling();
// Node getPreviousSibling();
//
// Node appendChild(Node node);
//
// String getTextContent();
// }
//
// Path: htmlview2/src/main/java/org/kobjects/dom/Text.java
// public interface Text extends Node {
// String getData();
// }
// Path: htmlview2/src/main/java/org/kobjects/htmlview2/TreeSync.java
import android.util.Log;
import android.view.View;
import android.widget.ArrayAdapter;
import android.widget.Spinner;
import org.kobjects.dom.Node;
import org.kobjects.dom.Text;
import java.net.URISyntaxException;
package org.kobjects.htmlview2;
/**
* Synchronizes the physical view hierarchy to the DOM.
*/
class TreeSync {
static void syncContainer(HtmlViewGroup physicalContainer, Hv2DomContainer logicalContainer, boolean clear) {
if (logicalContainer.syncState == Hv2DomContainer.SyncState.SYNCED) {
return;
}
logicalContainer.syncState = Hv2DomContainer.SyncState.SYNCED;
if (clear) {
physicalContainer.removeAllViews();
}
HtmlTextView pendingText = null;
Node child = logicalContainer.getFirstChild();
while (child != null) {
pendingText = syncChild(physicalContainer, child, pendingText);
child = child.getNextSibling();
}
}
static HtmlTextView syncChild(HtmlViewGroup physicalContainer, Node childNode, HtmlTextView pendingText) { | if (childNode instanceof Text) { |
stefanhaustein/HtmlView2 | htmlview2/src/main/java/org/kobjects/htmlview2/TableLayoutManager.java | // Path: htmlview2/src/main/java/org/kobjects/dom/Element.java
// public interface Element extends Node {
// String getLocalName();
// void setAttribute(String name, String value);
// String getAttribute(String name);
//
// Element getFirstElementChild();
// Element getLastElementChild();
// Element getNextElementSibling();
// Element getPreviousElementSibling();
//
// CSSStyleDeclaration getStyle();
// CSSStyleDeclaration getComputedStyle();
// }
//
// Path: htmlview2/src/main/java/org/kobjects/css/CssProperty.java
// public enum CssProperty {
//
// // Properties applying to text (inherited by default)
//
// BORDER_COLLAPSE,
// BORDER_SPACING,
// CAPTION_SIDE,
// COLOR,
// DISPLAY, // Not inherited
// EMPTY_CELLS,
// FONT_SIZE,
// FONT_STYLE,
// FONT_VARIANT,
// FONT_WEIGHT,
// LINE_HEIGHT,
// LIST_STYLE_POSITION,
// LIST_STYLE_TYPE,
// TEXT_ALIGN,
// TEXT_DECORATION,
// TEXT_INDENT,
// TEXT_TRANSFORM,
// VISIBILITY,
// WHITE_SPACE,
//
// // Other regular number properties
//
// BACKGROUND_COLOR,
// BACKGROUND_POSITION_X,
// BACKGROUND_POSITION_Y,
// BACKGROUND_REPEAT,
//
// BORDER_TOP_COLOR,
// BORDER_RIGHT_COLOR,
// BORDER_BOTTOM_COLOR,
// BORDER_LEFT_COLOR,
//
// BORDER_TOP_SPACING,
// BORDER_RIGHT_SPACING,
// BORDER_BOTTOM_SPACING,
// BORDER_LEFT_SPACING,
//
// BORDER_TOP_STYLE,
// BORDER_RIGHT_STYLE,
// BORDER_BOTTOM_STYLE,
// BORDER_LEFT_STYLE,
//
// BORDER_TOP_WIDTH,
// BORDER_RIGHT_WIDTH,
// BORDER_BOTTOM_WIDTH,
// BORDER_LEFT_WIDTH,
//
// BOTTOM,
// CLEAR,
// CLIP,
// FLOAT,
// HEIGHT,
// LEFT,
//
// MARGIN_TOP,
// MARGIN_RIGHT,
// MARGIN_BOTTOM,
// MARGIN_LEFT,
//
// OVERFLOW,
// PADDING_TOP,
// PADDING_RIGHT,
// PADDING_BOTTOM,
// PADDING_LEFT,
// POSITION,
// RIGHT,
// TABLE_LAYOUT,
// TOP,
// VERTICAL_ALIGN,
// WIDTH,
// Z_INDEX,
//
// // Special properties: String-valued and multivalue shorthands.
//
// BACKGROUND,
// BACKGROUND_IMAGE,
// BACKGROUND_POSITION,
// BORDER,
// BORDER_COLOR,
// BORDER_STYLE,
// BORDER_WIDTH,
// FONT,
// FONT_FAMILY,
// LIST_STYLE,
// MARGIN,
// PADDING, MAX_WIDTH;
//
// public static final int TEXT_PROPERTY_COUNT = BACKGROUND_POSITION_X.ordinal();
// public static final int REGULAR_PROPERTY_COUNT = BACKGROUND.ordinal();
// }
//
// Path: htmlview2/src/main/java/org/kobjects/css/CssStylableElement.java
// public interface CssStylableElement {
//
// String getAttribute(String name);
//
// String getLocalName();
//
// Iterator<? extends CssStylableElement> getChildElementIterator();
//
// void setComputedStyle(CssStyleDeclaration style);
// CssStyleDeclaration getStyle();
// }
//
// Path: htmlview2/src/main/java/org/kobjects/css/CssUnit.java
// public enum CssUnit {
// VALUE_NOT_SET, NUMBER, PERCENT, CM, EM, EX, IN, MM, PC, PT, PX, ENUM, ARGB, STRING
// }
| import android.view.View;
import org.kobjects.dom.Element;
import org.kobjects.css.CssProperty;
import org.kobjects.css.CssStylableElement;
import org.kobjects.css.CssUnit;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map; | int colSpan = getColSpan(cellParams.element);
int rowSpan = getRowSpan(cellParams.element);
int cellWidth = cell.getMeasuredWidth() + cellParams.getBorderLeft() + cellParams.getPaddingLeft()
+ cellParams.getPaddingRight() + cellParams.getBorderRight();
if (colSpan == 1) {
columnData.maxMeasuredWidth = Math.max(columnData.maxMeasuredWidth, cellWidth);
} else {
if (columnData.maxWidthForColspan == null) {
columnData.maxWidthForColspan = new HashMap<>();
}
Integer old = columnData.maxWidthForColspan.get(colSpan);
columnData.maxWidthForColspan.put(colSpan, old == null ? cellWidth : Math.max(old, cellWidth));
while (columnList.size() < columnIndex + colSpan) {
columnList.add(new ColumnData());
}
}
if (rowSpan > 0) {
for (int i = 0; i < colSpan; i++) {
columnList.get(columnIndex + i).remainingRowSpan = rowSpan;
}
}
columnIndex += colSpan;
}
columnCount = Math.max(columnCount, columnIndex);
}
while (columnList.size() <= columnCount) {
columnList.add(new ColumnData());
}
| // Path: htmlview2/src/main/java/org/kobjects/dom/Element.java
// public interface Element extends Node {
// String getLocalName();
// void setAttribute(String name, String value);
// String getAttribute(String name);
//
// Element getFirstElementChild();
// Element getLastElementChild();
// Element getNextElementSibling();
// Element getPreviousElementSibling();
//
// CSSStyleDeclaration getStyle();
// CSSStyleDeclaration getComputedStyle();
// }
//
// Path: htmlview2/src/main/java/org/kobjects/css/CssProperty.java
// public enum CssProperty {
//
// // Properties applying to text (inherited by default)
//
// BORDER_COLLAPSE,
// BORDER_SPACING,
// CAPTION_SIDE,
// COLOR,
// DISPLAY, // Not inherited
// EMPTY_CELLS,
// FONT_SIZE,
// FONT_STYLE,
// FONT_VARIANT,
// FONT_WEIGHT,
// LINE_HEIGHT,
// LIST_STYLE_POSITION,
// LIST_STYLE_TYPE,
// TEXT_ALIGN,
// TEXT_DECORATION,
// TEXT_INDENT,
// TEXT_TRANSFORM,
// VISIBILITY,
// WHITE_SPACE,
//
// // Other regular number properties
//
// BACKGROUND_COLOR,
// BACKGROUND_POSITION_X,
// BACKGROUND_POSITION_Y,
// BACKGROUND_REPEAT,
//
// BORDER_TOP_COLOR,
// BORDER_RIGHT_COLOR,
// BORDER_BOTTOM_COLOR,
// BORDER_LEFT_COLOR,
//
// BORDER_TOP_SPACING,
// BORDER_RIGHT_SPACING,
// BORDER_BOTTOM_SPACING,
// BORDER_LEFT_SPACING,
//
// BORDER_TOP_STYLE,
// BORDER_RIGHT_STYLE,
// BORDER_BOTTOM_STYLE,
// BORDER_LEFT_STYLE,
//
// BORDER_TOP_WIDTH,
// BORDER_RIGHT_WIDTH,
// BORDER_BOTTOM_WIDTH,
// BORDER_LEFT_WIDTH,
//
// BOTTOM,
// CLEAR,
// CLIP,
// FLOAT,
// HEIGHT,
// LEFT,
//
// MARGIN_TOP,
// MARGIN_RIGHT,
// MARGIN_BOTTOM,
// MARGIN_LEFT,
//
// OVERFLOW,
// PADDING_TOP,
// PADDING_RIGHT,
// PADDING_BOTTOM,
// PADDING_LEFT,
// POSITION,
// RIGHT,
// TABLE_LAYOUT,
// TOP,
// VERTICAL_ALIGN,
// WIDTH,
// Z_INDEX,
//
// // Special properties: String-valued and multivalue shorthands.
//
// BACKGROUND,
// BACKGROUND_IMAGE,
// BACKGROUND_POSITION,
// BORDER,
// BORDER_COLOR,
// BORDER_STYLE,
// BORDER_WIDTH,
// FONT,
// FONT_FAMILY,
// LIST_STYLE,
// MARGIN,
// PADDING, MAX_WIDTH;
//
// public static final int TEXT_PROPERTY_COUNT = BACKGROUND_POSITION_X.ordinal();
// public static final int REGULAR_PROPERTY_COUNT = BACKGROUND.ordinal();
// }
//
// Path: htmlview2/src/main/java/org/kobjects/css/CssStylableElement.java
// public interface CssStylableElement {
//
// String getAttribute(String name);
//
// String getLocalName();
//
// Iterator<? extends CssStylableElement> getChildElementIterator();
//
// void setComputedStyle(CssStyleDeclaration style);
// CssStyleDeclaration getStyle();
// }
//
// Path: htmlview2/src/main/java/org/kobjects/css/CssUnit.java
// public enum CssUnit {
// VALUE_NOT_SET, NUMBER, PERCENT, CM, EM, EX, IN, MM, PC, PT, PX, ENUM, ARGB, STRING
// }
// Path: htmlview2/src/main/java/org/kobjects/htmlview2/TableLayoutManager.java
import android.view.View;
import org.kobjects.dom.Element;
import org.kobjects.css.CssProperty;
import org.kobjects.css.CssStylableElement;
import org.kobjects.css.CssUnit;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
int colSpan = getColSpan(cellParams.element);
int rowSpan = getRowSpan(cellParams.element);
int cellWidth = cell.getMeasuredWidth() + cellParams.getBorderLeft() + cellParams.getPaddingLeft()
+ cellParams.getPaddingRight() + cellParams.getBorderRight();
if (colSpan == 1) {
columnData.maxMeasuredWidth = Math.max(columnData.maxMeasuredWidth, cellWidth);
} else {
if (columnData.maxWidthForColspan == null) {
columnData.maxWidthForColspan = new HashMap<>();
}
Integer old = columnData.maxWidthForColspan.get(colSpan);
columnData.maxWidthForColspan.put(colSpan, old == null ? cellWidth : Math.max(old, cellWidth));
while (columnList.size() < columnIndex + colSpan) {
columnList.add(new ColumnData());
}
}
if (rowSpan > 0) {
for (int i = 0; i < colSpan; i++) {
columnList.get(columnIndex + i).remainingRowSpan = rowSpan;
}
}
columnIndex += colSpan;
}
columnCount = Math.max(columnCount, columnIndex);
}
while (columnList.size() <= columnCount) {
columnList.add(new ColumnData());
}
| int borderSpacing = Math.round(htmlLayout.getStyle().get(CssProperty.BORDER_SPACING, CssUnit.PX, htmlLayout.cssContentWidth)); |
stefanhaustein/HtmlView2 | htmlview2/src/main/java/org/kobjects/htmlview2/TableLayoutManager.java | // Path: htmlview2/src/main/java/org/kobjects/dom/Element.java
// public interface Element extends Node {
// String getLocalName();
// void setAttribute(String name, String value);
// String getAttribute(String name);
//
// Element getFirstElementChild();
// Element getLastElementChild();
// Element getNextElementSibling();
// Element getPreviousElementSibling();
//
// CSSStyleDeclaration getStyle();
// CSSStyleDeclaration getComputedStyle();
// }
//
// Path: htmlview2/src/main/java/org/kobjects/css/CssProperty.java
// public enum CssProperty {
//
// // Properties applying to text (inherited by default)
//
// BORDER_COLLAPSE,
// BORDER_SPACING,
// CAPTION_SIDE,
// COLOR,
// DISPLAY, // Not inherited
// EMPTY_CELLS,
// FONT_SIZE,
// FONT_STYLE,
// FONT_VARIANT,
// FONT_WEIGHT,
// LINE_HEIGHT,
// LIST_STYLE_POSITION,
// LIST_STYLE_TYPE,
// TEXT_ALIGN,
// TEXT_DECORATION,
// TEXT_INDENT,
// TEXT_TRANSFORM,
// VISIBILITY,
// WHITE_SPACE,
//
// // Other regular number properties
//
// BACKGROUND_COLOR,
// BACKGROUND_POSITION_X,
// BACKGROUND_POSITION_Y,
// BACKGROUND_REPEAT,
//
// BORDER_TOP_COLOR,
// BORDER_RIGHT_COLOR,
// BORDER_BOTTOM_COLOR,
// BORDER_LEFT_COLOR,
//
// BORDER_TOP_SPACING,
// BORDER_RIGHT_SPACING,
// BORDER_BOTTOM_SPACING,
// BORDER_LEFT_SPACING,
//
// BORDER_TOP_STYLE,
// BORDER_RIGHT_STYLE,
// BORDER_BOTTOM_STYLE,
// BORDER_LEFT_STYLE,
//
// BORDER_TOP_WIDTH,
// BORDER_RIGHT_WIDTH,
// BORDER_BOTTOM_WIDTH,
// BORDER_LEFT_WIDTH,
//
// BOTTOM,
// CLEAR,
// CLIP,
// FLOAT,
// HEIGHT,
// LEFT,
//
// MARGIN_TOP,
// MARGIN_RIGHT,
// MARGIN_BOTTOM,
// MARGIN_LEFT,
//
// OVERFLOW,
// PADDING_TOP,
// PADDING_RIGHT,
// PADDING_BOTTOM,
// PADDING_LEFT,
// POSITION,
// RIGHT,
// TABLE_LAYOUT,
// TOP,
// VERTICAL_ALIGN,
// WIDTH,
// Z_INDEX,
//
// // Special properties: String-valued and multivalue shorthands.
//
// BACKGROUND,
// BACKGROUND_IMAGE,
// BACKGROUND_POSITION,
// BORDER,
// BORDER_COLOR,
// BORDER_STYLE,
// BORDER_WIDTH,
// FONT,
// FONT_FAMILY,
// LIST_STYLE,
// MARGIN,
// PADDING, MAX_WIDTH;
//
// public static final int TEXT_PROPERTY_COUNT = BACKGROUND_POSITION_X.ordinal();
// public static final int REGULAR_PROPERTY_COUNT = BACKGROUND.ordinal();
// }
//
// Path: htmlview2/src/main/java/org/kobjects/css/CssStylableElement.java
// public interface CssStylableElement {
//
// String getAttribute(String name);
//
// String getLocalName();
//
// Iterator<? extends CssStylableElement> getChildElementIterator();
//
// void setComputedStyle(CssStyleDeclaration style);
// CssStyleDeclaration getStyle();
// }
//
// Path: htmlview2/src/main/java/org/kobjects/css/CssUnit.java
// public enum CssUnit {
// VALUE_NOT_SET, NUMBER, PERCENT, CM, EM, EX, IN, MM, PC, PT, PX, ENUM, ARGB, STRING
// }
| import android.view.View;
import org.kobjects.dom.Element;
import org.kobjects.css.CssProperty;
import org.kobjects.css.CssStylableElement;
import org.kobjects.css.CssUnit;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map; | int colSpan = getColSpan(cellParams.element);
int rowSpan = getRowSpan(cellParams.element);
int cellWidth = cell.getMeasuredWidth() + cellParams.getBorderLeft() + cellParams.getPaddingLeft()
+ cellParams.getPaddingRight() + cellParams.getBorderRight();
if (colSpan == 1) {
columnData.maxMeasuredWidth = Math.max(columnData.maxMeasuredWidth, cellWidth);
} else {
if (columnData.maxWidthForColspan == null) {
columnData.maxWidthForColspan = new HashMap<>();
}
Integer old = columnData.maxWidthForColspan.get(colSpan);
columnData.maxWidthForColspan.put(colSpan, old == null ? cellWidth : Math.max(old, cellWidth));
while (columnList.size() < columnIndex + colSpan) {
columnList.add(new ColumnData());
}
}
if (rowSpan > 0) {
for (int i = 0; i < colSpan; i++) {
columnList.get(columnIndex + i).remainingRowSpan = rowSpan;
}
}
columnIndex += colSpan;
}
columnCount = Math.max(columnCount, columnIndex);
}
while (columnList.size() <= columnCount) {
columnList.add(new ColumnData());
}
| // Path: htmlview2/src/main/java/org/kobjects/dom/Element.java
// public interface Element extends Node {
// String getLocalName();
// void setAttribute(String name, String value);
// String getAttribute(String name);
//
// Element getFirstElementChild();
// Element getLastElementChild();
// Element getNextElementSibling();
// Element getPreviousElementSibling();
//
// CSSStyleDeclaration getStyle();
// CSSStyleDeclaration getComputedStyle();
// }
//
// Path: htmlview2/src/main/java/org/kobjects/css/CssProperty.java
// public enum CssProperty {
//
// // Properties applying to text (inherited by default)
//
// BORDER_COLLAPSE,
// BORDER_SPACING,
// CAPTION_SIDE,
// COLOR,
// DISPLAY, // Not inherited
// EMPTY_CELLS,
// FONT_SIZE,
// FONT_STYLE,
// FONT_VARIANT,
// FONT_WEIGHT,
// LINE_HEIGHT,
// LIST_STYLE_POSITION,
// LIST_STYLE_TYPE,
// TEXT_ALIGN,
// TEXT_DECORATION,
// TEXT_INDENT,
// TEXT_TRANSFORM,
// VISIBILITY,
// WHITE_SPACE,
//
// // Other regular number properties
//
// BACKGROUND_COLOR,
// BACKGROUND_POSITION_X,
// BACKGROUND_POSITION_Y,
// BACKGROUND_REPEAT,
//
// BORDER_TOP_COLOR,
// BORDER_RIGHT_COLOR,
// BORDER_BOTTOM_COLOR,
// BORDER_LEFT_COLOR,
//
// BORDER_TOP_SPACING,
// BORDER_RIGHT_SPACING,
// BORDER_BOTTOM_SPACING,
// BORDER_LEFT_SPACING,
//
// BORDER_TOP_STYLE,
// BORDER_RIGHT_STYLE,
// BORDER_BOTTOM_STYLE,
// BORDER_LEFT_STYLE,
//
// BORDER_TOP_WIDTH,
// BORDER_RIGHT_WIDTH,
// BORDER_BOTTOM_WIDTH,
// BORDER_LEFT_WIDTH,
//
// BOTTOM,
// CLEAR,
// CLIP,
// FLOAT,
// HEIGHT,
// LEFT,
//
// MARGIN_TOP,
// MARGIN_RIGHT,
// MARGIN_BOTTOM,
// MARGIN_LEFT,
//
// OVERFLOW,
// PADDING_TOP,
// PADDING_RIGHT,
// PADDING_BOTTOM,
// PADDING_LEFT,
// POSITION,
// RIGHT,
// TABLE_LAYOUT,
// TOP,
// VERTICAL_ALIGN,
// WIDTH,
// Z_INDEX,
//
// // Special properties: String-valued and multivalue shorthands.
//
// BACKGROUND,
// BACKGROUND_IMAGE,
// BACKGROUND_POSITION,
// BORDER,
// BORDER_COLOR,
// BORDER_STYLE,
// BORDER_WIDTH,
// FONT,
// FONT_FAMILY,
// LIST_STYLE,
// MARGIN,
// PADDING, MAX_WIDTH;
//
// public static final int TEXT_PROPERTY_COUNT = BACKGROUND_POSITION_X.ordinal();
// public static final int REGULAR_PROPERTY_COUNT = BACKGROUND.ordinal();
// }
//
// Path: htmlview2/src/main/java/org/kobjects/css/CssStylableElement.java
// public interface CssStylableElement {
//
// String getAttribute(String name);
//
// String getLocalName();
//
// Iterator<? extends CssStylableElement> getChildElementIterator();
//
// void setComputedStyle(CssStyleDeclaration style);
// CssStyleDeclaration getStyle();
// }
//
// Path: htmlview2/src/main/java/org/kobjects/css/CssUnit.java
// public enum CssUnit {
// VALUE_NOT_SET, NUMBER, PERCENT, CM, EM, EX, IN, MM, PC, PT, PX, ENUM, ARGB, STRING
// }
// Path: htmlview2/src/main/java/org/kobjects/htmlview2/TableLayoutManager.java
import android.view.View;
import org.kobjects.dom.Element;
import org.kobjects.css.CssProperty;
import org.kobjects.css.CssStylableElement;
import org.kobjects.css.CssUnit;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
int colSpan = getColSpan(cellParams.element);
int rowSpan = getRowSpan(cellParams.element);
int cellWidth = cell.getMeasuredWidth() + cellParams.getBorderLeft() + cellParams.getPaddingLeft()
+ cellParams.getPaddingRight() + cellParams.getBorderRight();
if (colSpan == 1) {
columnData.maxMeasuredWidth = Math.max(columnData.maxMeasuredWidth, cellWidth);
} else {
if (columnData.maxWidthForColspan == null) {
columnData.maxWidthForColspan = new HashMap<>();
}
Integer old = columnData.maxWidthForColspan.get(colSpan);
columnData.maxWidthForColspan.put(colSpan, old == null ? cellWidth : Math.max(old, cellWidth));
while (columnList.size() < columnIndex + colSpan) {
columnList.add(new ColumnData());
}
}
if (rowSpan > 0) {
for (int i = 0; i < colSpan; i++) {
columnList.get(columnIndex + i).remainingRowSpan = rowSpan;
}
}
columnIndex += colSpan;
}
columnCount = Math.max(columnCount, columnIndex);
}
while (columnList.size() <= columnCount) {
columnList.add(new ColumnData());
}
| int borderSpacing = Math.round(htmlLayout.getStyle().get(CssProperty.BORDER_SPACING, CssUnit.PX, htmlLayout.cssContentWidth)); |
stefanhaustein/HtmlView2 | htmlview2/src/main/java/org/kobjects/htmlview2/TableLayoutManager.java | // Path: htmlview2/src/main/java/org/kobjects/dom/Element.java
// public interface Element extends Node {
// String getLocalName();
// void setAttribute(String name, String value);
// String getAttribute(String name);
//
// Element getFirstElementChild();
// Element getLastElementChild();
// Element getNextElementSibling();
// Element getPreviousElementSibling();
//
// CSSStyleDeclaration getStyle();
// CSSStyleDeclaration getComputedStyle();
// }
//
// Path: htmlview2/src/main/java/org/kobjects/css/CssProperty.java
// public enum CssProperty {
//
// // Properties applying to text (inherited by default)
//
// BORDER_COLLAPSE,
// BORDER_SPACING,
// CAPTION_SIDE,
// COLOR,
// DISPLAY, // Not inherited
// EMPTY_CELLS,
// FONT_SIZE,
// FONT_STYLE,
// FONT_VARIANT,
// FONT_WEIGHT,
// LINE_HEIGHT,
// LIST_STYLE_POSITION,
// LIST_STYLE_TYPE,
// TEXT_ALIGN,
// TEXT_DECORATION,
// TEXT_INDENT,
// TEXT_TRANSFORM,
// VISIBILITY,
// WHITE_SPACE,
//
// // Other regular number properties
//
// BACKGROUND_COLOR,
// BACKGROUND_POSITION_X,
// BACKGROUND_POSITION_Y,
// BACKGROUND_REPEAT,
//
// BORDER_TOP_COLOR,
// BORDER_RIGHT_COLOR,
// BORDER_BOTTOM_COLOR,
// BORDER_LEFT_COLOR,
//
// BORDER_TOP_SPACING,
// BORDER_RIGHT_SPACING,
// BORDER_BOTTOM_SPACING,
// BORDER_LEFT_SPACING,
//
// BORDER_TOP_STYLE,
// BORDER_RIGHT_STYLE,
// BORDER_BOTTOM_STYLE,
// BORDER_LEFT_STYLE,
//
// BORDER_TOP_WIDTH,
// BORDER_RIGHT_WIDTH,
// BORDER_BOTTOM_WIDTH,
// BORDER_LEFT_WIDTH,
//
// BOTTOM,
// CLEAR,
// CLIP,
// FLOAT,
// HEIGHT,
// LEFT,
//
// MARGIN_TOP,
// MARGIN_RIGHT,
// MARGIN_BOTTOM,
// MARGIN_LEFT,
//
// OVERFLOW,
// PADDING_TOP,
// PADDING_RIGHT,
// PADDING_BOTTOM,
// PADDING_LEFT,
// POSITION,
// RIGHT,
// TABLE_LAYOUT,
// TOP,
// VERTICAL_ALIGN,
// WIDTH,
// Z_INDEX,
//
// // Special properties: String-valued and multivalue shorthands.
//
// BACKGROUND,
// BACKGROUND_IMAGE,
// BACKGROUND_POSITION,
// BORDER,
// BORDER_COLOR,
// BORDER_STYLE,
// BORDER_WIDTH,
// FONT,
// FONT_FAMILY,
// LIST_STYLE,
// MARGIN,
// PADDING, MAX_WIDTH;
//
// public static final int TEXT_PROPERTY_COUNT = BACKGROUND_POSITION_X.ordinal();
// public static final int REGULAR_PROPERTY_COUNT = BACKGROUND.ordinal();
// }
//
// Path: htmlview2/src/main/java/org/kobjects/css/CssStylableElement.java
// public interface CssStylableElement {
//
// String getAttribute(String name);
//
// String getLocalName();
//
// Iterator<? extends CssStylableElement> getChildElementIterator();
//
// void setComputedStyle(CssStyleDeclaration style);
// CssStyleDeclaration getStyle();
// }
//
// Path: htmlview2/src/main/java/org/kobjects/css/CssUnit.java
// public enum CssUnit {
// VALUE_NOT_SET, NUMBER, PERCENT, CM, EM, EX, IN, MM, PC, PT, PX, ENUM, ARGB, STRING
// }
| import android.view.View;
import org.kobjects.dom.Element;
import org.kobjects.css.CssProperty;
import org.kobjects.css.CssStylableElement;
import org.kobjects.css.CssUnit;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map; | columnData.yOffset = currentY + topOffset + bottomOffset;
currentX += spanWidth + borderSpacing;
columnIndex += colSpan;
}
for (ColumnData columnData : columnList) {
if (columnData.remainingRowSpan == 1) {
rowHeight = Math.max(rowHeight, columnData.remainingHeight);
}
}
for (ColumnData columnData : columnList) {
if (columnData.remainingRowSpan == 1) {
columnData.remainingRowSpan = 0;
columnData.startCell.measure(View.MeasureSpec.EXACTLY | columnData.startCell.getMeasuredWidth(),
View.MeasureSpec.EXACTLY | (currentY + rowHeight - columnData.yOffset));
} else if (columnData.remainingRowSpan > 1) {
columnData.remainingHeight -= rowHeight - borderSpacing;
columnData.remainingRowSpan--;
}
}
currentY += rowHeight + borderSpacing;
}
htmlLayout.setMeasuredSize(totalWidth, heightMode == View.MeasureSpec.EXACTLY ? height : currentY - borderSpacing);
}
List<List<View>> collectRows(HtmlViewGroup htmlLayout) {
ArrayList<List<View>> rows = new ArrayList<>();
if (!(htmlLayout.getLayoutParams() instanceof HtmlViewGroup.LayoutParams)) {
return rows;
}
| // Path: htmlview2/src/main/java/org/kobjects/dom/Element.java
// public interface Element extends Node {
// String getLocalName();
// void setAttribute(String name, String value);
// String getAttribute(String name);
//
// Element getFirstElementChild();
// Element getLastElementChild();
// Element getNextElementSibling();
// Element getPreviousElementSibling();
//
// CSSStyleDeclaration getStyle();
// CSSStyleDeclaration getComputedStyle();
// }
//
// Path: htmlview2/src/main/java/org/kobjects/css/CssProperty.java
// public enum CssProperty {
//
// // Properties applying to text (inherited by default)
//
// BORDER_COLLAPSE,
// BORDER_SPACING,
// CAPTION_SIDE,
// COLOR,
// DISPLAY, // Not inherited
// EMPTY_CELLS,
// FONT_SIZE,
// FONT_STYLE,
// FONT_VARIANT,
// FONT_WEIGHT,
// LINE_HEIGHT,
// LIST_STYLE_POSITION,
// LIST_STYLE_TYPE,
// TEXT_ALIGN,
// TEXT_DECORATION,
// TEXT_INDENT,
// TEXT_TRANSFORM,
// VISIBILITY,
// WHITE_SPACE,
//
// // Other regular number properties
//
// BACKGROUND_COLOR,
// BACKGROUND_POSITION_X,
// BACKGROUND_POSITION_Y,
// BACKGROUND_REPEAT,
//
// BORDER_TOP_COLOR,
// BORDER_RIGHT_COLOR,
// BORDER_BOTTOM_COLOR,
// BORDER_LEFT_COLOR,
//
// BORDER_TOP_SPACING,
// BORDER_RIGHT_SPACING,
// BORDER_BOTTOM_SPACING,
// BORDER_LEFT_SPACING,
//
// BORDER_TOP_STYLE,
// BORDER_RIGHT_STYLE,
// BORDER_BOTTOM_STYLE,
// BORDER_LEFT_STYLE,
//
// BORDER_TOP_WIDTH,
// BORDER_RIGHT_WIDTH,
// BORDER_BOTTOM_WIDTH,
// BORDER_LEFT_WIDTH,
//
// BOTTOM,
// CLEAR,
// CLIP,
// FLOAT,
// HEIGHT,
// LEFT,
//
// MARGIN_TOP,
// MARGIN_RIGHT,
// MARGIN_BOTTOM,
// MARGIN_LEFT,
//
// OVERFLOW,
// PADDING_TOP,
// PADDING_RIGHT,
// PADDING_BOTTOM,
// PADDING_LEFT,
// POSITION,
// RIGHT,
// TABLE_LAYOUT,
// TOP,
// VERTICAL_ALIGN,
// WIDTH,
// Z_INDEX,
//
// // Special properties: String-valued and multivalue shorthands.
//
// BACKGROUND,
// BACKGROUND_IMAGE,
// BACKGROUND_POSITION,
// BORDER,
// BORDER_COLOR,
// BORDER_STYLE,
// BORDER_WIDTH,
// FONT,
// FONT_FAMILY,
// LIST_STYLE,
// MARGIN,
// PADDING, MAX_WIDTH;
//
// public static final int TEXT_PROPERTY_COUNT = BACKGROUND_POSITION_X.ordinal();
// public static final int REGULAR_PROPERTY_COUNT = BACKGROUND.ordinal();
// }
//
// Path: htmlview2/src/main/java/org/kobjects/css/CssStylableElement.java
// public interface CssStylableElement {
//
// String getAttribute(String name);
//
// String getLocalName();
//
// Iterator<? extends CssStylableElement> getChildElementIterator();
//
// void setComputedStyle(CssStyleDeclaration style);
// CssStyleDeclaration getStyle();
// }
//
// Path: htmlview2/src/main/java/org/kobjects/css/CssUnit.java
// public enum CssUnit {
// VALUE_NOT_SET, NUMBER, PERCENT, CM, EM, EX, IN, MM, PC, PT, PX, ENUM, ARGB, STRING
// }
// Path: htmlview2/src/main/java/org/kobjects/htmlview2/TableLayoutManager.java
import android.view.View;
import org.kobjects.dom.Element;
import org.kobjects.css.CssProperty;
import org.kobjects.css.CssStylableElement;
import org.kobjects.css.CssUnit;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
columnData.yOffset = currentY + topOffset + bottomOffset;
currentX += spanWidth + borderSpacing;
columnIndex += colSpan;
}
for (ColumnData columnData : columnList) {
if (columnData.remainingRowSpan == 1) {
rowHeight = Math.max(rowHeight, columnData.remainingHeight);
}
}
for (ColumnData columnData : columnList) {
if (columnData.remainingRowSpan == 1) {
columnData.remainingRowSpan = 0;
columnData.startCell.measure(View.MeasureSpec.EXACTLY | columnData.startCell.getMeasuredWidth(),
View.MeasureSpec.EXACTLY | (currentY + rowHeight - columnData.yOffset));
} else if (columnData.remainingRowSpan > 1) {
columnData.remainingHeight -= rowHeight - borderSpacing;
columnData.remainingRowSpan--;
}
}
currentY += rowHeight + borderSpacing;
}
htmlLayout.setMeasuredSize(totalWidth, heightMode == View.MeasureSpec.EXACTLY ? height : currentY - borderSpacing);
}
List<List<View>> collectRows(HtmlViewGroup htmlLayout) {
ArrayList<List<View>> rows = new ArrayList<>();
if (!(htmlLayout.getLayoutParams() instanceof HtmlViewGroup.LayoutParams)) {
return rows;
}
| Iterator<? extends CssStylableElement> rowIterator = |
mageddo/bookmark-notes | src/main/java/com/mageddo/config/ReflectionClasses.java | // Path: src/main/java/thymeleaf/ThymeleafUtils.java
// public final class ThymeleafUtils {
//
// private ThymeleafUtils() {
// }
//
// public static String[] splitTags(String tags) {
// return tags == null ? null : tags.split(",");
// }
//
// public static String encodePath(String path) {
// return UrlUtils.encode(path);
// }
//
// public static String createBookmarkUrl(long id, String name) {
// return SiteMapService.formatUrl(id, name);
// }
//
// public static String analyticsId() {
// return context().getEnvironment()
// .get("analytics.id", String.class, "");
// }
//
// public static String headerHtml(){
// return HtmlEscape.unescapeHtml(context()
// .getBean(SettingsService.class)
// .findSetting(Setting.PUBLIC_PAGES_HEADER_HTML.name())
// .getValue())
// ;
// }
// }
| import com.oracle.svm.core.annotate.AutomaticFeature;
import org.flywaydb.core.internal.logging.javautil.JavaUtilLogCreator;
import org.graalvm.nativeimage.hosted.Feature;
import nativeimage.Reflection;
import nativeimage.Reflections;
import thymeleaf.ThymeleafUtils; | package com.mageddo.config;
@Reflections({
@Reflection(declaredConstructors = true, declaredMethods = true, scanPackage = "com.mageddo.bookmarks.jackson"),
// flyway migration
@Reflection(scanClass = JavaUtilLogCreator.class, declaredConstructors = true),
| // Path: src/main/java/thymeleaf/ThymeleafUtils.java
// public final class ThymeleafUtils {
//
// private ThymeleafUtils() {
// }
//
// public static String[] splitTags(String tags) {
// return tags == null ? null : tags.split(",");
// }
//
// public static String encodePath(String path) {
// return UrlUtils.encode(path);
// }
//
// public static String createBookmarkUrl(long id, String name) {
// return SiteMapService.formatUrl(id, name);
// }
//
// public static String analyticsId() {
// return context().getEnvironment()
// .get("analytics.id", String.class, "");
// }
//
// public static String headerHtml(){
// return HtmlEscape.unescapeHtml(context()
// .getBean(SettingsService.class)
// .findSetting(Setting.PUBLIC_PAGES_HEADER_HTML.name())
// .getValue())
// ;
// }
// }
// Path: src/main/java/com/mageddo/config/ReflectionClasses.java
import com.oracle.svm.core.annotate.AutomaticFeature;
import org.flywaydb.core.internal.logging.javautil.JavaUtilLogCreator;
import org.graalvm.nativeimage.hosted.Feature;
import nativeimage.Reflection;
import nativeimage.Reflections;
import thymeleaf.ThymeleafUtils;
package com.mageddo.config;
@Reflections({
@Reflection(declaredConstructors = true, declaredMethods = true, scanPackage = "com.mageddo.bookmarks.jackson"),
// flyway migration
@Reflection(scanClass = JavaUtilLogCreator.class, declaredConstructors = true),
| @Reflection(scanClass = ThymeleafUtils.class, declaredMethods = true), |
mageddo/bookmark-notes | src/main/java/com/mageddo/bookmarks/dao/TagDAO.java | // Path: src/main/java/com/mageddo/bookmarks/apiserver/res/TagV1Res.java
// public class TagV1Res {
//
// private Long id;
// private String name;
// private String slug;
//
// public static RowMapper<TagV1Res> mapper() {
// return (rs, rowNum) -> new TagV1Res().setId(rs.getLong("ID"))
// .setName(rs.getString("NAME"))
// .setSlug(rs.getString("SLUG"));
// }
//
// public Long getId() {
// return id;
// }
//
// public TagV1Res setId(Long id) {
// this.id = id;
// return this;
// }
//
// public String getName() {
// return name;
// }
//
// public TagV1Res setName(String name) {
// this.name = name;
// return this;
// }
//
// public String getSlug() {
// return slug;
// }
//
// public TagV1Res setSlug(String slug) {
// this.slug = slug;
// return this;
// }
// }
//
// Path: src/main/java/com/mageddo/bookmarks/entity/TagEntity.java
// public class TagEntity {
//
// private Integer id;
// private String slug;
// private String name;
// private Integer bookmarkId;
//
// public static RowMapper<TagEntity> mapper() {
// return (rs, rowNum) -> new TagEntity().setId(rs.getInt("IDT_TAG"))
// .setName(rs.getString("NAM_TAG"))
// .setSlug(rs.getString("COD_SLUG"))
// .setBookmarkId(JdbcHelper.getInteger(rs, "IDT_BOOKMARK"));
// }
//
// public String getName() {
// return name;
// }
//
// public TagEntity setName(String name) {
// this.name = name;
// return this;
// }
//
// public Integer getId() {
// return id;
// }
//
// public TagEntity setId(Integer id) {
// this.id = id;
// return this;
// }
//
// public String getSlug() {
// return slug;
// }
//
// public TagEntity setSlug(String slug) {
// this.slug = slug;
// return this;
// }
//
// public Integer getBookmarkId() {
// return bookmarkId;
// }
//
// public TagEntity setBookmarkId(Integer bookmarkId) {
// this.bookmarkId = bookmarkId;
// return this;
// }
//
// }
//
// Path: src/main/java/com/mageddo/bookmarks/utils/Tags.java
// public final class Tags {
// private Tags() {
// }
//
// public static Set<Tag> toTags(List<String> rawTags) {
// if (rawTags == null) {
// return Collections.emptySet();
// }
// return rawTags.stream()
// .map(Tag::new)
// .filter(it -> it.getSlug()
// .length() > 0)
// .collect(Collectors.toSet());
// }
//
// static String toSlug(String name) {
// return name.toLowerCase()
// .replace("/[^a-z0-9\\ \\-_]+/g", "")
// .trim()
// .replace("/[\\ _]+/g", "\\-");
// }
//
//
// public static class Tag {
//
// private final String name;
// private final String slug;
//
// public Tag(String name) {
// this.name = name.trim();
// this.slug = toSlug(name);
// }
//
// public String getName() {
// return name;
// }
//
// public String getSlug() {
// return slug;
// }
// }
// }
| import java.util.List;
import com.mageddo.bookmarks.apiserver.res.TagV1Res;
import com.mageddo.bookmarks.entity.TagEntity;
import com.mageddo.bookmarks.utils.Tags; | package com.mageddo.bookmarks.dao;
public interface TagDAO {
List<TagV1Res> findTags();
| // Path: src/main/java/com/mageddo/bookmarks/apiserver/res/TagV1Res.java
// public class TagV1Res {
//
// private Long id;
// private String name;
// private String slug;
//
// public static RowMapper<TagV1Res> mapper() {
// return (rs, rowNum) -> new TagV1Res().setId(rs.getLong("ID"))
// .setName(rs.getString("NAME"))
// .setSlug(rs.getString("SLUG"));
// }
//
// public Long getId() {
// return id;
// }
//
// public TagV1Res setId(Long id) {
// this.id = id;
// return this;
// }
//
// public String getName() {
// return name;
// }
//
// public TagV1Res setName(String name) {
// this.name = name;
// return this;
// }
//
// public String getSlug() {
// return slug;
// }
//
// public TagV1Res setSlug(String slug) {
// this.slug = slug;
// return this;
// }
// }
//
// Path: src/main/java/com/mageddo/bookmarks/entity/TagEntity.java
// public class TagEntity {
//
// private Integer id;
// private String slug;
// private String name;
// private Integer bookmarkId;
//
// public static RowMapper<TagEntity> mapper() {
// return (rs, rowNum) -> new TagEntity().setId(rs.getInt("IDT_TAG"))
// .setName(rs.getString("NAM_TAG"))
// .setSlug(rs.getString("COD_SLUG"))
// .setBookmarkId(JdbcHelper.getInteger(rs, "IDT_BOOKMARK"));
// }
//
// public String getName() {
// return name;
// }
//
// public TagEntity setName(String name) {
// this.name = name;
// return this;
// }
//
// public Integer getId() {
// return id;
// }
//
// public TagEntity setId(Integer id) {
// this.id = id;
// return this;
// }
//
// public String getSlug() {
// return slug;
// }
//
// public TagEntity setSlug(String slug) {
// this.slug = slug;
// return this;
// }
//
// public Integer getBookmarkId() {
// return bookmarkId;
// }
//
// public TagEntity setBookmarkId(Integer bookmarkId) {
// this.bookmarkId = bookmarkId;
// return this;
// }
//
// }
//
// Path: src/main/java/com/mageddo/bookmarks/utils/Tags.java
// public final class Tags {
// private Tags() {
// }
//
// public static Set<Tag> toTags(List<String> rawTags) {
// if (rawTags == null) {
// return Collections.emptySet();
// }
// return rawTags.stream()
// .map(Tag::new)
// .filter(it -> it.getSlug()
// .length() > 0)
// .collect(Collectors.toSet());
// }
//
// static String toSlug(String name) {
// return name.toLowerCase()
// .replace("/[^a-z0-9\\ \\-_]+/g", "")
// .trim()
// .replace("/[\\ _]+/g", "\\-");
// }
//
//
// public static class Tag {
//
// private final String name;
// private final String slug;
//
// public Tag(String name) {
// this.name = name.trim();
// this.slug = toSlug(name);
// }
//
// public String getName() {
// return name;
// }
//
// public String getSlug() {
// return slug;
// }
// }
// }
// Path: src/main/java/com/mageddo/bookmarks/dao/TagDAO.java
import java.util.List;
import com.mageddo.bookmarks.apiserver.res.TagV1Res;
import com.mageddo.bookmarks.entity.TagEntity;
import com.mageddo.bookmarks.utils.Tags;
package com.mageddo.bookmarks.dao;
public interface TagDAO {
List<TagV1Res> findTags();
| List<TagEntity> findTags(long bookmarkId); |
mageddo/bookmark-notes | src/main/java/com/mageddo/bookmarks/dao/TagDAO.java | // Path: src/main/java/com/mageddo/bookmarks/apiserver/res/TagV1Res.java
// public class TagV1Res {
//
// private Long id;
// private String name;
// private String slug;
//
// public static RowMapper<TagV1Res> mapper() {
// return (rs, rowNum) -> new TagV1Res().setId(rs.getLong("ID"))
// .setName(rs.getString("NAME"))
// .setSlug(rs.getString("SLUG"));
// }
//
// public Long getId() {
// return id;
// }
//
// public TagV1Res setId(Long id) {
// this.id = id;
// return this;
// }
//
// public String getName() {
// return name;
// }
//
// public TagV1Res setName(String name) {
// this.name = name;
// return this;
// }
//
// public String getSlug() {
// return slug;
// }
//
// public TagV1Res setSlug(String slug) {
// this.slug = slug;
// return this;
// }
// }
//
// Path: src/main/java/com/mageddo/bookmarks/entity/TagEntity.java
// public class TagEntity {
//
// private Integer id;
// private String slug;
// private String name;
// private Integer bookmarkId;
//
// public static RowMapper<TagEntity> mapper() {
// return (rs, rowNum) -> new TagEntity().setId(rs.getInt("IDT_TAG"))
// .setName(rs.getString("NAM_TAG"))
// .setSlug(rs.getString("COD_SLUG"))
// .setBookmarkId(JdbcHelper.getInteger(rs, "IDT_BOOKMARK"));
// }
//
// public String getName() {
// return name;
// }
//
// public TagEntity setName(String name) {
// this.name = name;
// return this;
// }
//
// public Integer getId() {
// return id;
// }
//
// public TagEntity setId(Integer id) {
// this.id = id;
// return this;
// }
//
// public String getSlug() {
// return slug;
// }
//
// public TagEntity setSlug(String slug) {
// this.slug = slug;
// return this;
// }
//
// public Integer getBookmarkId() {
// return bookmarkId;
// }
//
// public TagEntity setBookmarkId(Integer bookmarkId) {
// this.bookmarkId = bookmarkId;
// return this;
// }
//
// }
//
// Path: src/main/java/com/mageddo/bookmarks/utils/Tags.java
// public final class Tags {
// private Tags() {
// }
//
// public static Set<Tag> toTags(List<String> rawTags) {
// if (rawTags == null) {
// return Collections.emptySet();
// }
// return rawTags.stream()
// .map(Tag::new)
// .filter(it -> it.getSlug()
// .length() > 0)
// .collect(Collectors.toSet());
// }
//
// static String toSlug(String name) {
// return name.toLowerCase()
// .replace("/[^a-z0-9\\ \\-_]+/g", "")
// .trim()
// .replace("/[\\ _]+/g", "\\-");
// }
//
//
// public static class Tag {
//
// private final String name;
// private final String slug;
//
// public Tag(String name) {
// this.name = name.trim();
// this.slug = toSlug(name);
// }
//
// public String getName() {
// return name;
// }
//
// public String getSlug() {
// return slug;
// }
// }
// }
| import java.util.List;
import com.mageddo.bookmarks.apiserver.res.TagV1Res;
import com.mageddo.bookmarks.entity.TagEntity;
import com.mageddo.bookmarks.utils.Tags; | package com.mageddo.bookmarks.dao;
public interface TagDAO {
List<TagV1Res> findTags();
List<TagEntity> findTags(long bookmarkId);
List<TagEntity> findTags(String query);
| // Path: src/main/java/com/mageddo/bookmarks/apiserver/res/TagV1Res.java
// public class TagV1Res {
//
// private Long id;
// private String name;
// private String slug;
//
// public static RowMapper<TagV1Res> mapper() {
// return (rs, rowNum) -> new TagV1Res().setId(rs.getLong("ID"))
// .setName(rs.getString("NAME"))
// .setSlug(rs.getString("SLUG"));
// }
//
// public Long getId() {
// return id;
// }
//
// public TagV1Res setId(Long id) {
// this.id = id;
// return this;
// }
//
// public String getName() {
// return name;
// }
//
// public TagV1Res setName(String name) {
// this.name = name;
// return this;
// }
//
// public String getSlug() {
// return slug;
// }
//
// public TagV1Res setSlug(String slug) {
// this.slug = slug;
// return this;
// }
// }
//
// Path: src/main/java/com/mageddo/bookmarks/entity/TagEntity.java
// public class TagEntity {
//
// private Integer id;
// private String slug;
// private String name;
// private Integer bookmarkId;
//
// public static RowMapper<TagEntity> mapper() {
// return (rs, rowNum) -> new TagEntity().setId(rs.getInt("IDT_TAG"))
// .setName(rs.getString("NAM_TAG"))
// .setSlug(rs.getString("COD_SLUG"))
// .setBookmarkId(JdbcHelper.getInteger(rs, "IDT_BOOKMARK"));
// }
//
// public String getName() {
// return name;
// }
//
// public TagEntity setName(String name) {
// this.name = name;
// return this;
// }
//
// public Integer getId() {
// return id;
// }
//
// public TagEntity setId(Integer id) {
// this.id = id;
// return this;
// }
//
// public String getSlug() {
// return slug;
// }
//
// public TagEntity setSlug(String slug) {
// this.slug = slug;
// return this;
// }
//
// public Integer getBookmarkId() {
// return bookmarkId;
// }
//
// public TagEntity setBookmarkId(Integer bookmarkId) {
// this.bookmarkId = bookmarkId;
// return this;
// }
//
// }
//
// Path: src/main/java/com/mageddo/bookmarks/utils/Tags.java
// public final class Tags {
// private Tags() {
// }
//
// public static Set<Tag> toTags(List<String> rawTags) {
// if (rawTags == null) {
// return Collections.emptySet();
// }
// return rawTags.stream()
// .map(Tag::new)
// .filter(it -> it.getSlug()
// .length() > 0)
// .collect(Collectors.toSet());
// }
//
// static String toSlug(String name) {
// return name.toLowerCase()
// .replace("/[^a-z0-9\\ \\-_]+/g", "")
// .trim()
// .replace("/[\\ _]+/g", "\\-");
// }
//
//
// public static class Tag {
//
// private final String name;
// private final String slug;
//
// public Tag(String name) {
// this.name = name.trim();
// this.slug = toSlug(name);
// }
//
// public String getName() {
// return name;
// }
//
// public String getSlug() {
// return slug;
// }
// }
// }
// Path: src/main/java/com/mageddo/bookmarks/dao/TagDAO.java
import java.util.List;
import com.mageddo.bookmarks.apiserver.res.TagV1Res;
import com.mageddo.bookmarks.entity.TagEntity;
import com.mageddo.bookmarks.utils.Tags;
package com.mageddo.bookmarks.dao;
public interface TagDAO {
List<TagV1Res> findTags();
List<TagEntity> findTags(long bookmarkId);
List<TagEntity> findTags(String query);
| void createIgnoreDuplicates(Tags.Tag tag); |
mageddo/bookmark-notes | src/main/java/com/mageddo/bookmarks/apiserver/res/BookmarkRes.java | // Path: src/main/java/com/mageddo/bookmarks/entity/BookmarkEntity.java
// public class BookmarkEntity {
//
// private Integer id;
// private String name;
// private LocalDateTime lastUpdate;
// private String link;
// private String description;
// private boolean deleted;
// private boolean archived;
// private BookmarkVisibility visibility;
// private LocalDateTime creation;
//
// public BookmarkEntity() {
// this.lastUpdate = LocalDateTime.now();
// }
//
// public BookmarkEntity(String name, BookmarkVisibility visibility) {
// this.name = name;
// this.visibility = visibility;
// }
//
// public static RowMapper<BookmarkEntity> mapper() {
// return (rs, rowNum) -> new BookmarkEntity().setArchived(rs.getBoolean("flg_archived"))
// .setDeleted(rs.getBoolean("flg_deleted"))
// .setDescription(rs.getString("des_html"))
// .setId(rs.getInt("idt_bookmark"))
// .setLastUpdate(JdbcHelper.getLocalDateTime(rs, "dat_update"))
// .setLink(rs.getString("des_link"))
// .setName(rs.getString("nam_bookmark"))
// .setVisibility(BookmarkVisibility.mustFromCode(rs.getInt("num_visibility")))
// .setCreation(JdbcHelper.getLocalDateTime(rs, "DAT_CREATION"))
// .setLastUpdate(JdbcHelper.getLocalDateTime(rs, "DAT_UPDATE"));
// }
//
// public Integer getId() {
// return id;
// }
//
// public BookmarkEntity setId(Integer id) {
// this.id = id;
// return this;
// }
//
// public String getName() {
// return name;
// }
//
// public BookmarkEntity setName(String name) {
// this.name = name;
// return this;
// }
//
// public LocalDateTime getLastUpdate() {
// return lastUpdate;
// }
//
// public BookmarkEntity setLastUpdate(LocalDateTime lastUpdate) {
// this.lastUpdate = lastUpdate;
// return this;
// }
//
// public String getLink() {
// return link;
// }
//
// public BookmarkEntity setLink(String link) {
// this.link = link;
// return this;
// }
//
// public String getDescription() {
// return description;
// }
//
// public BookmarkEntity setDescription(String description) {
// this.description = description;
// return this;
// }
//
// public boolean isDeleted() {
// return deleted;
// }
//
// public BookmarkEntity setDeleted(boolean deleted) {
// this.deleted = deleted;
// return this;
// }
//
// public boolean isArchived() {
// return archived;
// }
//
// public BookmarkEntity setArchived(boolean archived) {
// this.archived = archived;
// return this;
// }
//
// public BookmarkVisibility getVisibility() {
// return visibility;
// }
//
// public BookmarkEntity setVisibility(BookmarkVisibility visibility) {
// this.visibility = visibility;
// return this;
// }
//
// public LocalDateTime getCreation() {
// return creation;
// }
//
// public BookmarkEntity setCreation(LocalDateTime creation) {
// this.creation = creation;
// return this;
// }
// }
//
// Path: src/main/java/com/mageddo/bookmarks/jackson/TruncatedLocalDateTimeConverter.java
// public interface TruncatedLocalDateTimeConverter {
//
// DateTimeFormatter FORMATTER = new DateTimeFormatterBuilder().parseCaseInsensitive()
// .appendPattern("yyyy-MM-dd")
// .toFormatter();
//
// class Deserializer extends JsonDeserializer<LocalDateTime> {
//
// @Override
// public LocalDateTime deserialize(JsonParser p, DeserializationContext ctxt) throws IOException {
// // 2018-01-18T17:43:34.101
// if (p.getCurrentToken() == JsonToken.VALUE_NULL) {
// return null;
// }
// return LocalDateTime.parse(p.getValueAsString(), FORMATTER);
// }
// }
//
// class Serializer extends JsonSerializer<LocalDateTime> {
// @Override
// public void serialize(LocalDateTime value, JsonGenerator gen, SerializerProvider serializers) throws IOException {
// if (value == null) {
// gen.writeNull();
// return;
// }
// gen.writeString(DateUtils.format(value, FORMATTER));
// }
// }
// }
| import java.time.LocalDateTime;
import java.util.List;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.mageddo.bookmarks.entity.BookmarkEntity;
import com.mageddo.bookmarks.jackson.TruncatedLocalDateTimeConverter;
import org.springframework.jdbc.core.RowMapper;
import static com.mageddo.bookmarks.enums.BookmarkVisibility.PRIVATE;
import static com.mageddo.bookmarks.enums.BookmarkVisibility.mustFromCode; | package com.mageddo.bookmarks.apiserver.res;
public class BookmarkRes {
private Integer id;
private String name;
private String link;
private Integer visibility;
private String html;
private Integer length;
private List<String> tags;
private LocalDateTime creationDate;
private LocalDateTime updateDate;
public static RowMapper<BookmarkRes> mapper() {
return (rs, i) -> { | // Path: src/main/java/com/mageddo/bookmarks/entity/BookmarkEntity.java
// public class BookmarkEntity {
//
// private Integer id;
// private String name;
// private LocalDateTime lastUpdate;
// private String link;
// private String description;
// private boolean deleted;
// private boolean archived;
// private BookmarkVisibility visibility;
// private LocalDateTime creation;
//
// public BookmarkEntity() {
// this.lastUpdate = LocalDateTime.now();
// }
//
// public BookmarkEntity(String name, BookmarkVisibility visibility) {
// this.name = name;
// this.visibility = visibility;
// }
//
// public static RowMapper<BookmarkEntity> mapper() {
// return (rs, rowNum) -> new BookmarkEntity().setArchived(rs.getBoolean("flg_archived"))
// .setDeleted(rs.getBoolean("flg_deleted"))
// .setDescription(rs.getString("des_html"))
// .setId(rs.getInt("idt_bookmark"))
// .setLastUpdate(JdbcHelper.getLocalDateTime(rs, "dat_update"))
// .setLink(rs.getString("des_link"))
// .setName(rs.getString("nam_bookmark"))
// .setVisibility(BookmarkVisibility.mustFromCode(rs.getInt("num_visibility")))
// .setCreation(JdbcHelper.getLocalDateTime(rs, "DAT_CREATION"))
// .setLastUpdate(JdbcHelper.getLocalDateTime(rs, "DAT_UPDATE"));
// }
//
// public Integer getId() {
// return id;
// }
//
// public BookmarkEntity setId(Integer id) {
// this.id = id;
// return this;
// }
//
// public String getName() {
// return name;
// }
//
// public BookmarkEntity setName(String name) {
// this.name = name;
// return this;
// }
//
// public LocalDateTime getLastUpdate() {
// return lastUpdate;
// }
//
// public BookmarkEntity setLastUpdate(LocalDateTime lastUpdate) {
// this.lastUpdate = lastUpdate;
// return this;
// }
//
// public String getLink() {
// return link;
// }
//
// public BookmarkEntity setLink(String link) {
// this.link = link;
// return this;
// }
//
// public String getDescription() {
// return description;
// }
//
// public BookmarkEntity setDescription(String description) {
// this.description = description;
// return this;
// }
//
// public boolean isDeleted() {
// return deleted;
// }
//
// public BookmarkEntity setDeleted(boolean deleted) {
// this.deleted = deleted;
// return this;
// }
//
// public boolean isArchived() {
// return archived;
// }
//
// public BookmarkEntity setArchived(boolean archived) {
// this.archived = archived;
// return this;
// }
//
// public BookmarkVisibility getVisibility() {
// return visibility;
// }
//
// public BookmarkEntity setVisibility(BookmarkVisibility visibility) {
// this.visibility = visibility;
// return this;
// }
//
// public LocalDateTime getCreation() {
// return creation;
// }
//
// public BookmarkEntity setCreation(LocalDateTime creation) {
// this.creation = creation;
// return this;
// }
// }
//
// Path: src/main/java/com/mageddo/bookmarks/jackson/TruncatedLocalDateTimeConverter.java
// public interface TruncatedLocalDateTimeConverter {
//
// DateTimeFormatter FORMATTER = new DateTimeFormatterBuilder().parseCaseInsensitive()
// .appendPattern("yyyy-MM-dd")
// .toFormatter();
//
// class Deserializer extends JsonDeserializer<LocalDateTime> {
//
// @Override
// public LocalDateTime deserialize(JsonParser p, DeserializationContext ctxt) throws IOException {
// // 2018-01-18T17:43:34.101
// if (p.getCurrentToken() == JsonToken.VALUE_NULL) {
// return null;
// }
// return LocalDateTime.parse(p.getValueAsString(), FORMATTER);
// }
// }
//
// class Serializer extends JsonSerializer<LocalDateTime> {
// @Override
// public void serialize(LocalDateTime value, JsonGenerator gen, SerializerProvider serializers) throws IOException {
// if (value == null) {
// gen.writeNull();
// return;
// }
// gen.writeString(DateUtils.format(value, FORMATTER));
// }
// }
// }
// Path: src/main/java/com/mageddo/bookmarks/apiserver/res/BookmarkRes.java
import java.time.LocalDateTime;
import java.util.List;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.mageddo.bookmarks.entity.BookmarkEntity;
import com.mageddo.bookmarks.jackson.TruncatedLocalDateTimeConverter;
import org.springframework.jdbc.core.RowMapper;
import static com.mageddo.bookmarks.enums.BookmarkVisibility.PRIVATE;
import static com.mageddo.bookmarks.enums.BookmarkVisibility.mustFromCode;
package com.mageddo.bookmarks.apiserver.res;
public class BookmarkRes {
private Integer id;
private String name;
private String link;
private Integer visibility;
private String html;
private Integer length;
private List<String> tags;
private LocalDateTime creationDate;
private LocalDateTime updateDate;
public static RowMapper<BookmarkRes> mapper() {
return (rs, i) -> { | final BookmarkRes bookmark = BookmarkRes.valueOf(BookmarkEntity |
mageddo/bookmark-notes | src/main/java/com/mageddo/bookmarks/apiserver/res/BookmarkRes.java | // Path: src/main/java/com/mageddo/bookmarks/entity/BookmarkEntity.java
// public class BookmarkEntity {
//
// private Integer id;
// private String name;
// private LocalDateTime lastUpdate;
// private String link;
// private String description;
// private boolean deleted;
// private boolean archived;
// private BookmarkVisibility visibility;
// private LocalDateTime creation;
//
// public BookmarkEntity() {
// this.lastUpdate = LocalDateTime.now();
// }
//
// public BookmarkEntity(String name, BookmarkVisibility visibility) {
// this.name = name;
// this.visibility = visibility;
// }
//
// public static RowMapper<BookmarkEntity> mapper() {
// return (rs, rowNum) -> new BookmarkEntity().setArchived(rs.getBoolean("flg_archived"))
// .setDeleted(rs.getBoolean("flg_deleted"))
// .setDescription(rs.getString("des_html"))
// .setId(rs.getInt("idt_bookmark"))
// .setLastUpdate(JdbcHelper.getLocalDateTime(rs, "dat_update"))
// .setLink(rs.getString("des_link"))
// .setName(rs.getString("nam_bookmark"))
// .setVisibility(BookmarkVisibility.mustFromCode(rs.getInt("num_visibility")))
// .setCreation(JdbcHelper.getLocalDateTime(rs, "DAT_CREATION"))
// .setLastUpdate(JdbcHelper.getLocalDateTime(rs, "DAT_UPDATE"));
// }
//
// public Integer getId() {
// return id;
// }
//
// public BookmarkEntity setId(Integer id) {
// this.id = id;
// return this;
// }
//
// public String getName() {
// return name;
// }
//
// public BookmarkEntity setName(String name) {
// this.name = name;
// return this;
// }
//
// public LocalDateTime getLastUpdate() {
// return lastUpdate;
// }
//
// public BookmarkEntity setLastUpdate(LocalDateTime lastUpdate) {
// this.lastUpdate = lastUpdate;
// return this;
// }
//
// public String getLink() {
// return link;
// }
//
// public BookmarkEntity setLink(String link) {
// this.link = link;
// return this;
// }
//
// public String getDescription() {
// return description;
// }
//
// public BookmarkEntity setDescription(String description) {
// this.description = description;
// return this;
// }
//
// public boolean isDeleted() {
// return deleted;
// }
//
// public BookmarkEntity setDeleted(boolean deleted) {
// this.deleted = deleted;
// return this;
// }
//
// public boolean isArchived() {
// return archived;
// }
//
// public BookmarkEntity setArchived(boolean archived) {
// this.archived = archived;
// return this;
// }
//
// public BookmarkVisibility getVisibility() {
// return visibility;
// }
//
// public BookmarkEntity setVisibility(BookmarkVisibility visibility) {
// this.visibility = visibility;
// return this;
// }
//
// public LocalDateTime getCreation() {
// return creation;
// }
//
// public BookmarkEntity setCreation(LocalDateTime creation) {
// this.creation = creation;
// return this;
// }
// }
//
// Path: src/main/java/com/mageddo/bookmarks/jackson/TruncatedLocalDateTimeConverter.java
// public interface TruncatedLocalDateTimeConverter {
//
// DateTimeFormatter FORMATTER = new DateTimeFormatterBuilder().parseCaseInsensitive()
// .appendPattern("yyyy-MM-dd")
// .toFormatter();
//
// class Deserializer extends JsonDeserializer<LocalDateTime> {
//
// @Override
// public LocalDateTime deserialize(JsonParser p, DeserializationContext ctxt) throws IOException {
// // 2018-01-18T17:43:34.101
// if (p.getCurrentToken() == JsonToken.VALUE_NULL) {
// return null;
// }
// return LocalDateTime.parse(p.getValueAsString(), FORMATTER);
// }
// }
//
// class Serializer extends JsonSerializer<LocalDateTime> {
// @Override
// public void serialize(LocalDateTime value, JsonGenerator gen, SerializerProvider serializers) throws IOException {
// if (value == null) {
// gen.writeNull();
// return;
// }
// gen.writeString(DateUtils.format(value, FORMATTER));
// }
// }
// }
| import java.time.LocalDateTime;
import java.util.List;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.mageddo.bookmarks.entity.BookmarkEntity;
import com.mageddo.bookmarks.jackson.TruncatedLocalDateTimeConverter;
import org.springframework.jdbc.core.RowMapper;
import static com.mageddo.bookmarks.enums.BookmarkVisibility.PRIVATE;
import static com.mageddo.bookmarks.enums.BookmarkVisibility.mustFromCode; | package com.mageddo.bookmarks.apiserver.res;
public class BookmarkRes {
private Integer id;
private String name;
private String link;
private Integer visibility;
private String html;
private Integer length;
private List<String> tags;
private LocalDateTime creationDate;
private LocalDateTime updateDate;
public static RowMapper<BookmarkRes> mapper() {
return (rs, i) -> {
final BookmarkRes bookmark = BookmarkRes.valueOf(BookmarkEntity
.mapper()
.mapRow(rs, i));
bookmark.setLength(rs.getInt("NUM_QUANTITY"));
return bookmark;
};
}
private static BookmarkRes valueOf(BookmarkEntity bookmark) {
return new BookmarkRes().setHtml(bookmark.getDescription())
.setId(bookmark.getId())
.setName(bookmark.getName())
.setVisibility(bookmark.getVisibility()
.getCode())
.setLink(bookmark.getLink())
.setUpdateDate(bookmark.getLastUpdate())
.setCreationDate(bookmark.getCreation());
}
| // Path: src/main/java/com/mageddo/bookmarks/entity/BookmarkEntity.java
// public class BookmarkEntity {
//
// private Integer id;
// private String name;
// private LocalDateTime lastUpdate;
// private String link;
// private String description;
// private boolean deleted;
// private boolean archived;
// private BookmarkVisibility visibility;
// private LocalDateTime creation;
//
// public BookmarkEntity() {
// this.lastUpdate = LocalDateTime.now();
// }
//
// public BookmarkEntity(String name, BookmarkVisibility visibility) {
// this.name = name;
// this.visibility = visibility;
// }
//
// public static RowMapper<BookmarkEntity> mapper() {
// return (rs, rowNum) -> new BookmarkEntity().setArchived(rs.getBoolean("flg_archived"))
// .setDeleted(rs.getBoolean("flg_deleted"))
// .setDescription(rs.getString("des_html"))
// .setId(rs.getInt("idt_bookmark"))
// .setLastUpdate(JdbcHelper.getLocalDateTime(rs, "dat_update"))
// .setLink(rs.getString("des_link"))
// .setName(rs.getString("nam_bookmark"))
// .setVisibility(BookmarkVisibility.mustFromCode(rs.getInt("num_visibility")))
// .setCreation(JdbcHelper.getLocalDateTime(rs, "DAT_CREATION"))
// .setLastUpdate(JdbcHelper.getLocalDateTime(rs, "DAT_UPDATE"));
// }
//
// public Integer getId() {
// return id;
// }
//
// public BookmarkEntity setId(Integer id) {
// this.id = id;
// return this;
// }
//
// public String getName() {
// return name;
// }
//
// public BookmarkEntity setName(String name) {
// this.name = name;
// return this;
// }
//
// public LocalDateTime getLastUpdate() {
// return lastUpdate;
// }
//
// public BookmarkEntity setLastUpdate(LocalDateTime lastUpdate) {
// this.lastUpdate = lastUpdate;
// return this;
// }
//
// public String getLink() {
// return link;
// }
//
// public BookmarkEntity setLink(String link) {
// this.link = link;
// return this;
// }
//
// public String getDescription() {
// return description;
// }
//
// public BookmarkEntity setDescription(String description) {
// this.description = description;
// return this;
// }
//
// public boolean isDeleted() {
// return deleted;
// }
//
// public BookmarkEntity setDeleted(boolean deleted) {
// this.deleted = deleted;
// return this;
// }
//
// public boolean isArchived() {
// return archived;
// }
//
// public BookmarkEntity setArchived(boolean archived) {
// this.archived = archived;
// return this;
// }
//
// public BookmarkVisibility getVisibility() {
// return visibility;
// }
//
// public BookmarkEntity setVisibility(BookmarkVisibility visibility) {
// this.visibility = visibility;
// return this;
// }
//
// public LocalDateTime getCreation() {
// return creation;
// }
//
// public BookmarkEntity setCreation(LocalDateTime creation) {
// this.creation = creation;
// return this;
// }
// }
//
// Path: src/main/java/com/mageddo/bookmarks/jackson/TruncatedLocalDateTimeConverter.java
// public interface TruncatedLocalDateTimeConverter {
//
// DateTimeFormatter FORMATTER = new DateTimeFormatterBuilder().parseCaseInsensitive()
// .appendPattern("yyyy-MM-dd")
// .toFormatter();
//
// class Deserializer extends JsonDeserializer<LocalDateTime> {
//
// @Override
// public LocalDateTime deserialize(JsonParser p, DeserializationContext ctxt) throws IOException {
// // 2018-01-18T17:43:34.101
// if (p.getCurrentToken() == JsonToken.VALUE_NULL) {
// return null;
// }
// return LocalDateTime.parse(p.getValueAsString(), FORMATTER);
// }
// }
//
// class Serializer extends JsonSerializer<LocalDateTime> {
// @Override
// public void serialize(LocalDateTime value, JsonGenerator gen, SerializerProvider serializers) throws IOException {
// if (value == null) {
// gen.writeNull();
// return;
// }
// gen.writeString(DateUtils.format(value, FORMATTER));
// }
// }
// }
// Path: src/main/java/com/mageddo/bookmarks/apiserver/res/BookmarkRes.java
import java.time.LocalDateTime;
import java.util.List;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.mageddo.bookmarks.entity.BookmarkEntity;
import com.mageddo.bookmarks.jackson.TruncatedLocalDateTimeConverter;
import org.springframework.jdbc.core.RowMapper;
import static com.mageddo.bookmarks.enums.BookmarkVisibility.PRIVATE;
import static com.mageddo.bookmarks.enums.BookmarkVisibility.mustFromCode;
package com.mageddo.bookmarks.apiserver.res;
public class BookmarkRes {
private Integer id;
private String name;
private String link;
private Integer visibility;
private String html;
private Integer length;
private List<String> tags;
private LocalDateTime creationDate;
private LocalDateTime updateDate;
public static RowMapper<BookmarkRes> mapper() {
return (rs, i) -> {
final BookmarkRes bookmark = BookmarkRes.valueOf(BookmarkEntity
.mapper()
.mapRow(rs, i));
bookmark.setLength(rs.getInt("NUM_QUANTITY"));
return bookmark;
};
}
private static BookmarkRes valueOf(BookmarkEntity bookmark) {
return new BookmarkRes().setHtml(bookmark.getDescription())
.setId(bookmark.getId())
.setName(bookmark.getName())
.setVisibility(bookmark.getVisibility()
.getCode())
.setLink(bookmark.getLink())
.setUpdateDate(bookmark.getLastUpdate())
.setCreationDate(bookmark.getCreation());
}
| @JsonSerialize(using = TruncatedLocalDateTimeConverter.Serializer.class) |
mageddo/bookmark-notes | src/main/java/com/mageddo/Application.java | // Path: src/main/java/com/mageddo/commons/MigrationUtils.java
// public final class MigrationUtils {
//
// private MigrationUtils() {
// }
//
// public static void migrate(final Environment env) {
// final Flyway flyway = getFlyway(env);
// flyway.repair();
// flyway.migrate();
// }
//
// public static Flyway getFlyway(Environment env) {
// return Flyway.configure()
// .locations(getLocations(env))
// .dataSource(get(env, "datasources.default.jdbc-url"), get(env, "datasources.default.username"),
// get(env, "datasources.default.password")
// )
// .schemas(get(env, "flyway.schema"))
// .load();
// }
//
// private static String get(Environment env, String k) {
// return env.get(k, String.class, "");
// }
//
// private static String getLocations(Environment env) {
// if (ImageInfo.inImageRuntimeCode()) {
// return String.format("filesystem:%s/%s", getExecutablePath(), get(env, "flyway.locations-image"));
// }
// return "classpath:" + get(env, "flyway.locations-java");
// }
//
// private static Path getExecutablePath() {
// return Paths.get(ProcessProperties.getExecutableName())
// .getParent();
// }
//
// }
//
// Path: src/main/java/com/mageddo/config/ApplicationContextUtils.java
// public final class ApplicationContextUtils {
//
// private static ApplicationContext context;
//
// private ApplicationContextUtils() {
// }
//
// public static ApplicationContext context() {
// return context;
// }
//
// public static void context(ApplicationContext context) {
// ApplicationContextUtils.context = context;
// }
// }
//
// Path: src/main/java/thymeleaf/ThymeleafUtils.java
// public final class ThymeleafUtils {
//
// private ThymeleafUtils() {
// }
//
// public static String[] splitTags(String tags) {
// return tags == null ? null : tags.split(",");
// }
//
// public static String encodePath(String path) {
// return UrlUtils.encode(path);
// }
//
// public static String createBookmarkUrl(long id, String name) {
// return SiteMapService.formatUrl(id, name);
// }
//
// public static String analyticsId() {
// return context().getEnvironment()
// .get("analytics.id", String.class, "");
// }
//
// public static String headerHtml(){
// return HtmlEscape.unescapeHtml(context()
// .getBean(SettingsService.class)
// .findSetting(Setting.PUBLIC_PAGES_HEADER_HTML.name())
// .getValue())
// ;
// }
// }
| import com.mageddo.commons.MigrationUtils;
import com.mageddo.config.ApplicationContextUtils;
import io.micronaut.context.ApplicationContext;
import io.micronaut.runtime.Micronaut;
import io.micronaut.runtime.event.annotation.EventListener;
import io.micronaut.runtime.server.event.ServerStartupEvent;
import nativeimage.Reflection;
import nativeimage.Reflections;
import org.flywaydb.core.internal.logging.javautil.JavaUtilLogCreator;
import thymeleaf.ThymeleafUtils;
import java.lang.reflect.InvocationTargetException; | package com.mageddo;
public class Application {
public static void main(String[] args) {
setupProperties();
setupEnv();
Micronaut.run(Application.class);
}
static void setupEnv() {
final String osEnvs = System.getenv("MICRONAUT_ENVIRONMENTS");
final String javaEnvs = System.getProperty("micronaut.environments");
if (osEnvs == null && javaEnvs == null) {
System.setProperty("micronaut.environments", "pg");
}
}
static void setupProperties() {
commonsLoggingFix();
}
private static void commonsLoggingFix() {
System.setProperty("org.apache.commons.logging.Log", "org.apache.commons.logging.impl.NoOpLog");
System.setProperty("org.apache.commons.logging.diagnostics.dest", "STDOUT");
}
@EventListener
public void onStartup(ServerStartupEvent event)
throws NoSuchMethodException, InvocationTargetException, IllegalAccessException {
final ApplicationContext ctx = event.getSource()
.getApplicationContext(); | // Path: src/main/java/com/mageddo/commons/MigrationUtils.java
// public final class MigrationUtils {
//
// private MigrationUtils() {
// }
//
// public static void migrate(final Environment env) {
// final Flyway flyway = getFlyway(env);
// flyway.repair();
// flyway.migrate();
// }
//
// public static Flyway getFlyway(Environment env) {
// return Flyway.configure()
// .locations(getLocations(env))
// .dataSource(get(env, "datasources.default.jdbc-url"), get(env, "datasources.default.username"),
// get(env, "datasources.default.password")
// )
// .schemas(get(env, "flyway.schema"))
// .load();
// }
//
// private static String get(Environment env, String k) {
// return env.get(k, String.class, "");
// }
//
// private static String getLocations(Environment env) {
// if (ImageInfo.inImageRuntimeCode()) {
// return String.format("filesystem:%s/%s", getExecutablePath(), get(env, "flyway.locations-image"));
// }
// return "classpath:" + get(env, "flyway.locations-java");
// }
//
// private static Path getExecutablePath() {
// return Paths.get(ProcessProperties.getExecutableName())
// .getParent();
// }
//
// }
//
// Path: src/main/java/com/mageddo/config/ApplicationContextUtils.java
// public final class ApplicationContextUtils {
//
// private static ApplicationContext context;
//
// private ApplicationContextUtils() {
// }
//
// public static ApplicationContext context() {
// return context;
// }
//
// public static void context(ApplicationContext context) {
// ApplicationContextUtils.context = context;
// }
// }
//
// Path: src/main/java/thymeleaf/ThymeleafUtils.java
// public final class ThymeleafUtils {
//
// private ThymeleafUtils() {
// }
//
// public static String[] splitTags(String tags) {
// return tags == null ? null : tags.split(",");
// }
//
// public static String encodePath(String path) {
// return UrlUtils.encode(path);
// }
//
// public static String createBookmarkUrl(long id, String name) {
// return SiteMapService.formatUrl(id, name);
// }
//
// public static String analyticsId() {
// return context().getEnvironment()
// .get("analytics.id", String.class, "");
// }
//
// public static String headerHtml(){
// return HtmlEscape.unescapeHtml(context()
// .getBean(SettingsService.class)
// .findSetting(Setting.PUBLIC_PAGES_HEADER_HTML.name())
// .getValue())
// ;
// }
// }
// Path: src/main/java/com/mageddo/Application.java
import com.mageddo.commons.MigrationUtils;
import com.mageddo.config.ApplicationContextUtils;
import io.micronaut.context.ApplicationContext;
import io.micronaut.runtime.Micronaut;
import io.micronaut.runtime.event.annotation.EventListener;
import io.micronaut.runtime.server.event.ServerStartupEvent;
import nativeimage.Reflection;
import nativeimage.Reflections;
import org.flywaydb.core.internal.logging.javautil.JavaUtilLogCreator;
import thymeleaf.ThymeleafUtils;
import java.lang.reflect.InvocationTargetException;
package com.mageddo;
public class Application {
public static void main(String[] args) {
setupProperties();
setupEnv();
Micronaut.run(Application.class);
}
static void setupEnv() {
final String osEnvs = System.getenv("MICRONAUT_ENVIRONMENTS");
final String javaEnvs = System.getProperty("micronaut.environments");
if (osEnvs == null && javaEnvs == null) {
System.setProperty("micronaut.environments", "pg");
}
}
static void setupProperties() {
commonsLoggingFix();
}
private static void commonsLoggingFix() {
System.setProperty("org.apache.commons.logging.Log", "org.apache.commons.logging.impl.NoOpLog");
System.setProperty("org.apache.commons.logging.diagnostics.dest", "STDOUT");
}
@EventListener
public void onStartup(ServerStartupEvent event)
throws NoSuchMethodException, InvocationTargetException, IllegalAccessException {
final ApplicationContext ctx = event.getSource()
.getApplicationContext(); | ApplicationContextUtils.context(ctx); |
mageddo/bookmark-notes | src/main/java/com/mageddo/Application.java | // Path: src/main/java/com/mageddo/commons/MigrationUtils.java
// public final class MigrationUtils {
//
// private MigrationUtils() {
// }
//
// public static void migrate(final Environment env) {
// final Flyway flyway = getFlyway(env);
// flyway.repair();
// flyway.migrate();
// }
//
// public static Flyway getFlyway(Environment env) {
// return Flyway.configure()
// .locations(getLocations(env))
// .dataSource(get(env, "datasources.default.jdbc-url"), get(env, "datasources.default.username"),
// get(env, "datasources.default.password")
// )
// .schemas(get(env, "flyway.schema"))
// .load();
// }
//
// private static String get(Environment env, String k) {
// return env.get(k, String.class, "");
// }
//
// private static String getLocations(Environment env) {
// if (ImageInfo.inImageRuntimeCode()) {
// return String.format("filesystem:%s/%s", getExecutablePath(), get(env, "flyway.locations-image"));
// }
// return "classpath:" + get(env, "flyway.locations-java");
// }
//
// private static Path getExecutablePath() {
// return Paths.get(ProcessProperties.getExecutableName())
// .getParent();
// }
//
// }
//
// Path: src/main/java/com/mageddo/config/ApplicationContextUtils.java
// public final class ApplicationContextUtils {
//
// private static ApplicationContext context;
//
// private ApplicationContextUtils() {
// }
//
// public static ApplicationContext context() {
// return context;
// }
//
// public static void context(ApplicationContext context) {
// ApplicationContextUtils.context = context;
// }
// }
//
// Path: src/main/java/thymeleaf/ThymeleafUtils.java
// public final class ThymeleafUtils {
//
// private ThymeleafUtils() {
// }
//
// public static String[] splitTags(String tags) {
// return tags == null ? null : tags.split(",");
// }
//
// public static String encodePath(String path) {
// return UrlUtils.encode(path);
// }
//
// public static String createBookmarkUrl(long id, String name) {
// return SiteMapService.formatUrl(id, name);
// }
//
// public static String analyticsId() {
// return context().getEnvironment()
// .get("analytics.id", String.class, "");
// }
//
// public static String headerHtml(){
// return HtmlEscape.unescapeHtml(context()
// .getBean(SettingsService.class)
// .findSetting(Setting.PUBLIC_PAGES_HEADER_HTML.name())
// .getValue())
// ;
// }
// }
| import com.mageddo.commons.MigrationUtils;
import com.mageddo.config.ApplicationContextUtils;
import io.micronaut.context.ApplicationContext;
import io.micronaut.runtime.Micronaut;
import io.micronaut.runtime.event.annotation.EventListener;
import io.micronaut.runtime.server.event.ServerStartupEvent;
import nativeimage.Reflection;
import nativeimage.Reflections;
import org.flywaydb.core.internal.logging.javautil.JavaUtilLogCreator;
import thymeleaf.ThymeleafUtils;
import java.lang.reflect.InvocationTargetException; | package com.mageddo;
public class Application {
public static void main(String[] args) {
setupProperties();
setupEnv();
Micronaut.run(Application.class);
}
static void setupEnv() {
final String osEnvs = System.getenv("MICRONAUT_ENVIRONMENTS");
final String javaEnvs = System.getProperty("micronaut.environments");
if (osEnvs == null && javaEnvs == null) {
System.setProperty("micronaut.environments", "pg");
}
}
static void setupProperties() {
commonsLoggingFix();
}
private static void commonsLoggingFix() {
System.setProperty("org.apache.commons.logging.Log", "org.apache.commons.logging.impl.NoOpLog");
System.setProperty("org.apache.commons.logging.diagnostics.dest", "STDOUT");
}
@EventListener
public void onStartup(ServerStartupEvent event)
throws NoSuchMethodException, InvocationTargetException, IllegalAccessException {
final ApplicationContext ctx = event.getSource()
.getApplicationContext();
ApplicationContextUtils.context(ctx); | // Path: src/main/java/com/mageddo/commons/MigrationUtils.java
// public final class MigrationUtils {
//
// private MigrationUtils() {
// }
//
// public static void migrate(final Environment env) {
// final Flyway flyway = getFlyway(env);
// flyway.repair();
// flyway.migrate();
// }
//
// public static Flyway getFlyway(Environment env) {
// return Flyway.configure()
// .locations(getLocations(env))
// .dataSource(get(env, "datasources.default.jdbc-url"), get(env, "datasources.default.username"),
// get(env, "datasources.default.password")
// )
// .schemas(get(env, "flyway.schema"))
// .load();
// }
//
// private static String get(Environment env, String k) {
// return env.get(k, String.class, "");
// }
//
// private static String getLocations(Environment env) {
// if (ImageInfo.inImageRuntimeCode()) {
// return String.format("filesystem:%s/%s", getExecutablePath(), get(env, "flyway.locations-image"));
// }
// return "classpath:" + get(env, "flyway.locations-java");
// }
//
// private static Path getExecutablePath() {
// return Paths.get(ProcessProperties.getExecutableName())
// .getParent();
// }
//
// }
//
// Path: src/main/java/com/mageddo/config/ApplicationContextUtils.java
// public final class ApplicationContextUtils {
//
// private static ApplicationContext context;
//
// private ApplicationContextUtils() {
// }
//
// public static ApplicationContext context() {
// return context;
// }
//
// public static void context(ApplicationContext context) {
// ApplicationContextUtils.context = context;
// }
// }
//
// Path: src/main/java/thymeleaf/ThymeleafUtils.java
// public final class ThymeleafUtils {
//
// private ThymeleafUtils() {
// }
//
// public static String[] splitTags(String tags) {
// return tags == null ? null : tags.split(",");
// }
//
// public static String encodePath(String path) {
// return UrlUtils.encode(path);
// }
//
// public static String createBookmarkUrl(long id, String name) {
// return SiteMapService.formatUrl(id, name);
// }
//
// public static String analyticsId() {
// return context().getEnvironment()
// .get("analytics.id", String.class, "");
// }
//
// public static String headerHtml(){
// return HtmlEscape.unescapeHtml(context()
// .getBean(SettingsService.class)
// .findSetting(Setting.PUBLIC_PAGES_HEADER_HTML.name())
// .getValue())
// ;
// }
// }
// Path: src/main/java/com/mageddo/Application.java
import com.mageddo.commons.MigrationUtils;
import com.mageddo.config.ApplicationContextUtils;
import io.micronaut.context.ApplicationContext;
import io.micronaut.runtime.Micronaut;
import io.micronaut.runtime.event.annotation.EventListener;
import io.micronaut.runtime.server.event.ServerStartupEvent;
import nativeimage.Reflection;
import nativeimage.Reflections;
import org.flywaydb.core.internal.logging.javautil.JavaUtilLogCreator;
import thymeleaf.ThymeleafUtils;
import java.lang.reflect.InvocationTargetException;
package com.mageddo;
public class Application {
public static void main(String[] args) {
setupProperties();
setupEnv();
Micronaut.run(Application.class);
}
static void setupEnv() {
final String osEnvs = System.getenv("MICRONAUT_ENVIRONMENTS");
final String javaEnvs = System.getProperty("micronaut.environments");
if (osEnvs == null && javaEnvs == null) {
System.setProperty("micronaut.environments", "pg");
}
}
static void setupProperties() {
commonsLoggingFix();
}
private static void commonsLoggingFix() {
System.setProperty("org.apache.commons.logging.Log", "org.apache.commons.logging.impl.NoOpLog");
System.setProperty("org.apache.commons.logging.diagnostics.dest", "STDOUT");
}
@EventListener
public void onStartup(ServerStartupEvent event)
throws NoSuchMethodException, InvocationTargetException, IllegalAccessException {
final ApplicationContext ctx = event.getSource()
.getApplicationContext();
ApplicationContextUtils.context(ctx); | MigrationUtils.migrate(ctx.getEnvironment()); |
mageddo/bookmark-notes | src/main/java/com/mageddo/bookmarks/apiserver/TagController.java | // Path: src/main/java/com/mageddo/bookmarks/service/TagService.java
// @Singleton
// public class TagService {
//
// private final TagDAO tagDAO;
//
// public TagService(TagDAO tagDAO) {
// this.tagDAO = tagDAO;
// }
//
// public List<TagV1Res> getTags() {
// return tagDAO.findTags();
// }
//
// public List<TagEntity> getTags(long bookmarkId) {
// return tagDAO.findTags(bookmarkId);
// }
//
// public List<TagEntity> findTags(String query) {
// return tagDAO.findTags(query);
// }
// }
| import com.mageddo.bookmarks.service.TagService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import io.micronaut.http.HttpResponse;
import io.micronaut.http.annotation.Controller;
import io.micronaut.http.annotation.Get;
import io.micronaut.http.annotation.QueryValue;
import static io.micronaut.core.util.CollectionUtils.mapOf;
import static io.micronaut.http.HttpResponse.ok;
import static io.micronaut.http.HttpResponse.serverError; | package com.mageddo.bookmarks.apiserver;
@Controller
public class TagController {
private final Logger logger = LoggerFactory.getLogger(getClass()); | // Path: src/main/java/com/mageddo/bookmarks/service/TagService.java
// @Singleton
// public class TagService {
//
// private final TagDAO tagDAO;
//
// public TagService(TagDAO tagDAO) {
// this.tagDAO = tagDAO;
// }
//
// public List<TagV1Res> getTags() {
// return tagDAO.findTags();
// }
//
// public List<TagEntity> getTags(long bookmarkId) {
// return tagDAO.findTags(bookmarkId);
// }
//
// public List<TagEntity> findTags(String query) {
// return tagDAO.findTags(query);
// }
// }
// Path: src/main/java/com/mageddo/bookmarks/apiserver/TagController.java
import com.mageddo.bookmarks.service.TagService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import io.micronaut.http.HttpResponse;
import io.micronaut.http.annotation.Controller;
import io.micronaut.http.annotation.Get;
import io.micronaut.http.annotation.QueryValue;
import static io.micronaut.core.util.CollectionUtils.mapOf;
import static io.micronaut.http.HttpResponse.ok;
import static io.micronaut.http.HttpResponse.serverError;
package com.mageddo.bookmarks.apiserver;
@Controller
public class TagController {
private final Logger logger = LoggerFactory.getLogger(getClass()); | private final TagService tagService; |
mageddo/bookmark-notes | src/test/java/com/mageddo/bookmarks/apiserver/SettingsControllerIntTest.java | // Path: src/test/java/com/mageddo/config/DatabaseConfigurator.java
// @Singleton
// public class DatabaseConfigurator {
//
// private static boolean migrated = false;
//
// private final Logger logger = LoggerFactory.getLogger(getClass());
// private final NamedParameterJdbcTemplate namedJdbcTemplate;
// private final PlatformTransactionManager platformTransactionManager;
// private final Environment environment;
//
// public DatabaseConfigurator(NamedParameterJdbcTemplate namedJdbcTemplate,
// PlatformTransactionManager platformTransactionManager, Environment environment) {
// this.namedJdbcTemplate = namedJdbcTemplate;
// this.platformTransactionManager = platformTransactionManager;
// this.environment = environment;
// }
//
// public void migrate() {
// if (!migrated) {
// final Flyway flyway = MigrationUtils.getFlyway(environment);
// flyway.clean();
// flyway.migrate();
// migrated = true;
// }
// new TransactionTemplate(platformTransactionManager).execute((st) -> {
// logger.info("status=schema-truncating");
// final StringBuilder sql = new StringBuilder().append("SELECT \n")
// .append(" CONCAT(TABLE_SCHEMA, '.', TABLE_NAME) \n")
// .append("FROM INFORMATION_SCHEMA.TABLES \n")
// .append("WHERE TABLE_SCHEMA = CURRENT_SCHEMA() \n")
// .append("AND TABLE_NAME NOT IN (:tables) \n")
// .append("ORDER BY TABLE_NAME \n");
// final List<String> tables = namedJdbcTemplate.query(sql.toString(), Maps.of("tables", skipTables()),
// (rs, i) -> rs.getString(1)
// );
// namedJdbcTemplate.update("SET CONSTRAINTS ALL DEFERRED", Maps.of());
// for (final String table : tables) {
// namedJdbcTemplate.update("DELETE FROM " + table, Maps.of());
// }
// namedJdbcTemplate.update("SET CONSTRAINTS ALL IMMEDIATE", Maps.of());
// logger.info("status=schema-truncated");
// try {
// namedJdbcTemplate.update(TestUtils.readAsString("/db/base-data.sql"), Maps.of());
// } catch (Exception e) {
// logger.error("status=cant-run-base-data", e);
// throw new RuntimeException(e);
// }
// logger.info("status=base-data-executed");
// return null;
// });
// }
//
// public Collection<String> skipTables() {
// return Arrays.asList("flyway_schema_history".toLowerCase(), "system_property".toLowerCase());
// }
//
// }
//
// Path: src/test/java/com/mageddo/config/TestUtils.java
// public static void setupRestAssured(EmbeddedServer server) {
// RestAssured.port = server.getPort();
// RestAssured.port = server.getPort();
// RestAssured.baseURI = String.format("%s://%s", server.getScheme(), server.getHost());
// }
| import java.io.IOException;
import javax.inject.Inject;
import com.mageddo.common.jackson.JsonUtils;
import com.mageddo.config.DatabaseConfigurator;
import com.mageddo.rawstringliterals.RawString;
import com.mageddo.rawstringliterals.Rsl;
import org.json.JSONException;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.skyscreamer.jsonassert.JSONCompareMode;
import org.skyscreamer.jsonassert.comparator.DefaultComparator;
import org.skyscreamer.jsonassert.comparator.JSONComparator;
import io.micronaut.http.MediaType;
import io.micronaut.runtime.server.EmbeddedServer;
import io.micronaut.test.annotation.MicronautTest;
import io.restassured.response.Response;
import static com.mageddo.config.TestUtils.setupRestAssured;
import static com.mageddo.rawstringliterals.RawStrings.lateInit;
import static io.micronaut.http.HttpStatus.NOT_FOUND;
import static io.micronaut.http.HttpStatus.OK;
import static io.restassured.RestAssured.get;
import static io.restassured.RestAssured.given;
import static org.hamcrest.text.IsEmptyString.emptyOrNullString;
import static org.skyscreamer.jsonassert.JSONAssert.assertEquals; | package com.mageddo.bookmarks.apiserver;
@Rsl
@MicronautTest(environments = "pg")
class SettingsControllerIntTest {
private static final JSONComparator comparator = new DefaultComparator(JSONCompareMode.LENIENT);
@Inject
private EmbeddedServer server;
@Inject | // Path: src/test/java/com/mageddo/config/DatabaseConfigurator.java
// @Singleton
// public class DatabaseConfigurator {
//
// private static boolean migrated = false;
//
// private final Logger logger = LoggerFactory.getLogger(getClass());
// private final NamedParameterJdbcTemplate namedJdbcTemplate;
// private final PlatformTransactionManager platformTransactionManager;
// private final Environment environment;
//
// public DatabaseConfigurator(NamedParameterJdbcTemplate namedJdbcTemplate,
// PlatformTransactionManager platformTransactionManager, Environment environment) {
// this.namedJdbcTemplate = namedJdbcTemplate;
// this.platformTransactionManager = platformTransactionManager;
// this.environment = environment;
// }
//
// public void migrate() {
// if (!migrated) {
// final Flyway flyway = MigrationUtils.getFlyway(environment);
// flyway.clean();
// flyway.migrate();
// migrated = true;
// }
// new TransactionTemplate(platformTransactionManager).execute((st) -> {
// logger.info("status=schema-truncating");
// final StringBuilder sql = new StringBuilder().append("SELECT \n")
// .append(" CONCAT(TABLE_SCHEMA, '.', TABLE_NAME) \n")
// .append("FROM INFORMATION_SCHEMA.TABLES \n")
// .append("WHERE TABLE_SCHEMA = CURRENT_SCHEMA() \n")
// .append("AND TABLE_NAME NOT IN (:tables) \n")
// .append("ORDER BY TABLE_NAME \n");
// final List<String> tables = namedJdbcTemplate.query(sql.toString(), Maps.of("tables", skipTables()),
// (rs, i) -> rs.getString(1)
// );
// namedJdbcTemplate.update("SET CONSTRAINTS ALL DEFERRED", Maps.of());
// for (final String table : tables) {
// namedJdbcTemplate.update("DELETE FROM " + table, Maps.of());
// }
// namedJdbcTemplate.update("SET CONSTRAINTS ALL IMMEDIATE", Maps.of());
// logger.info("status=schema-truncated");
// try {
// namedJdbcTemplate.update(TestUtils.readAsString("/db/base-data.sql"), Maps.of());
// } catch (Exception e) {
// logger.error("status=cant-run-base-data", e);
// throw new RuntimeException(e);
// }
// logger.info("status=base-data-executed");
// return null;
// });
// }
//
// public Collection<String> skipTables() {
// return Arrays.asList("flyway_schema_history".toLowerCase(), "system_property".toLowerCase());
// }
//
// }
//
// Path: src/test/java/com/mageddo/config/TestUtils.java
// public static void setupRestAssured(EmbeddedServer server) {
// RestAssured.port = server.getPort();
// RestAssured.port = server.getPort();
// RestAssured.baseURI = String.format("%s://%s", server.getScheme(), server.getHost());
// }
// Path: src/test/java/com/mageddo/bookmarks/apiserver/SettingsControllerIntTest.java
import java.io.IOException;
import javax.inject.Inject;
import com.mageddo.common.jackson.JsonUtils;
import com.mageddo.config.DatabaseConfigurator;
import com.mageddo.rawstringliterals.RawString;
import com.mageddo.rawstringliterals.Rsl;
import org.json.JSONException;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.skyscreamer.jsonassert.JSONCompareMode;
import org.skyscreamer.jsonassert.comparator.DefaultComparator;
import org.skyscreamer.jsonassert.comparator.JSONComparator;
import io.micronaut.http.MediaType;
import io.micronaut.runtime.server.EmbeddedServer;
import io.micronaut.test.annotation.MicronautTest;
import io.restassured.response.Response;
import static com.mageddo.config.TestUtils.setupRestAssured;
import static com.mageddo.rawstringliterals.RawStrings.lateInit;
import static io.micronaut.http.HttpStatus.NOT_FOUND;
import static io.micronaut.http.HttpStatus.OK;
import static io.restassured.RestAssured.get;
import static io.restassured.RestAssured.given;
import static org.hamcrest.text.IsEmptyString.emptyOrNullString;
import static org.skyscreamer.jsonassert.JSONAssert.assertEquals;
package com.mageddo.bookmarks.apiserver;
@Rsl
@MicronautTest(environments = "pg")
class SettingsControllerIntTest {
private static final JSONComparator comparator = new DefaultComparator(JSONCompareMode.LENIENT);
@Inject
private EmbeddedServer server;
@Inject | private DatabaseConfigurator databaseConfigurator; |
mageddo/bookmark-notes | src/test/java/com/mageddo/bookmarks/apiserver/SettingsControllerIntTest.java | // Path: src/test/java/com/mageddo/config/DatabaseConfigurator.java
// @Singleton
// public class DatabaseConfigurator {
//
// private static boolean migrated = false;
//
// private final Logger logger = LoggerFactory.getLogger(getClass());
// private final NamedParameterJdbcTemplate namedJdbcTemplate;
// private final PlatformTransactionManager platformTransactionManager;
// private final Environment environment;
//
// public DatabaseConfigurator(NamedParameterJdbcTemplate namedJdbcTemplate,
// PlatformTransactionManager platformTransactionManager, Environment environment) {
// this.namedJdbcTemplate = namedJdbcTemplate;
// this.platformTransactionManager = platformTransactionManager;
// this.environment = environment;
// }
//
// public void migrate() {
// if (!migrated) {
// final Flyway flyway = MigrationUtils.getFlyway(environment);
// flyway.clean();
// flyway.migrate();
// migrated = true;
// }
// new TransactionTemplate(platformTransactionManager).execute((st) -> {
// logger.info("status=schema-truncating");
// final StringBuilder sql = new StringBuilder().append("SELECT \n")
// .append(" CONCAT(TABLE_SCHEMA, '.', TABLE_NAME) \n")
// .append("FROM INFORMATION_SCHEMA.TABLES \n")
// .append("WHERE TABLE_SCHEMA = CURRENT_SCHEMA() \n")
// .append("AND TABLE_NAME NOT IN (:tables) \n")
// .append("ORDER BY TABLE_NAME \n");
// final List<String> tables = namedJdbcTemplate.query(sql.toString(), Maps.of("tables", skipTables()),
// (rs, i) -> rs.getString(1)
// );
// namedJdbcTemplate.update("SET CONSTRAINTS ALL DEFERRED", Maps.of());
// for (final String table : tables) {
// namedJdbcTemplate.update("DELETE FROM " + table, Maps.of());
// }
// namedJdbcTemplate.update("SET CONSTRAINTS ALL IMMEDIATE", Maps.of());
// logger.info("status=schema-truncated");
// try {
// namedJdbcTemplate.update(TestUtils.readAsString("/db/base-data.sql"), Maps.of());
// } catch (Exception e) {
// logger.error("status=cant-run-base-data", e);
// throw new RuntimeException(e);
// }
// logger.info("status=base-data-executed");
// return null;
// });
// }
//
// public Collection<String> skipTables() {
// return Arrays.asList("flyway_schema_history".toLowerCase(), "system_property".toLowerCase());
// }
//
// }
//
// Path: src/test/java/com/mageddo/config/TestUtils.java
// public static void setupRestAssured(EmbeddedServer server) {
// RestAssured.port = server.getPort();
// RestAssured.port = server.getPort();
// RestAssured.baseURI = String.format("%s://%s", server.getScheme(), server.getHost());
// }
| import java.io.IOException;
import javax.inject.Inject;
import com.mageddo.common.jackson.JsonUtils;
import com.mageddo.config.DatabaseConfigurator;
import com.mageddo.rawstringliterals.RawString;
import com.mageddo.rawstringliterals.Rsl;
import org.json.JSONException;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.skyscreamer.jsonassert.JSONCompareMode;
import org.skyscreamer.jsonassert.comparator.DefaultComparator;
import org.skyscreamer.jsonassert.comparator.JSONComparator;
import io.micronaut.http.MediaType;
import io.micronaut.runtime.server.EmbeddedServer;
import io.micronaut.test.annotation.MicronautTest;
import io.restassured.response.Response;
import static com.mageddo.config.TestUtils.setupRestAssured;
import static com.mageddo.rawstringliterals.RawStrings.lateInit;
import static io.micronaut.http.HttpStatus.NOT_FOUND;
import static io.micronaut.http.HttpStatus.OK;
import static io.restassured.RestAssured.get;
import static io.restassured.RestAssured.given;
import static org.hamcrest.text.IsEmptyString.emptyOrNullString;
import static org.skyscreamer.jsonassert.JSONAssert.assertEquals; | package com.mageddo.bookmarks.apiserver;
@Rsl
@MicronautTest(environments = "pg")
class SettingsControllerIntTest {
private static final JSONComparator comparator = new DefaultComparator(JSONCompareMode.LENIENT);
@Inject
private EmbeddedServer server;
@Inject
private DatabaseConfigurator databaseConfigurator;
@BeforeEach
void before() { | // Path: src/test/java/com/mageddo/config/DatabaseConfigurator.java
// @Singleton
// public class DatabaseConfigurator {
//
// private static boolean migrated = false;
//
// private final Logger logger = LoggerFactory.getLogger(getClass());
// private final NamedParameterJdbcTemplate namedJdbcTemplate;
// private final PlatformTransactionManager platformTransactionManager;
// private final Environment environment;
//
// public DatabaseConfigurator(NamedParameterJdbcTemplate namedJdbcTemplate,
// PlatformTransactionManager platformTransactionManager, Environment environment) {
// this.namedJdbcTemplate = namedJdbcTemplate;
// this.platformTransactionManager = platformTransactionManager;
// this.environment = environment;
// }
//
// public void migrate() {
// if (!migrated) {
// final Flyway flyway = MigrationUtils.getFlyway(environment);
// flyway.clean();
// flyway.migrate();
// migrated = true;
// }
// new TransactionTemplate(platformTransactionManager).execute((st) -> {
// logger.info("status=schema-truncating");
// final StringBuilder sql = new StringBuilder().append("SELECT \n")
// .append(" CONCAT(TABLE_SCHEMA, '.', TABLE_NAME) \n")
// .append("FROM INFORMATION_SCHEMA.TABLES \n")
// .append("WHERE TABLE_SCHEMA = CURRENT_SCHEMA() \n")
// .append("AND TABLE_NAME NOT IN (:tables) \n")
// .append("ORDER BY TABLE_NAME \n");
// final List<String> tables = namedJdbcTemplate.query(sql.toString(), Maps.of("tables", skipTables()),
// (rs, i) -> rs.getString(1)
// );
// namedJdbcTemplate.update("SET CONSTRAINTS ALL DEFERRED", Maps.of());
// for (final String table : tables) {
// namedJdbcTemplate.update("DELETE FROM " + table, Maps.of());
// }
// namedJdbcTemplate.update("SET CONSTRAINTS ALL IMMEDIATE", Maps.of());
// logger.info("status=schema-truncated");
// try {
// namedJdbcTemplate.update(TestUtils.readAsString("/db/base-data.sql"), Maps.of());
// } catch (Exception e) {
// logger.error("status=cant-run-base-data", e);
// throw new RuntimeException(e);
// }
// logger.info("status=base-data-executed");
// return null;
// });
// }
//
// public Collection<String> skipTables() {
// return Arrays.asList("flyway_schema_history".toLowerCase(), "system_property".toLowerCase());
// }
//
// }
//
// Path: src/test/java/com/mageddo/config/TestUtils.java
// public static void setupRestAssured(EmbeddedServer server) {
// RestAssured.port = server.getPort();
// RestAssured.port = server.getPort();
// RestAssured.baseURI = String.format("%s://%s", server.getScheme(), server.getHost());
// }
// Path: src/test/java/com/mageddo/bookmarks/apiserver/SettingsControllerIntTest.java
import java.io.IOException;
import javax.inject.Inject;
import com.mageddo.common.jackson.JsonUtils;
import com.mageddo.config.DatabaseConfigurator;
import com.mageddo.rawstringliterals.RawString;
import com.mageddo.rawstringliterals.Rsl;
import org.json.JSONException;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.skyscreamer.jsonassert.JSONCompareMode;
import org.skyscreamer.jsonassert.comparator.DefaultComparator;
import org.skyscreamer.jsonassert.comparator.JSONComparator;
import io.micronaut.http.MediaType;
import io.micronaut.runtime.server.EmbeddedServer;
import io.micronaut.test.annotation.MicronautTest;
import io.restassured.response.Response;
import static com.mageddo.config.TestUtils.setupRestAssured;
import static com.mageddo.rawstringliterals.RawStrings.lateInit;
import static io.micronaut.http.HttpStatus.NOT_FOUND;
import static io.micronaut.http.HttpStatus.OK;
import static io.restassured.RestAssured.get;
import static io.restassured.RestAssured.given;
import static org.hamcrest.text.IsEmptyString.emptyOrNullString;
import static org.skyscreamer.jsonassert.JSONAssert.assertEquals;
package com.mageddo.bookmarks.apiserver;
@Rsl
@MicronautTest(environments = "pg")
class SettingsControllerIntTest {
private static final JSONComparator comparator = new DefaultComparator(JSONCompareMode.LENIENT);
@Inject
private EmbeddedServer server;
@Inject
private DatabaseConfigurator databaseConfigurator;
@BeforeEach
void before() { | setupRestAssured(server); |
mageddo/bookmark-notes | src/main/java/com/mageddo/bookmarks/apiserver/SettingsController.java | // Path: src/main/java/com/mageddo/bookmarks/entity/SettingEntity.java
// public class SettingEntity {
//
// private String key;
// private String value;
//
// @JsonIgnore
// private LocalDateTime update;
//
// public static RowMapper<SettingEntity> mapper() {
// return (rs, rowNum) -> {
// return new SettingEntity().setUpdate(JdbcHelper.getLocalDateTime(rs, "DAT_UPDATE"))
// .setValue(rs.getString("DES_VALUE"))
// .setKey(rs.getString("NAM_PROPERTY"));
// };
// }
//
// public String getValue() {
// return value;
// }
//
// public SettingEntity setValue(String value) {
// this.value = value;
// return this;
// }
//
// public String getKey() {
// return key;
// }
//
// public SettingEntity setKey(String key) {
// this.key = key;
// return this;
// }
//
// public LocalDateTime getUpdate() {
// return update;
// }
//
// public SettingEntity setUpdate(LocalDateTime update) {
// this.update = update;
// return this;
// }
//
// public enum Setting {
//
// CODE_BLOCK_MAX_HEIGHT, //
// MOBILE_CODE_BLOCK_MAX_HEIGHT, //
// CODE_STYLE_TAB_SIZE, //
// CODE_STYLE_TAB_STYLE, //
// CODE_STYLE_SHOW_WHITESPACES, //
//
// /**
// * HTML which should be put inside the <head> tag
// */
// PUBLIC_PAGES_HEADER_HTML, //
// ;
// }
// }
//
// Path: src/main/java/com/mageddo/bookmarks/exception/NotFoundException.java
// public class NotFoundException extends RuntimeException {
// public NotFoundException(String message) {
// super(message);
// }
// }
//
// Path: src/main/java/com/mageddo/bookmarks/service/SettingsService.java
// @Singleton
// public class SettingsService {
//
// private final SettingsDAO settingsDAO;
//
// public SettingsService(SettingsDAO settingsDAO) {
// this.settingsDAO = settingsDAO;
// }
//
// public Map<String, String> findAllAsMap() {
// final List<SettingEntity> settings = settingsDAO.findAll();
// final Map<String, String> settingsMap = new LinkedHashMap<>();
// for (SettingEntity setting : settings) {
// settingsMap.put(setting.getKey(), setting.getValue());
// }
// return settingsMap;
// }
//
// public List<SettingEntity> findAll() {
// return settingsDAO.findAll();
// }
//
// public SettingEntity findSetting(String key) {
// return settingsDAO.find(key);
// }
//
// public boolean patch(SettingEntity settingEntity) {
// final SettingEntity dbSettingEntity = settingsDAO.find(settingEntity.getKey());
// if (dbSettingEntity == null) {
// throw new NotFoundException(String.format("parameter doesn't exists %s", settingEntity.getKey()));
// }
// dbSettingEntity.setValue(settingEntity.getValue());
// dbSettingEntity.setUpdate(LocalDateTime.now());
// settingsDAO.patch(dbSettingEntity);
// return true;
// }
//
// public void patch(List<SettingEntity> settings) {
// for (SettingEntity setting : settings) {
// this.patch(setting);
// }
// }
// }
| import com.mageddo.bookmarks.entity.SettingEntity;
import com.mageddo.bookmarks.exception.NotFoundException;
import com.mageddo.bookmarks.service.SettingsService;
import io.micronaut.http.HttpResponse;
import io.micronaut.http.MediaType;
import io.micronaut.http.annotation.Body;
import io.micronaut.http.annotation.Controller;
import io.micronaut.http.annotation.Get;
import io.micronaut.http.annotation.Patch;
import io.micronaut.http.annotation.QueryValue;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.unbescape.html.HtmlEscape;
import java.util.List;
import java.util.stream.Collectors;
import static io.micronaut.http.HttpResponse.badRequest;
import static io.micronaut.http.HttpResponse.notFound;
import static io.micronaut.http.HttpResponse.ok; | package com.mageddo.bookmarks.apiserver;
@Controller
public class SettingsController {
| // Path: src/main/java/com/mageddo/bookmarks/entity/SettingEntity.java
// public class SettingEntity {
//
// private String key;
// private String value;
//
// @JsonIgnore
// private LocalDateTime update;
//
// public static RowMapper<SettingEntity> mapper() {
// return (rs, rowNum) -> {
// return new SettingEntity().setUpdate(JdbcHelper.getLocalDateTime(rs, "DAT_UPDATE"))
// .setValue(rs.getString("DES_VALUE"))
// .setKey(rs.getString("NAM_PROPERTY"));
// };
// }
//
// public String getValue() {
// return value;
// }
//
// public SettingEntity setValue(String value) {
// this.value = value;
// return this;
// }
//
// public String getKey() {
// return key;
// }
//
// public SettingEntity setKey(String key) {
// this.key = key;
// return this;
// }
//
// public LocalDateTime getUpdate() {
// return update;
// }
//
// public SettingEntity setUpdate(LocalDateTime update) {
// this.update = update;
// return this;
// }
//
// public enum Setting {
//
// CODE_BLOCK_MAX_HEIGHT, //
// MOBILE_CODE_BLOCK_MAX_HEIGHT, //
// CODE_STYLE_TAB_SIZE, //
// CODE_STYLE_TAB_STYLE, //
// CODE_STYLE_SHOW_WHITESPACES, //
//
// /**
// * HTML which should be put inside the <head> tag
// */
// PUBLIC_PAGES_HEADER_HTML, //
// ;
// }
// }
//
// Path: src/main/java/com/mageddo/bookmarks/exception/NotFoundException.java
// public class NotFoundException extends RuntimeException {
// public NotFoundException(String message) {
// super(message);
// }
// }
//
// Path: src/main/java/com/mageddo/bookmarks/service/SettingsService.java
// @Singleton
// public class SettingsService {
//
// private final SettingsDAO settingsDAO;
//
// public SettingsService(SettingsDAO settingsDAO) {
// this.settingsDAO = settingsDAO;
// }
//
// public Map<String, String> findAllAsMap() {
// final List<SettingEntity> settings = settingsDAO.findAll();
// final Map<String, String> settingsMap = new LinkedHashMap<>();
// for (SettingEntity setting : settings) {
// settingsMap.put(setting.getKey(), setting.getValue());
// }
// return settingsMap;
// }
//
// public List<SettingEntity> findAll() {
// return settingsDAO.findAll();
// }
//
// public SettingEntity findSetting(String key) {
// return settingsDAO.find(key);
// }
//
// public boolean patch(SettingEntity settingEntity) {
// final SettingEntity dbSettingEntity = settingsDAO.find(settingEntity.getKey());
// if (dbSettingEntity == null) {
// throw new NotFoundException(String.format("parameter doesn't exists %s", settingEntity.getKey()));
// }
// dbSettingEntity.setValue(settingEntity.getValue());
// dbSettingEntity.setUpdate(LocalDateTime.now());
// settingsDAO.patch(dbSettingEntity);
// return true;
// }
//
// public void patch(List<SettingEntity> settings) {
// for (SettingEntity setting : settings) {
// this.patch(setting);
// }
// }
// }
// Path: src/main/java/com/mageddo/bookmarks/apiserver/SettingsController.java
import com.mageddo.bookmarks.entity.SettingEntity;
import com.mageddo.bookmarks.exception.NotFoundException;
import com.mageddo.bookmarks.service.SettingsService;
import io.micronaut.http.HttpResponse;
import io.micronaut.http.MediaType;
import io.micronaut.http.annotation.Body;
import io.micronaut.http.annotation.Controller;
import io.micronaut.http.annotation.Get;
import io.micronaut.http.annotation.Patch;
import io.micronaut.http.annotation.QueryValue;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.unbescape.html.HtmlEscape;
import java.util.List;
import java.util.stream.Collectors;
import static io.micronaut.http.HttpResponse.badRequest;
import static io.micronaut.http.HttpResponse.notFound;
import static io.micronaut.http.HttpResponse.ok;
package com.mageddo.bookmarks.apiserver;
@Controller
public class SettingsController {
| private final SettingsService settingsService; |
mageddo/bookmark-notes | src/main/java/com/mageddo/bookmarks/apiserver/SettingsController.java | // Path: src/main/java/com/mageddo/bookmarks/entity/SettingEntity.java
// public class SettingEntity {
//
// private String key;
// private String value;
//
// @JsonIgnore
// private LocalDateTime update;
//
// public static RowMapper<SettingEntity> mapper() {
// return (rs, rowNum) -> {
// return new SettingEntity().setUpdate(JdbcHelper.getLocalDateTime(rs, "DAT_UPDATE"))
// .setValue(rs.getString("DES_VALUE"))
// .setKey(rs.getString("NAM_PROPERTY"));
// };
// }
//
// public String getValue() {
// return value;
// }
//
// public SettingEntity setValue(String value) {
// this.value = value;
// return this;
// }
//
// public String getKey() {
// return key;
// }
//
// public SettingEntity setKey(String key) {
// this.key = key;
// return this;
// }
//
// public LocalDateTime getUpdate() {
// return update;
// }
//
// public SettingEntity setUpdate(LocalDateTime update) {
// this.update = update;
// return this;
// }
//
// public enum Setting {
//
// CODE_BLOCK_MAX_HEIGHT, //
// MOBILE_CODE_BLOCK_MAX_HEIGHT, //
// CODE_STYLE_TAB_SIZE, //
// CODE_STYLE_TAB_STYLE, //
// CODE_STYLE_SHOW_WHITESPACES, //
//
// /**
// * HTML which should be put inside the <head> tag
// */
// PUBLIC_PAGES_HEADER_HTML, //
// ;
// }
// }
//
// Path: src/main/java/com/mageddo/bookmarks/exception/NotFoundException.java
// public class NotFoundException extends RuntimeException {
// public NotFoundException(String message) {
// super(message);
// }
// }
//
// Path: src/main/java/com/mageddo/bookmarks/service/SettingsService.java
// @Singleton
// public class SettingsService {
//
// private final SettingsDAO settingsDAO;
//
// public SettingsService(SettingsDAO settingsDAO) {
// this.settingsDAO = settingsDAO;
// }
//
// public Map<String, String> findAllAsMap() {
// final List<SettingEntity> settings = settingsDAO.findAll();
// final Map<String, String> settingsMap = new LinkedHashMap<>();
// for (SettingEntity setting : settings) {
// settingsMap.put(setting.getKey(), setting.getValue());
// }
// return settingsMap;
// }
//
// public List<SettingEntity> findAll() {
// return settingsDAO.findAll();
// }
//
// public SettingEntity findSetting(String key) {
// return settingsDAO.find(key);
// }
//
// public boolean patch(SettingEntity settingEntity) {
// final SettingEntity dbSettingEntity = settingsDAO.find(settingEntity.getKey());
// if (dbSettingEntity == null) {
// throw new NotFoundException(String.format("parameter doesn't exists %s", settingEntity.getKey()));
// }
// dbSettingEntity.setValue(settingEntity.getValue());
// dbSettingEntity.setUpdate(LocalDateTime.now());
// settingsDAO.patch(dbSettingEntity);
// return true;
// }
//
// public void patch(List<SettingEntity> settings) {
// for (SettingEntity setting : settings) {
// this.patch(setting);
// }
// }
// }
| import com.mageddo.bookmarks.entity.SettingEntity;
import com.mageddo.bookmarks.exception.NotFoundException;
import com.mageddo.bookmarks.service.SettingsService;
import io.micronaut.http.HttpResponse;
import io.micronaut.http.MediaType;
import io.micronaut.http.annotation.Body;
import io.micronaut.http.annotation.Controller;
import io.micronaut.http.annotation.Get;
import io.micronaut.http.annotation.Patch;
import io.micronaut.http.annotation.QueryValue;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.unbescape.html.HtmlEscape;
import java.util.List;
import java.util.stream.Collectors;
import static io.micronaut.http.HttpResponse.badRequest;
import static io.micronaut.http.HttpResponse.notFound;
import static io.micronaut.http.HttpResponse.ok; | try {
return ok(settingsService.findAllAsMap());
} catch (Exception e) {
logger.error("status=cant-load-settings, msg={}", e.getMessage(), e);
return badRequest("Could not read settings");
}
}
@Get("/api/v{version:[12]}.0/settings")
public HttpResponse _2(String version) {
try {
return ok(settingsService.findAll());
} catch (Exception e) {
logger.error("status=cant-load-settings, msg={}", e.getMessage(), e);
return badRequest("Could not read settings");
}
}
@Get("/api/v{version:[12]}.0/settings?key")
public HttpResponse _3(String version, @QueryValue("key") String key) {
try {
return ok(settingsService.findSetting(key));
} catch (Exception e) {
logger.error("status=cant-load-settings, msg={}", e.getMessage(), e);
return badRequest("Could not read settings");
}
}
@Patch(value = "/api/v{version:[12]}.0/settings", consumes = MediaType.APPLICATION_JSON,
produces = MediaType.APPLICATION_JSON) | // Path: src/main/java/com/mageddo/bookmarks/entity/SettingEntity.java
// public class SettingEntity {
//
// private String key;
// private String value;
//
// @JsonIgnore
// private LocalDateTime update;
//
// public static RowMapper<SettingEntity> mapper() {
// return (rs, rowNum) -> {
// return new SettingEntity().setUpdate(JdbcHelper.getLocalDateTime(rs, "DAT_UPDATE"))
// .setValue(rs.getString("DES_VALUE"))
// .setKey(rs.getString("NAM_PROPERTY"));
// };
// }
//
// public String getValue() {
// return value;
// }
//
// public SettingEntity setValue(String value) {
// this.value = value;
// return this;
// }
//
// public String getKey() {
// return key;
// }
//
// public SettingEntity setKey(String key) {
// this.key = key;
// return this;
// }
//
// public LocalDateTime getUpdate() {
// return update;
// }
//
// public SettingEntity setUpdate(LocalDateTime update) {
// this.update = update;
// return this;
// }
//
// public enum Setting {
//
// CODE_BLOCK_MAX_HEIGHT, //
// MOBILE_CODE_BLOCK_MAX_HEIGHT, //
// CODE_STYLE_TAB_SIZE, //
// CODE_STYLE_TAB_STYLE, //
// CODE_STYLE_SHOW_WHITESPACES, //
//
// /**
// * HTML which should be put inside the <head> tag
// */
// PUBLIC_PAGES_HEADER_HTML, //
// ;
// }
// }
//
// Path: src/main/java/com/mageddo/bookmarks/exception/NotFoundException.java
// public class NotFoundException extends RuntimeException {
// public NotFoundException(String message) {
// super(message);
// }
// }
//
// Path: src/main/java/com/mageddo/bookmarks/service/SettingsService.java
// @Singleton
// public class SettingsService {
//
// private final SettingsDAO settingsDAO;
//
// public SettingsService(SettingsDAO settingsDAO) {
// this.settingsDAO = settingsDAO;
// }
//
// public Map<String, String> findAllAsMap() {
// final List<SettingEntity> settings = settingsDAO.findAll();
// final Map<String, String> settingsMap = new LinkedHashMap<>();
// for (SettingEntity setting : settings) {
// settingsMap.put(setting.getKey(), setting.getValue());
// }
// return settingsMap;
// }
//
// public List<SettingEntity> findAll() {
// return settingsDAO.findAll();
// }
//
// public SettingEntity findSetting(String key) {
// return settingsDAO.find(key);
// }
//
// public boolean patch(SettingEntity settingEntity) {
// final SettingEntity dbSettingEntity = settingsDAO.find(settingEntity.getKey());
// if (dbSettingEntity == null) {
// throw new NotFoundException(String.format("parameter doesn't exists %s", settingEntity.getKey()));
// }
// dbSettingEntity.setValue(settingEntity.getValue());
// dbSettingEntity.setUpdate(LocalDateTime.now());
// settingsDAO.patch(dbSettingEntity);
// return true;
// }
//
// public void patch(List<SettingEntity> settings) {
// for (SettingEntity setting : settings) {
// this.patch(setting);
// }
// }
// }
// Path: src/main/java/com/mageddo/bookmarks/apiserver/SettingsController.java
import com.mageddo.bookmarks.entity.SettingEntity;
import com.mageddo.bookmarks.exception.NotFoundException;
import com.mageddo.bookmarks.service.SettingsService;
import io.micronaut.http.HttpResponse;
import io.micronaut.http.MediaType;
import io.micronaut.http.annotation.Body;
import io.micronaut.http.annotation.Controller;
import io.micronaut.http.annotation.Get;
import io.micronaut.http.annotation.Patch;
import io.micronaut.http.annotation.QueryValue;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.unbescape.html.HtmlEscape;
import java.util.List;
import java.util.stream.Collectors;
import static io.micronaut.http.HttpResponse.badRequest;
import static io.micronaut.http.HttpResponse.notFound;
import static io.micronaut.http.HttpResponse.ok;
try {
return ok(settingsService.findAllAsMap());
} catch (Exception e) {
logger.error("status=cant-load-settings, msg={}", e.getMessage(), e);
return badRequest("Could not read settings");
}
}
@Get("/api/v{version:[12]}.0/settings")
public HttpResponse _2(String version) {
try {
return ok(settingsService.findAll());
} catch (Exception e) {
logger.error("status=cant-load-settings, msg={}", e.getMessage(), e);
return badRequest("Could not read settings");
}
}
@Get("/api/v{version:[12]}.0/settings?key")
public HttpResponse _3(String version, @QueryValue("key") String key) {
try {
return ok(settingsService.findSetting(key));
} catch (Exception e) {
logger.error("status=cant-load-settings, msg={}", e.getMessage(), e);
return badRequest("Could not read settings");
}
}
@Patch(value = "/api/v{version:[12]}.0/settings", consumes = MediaType.APPLICATION_JSON,
produces = MediaType.APPLICATION_JSON) | public HttpResponse _4(String version, @Body List<SettingEntity> settings) { |
mageddo/bookmark-notes | src/main/java/com/mageddo/bookmarks/apiserver/SettingsController.java | // Path: src/main/java/com/mageddo/bookmarks/entity/SettingEntity.java
// public class SettingEntity {
//
// private String key;
// private String value;
//
// @JsonIgnore
// private LocalDateTime update;
//
// public static RowMapper<SettingEntity> mapper() {
// return (rs, rowNum) -> {
// return new SettingEntity().setUpdate(JdbcHelper.getLocalDateTime(rs, "DAT_UPDATE"))
// .setValue(rs.getString("DES_VALUE"))
// .setKey(rs.getString("NAM_PROPERTY"));
// };
// }
//
// public String getValue() {
// return value;
// }
//
// public SettingEntity setValue(String value) {
// this.value = value;
// return this;
// }
//
// public String getKey() {
// return key;
// }
//
// public SettingEntity setKey(String key) {
// this.key = key;
// return this;
// }
//
// public LocalDateTime getUpdate() {
// return update;
// }
//
// public SettingEntity setUpdate(LocalDateTime update) {
// this.update = update;
// return this;
// }
//
// public enum Setting {
//
// CODE_BLOCK_MAX_HEIGHT, //
// MOBILE_CODE_BLOCK_MAX_HEIGHT, //
// CODE_STYLE_TAB_SIZE, //
// CODE_STYLE_TAB_STYLE, //
// CODE_STYLE_SHOW_WHITESPACES, //
//
// /**
// * HTML which should be put inside the <head> tag
// */
// PUBLIC_PAGES_HEADER_HTML, //
// ;
// }
// }
//
// Path: src/main/java/com/mageddo/bookmarks/exception/NotFoundException.java
// public class NotFoundException extends RuntimeException {
// public NotFoundException(String message) {
// super(message);
// }
// }
//
// Path: src/main/java/com/mageddo/bookmarks/service/SettingsService.java
// @Singleton
// public class SettingsService {
//
// private final SettingsDAO settingsDAO;
//
// public SettingsService(SettingsDAO settingsDAO) {
// this.settingsDAO = settingsDAO;
// }
//
// public Map<String, String> findAllAsMap() {
// final List<SettingEntity> settings = settingsDAO.findAll();
// final Map<String, String> settingsMap = new LinkedHashMap<>();
// for (SettingEntity setting : settings) {
// settingsMap.put(setting.getKey(), setting.getValue());
// }
// return settingsMap;
// }
//
// public List<SettingEntity> findAll() {
// return settingsDAO.findAll();
// }
//
// public SettingEntity findSetting(String key) {
// return settingsDAO.find(key);
// }
//
// public boolean patch(SettingEntity settingEntity) {
// final SettingEntity dbSettingEntity = settingsDAO.find(settingEntity.getKey());
// if (dbSettingEntity == null) {
// throw new NotFoundException(String.format("parameter doesn't exists %s", settingEntity.getKey()));
// }
// dbSettingEntity.setValue(settingEntity.getValue());
// dbSettingEntity.setUpdate(LocalDateTime.now());
// settingsDAO.patch(dbSettingEntity);
// return true;
// }
//
// public void patch(List<SettingEntity> settings) {
// for (SettingEntity setting : settings) {
// this.patch(setting);
// }
// }
// }
| import com.mageddo.bookmarks.entity.SettingEntity;
import com.mageddo.bookmarks.exception.NotFoundException;
import com.mageddo.bookmarks.service.SettingsService;
import io.micronaut.http.HttpResponse;
import io.micronaut.http.MediaType;
import io.micronaut.http.annotation.Body;
import io.micronaut.http.annotation.Controller;
import io.micronaut.http.annotation.Get;
import io.micronaut.http.annotation.Patch;
import io.micronaut.http.annotation.QueryValue;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.unbescape.html.HtmlEscape;
import java.util.List;
import java.util.stream.Collectors;
import static io.micronaut.http.HttpResponse.badRequest;
import static io.micronaut.http.HttpResponse.notFound;
import static io.micronaut.http.HttpResponse.ok; | public HttpResponse _2(String version) {
try {
return ok(settingsService.findAll());
} catch (Exception e) {
logger.error("status=cant-load-settings, msg={}", e.getMessage(), e);
return badRequest("Could not read settings");
}
}
@Get("/api/v{version:[12]}.0/settings?key")
public HttpResponse _3(String version, @QueryValue("key") String key) {
try {
return ok(settingsService.findSetting(key));
} catch (Exception e) {
logger.error("status=cant-load-settings, msg={}", e.getMessage(), e);
return badRequest("Could not read settings");
}
}
@Patch(value = "/api/v{version:[12]}.0/settings", consumes = MediaType.APPLICATION_JSON,
produces = MediaType.APPLICATION_JSON)
public HttpResponse _4(String version, @Body List<SettingEntity> settings) {
try {
settingsService.patch(
settings
.stream()
.map(it -> it.setValue(HtmlEscape.escapeHtml4(it.getValue())))
.collect(Collectors.toList())
);
return ok(); | // Path: src/main/java/com/mageddo/bookmarks/entity/SettingEntity.java
// public class SettingEntity {
//
// private String key;
// private String value;
//
// @JsonIgnore
// private LocalDateTime update;
//
// public static RowMapper<SettingEntity> mapper() {
// return (rs, rowNum) -> {
// return new SettingEntity().setUpdate(JdbcHelper.getLocalDateTime(rs, "DAT_UPDATE"))
// .setValue(rs.getString("DES_VALUE"))
// .setKey(rs.getString("NAM_PROPERTY"));
// };
// }
//
// public String getValue() {
// return value;
// }
//
// public SettingEntity setValue(String value) {
// this.value = value;
// return this;
// }
//
// public String getKey() {
// return key;
// }
//
// public SettingEntity setKey(String key) {
// this.key = key;
// return this;
// }
//
// public LocalDateTime getUpdate() {
// return update;
// }
//
// public SettingEntity setUpdate(LocalDateTime update) {
// this.update = update;
// return this;
// }
//
// public enum Setting {
//
// CODE_BLOCK_MAX_HEIGHT, //
// MOBILE_CODE_BLOCK_MAX_HEIGHT, //
// CODE_STYLE_TAB_SIZE, //
// CODE_STYLE_TAB_STYLE, //
// CODE_STYLE_SHOW_WHITESPACES, //
//
// /**
// * HTML which should be put inside the <head> tag
// */
// PUBLIC_PAGES_HEADER_HTML, //
// ;
// }
// }
//
// Path: src/main/java/com/mageddo/bookmarks/exception/NotFoundException.java
// public class NotFoundException extends RuntimeException {
// public NotFoundException(String message) {
// super(message);
// }
// }
//
// Path: src/main/java/com/mageddo/bookmarks/service/SettingsService.java
// @Singleton
// public class SettingsService {
//
// private final SettingsDAO settingsDAO;
//
// public SettingsService(SettingsDAO settingsDAO) {
// this.settingsDAO = settingsDAO;
// }
//
// public Map<String, String> findAllAsMap() {
// final List<SettingEntity> settings = settingsDAO.findAll();
// final Map<String, String> settingsMap = new LinkedHashMap<>();
// for (SettingEntity setting : settings) {
// settingsMap.put(setting.getKey(), setting.getValue());
// }
// return settingsMap;
// }
//
// public List<SettingEntity> findAll() {
// return settingsDAO.findAll();
// }
//
// public SettingEntity findSetting(String key) {
// return settingsDAO.find(key);
// }
//
// public boolean patch(SettingEntity settingEntity) {
// final SettingEntity dbSettingEntity = settingsDAO.find(settingEntity.getKey());
// if (dbSettingEntity == null) {
// throw new NotFoundException(String.format("parameter doesn't exists %s", settingEntity.getKey()));
// }
// dbSettingEntity.setValue(settingEntity.getValue());
// dbSettingEntity.setUpdate(LocalDateTime.now());
// settingsDAO.patch(dbSettingEntity);
// return true;
// }
//
// public void patch(List<SettingEntity> settings) {
// for (SettingEntity setting : settings) {
// this.patch(setting);
// }
// }
// }
// Path: src/main/java/com/mageddo/bookmarks/apiserver/SettingsController.java
import com.mageddo.bookmarks.entity.SettingEntity;
import com.mageddo.bookmarks.exception.NotFoundException;
import com.mageddo.bookmarks.service.SettingsService;
import io.micronaut.http.HttpResponse;
import io.micronaut.http.MediaType;
import io.micronaut.http.annotation.Body;
import io.micronaut.http.annotation.Controller;
import io.micronaut.http.annotation.Get;
import io.micronaut.http.annotation.Patch;
import io.micronaut.http.annotation.QueryValue;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.unbescape.html.HtmlEscape;
import java.util.List;
import java.util.stream.Collectors;
import static io.micronaut.http.HttpResponse.badRequest;
import static io.micronaut.http.HttpResponse.notFound;
import static io.micronaut.http.HttpResponse.ok;
public HttpResponse _2(String version) {
try {
return ok(settingsService.findAll());
} catch (Exception e) {
logger.error("status=cant-load-settings, msg={}", e.getMessage(), e);
return badRequest("Could not read settings");
}
}
@Get("/api/v{version:[12]}.0/settings?key")
public HttpResponse _3(String version, @QueryValue("key") String key) {
try {
return ok(settingsService.findSetting(key));
} catch (Exception e) {
logger.error("status=cant-load-settings, msg={}", e.getMessage(), e);
return badRequest("Could not read settings");
}
}
@Patch(value = "/api/v{version:[12]}.0/settings", consumes = MediaType.APPLICATION_JSON,
produces = MediaType.APPLICATION_JSON)
public HttpResponse _4(String version, @Body List<SettingEntity> settings) {
try {
settingsService.patch(
settings
.stream()
.map(it -> it.setValue(HtmlEscape.escapeHtml4(it.getValue())))
.collect(Collectors.toList())
);
return ok(); | } catch (NotFoundException e) { |
mageddo/bookmark-notes | src/test/java/com/mageddo/commons/MarkdownUtilsTest.java | // Path: src/test/java/com/mageddo/config/TestUtils.java
// public static String readAsString(String path) {
// try {
// final InputStream resource = TestUtils.class.getResourceAsStream(path);
// assertNotNull(resource, "file not found: " + path);
// return IOUtils.readText(new BufferedReader(new InputStreamReader(resource)));
// } catch (IOException e) {
// throw new UncheckedIOException(e);
// }
// }
//
// Path: src/main/java/com/mageddo/markdown/MarkdownUtils.java
// public static String parseMarkdown(String markdown) {
// final List<Extension> extensions = Arrays.asList(CustomTableExtension.create("table table-bordered table-striped"));
// final Parser parser = Parser.builder()
// .extensions(extensions)
// .build();
// return HtmlRenderer.builder()
// .extensions(extensions)
// .build()
// .render(parser.parse(markdown));
// }
| import org.junit.jupiter.api.Test;
import static com.mageddo.config.TestUtils.readAsString;
import static com.mageddo.markdown.MarkdownUtils.parseMarkdown;
import static org.junit.jupiter.api.Assertions.assertEquals; | package com.mageddo.commons;
class MarkdownUtilsTest {
@Test
void mustParseTable() {
// arrange
String markdown = "# Table\n" + "| Day | Meal | Price |\n" + "| --------|---------|-------|\n" + "| Monday"
+ " | pasta | $6 |\n" + "| Tuesday | chicken | $8 |";
// act | // Path: src/test/java/com/mageddo/config/TestUtils.java
// public static String readAsString(String path) {
// try {
// final InputStream resource = TestUtils.class.getResourceAsStream(path);
// assertNotNull(resource, "file not found: " + path);
// return IOUtils.readText(new BufferedReader(new InputStreamReader(resource)));
// } catch (IOException e) {
// throw new UncheckedIOException(e);
// }
// }
//
// Path: src/main/java/com/mageddo/markdown/MarkdownUtils.java
// public static String parseMarkdown(String markdown) {
// final List<Extension> extensions = Arrays.asList(CustomTableExtension.create("table table-bordered table-striped"));
// final Parser parser = Parser.builder()
// .extensions(extensions)
// .build();
// return HtmlRenderer.builder()
// .extensions(extensions)
// .build()
// .render(parser.parse(markdown));
// }
// Path: src/test/java/com/mageddo/commons/MarkdownUtilsTest.java
import org.junit.jupiter.api.Test;
import static com.mageddo.config.TestUtils.readAsString;
import static com.mageddo.markdown.MarkdownUtils.parseMarkdown;
import static org.junit.jupiter.api.Assertions.assertEquals;
package com.mageddo.commons;
class MarkdownUtilsTest {
@Test
void mustParseTable() {
// arrange
String markdown = "# Table\n" + "| Day | Meal | Price |\n" + "| --------|---------|-------|\n" + "| Monday"
+ " | pasta | $6 |\n" + "| Tuesday | chicken | $8 |";
// act | final String renderedHtml = parseMarkdown(markdown); |
mageddo/bookmark-notes | src/test/java/com/mageddo/commons/MarkdownUtilsTest.java | // Path: src/test/java/com/mageddo/config/TestUtils.java
// public static String readAsString(String path) {
// try {
// final InputStream resource = TestUtils.class.getResourceAsStream(path);
// assertNotNull(resource, "file not found: " + path);
// return IOUtils.readText(new BufferedReader(new InputStreamReader(resource)));
// } catch (IOException e) {
// throw new UncheckedIOException(e);
// }
// }
//
// Path: src/main/java/com/mageddo/markdown/MarkdownUtils.java
// public static String parseMarkdown(String markdown) {
// final List<Extension> extensions = Arrays.asList(CustomTableExtension.create("table table-bordered table-striped"));
// final Parser parser = Parser.builder()
// .extensions(extensions)
// .build();
// return HtmlRenderer.builder()
// .extensions(extensions)
// .build()
// .render(parser.parse(markdown));
// }
| import org.junit.jupiter.api.Test;
import static com.mageddo.config.TestUtils.readAsString;
import static com.mageddo.markdown.MarkdownUtils.parseMarkdown;
import static org.junit.jupiter.api.Assertions.assertEquals; | package com.mageddo.commons;
class MarkdownUtilsTest {
@Test
void mustParseTable() {
// arrange
String markdown = "# Table\n" + "| Day | Meal | Price |\n" + "| --------|---------|-------|\n" + "| Monday"
+ " | pasta | $6 |\n" + "| Tuesday | chicken | $8 |";
// act
final String renderedHtml = parseMarkdown(markdown);
// assert | // Path: src/test/java/com/mageddo/config/TestUtils.java
// public static String readAsString(String path) {
// try {
// final InputStream resource = TestUtils.class.getResourceAsStream(path);
// assertNotNull(resource, "file not found: " + path);
// return IOUtils.readText(new BufferedReader(new InputStreamReader(resource)));
// } catch (IOException e) {
// throw new UncheckedIOException(e);
// }
// }
//
// Path: src/main/java/com/mageddo/markdown/MarkdownUtils.java
// public static String parseMarkdown(String markdown) {
// final List<Extension> extensions = Arrays.asList(CustomTableExtension.create("table table-bordered table-striped"));
// final Parser parser = Parser.builder()
// .extensions(extensions)
// .build();
// return HtmlRenderer.builder()
// .extensions(extensions)
// .build()
// .render(parser.parse(markdown));
// }
// Path: src/test/java/com/mageddo/commons/MarkdownUtilsTest.java
import org.junit.jupiter.api.Test;
import static com.mageddo.config.TestUtils.readAsString;
import static com.mageddo.markdown.MarkdownUtils.parseMarkdown;
import static org.junit.jupiter.api.Assertions.assertEquals;
package com.mageddo.commons;
class MarkdownUtilsTest {
@Test
void mustParseTable() {
// arrange
String markdown = "# Table\n" + "| Day | Meal | Price |\n" + "| --------|---------|-------|\n" + "| Monday"
+ " | pasta | $6 |\n" + "| Tuesday | chicken | $8 |";
// act
final String renderedHtml = parseMarkdown(markdown);
// assert | assertEquals(readAsString("/markdown-utils-test/001.html"), renderedHtml); |
mageddo/bookmark-notes | src/main/java/com/mageddo/bookmarks/apiserver/SiteMapController.java | // Path: src/main/java/com/mageddo/bookmarks/service/SiteMapService.java
// @Rsl
// @Singleton
// public class SiteMapService {
//
// private final BookmarkDAO bookmarkDAO;
//
// public SiteMapService(BookmarkDAO bookmarkDAO) {
// this.bookmarkDAO = bookmarkDAO;
// }
//
// @Transactional
// public void generateSiteMapXML(OutputStream out, HttpRequest req) throws IOException {
// /*
// <urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
// */
// @RawString
// final String header = lateInit();
// out.write(header.getBytes());
//
// /*
// <url>
// <loc>%s</loc>
// %s
// <changefreq>weekly</changefreq>
// <priority>1</priority>
// </url>
// */
// @RawString
// final String siteMapItem = lateInit();
//
// for (final var bookmarkEntity : this.bookmarkDAO.loadSiteMap()) {
// out.write(String.format(
// siteMapItem, this.formatURL(req, bookmarkEntity),
// this.formatDate(bookmarkEntity.getLastUpdate())
// ).getBytes());
// }
// out.write("</urlset>\n".getBytes());
//
// }
//
// private String formatDate(LocalDateTime date) {
// if (date == null) {
// return "";
// }
// return String.format("<lastmod>%s</lastmod>", date.format(DateTimeFormatter.ISO_DATE));
// }
//
// private String formatURL(HttpRequest url, BookmarkEntity bookmarkEntity) {
// return String.format(
// "%s%s",
// UrlUtils.getFullHost(url),
// formatUrl(bookmarkEntity.getId(), bookmarkEntity.getName())
// );
// }
//
// public static String formatUrl(long bookmarkId, String bookmarkName){
// return String.format("/bookmark/%d/%s", bookmarkId, UrlUtils.encodeSeoUrl(bookmarkName));
// }
// }
| import java.io.ByteArrayOutputStream;
import com.mageddo.bookmarks.service.SiteMapService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import io.micronaut.http.HttpRequest;
import io.micronaut.http.HttpResponse;
import io.micronaut.http.MediaType;
import io.micronaut.http.annotation.Controller;
import io.micronaut.http.annotation.Get;
import io.micronaut.http.annotation.Produces;
import static io.micronaut.http.HttpResponse.badRequest;
import static io.micronaut.http.HttpResponse.ok; | package com.mageddo.bookmarks.apiserver;
@Controller
public class SiteMapController {
private final Logger logger = LoggerFactory.getLogger(getClass()); | // Path: src/main/java/com/mageddo/bookmarks/service/SiteMapService.java
// @Rsl
// @Singleton
// public class SiteMapService {
//
// private final BookmarkDAO bookmarkDAO;
//
// public SiteMapService(BookmarkDAO bookmarkDAO) {
// this.bookmarkDAO = bookmarkDAO;
// }
//
// @Transactional
// public void generateSiteMapXML(OutputStream out, HttpRequest req) throws IOException {
// /*
// <urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
// */
// @RawString
// final String header = lateInit();
// out.write(header.getBytes());
//
// /*
// <url>
// <loc>%s</loc>
// %s
// <changefreq>weekly</changefreq>
// <priority>1</priority>
// </url>
// */
// @RawString
// final String siteMapItem = lateInit();
//
// for (final var bookmarkEntity : this.bookmarkDAO.loadSiteMap()) {
// out.write(String.format(
// siteMapItem, this.formatURL(req, bookmarkEntity),
// this.formatDate(bookmarkEntity.getLastUpdate())
// ).getBytes());
// }
// out.write("</urlset>\n".getBytes());
//
// }
//
// private String formatDate(LocalDateTime date) {
// if (date == null) {
// return "";
// }
// return String.format("<lastmod>%s</lastmod>", date.format(DateTimeFormatter.ISO_DATE));
// }
//
// private String formatURL(HttpRequest url, BookmarkEntity bookmarkEntity) {
// return String.format(
// "%s%s",
// UrlUtils.getFullHost(url),
// formatUrl(bookmarkEntity.getId(), bookmarkEntity.getName())
// );
// }
//
// public static String formatUrl(long bookmarkId, String bookmarkName){
// return String.format("/bookmark/%d/%s", bookmarkId, UrlUtils.encodeSeoUrl(bookmarkName));
// }
// }
// Path: src/main/java/com/mageddo/bookmarks/apiserver/SiteMapController.java
import java.io.ByteArrayOutputStream;
import com.mageddo.bookmarks.service.SiteMapService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import io.micronaut.http.HttpRequest;
import io.micronaut.http.HttpResponse;
import io.micronaut.http.MediaType;
import io.micronaut.http.annotation.Controller;
import io.micronaut.http.annotation.Get;
import io.micronaut.http.annotation.Produces;
import static io.micronaut.http.HttpResponse.badRequest;
import static io.micronaut.http.HttpResponse.ok;
package com.mageddo.bookmarks.apiserver;
@Controller
public class SiteMapController {
private final Logger logger = LoggerFactory.getLogger(getClass()); | private final SiteMapService siteMapService; |
mageddo/bookmark-notes | src/main/java/com/mageddo/bookmarks/service/TagService.java | // Path: src/main/java/com/mageddo/bookmarks/apiserver/res/TagV1Res.java
// public class TagV1Res {
//
// private Long id;
// private String name;
// private String slug;
//
// public static RowMapper<TagV1Res> mapper() {
// return (rs, rowNum) -> new TagV1Res().setId(rs.getLong("ID"))
// .setName(rs.getString("NAME"))
// .setSlug(rs.getString("SLUG"));
// }
//
// public Long getId() {
// return id;
// }
//
// public TagV1Res setId(Long id) {
// this.id = id;
// return this;
// }
//
// public String getName() {
// return name;
// }
//
// public TagV1Res setName(String name) {
// this.name = name;
// return this;
// }
//
// public String getSlug() {
// return slug;
// }
//
// public TagV1Res setSlug(String slug) {
// this.slug = slug;
// return this;
// }
// }
//
// Path: src/main/java/com/mageddo/bookmarks/dao/TagDAO.java
// public interface TagDAO {
//
// List<TagV1Res> findTags();
//
// List<TagEntity> findTags(long bookmarkId);
//
// List<TagEntity> findTags(String query);
//
// void createIgnoreDuplicates(Tags.Tag tag);
//
// TagEntity findTag(String slug);
// }
//
// Path: src/main/java/com/mageddo/bookmarks/entity/TagEntity.java
// public class TagEntity {
//
// private Integer id;
// private String slug;
// private String name;
// private Integer bookmarkId;
//
// public static RowMapper<TagEntity> mapper() {
// return (rs, rowNum) -> new TagEntity().setId(rs.getInt("IDT_TAG"))
// .setName(rs.getString("NAM_TAG"))
// .setSlug(rs.getString("COD_SLUG"))
// .setBookmarkId(JdbcHelper.getInteger(rs, "IDT_BOOKMARK"));
// }
//
// public String getName() {
// return name;
// }
//
// public TagEntity setName(String name) {
// this.name = name;
// return this;
// }
//
// public Integer getId() {
// return id;
// }
//
// public TagEntity setId(Integer id) {
// this.id = id;
// return this;
// }
//
// public String getSlug() {
// return slug;
// }
//
// public TagEntity setSlug(String slug) {
// this.slug = slug;
// return this;
// }
//
// public Integer getBookmarkId() {
// return bookmarkId;
// }
//
// public TagEntity setBookmarkId(Integer bookmarkId) {
// this.bookmarkId = bookmarkId;
// return this;
// }
//
// }
| import java.util.List;
import javax.inject.Singleton;
import com.mageddo.bookmarks.apiserver.res.TagV1Res;
import com.mageddo.bookmarks.dao.TagDAO;
import com.mageddo.bookmarks.entity.TagEntity; | package com.mageddo.bookmarks.service;
@Singleton
public class TagService {
| // Path: src/main/java/com/mageddo/bookmarks/apiserver/res/TagV1Res.java
// public class TagV1Res {
//
// private Long id;
// private String name;
// private String slug;
//
// public static RowMapper<TagV1Res> mapper() {
// return (rs, rowNum) -> new TagV1Res().setId(rs.getLong("ID"))
// .setName(rs.getString("NAME"))
// .setSlug(rs.getString("SLUG"));
// }
//
// public Long getId() {
// return id;
// }
//
// public TagV1Res setId(Long id) {
// this.id = id;
// return this;
// }
//
// public String getName() {
// return name;
// }
//
// public TagV1Res setName(String name) {
// this.name = name;
// return this;
// }
//
// public String getSlug() {
// return slug;
// }
//
// public TagV1Res setSlug(String slug) {
// this.slug = slug;
// return this;
// }
// }
//
// Path: src/main/java/com/mageddo/bookmarks/dao/TagDAO.java
// public interface TagDAO {
//
// List<TagV1Res> findTags();
//
// List<TagEntity> findTags(long bookmarkId);
//
// List<TagEntity> findTags(String query);
//
// void createIgnoreDuplicates(Tags.Tag tag);
//
// TagEntity findTag(String slug);
// }
//
// Path: src/main/java/com/mageddo/bookmarks/entity/TagEntity.java
// public class TagEntity {
//
// private Integer id;
// private String slug;
// private String name;
// private Integer bookmarkId;
//
// public static RowMapper<TagEntity> mapper() {
// return (rs, rowNum) -> new TagEntity().setId(rs.getInt("IDT_TAG"))
// .setName(rs.getString("NAM_TAG"))
// .setSlug(rs.getString("COD_SLUG"))
// .setBookmarkId(JdbcHelper.getInteger(rs, "IDT_BOOKMARK"));
// }
//
// public String getName() {
// return name;
// }
//
// public TagEntity setName(String name) {
// this.name = name;
// return this;
// }
//
// public Integer getId() {
// return id;
// }
//
// public TagEntity setId(Integer id) {
// this.id = id;
// return this;
// }
//
// public String getSlug() {
// return slug;
// }
//
// public TagEntity setSlug(String slug) {
// this.slug = slug;
// return this;
// }
//
// public Integer getBookmarkId() {
// return bookmarkId;
// }
//
// public TagEntity setBookmarkId(Integer bookmarkId) {
// this.bookmarkId = bookmarkId;
// return this;
// }
//
// }
// Path: src/main/java/com/mageddo/bookmarks/service/TagService.java
import java.util.List;
import javax.inject.Singleton;
import com.mageddo.bookmarks.apiserver.res.TagV1Res;
import com.mageddo.bookmarks.dao.TagDAO;
import com.mageddo.bookmarks.entity.TagEntity;
package com.mageddo.bookmarks.service;
@Singleton
public class TagService {
| private final TagDAO tagDAO; |
mageddo/bookmark-notes | src/main/java/com/mageddo/bookmarks/service/TagService.java | // Path: src/main/java/com/mageddo/bookmarks/apiserver/res/TagV1Res.java
// public class TagV1Res {
//
// private Long id;
// private String name;
// private String slug;
//
// public static RowMapper<TagV1Res> mapper() {
// return (rs, rowNum) -> new TagV1Res().setId(rs.getLong("ID"))
// .setName(rs.getString("NAME"))
// .setSlug(rs.getString("SLUG"));
// }
//
// public Long getId() {
// return id;
// }
//
// public TagV1Res setId(Long id) {
// this.id = id;
// return this;
// }
//
// public String getName() {
// return name;
// }
//
// public TagV1Res setName(String name) {
// this.name = name;
// return this;
// }
//
// public String getSlug() {
// return slug;
// }
//
// public TagV1Res setSlug(String slug) {
// this.slug = slug;
// return this;
// }
// }
//
// Path: src/main/java/com/mageddo/bookmarks/dao/TagDAO.java
// public interface TagDAO {
//
// List<TagV1Res> findTags();
//
// List<TagEntity> findTags(long bookmarkId);
//
// List<TagEntity> findTags(String query);
//
// void createIgnoreDuplicates(Tags.Tag tag);
//
// TagEntity findTag(String slug);
// }
//
// Path: src/main/java/com/mageddo/bookmarks/entity/TagEntity.java
// public class TagEntity {
//
// private Integer id;
// private String slug;
// private String name;
// private Integer bookmarkId;
//
// public static RowMapper<TagEntity> mapper() {
// return (rs, rowNum) -> new TagEntity().setId(rs.getInt("IDT_TAG"))
// .setName(rs.getString("NAM_TAG"))
// .setSlug(rs.getString("COD_SLUG"))
// .setBookmarkId(JdbcHelper.getInteger(rs, "IDT_BOOKMARK"));
// }
//
// public String getName() {
// return name;
// }
//
// public TagEntity setName(String name) {
// this.name = name;
// return this;
// }
//
// public Integer getId() {
// return id;
// }
//
// public TagEntity setId(Integer id) {
// this.id = id;
// return this;
// }
//
// public String getSlug() {
// return slug;
// }
//
// public TagEntity setSlug(String slug) {
// this.slug = slug;
// return this;
// }
//
// public Integer getBookmarkId() {
// return bookmarkId;
// }
//
// public TagEntity setBookmarkId(Integer bookmarkId) {
// this.bookmarkId = bookmarkId;
// return this;
// }
//
// }
| import java.util.List;
import javax.inject.Singleton;
import com.mageddo.bookmarks.apiserver.res.TagV1Res;
import com.mageddo.bookmarks.dao.TagDAO;
import com.mageddo.bookmarks.entity.TagEntity; | package com.mageddo.bookmarks.service;
@Singleton
public class TagService {
private final TagDAO tagDAO;
public TagService(TagDAO tagDAO) {
this.tagDAO = tagDAO;
}
| // Path: src/main/java/com/mageddo/bookmarks/apiserver/res/TagV1Res.java
// public class TagV1Res {
//
// private Long id;
// private String name;
// private String slug;
//
// public static RowMapper<TagV1Res> mapper() {
// return (rs, rowNum) -> new TagV1Res().setId(rs.getLong("ID"))
// .setName(rs.getString("NAME"))
// .setSlug(rs.getString("SLUG"));
// }
//
// public Long getId() {
// return id;
// }
//
// public TagV1Res setId(Long id) {
// this.id = id;
// return this;
// }
//
// public String getName() {
// return name;
// }
//
// public TagV1Res setName(String name) {
// this.name = name;
// return this;
// }
//
// public String getSlug() {
// return slug;
// }
//
// public TagV1Res setSlug(String slug) {
// this.slug = slug;
// return this;
// }
// }
//
// Path: src/main/java/com/mageddo/bookmarks/dao/TagDAO.java
// public interface TagDAO {
//
// List<TagV1Res> findTags();
//
// List<TagEntity> findTags(long bookmarkId);
//
// List<TagEntity> findTags(String query);
//
// void createIgnoreDuplicates(Tags.Tag tag);
//
// TagEntity findTag(String slug);
// }
//
// Path: src/main/java/com/mageddo/bookmarks/entity/TagEntity.java
// public class TagEntity {
//
// private Integer id;
// private String slug;
// private String name;
// private Integer bookmarkId;
//
// public static RowMapper<TagEntity> mapper() {
// return (rs, rowNum) -> new TagEntity().setId(rs.getInt("IDT_TAG"))
// .setName(rs.getString("NAM_TAG"))
// .setSlug(rs.getString("COD_SLUG"))
// .setBookmarkId(JdbcHelper.getInteger(rs, "IDT_BOOKMARK"));
// }
//
// public String getName() {
// return name;
// }
//
// public TagEntity setName(String name) {
// this.name = name;
// return this;
// }
//
// public Integer getId() {
// return id;
// }
//
// public TagEntity setId(Integer id) {
// this.id = id;
// return this;
// }
//
// public String getSlug() {
// return slug;
// }
//
// public TagEntity setSlug(String slug) {
// this.slug = slug;
// return this;
// }
//
// public Integer getBookmarkId() {
// return bookmarkId;
// }
//
// public TagEntity setBookmarkId(Integer bookmarkId) {
// this.bookmarkId = bookmarkId;
// return this;
// }
//
// }
// Path: src/main/java/com/mageddo/bookmarks/service/TagService.java
import java.util.List;
import javax.inject.Singleton;
import com.mageddo.bookmarks.apiserver.res.TagV1Res;
import com.mageddo.bookmarks.dao.TagDAO;
import com.mageddo.bookmarks.entity.TagEntity;
package com.mageddo.bookmarks.service;
@Singleton
public class TagService {
private final TagDAO tagDAO;
public TagService(TagDAO tagDAO) {
this.tagDAO = tagDAO;
}
| public List<TagV1Res> getTags() { |
mageddo/bookmark-notes | src/main/java/com/mageddo/bookmarks/service/TagService.java | // Path: src/main/java/com/mageddo/bookmarks/apiserver/res/TagV1Res.java
// public class TagV1Res {
//
// private Long id;
// private String name;
// private String slug;
//
// public static RowMapper<TagV1Res> mapper() {
// return (rs, rowNum) -> new TagV1Res().setId(rs.getLong("ID"))
// .setName(rs.getString("NAME"))
// .setSlug(rs.getString("SLUG"));
// }
//
// public Long getId() {
// return id;
// }
//
// public TagV1Res setId(Long id) {
// this.id = id;
// return this;
// }
//
// public String getName() {
// return name;
// }
//
// public TagV1Res setName(String name) {
// this.name = name;
// return this;
// }
//
// public String getSlug() {
// return slug;
// }
//
// public TagV1Res setSlug(String slug) {
// this.slug = slug;
// return this;
// }
// }
//
// Path: src/main/java/com/mageddo/bookmarks/dao/TagDAO.java
// public interface TagDAO {
//
// List<TagV1Res> findTags();
//
// List<TagEntity> findTags(long bookmarkId);
//
// List<TagEntity> findTags(String query);
//
// void createIgnoreDuplicates(Tags.Tag tag);
//
// TagEntity findTag(String slug);
// }
//
// Path: src/main/java/com/mageddo/bookmarks/entity/TagEntity.java
// public class TagEntity {
//
// private Integer id;
// private String slug;
// private String name;
// private Integer bookmarkId;
//
// public static RowMapper<TagEntity> mapper() {
// return (rs, rowNum) -> new TagEntity().setId(rs.getInt("IDT_TAG"))
// .setName(rs.getString("NAM_TAG"))
// .setSlug(rs.getString("COD_SLUG"))
// .setBookmarkId(JdbcHelper.getInteger(rs, "IDT_BOOKMARK"));
// }
//
// public String getName() {
// return name;
// }
//
// public TagEntity setName(String name) {
// this.name = name;
// return this;
// }
//
// public Integer getId() {
// return id;
// }
//
// public TagEntity setId(Integer id) {
// this.id = id;
// return this;
// }
//
// public String getSlug() {
// return slug;
// }
//
// public TagEntity setSlug(String slug) {
// this.slug = slug;
// return this;
// }
//
// public Integer getBookmarkId() {
// return bookmarkId;
// }
//
// public TagEntity setBookmarkId(Integer bookmarkId) {
// this.bookmarkId = bookmarkId;
// return this;
// }
//
// }
| import java.util.List;
import javax.inject.Singleton;
import com.mageddo.bookmarks.apiserver.res.TagV1Res;
import com.mageddo.bookmarks.dao.TagDAO;
import com.mageddo.bookmarks.entity.TagEntity; | package com.mageddo.bookmarks.service;
@Singleton
public class TagService {
private final TagDAO tagDAO;
public TagService(TagDAO tagDAO) {
this.tagDAO = tagDAO;
}
public List<TagV1Res> getTags() {
return tagDAO.findTags();
}
| // Path: src/main/java/com/mageddo/bookmarks/apiserver/res/TagV1Res.java
// public class TagV1Res {
//
// private Long id;
// private String name;
// private String slug;
//
// public static RowMapper<TagV1Res> mapper() {
// return (rs, rowNum) -> new TagV1Res().setId(rs.getLong("ID"))
// .setName(rs.getString("NAME"))
// .setSlug(rs.getString("SLUG"));
// }
//
// public Long getId() {
// return id;
// }
//
// public TagV1Res setId(Long id) {
// this.id = id;
// return this;
// }
//
// public String getName() {
// return name;
// }
//
// public TagV1Res setName(String name) {
// this.name = name;
// return this;
// }
//
// public String getSlug() {
// return slug;
// }
//
// public TagV1Res setSlug(String slug) {
// this.slug = slug;
// return this;
// }
// }
//
// Path: src/main/java/com/mageddo/bookmarks/dao/TagDAO.java
// public interface TagDAO {
//
// List<TagV1Res> findTags();
//
// List<TagEntity> findTags(long bookmarkId);
//
// List<TagEntity> findTags(String query);
//
// void createIgnoreDuplicates(Tags.Tag tag);
//
// TagEntity findTag(String slug);
// }
//
// Path: src/main/java/com/mageddo/bookmarks/entity/TagEntity.java
// public class TagEntity {
//
// private Integer id;
// private String slug;
// private String name;
// private Integer bookmarkId;
//
// public static RowMapper<TagEntity> mapper() {
// return (rs, rowNum) -> new TagEntity().setId(rs.getInt("IDT_TAG"))
// .setName(rs.getString("NAM_TAG"))
// .setSlug(rs.getString("COD_SLUG"))
// .setBookmarkId(JdbcHelper.getInteger(rs, "IDT_BOOKMARK"));
// }
//
// public String getName() {
// return name;
// }
//
// public TagEntity setName(String name) {
// this.name = name;
// return this;
// }
//
// public Integer getId() {
// return id;
// }
//
// public TagEntity setId(Integer id) {
// this.id = id;
// return this;
// }
//
// public String getSlug() {
// return slug;
// }
//
// public TagEntity setSlug(String slug) {
// this.slug = slug;
// return this;
// }
//
// public Integer getBookmarkId() {
// return bookmarkId;
// }
//
// public TagEntity setBookmarkId(Integer bookmarkId) {
// this.bookmarkId = bookmarkId;
// return this;
// }
//
// }
// Path: src/main/java/com/mageddo/bookmarks/service/TagService.java
import java.util.List;
import javax.inject.Singleton;
import com.mageddo.bookmarks.apiserver.res.TagV1Res;
import com.mageddo.bookmarks.dao.TagDAO;
import com.mageddo.bookmarks.entity.TagEntity;
package com.mageddo.bookmarks.service;
@Singleton
public class TagService {
private final TagDAO tagDAO;
public TagService(TagDAO tagDAO) {
this.tagDAO = tagDAO;
}
public List<TagV1Res> getTags() {
return tagDAO.findTags();
}
| public List<TagEntity> getTags(long bookmarkId) { |
mageddo/bookmark-notes | src/main/java/com/mageddo/bookmarks/entity/BookmarkEntity.java | // Path: src/main/java/com/mageddo/bookmarks/enums/BookmarkVisibility.java
// public enum BookmarkVisibility {
//
// PRIVATE(0), PUBLIC(1);
//
// private final int code;
//
// BookmarkVisibility(int code) {
// this.code = code;
// }
//
// public static BookmarkVisibility mustFromCode(int code) {
// for (BookmarkVisibility visibility : values()) {
// if (visibility.getCode() == code) {
// return visibility;
// }
// }
// return null;
// }
//
// public int getCode() {
// return code;
// }
// }
| import java.time.LocalDateTime;
import com.mageddo.bookmarks.enums.BookmarkVisibility;
import com.mageddo.common.jdbc.JdbcHelper;
import org.springframework.jdbc.core.RowMapper; | package com.mageddo.bookmarks.entity;
public class BookmarkEntity {
private Integer id;
private String name;
private LocalDateTime lastUpdate;
private String link;
private String description;
private boolean deleted;
private boolean archived; | // Path: src/main/java/com/mageddo/bookmarks/enums/BookmarkVisibility.java
// public enum BookmarkVisibility {
//
// PRIVATE(0), PUBLIC(1);
//
// private final int code;
//
// BookmarkVisibility(int code) {
// this.code = code;
// }
//
// public static BookmarkVisibility mustFromCode(int code) {
// for (BookmarkVisibility visibility : values()) {
// if (visibility.getCode() == code) {
// return visibility;
// }
// }
// return null;
// }
//
// public int getCode() {
// return code;
// }
// }
// Path: src/main/java/com/mageddo/bookmarks/entity/BookmarkEntity.java
import java.time.LocalDateTime;
import com.mageddo.bookmarks.enums.BookmarkVisibility;
import com.mageddo.common.jdbc.JdbcHelper;
import org.springframework.jdbc.core.RowMapper;
package com.mageddo.bookmarks.entity;
public class BookmarkEntity {
private Integer id;
private String name;
private LocalDateTime lastUpdate;
private String link;
private String description;
private boolean deleted;
private boolean archived; | private BookmarkVisibility visibility; |
mageddo/bookmark-notes | src/main/java/thymeleaf/ThymeleafUtils.java | // Path: src/main/java/com/mageddo/bookmarks/entity/SettingEntity.java
// public enum Setting {
//
// CODE_BLOCK_MAX_HEIGHT, //
// MOBILE_CODE_BLOCK_MAX_HEIGHT, //
// CODE_STYLE_TAB_SIZE, //
// CODE_STYLE_TAB_STYLE, //
// CODE_STYLE_SHOW_WHITESPACES, //
//
// /**
// * HTML which should be put inside the <head> tag
// */
// PUBLIC_PAGES_HEADER_HTML, //
// ;
// }
//
// Path: src/main/java/com/mageddo/bookmarks/service/SettingsService.java
// @Singleton
// public class SettingsService {
//
// private final SettingsDAO settingsDAO;
//
// public SettingsService(SettingsDAO settingsDAO) {
// this.settingsDAO = settingsDAO;
// }
//
// public Map<String, String> findAllAsMap() {
// final List<SettingEntity> settings = settingsDAO.findAll();
// final Map<String, String> settingsMap = new LinkedHashMap<>();
// for (SettingEntity setting : settings) {
// settingsMap.put(setting.getKey(), setting.getValue());
// }
// return settingsMap;
// }
//
// public List<SettingEntity> findAll() {
// return settingsDAO.findAll();
// }
//
// public SettingEntity findSetting(String key) {
// return settingsDAO.find(key);
// }
//
// public boolean patch(SettingEntity settingEntity) {
// final SettingEntity dbSettingEntity = settingsDAO.find(settingEntity.getKey());
// if (dbSettingEntity == null) {
// throw new NotFoundException(String.format("parameter doesn't exists %s", settingEntity.getKey()));
// }
// dbSettingEntity.setValue(settingEntity.getValue());
// dbSettingEntity.setUpdate(LocalDateTime.now());
// settingsDAO.patch(dbSettingEntity);
// return true;
// }
//
// public void patch(List<SettingEntity> settings) {
// for (SettingEntity setting : settings) {
// this.patch(setting);
// }
// }
// }
//
// Path: src/main/java/com/mageddo/bookmarks/service/SiteMapService.java
// @Rsl
// @Singleton
// public class SiteMapService {
//
// private final BookmarkDAO bookmarkDAO;
//
// public SiteMapService(BookmarkDAO bookmarkDAO) {
// this.bookmarkDAO = bookmarkDAO;
// }
//
// @Transactional
// public void generateSiteMapXML(OutputStream out, HttpRequest req) throws IOException {
// /*
// <urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
// */
// @RawString
// final String header = lateInit();
// out.write(header.getBytes());
//
// /*
// <url>
// <loc>%s</loc>
// %s
// <changefreq>weekly</changefreq>
// <priority>1</priority>
// </url>
// */
// @RawString
// final String siteMapItem = lateInit();
//
// for (final var bookmarkEntity : this.bookmarkDAO.loadSiteMap()) {
// out.write(String.format(
// siteMapItem, this.formatURL(req, bookmarkEntity),
// this.formatDate(bookmarkEntity.getLastUpdate())
// ).getBytes());
// }
// out.write("</urlset>\n".getBytes());
//
// }
//
// private String formatDate(LocalDateTime date) {
// if (date == null) {
// return "";
// }
// return String.format("<lastmod>%s</lastmod>", date.format(DateTimeFormatter.ISO_DATE));
// }
//
// private String formatURL(HttpRequest url, BookmarkEntity bookmarkEntity) {
// return String.format(
// "%s%s",
// UrlUtils.getFullHost(url),
// formatUrl(bookmarkEntity.getId(), bookmarkEntity.getName())
// );
// }
//
// public static String formatUrl(long bookmarkId, String bookmarkName){
// return String.format("/bookmark/%d/%s", bookmarkId, UrlUtils.encodeSeoUrl(bookmarkName));
// }
// }
//
// Path: src/main/java/com/mageddo/commons/UrlUtils.java
// public final class UrlUtils {
// private UrlUtils() {
// }
//
// public static String encode(String path) {
// if (path == null) {
// return "";
// }
// try {
// return URLEncoder.encode(path, StandardCharsets.UTF_8.displayName())
// .toLowerCase();
// } catch (UnsupportedEncodingException e) {
// throw new RuntimeException(e);
// }
// }
//
// public static String encodeSeoUrl(String path) {
// if (path == null) {
// return "";
// }
// return normalizeURL(path)
// .replaceAll("[^a-z0-9\\-_]", "-")
// .replaceAll("-{2,}", "-")
// .replaceAll("-+$", "")
// .replaceAll("^-+", "")
// ;
// }
//
// public static String getHost(HttpRequest req) {
// return req.getHeaders()
// .get("Host");
// }
//
// public static String getFullHost(HttpRequest req) {
// return String.format("http://%s", getHost(req));
// }
//
// static String normalizeURL(String path) {
// return StringUtils.stripAccents(path.toLowerCase()
// .replaceAll("\\s", "-"));
// }
// }
//
// Path: src/main/java/com/mageddo/config/ApplicationContextUtils.java
// public static ApplicationContext context() {
// return context;
// }
| import com.mageddo.bookmarks.entity.SettingEntity.Setting;
import com.mageddo.bookmarks.service.SettingsService;
import com.mageddo.bookmarks.service.SiteMapService;
import com.mageddo.commons.UrlUtils;
import org.commonmark.internal.util.Html5Entities;
import org.unbescape.html.HtmlEscape;
import static com.mageddo.config.ApplicationContextUtils.context; | package thymeleaf;
public final class ThymeleafUtils {
private ThymeleafUtils() {
}
public static String[] splitTags(String tags) {
return tags == null ? null : tags.split(",");
}
public static String encodePath(String path) { | // Path: src/main/java/com/mageddo/bookmarks/entity/SettingEntity.java
// public enum Setting {
//
// CODE_BLOCK_MAX_HEIGHT, //
// MOBILE_CODE_BLOCK_MAX_HEIGHT, //
// CODE_STYLE_TAB_SIZE, //
// CODE_STYLE_TAB_STYLE, //
// CODE_STYLE_SHOW_WHITESPACES, //
//
// /**
// * HTML which should be put inside the <head> tag
// */
// PUBLIC_PAGES_HEADER_HTML, //
// ;
// }
//
// Path: src/main/java/com/mageddo/bookmarks/service/SettingsService.java
// @Singleton
// public class SettingsService {
//
// private final SettingsDAO settingsDAO;
//
// public SettingsService(SettingsDAO settingsDAO) {
// this.settingsDAO = settingsDAO;
// }
//
// public Map<String, String> findAllAsMap() {
// final List<SettingEntity> settings = settingsDAO.findAll();
// final Map<String, String> settingsMap = new LinkedHashMap<>();
// for (SettingEntity setting : settings) {
// settingsMap.put(setting.getKey(), setting.getValue());
// }
// return settingsMap;
// }
//
// public List<SettingEntity> findAll() {
// return settingsDAO.findAll();
// }
//
// public SettingEntity findSetting(String key) {
// return settingsDAO.find(key);
// }
//
// public boolean patch(SettingEntity settingEntity) {
// final SettingEntity dbSettingEntity = settingsDAO.find(settingEntity.getKey());
// if (dbSettingEntity == null) {
// throw new NotFoundException(String.format("parameter doesn't exists %s", settingEntity.getKey()));
// }
// dbSettingEntity.setValue(settingEntity.getValue());
// dbSettingEntity.setUpdate(LocalDateTime.now());
// settingsDAO.patch(dbSettingEntity);
// return true;
// }
//
// public void patch(List<SettingEntity> settings) {
// for (SettingEntity setting : settings) {
// this.patch(setting);
// }
// }
// }
//
// Path: src/main/java/com/mageddo/bookmarks/service/SiteMapService.java
// @Rsl
// @Singleton
// public class SiteMapService {
//
// private final BookmarkDAO bookmarkDAO;
//
// public SiteMapService(BookmarkDAO bookmarkDAO) {
// this.bookmarkDAO = bookmarkDAO;
// }
//
// @Transactional
// public void generateSiteMapXML(OutputStream out, HttpRequest req) throws IOException {
// /*
// <urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
// */
// @RawString
// final String header = lateInit();
// out.write(header.getBytes());
//
// /*
// <url>
// <loc>%s</loc>
// %s
// <changefreq>weekly</changefreq>
// <priority>1</priority>
// </url>
// */
// @RawString
// final String siteMapItem = lateInit();
//
// for (final var bookmarkEntity : this.bookmarkDAO.loadSiteMap()) {
// out.write(String.format(
// siteMapItem, this.formatURL(req, bookmarkEntity),
// this.formatDate(bookmarkEntity.getLastUpdate())
// ).getBytes());
// }
// out.write("</urlset>\n".getBytes());
//
// }
//
// private String formatDate(LocalDateTime date) {
// if (date == null) {
// return "";
// }
// return String.format("<lastmod>%s</lastmod>", date.format(DateTimeFormatter.ISO_DATE));
// }
//
// private String formatURL(HttpRequest url, BookmarkEntity bookmarkEntity) {
// return String.format(
// "%s%s",
// UrlUtils.getFullHost(url),
// formatUrl(bookmarkEntity.getId(), bookmarkEntity.getName())
// );
// }
//
// public static String formatUrl(long bookmarkId, String bookmarkName){
// return String.format("/bookmark/%d/%s", bookmarkId, UrlUtils.encodeSeoUrl(bookmarkName));
// }
// }
//
// Path: src/main/java/com/mageddo/commons/UrlUtils.java
// public final class UrlUtils {
// private UrlUtils() {
// }
//
// public static String encode(String path) {
// if (path == null) {
// return "";
// }
// try {
// return URLEncoder.encode(path, StandardCharsets.UTF_8.displayName())
// .toLowerCase();
// } catch (UnsupportedEncodingException e) {
// throw new RuntimeException(e);
// }
// }
//
// public static String encodeSeoUrl(String path) {
// if (path == null) {
// return "";
// }
// return normalizeURL(path)
// .replaceAll("[^a-z0-9\\-_]", "-")
// .replaceAll("-{2,}", "-")
// .replaceAll("-+$", "")
// .replaceAll("^-+", "")
// ;
// }
//
// public static String getHost(HttpRequest req) {
// return req.getHeaders()
// .get("Host");
// }
//
// public static String getFullHost(HttpRequest req) {
// return String.format("http://%s", getHost(req));
// }
//
// static String normalizeURL(String path) {
// return StringUtils.stripAccents(path.toLowerCase()
// .replaceAll("\\s", "-"));
// }
// }
//
// Path: src/main/java/com/mageddo/config/ApplicationContextUtils.java
// public static ApplicationContext context() {
// return context;
// }
// Path: src/main/java/thymeleaf/ThymeleafUtils.java
import com.mageddo.bookmarks.entity.SettingEntity.Setting;
import com.mageddo.bookmarks.service.SettingsService;
import com.mageddo.bookmarks.service.SiteMapService;
import com.mageddo.commons.UrlUtils;
import org.commonmark.internal.util.Html5Entities;
import org.unbescape.html.HtmlEscape;
import static com.mageddo.config.ApplicationContextUtils.context;
package thymeleaf;
public final class ThymeleafUtils {
private ThymeleafUtils() {
}
public static String[] splitTags(String tags) {
return tags == null ? null : tags.split(",");
}
public static String encodePath(String path) { | return UrlUtils.encode(path); |
mageddo/bookmark-notes | src/main/java/thymeleaf/ThymeleafUtils.java | // Path: src/main/java/com/mageddo/bookmarks/entity/SettingEntity.java
// public enum Setting {
//
// CODE_BLOCK_MAX_HEIGHT, //
// MOBILE_CODE_BLOCK_MAX_HEIGHT, //
// CODE_STYLE_TAB_SIZE, //
// CODE_STYLE_TAB_STYLE, //
// CODE_STYLE_SHOW_WHITESPACES, //
//
// /**
// * HTML which should be put inside the <head> tag
// */
// PUBLIC_PAGES_HEADER_HTML, //
// ;
// }
//
// Path: src/main/java/com/mageddo/bookmarks/service/SettingsService.java
// @Singleton
// public class SettingsService {
//
// private final SettingsDAO settingsDAO;
//
// public SettingsService(SettingsDAO settingsDAO) {
// this.settingsDAO = settingsDAO;
// }
//
// public Map<String, String> findAllAsMap() {
// final List<SettingEntity> settings = settingsDAO.findAll();
// final Map<String, String> settingsMap = new LinkedHashMap<>();
// for (SettingEntity setting : settings) {
// settingsMap.put(setting.getKey(), setting.getValue());
// }
// return settingsMap;
// }
//
// public List<SettingEntity> findAll() {
// return settingsDAO.findAll();
// }
//
// public SettingEntity findSetting(String key) {
// return settingsDAO.find(key);
// }
//
// public boolean patch(SettingEntity settingEntity) {
// final SettingEntity dbSettingEntity = settingsDAO.find(settingEntity.getKey());
// if (dbSettingEntity == null) {
// throw new NotFoundException(String.format("parameter doesn't exists %s", settingEntity.getKey()));
// }
// dbSettingEntity.setValue(settingEntity.getValue());
// dbSettingEntity.setUpdate(LocalDateTime.now());
// settingsDAO.patch(dbSettingEntity);
// return true;
// }
//
// public void patch(List<SettingEntity> settings) {
// for (SettingEntity setting : settings) {
// this.patch(setting);
// }
// }
// }
//
// Path: src/main/java/com/mageddo/bookmarks/service/SiteMapService.java
// @Rsl
// @Singleton
// public class SiteMapService {
//
// private final BookmarkDAO bookmarkDAO;
//
// public SiteMapService(BookmarkDAO bookmarkDAO) {
// this.bookmarkDAO = bookmarkDAO;
// }
//
// @Transactional
// public void generateSiteMapXML(OutputStream out, HttpRequest req) throws IOException {
// /*
// <urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
// */
// @RawString
// final String header = lateInit();
// out.write(header.getBytes());
//
// /*
// <url>
// <loc>%s</loc>
// %s
// <changefreq>weekly</changefreq>
// <priority>1</priority>
// </url>
// */
// @RawString
// final String siteMapItem = lateInit();
//
// for (final var bookmarkEntity : this.bookmarkDAO.loadSiteMap()) {
// out.write(String.format(
// siteMapItem, this.formatURL(req, bookmarkEntity),
// this.formatDate(bookmarkEntity.getLastUpdate())
// ).getBytes());
// }
// out.write("</urlset>\n".getBytes());
//
// }
//
// private String formatDate(LocalDateTime date) {
// if (date == null) {
// return "";
// }
// return String.format("<lastmod>%s</lastmod>", date.format(DateTimeFormatter.ISO_DATE));
// }
//
// private String formatURL(HttpRequest url, BookmarkEntity bookmarkEntity) {
// return String.format(
// "%s%s",
// UrlUtils.getFullHost(url),
// formatUrl(bookmarkEntity.getId(), bookmarkEntity.getName())
// );
// }
//
// public static String formatUrl(long bookmarkId, String bookmarkName){
// return String.format("/bookmark/%d/%s", bookmarkId, UrlUtils.encodeSeoUrl(bookmarkName));
// }
// }
//
// Path: src/main/java/com/mageddo/commons/UrlUtils.java
// public final class UrlUtils {
// private UrlUtils() {
// }
//
// public static String encode(String path) {
// if (path == null) {
// return "";
// }
// try {
// return URLEncoder.encode(path, StandardCharsets.UTF_8.displayName())
// .toLowerCase();
// } catch (UnsupportedEncodingException e) {
// throw new RuntimeException(e);
// }
// }
//
// public static String encodeSeoUrl(String path) {
// if (path == null) {
// return "";
// }
// return normalizeURL(path)
// .replaceAll("[^a-z0-9\\-_]", "-")
// .replaceAll("-{2,}", "-")
// .replaceAll("-+$", "")
// .replaceAll("^-+", "")
// ;
// }
//
// public static String getHost(HttpRequest req) {
// return req.getHeaders()
// .get("Host");
// }
//
// public static String getFullHost(HttpRequest req) {
// return String.format("http://%s", getHost(req));
// }
//
// static String normalizeURL(String path) {
// return StringUtils.stripAccents(path.toLowerCase()
// .replaceAll("\\s", "-"));
// }
// }
//
// Path: src/main/java/com/mageddo/config/ApplicationContextUtils.java
// public static ApplicationContext context() {
// return context;
// }
| import com.mageddo.bookmarks.entity.SettingEntity.Setting;
import com.mageddo.bookmarks.service.SettingsService;
import com.mageddo.bookmarks.service.SiteMapService;
import com.mageddo.commons.UrlUtils;
import org.commonmark.internal.util.Html5Entities;
import org.unbescape.html.HtmlEscape;
import static com.mageddo.config.ApplicationContextUtils.context; | package thymeleaf;
public final class ThymeleafUtils {
private ThymeleafUtils() {
}
public static String[] splitTags(String tags) {
return tags == null ? null : tags.split(",");
}
public static String encodePath(String path) {
return UrlUtils.encode(path);
}
public static String createBookmarkUrl(long id, String name) { | // Path: src/main/java/com/mageddo/bookmarks/entity/SettingEntity.java
// public enum Setting {
//
// CODE_BLOCK_MAX_HEIGHT, //
// MOBILE_CODE_BLOCK_MAX_HEIGHT, //
// CODE_STYLE_TAB_SIZE, //
// CODE_STYLE_TAB_STYLE, //
// CODE_STYLE_SHOW_WHITESPACES, //
//
// /**
// * HTML which should be put inside the <head> tag
// */
// PUBLIC_PAGES_HEADER_HTML, //
// ;
// }
//
// Path: src/main/java/com/mageddo/bookmarks/service/SettingsService.java
// @Singleton
// public class SettingsService {
//
// private final SettingsDAO settingsDAO;
//
// public SettingsService(SettingsDAO settingsDAO) {
// this.settingsDAO = settingsDAO;
// }
//
// public Map<String, String> findAllAsMap() {
// final List<SettingEntity> settings = settingsDAO.findAll();
// final Map<String, String> settingsMap = new LinkedHashMap<>();
// for (SettingEntity setting : settings) {
// settingsMap.put(setting.getKey(), setting.getValue());
// }
// return settingsMap;
// }
//
// public List<SettingEntity> findAll() {
// return settingsDAO.findAll();
// }
//
// public SettingEntity findSetting(String key) {
// return settingsDAO.find(key);
// }
//
// public boolean patch(SettingEntity settingEntity) {
// final SettingEntity dbSettingEntity = settingsDAO.find(settingEntity.getKey());
// if (dbSettingEntity == null) {
// throw new NotFoundException(String.format("parameter doesn't exists %s", settingEntity.getKey()));
// }
// dbSettingEntity.setValue(settingEntity.getValue());
// dbSettingEntity.setUpdate(LocalDateTime.now());
// settingsDAO.patch(dbSettingEntity);
// return true;
// }
//
// public void patch(List<SettingEntity> settings) {
// for (SettingEntity setting : settings) {
// this.patch(setting);
// }
// }
// }
//
// Path: src/main/java/com/mageddo/bookmarks/service/SiteMapService.java
// @Rsl
// @Singleton
// public class SiteMapService {
//
// private final BookmarkDAO bookmarkDAO;
//
// public SiteMapService(BookmarkDAO bookmarkDAO) {
// this.bookmarkDAO = bookmarkDAO;
// }
//
// @Transactional
// public void generateSiteMapXML(OutputStream out, HttpRequest req) throws IOException {
// /*
// <urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
// */
// @RawString
// final String header = lateInit();
// out.write(header.getBytes());
//
// /*
// <url>
// <loc>%s</loc>
// %s
// <changefreq>weekly</changefreq>
// <priority>1</priority>
// </url>
// */
// @RawString
// final String siteMapItem = lateInit();
//
// for (final var bookmarkEntity : this.bookmarkDAO.loadSiteMap()) {
// out.write(String.format(
// siteMapItem, this.formatURL(req, bookmarkEntity),
// this.formatDate(bookmarkEntity.getLastUpdate())
// ).getBytes());
// }
// out.write("</urlset>\n".getBytes());
//
// }
//
// private String formatDate(LocalDateTime date) {
// if (date == null) {
// return "";
// }
// return String.format("<lastmod>%s</lastmod>", date.format(DateTimeFormatter.ISO_DATE));
// }
//
// private String formatURL(HttpRequest url, BookmarkEntity bookmarkEntity) {
// return String.format(
// "%s%s",
// UrlUtils.getFullHost(url),
// formatUrl(bookmarkEntity.getId(), bookmarkEntity.getName())
// );
// }
//
// public static String formatUrl(long bookmarkId, String bookmarkName){
// return String.format("/bookmark/%d/%s", bookmarkId, UrlUtils.encodeSeoUrl(bookmarkName));
// }
// }
//
// Path: src/main/java/com/mageddo/commons/UrlUtils.java
// public final class UrlUtils {
// private UrlUtils() {
// }
//
// public static String encode(String path) {
// if (path == null) {
// return "";
// }
// try {
// return URLEncoder.encode(path, StandardCharsets.UTF_8.displayName())
// .toLowerCase();
// } catch (UnsupportedEncodingException e) {
// throw new RuntimeException(e);
// }
// }
//
// public static String encodeSeoUrl(String path) {
// if (path == null) {
// return "";
// }
// return normalizeURL(path)
// .replaceAll("[^a-z0-9\\-_]", "-")
// .replaceAll("-{2,}", "-")
// .replaceAll("-+$", "")
// .replaceAll("^-+", "")
// ;
// }
//
// public static String getHost(HttpRequest req) {
// return req.getHeaders()
// .get("Host");
// }
//
// public static String getFullHost(HttpRequest req) {
// return String.format("http://%s", getHost(req));
// }
//
// static String normalizeURL(String path) {
// return StringUtils.stripAccents(path.toLowerCase()
// .replaceAll("\\s", "-"));
// }
// }
//
// Path: src/main/java/com/mageddo/config/ApplicationContextUtils.java
// public static ApplicationContext context() {
// return context;
// }
// Path: src/main/java/thymeleaf/ThymeleafUtils.java
import com.mageddo.bookmarks.entity.SettingEntity.Setting;
import com.mageddo.bookmarks.service.SettingsService;
import com.mageddo.bookmarks.service.SiteMapService;
import com.mageddo.commons.UrlUtils;
import org.commonmark.internal.util.Html5Entities;
import org.unbescape.html.HtmlEscape;
import static com.mageddo.config.ApplicationContextUtils.context;
package thymeleaf;
public final class ThymeleafUtils {
private ThymeleafUtils() {
}
public static String[] splitTags(String tags) {
return tags == null ? null : tags.split(",");
}
public static String encodePath(String path) {
return UrlUtils.encode(path);
}
public static String createBookmarkUrl(long id, String name) { | return SiteMapService.formatUrl(id, name); |
mageddo/bookmark-notes | src/main/java/com/mageddo/bookmarks/service/SettingsService.java | // Path: src/main/java/com/mageddo/bookmarks/dao/SettingsDAO.java
// public interface SettingsDAO {
//
// List<SettingEntity> findAll();
//
// SettingEntity find(String key);
//
// void patch(SettingEntity settingEntity);
// }
//
// Path: src/main/java/com/mageddo/bookmarks/entity/SettingEntity.java
// public class SettingEntity {
//
// private String key;
// private String value;
//
// @JsonIgnore
// private LocalDateTime update;
//
// public static RowMapper<SettingEntity> mapper() {
// return (rs, rowNum) -> {
// return new SettingEntity().setUpdate(JdbcHelper.getLocalDateTime(rs, "DAT_UPDATE"))
// .setValue(rs.getString("DES_VALUE"))
// .setKey(rs.getString("NAM_PROPERTY"));
// };
// }
//
// public String getValue() {
// return value;
// }
//
// public SettingEntity setValue(String value) {
// this.value = value;
// return this;
// }
//
// public String getKey() {
// return key;
// }
//
// public SettingEntity setKey(String key) {
// this.key = key;
// return this;
// }
//
// public LocalDateTime getUpdate() {
// return update;
// }
//
// public SettingEntity setUpdate(LocalDateTime update) {
// this.update = update;
// return this;
// }
//
// public enum Setting {
//
// CODE_BLOCK_MAX_HEIGHT, //
// MOBILE_CODE_BLOCK_MAX_HEIGHT, //
// CODE_STYLE_TAB_SIZE, //
// CODE_STYLE_TAB_STYLE, //
// CODE_STYLE_SHOW_WHITESPACES, //
//
// /**
// * HTML which should be put inside the <head> tag
// */
// PUBLIC_PAGES_HEADER_HTML, //
// ;
// }
// }
//
// Path: src/main/java/com/mageddo/bookmarks/exception/NotFoundException.java
// public class NotFoundException extends RuntimeException {
// public NotFoundException(String message) {
// super(message);
// }
// }
| import java.time.LocalDateTime;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import javax.inject.Singleton;
import com.mageddo.bookmarks.dao.SettingsDAO;
import com.mageddo.bookmarks.entity.SettingEntity;
import com.mageddo.bookmarks.exception.NotFoundException; | package com.mageddo.bookmarks.service;
@Singleton
public class SettingsService {
| // Path: src/main/java/com/mageddo/bookmarks/dao/SettingsDAO.java
// public interface SettingsDAO {
//
// List<SettingEntity> findAll();
//
// SettingEntity find(String key);
//
// void patch(SettingEntity settingEntity);
// }
//
// Path: src/main/java/com/mageddo/bookmarks/entity/SettingEntity.java
// public class SettingEntity {
//
// private String key;
// private String value;
//
// @JsonIgnore
// private LocalDateTime update;
//
// public static RowMapper<SettingEntity> mapper() {
// return (rs, rowNum) -> {
// return new SettingEntity().setUpdate(JdbcHelper.getLocalDateTime(rs, "DAT_UPDATE"))
// .setValue(rs.getString("DES_VALUE"))
// .setKey(rs.getString("NAM_PROPERTY"));
// };
// }
//
// public String getValue() {
// return value;
// }
//
// public SettingEntity setValue(String value) {
// this.value = value;
// return this;
// }
//
// public String getKey() {
// return key;
// }
//
// public SettingEntity setKey(String key) {
// this.key = key;
// return this;
// }
//
// public LocalDateTime getUpdate() {
// return update;
// }
//
// public SettingEntity setUpdate(LocalDateTime update) {
// this.update = update;
// return this;
// }
//
// public enum Setting {
//
// CODE_BLOCK_MAX_HEIGHT, //
// MOBILE_CODE_BLOCK_MAX_HEIGHT, //
// CODE_STYLE_TAB_SIZE, //
// CODE_STYLE_TAB_STYLE, //
// CODE_STYLE_SHOW_WHITESPACES, //
//
// /**
// * HTML which should be put inside the <head> tag
// */
// PUBLIC_PAGES_HEADER_HTML, //
// ;
// }
// }
//
// Path: src/main/java/com/mageddo/bookmarks/exception/NotFoundException.java
// public class NotFoundException extends RuntimeException {
// public NotFoundException(String message) {
// super(message);
// }
// }
// Path: src/main/java/com/mageddo/bookmarks/service/SettingsService.java
import java.time.LocalDateTime;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import javax.inject.Singleton;
import com.mageddo.bookmarks.dao.SettingsDAO;
import com.mageddo.bookmarks.entity.SettingEntity;
import com.mageddo.bookmarks.exception.NotFoundException;
package com.mageddo.bookmarks.service;
@Singleton
public class SettingsService {
| private final SettingsDAO settingsDAO; |
mageddo/bookmark-notes | src/main/java/com/mageddo/bookmarks/service/SettingsService.java | // Path: src/main/java/com/mageddo/bookmarks/dao/SettingsDAO.java
// public interface SettingsDAO {
//
// List<SettingEntity> findAll();
//
// SettingEntity find(String key);
//
// void patch(SettingEntity settingEntity);
// }
//
// Path: src/main/java/com/mageddo/bookmarks/entity/SettingEntity.java
// public class SettingEntity {
//
// private String key;
// private String value;
//
// @JsonIgnore
// private LocalDateTime update;
//
// public static RowMapper<SettingEntity> mapper() {
// return (rs, rowNum) -> {
// return new SettingEntity().setUpdate(JdbcHelper.getLocalDateTime(rs, "DAT_UPDATE"))
// .setValue(rs.getString("DES_VALUE"))
// .setKey(rs.getString("NAM_PROPERTY"));
// };
// }
//
// public String getValue() {
// return value;
// }
//
// public SettingEntity setValue(String value) {
// this.value = value;
// return this;
// }
//
// public String getKey() {
// return key;
// }
//
// public SettingEntity setKey(String key) {
// this.key = key;
// return this;
// }
//
// public LocalDateTime getUpdate() {
// return update;
// }
//
// public SettingEntity setUpdate(LocalDateTime update) {
// this.update = update;
// return this;
// }
//
// public enum Setting {
//
// CODE_BLOCK_MAX_HEIGHT, //
// MOBILE_CODE_BLOCK_MAX_HEIGHT, //
// CODE_STYLE_TAB_SIZE, //
// CODE_STYLE_TAB_STYLE, //
// CODE_STYLE_SHOW_WHITESPACES, //
//
// /**
// * HTML which should be put inside the <head> tag
// */
// PUBLIC_PAGES_HEADER_HTML, //
// ;
// }
// }
//
// Path: src/main/java/com/mageddo/bookmarks/exception/NotFoundException.java
// public class NotFoundException extends RuntimeException {
// public NotFoundException(String message) {
// super(message);
// }
// }
| import java.time.LocalDateTime;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import javax.inject.Singleton;
import com.mageddo.bookmarks.dao.SettingsDAO;
import com.mageddo.bookmarks.entity.SettingEntity;
import com.mageddo.bookmarks.exception.NotFoundException; | package com.mageddo.bookmarks.service;
@Singleton
public class SettingsService {
private final SettingsDAO settingsDAO;
public SettingsService(SettingsDAO settingsDAO) {
this.settingsDAO = settingsDAO;
}
public Map<String, String> findAllAsMap() { | // Path: src/main/java/com/mageddo/bookmarks/dao/SettingsDAO.java
// public interface SettingsDAO {
//
// List<SettingEntity> findAll();
//
// SettingEntity find(String key);
//
// void patch(SettingEntity settingEntity);
// }
//
// Path: src/main/java/com/mageddo/bookmarks/entity/SettingEntity.java
// public class SettingEntity {
//
// private String key;
// private String value;
//
// @JsonIgnore
// private LocalDateTime update;
//
// public static RowMapper<SettingEntity> mapper() {
// return (rs, rowNum) -> {
// return new SettingEntity().setUpdate(JdbcHelper.getLocalDateTime(rs, "DAT_UPDATE"))
// .setValue(rs.getString("DES_VALUE"))
// .setKey(rs.getString("NAM_PROPERTY"));
// };
// }
//
// public String getValue() {
// return value;
// }
//
// public SettingEntity setValue(String value) {
// this.value = value;
// return this;
// }
//
// public String getKey() {
// return key;
// }
//
// public SettingEntity setKey(String key) {
// this.key = key;
// return this;
// }
//
// public LocalDateTime getUpdate() {
// return update;
// }
//
// public SettingEntity setUpdate(LocalDateTime update) {
// this.update = update;
// return this;
// }
//
// public enum Setting {
//
// CODE_BLOCK_MAX_HEIGHT, //
// MOBILE_CODE_BLOCK_MAX_HEIGHT, //
// CODE_STYLE_TAB_SIZE, //
// CODE_STYLE_TAB_STYLE, //
// CODE_STYLE_SHOW_WHITESPACES, //
//
// /**
// * HTML which should be put inside the <head> tag
// */
// PUBLIC_PAGES_HEADER_HTML, //
// ;
// }
// }
//
// Path: src/main/java/com/mageddo/bookmarks/exception/NotFoundException.java
// public class NotFoundException extends RuntimeException {
// public NotFoundException(String message) {
// super(message);
// }
// }
// Path: src/main/java/com/mageddo/bookmarks/service/SettingsService.java
import java.time.LocalDateTime;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import javax.inject.Singleton;
import com.mageddo.bookmarks.dao.SettingsDAO;
import com.mageddo.bookmarks.entity.SettingEntity;
import com.mageddo.bookmarks.exception.NotFoundException;
package com.mageddo.bookmarks.service;
@Singleton
public class SettingsService {
private final SettingsDAO settingsDAO;
public SettingsService(SettingsDAO settingsDAO) {
this.settingsDAO = settingsDAO;
}
public Map<String, String> findAllAsMap() { | final List<SettingEntity> settings = settingsDAO.findAll(); |
mageddo/bookmark-notes | src/main/java/com/mageddo/bookmarks/service/SettingsService.java | // Path: src/main/java/com/mageddo/bookmarks/dao/SettingsDAO.java
// public interface SettingsDAO {
//
// List<SettingEntity> findAll();
//
// SettingEntity find(String key);
//
// void patch(SettingEntity settingEntity);
// }
//
// Path: src/main/java/com/mageddo/bookmarks/entity/SettingEntity.java
// public class SettingEntity {
//
// private String key;
// private String value;
//
// @JsonIgnore
// private LocalDateTime update;
//
// public static RowMapper<SettingEntity> mapper() {
// return (rs, rowNum) -> {
// return new SettingEntity().setUpdate(JdbcHelper.getLocalDateTime(rs, "DAT_UPDATE"))
// .setValue(rs.getString("DES_VALUE"))
// .setKey(rs.getString("NAM_PROPERTY"));
// };
// }
//
// public String getValue() {
// return value;
// }
//
// public SettingEntity setValue(String value) {
// this.value = value;
// return this;
// }
//
// public String getKey() {
// return key;
// }
//
// public SettingEntity setKey(String key) {
// this.key = key;
// return this;
// }
//
// public LocalDateTime getUpdate() {
// return update;
// }
//
// public SettingEntity setUpdate(LocalDateTime update) {
// this.update = update;
// return this;
// }
//
// public enum Setting {
//
// CODE_BLOCK_MAX_HEIGHT, //
// MOBILE_CODE_BLOCK_MAX_HEIGHT, //
// CODE_STYLE_TAB_SIZE, //
// CODE_STYLE_TAB_STYLE, //
// CODE_STYLE_SHOW_WHITESPACES, //
//
// /**
// * HTML which should be put inside the <head> tag
// */
// PUBLIC_PAGES_HEADER_HTML, //
// ;
// }
// }
//
// Path: src/main/java/com/mageddo/bookmarks/exception/NotFoundException.java
// public class NotFoundException extends RuntimeException {
// public NotFoundException(String message) {
// super(message);
// }
// }
| import java.time.LocalDateTime;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import javax.inject.Singleton;
import com.mageddo.bookmarks.dao.SettingsDAO;
import com.mageddo.bookmarks.entity.SettingEntity;
import com.mageddo.bookmarks.exception.NotFoundException; | package com.mageddo.bookmarks.service;
@Singleton
public class SettingsService {
private final SettingsDAO settingsDAO;
public SettingsService(SettingsDAO settingsDAO) {
this.settingsDAO = settingsDAO;
}
public Map<String, String> findAllAsMap() {
final List<SettingEntity> settings = settingsDAO.findAll();
final Map<String, String> settingsMap = new LinkedHashMap<>();
for (SettingEntity setting : settings) {
settingsMap.put(setting.getKey(), setting.getValue());
}
return settingsMap;
}
public List<SettingEntity> findAll() {
return settingsDAO.findAll();
}
public SettingEntity findSetting(String key) {
return settingsDAO.find(key);
}
public boolean patch(SettingEntity settingEntity) {
final SettingEntity dbSettingEntity = settingsDAO.find(settingEntity.getKey());
if (dbSettingEntity == null) { | // Path: src/main/java/com/mageddo/bookmarks/dao/SettingsDAO.java
// public interface SettingsDAO {
//
// List<SettingEntity> findAll();
//
// SettingEntity find(String key);
//
// void patch(SettingEntity settingEntity);
// }
//
// Path: src/main/java/com/mageddo/bookmarks/entity/SettingEntity.java
// public class SettingEntity {
//
// private String key;
// private String value;
//
// @JsonIgnore
// private LocalDateTime update;
//
// public static RowMapper<SettingEntity> mapper() {
// return (rs, rowNum) -> {
// return new SettingEntity().setUpdate(JdbcHelper.getLocalDateTime(rs, "DAT_UPDATE"))
// .setValue(rs.getString("DES_VALUE"))
// .setKey(rs.getString("NAM_PROPERTY"));
// };
// }
//
// public String getValue() {
// return value;
// }
//
// public SettingEntity setValue(String value) {
// this.value = value;
// return this;
// }
//
// public String getKey() {
// return key;
// }
//
// public SettingEntity setKey(String key) {
// this.key = key;
// return this;
// }
//
// public LocalDateTime getUpdate() {
// return update;
// }
//
// public SettingEntity setUpdate(LocalDateTime update) {
// this.update = update;
// return this;
// }
//
// public enum Setting {
//
// CODE_BLOCK_MAX_HEIGHT, //
// MOBILE_CODE_BLOCK_MAX_HEIGHT, //
// CODE_STYLE_TAB_SIZE, //
// CODE_STYLE_TAB_STYLE, //
// CODE_STYLE_SHOW_WHITESPACES, //
//
// /**
// * HTML which should be put inside the <head> tag
// */
// PUBLIC_PAGES_HEADER_HTML, //
// ;
// }
// }
//
// Path: src/main/java/com/mageddo/bookmarks/exception/NotFoundException.java
// public class NotFoundException extends RuntimeException {
// public NotFoundException(String message) {
// super(message);
// }
// }
// Path: src/main/java/com/mageddo/bookmarks/service/SettingsService.java
import java.time.LocalDateTime;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import javax.inject.Singleton;
import com.mageddo.bookmarks.dao.SettingsDAO;
import com.mageddo.bookmarks.entity.SettingEntity;
import com.mageddo.bookmarks.exception.NotFoundException;
package com.mageddo.bookmarks.service;
@Singleton
public class SettingsService {
private final SettingsDAO settingsDAO;
public SettingsService(SettingsDAO settingsDAO) {
this.settingsDAO = settingsDAO;
}
public Map<String, String> findAllAsMap() {
final List<SettingEntity> settings = settingsDAO.findAll();
final Map<String, String> settingsMap = new LinkedHashMap<>();
for (SettingEntity setting : settings) {
settingsMap.put(setting.getKey(), setting.getValue());
}
return settingsMap;
}
public List<SettingEntity> findAll() {
return settingsDAO.findAll();
}
public SettingEntity findSetting(String key) {
return settingsDAO.find(key);
}
public boolean patch(SettingEntity settingEntity) {
final SettingEntity dbSettingEntity = settingsDAO.find(settingEntity.getKey());
if (dbSettingEntity == null) { | throw new NotFoundException(String.format("parameter doesn't exists %s", settingEntity.getKey())); |
mageddo/bookmark-notes | src/test/java/com/mageddo/config/DatabaseConfiguratorExtension.java | // Path: src/main/java/com/mageddo/config/ApplicationContextUtils.java
// public static ApplicationContext context() {
// return context;
// }
| import org.junit.jupiter.api.extension.BeforeTestExecutionCallback;
import org.junit.jupiter.api.extension.ExtensionContext;
import org.junit.jupiter.api.extension.TestInstancePostProcessor;
import org.junit.platform.commons.support.AnnotationSupport;
import io.micronaut.test.annotation.MicronautTest;
import static com.mageddo.config.ApplicationContextUtils.context; | package com.mageddo.config;
public class DatabaseConfiguratorExtension implements TestInstancePostProcessor, BeforeTestExecutionCallback {
@Override
public void postProcessTestInstance(Object o, ExtensionContext extensionContext) throws Exception {
AnnotationSupport.findAnnotation(extensionContext.getRequiredTestClass(), MicronautTest.class);
}
@Override
public void beforeTestExecution(ExtensionContext extensionContext) throws Exception { | // Path: src/main/java/com/mageddo/config/ApplicationContextUtils.java
// public static ApplicationContext context() {
// return context;
// }
// Path: src/test/java/com/mageddo/config/DatabaseConfiguratorExtension.java
import org.junit.jupiter.api.extension.BeforeTestExecutionCallback;
import org.junit.jupiter.api.extension.ExtensionContext;
import org.junit.jupiter.api.extension.TestInstancePostProcessor;
import org.junit.platform.commons.support.AnnotationSupport;
import io.micronaut.test.annotation.MicronautTest;
import static com.mageddo.config.ApplicationContextUtils.context;
package com.mageddo.config;
public class DatabaseConfiguratorExtension implements TestInstancePostProcessor, BeforeTestExecutionCallback {
@Override
public void postProcessTestInstance(Object o, ExtensionContext extensionContext) throws Exception {
AnnotationSupport.findAnnotation(extensionContext.getRequiredTestClass(), MicronautTest.class);
}
@Override
public void beforeTestExecution(ExtensionContext extensionContext) throws Exception { | final DatabaseConfigurator databaseConfigurator = context().getBean(DatabaseConfigurator.class); |
g0dkar/ajuda-ai | ajuda.ai/backend/src/main/java/ajuda/ai/backend/v1/institution/InstitutionPostList.java | // Path: ajuda.ai/model/src/main/java/ajuda/ai/model/institution/InstitutionPost.java
// @Entity
// @Table(indexes = { @Index(name = "unique_post_per_institution", unique = true, columnList = "slug, institution") })
// public class InstitutionPost extends Page implements Serializable {
// /** Serial Version UID */
// private static final long serialVersionUID = 1L;
//
// @NotNull
// @ManyToOne(optional = false, fetch = FetchType.LAZY)
// private Institution institution;
//
// public Institution getInstitution() {
// return institution;
// }
//
// public void setInstitution(final Institution institution) {
// this.institution = institution;
// }
// }
| import java.util.List;
import ajuda.ai.model.institution.InstitutionPost;
| package ajuda.ai.backend.v1.institution;
public class InstitutionPostList {
private int total;
private int offset;
private int pageSize;
| // Path: ajuda.ai/model/src/main/java/ajuda/ai/model/institution/InstitutionPost.java
// @Entity
// @Table(indexes = { @Index(name = "unique_post_per_institution", unique = true, columnList = "slug, institution") })
// public class InstitutionPost extends Page implements Serializable {
// /** Serial Version UID */
// private static final long serialVersionUID = 1L;
//
// @NotNull
// @ManyToOne(optional = false, fetch = FetchType.LAZY)
// private Institution institution;
//
// public Institution getInstitution() {
// return institution;
// }
//
// public void setInstitution(final Institution institution) {
// this.institution = institution;
// }
// }
// Path: ajuda.ai/backend/src/main/java/ajuda/ai/backend/v1/institution/InstitutionPostList.java
import java.util.List;
import ajuda.ai.model.institution.InstitutionPost;
package ajuda.ai.backend.v1.institution;
public class InstitutionPostList {
private int total;
private int offset;
private int pageSize;
| private List<InstitutionPost> posts;
|
g0dkar/ajuda-ai | ajuda.ai/backend/src/main/java/ajuda/ai/backend/v1/institution/InstitutionDashboardData.java | // Path: ajuda.ai/model/src/main/java/ajuda/ai/model/institution/Institution.java
// @Entity
// public class Institution implements Serializable {
// /** Serial Version UID */
// private static final long serialVersionUID = 1L;
//
// @Id @GeneratedValue(strategy = GenerationType.IDENTITY)
// private Long id;
//
// /** "Endereço" desta entidade. Se {@code exemplo} for o slug podemos ter algo como {@code https://ajuda.ai/exemplo} */
// @NotBlank
// @Size(min = 2, max = 64)
// @Column(nullable = false, unique = true, length = 64)
// @Pattern(regexp = "[a-z][a-z0-9\\-]*[a-z0-9]")
// private String slug;
//
// @Embedded
// private CreationInfo creation;
//
// @NotBlank
// @Size(max = 64)
// @Column(nullable = false, length = 64)
// private String name;
//
// @NotBlank
// @Size(max = 65535)
// @Column(nullable = false, columnDefinition = "MEDIUMTEXT")
// private String description;
//
// @NotNull
// @Column(nullable = false, length = 16)
// private String paymentService;
//
// @URL
// @Column(length = 1024)
// private String logo;
//
// @URL
// @Column(length = 1024)
// private String banner;
//
// @Column(name = "value", length = 512)
// @ElementCollection(fetch = FetchType.EAGER)
// @MapKeyColumn(name = "attribute", length = 24)
// @JoinTable(name = "institution_attributes", joinColumns = @JoinColumn(name = "id"))
// private Map<String, String> attributes;
//
// public Long getId() {
// return id;
// }
//
// public void setId(final Long id) {
// this.id = id;
// }
//
// public String getSlug() {
// return slug;
// }
//
// public void setSlug(final String slug) {
// this.slug = slug != null ? slug.toLowerCase() : null;
// }
//
// public CreationInfo getCreation() {
// return creation;
// }
//
// public void setCreation(final CreationInfo creation) {
// this.creation = creation;
// }
//
// public String getName() {
// return name;
// }
//
// public void setName(final String name) {
// this.name = name;
// }
//
// public String getDescription() {
// return description;
// }
//
// public String getDescriptionMarkdown() {
// return StringUtils.markdown(description);
// }
//
// public void setDescription(final String description) {
// this.description = description;
// }
//
// public String getPaymentService() {
// return paymentService;
// }
//
// public void setPaymentService(final String paymentService) {
// this.paymentService = paymentService;
// }
//
// public String getLogo() {
// return logo;
// }
//
// public void setLogo(final String logo) {
// this.logo = logo;
// }
//
// public String getBanner() {
// return banner;
// }
//
// public void setBanner(final String banner) {
// this.banner = banner;
// }
//
// public String toJson() {
// return JsonUtils.toJsonExposed(this);
// }
//
// public Map<String, String> getAttributes() {
// return attributes;
// }
//
// public String attributeMarkdown(final String attribute) {
// return StringUtils.markdown(attributes.get(attribute));
// }
//
// public void setAttributes(final Map<String, String> attributes) {
// this.attributes = attributes;
// }
// }
| import java.util.List;
import ajuda.ai.model.institution.Institution;
| package ajuda.ai.backend.v1.institution;
/**
* POJO para facilitar o envio dos dados do Dashboard do Ajuda.Ai
*
* @author Rafael Lins
*
*/
public class InstitutionDashboardData {
private int donations;
private int value;
private int helpers;
private int maxValue;
private int meanValue;
private int institutionCount;
| // Path: ajuda.ai/model/src/main/java/ajuda/ai/model/institution/Institution.java
// @Entity
// public class Institution implements Serializable {
// /** Serial Version UID */
// private static final long serialVersionUID = 1L;
//
// @Id @GeneratedValue(strategy = GenerationType.IDENTITY)
// private Long id;
//
// /** "Endereço" desta entidade. Se {@code exemplo} for o slug podemos ter algo como {@code https://ajuda.ai/exemplo} */
// @NotBlank
// @Size(min = 2, max = 64)
// @Column(nullable = false, unique = true, length = 64)
// @Pattern(regexp = "[a-z][a-z0-9\\-]*[a-z0-9]")
// private String slug;
//
// @Embedded
// private CreationInfo creation;
//
// @NotBlank
// @Size(max = 64)
// @Column(nullable = false, length = 64)
// private String name;
//
// @NotBlank
// @Size(max = 65535)
// @Column(nullable = false, columnDefinition = "MEDIUMTEXT")
// private String description;
//
// @NotNull
// @Column(nullable = false, length = 16)
// private String paymentService;
//
// @URL
// @Column(length = 1024)
// private String logo;
//
// @URL
// @Column(length = 1024)
// private String banner;
//
// @Column(name = "value", length = 512)
// @ElementCollection(fetch = FetchType.EAGER)
// @MapKeyColumn(name = "attribute", length = 24)
// @JoinTable(name = "institution_attributes", joinColumns = @JoinColumn(name = "id"))
// private Map<String, String> attributes;
//
// public Long getId() {
// return id;
// }
//
// public void setId(final Long id) {
// this.id = id;
// }
//
// public String getSlug() {
// return slug;
// }
//
// public void setSlug(final String slug) {
// this.slug = slug != null ? slug.toLowerCase() : null;
// }
//
// public CreationInfo getCreation() {
// return creation;
// }
//
// public void setCreation(final CreationInfo creation) {
// this.creation = creation;
// }
//
// public String getName() {
// return name;
// }
//
// public void setName(final String name) {
// this.name = name;
// }
//
// public String getDescription() {
// return description;
// }
//
// public String getDescriptionMarkdown() {
// return StringUtils.markdown(description);
// }
//
// public void setDescription(final String description) {
// this.description = description;
// }
//
// public String getPaymentService() {
// return paymentService;
// }
//
// public void setPaymentService(final String paymentService) {
// this.paymentService = paymentService;
// }
//
// public String getLogo() {
// return logo;
// }
//
// public void setLogo(final String logo) {
// this.logo = logo;
// }
//
// public String getBanner() {
// return banner;
// }
//
// public void setBanner(final String banner) {
// this.banner = banner;
// }
//
// public String toJson() {
// return JsonUtils.toJsonExposed(this);
// }
//
// public Map<String, String> getAttributes() {
// return attributes;
// }
//
// public String attributeMarkdown(final String attribute) {
// return StringUtils.markdown(attributes.get(attribute));
// }
//
// public void setAttributes(final Map<String, String> attributes) {
// this.attributes = attributes;
// }
// }
// Path: ajuda.ai/backend/src/main/java/ajuda/ai/backend/v1/institution/InstitutionDashboardData.java
import java.util.List;
import ajuda.ai.model.institution.Institution;
package ajuda.ai.backend.v1.institution;
/**
* POJO para facilitar o envio dos dados do Dashboard do Ajuda.Ai
*
* @author Rafael Lins
*
*/
public class InstitutionDashboardData {
private int donations;
private int value;
private int helpers;
private int maxValue;
private int meanValue;
private int institutionCount;
| private List<Institution> institutions;
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.