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
lkorth/photo-paper
PhotoPaper/src/main/java/com/lukekorth/photo_paper/api/FiveHundredPxClient.java
// Path: PhotoPaper/src/main/java/com/lukekorth/photo_paper/models/ApiResponse.java // public class ApiResponse { // } // // Path: PhotoPaper/src/main/java/com/lukekorth/photo_paper/models/GalleryResponse.java // public class GalleryResponse { // // @Expose public List<Gallery> galleries; // // public class Gallery { // // @Expose public String id; // @Expose public String name; // } // } // // Path: PhotoPaper/src/main/java/com/lukekorth/photo_paper/models/PhotoGalleryRequest.java // public class PhotoGalleryRequest { // // @Expose private Add add; // @Expose private Remove remove; // // public static PhotoGalleryRequest add(String photoId) { // PhotoGalleryRequest photoGalleryRequest = new PhotoGalleryRequest(); // photoGalleryRequest.add = new Add(photoId); // return photoGalleryRequest; // } // // public static PhotoGalleryRequest remove(String photoId) { // PhotoGalleryRequest photoGalleryRequest = new PhotoGalleryRequest(); // photoGalleryRequest.remove = new Remove(photoId); // return photoGalleryRequest; // } // // private static class Add { // // @Expose private List<String> photos; // // private Add(String photoId) { // photos = Collections.singletonList(photoId); // } // } // // private static class Remove { // // @Expose private List<String> photos; // // private Remove(String photoId) { // photos = Collections.singletonList(photoId); // } // } // } // // Path: PhotoPaper/src/main/java/com/lukekorth/photo_paper/models/PhotoResponse.java // public class PhotoResponse { // // @Expose public Photo photo; // } // // Path: PhotoPaper/src/main/java/com/lukekorth/photo_paper/models/PhotosResponse.java // public class PhotosResponse { // // @Expose public String feature; // @Expose @SerializedName("current_page") public int currentPage; // @Expose @SerializedName("total_pages") public int totalPages; // @Expose public Photo[] photos; // } // // Path: PhotoPaper/src/main/java/com/lukekorth/photo_paper/models/SearchResult.java // public class SearchResult { // // @Expose public List<Photo> photos; // } // // Path: PhotoPaper/src/main/java/com/lukekorth/photo_paper/models/UsersResponse.java // public class UsersResponse { // // @Expose public User user; // }
import com.lukekorth.photo_paper.models.ApiResponse; import com.lukekorth.photo_paper.models.GalleryResponse; import com.lukekorth.photo_paper.models.PhotoGalleryRequest; import com.lukekorth.photo_paper.models.PhotoResponse; import com.lukekorth.photo_paper.models.PhotosResponse; import com.lukekorth.photo_paper.models.SearchResult; import com.lukekorth.photo_paper.models.UsersResponse; import retrofit2.Call; import retrofit2.http.Body; import retrofit2.http.DELETE; import retrofit2.http.GET; import retrofit2.http.POST; import retrofit2.http.PUT; import retrofit2.http.Path; import retrofit2.http.Query;
package com.lukekorth.photo_paper.api; public interface FiveHundredPxClient { @GET("users") Call<UsersResponse> users(); @GET("photos/{id}")
// Path: PhotoPaper/src/main/java/com/lukekorth/photo_paper/models/ApiResponse.java // public class ApiResponse { // } // // Path: PhotoPaper/src/main/java/com/lukekorth/photo_paper/models/GalleryResponse.java // public class GalleryResponse { // // @Expose public List<Gallery> galleries; // // public class Gallery { // // @Expose public String id; // @Expose public String name; // } // } // // Path: PhotoPaper/src/main/java/com/lukekorth/photo_paper/models/PhotoGalleryRequest.java // public class PhotoGalleryRequest { // // @Expose private Add add; // @Expose private Remove remove; // // public static PhotoGalleryRequest add(String photoId) { // PhotoGalleryRequest photoGalleryRequest = new PhotoGalleryRequest(); // photoGalleryRequest.add = new Add(photoId); // return photoGalleryRequest; // } // // public static PhotoGalleryRequest remove(String photoId) { // PhotoGalleryRequest photoGalleryRequest = new PhotoGalleryRequest(); // photoGalleryRequest.remove = new Remove(photoId); // return photoGalleryRequest; // } // // private static class Add { // // @Expose private List<String> photos; // // private Add(String photoId) { // photos = Collections.singletonList(photoId); // } // } // // private static class Remove { // // @Expose private List<String> photos; // // private Remove(String photoId) { // photos = Collections.singletonList(photoId); // } // } // } // // Path: PhotoPaper/src/main/java/com/lukekorth/photo_paper/models/PhotoResponse.java // public class PhotoResponse { // // @Expose public Photo photo; // } // // Path: PhotoPaper/src/main/java/com/lukekorth/photo_paper/models/PhotosResponse.java // public class PhotosResponse { // // @Expose public String feature; // @Expose @SerializedName("current_page") public int currentPage; // @Expose @SerializedName("total_pages") public int totalPages; // @Expose public Photo[] photos; // } // // Path: PhotoPaper/src/main/java/com/lukekorth/photo_paper/models/SearchResult.java // public class SearchResult { // // @Expose public List<Photo> photos; // } // // Path: PhotoPaper/src/main/java/com/lukekorth/photo_paper/models/UsersResponse.java // public class UsersResponse { // // @Expose public User user; // } // Path: PhotoPaper/src/main/java/com/lukekorth/photo_paper/api/FiveHundredPxClient.java import com.lukekorth.photo_paper.models.ApiResponse; import com.lukekorth.photo_paper.models.GalleryResponse; import com.lukekorth.photo_paper.models.PhotoGalleryRequest; import com.lukekorth.photo_paper.models.PhotoResponse; import com.lukekorth.photo_paper.models.PhotosResponse; import com.lukekorth.photo_paper.models.SearchResult; import com.lukekorth.photo_paper.models.UsersResponse; import retrofit2.Call; import retrofit2.http.Body; import retrofit2.http.DELETE; import retrofit2.http.GET; import retrofit2.http.POST; import retrofit2.http.PUT; import retrofit2.http.Path; import retrofit2.http.Query; package com.lukekorth.photo_paper.api; public interface FiveHundredPxClient { @GET("users") Call<UsersResponse> users(); @GET("photos/{id}")
Call<PhotoResponse> photo(@Path("id") String id);
lkorth/photo-paper
PhotoPaper/src/main/java/com/lukekorth/photo_paper/api/FiveHundredPxClient.java
// Path: PhotoPaper/src/main/java/com/lukekorth/photo_paper/models/ApiResponse.java // public class ApiResponse { // } // // Path: PhotoPaper/src/main/java/com/lukekorth/photo_paper/models/GalleryResponse.java // public class GalleryResponse { // // @Expose public List<Gallery> galleries; // // public class Gallery { // // @Expose public String id; // @Expose public String name; // } // } // // Path: PhotoPaper/src/main/java/com/lukekorth/photo_paper/models/PhotoGalleryRequest.java // public class PhotoGalleryRequest { // // @Expose private Add add; // @Expose private Remove remove; // // public static PhotoGalleryRequest add(String photoId) { // PhotoGalleryRequest photoGalleryRequest = new PhotoGalleryRequest(); // photoGalleryRequest.add = new Add(photoId); // return photoGalleryRequest; // } // // public static PhotoGalleryRequest remove(String photoId) { // PhotoGalleryRequest photoGalleryRequest = new PhotoGalleryRequest(); // photoGalleryRequest.remove = new Remove(photoId); // return photoGalleryRequest; // } // // private static class Add { // // @Expose private List<String> photos; // // private Add(String photoId) { // photos = Collections.singletonList(photoId); // } // } // // private static class Remove { // // @Expose private List<String> photos; // // private Remove(String photoId) { // photos = Collections.singletonList(photoId); // } // } // } // // Path: PhotoPaper/src/main/java/com/lukekorth/photo_paper/models/PhotoResponse.java // public class PhotoResponse { // // @Expose public Photo photo; // } // // Path: PhotoPaper/src/main/java/com/lukekorth/photo_paper/models/PhotosResponse.java // public class PhotosResponse { // // @Expose public String feature; // @Expose @SerializedName("current_page") public int currentPage; // @Expose @SerializedName("total_pages") public int totalPages; // @Expose public Photo[] photos; // } // // Path: PhotoPaper/src/main/java/com/lukekorth/photo_paper/models/SearchResult.java // public class SearchResult { // // @Expose public List<Photo> photos; // } // // Path: PhotoPaper/src/main/java/com/lukekorth/photo_paper/models/UsersResponse.java // public class UsersResponse { // // @Expose public User user; // }
import com.lukekorth.photo_paper.models.ApiResponse; import com.lukekorth.photo_paper.models.GalleryResponse; import com.lukekorth.photo_paper.models.PhotoGalleryRequest; import com.lukekorth.photo_paper.models.PhotoResponse; import com.lukekorth.photo_paper.models.PhotosResponse; import com.lukekorth.photo_paper.models.SearchResult; import com.lukekorth.photo_paper.models.UsersResponse; import retrofit2.Call; import retrofit2.http.Body; import retrofit2.http.DELETE; import retrofit2.http.GET; import retrofit2.http.POST; import retrofit2.http.PUT; import retrofit2.http.Path; import retrofit2.http.Query;
package com.lukekorth.photo_paper.api; public interface FiveHundredPxClient { @GET("users") Call<UsersResponse> users(); @GET("photos/{id}") Call<PhotoResponse> photo(@Path("id") String id); @GET("photos/search?image_size=2&rpp=100")
// Path: PhotoPaper/src/main/java/com/lukekorth/photo_paper/models/ApiResponse.java // public class ApiResponse { // } // // Path: PhotoPaper/src/main/java/com/lukekorth/photo_paper/models/GalleryResponse.java // public class GalleryResponse { // // @Expose public List<Gallery> galleries; // // public class Gallery { // // @Expose public String id; // @Expose public String name; // } // } // // Path: PhotoPaper/src/main/java/com/lukekorth/photo_paper/models/PhotoGalleryRequest.java // public class PhotoGalleryRequest { // // @Expose private Add add; // @Expose private Remove remove; // // public static PhotoGalleryRequest add(String photoId) { // PhotoGalleryRequest photoGalleryRequest = new PhotoGalleryRequest(); // photoGalleryRequest.add = new Add(photoId); // return photoGalleryRequest; // } // // public static PhotoGalleryRequest remove(String photoId) { // PhotoGalleryRequest photoGalleryRequest = new PhotoGalleryRequest(); // photoGalleryRequest.remove = new Remove(photoId); // return photoGalleryRequest; // } // // private static class Add { // // @Expose private List<String> photos; // // private Add(String photoId) { // photos = Collections.singletonList(photoId); // } // } // // private static class Remove { // // @Expose private List<String> photos; // // private Remove(String photoId) { // photos = Collections.singletonList(photoId); // } // } // } // // Path: PhotoPaper/src/main/java/com/lukekorth/photo_paper/models/PhotoResponse.java // public class PhotoResponse { // // @Expose public Photo photo; // } // // Path: PhotoPaper/src/main/java/com/lukekorth/photo_paper/models/PhotosResponse.java // public class PhotosResponse { // // @Expose public String feature; // @Expose @SerializedName("current_page") public int currentPage; // @Expose @SerializedName("total_pages") public int totalPages; // @Expose public Photo[] photos; // } // // Path: PhotoPaper/src/main/java/com/lukekorth/photo_paper/models/SearchResult.java // public class SearchResult { // // @Expose public List<Photo> photos; // } // // Path: PhotoPaper/src/main/java/com/lukekorth/photo_paper/models/UsersResponse.java // public class UsersResponse { // // @Expose public User user; // } // Path: PhotoPaper/src/main/java/com/lukekorth/photo_paper/api/FiveHundredPxClient.java import com.lukekorth.photo_paper.models.ApiResponse; import com.lukekorth.photo_paper.models.GalleryResponse; import com.lukekorth.photo_paper.models.PhotoGalleryRequest; import com.lukekorth.photo_paper.models.PhotoResponse; import com.lukekorth.photo_paper.models.PhotosResponse; import com.lukekorth.photo_paper.models.SearchResult; import com.lukekorth.photo_paper.models.UsersResponse; import retrofit2.Call; import retrofit2.http.Body; import retrofit2.http.DELETE; import retrofit2.http.GET; import retrofit2.http.POST; import retrofit2.http.PUT; import retrofit2.http.Path; import retrofit2.http.Query; package com.lukekorth.photo_paper.api; public interface FiveHundredPxClient { @GET("users") Call<UsersResponse> users(); @GET("photos/{id}") Call<PhotoResponse> photo(@Path("id") String id); @GET("photos/search?image_size=2&rpp=100")
Call<SearchResult> search(@Query("term") String term);
lkorth/photo-paper
PhotoPaper/src/main/java/com/lukekorth/photo_paper/api/FiveHundredPxClient.java
// Path: PhotoPaper/src/main/java/com/lukekorth/photo_paper/models/ApiResponse.java // public class ApiResponse { // } // // Path: PhotoPaper/src/main/java/com/lukekorth/photo_paper/models/GalleryResponse.java // public class GalleryResponse { // // @Expose public List<Gallery> galleries; // // public class Gallery { // // @Expose public String id; // @Expose public String name; // } // } // // Path: PhotoPaper/src/main/java/com/lukekorth/photo_paper/models/PhotoGalleryRequest.java // public class PhotoGalleryRequest { // // @Expose private Add add; // @Expose private Remove remove; // // public static PhotoGalleryRequest add(String photoId) { // PhotoGalleryRequest photoGalleryRequest = new PhotoGalleryRequest(); // photoGalleryRequest.add = new Add(photoId); // return photoGalleryRequest; // } // // public static PhotoGalleryRequest remove(String photoId) { // PhotoGalleryRequest photoGalleryRequest = new PhotoGalleryRequest(); // photoGalleryRequest.remove = new Remove(photoId); // return photoGalleryRequest; // } // // private static class Add { // // @Expose private List<String> photos; // // private Add(String photoId) { // photos = Collections.singletonList(photoId); // } // } // // private static class Remove { // // @Expose private List<String> photos; // // private Remove(String photoId) { // photos = Collections.singletonList(photoId); // } // } // } // // Path: PhotoPaper/src/main/java/com/lukekorth/photo_paper/models/PhotoResponse.java // public class PhotoResponse { // // @Expose public Photo photo; // } // // Path: PhotoPaper/src/main/java/com/lukekorth/photo_paper/models/PhotosResponse.java // public class PhotosResponse { // // @Expose public String feature; // @Expose @SerializedName("current_page") public int currentPage; // @Expose @SerializedName("total_pages") public int totalPages; // @Expose public Photo[] photos; // } // // Path: PhotoPaper/src/main/java/com/lukekorth/photo_paper/models/SearchResult.java // public class SearchResult { // // @Expose public List<Photo> photos; // } // // Path: PhotoPaper/src/main/java/com/lukekorth/photo_paper/models/UsersResponse.java // public class UsersResponse { // // @Expose public User user; // }
import com.lukekorth.photo_paper.models.ApiResponse; import com.lukekorth.photo_paper.models.GalleryResponse; import com.lukekorth.photo_paper.models.PhotoGalleryRequest; import com.lukekorth.photo_paper.models.PhotoResponse; import com.lukekorth.photo_paper.models.PhotosResponse; import com.lukekorth.photo_paper.models.SearchResult; import com.lukekorth.photo_paper.models.UsersResponse; import retrofit2.Call; import retrofit2.http.Body; import retrofit2.http.DELETE; import retrofit2.http.GET; import retrofit2.http.POST; import retrofit2.http.PUT; import retrofit2.http.Path; import retrofit2.http.Query;
package com.lukekorth.photo_paper.api; public interface FiveHundredPxClient { @GET("users") Call<UsersResponse> users(); @GET("photos/{id}") Call<PhotoResponse> photo(@Path("id") String id); @GET("photos/search?image_size=2&rpp=100") Call<SearchResult> search(@Query("term") String term); @GET("photos/search?image_size=2048&rpp100")
// Path: PhotoPaper/src/main/java/com/lukekorth/photo_paper/models/ApiResponse.java // public class ApiResponse { // } // // Path: PhotoPaper/src/main/java/com/lukekorth/photo_paper/models/GalleryResponse.java // public class GalleryResponse { // // @Expose public List<Gallery> galleries; // // public class Gallery { // // @Expose public String id; // @Expose public String name; // } // } // // Path: PhotoPaper/src/main/java/com/lukekorth/photo_paper/models/PhotoGalleryRequest.java // public class PhotoGalleryRequest { // // @Expose private Add add; // @Expose private Remove remove; // // public static PhotoGalleryRequest add(String photoId) { // PhotoGalleryRequest photoGalleryRequest = new PhotoGalleryRequest(); // photoGalleryRequest.add = new Add(photoId); // return photoGalleryRequest; // } // // public static PhotoGalleryRequest remove(String photoId) { // PhotoGalleryRequest photoGalleryRequest = new PhotoGalleryRequest(); // photoGalleryRequest.remove = new Remove(photoId); // return photoGalleryRequest; // } // // private static class Add { // // @Expose private List<String> photos; // // private Add(String photoId) { // photos = Collections.singletonList(photoId); // } // } // // private static class Remove { // // @Expose private List<String> photos; // // private Remove(String photoId) { // photos = Collections.singletonList(photoId); // } // } // } // // Path: PhotoPaper/src/main/java/com/lukekorth/photo_paper/models/PhotoResponse.java // public class PhotoResponse { // // @Expose public Photo photo; // } // // Path: PhotoPaper/src/main/java/com/lukekorth/photo_paper/models/PhotosResponse.java // public class PhotosResponse { // // @Expose public String feature; // @Expose @SerializedName("current_page") public int currentPage; // @Expose @SerializedName("total_pages") public int totalPages; // @Expose public Photo[] photos; // } // // Path: PhotoPaper/src/main/java/com/lukekorth/photo_paper/models/SearchResult.java // public class SearchResult { // // @Expose public List<Photo> photos; // } // // Path: PhotoPaper/src/main/java/com/lukekorth/photo_paper/models/UsersResponse.java // public class UsersResponse { // // @Expose public User user; // } // Path: PhotoPaper/src/main/java/com/lukekorth/photo_paper/api/FiveHundredPxClient.java import com.lukekorth.photo_paper.models.ApiResponse; import com.lukekorth.photo_paper.models.GalleryResponse; import com.lukekorth.photo_paper.models.PhotoGalleryRequest; import com.lukekorth.photo_paper.models.PhotoResponse; import com.lukekorth.photo_paper.models.PhotosResponse; import com.lukekorth.photo_paper.models.SearchResult; import com.lukekorth.photo_paper.models.UsersResponse; import retrofit2.Call; import retrofit2.http.Body; import retrofit2.http.DELETE; import retrofit2.http.GET; import retrofit2.http.POST; import retrofit2.http.PUT; import retrofit2.http.Path; import retrofit2.http.Query; package com.lukekorth.photo_paper.api; public interface FiveHundredPxClient { @GET("users") Call<UsersResponse> users(); @GET("photos/{id}") Call<PhotoResponse> photo(@Path("id") String id); @GET("photos/search?image_size=2&rpp=100") Call<SearchResult> search(@Query("term") String term); @GET("photos/search?image_size=2048&rpp100")
Call<PhotosResponse> getPhotosFromSearch(@Query("term") String term, @Query("categories") String categories, @Query("page") int page);
lkorth/photo-paper
PhotoPaper/src/main/java/com/lukekorth/photo_paper/api/FiveHundredPxClient.java
// Path: PhotoPaper/src/main/java/com/lukekorth/photo_paper/models/ApiResponse.java // public class ApiResponse { // } // // Path: PhotoPaper/src/main/java/com/lukekorth/photo_paper/models/GalleryResponse.java // public class GalleryResponse { // // @Expose public List<Gallery> galleries; // // public class Gallery { // // @Expose public String id; // @Expose public String name; // } // } // // Path: PhotoPaper/src/main/java/com/lukekorth/photo_paper/models/PhotoGalleryRequest.java // public class PhotoGalleryRequest { // // @Expose private Add add; // @Expose private Remove remove; // // public static PhotoGalleryRequest add(String photoId) { // PhotoGalleryRequest photoGalleryRequest = new PhotoGalleryRequest(); // photoGalleryRequest.add = new Add(photoId); // return photoGalleryRequest; // } // // public static PhotoGalleryRequest remove(String photoId) { // PhotoGalleryRequest photoGalleryRequest = new PhotoGalleryRequest(); // photoGalleryRequest.remove = new Remove(photoId); // return photoGalleryRequest; // } // // private static class Add { // // @Expose private List<String> photos; // // private Add(String photoId) { // photos = Collections.singletonList(photoId); // } // } // // private static class Remove { // // @Expose private List<String> photos; // // private Remove(String photoId) { // photos = Collections.singletonList(photoId); // } // } // } // // Path: PhotoPaper/src/main/java/com/lukekorth/photo_paper/models/PhotoResponse.java // public class PhotoResponse { // // @Expose public Photo photo; // } // // Path: PhotoPaper/src/main/java/com/lukekorth/photo_paper/models/PhotosResponse.java // public class PhotosResponse { // // @Expose public String feature; // @Expose @SerializedName("current_page") public int currentPage; // @Expose @SerializedName("total_pages") public int totalPages; // @Expose public Photo[] photos; // } // // Path: PhotoPaper/src/main/java/com/lukekorth/photo_paper/models/SearchResult.java // public class SearchResult { // // @Expose public List<Photo> photos; // } // // Path: PhotoPaper/src/main/java/com/lukekorth/photo_paper/models/UsersResponse.java // public class UsersResponse { // // @Expose public User user; // }
import com.lukekorth.photo_paper.models.ApiResponse; import com.lukekorth.photo_paper.models.GalleryResponse; import com.lukekorth.photo_paper.models.PhotoGalleryRequest; import com.lukekorth.photo_paper.models.PhotoResponse; import com.lukekorth.photo_paper.models.PhotosResponse; import com.lukekorth.photo_paper.models.SearchResult; import com.lukekorth.photo_paper.models.UsersResponse; import retrofit2.Call; import retrofit2.http.Body; import retrofit2.http.DELETE; import retrofit2.http.GET; import retrofit2.http.POST; import retrofit2.http.PUT; import retrofit2.http.Path; import retrofit2.http.Query;
package com.lukekorth.photo_paper.api; public interface FiveHundredPxClient { @GET("users") Call<UsersResponse> users(); @GET("photos/{id}") Call<PhotoResponse> photo(@Path("id") String id); @GET("photos/search?image_size=2&rpp=100") Call<SearchResult> search(@Query("term") String term); @GET("photos/search?image_size=2048&rpp100") Call<PhotosResponse> getPhotosFromSearch(@Query("term") String term, @Query("categories") String categories, @Query("page") int page); @GET("photos?image_size=2048&rpp=100") Call<PhotosResponse> getPhotos(@Query("feature") String feature, @Query("categories") String categories, @Query("page") int page); @GET("users/{user_id}/galleries/{gallery_id}/items?image_size=2048&rpp=100") Call<PhotosResponse> getFavorites(@Path("user_id") int userId, @Path("gallery_id") String galleryId, @Query("only") String categories, @Query("page") int page); @POST("photos/{id}/vote?vote=1") Call<PhotoResponse> like(@Path("id") String id); @DELETE("photos/{id}/vote") Call<PhotoResponse> unlike(@Path("id") String id); @PUT("users/{user_id}/galleries/{gallery_id}/items")
// Path: PhotoPaper/src/main/java/com/lukekorth/photo_paper/models/ApiResponse.java // public class ApiResponse { // } // // Path: PhotoPaper/src/main/java/com/lukekorth/photo_paper/models/GalleryResponse.java // public class GalleryResponse { // // @Expose public List<Gallery> galleries; // // public class Gallery { // // @Expose public String id; // @Expose public String name; // } // } // // Path: PhotoPaper/src/main/java/com/lukekorth/photo_paper/models/PhotoGalleryRequest.java // public class PhotoGalleryRequest { // // @Expose private Add add; // @Expose private Remove remove; // // public static PhotoGalleryRequest add(String photoId) { // PhotoGalleryRequest photoGalleryRequest = new PhotoGalleryRequest(); // photoGalleryRequest.add = new Add(photoId); // return photoGalleryRequest; // } // // public static PhotoGalleryRequest remove(String photoId) { // PhotoGalleryRequest photoGalleryRequest = new PhotoGalleryRequest(); // photoGalleryRequest.remove = new Remove(photoId); // return photoGalleryRequest; // } // // private static class Add { // // @Expose private List<String> photos; // // private Add(String photoId) { // photos = Collections.singletonList(photoId); // } // } // // private static class Remove { // // @Expose private List<String> photos; // // private Remove(String photoId) { // photos = Collections.singletonList(photoId); // } // } // } // // Path: PhotoPaper/src/main/java/com/lukekorth/photo_paper/models/PhotoResponse.java // public class PhotoResponse { // // @Expose public Photo photo; // } // // Path: PhotoPaper/src/main/java/com/lukekorth/photo_paper/models/PhotosResponse.java // public class PhotosResponse { // // @Expose public String feature; // @Expose @SerializedName("current_page") public int currentPage; // @Expose @SerializedName("total_pages") public int totalPages; // @Expose public Photo[] photos; // } // // Path: PhotoPaper/src/main/java/com/lukekorth/photo_paper/models/SearchResult.java // public class SearchResult { // // @Expose public List<Photo> photos; // } // // Path: PhotoPaper/src/main/java/com/lukekorth/photo_paper/models/UsersResponse.java // public class UsersResponse { // // @Expose public User user; // } // Path: PhotoPaper/src/main/java/com/lukekorth/photo_paper/api/FiveHundredPxClient.java import com.lukekorth.photo_paper.models.ApiResponse; import com.lukekorth.photo_paper.models.GalleryResponse; import com.lukekorth.photo_paper.models.PhotoGalleryRequest; import com.lukekorth.photo_paper.models.PhotoResponse; import com.lukekorth.photo_paper.models.PhotosResponse; import com.lukekorth.photo_paper.models.SearchResult; import com.lukekorth.photo_paper.models.UsersResponse; import retrofit2.Call; import retrofit2.http.Body; import retrofit2.http.DELETE; import retrofit2.http.GET; import retrofit2.http.POST; import retrofit2.http.PUT; import retrofit2.http.Path; import retrofit2.http.Query; package com.lukekorth.photo_paper.api; public interface FiveHundredPxClient { @GET("users") Call<UsersResponse> users(); @GET("photos/{id}") Call<PhotoResponse> photo(@Path("id") String id); @GET("photos/search?image_size=2&rpp=100") Call<SearchResult> search(@Query("term") String term); @GET("photos/search?image_size=2048&rpp100") Call<PhotosResponse> getPhotosFromSearch(@Query("term") String term, @Query("categories") String categories, @Query("page") int page); @GET("photos?image_size=2048&rpp=100") Call<PhotosResponse> getPhotos(@Query("feature") String feature, @Query("categories") String categories, @Query("page") int page); @GET("users/{user_id}/galleries/{gallery_id}/items?image_size=2048&rpp=100") Call<PhotosResponse> getFavorites(@Path("user_id") int userId, @Path("gallery_id") String galleryId, @Query("only") String categories, @Query("page") int page); @POST("photos/{id}/vote?vote=1") Call<PhotoResponse> like(@Path("id") String id); @DELETE("photos/{id}/vote") Call<PhotoResponse> unlike(@Path("id") String id); @PUT("users/{user_id}/galleries/{gallery_id}/items")
Call<ApiResponse> favorite(@Path("user_id") int userId, @Path("gallery_id") String galleryId, @Body PhotoGalleryRequest request);
lkorth/photo-paper
PhotoPaper/src/main/java/com/lukekorth/photo_paper/api/FiveHundredPxClient.java
// Path: PhotoPaper/src/main/java/com/lukekorth/photo_paper/models/ApiResponse.java // public class ApiResponse { // } // // Path: PhotoPaper/src/main/java/com/lukekorth/photo_paper/models/GalleryResponse.java // public class GalleryResponse { // // @Expose public List<Gallery> galleries; // // public class Gallery { // // @Expose public String id; // @Expose public String name; // } // } // // Path: PhotoPaper/src/main/java/com/lukekorth/photo_paper/models/PhotoGalleryRequest.java // public class PhotoGalleryRequest { // // @Expose private Add add; // @Expose private Remove remove; // // public static PhotoGalleryRequest add(String photoId) { // PhotoGalleryRequest photoGalleryRequest = new PhotoGalleryRequest(); // photoGalleryRequest.add = new Add(photoId); // return photoGalleryRequest; // } // // public static PhotoGalleryRequest remove(String photoId) { // PhotoGalleryRequest photoGalleryRequest = new PhotoGalleryRequest(); // photoGalleryRequest.remove = new Remove(photoId); // return photoGalleryRequest; // } // // private static class Add { // // @Expose private List<String> photos; // // private Add(String photoId) { // photos = Collections.singletonList(photoId); // } // } // // private static class Remove { // // @Expose private List<String> photos; // // private Remove(String photoId) { // photos = Collections.singletonList(photoId); // } // } // } // // Path: PhotoPaper/src/main/java/com/lukekorth/photo_paper/models/PhotoResponse.java // public class PhotoResponse { // // @Expose public Photo photo; // } // // Path: PhotoPaper/src/main/java/com/lukekorth/photo_paper/models/PhotosResponse.java // public class PhotosResponse { // // @Expose public String feature; // @Expose @SerializedName("current_page") public int currentPage; // @Expose @SerializedName("total_pages") public int totalPages; // @Expose public Photo[] photos; // } // // Path: PhotoPaper/src/main/java/com/lukekorth/photo_paper/models/SearchResult.java // public class SearchResult { // // @Expose public List<Photo> photos; // } // // Path: PhotoPaper/src/main/java/com/lukekorth/photo_paper/models/UsersResponse.java // public class UsersResponse { // // @Expose public User user; // }
import com.lukekorth.photo_paper.models.ApiResponse; import com.lukekorth.photo_paper.models.GalleryResponse; import com.lukekorth.photo_paper.models.PhotoGalleryRequest; import com.lukekorth.photo_paper.models.PhotoResponse; import com.lukekorth.photo_paper.models.PhotosResponse; import com.lukekorth.photo_paper.models.SearchResult; import com.lukekorth.photo_paper.models.UsersResponse; import retrofit2.Call; import retrofit2.http.Body; import retrofit2.http.DELETE; import retrofit2.http.GET; import retrofit2.http.POST; import retrofit2.http.PUT; import retrofit2.http.Path; import retrofit2.http.Query;
package com.lukekorth.photo_paper.api; public interface FiveHundredPxClient { @GET("users") Call<UsersResponse> users(); @GET("photos/{id}") Call<PhotoResponse> photo(@Path("id") String id); @GET("photos/search?image_size=2&rpp=100") Call<SearchResult> search(@Query("term") String term); @GET("photos/search?image_size=2048&rpp100") Call<PhotosResponse> getPhotosFromSearch(@Query("term") String term, @Query("categories") String categories, @Query("page") int page); @GET("photos?image_size=2048&rpp=100") Call<PhotosResponse> getPhotos(@Query("feature") String feature, @Query("categories") String categories, @Query("page") int page); @GET("users/{user_id}/galleries/{gallery_id}/items?image_size=2048&rpp=100") Call<PhotosResponse> getFavorites(@Path("user_id") int userId, @Path("gallery_id") String galleryId, @Query("only") String categories, @Query("page") int page); @POST("photos/{id}/vote?vote=1") Call<PhotoResponse> like(@Path("id") String id); @DELETE("photos/{id}/vote") Call<PhotoResponse> unlike(@Path("id") String id); @PUT("users/{user_id}/galleries/{gallery_id}/items")
// Path: PhotoPaper/src/main/java/com/lukekorth/photo_paper/models/ApiResponse.java // public class ApiResponse { // } // // Path: PhotoPaper/src/main/java/com/lukekorth/photo_paper/models/GalleryResponse.java // public class GalleryResponse { // // @Expose public List<Gallery> galleries; // // public class Gallery { // // @Expose public String id; // @Expose public String name; // } // } // // Path: PhotoPaper/src/main/java/com/lukekorth/photo_paper/models/PhotoGalleryRequest.java // public class PhotoGalleryRequest { // // @Expose private Add add; // @Expose private Remove remove; // // public static PhotoGalleryRequest add(String photoId) { // PhotoGalleryRequest photoGalleryRequest = new PhotoGalleryRequest(); // photoGalleryRequest.add = new Add(photoId); // return photoGalleryRequest; // } // // public static PhotoGalleryRequest remove(String photoId) { // PhotoGalleryRequest photoGalleryRequest = new PhotoGalleryRequest(); // photoGalleryRequest.remove = new Remove(photoId); // return photoGalleryRequest; // } // // private static class Add { // // @Expose private List<String> photos; // // private Add(String photoId) { // photos = Collections.singletonList(photoId); // } // } // // private static class Remove { // // @Expose private List<String> photos; // // private Remove(String photoId) { // photos = Collections.singletonList(photoId); // } // } // } // // Path: PhotoPaper/src/main/java/com/lukekorth/photo_paper/models/PhotoResponse.java // public class PhotoResponse { // // @Expose public Photo photo; // } // // Path: PhotoPaper/src/main/java/com/lukekorth/photo_paper/models/PhotosResponse.java // public class PhotosResponse { // // @Expose public String feature; // @Expose @SerializedName("current_page") public int currentPage; // @Expose @SerializedName("total_pages") public int totalPages; // @Expose public Photo[] photos; // } // // Path: PhotoPaper/src/main/java/com/lukekorth/photo_paper/models/SearchResult.java // public class SearchResult { // // @Expose public List<Photo> photos; // } // // Path: PhotoPaper/src/main/java/com/lukekorth/photo_paper/models/UsersResponse.java // public class UsersResponse { // // @Expose public User user; // } // Path: PhotoPaper/src/main/java/com/lukekorth/photo_paper/api/FiveHundredPxClient.java import com.lukekorth.photo_paper.models.ApiResponse; import com.lukekorth.photo_paper.models.GalleryResponse; import com.lukekorth.photo_paper.models.PhotoGalleryRequest; import com.lukekorth.photo_paper.models.PhotoResponse; import com.lukekorth.photo_paper.models.PhotosResponse; import com.lukekorth.photo_paper.models.SearchResult; import com.lukekorth.photo_paper.models.UsersResponse; import retrofit2.Call; import retrofit2.http.Body; import retrofit2.http.DELETE; import retrofit2.http.GET; import retrofit2.http.POST; import retrofit2.http.PUT; import retrofit2.http.Path; import retrofit2.http.Query; package com.lukekorth.photo_paper.api; public interface FiveHundredPxClient { @GET("users") Call<UsersResponse> users(); @GET("photos/{id}") Call<PhotoResponse> photo(@Path("id") String id); @GET("photos/search?image_size=2&rpp=100") Call<SearchResult> search(@Query("term") String term); @GET("photos/search?image_size=2048&rpp100") Call<PhotosResponse> getPhotosFromSearch(@Query("term") String term, @Query("categories") String categories, @Query("page") int page); @GET("photos?image_size=2048&rpp=100") Call<PhotosResponse> getPhotos(@Query("feature") String feature, @Query("categories") String categories, @Query("page") int page); @GET("users/{user_id}/galleries/{gallery_id}/items?image_size=2048&rpp=100") Call<PhotosResponse> getFavorites(@Path("user_id") int userId, @Path("gallery_id") String galleryId, @Query("only") String categories, @Query("page") int page); @POST("photos/{id}/vote?vote=1") Call<PhotoResponse> like(@Path("id") String id); @DELETE("photos/{id}/vote") Call<PhotoResponse> unlike(@Path("id") String id); @PUT("users/{user_id}/galleries/{gallery_id}/items")
Call<ApiResponse> favorite(@Path("user_id") int userId, @Path("gallery_id") String galleryId, @Body PhotoGalleryRequest request);
lkorth/photo-paper
PhotoPaper/src/main/java/com/lukekorth/photo_paper/api/FiveHundredPxClient.java
// Path: PhotoPaper/src/main/java/com/lukekorth/photo_paper/models/ApiResponse.java // public class ApiResponse { // } // // Path: PhotoPaper/src/main/java/com/lukekorth/photo_paper/models/GalleryResponse.java // public class GalleryResponse { // // @Expose public List<Gallery> galleries; // // public class Gallery { // // @Expose public String id; // @Expose public String name; // } // } // // Path: PhotoPaper/src/main/java/com/lukekorth/photo_paper/models/PhotoGalleryRequest.java // public class PhotoGalleryRequest { // // @Expose private Add add; // @Expose private Remove remove; // // public static PhotoGalleryRequest add(String photoId) { // PhotoGalleryRequest photoGalleryRequest = new PhotoGalleryRequest(); // photoGalleryRequest.add = new Add(photoId); // return photoGalleryRequest; // } // // public static PhotoGalleryRequest remove(String photoId) { // PhotoGalleryRequest photoGalleryRequest = new PhotoGalleryRequest(); // photoGalleryRequest.remove = new Remove(photoId); // return photoGalleryRequest; // } // // private static class Add { // // @Expose private List<String> photos; // // private Add(String photoId) { // photos = Collections.singletonList(photoId); // } // } // // private static class Remove { // // @Expose private List<String> photos; // // private Remove(String photoId) { // photos = Collections.singletonList(photoId); // } // } // } // // Path: PhotoPaper/src/main/java/com/lukekorth/photo_paper/models/PhotoResponse.java // public class PhotoResponse { // // @Expose public Photo photo; // } // // Path: PhotoPaper/src/main/java/com/lukekorth/photo_paper/models/PhotosResponse.java // public class PhotosResponse { // // @Expose public String feature; // @Expose @SerializedName("current_page") public int currentPage; // @Expose @SerializedName("total_pages") public int totalPages; // @Expose public Photo[] photos; // } // // Path: PhotoPaper/src/main/java/com/lukekorth/photo_paper/models/SearchResult.java // public class SearchResult { // // @Expose public List<Photo> photos; // } // // Path: PhotoPaper/src/main/java/com/lukekorth/photo_paper/models/UsersResponse.java // public class UsersResponse { // // @Expose public User user; // }
import com.lukekorth.photo_paper.models.ApiResponse; import com.lukekorth.photo_paper.models.GalleryResponse; import com.lukekorth.photo_paper.models.PhotoGalleryRequest; import com.lukekorth.photo_paper.models.PhotoResponse; import com.lukekorth.photo_paper.models.PhotosResponse; import com.lukekorth.photo_paper.models.SearchResult; import com.lukekorth.photo_paper.models.UsersResponse; import retrofit2.Call; import retrofit2.http.Body; import retrofit2.http.DELETE; import retrofit2.http.GET; import retrofit2.http.POST; import retrofit2.http.PUT; import retrofit2.http.Path; import retrofit2.http.Query;
package com.lukekorth.photo_paper.api; public interface FiveHundredPxClient { @GET("users") Call<UsersResponse> users(); @GET("photos/{id}") Call<PhotoResponse> photo(@Path("id") String id); @GET("photos/search?image_size=2&rpp=100") Call<SearchResult> search(@Query("term") String term); @GET("photos/search?image_size=2048&rpp100") Call<PhotosResponse> getPhotosFromSearch(@Query("term") String term, @Query("categories") String categories, @Query("page") int page); @GET("photos?image_size=2048&rpp=100") Call<PhotosResponse> getPhotos(@Query("feature") String feature, @Query("categories") String categories, @Query("page") int page); @GET("users/{user_id}/galleries/{gallery_id}/items?image_size=2048&rpp=100") Call<PhotosResponse> getFavorites(@Path("user_id") int userId, @Path("gallery_id") String galleryId, @Query("only") String categories, @Query("page") int page); @POST("photos/{id}/vote?vote=1") Call<PhotoResponse> like(@Path("id") String id); @DELETE("photos/{id}/vote") Call<PhotoResponse> unlike(@Path("id") String id); @PUT("users/{user_id}/galleries/{gallery_id}/items") Call<ApiResponse> favorite(@Path("user_id") int userId, @Path("gallery_id") String galleryId, @Body PhotoGalleryRequest request); @PUT("users/{user_id}/galleries/{gallery_id}/items") Call<ApiResponse> unfavorite(@Path("user_id") int userId, @Path("gallery_id") String galleryId, @Body PhotoGalleryRequest request); @GET("users/{id}/galleries?privacy=both&rpp=100")
// Path: PhotoPaper/src/main/java/com/lukekorth/photo_paper/models/ApiResponse.java // public class ApiResponse { // } // // Path: PhotoPaper/src/main/java/com/lukekorth/photo_paper/models/GalleryResponse.java // public class GalleryResponse { // // @Expose public List<Gallery> galleries; // // public class Gallery { // // @Expose public String id; // @Expose public String name; // } // } // // Path: PhotoPaper/src/main/java/com/lukekorth/photo_paper/models/PhotoGalleryRequest.java // public class PhotoGalleryRequest { // // @Expose private Add add; // @Expose private Remove remove; // // public static PhotoGalleryRequest add(String photoId) { // PhotoGalleryRequest photoGalleryRequest = new PhotoGalleryRequest(); // photoGalleryRequest.add = new Add(photoId); // return photoGalleryRequest; // } // // public static PhotoGalleryRequest remove(String photoId) { // PhotoGalleryRequest photoGalleryRequest = new PhotoGalleryRequest(); // photoGalleryRequest.remove = new Remove(photoId); // return photoGalleryRequest; // } // // private static class Add { // // @Expose private List<String> photos; // // private Add(String photoId) { // photos = Collections.singletonList(photoId); // } // } // // private static class Remove { // // @Expose private List<String> photos; // // private Remove(String photoId) { // photos = Collections.singletonList(photoId); // } // } // } // // Path: PhotoPaper/src/main/java/com/lukekorth/photo_paper/models/PhotoResponse.java // public class PhotoResponse { // // @Expose public Photo photo; // } // // Path: PhotoPaper/src/main/java/com/lukekorth/photo_paper/models/PhotosResponse.java // public class PhotosResponse { // // @Expose public String feature; // @Expose @SerializedName("current_page") public int currentPage; // @Expose @SerializedName("total_pages") public int totalPages; // @Expose public Photo[] photos; // } // // Path: PhotoPaper/src/main/java/com/lukekorth/photo_paper/models/SearchResult.java // public class SearchResult { // // @Expose public List<Photo> photos; // } // // Path: PhotoPaper/src/main/java/com/lukekorth/photo_paper/models/UsersResponse.java // public class UsersResponse { // // @Expose public User user; // } // Path: PhotoPaper/src/main/java/com/lukekorth/photo_paper/api/FiveHundredPxClient.java import com.lukekorth.photo_paper.models.ApiResponse; import com.lukekorth.photo_paper.models.GalleryResponse; import com.lukekorth.photo_paper.models.PhotoGalleryRequest; import com.lukekorth.photo_paper.models.PhotoResponse; import com.lukekorth.photo_paper.models.PhotosResponse; import com.lukekorth.photo_paper.models.SearchResult; import com.lukekorth.photo_paper.models.UsersResponse; import retrofit2.Call; import retrofit2.http.Body; import retrofit2.http.DELETE; import retrofit2.http.GET; import retrofit2.http.POST; import retrofit2.http.PUT; import retrofit2.http.Path; import retrofit2.http.Query; package com.lukekorth.photo_paper.api; public interface FiveHundredPxClient { @GET("users") Call<UsersResponse> users(); @GET("photos/{id}") Call<PhotoResponse> photo(@Path("id") String id); @GET("photos/search?image_size=2&rpp=100") Call<SearchResult> search(@Query("term") String term); @GET("photos/search?image_size=2048&rpp100") Call<PhotosResponse> getPhotosFromSearch(@Query("term") String term, @Query("categories") String categories, @Query("page") int page); @GET("photos?image_size=2048&rpp=100") Call<PhotosResponse> getPhotos(@Query("feature") String feature, @Query("categories") String categories, @Query("page") int page); @GET("users/{user_id}/galleries/{gallery_id}/items?image_size=2048&rpp=100") Call<PhotosResponse> getFavorites(@Path("user_id") int userId, @Path("gallery_id") String galleryId, @Query("only") String categories, @Query("page") int page); @POST("photos/{id}/vote?vote=1") Call<PhotoResponse> like(@Path("id") String id); @DELETE("photos/{id}/vote") Call<PhotoResponse> unlike(@Path("id") String id); @PUT("users/{user_id}/galleries/{gallery_id}/items") Call<ApiResponse> favorite(@Path("user_id") int userId, @Path("gallery_id") String galleryId, @Body PhotoGalleryRequest request); @PUT("users/{user_id}/galleries/{gallery_id}/items") Call<ApiResponse> unfavorite(@Path("user_id") int userId, @Path("gallery_id") String galleryId, @Body PhotoGalleryRequest request); @GET("users/{id}/galleries?privacy=both&rpp=100")
Call<GalleryResponse> galleries(@Path("id") int userId);
lkorth/photo-paper
PhotoPaper/src/main/java/com/lukekorth/photo_paper/models/Photos.java
// Path: PhotoPaper/src/main/java/com/lukekorth/photo_paper/helpers/Settings.java // public class Settings { // // private static SharedPreferences getPrefs(Context context) { // return PreferenceManager.getDefaultSharedPreferences(context); // } // // public static String getFavoriteGallery(Context context) { // return getPrefs(context).getString("favorite_gallery", null); // } // // public static String getFavoriteGalleryId(Context context) { // return getPrefs(context).getString("favorite_gallery_id", null); // } // // public static void setFavoriteGallery(Context context, String gallery) { // getPrefs(context).edit().putString("favorite_gallery", gallery).apply(); // } // // public static void setFavoriteGalleryId(Context context, String id) { // getPrefs(context).edit().putString("favorite_gallery_id", id).apply(); // } // // public static String getFeature(Context context) { // return getPrefs(context).getString("feature", "popular"); // } // // public static void setFeature(Context context, String feature) { // getPrefs(context).edit().putString("feature", feature).apply(); // } // // public static String getSearchQuery(Context context) { // return getPrefs(context).getString("search_query", ""); // } // // public static void setSearchQuery(Context context, String query) { // getPrefs(context).edit().putString("search_query", query).apply(); // } // // public static int[] getCategories(Context context) { // Set<String> defaultCategory = new HashSet<String>(); // defaultCategory.add("8"); // Set<String> prefCategories = getPrefs(context).getStringSet("categories", defaultCategory); // // int[] categories = new int[prefCategories.size()]; // int i = 0; // for (String category : prefCategories) { // categories[i] = Integer.parseInt(category); // i++; // } // // return categories; // } // // public static void setCategories(Context context, Set<String> categories) { // getPrefs(context).edit().putStringSet("categories", categories).apply(); // } // // public static boolean isEnabled(Context context) { // return getPrefs(context).getBoolean("enable", false); // } // // public static int getUpdateInterval(Context context) { // return Integer.parseInt(getPrefs(context).getString("update_interval", "3600")); // } // // public static void setUpdateInterval(Context context, String interval) { // getPrefs(context).edit().putString("update_interval", interval).apply(); // } // // public static boolean useParallax(Context context) { // return getPrefs(context).getBoolean("use_parallax", false); // } // // public static boolean useOnlyWifi(Context context) { // return getPrefs(context).getBoolean("use_only_wifi", true); // } // // public static long getLastUpdated(Context context) { // return getPrefs(context).getLong("last_updated", 0); // } // // public static void setUpdated(Context context) { // getPrefs(context).edit().putLong("last_updated", System.currentTimeMillis()).apply(); // } // // public static void clearUpdated(Context context) { // getPrefs(context).edit().putLong("last_updated", 0).apply(); // } // }
import android.content.Context; import com.google.gson.annotations.Expose; import com.google.gson.annotations.SerializedName; import com.lukekorth.photo_paper.helpers.Settings; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.List; import java.util.concurrent.TimeUnit; import io.realm.Realm; import io.realm.RealmObject; import io.realm.RealmQuery; import io.realm.RealmResults; import io.realm.Sort; import io.realm.annotations.Required;
} else { return photos.first(); } } public static Photos getCurrentPhoto(Realm realm) { RealmResults<Photos> photos = getRecentlySeenPhotos(realm); if (photos.isEmpty()) { return null; } else { return photos.first(); } } public static RealmResults<Photos> getRecentlySeenPhotos(Realm realm) { return realm.where(Photos.class) .equalTo("seen", true) .greaterThan("seenAt", System.currentTimeMillis() - TimeUnit.DAYS.toMillis(7)) .findAllSorted("seenAt", Sort.DESCENDING); } public static List<Photos> getUnseenPhotos(Context context, Realm realm) { return getQuery(context, realm); } public static int unseenPhotoCount(Context context, Realm realm) { return getQuery(context, realm).size(); } private static RealmResults<Photos> getQuery(Context context, Realm realm) {
// Path: PhotoPaper/src/main/java/com/lukekorth/photo_paper/helpers/Settings.java // public class Settings { // // private static SharedPreferences getPrefs(Context context) { // return PreferenceManager.getDefaultSharedPreferences(context); // } // // public static String getFavoriteGallery(Context context) { // return getPrefs(context).getString("favorite_gallery", null); // } // // public static String getFavoriteGalleryId(Context context) { // return getPrefs(context).getString("favorite_gallery_id", null); // } // // public static void setFavoriteGallery(Context context, String gallery) { // getPrefs(context).edit().putString("favorite_gallery", gallery).apply(); // } // // public static void setFavoriteGalleryId(Context context, String id) { // getPrefs(context).edit().putString("favorite_gallery_id", id).apply(); // } // // public static String getFeature(Context context) { // return getPrefs(context).getString("feature", "popular"); // } // // public static void setFeature(Context context, String feature) { // getPrefs(context).edit().putString("feature", feature).apply(); // } // // public static String getSearchQuery(Context context) { // return getPrefs(context).getString("search_query", ""); // } // // public static void setSearchQuery(Context context, String query) { // getPrefs(context).edit().putString("search_query", query).apply(); // } // // public static int[] getCategories(Context context) { // Set<String> defaultCategory = new HashSet<String>(); // defaultCategory.add("8"); // Set<String> prefCategories = getPrefs(context).getStringSet("categories", defaultCategory); // // int[] categories = new int[prefCategories.size()]; // int i = 0; // for (String category : prefCategories) { // categories[i] = Integer.parseInt(category); // i++; // } // // return categories; // } // // public static void setCategories(Context context, Set<String> categories) { // getPrefs(context).edit().putStringSet("categories", categories).apply(); // } // // public static boolean isEnabled(Context context) { // return getPrefs(context).getBoolean("enable", false); // } // // public static int getUpdateInterval(Context context) { // return Integer.parseInt(getPrefs(context).getString("update_interval", "3600")); // } // // public static void setUpdateInterval(Context context, String interval) { // getPrefs(context).edit().putString("update_interval", interval).apply(); // } // // public static boolean useParallax(Context context) { // return getPrefs(context).getBoolean("use_parallax", false); // } // // public static boolean useOnlyWifi(Context context) { // return getPrefs(context).getBoolean("use_only_wifi", true); // } // // public static long getLastUpdated(Context context) { // return getPrefs(context).getLong("last_updated", 0); // } // // public static void setUpdated(Context context) { // getPrefs(context).edit().putLong("last_updated", System.currentTimeMillis()).apply(); // } // // public static void clearUpdated(Context context) { // getPrefs(context).edit().putLong("last_updated", 0).apply(); // } // } // Path: PhotoPaper/src/main/java/com/lukekorth/photo_paper/models/Photos.java import android.content.Context; import com.google.gson.annotations.Expose; import com.google.gson.annotations.SerializedName; import com.lukekorth.photo_paper.helpers.Settings; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.List; import java.util.concurrent.TimeUnit; import io.realm.Realm; import io.realm.RealmObject; import io.realm.RealmQuery; import io.realm.RealmResults; import io.realm.Sort; import io.realm.annotations.Required; } else { return photos.first(); } } public static Photos getCurrentPhoto(Realm realm) { RealmResults<Photos> photos = getRecentlySeenPhotos(realm); if (photos.isEmpty()) { return null; } else { return photos.first(); } } public static RealmResults<Photos> getRecentlySeenPhotos(Realm realm) { return realm.where(Photos.class) .equalTo("seen", true) .greaterThan("seenAt", System.currentTimeMillis() - TimeUnit.DAYS.toMillis(7)) .findAllSorted("seenAt", Sort.DESCENDING); } public static List<Photos> getUnseenPhotos(Context context, Realm realm) { return getQuery(context, realm); } public static int unseenPhotoCount(Context context, Realm realm) { return getQuery(context, realm).size(); } private static RealmResults<Photos> getQuery(Context context, Realm realm) {
String feature = Settings.getFeature(context);
lkorth/photo-paper
PhotoPaper/src/main/java/com/lukekorth/photo_paper/helpers/PicassoHelper.java
// Path: PhotoPaper/src/main/java/com/squareup/picasso/PicassoTools.java // public class PicassoTools { // // public static void clearCache(Picasso picasso) { // picasso.cache.clear(); // } // // }
import android.content.Context; import com.jakewharton.picasso.OkHttp3Downloader; import com.lukekorth.photo_paper.BuildConfig; import com.squareup.picasso.Picasso; import com.squareup.picasso.PicassoTools;
package com.lukekorth.photo_paper.helpers; public class PicassoHelper { public static Picasso getPicasso(Context context) { return new Picasso.Builder(context.getApplicationContext()) .downloader(new OkHttp3Downloader(context.getApplicationContext(), 512000000)) // 512mb .indicatorsEnabled(BuildConfig.DEBUG) .build(); } public static void clearCache(Context context) {
// Path: PhotoPaper/src/main/java/com/squareup/picasso/PicassoTools.java // public class PicassoTools { // // public static void clearCache(Picasso picasso) { // picasso.cache.clear(); // } // // } // Path: PhotoPaper/src/main/java/com/lukekorth/photo_paper/helpers/PicassoHelper.java import android.content.Context; import com.jakewharton.picasso.OkHttp3Downloader; import com.lukekorth.photo_paper.BuildConfig; import com.squareup.picasso.Picasso; import com.squareup.picasso.PicassoTools; package com.lukekorth.photo_paper.helpers; public class PicassoHelper { public static Picasso getPicasso(Context context) { return new Picasso.Builder(context.getApplicationContext()) .downloader(new OkHttp3Downloader(context.getApplicationContext(), 512000000)) // 512mb .indicatorsEnabled(BuildConfig.DEBUG) .build(); } public static void clearCache(Context context) {
PicassoTools.clearCache(PicassoHelper.getPicasso(context));
lkorth/photo-paper
PhotoPaper/src/main/java/com/lukekorth/photo_paper/models/User.java
// Path: PhotoPaper/src/main/java/com/lukekorth/fivehundredpx/AccessToken.java // public class AccessToken implements Parcelable { // // private String mToken; // private String mTokenSecret; // // public AccessToken(String token, String tokenSecret) { // mToken = token; // mTokenSecret = tokenSecret; // } // // AccessToken(HttpResponse response) throws FiveHundredException { // try { // Uri responseUri = Uri.parse(EntityUtils.toString(response.getEntity())); // // mToken = responseUri.getQueryParameter("oauth_token"); // mTokenSecret = responseUri.getQueryParameter("oauth_token_secret"); // } catch (ParseException | IOException | NullPointerException e) { // throw new FiveHundredException(e); // } // } // // public String getToken() { // return mToken; // } // // public String getTokenSecret() { // return mTokenSecret; // } // // @Override // public int describeContents() { // return 0; // } // // @Override // public void writeToParcel(Parcel dest, int flags) { // dest.writeString(mToken); // dest.writeString(mTokenSecret); // } // // private AccessToken(Parcel in) { // mToken = in.readString(); // mTokenSecret = in.readString(); // } // // public static final Creator<AccessToken> CREATOR = new Creator<AccessToken>() { // public AccessToken createFromParcel(Parcel source) { // return new AccessToken(source); // } // // public AccessToken[] newArray(int size) { // return new AccessToken[size]; // } // }; // } // // Path: PhotoPaper/src/main/java/com/lukekorth/photo_paper/services/UserInfoIntentService.java // public class UserInfoIntentService extends IntentService { // // public UserInfoIntentService() { // super("UserInfoIntentService"); // } // // @Override // protected void onHandleIntent(Intent intent) { // ((WallpaperApplication) getApplication()).onUserUpdated(null); // // try { // User userResponse = WallpaperApplication.getApiClient() // .users() // .execute() // .body() // .user; // // Realm realm = Realm.getDefaultInstance(); // User user = User.getUser(realm); // realm.beginTransaction(); // user.setId(userResponse.getId()); // user.setUserName(userResponse.getUserName()); // user.setFirstName(userResponse.getFirstName()); // user.setLastName(userResponse.getLastName()); // user.setPhoto(userResponse.getPhoto()); // realm.commitTransaction(); // realm.close(); // // Settings.setFavoriteGallery(this, null); // Settings.setFavoriteGalleryId(this, null); // // FirebaseAnalytics.getInstance(this).logEvent(FirebaseAnalytics.Event.LOGIN, null); // // WallpaperApplication.getBus().post(new UserUpdatedEvent()); // } catch (IOException e) { // LoggerFactory.getLogger("UserInfoIntentService").error(e.getMessage()); // } // } // }
import android.content.Context; import android.content.Intent; import com.lukekorth.fivehundredpx.AccessToken; import com.google.gson.annotations.Expose; import com.google.gson.annotations.SerializedName; import com.lukekorth.photo_paper.services.UserInfoIntentService; import io.realm.Realm; import io.realm.RealmObject;
public String getAccessToken() { return accessToken; } public void setAccessToken(String accessToken) { this.accessToken = accessToken; } public String getAccessTokenSecret() { return accessTokenSecret; } public void setAccessTokenSecret(String accessTokenSecret) { this.accessTokenSecret = accessTokenSecret; } public static User getUser(Realm realm) { return realm.where(User.class).findFirst(); } public static boolean isUserLoggedIn(Realm realm) { return (realm.where(User.class).findFirst() != null); } public static void logout(Realm realm) { realm.beginTransaction(); realm.where(User.class).findAll().deleteAllFromRealm(); realm.commitTransaction(); }
// Path: PhotoPaper/src/main/java/com/lukekorth/fivehundredpx/AccessToken.java // public class AccessToken implements Parcelable { // // private String mToken; // private String mTokenSecret; // // public AccessToken(String token, String tokenSecret) { // mToken = token; // mTokenSecret = tokenSecret; // } // // AccessToken(HttpResponse response) throws FiveHundredException { // try { // Uri responseUri = Uri.parse(EntityUtils.toString(response.getEntity())); // // mToken = responseUri.getQueryParameter("oauth_token"); // mTokenSecret = responseUri.getQueryParameter("oauth_token_secret"); // } catch (ParseException | IOException | NullPointerException e) { // throw new FiveHundredException(e); // } // } // // public String getToken() { // return mToken; // } // // public String getTokenSecret() { // return mTokenSecret; // } // // @Override // public int describeContents() { // return 0; // } // // @Override // public void writeToParcel(Parcel dest, int flags) { // dest.writeString(mToken); // dest.writeString(mTokenSecret); // } // // private AccessToken(Parcel in) { // mToken = in.readString(); // mTokenSecret = in.readString(); // } // // public static final Creator<AccessToken> CREATOR = new Creator<AccessToken>() { // public AccessToken createFromParcel(Parcel source) { // return new AccessToken(source); // } // // public AccessToken[] newArray(int size) { // return new AccessToken[size]; // } // }; // } // // Path: PhotoPaper/src/main/java/com/lukekorth/photo_paper/services/UserInfoIntentService.java // public class UserInfoIntentService extends IntentService { // // public UserInfoIntentService() { // super("UserInfoIntentService"); // } // // @Override // protected void onHandleIntent(Intent intent) { // ((WallpaperApplication) getApplication()).onUserUpdated(null); // // try { // User userResponse = WallpaperApplication.getApiClient() // .users() // .execute() // .body() // .user; // // Realm realm = Realm.getDefaultInstance(); // User user = User.getUser(realm); // realm.beginTransaction(); // user.setId(userResponse.getId()); // user.setUserName(userResponse.getUserName()); // user.setFirstName(userResponse.getFirstName()); // user.setLastName(userResponse.getLastName()); // user.setPhoto(userResponse.getPhoto()); // realm.commitTransaction(); // realm.close(); // // Settings.setFavoriteGallery(this, null); // Settings.setFavoriteGalleryId(this, null); // // FirebaseAnalytics.getInstance(this).logEvent(FirebaseAnalytics.Event.LOGIN, null); // // WallpaperApplication.getBus().post(new UserUpdatedEvent()); // } catch (IOException e) { // LoggerFactory.getLogger("UserInfoIntentService").error(e.getMessage()); // } // } // } // Path: PhotoPaper/src/main/java/com/lukekorth/photo_paper/models/User.java import android.content.Context; import android.content.Intent; import com.lukekorth.fivehundredpx.AccessToken; import com.google.gson.annotations.Expose; import com.google.gson.annotations.SerializedName; import com.lukekorth.photo_paper.services.UserInfoIntentService; import io.realm.Realm; import io.realm.RealmObject; public String getAccessToken() { return accessToken; } public void setAccessToken(String accessToken) { this.accessToken = accessToken; } public String getAccessTokenSecret() { return accessTokenSecret; } public void setAccessTokenSecret(String accessTokenSecret) { this.accessTokenSecret = accessTokenSecret; } public static User getUser(Realm realm) { return realm.where(User.class).findFirst(); } public static boolean isUserLoggedIn(Realm realm) { return (realm.where(User.class).findFirst() != null); } public static void logout(Realm realm) { realm.beginTransaction(); realm.where(User.class).findAll().deleteAllFromRealm(); realm.commitTransaction(); }
public static void newUser(Context context, Realm realm, AccessToken accessToken) {
lkorth/photo-paper
PhotoPaper/src/main/java/com/lukekorth/photo_paper/models/User.java
// Path: PhotoPaper/src/main/java/com/lukekorth/fivehundredpx/AccessToken.java // public class AccessToken implements Parcelable { // // private String mToken; // private String mTokenSecret; // // public AccessToken(String token, String tokenSecret) { // mToken = token; // mTokenSecret = tokenSecret; // } // // AccessToken(HttpResponse response) throws FiveHundredException { // try { // Uri responseUri = Uri.parse(EntityUtils.toString(response.getEntity())); // // mToken = responseUri.getQueryParameter("oauth_token"); // mTokenSecret = responseUri.getQueryParameter("oauth_token_secret"); // } catch (ParseException | IOException | NullPointerException e) { // throw new FiveHundredException(e); // } // } // // public String getToken() { // return mToken; // } // // public String getTokenSecret() { // return mTokenSecret; // } // // @Override // public int describeContents() { // return 0; // } // // @Override // public void writeToParcel(Parcel dest, int flags) { // dest.writeString(mToken); // dest.writeString(mTokenSecret); // } // // private AccessToken(Parcel in) { // mToken = in.readString(); // mTokenSecret = in.readString(); // } // // public static final Creator<AccessToken> CREATOR = new Creator<AccessToken>() { // public AccessToken createFromParcel(Parcel source) { // return new AccessToken(source); // } // // public AccessToken[] newArray(int size) { // return new AccessToken[size]; // } // }; // } // // Path: PhotoPaper/src/main/java/com/lukekorth/photo_paper/services/UserInfoIntentService.java // public class UserInfoIntentService extends IntentService { // // public UserInfoIntentService() { // super("UserInfoIntentService"); // } // // @Override // protected void onHandleIntent(Intent intent) { // ((WallpaperApplication) getApplication()).onUserUpdated(null); // // try { // User userResponse = WallpaperApplication.getApiClient() // .users() // .execute() // .body() // .user; // // Realm realm = Realm.getDefaultInstance(); // User user = User.getUser(realm); // realm.beginTransaction(); // user.setId(userResponse.getId()); // user.setUserName(userResponse.getUserName()); // user.setFirstName(userResponse.getFirstName()); // user.setLastName(userResponse.getLastName()); // user.setPhoto(userResponse.getPhoto()); // realm.commitTransaction(); // realm.close(); // // Settings.setFavoriteGallery(this, null); // Settings.setFavoriteGalleryId(this, null); // // FirebaseAnalytics.getInstance(this).logEvent(FirebaseAnalytics.Event.LOGIN, null); // // WallpaperApplication.getBus().post(new UserUpdatedEvent()); // } catch (IOException e) { // LoggerFactory.getLogger("UserInfoIntentService").error(e.getMessage()); // } // } // }
import android.content.Context; import android.content.Intent; import com.lukekorth.fivehundredpx.AccessToken; import com.google.gson.annotations.Expose; import com.google.gson.annotations.SerializedName; import com.lukekorth.photo_paper.services.UserInfoIntentService; import io.realm.Realm; import io.realm.RealmObject;
return accessTokenSecret; } public void setAccessTokenSecret(String accessTokenSecret) { this.accessTokenSecret = accessTokenSecret; } public static User getUser(Realm realm) { return realm.where(User.class).findFirst(); } public static boolean isUserLoggedIn(Realm realm) { return (realm.where(User.class).findFirst() != null); } public static void logout(Realm realm) { realm.beginTransaction(); realm.where(User.class).findAll().deleteAllFromRealm(); realm.commitTransaction(); } public static void newUser(Context context, Realm realm, AccessToken accessToken) { User.logout(realm); realm.beginTransaction(); User user = realm.createObject(User.class); user.setAccessToken(accessToken.getToken()); user.setAccessTokenSecret(accessToken.getTokenSecret()); realm.commitTransaction();
// Path: PhotoPaper/src/main/java/com/lukekorth/fivehundredpx/AccessToken.java // public class AccessToken implements Parcelable { // // private String mToken; // private String mTokenSecret; // // public AccessToken(String token, String tokenSecret) { // mToken = token; // mTokenSecret = tokenSecret; // } // // AccessToken(HttpResponse response) throws FiveHundredException { // try { // Uri responseUri = Uri.parse(EntityUtils.toString(response.getEntity())); // // mToken = responseUri.getQueryParameter("oauth_token"); // mTokenSecret = responseUri.getQueryParameter("oauth_token_secret"); // } catch (ParseException | IOException | NullPointerException e) { // throw new FiveHundredException(e); // } // } // // public String getToken() { // return mToken; // } // // public String getTokenSecret() { // return mTokenSecret; // } // // @Override // public int describeContents() { // return 0; // } // // @Override // public void writeToParcel(Parcel dest, int flags) { // dest.writeString(mToken); // dest.writeString(mTokenSecret); // } // // private AccessToken(Parcel in) { // mToken = in.readString(); // mTokenSecret = in.readString(); // } // // public static final Creator<AccessToken> CREATOR = new Creator<AccessToken>() { // public AccessToken createFromParcel(Parcel source) { // return new AccessToken(source); // } // // public AccessToken[] newArray(int size) { // return new AccessToken[size]; // } // }; // } // // Path: PhotoPaper/src/main/java/com/lukekorth/photo_paper/services/UserInfoIntentService.java // public class UserInfoIntentService extends IntentService { // // public UserInfoIntentService() { // super("UserInfoIntentService"); // } // // @Override // protected void onHandleIntent(Intent intent) { // ((WallpaperApplication) getApplication()).onUserUpdated(null); // // try { // User userResponse = WallpaperApplication.getApiClient() // .users() // .execute() // .body() // .user; // // Realm realm = Realm.getDefaultInstance(); // User user = User.getUser(realm); // realm.beginTransaction(); // user.setId(userResponse.getId()); // user.setUserName(userResponse.getUserName()); // user.setFirstName(userResponse.getFirstName()); // user.setLastName(userResponse.getLastName()); // user.setPhoto(userResponse.getPhoto()); // realm.commitTransaction(); // realm.close(); // // Settings.setFavoriteGallery(this, null); // Settings.setFavoriteGalleryId(this, null); // // FirebaseAnalytics.getInstance(this).logEvent(FirebaseAnalytics.Event.LOGIN, null); // // WallpaperApplication.getBus().post(new UserUpdatedEvent()); // } catch (IOException e) { // LoggerFactory.getLogger("UserInfoIntentService").error(e.getMessage()); // } // } // } // Path: PhotoPaper/src/main/java/com/lukekorth/photo_paper/models/User.java import android.content.Context; import android.content.Intent; import com.lukekorth.fivehundredpx.AccessToken; import com.google.gson.annotations.Expose; import com.google.gson.annotations.SerializedName; import com.lukekorth.photo_paper.services.UserInfoIntentService; import io.realm.Realm; import io.realm.RealmObject; return accessTokenSecret; } public void setAccessTokenSecret(String accessTokenSecret) { this.accessTokenSecret = accessTokenSecret; } public static User getUser(Realm realm) { return realm.where(User.class).findFirst(); } public static boolean isUserLoggedIn(Realm realm) { return (realm.where(User.class).findFirst() != null); } public static void logout(Realm realm) { realm.beginTransaction(); realm.where(User.class).findAll().deleteAllFromRealm(); realm.commitTransaction(); } public static void newUser(Context context, Realm realm, AccessToken accessToken) { User.logout(realm); realm.beginTransaction(); User user = realm.createObject(User.class); user.setAccessToken(accessToken.getToken()); user.setAccessTokenSecret(accessToken.getTokenSecret()); realm.commitTransaction();
context.startService(new Intent(context, UserInfoIntentService.class));
EscapeIndustries/DotMatrixView
DotMatrixViewTests/src/com/escapeindustries/dotmatrix/tests/GlyphTests.java
// Path: DotMatrixView/src/com/escapeindustries/dotmatrix/Glyph.java // public abstract class Glyph { // protected int width; // protected int height; // protected int leftMostColumn; // protected int topRow; // protected Grid grid; // // /** // * Get the width of this Glyph in dots. // * // * @return The width in dots needed to draw this Glyph. // */ // public int getWidth() { // return width; // } // // /** // * Get the height of this Glyph in dots. // * // * @return The height in dots needed to draw this Glyph // */ // public int getHeight() { // return height; // } // // /** // * Set the target {@link Grid} that this Glyph will draw into // * // * @param grid // * The {@link Grid} that the Glyph should draw into // */ // public void setGrid(Grid grid) { // this.grid = grid; // } // // /** // * Set the left-most column of the target {@link Grid} that this Glyph will // * draw at. // * // * @param column // * The left-most column at which to start drawing this Glyph in // * the target {@link Grid}. // * @see #setGrid // */ // public void setColumn(int column) { // this.leftMostColumn = column; // } // // /** // * Set the top-most column of the target {@link Grid} that this Glyph will // * draw at. // * // * @param row // * The top-most row at which to start drawing this Glyph in the // * target {@link Grid}. // * @see #setGrid // */ // public void setRow(int row) { // this.topRow = row; // } // // /** // * Convenience method for setting a dot on or off using a one dimensional // * index as used as a shape definition by {@link DigitDefinition}. // * // * @param index // * One-dimensional zero-based index to the dot. For example, if // * the dot was the the right-most of the second line of a Glyph // * with a width of 5, index would be 9. // * @param on // * The new state of the dot. // */ // public void changeDot(int index, boolean on) { // // index is relative to topRow and leftMostColumn. // int x = leftMostColumn + (index % width); // int y = (index / width) + topRow; // grid.changeDot(x, y, on); // } // // /** // * Override this to add code to draw a Glyph into the target {@link Grid}. // * Make calls to {@link #changeDot} to set individual dots on or off. // */ // public abstract void draw(); // // } // // Path: DotMatrixView/src/com/escapeindustries/dotmatrix/GlyphFactory.java // public class GlyphFactory { // // private Grid grid; // // /** // * @param grid // * The {@link Grid} that all created {@link Glyph}s will drawn in // */ // public GlyphFactory(Grid grid) { // this.grid = grid; // } // // /** // * @return A {@link Digit} set to draw to the configured {@link Grid} // */ // public Digit createDigit() { // return new Digit(grid, 0, 0); // } // // /** // * @return A {@link Seperator} set to draw to the configured {@link Grid} // */ // public Seperator createSeperator() { // return new Seperator(grid, 0, 0); // } // // /** // * @return A {@link Space} set to draw to the configured {@link Grid} // */ // public Space createSpace() { // return new Space(); // } // // }
import com.escapeindustries.dotmatrix.Glyph; import com.escapeindustries.dotmatrix.GlyphFactory; import junit.framework.TestCase;
package com.escapeindustries.dotmatrix.tests; public class GlyphTests extends TestCase { private GlyphFactory factory; protected void setUp() throws Exception { super.setUp(); factory = new GlyphFactory(new TestGrid()); } public void testStandardWidth() { // Arrange int expectedWidth = 7; // Act
// Path: DotMatrixView/src/com/escapeindustries/dotmatrix/Glyph.java // public abstract class Glyph { // protected int width; // protected int height; // protected int leftMostColumn; // protected int topRow; // protected Grid grid; // // /** // * Get the width of this Glyph in dots. // * // * @return The width in dots needed to draw this Glyph. // */ // public int getWidth() { // return width; // } // // /** // * Get the height of this Glyph in dots. // * // * @return The height in dots needed to draw this Glyph // */ // public int getHeight() { // return height; // } // // /** // * Set the target {@link Grid} that this Glyph will draw into // * // * @param grid // * The {@link Grid} that the Glyph should draw into // */ // public void setGrid(Grid grid) { // this.grid = grid; // } // // /** // * Set the left-most column of the target {@link Grid} that this Glyph will // * draw at. // * // * @param column // * The left-most column at which to start drawing this Glyph in // * the target {@link Grid}. // * @see #setGrid // */ // public void setColumn(int column) { // this.leftMostColumn = column; // } // // /** // * Set the top-most column of the target {@link Grid} that this Glyph will // * draw at. // * // * @param row // * The top-most row at which to start drawing this Glyph in the // * target {@link Grid}. // * @see #setGrid // */ // public void setRow(int row) { // this.topRow = row; // } // // /** // * Convenience method for setting a dot on or off using a one dimensional // * index as used as a shape definition by {@link DigitDefinition}. // * // * @param index // * One-dimensional zero-based index to the dot. For example, if // * the dot was the the right-most of the second line of a Glyph // * with a width of 5, index would be 9. // * @param on // * The new state of the dot. // */ // public void changeDot(int index, boolean on) { // // index is relative to topRow and leftMostColumn. // int x = leftMostColumn + (index % width); // int y = (index / width) + topRow; // grid.changeDot(x, y, on); // } // // /** // * Override this to add code to draw a Glyph into the target {@link Grid}. // * Make calls to {@link #changeDot} to set individual dots on or off. // */ // public abstract void draw(); // // } // // Path: DotMatrixView/src/com/escapeindustries/dotmatrix/GlyphFactory.java // public class GlyphFactory { // // private Grid grid; // // /** // * @param grid // * The {@link Grid} that all created {@link Glyph}s will drawn in // */ // public GlyphFactory(Grid grid) { // this.grid = grid; // } // // /** // * @return A {@link Digit} set to draw to the configured {@link Grid} // */ // public Digit createDigit() { // return new Digit(grid, 0, 0); // } // // /** // * @return A {@link Seperator} set to draw to the configured {@link Grid} // */ // public Seperator createSeperator() { // return new Seperator(grid, 0, 0); // } // // /** // * @return A {@link Space} set to draw to the configured {@link Grid} // */ // public Space createSpace() { // return new Space(); // } // // } // Path: DotMatrixViewTests/src/com/escapeindustries/dotmatrix/tests/GlyphTests.java import com.escapeindustries.dotmatrix.Glyph; import com.escapeindustries.dotmatrix.GlyphFactory; import junit.framework.TestCase; package com.escapeindustries.dotmatrix.tests; public class GlyphTests extends TestCase { private GlyphFactory factory; protected void setUp() throws Exception { super.setUp(); factory = new GlyphFactory(new TestGrid()); } public void testStandardWidth() { // Arrange int expectedWidth = 7; // Act
Glyph digit = factory.createDigit();
EscapeIndustries/DotMatrixView
DotMatrixViewTests/src/com/escapeindustries/dotmatrix/tests/DigitDisplayTests.java
// Path: DotMatrixView/src/com/escapeindustries/dotmatrix/DigitDefinition.java // public class DigitDefinition { // private static int[] zero = { 1, 2, 3, 4, 5, 7, 13, 14, 20, 21, 27, 28, 34, // 35, 41, // // 49, 55, 56, 62, 63, 69, 70, 76, 77, 83, 85, 86, 87, 88, 89 }; // // private static int[] one = { 13, 20, 27, 34, 41, 55, 62, 69, 76, 83 }; // private static int[] two = { 1, 2, 3, 4, 5, 13, 20, 27, 34, 41, 43, 44, 45, // 46, 47, 49, 56, 63, 70, 77, 85, 86, 87, 88, 89 }; // private static int[] three = { 1, 2, 3, 4, 5, 13, 20, 27, 34, 41, 43, 44, // 45, 46, 47, 55, 62, 69, 76, 83, 85, 86, 87, 88, 89 }; // private static int[] four = { 7, 13, 14, 20, 21, 27, 28, 34, 35, 41, 43, // 44, 45, 46, 47, 55, 62, 69, 76, 83 }; // private static int[] five = { 1, 2, 3, 4, 5, 7, 14, 21, 28, 35, 43, 44, 45, // 46, 47, 55, 62, 69, 76, 83, 85, 86, 87, 88, 89 }; // private static int[] six = { 7, 14, 21, 28, 35, 43, 44, 45, 46, 47, 49, 55, // 56, 62, 63, 69, 70, 76, 77, 83, 85, 86, 87, 88, 89 }; // private static int[] seven = { 1, 2, 3, 4, 5, 13, 20, 27, 34, 41, // // 55, 62, 69, 76, 83 }; // // private static int[] eight = { 1, 2, 3, 4, 5, 7, 13, 14, 20, 21, 27, 28, // 34, 35, 41, 43, 44, 45, 46, 47, 49, 55, 56, 62, 63, 69, 70, 76, 77, // 83, 85, 86, 87, 88, 89 }; // // private static int[] nine = { 1, 2, 3, 4, 5, 7, 13, 14, 20, 21, 27, 28, 34, // 35, 41, 43, 44, 45, 46, 47, 55, 62, 69, 76, 83 }; // private static int[] allDotsOff = {}; // // public static int[][] patterns = { zero, one, two, three, four, five, six, // seven, eight, nine, allDotsOff }; // } // // Path: DotMatrixView/src/com/escapeindustries/dotmatrix/GlyphTransition.java // public class GlyphTransition { // // private DotChangeAction action; // // /** // * Construct and configure a GlyphTransition. // * // * @param action // * action will be informed of all changes that need to be made // * when transitions are calculated. // */ // public GlyphTransition(DotChangeAction action) { // this.action = action; // } // // /** // * Inform the member DotChangeAction which dots need to be change state to // * move from the current state to the next state. The parameters are arrays // * of one dimensional coordinates beginning in the top right corner of the // * part of the {@link Grid} that the {@link Glyph} is being rendered in. // * // * @param from // * A list of 1 dimensional co-ordinates, in ascending order, of // * dots that are currently on. // * @param to // * A list of 1 dimensional co-ordinate, in ascending order, of // * dots that will be on when the transition ends. // */ // public void makeTransition(int[] from, int[] to) { // int f = 0; // int t = 0; // while (f < from.length && t < to.length) { // if (from[f] == to[t]) { // // Dot should stay on - no change // f++; // t++; // } else if (from[f] > to[t]) { // // Dot should be lit // action.dotHasChanged(to[t], true); // t++; // } else { // // Dot should be dimmed // action.dotHasChanged(from[f], false); // f++; // } // } // if (f < from.length) { // // Reached the end of to before the end of from - remaining from // // must be dimmed // for (; f < from.length; f++) { // action.dotHasChanged(from[f], false); // } // } else if (t < to.length) { // // Reached the end of from before the end of to - remaining to must // // be lit // for (; t < to.length; t++) { // action.dotHasChanged(to[t], true); // } // } // } // }
import com.escapeindustries.dotmatrix.DigitDefinition; import com.escapeindustries.dotmatrix.GlyphTransition; import junit.framework.TestCase;
package com.escapeindustries.dotmatrix.tests; public class DigitDisplayTests extends TestCase { // Shared between tests private int[] one; private int[] two; private int[] three; private DotChangeCounter counter; @Override protected void setUp() throws Exception {
// Path: DotMatrixView/src/com/escapeindustries/dotmatrix/DigitDefinition.java // public class DigitDefinition { // private static int[] zero = { 1, 2, 3, 4, 5, 7, 13, 14, 20, 21, 27, 28, 34, // 35, 41, // // 49, 55, 56, 62, 63, 69, 70, 76, 77, 83, 85, 86, 87, 88, 89 }; // // private static int[] one = { 13, 20, 27, 34, 41, 55, 62, 69, 76, 83 }; // private static int[] two = { 1, 2, 3, 4, 5, 13, 20, 27, 34, 41, 43, 44, 45, // 46, 47, 49, 56, 63, 70, 77, 85, 86, 87, 88, 89 }; // private static int[] three = { 1, 2, 3, 4, 5, 13, 20, 27, 34, 41, 43, 44, // 45, 46, 47, 55, 62, 69, 76, 83, 85, 86, 87, 88, 89 }; // private static int[] four = { 7, 13, 14, 20, 21, 27, 28, 34, 35, 41, 43, // 44, 45, 46, 47, 55, 62, 69, 76, 83 }; // private static int[] five = { 1, 2, 3, 4, 5, 7, 14, 21, 28, 35, 43, 44, 45, // 46, 47, 55, 62, 69, 76, 83, 85, 86, 87, 88, 89 }; // private static int[] six = { 7, 14, 21, 28, 35, 43, 44, 45, 46, 47, 49, 55, // 56, 62, 63, 69, 70, 76, 77, 83, 85, 86, 87, 88, 89 }; // private static int[] seven = { 1, 2, 3, 4, 5, 13, 20, 27, 34, 41, // // 55, 62, 69, 76, 83 }; // // private static int[] eight = { 1, 2, 3, 4, 5, 7, 13, 14, 20, 21, 27, 28, // 34, 35, 41, 43, 44, 45, 46, 47, 49, 55, 56, 62, 63, 69, 70, 76, 77, // 83, 85, 86, 87, 88, 89 }; // // private static int[] nine = { 1, 2, 3, 4, 5, 7, 13, 14, 20, 21, 27, 28, 34, // 35, 41, 43, 44, 45, 46, 47, 55, 62, 69, 76, 83 }; // private static int[] allDotsOff = {}; // // public static int[][] patterns = { zero, one, two, three, four, five, six, // seven, eight, nine, allDotsOff }; // } // // Path: DotMatrixView/src/com/escapeindustries/dotmatrix/GlyphTransition.java // public class GlyphTransition { // // private DotChangeAction action; // // /** // * Construct and configure a GlyphTransition. // * // * @param action // * action will be informed of all changes that need to be made // * when transitions are calculated. // */ // public GlyphTransition(DotChangeAction action) { // this.action = action; // } // // /** // * Inform the member DotChangeAction which dots need to be change state to // * move from the current state to the next state. The parameters are arrays // * of one dimensional coordinates beginning in the top right corner of the // * part of the {@link Grid} that the {@link Glyph} is being rendered in. // * // * @param from // * A list of 1 dimensional co-ordinates, in ascending order, of // * dots that are currently on. // * @param to // * A list of 1 dimensional co-ordinate, in ascending order, of // * dots that will be on when the transition ends. // */ // public void makeTransition(int[] from, int[] to) { // int f = 0; // int t = 0; // while (f < from.length && t < to.length) { // if (from[f] == to[t]) { // // Dot should stay on - no change // f++; // t++; // } else if (from[f] > to[t]) { // // Dot should be lit // action.dotHasChanged(to[t], true); // t++; // } else { // // Dot should be dimmed // action.dotHasChanged(from[f], false); // f++; // } // } // if (f < from.length) { // // Reached the end of to before the end of from - remaining from // // must be dimmed // for (; f < from.length; f++) { // action.dotHasChanged(from[f], false); // } // } else if (t < to.length) { // // Reached the end of from before the end of to - remaining to must // // be lit // for (; t < to.length; t++) { // action.dotHasChanged(to[t], true); // } // } // } // } // Path: DotMatrixViewTests/src/com/escapeindustries/dotmatrix/tests/DigitDisplayTests.java import com.escapeindustries.dotmatrix.DigitDefinition; import com.escapeindustries.dotmatrix.GlyphTransition; import junit.framework.TestCase; package com.escapeindustries.dotmatrix.tests; public class DigitDisplayTests extends TestCase { // Shared between tests private int[] one; private int[] two; private int[] three; private DotChangeCounter counter; @Override protected void setUp() throws Exception {
one = DigitDefinition.patterns[1];
EscapeIndustries/DotMatrixView
DotMatrixViewTests/src/com/escapeindustries/dotmatrix/tests/DigitDisplayTests.java
// Path: DotMatrixView/src/com/escapeindustries/dotmatrix/DigitDefinition.java // public class DigitDefinition { // private static int[] zero = { 1, 2, 3, 4, 5, 7, 13, 14, 20, 21, 27, 28, 34, // 35, 41, // // 49, 55, 56, 62, 63, 69, 70, 76, 77, 83, 85, 86, 87, 88, 89 }; // // private static int[] one = { 13, 20, 27, 34, 41, 55, 62, 69, 76, 83 }; // private static int[] two = { 1, 2, 3, 4, 5, 13, 20, 27, 34, 41, 43, 44, 45, // 46, 47, 49, 56, 63, 70, 77, 85, 86, 87, 88, 89 }; // private static int[] three = { 1, 2, 3, 4, 5, 13, 20, 27, 34, 41, 43, 44, // 45, 46, 47, 55, 62, 69, 76, 83, 85, 86, 87, 88, 89 }; // private static int[] four = { 7, 13, 14, 20, 21, 27, 28, 34, 35, 41, 43, // 44, 45, 46, 47, 55, 62, 69, 76, 83 }; // private static int[] five = { 1, 2, 3, 4, 5, 7, 14, 21, 28, 35, 43, 44, 45, // 46, 47, 55, 62, 69, 76, 83, 85, 86, 87, 88, 89 }; // private static int[] six = { 7, 14, 21, 28, 35, 43, 44, 45, 46, 47, 49, 55, // 56, 62, 63, 69, 70, 76, 77, 83, 85, 86, 87, 88, 89 }; // private static int[] seven = { 1, 2, 3, 4, 5, 13, 20, 27, 34, 41, // // 55, 62, 69, 76, 83 }; // // private static int[] eight = { 1, 2, 3, 4, 5, 7, 13, 14, 20, 21, 27, 28, // 34, 35, 41, 43, 44, 45, 46, 47, 49, 55, 56, 62, 63, 69, 70, 76, 77, // 83, 85, 86, 87, 88, 89 }; // // private static int[] nine = { 1, 2, 3, 4, 5, 7, 13, 14, 20, 21, 27, 28, 34, // 35, 41, 43, 44, 45, 46, 47, 55, 62, 69, 76, 83 }; // private static int[] allDotsOff = {}; // // public static int[][] patterns = { zero, one, two, three, four, five, six, // seven, eight, nine, allDotsOff }; // } // // Path: DotMatrixView/src/com/escapeindustries/dotmatrix/GlyphTransition.java // public class GlyphTransition { // // private DotChangeAction action; // // /** // * Construct and configure a GlyphTransition. // * // * @param action // * action will be informed of all changes that need to be made // * when transitions are calculated. // */ // public GlyphTransition(DotChangeAction action) { // this.action = action; // } // // /** // * Inform the member DotChangeAction which dots need to be change state to // * move from the current state to the next state. The parameters are arrays // * of one dimensional coordinates beginning in the top right corner of the // * part of the {@link Grid} that the {@link Glyph} is being rendered in. // * // * @param from // * A list of 1 dimensional co-ordinates, in ascending order, of // * dots that are currently on. // * @param to // * A list of 1 dimensional co-ordinate, in ascending order, of // * dots that will be on when the transition ends. // */ // public void makeTransition(int[] from, int[] to) { // int f = 0; // int t = 0; // while (f < from.length && t < to.length) { // if (from[f] == to[t]) { // // Dot should stay on - no change // f++; // t++; // } else if (from[f] > to[t]) { // // Dot should be lit // action.dotHasChanged(to[t], true); // t++; // } else { // // Dot should be dimmed // action.dotHasChanged(from[f], false); // f++; // } // } // if (f < from.length) { // // Reached the end of to before the end of from - remaining from // // must be dimmed // for (; f < from.length; f++) { // action.dotHasChanged(from[f], false); // } // } else if (t < to.length) { // // Reached the end of from before the end of to - remaining to must // // be lit // for (; t < to.length; t++) { // action.dotHasChanged(to[t], true); // } // } // } // }
import com.escapeindustries.dotmatrix.DigitDefinition; import com.escapeindustries.dotmatrix.GlyphTransition; import junit.framework.TestCase;
package com.escapeindustries.dotmatrix.tests; public class DigitDisplayTests extends TestCase { // Shared between tests private int[] one; private int[] two; private int[] three; private DotChangeCounter counter; @Override protected void setUp() throws Exception { one = DigitDefinition.patterns[1]; two = DigitDefinition.patterns[2]; three = DigitDefinition.patterns[3]; counter = new DotChangeCounter(); } public void testFindCorrectDotsToDimFromEndsBeforeTo() { // Arrange int[] expected = { 55, 62, 69, 76, 83 };
// Path: DotMatrixView/src/com/escapeindustries/dotmatrix/DigitDefinition.java // public class DigitDefinition { // private static int[] zero = { 1, 2, 3, 4, 5, 7, 13, 14, 20, 21, 27, 28, 34, // 35, 41, // // 49, 55, 56, 62, 63, 69, 70, 76, 77, 83, 85, 86, 87, 88, 89 }; // // private static int[] one = { 13, 20, 27, 34, 41, 55, 62, 69, 76, 83 }; // private static int[] two = { 1, 2, 3, 4, 5, 13, 20, 27, 34, 41, 43, 44, 45, // 46, 47, 49, 56, 63, 70, 77, 85, 86, 87, 88, 89 }; // private static int[] three = { 1, 2, 3, 4, 5, 13, 20, 27, 34, 41, 43, 44, // 45, 46, 47, 55, 62, 69, 76, 83, 85, 86, 87, 88, 89 }; // private static int[] four = { 7, 13, 14, 20, 21, 27, 28, 34, 35, 41, 43, // 44, 45, 46, 47, 55, 62, 69, 76, 83 }; // private static int[] five = { 1, 2, 3, 4, 5, 7, 14, 21, 28, 35, 43, 44, 45, // 46, 47, 55, 62, 69, 76, 83, 85, 86, 87, 88, 89 }; // private static int[] six = { 7, 14, 21, 28, 35, 43, 44, 45, 46, 47, 49, 55, // 56, 62, 63, 69, 70, 76, 77, 83, 85, 86, 87, 88, 89 }; // private static int[] seven = { 1, 2, 3, 4, 5, 13, 20, 27, 34, 41, // // 55, 62, 69, 76, 83 }; // // private static int[] eight = { 1, 2, 3, 4, 5, 7, 13, 14, 20, 21, 27, 28, // 34, 35, 41, 43, 44, 45, 46, 47, 49, 55, 56, 62, 63, 69, 70, 76, 77, // 83, 85, 86, 87, 88, 89 }; // // private static int[] nine = { 1, 2, 3, 4, 5, 7, 13, 14, 20, 21, 27, 28, 34, // 35, 41, 43, 44, 45, 46, 47, 55, 62, 69, 76, 83 }; // private static int[] allDotsOff = {}; // // public static int[][] patterns = { zero, one, two, three, four, five, six, // seven, eight, nine, allDotsOff }; // } // // Path: DotMatrixView/src/com/escapeindustries/dotmatrix/GlyphTransition.java // public class GlyphTransition { // // private DotChangeAction action; // // /** // * Construct and configure a GlyphTransition. // * // * @param action // * action will be informed of all changes that need to be made // * when transitions are calculated. // */ // public GlyphTransition(DotChangeAction action) { // this.action = action; // } // // /** // * Inform the member DotChangeAction which dots need to be change state to // * move from the current state to the next state. The parameters are arrays // * of one dimensional coordinates beginning in the top right corner of the // * part of the {@link Grid} that the {@link Glyph} is being rendered in. // * // * @param from // * A list of 1 dimensional co-ordinates, in ascending order, of // * dots that are currently on. // * @param to // * A list of 1 dimensional co-ordinate, in ascending order, of // * dots that will be on when the transition ends. // */ // public void makeTransition(int[] from, int[] to) { // int f = 0; // int t = 0; // while (f < from.length && t < to.length) { // if (from[f] == to[t]) { // // Dot should stay on - no change // f++; // t++; // } else if (from[f] > to[t]) { // // Dot should be lit // action.dotHasChanged(to[t], true); // t++; // } else { // // Dot should be dimmed // action.dotHasChanged(from[f], false); // f++; // } // } // if (f < from.length) { // // Reached the end of to before the end of from - remaining from // // must be dimmed // for (; f < from.length; f++) { // action.dotHasChanged(from[f], false); // } // } else if (t < to.length) { // // Reached the end of from before the end of to - remaining to must // // be lit // for (; t < to.length; t++) { // action.dotHasChanged(to[t], true); // } // } // } // } // Path: DotMatrixViewTests/src/com/escapeindustries/dotmatrix/tests/DigitDisplayTests.java import com.escapeindustries.dotmatrix.DigitDefinition; import com.escapeindustries.dotmatrix.GlyphTransition; import junit.framework.TestCase; package com.escapeindustries.dotmatrix.tests; public class DigitDisplayTests extends TestCase { // Shared between tests private int[] one; private int[] two; private int[] three; private DotChangeCounter counter; @Override protected void setUp() throws Exception { one = DigitDefinition.patterns[1]; two = DigitDefinition.patterns[2]; three = DigitDefinition.patterns[3]; counter = new DotChangeCounter(); } public void testFindCorrectDotsToDimFromEndsBeforeTo() { // Arrange int[] expected = { 55, 62, 69, 76, 83 };
GlyphTransition trans = new GlyphTransition(counter);
EscapeIndustries/DotMatrixView
DotMatrixViewTests/src/com/escapeindustries/dotmatrix/tests/TimeSourceTests.java
// Path: DotMatrixView/src/com/escapeindustries/dotmatrix/FormattedTime.java // public class FormattedTime { // // private TimeSource source; // // /** // * @param source // * The {@link TimeSource} to wrap // */ // public FormattedTime(TimeSource source) { // this.source = source; // } // // /** // * Get the consistently formatted current value from the wrapped // * {@link TimeSource}. // * // * @return The current value of the wrapped {@link TimeSource} in a // * consistent format // */ // public String getNow() { // Calendar now = source.getNow(); // return getTwoDigits(now.get(Calendar.HOUR_OF_DAY)) + ":" // + getTwoDigits(now.get(Calendar.MINUTE)) + ":" // + getTwoDigits(now.get(Calendar.SECOND)); // } // // private String getTwoDigits(int value) { // return "" + (value < 10 ? "0" + value : value); // } // // }
import com.escapeindustries.dotmatrix.FormattedTime; import junit.framework.TestCase;
package com.escapeindustries.dotmatrix.tests; public class TimeSourceTests extends TestCase { private TestTimeSource source;
// Path: DotMatrixView/src/com/escapeindustries/dotmatrix/FormattedTime.java // public class FormattedTime { // // private TimeSource source; // // /** // * @param source // * The {@link TimeSource} to wrap // */ // public FormattedTime(TimeSource source) { // this.source = source; // } // // /** // * Get the consistently formatted current value from the wrapped // * {@link TimeSource}. // * // * @return The current value of the wrapped {@link TimeSource} in a // * consistent format // */ // public String getNow() { // Calendar now = source.getNow(); // return getTwoDigits(now.get(Calendar.HOUR_OF_DAY)) + ":" // + getTwoDigits(now.get(Calendar.MINUTE)) + ":" // + getTwoDigits(now.get(Calendar.SECOND)); // } // // private String getTwoDigits(int value) { // return "" + (value < 10 ? "0" + value : value); // } // // } // Path: DotMatrixViewTests/src/com/escapeindustries/dotmatrix/tests/TimeSourceTests.java import com.escapeindustries.dotmatrix.FormattedTime; import junit.framework.TestCase; package com.escapeindustries.dotmatrix.tests; public class TimeSourceTests extends TestCase { private TestTimeSource source;
private FormattedTime formatter;
cs2103jan2015-w13-3j/main
src/udo/storage/TimeSlots.java
// Path: src/udo/storage/Task.java // public static enum TaskType {DEADLINE, EVENT, TODO};
import java.util.ArrayList; import edu.emory.mathcs.backport.java.util.Collections; import udo.storage.Task.TaskType;
package udo.storage; /** * This class processes the task list to determine * the occupied time slots and free time slots */ //@author A0113038U public class TimeSlots { private static final String CONTENT_FREE_SLOT = "Free slot"; private ArrayList<Task> occupiedSlots; private ArrayList<Task> freeSlots; public TimeSlots(){ occupiedSlots = new ArrayList<Task>(); freeSlots = new ArrayList<Task>(); } public TimeSlots(ArrayList<Task> taskList){ occupiedSlots = new ArrayList<Task>(); freeSlots = new ArrayList<Task>(); addEventTasks(taskList); Collections.sort(occupiedSlots, new StartTimeComparator()); mergeSlots(); setFreeSlots(); } private void addEventTasks(ArrayList<Task> taskList) { for (int i = 0; i < taskList.size(); i++){
// Path: src/udo/storage/Task.java // public static enum TaskType {DEADLINE, EVENT, TODO}; // Path: src/udo/storage/TimeSlots.java import java.util.ArrayList; import edu.emory.mathcs.backport.java.util.Collections; import udo.storage.Task.TaskType; package udo.storage; /** * This class processes the task list to determine * the occupied time slots and free time slots */ //@author A0113038U public class TimeSlots { private static final String CONTENT_FREE_SLOT = "Free slot"; private ArrayList<Task> occupiedSlots; private ArrayList<Task> freeSlots; public TimeSlots(){ occupiedSlots = new ArrayList<Task>(); freeSlots = new ArrayList<Task>(); } public TimeSlots(ArrayList<Task> taskList){ occupiedSlots = new ArrayList<Task>(); freeSlots = new ArrayList<Task>(); addEventTasks(taskList); Collections.sort(occupiedSlots, new StartTimeComparator()); mergeSlots(); setFreeSlots(); } private void addEventTasks(ArrayList<Task> taskList) { for (int i = 0; i < taskList.size(); i++){
if (taskList.get(i).getTaskType() == TaskType.EVENT){
dyu/bookmarks
bookmarks-importer/src/main/java/bookmarks/user/ImportUtil.java
// Path: bookmarks-importer/src/main/java/com/dyuproject/protostuffdb/TsKeyUtil.java // public final class TsKeyUtil // { // private TsKeyUtil() {} // // public static <T extends Entity<T>> byte[] newKey(final EntityMetadata<T> em, // WriteContext context, // T entity) // { // byte[] key = new byte[9]; // entity.setTs(context.fillEntityKey(key, em.kind, context.ts(em), -1)); // return key; // } // }
import static com.dyuproject.protostuffdb.SerializedValueUtil.readBAO$len; import java.util.ArrayList; import java.util.Collection; import java.util.Collections; import java.util.Comparator; import java.util.HashMap; import java.util.List; import java.util.regex.Pattern; import com.dyuproject.protostuff.ByteString; import com.dyuproject.protostuff.IntSerializer; import com.dyuproject.protostuff.LongHashSet; import com.dyuproject.protostuffdb.DSRuntimeExceptions; import com.dyuproject.protostuffdb.Datastore; import com.dyuproject.protostuffdb.DateTimeUtil; import com.dyuproject.protostuffdb.EntityMetadata; import com.dyuproject.protostuffdb.HasKeyAndTs; import com.dyuproject.protostuffdb.KeyUtil; import com.dyuproject.protostuffdb.Op; import com.dyuproject.protostuffdb.OpChain; import com.dyuproject.protostuffdb.SerializedValueUtil; import com.dyuproject.protostuffdb.TsKeyUtil; import com.dyuproject.protostuffdb.ValueUtil; import com.dyuproject.protostuffdb.Visitor; import com.dyuproject.protostuffdb.WriteContext; import com.dyuproject.protostuffdb.tag.TagUtil;
final long ts = Long.parseLong(tsSec) * 1000; final String[] tags = tagCSV != null && !tagCSV.isEmpty() ? COMMA.split(tagCSV) : DEFAULT_TAGS; int concurrentStart = 0; BookmarkTag bt; if (sorted && tagCurrentId == 0) { // insert the first auto tag bt = new BookmarkTag(DEFAULT_TAG); bt.key = newKey(ts, context.exclusiveLast, keySuffixSet, bt, BookmarkTag.EM, bt.name, concurrentStart++); bt.id = ++tagCurrentId; tagMap.put(bt.name, bt); } for (String tag : tags) { // normalize tag = tag.toLowerCase(); if (TAG_PATTERN != null && !TAG_PATTERN.matcher(tag).matches()) return tagCurrentId; bt = tagMap.get(tag); if (bt == null) { bt = new BookmarkTag(tag); bt.key = sorted ? newKey(ts, context.exclusiveLast, keySuffixSet, bt, BookmarkTag.EM, bt.name, concurrentStart++) :
// Path: bookmarks-importer/src/main/java/com/dyuproject/protostuffdb/TsKeyUtil.java // public final class TsKeyUtil // { // private TsKeyUtil() {} // // public static <T extends Entity<T>> byte[] newKey(final EntityMetadata<T> em, // WriteContext context, // T entity) // { // byte[] key = new byte[9]; // entity.setTs(context.fillEntityKey(key, em.kind, context.ts(em), -1)); // return key; // } // } // Path: bookmarks-importer/src/main/java/bookmarks/user/ImportUtil.java import static com.dyuproject.protostuffdb.SerializedValueUtil.readBAO$len; import java.util.ArrayList; import java.util.Collection; import java.util.Collections; import java.util.Comparator; import java.util.HashMap; import java.util.List; import java.util.regex.Pattern; import com.dyuproject.protostuff.ByteString; import com.dyuproject.protostuff.IntSerializer; import com.dyuproject.protostuff.LongHashSet; import com.dyuproject.protostuffdb.DSRuntimeExceptions; import com.dyuproject.protostuffdb.Datastore; import com.dyuproject.protostuffdb.DateTimeUtil; import com.dyuproject.protostuffdb.EntityMetadata; import com.dyuproject.protostuffdb.HasKeyAndTs; import com.dyuproject.protostuffdb.KeyUtil; import com.dyuproject.protostuffdb.Op; import com.dyuproject.protostuffdb.OpChain; import com.dyuproject.protostuffdb.SerializedValueUtil; import com.dyuproject.protostuffdb.TsKeyUtil; import com.dyuproject.protostuffdb.ValueUtil; import com.dyuproject.protostuffdb.Visitor; import com.dyuproject.protostuffdb.WriteContext; import com.dyuproject.protostuffdb.tag.TagUtil; final long ts = Long.parseLong(tsSec) * 1000; final String[] tags = tagCSV != null && !tagCSV.isEmpty() ? COMMA.split(tagCSV) : DEFAULT_TAGS; int concurrentStart = 0; BookmarkTag bt; if (sorted && tagCurrentId == 0) { // insert the first auto tag bt = new BookmarkTag(DEFAULT_TAG); bt.key = newKey(ts, context.exclusiveLast, keySuffixSet, bt, BookmarkTag.EM, bt.name, concurrentStart++); bt.id = ++tagCurrentId; tagMap.put(bt.name, bt); } for (String tag : tags) { // normalize tag = tag.toLowerCase(); if (TAG_PATTERN != null && !TAG_PATTERN.matcher(tag).matches()) return tagCurrentId; bt = tagMap.get(tag); if (bt == null) { bt = new BookmarkTag(tag); bt.key = sorted ? newKey(ts, context.exclusiveLast, keySuffixSet, bt, BookmarkTag.EM, bt.name, concurrentStart++) :
TsKeyUtil.newKey(BookmarkTag.EM, context, bt);
csuyzb/AndroidLinkup
LinkupCore/src/com/znv/linkup/core/map/template/MapTemplate.java
// Path: LinkupCore/src/com/znv/linkup/core/GameSettings.java // public class GameSettings { // // /** // * 地板卡片值 // */ // public static byte GroundCardValue = 0; // // /** // * 游戏卡片值,用于地图模版 // */ // public static byte GameCardValue = 1; // // /** // * 障碍卡片值 // */ // public static byte ObstacleCardValue = -1; // // /** // * 空卡片值 // */ // public static byte EmptyCardValue = -2; // // /** // * 消除卡片获得的积分,消除一对卡片得10分 // */ // public static int CardScore = 5; // // /** // * 连击延时时间,2000ms // */ // public static int ComboDelay = 2000; // // /** // * 连击间隔,3连击,6连击,9连击。。。 // */ // public static int ComboMod = 3; // // /** // * 连击分数,3连击则3*10=30 // */ // public static int ComboScore = 10; // // /** // * 剩余时间奖励分数,剩余10s,则奖励40分 // */ // public static int TimeScore = 4; // // /** // * 路径转弯奖励分数,直线不奖励,一个弯奖励5分,2个弯奖励10分 // */ // public static int CornerScore = 5; // // /** // * 消除一对卡片奖励的时间,0s // */ // public static int RewardTime = 0; // // /** // * 减少时间奖励,补偿分数 // */ // public static int RewardScoreMax = 5; // // /** // * 任务系数 // */ // public static int TaskFactor = 10; // // /** // * 重排时尝试次数,默认5次 // */ // public static int RefreshTryCount = 5; // // /** // * 星星的比例 // */ // public static float StarRatio = 0.4f; // } // // Path: LinkupCore/src/com/znv/linkup/core/map/BaseMap.java // public class BaseMap implements Serializable { // private static final long serialVersionUID = 7379717910848419154L; // // protected BaseMap() { // } // // protected BaseMap(int ySize, int xSize) { // YSize = ySize; // XSize = xSize; // Data = new Byte[ySize][xSize]; // } // // /** // * 随机重排 // */ // public void randomRefresh() { // int index = 0; // // 获取游戏块的值 // List<Byte> array = new ArrayList<Byte>(); // for (int i = 0; i < YSize; i++) { // for (int j = 0; j < XSize; j++) { // if (isRefresh(i, j)) { // array.add(Data[i][j]); // } // } // } // // 随机打乱 // Collections.shuffle(array); // // 重新赋值 // index = 0; // for (int i = 0; i < YSize; i++) { // for (int j = 0; j < XSize; j++) { // if (isRefresh(i, j)) { // Data[i][j] = array.get(index++); // } // } // } // } // // protected boolean isRefresh(int i, int j) { // return true; // } // // @Override // public String toString() { // StringBuilder strMap = new StringBuilder(String.valueOf(YSize) + "*" + String.valueOf(XSize) + "$"); // for (int i = 0; i < YSize; i++) { // for (int j = 0; j < XSize; j++) { // strMap.append(String.valueOf(Data[i][j]) + ","); // } // strMap.replace(strMap.length() - 1, strMap.length(), ";"); // } // strMap.deleteCharAt(strMap.length() - 1); // return strMap.toString(); // } // // protected int YSize; // protected int XSize; // protected Byte[][] Data; // }
import com.znv.linkup.core.GameSettings; import com.znv.linkup.core.map.BaseMap;
package com.znv.linkup.core.map.template; /** * 地图模版类 * * @author yzb * */ public class MapTemplate extends BaseMap { private static final long serialVersionUID = -8030816635103999967L; protected MapTemplate() { } public MapTemplate(int ySize, int xSize) { this(ySize, xSize, 0, 0); } public MapTemplate(int ySize, int xSize, int empty, int obstacle) { super(ySize, xSize); this.EmptyCount = empty; this.ObstacleCount = obstacle; this.Data = new Byte[ySize][xSize]; initTemplate(); } protected void initTemplate() { for (int i = 0; i < YSize; i++) { for (int j = 0; j < XSize; j++) { if (i == 0 || i == YSize - 1 || j == 0 || j == XSize - 1) {
// Path: LinkupCore/src/com/znv/linkup/core/GameSettings.java // public class GameSettings { // // /** // * 地板卡片值 // */ // public static byte GroundCardValue = 0; // // /** // * 游戏卡片值,用于地图模版 // */ // public static byte GameCardValue = 1; // // /** // * 障碍卡片值 // */ // public static byte ObstacleCardValue = -1; // // /** // * 空卡片值 // */ // public static byte EmptyCardValue = -2; // // /** // * 消除卡片获得的积分,消除一对卡片得10分 // */ // public static int CardScore = 5; // // /** // * 连击延时时间,2000ms // */ // public static int ComboDelay = 2000; // // /** // * 连击间隔,3连击,6连击,9连击。。。 // */ // public static int ComboMod = 3; // // /** // * 连击分数,3连击则3*10=30 // */ // public static int ComboScore = 10; // // /** // * 剩余时间奖励分数,剩余10s,则奖励40分 // */ // public static int TimeScore = 4; // // /** // * 路径转弯奖励分数,直线不奖励,一个弯奖励5分,2个弯奖励10分 // */ // public static int CornerScore = 5; // // /** // * 消除一对卡片奖励的时间,0s // */ // public static int RewardTime = 0; // // /** // * 减少时间奖励,补偿分数 // */ // public static int RewardScoreMax = 5; // // /** // * 任务系数 // */ // public static int TaskFactor = 10; // // /** // * 重排时尝试次数,默认5次 // */ // public static int RefreshTryCount = 5; // // /** // * 星星的比例 // */ // public static float StarRatio = 0.4f; // } // // Path: LinkupCore/src/com/znv/linkup/core/map/BaseMap.java // public class BaseMap implements Serializable { // private static final long serialVersionUID = 7379717910848419154L; // // protected BaseMap() { // } // // protected BaseMap(int ySize, int xSize) { // YSize = ySize; // XSize = xSize; // Data = new Byte[ySize][xSize]; // } // // /** // * 随机重排 // */ // public void randomRefresh() { // int index = 0; // // 获取游戏块的值 // List<Byte> array = new ArrayList<Byte>(); // for (int i = 0; i < YSize; i++) { // for (int j = 0; j < XSize; j++) { // if (isRefresh(i, j)) { // array.add(Data[i][j]); // } // } // } // // 随机打乱 // Collections.shuffle(array); // // 重新赋值 // index = 0; // for (int i = 0; i < YSize; i++) { // for (int j = 0; j < XSize; j++) { // if (isRefresh(i, j)) { // Data[i][j] = array.get(index++); // } // } // } // } // // protected boolean isRefresh(int i, int j) { // return true; // } // // @Override // public String toString() { // StringBuilder strMap = new StringBuilder(String.valueOf(YSize) + "*" + String.valueOf(XSize) + "$"); // for (int i = 0; i < YSize; i++) { // for (int j = 0; j < XSize; j++) { // strMap.append(String.valueOf(Data[i][j]) + ","); // } // strMap.replace(strMap.length() - 1, strMap.length(), ";"); // } // strMap.deleteCharAt(strMap.length() - 1); // return strMap.toString(); // } // // protected int YSize; // protected int XSize; // protected Byte[][] Data; // } // Path: LinkupCore/src/com/znv/linkup/core/map/template/MapTemplate.java import com.znv.linkup.core.GameSettings; import com.znv.linkup.core.map.BaseMap; package com.znv.linkup.core.map.template; /** * 地图模版类 * * @author yzb * */ public class MapTemplate extends BaseMap { private static final long serialVersionUID = -8030816635103999967L; protected MapTemplate() { } public MapTemplate(int ySize, int xSize) { this(ySize, xSize, 0, 0); } public MapTemplate(int ySize, int xSize, int empty, int obstacle) { super(ySize, xSize); this.EmptyCount = empty; this.ObstacleCount = obstacle; this.Data = new Byte[ySize][xSize]; initTemplate(); } protected void initTemplate() { for (int i = 0; i < YSize; i++) { for (int j = 0; j < XSize; j++) { if (i == 0 || i == YSize - 1 || j == 0 || j == XSize - 1) {
Data[i][j] = GameSettings.GroundCardValue;
csuyzb/AndroidLinkup
LinkupCore/src/com/znv/linkup/core/card/Piece.java
// Path: LinkupCore/src/com/znv/linkup/core/GameSettings.java // public class GameSettings { // // /** // * 地板卡片值 // */ // public static byte GroundCardValue = 0; // // /** // * 游戏卡片值,用于地图模版 // */ // public static byte GameCardValue = 1; // // /** // * 障碍卡片值 // */ // public static byte ObstacleCardValue = -1; // // /** // * 空卡片值 // */ // public static byte EmptyCardValue = -2; // // /** // * 消除卡片获得的积分,消除一对卡片得10分 // */ // public static int CardScore = 5; // // /** // * 连击延时时间,2000ms // */ // public static int ComboDelay = 2000; // // /** // * 连击间隔,3连击,6连击,9连击。。。 // */ // public static int ComboMod = 3; // // /** // * 连击分数,3连击则3*10=30 // */ // public static int ComboScore = 10; // // /** // * 剩余时间奖励分数,剩余10s,则奖励40分 // */ // public static int TimeScore = 4; // // /** // * 路径转弯奖励分数,直线不奖励,一个弯奖励5分,2个弯奖励10分 // */ // public static int CornerScore = 5; // // /** // * 消除一对卡片奖励的时间,0s // */ // public static int RewardTime = 0; // // /** // * 减少时间奖励,补偿分数 // */ // public static int RewardScoreMax = 5; // // /** // * 任务系数 // */ // public static int TaskFactor = 10; // // /** // * 重排时尝试次数,默认5次 // */ // public static int RefreshTryCount = 5; // // /** // * 星星的比例 // */ // public static float StarRatio = 0.4f; // }
import android.graphics.Point; import com.znv.linkup.core.GameSettings;
* @param other * 要交换的卡片 */ public void exchange(Piece other) { // Bitmap bm = getImage(); // setImage(other.getImage()); // other.setImage(bm); int imageId = getImageId(); setImageId(other.getImageId()); other.setImageId(imageId); // boolean isEmpty = isEmpty(); // setEmpty(other.isEmpty()); // other.setEmpty(isEmpty); boolean isStar = isStar(); setStar(other.isStar()); other.setStar(isStar); } /** * 判断卡片上是否有图片 * * @param piece * 卡片信息 * @return 如果图片则返回true */ public static boolean hasImage(Piece piece) { // return piece != null && !piece.isEmpty() && piece.getImageId() != GameSettings.GroundCardValue && piece.getImageId() != GameSettings.EmptyCardValue;
// Path: LinkupCore/src/com/znv/linkup/core/GameSettings.java // public class GameSettings { // // /** // * 地板卡片值 // */ // public static byte GroundCardValue = 0; // // /** // * 游戏卡片值,用于地图模版 // */ // public static byte GameCardValue = 1; // // /** // * 障碍卡片值 // */ // public static byte ObstacleCardValue = -1; // // /** // * 空卡片值 // */ // public static byte EmptyCardValue = -2; // // /** // * 消除卡片获得的积分,消除一对卡片得10分 // */ // public static int CardScore = 5; // // /** // * 连击延时时间,2000ms // */ // public static int ComboDelay = 2000; // // /** // * 连击间隔,3连击,6连击,9连击。。。 // */ // public static int ComboMod = 3; // // /** // * 连击分数,3连击则3*10=30 // */ // public static int ComboScore = 10; // // /** // * 剩余时间奖励分数,剩余10s,则奖励40分 // */ // public static int TimeScore = 4; // // /** // * 路径转弯奖励分数,直线不奖励,一个弯奖励5分,2个弯奖励10分 // */ // public static int CornerScore = 5; // // /** // * 消除一对卡片奖励的时间,0s // */ // public static int RewardTime = 0; // // /** // * 减少时间奖励,补偿分数 // */ // public static int RewardScoreMax = 5; // // /** // * 任务系数 // */ // public static int TaskFactor = 10; // // /** // * 重排时尝试次数,默认5次 // */ // public static int RefreshTryCount = 5; // // /** // * 星星的比例 // */ // public static float StarRatio = 0.4f; // } // Path: LinkupCore/src/com/znv/linkup/core/card/Piece.java import android.graphics.Point; import com.znv.linkup.core.GameSettings; * @param other * 要交换的卡片 */ public void exchange(Piece other) { // Bitmap bm = getImage(); // setImage(other.getImage()); // other.setImage(bm); int imageId = getImageId(); setImageId(other.getImageId()); other.setImageId(imageId); // boolean isEmpty = isEmpty(); // setEmpty(other.isEmpty()); // other.setEmpty(isEmpty); boolean isStar = isStar(); setStar(other.isStar()); other.setStar(isStar); } /** * 判断卡片上是否有图片 * * @param piece * 卡片信息 * @return 如果图片则返回true */ public static boolean hasImage(Piece piece) { // return piece != null && !piece.isEmpty() && piece.getImageId() != GameSettings.GroundCardValue && piece.getImageId() != GameSettings.EmptyCardValue;
return piece != null && piece.getImageId() != GameSettings.GroundCardValue && piece.getImageId() != GameSettings.EmptyCardValue;
csuyzb/AndroidLinkup
LinkupCore/src/com/znv/linkup/core/map/template/RandomTemplate.java
// Path: LinkupCore/src/com/znv/linkup/core/GameSettings.java // public class GameSettings { // // /** // * 地板卡片值 // */ // public static byte GroundCardValue = 0; // // /** // * 游戏卡片值,用于地图模版 // */ // public static byte GameCardValue = 1; // // /** // * 障碍卡片值 // */ // public static byte ObstacleCardValue = -1; // // /** // * 空卡片值 // */ // public static byte EmptyCardValue = -2; // // /** // * 消除卡片获得的积分,消除一对卡片得10分 // */ // public static int CardScore = 5; // // /** // * 连击延时时间,2000ms // */ // public static int ComboDelay = 2000; // // /** // * 连击间隔,3连击,6连击,9连击。。。 // */ // public static int ComboMod = 3; // // /** // * 连击分数,3连击则3*10=30 // */ // public static int ComboScore = 10; // // /** // * 剩余时间奖励分数,剩余10s,则奖励40分 // */ // public static int TimeScore = 4; // // /** // * 路径转弯奖励分数,直线不奖励,一个弯奖励5分,2个弯奖励10分 // */ // public static int CornerScore = 5; // // /** // * 消除一对卡片奖励的时间,0s // */ // public static int RewardTime = 0; // // /** // * 减少时间奖励,补偿分数 // */ // public static int RewardScoreMax = 5; // // /** // * 任务系数 // */ // public static int TaskFactor = 10; // // /** // * 重排时尝试次数,默认5次 // */ // public static int RefreshTryCount = 5; // // /** // * 星星的比例 // */ // public static float StarRatio = 0.4f; // }
import com.znv.linkup.core.GameSettings;
package com.znv.linkup.core.map.template; /** * 随机地图模版 * * @author yzb * */ public class RandomTemplate extends MapTemplate { private static final long serialVersionUID = -4260503758055093714L; public RandomTemplate(int ySize, int xSize) { super(ySize, xSize); } public RandomTemplate(int ySize, int xSize, int emptyCount, int obstacleCount) { super(ySize, xSize, emptyCount, obstacleCount); } @Override /** * 随机产生可以成功配对消除完成的地图模版 */ protected void initTemplate() { int empty = EmptyCount; int obstacle = ObstacleCount; // 必须保证 Rows * Colomns - EmptyCount - ObstacleCount 为偶数 if (empty + obstacle < YSize * XSize) { for (int i = 0; i < YSize; i++) { for (int j = 0; j < XSize; j++) { if (i == 0 || i == YSize - 1 || j == 0 || j == XSize - 1) {
// Path: LinkupCore/src/com/znv/linkup/core/GameSettings.java // public class GameSettings { // // /** // * 地板卡片值 // */ // public static byte GroundCardValue = 0; // // /** // * 游戏卡片值,用于地图模版 // */ // public static byte GameCardValue = 1; // // /** // * 障碍卡片值 // */ // public static byte ObstacleCardValue = -1; // // /** // * 空卡片值 // */ // public static byte EmptyCardValue = -2; // // /** // * 消除卡片获得的积分,消除一对卡片得10分 // */ // public static int CardScore = 5; // // /** // * 连击延时时间,2000ms // */ // public static int ComboDelay = 2000; // // /** // * 连击间隔,3连击,6连击,9连击。。。 // */ // public static int ComboMod = 3; // // /** // * 连击分数,3连击则3*10=30 // */ // public static int ComboScore = 10; // // /** // * 剩余时间奖励分数,剩余10s,则奖励40分 // */ // public static int TimeScore = 4; // // /** // * 路径转弯奖励分数,直线不奖励,一个弯奖励5分,2个弯奖励10分 // */ // public static int CornerScore = 5; // // /** // * 消除一对卡片奖励的时间,0s // */ // public static int RewardTime = 0; // // /** // * 减少时间奖励,补偿分数 // */ // public static int RewardScoreMax = 5; // // /** // * 任务系数 // */ // public static int TaskFactor = 10; // // /** // * 重排时尝试次数,默认5次 // */ // public static int RefreshTryCount = 5; // // /** // * 星星的比例 // */ // public static float StarRatio = 0.4f; // } // Path: LinkupCore/src/com/znv/linkup/core/map/template/RandomTemplate.java import com.znv.linkup.core.GameSettings; package com.znv.linkup.core.map.template; /** * 随机地图模版 * * @author yzb * */ public class RandomTemplate extends MapTemplate { private static final long serialVersionUID = -4260503758055093714L; public RandomTemplate(int ySize, int xSize) { super(ySize, xSize); } public RandomTemplate(int ySize, int xSize, int emptyCount, int obstacleCount) { super(ySize, xSize, emptyCount, obstacleCount); } @Override /** * 随机产生可以成功配对消除完成的地图模版 */ protected void initTemplate() { int empty = EmptyCount; int obstacle = ObstacleCount; // 必须保证 Rows * Colomns - EmptyCount - ObstacleCount 为偶数 if (empty + obstacle < YSize * XSize) { for (int i = 0; i < YSize; i++) { for (int j = 0; j < XSize; j++) { if (i == 0 || i == YSize - 1 || j == 0 || j == XSize - 1) {
Data[i][j] = GameSettings.GroundCardValue;
csuyzb/AndroidLinkup
Linkup/src/com/znv/linkup/push/MessageReceiver.java
// Path: Linkup/src/com/znv/linkup/MyApplication.java // public class MyApplication extends Application { // // user your appid the key. // public static final String APP_ID = "2882303761517169919"; // // user your appid the key. // public static final String APP_KEY = "5451716979919"; // // // 此TAG在adb logcat中检索自己所需要的信息, 只需在命令行终端输入 adb logcat | grep com.znv.linkup // public static final String TAG = "com.znv.linkup"; // // // 小米推送的注册ID // public static String Push_Reg_ID = ""; // // @Override // public void onCreate() { // super.onCreate(); // // // 注册push服务,注册成功后会向DemoMessageReceiver发送广播 // // 可以从DemoMessageReceiver的onCommandResult方法中MiPushCommandMessage对象参数中获取注册信息 // if (shouldInit()) { // MiPushClient.registerPush(this, APP_ID, APP_KEY); // } // // // LoggerInterface newLogger = new LoggerInterface() { // // // // @Override // // public void setTag(String tag) { // // // ignore // // } // // // // @Override // // public void log(String content, Throwable t) { // // Log.d(TAG, content, t); // // } // // // // @Override // // public void log(String content) { // // Log.d(TAG, content); // // } // // }; // // Logger.setLogger(this, newLogger); // } // // private boolean shouldInit() { // ActivityManager am = ((ActivityManager) getSystemService(Context.ACTIVITY_SERVICE)); // List<RunningAppProcessInfo> processInfos = am.getRunningAppProcesses(); // String mainProcessName = getPackageName(); // int myPid = Process.myPid(); // for (RunningAppProcessInfo info : processInfos) { // if (info.pid == myPid && mainProcessName.equals(info.processName)) { // return true; // } // } // return false; // } // }
import java.util.List; import android.content.Context; import com.xiaomi.mipush.sdk.ErrorCode; import com.xiaomi.mipush.sdk.MiPushClient; import com.xiaomi.mipush.sdk.MiPushCommandMessage; import com.xiaomi.mipush.sdk.MiPushMessage; import com.xiaomi.mipush.sdk.PushMessageReceiver; import com.znv.linkup.MyApplication;
package com.znv.linkup.push; public class MessageReceiver extends PushMessageReceiver { @Override public void onCommandResult(Context arg0, MiPushCommandMessage message) { String command = message.getCommand(); List<String> arguments = message.getCommandArguments(); String cmdArg1 = ((arguments != null && arguments.size() > 0) ? arguments.get(0) : null); if (MiPushClient.COMMAND_REGISTER.equals(command)) { if (message.getResultCode() == ErrorCode.SUCCESS) {
// Path: Linkup/src/com/znv/linkup/MyApplication.java // public class MyApplication extends Application { // // user your appid the key. // public static final String APP_ID = "2882303761517169919"; // // user your appid the key. // public static final String APP_KEY = "5451716979919"; // // // 此TAG在adb logcat中检索自己所需要的信息, 只需在命令行终端输入 adb logcat | grep com.znv.linkup // public static final String TAG = "com.znv.linkup"; // // // 小米推送的注册ID // public static String Push_Reg_ID = ""; // // @Override // public void onCreate() { // super.onCreate(); // // // 注册push服务,注册成功后会向DemoMessageReceiver发送广播 // // 可以从DemoMessageReceiver的onCommandResult方法中MiPushCommandMessage对象参数中获取注册信息 // if (shouldInit()) { // MiPushClient.registerPush(this, APP_ID, APP_KEY); // } // // // LoggerInterface newLogger = new LoggerInterface() { // // // // @Override // // public void setTag(String tag) { // // // ignore // // } // // // // @Override // // public void log(String content, Throwable t) { // // Log.d(TAG, content, t); // // } // // // // @Override // // public void log(String content) { // // Log.d(TAG, content); // // } // // }; // // Logger.setLogger(this, newLogger); // } // // private boolean shouldInit() { // ActivityManager am = ((ActivityManager) getSystemService(Context.ACTIVITY_SERVICE)); // List<RunningAppProcessInfo> processInfos = am.getRunningAppProcesses(); // String mainProcessName = getPackageName(); // int myPid = Process.myPid(); // for (RunningAppProcessInfo info : processInfos) { // if (info.pid == myPid && mainProcessName.equals(info.processName)) { // return true; // } // } // return false; // } // } // Path: Linkup/src/com/znv/linkup/push/MessageReceiver.java import java.util.List; import android.content.Context; import com.xiaomi.mipush.sdk.ErrorCode; import com.xiaomi.mipush.sdk.MiPushClient; import com.xiaomi.mipush.sdk.MiPushCommandMessage; import com.xiaomi.mipush.sdk.MiPushMessage; import com.xiaomi.mipush.sdk.PushMessageReceiver; import com.znv.linkup.MyApplication; package com.znv.linkup.push; public class MessageReceiver extends PushMessageReceiver { @Override public void onCommandResult(Context arg0, MiPushCommandMessage message) { String command = message.getCommand(); List<String> arguments = message.getCommandArguments(); String cmdArg1 = ((arguments != null && arguments.size() > 0) ? arguments.get(0) : null); if (MiPushClient.COMMAND_REGISTER.equals(command)) { if (message.getResultCode() == ErrorCode.SUCCESS) {
MyApplication.Push_Reg_ID = cmdArg1;
csuyzb/AndroidLinkup
LinkupCore/src/com/znv/linkup/core/status/GameCombo.java
// Path: LinkupCore/src/com/znv/linkup/core/GameSettings.java // public class GameSettings { // // /** // * 地板卡片值 // */ // public static byte GroundCardValue = 0; // // /** // * 游戏卡片值,用于地图模版 // */ // public static byte GameCardValue = 1; // // /** // * 障碍卡片值 // */ // public static byte ObstacleCardValue = -1; // // /** // * 空卡片值 // */ // public static byte EmptyCardValue = -2; // // /** // * 消除卡片获得的积分,消除一对卡片得10分 // */ // public static int CardScore = 5; // // /** // * 连击延时时间,2000ms // */ // public static int ComboDelay = 2000; // // /** // * 连击间隔,3连击,6连击,9连击。。。 // */ // public static int ComboMod = 3; // // /** // * 连击分数,3连击则3*10=30 // */ // public static int ComboScore = 10; // // /** // * 剩余时间奖励分数,剩余10s,则奖励40分 // */ // public static int TimeScore = 4; // // /** // * 路径转弯奖励分数,直线不奖励,一个弯奖励5分,2个弯奖励10分 // */ // public static int CornerScore = 5; // // /** // * 消除一对卡片奖励的时间,0s // */ // public static int RewardTime = 0; // // /** // * 减少时间奖励,补偿分数 // */ // public static int RewardScoreMax = 5; // // /** // * 任务系数 // */ // public static int TaskFactor = 10; // // /** // * 重排时尝试次数,默认5次 // */ // public static int RefreshTryCount = 5; // // /** // * 星星的比例 // */ // public static float StarRatio = 0.4f; // }
import com.znv.linkup.core.GameSettings;
package com.znv.linkup.core.status; /** * 游戏连击处理 * * @author yzb * */ class GameCombo { public GameCombo() { this(null); } public GameCombo(IGameStatus listener) { combo = 0; preRemoveTime = System.currentTimeMillis(); this.listener = listener; } public void clearCombo() { combo = 0; } public void addCombo() { combo++; } /** * 获取连击得分 * * @return 连击奖励分数 */ public int getComboScore() { long curTime = System.currentTimeMillis(); long span = curTime - preRemoveTime; // 毫秒数
// Path: LinkupCore/src/com/znv/linkup/core/GameSettings.java // public class GameSettings { // // /** // * 地板卡片值 // */ // public static byte GroundCardValue = 0; // // /** // * 游戏卡片值,用于地图模版 // */ // public static byte GameCardValue = 1; // // /** // * 障碍卡片值 // */ // public static byte ObstacleCardValue = -1; // // /** // * 空卡片值 // */ // public static byte EmptyCardValue = -2; // // /** // * 消除卡片获得的积分,消除一对卡片得10分 // */ // public static int CardScore = 5; // // /** // * 连击延时时间,2000ms // */ // public static int ComboDelay = 2000; // // /** // * 连击间隔,3连击,6连击,9连击。。。 // */ // public static int ComboMod = 3; // // /** // * 连击分数,3连击则3*10=30 // */ // public static int ComboScore = 10; // // /** // * 剩余时间奖励分数,剩余10s,则奖励40分 // */ // public static int TimeScore = 4; // // /** // * 路径转弯奖励分数,直线不奖励,一个弯奖励5分,2个弯奖励10分 // */ // public static int CornerScore = 5; // // /** // * 消除一对卡片奖励的时间,0s // */ // public static int RewardTime = 0; // // /** // * 减少时间奖励,补偿分数 // */ // public static int RewardScoreMax = 5; // // /** // * 任务系数 // */ // public static int TaskFactor = 10; // // /** // * 重排时尝试次数,默认5次 // */ // public static int RefreshTryCount = 5; // // /** // * 星星的比例 // */ // public static float StarRatio = 0.4f; // } // Path: LinkupCore/src/com/znv/linkup/core/status/GameCombo.java import com.znv.linkup.core.GameSettings; package com.znv.linkup.core.status; /** * 游戏连击处理 * * @author yzb * */ class GameCombo { public GameCombo() { this(null); } public GameCombo(IGameStatus listener) { combo = 0; preRemoveTime = System.currentTimeMillis(); this.listener = listener; } public void clearCombo() { combo = 0; } public void addCombo() { combo++; } /** * 获取连击得分 * * @return 连击奖励分数 */ public int getComboScore() { long curTime = System.currentTimeMillis(); long span = curTime - preRemoveTime; // 毫秒数
int diff = (int) span - GameSettings.ComboDelay;
csuyzb/AndroidLinkup
Linkup/src/com/znv/linkup/util/AnimatorUtil.java
// Path: Linkup/src/com/znv/linkup/view/animation/HideAnimator.java // public class HideAnimator implements AnimatorListener { // // private View view = null; // // public HideAnimator(View view) { // this.view = view; // } // // @Override // public void onAnimationEnd(Animator animation) { // view.setVisibility(View.GONE); // } // // @Override // public void onAnimationRepeat(Animator animation) { // } // // @Override // public void onAnimationStart(Animator animation) { // view.setVisibility(View.VISIBLE); // } // // @Override // public void onAnimationCancel(Animator animation) { // // } // // }
import android.animation.Animator; import android.animation.ObjectAnimator; import android.view.View; import com.znv.linkup.view.animation.HideAnimator;
/** * 平移动画 * * @param view * 执行动画的view * @param fromX * 起始X坐标 * @param toX * 结束X坐标 * @param fromY * 起始Y坐标 * @param toY * 结束Y坐标 * @param duration * 动画时长 */ public static void animTranslate(View view, float fromX, float toX, float fromY, float toY, int duration, int delay, boolean isHide) { Animator animX = ObjectAnimator.ofFloat(view, "translationX", fromX, toX).setDuration(duration); Animator animY = ObjectAnimator.ofFloat(view, "translationY", fromY, toY).setDuration(duration); if (fromX != toX) { animX.setStartDelay(delay); animX.start(); } else { view.setTranslationX(fromX); } if (fromY != toY) { animY.setStartDelay(delay); if (isHide) {
// Path: Linkup/src/com/znv/linkup/view/animation/HideAnimator.java // public class HideAnimator implements AnimatorListener { // // private View view = null; // // public HideAnimator(View view) { // this.view = view; // } // // @Override // public void onAnimationEnd(Animator animation) { // view.setVisibility(View.GONE); // } // // @Override // public void onAnimationRepeat(Animator animation) { // } // // @Override // public void onAnimationStart(Animator animation) { // view.setVisibility(View.VISIBLE); // } // // @Override // public void onAnimationCancel(Animator animation) { // // } // // } // Path: Linkup/src/com/znv/linkup/util/AnimatorUtil.java import android.animation.Animator; import android.animation.ObjectAnimator; import android.view.View; import com.znv.linkup.view.animation.HideAnimator; /** * 平移动画 * * @param view * 执行动画的view * @param fromX * 起始X坐标 * @param toX * 结束X坐标 * @param fromY * 起始Y坐标 * @param toY * 结束Y坐标 * @param duration * 动画时长 */ public static void animTranslate(View view, float fromX, float toX, float fromY, float toY, int duration, int delay, boolean isHide) { Animator animX = ObjectAnimator.ofFloat(view, "translationX", fromX, toX).setDuration(duration); Animator animY = ObjectAnimator.ofFloat(view, "translationY", fromY, toY).setDuration(duration); if (fromX != toX) { animX.setStartDelay(delay); animX.start(); } else { view.setTranslationX(fromX); } if (fromY != toY) { animY.setStartDelay(delay); if (isHide) {
animY.addListener(new HideAnimator(view));
csuyzb/AndroidLinkup
Linkup/src/com/znv/linkup/view/indicator/RankAdapter.java
// Path: LinkupCore/src/com/znv/linkup/core/config/RankCfg.java // public class RankCfg implements Serializable { // // private static final long serialVersionUID = -5068249504885791712L; // // public RankCfg(String rankName) { // this.rankName = rankName; // } // // /** // * 获取游戏等级下的关卡最高分只和 // * // * @return // */ // public int getRankScore() { // int total = 0; // for (LevelCfg levelCfg : LevelInfos) { // total += levelCfg.getMaxScore(); // } // return total; // } // // public String getRankId() { // return rankId; // } // // public void setRankId(String rankId) { // this.rankId = rankId; // } // // public String getRankName() { // return rankName; // } // // public void setRankName(String rankName) { // this.rankName = rankName; // } // // public String getGameSkin() { // return gameSkin; // } // // public void setGameSkin(String gameSkin) { // this.gameSkin = gameSkin; // } // // public List<LevelCfg> getLevelInfos() { // return LevelInfos; // } // // public void setLevelInfos(List<LevelCfg> levelInfos) { // LevelInfos = levelInfos; // } // // public int getRankBackground() { // return rankBackground; // } // // public void setRankBackground(int rankBackground) { // this.rankBackground = rankBackground; // } // // private String rankId; // private String rankName; // private String gameSkin; // private int rankBackground; // private List<LevelCfg> LevelInfos = new ArrayList<LevelCfg>(); // } // // Path: Linkup/src/com/znv/linkup/view/indicator/Rank.java // public class RankHolder { // TextView tvTitle; // GridView rankGrid; // }
import java.util.ArrayList; import java.util.List; import android.content.Context; import android.support.v4.view.PagerAdapter; import android.support.v4.view.ViewPager; import android.view.View; import com.znv.linkup.core.config.RankCfg; import com.znv.linkup.view.indicator.Rank.RankHolder;
return rankCfgs.size(); } @Override public boolean isViewFromObject(View arg0, Object arg1) { return arg0 == arg1; } @Override public Object instantiateItem(View arg0, int arg1) { View rankView = ranks[arg1].getRankView(); if (rankView.getParent() != null) { ((ViewPager) rankView.getParent()).removeView(rankView); } ((ViewPager) arg0).addView(rankView); return rankView; } @Override public void destroyItem(View arg0, int arg1, Object arg2) { ((ViewPager) arg0).removeView(ranks[arg1].getRankHolder().rankGrid); } /** * 更新rank信息 * * @param i * 页码 */ private void updateRankInfo(int i) {
// Path: LinkupCore/src/com/znv/linkup/core/config/RankCfg.java // public class RankCfg implements Serializable { // // private static final long serialVersionUID = -5068249504885791712L; // // public RankCfg(String rankName) { // this.rankName = rankName; // } // // /** // * 获取游戏等级下的关卡最高分只和 // * // * @return // */ // public int getRankScore() { // int total = 0; // for (LevelCfg levelCfg : LevelInfos) { // total += levelCfg.getMaxScore(); // } // return total; // } // // public String getRankId() { // return rankId; // } // // public void setRankId(String rankId) { // this.rankId = rankId; // } // // public String getRankName() { // return rankName; // } // // public void setRankName(String rankName) { // this.rankName = rankName; // } // // public String getGameSkin() { // return gameSkin; // } // // public void setGameSkin(String gameSkin) { // this.gameSkin = gameSkin; // } // // public List<LevelCfg> getLevelInfos() { // return LevelInfos; // } // // public void setLevelInfos(List<LevelCfg> levelInfos) { // LevelInfos = levelInfos; // } // // public int getRankBackground() { // return rankBackground; // } // // public void setRankBackground(int rankBackground) { // this.rankBackground = rankBackground; // } // // private String rankId; // private String rankName; // private String gameSkin; // private int rankBackground; // private List<LevelCfg> LevelInfos = new ArrayList<LevelCfg>(); // } // // Path: Linkup/src/com/znv/linkup/view/indicator/Rank.java // public class RankHolder { // TextView tvTitle; // GridView rankGrid; // } // Path: Linkup/src/com/znv/linkup/view/indicator/RankAdapter.java import java.util.ArrayList; import java.util.List; import android.content.Context; import android.support.v4.view.PagerAdapter; import android.support.v4.view.ViewPager; import android.view.View; import com.znv.linkup.core.config.RankCfg; import com.znv.linkup.view.indicator.Rank.RankHolder; return rankCfgs.size(); } @Override public boolean isViewFromObject(View arg0, Object arg1) { return arg0 == arg1; } @Override public Object instantiateItem(View arg0, int arg1) { View rankView = ranks[arg1].getRankView(); if (rankView.getParent() != null) { ((ViewPager) rankView.getParent()).removeView(rankView); } ((ViewPager) arg0).addView(rankView); return rankView; } @Override public void destroyItem(View arg0, int arg1, Object arg2) { ((ViewPager) arg0).removeView(ranks[arg1].getRankHolder().rankGrid); } /** * 更新rank信息 * * @param i * 页码 */ private void updateRankInfo(int i) {
RankHolder holder = ranks[i].getRankHolder();
csuyzb/AndroidLinkup
LinkupCore/src/com/znv/linkup/core/status/GameScore.java
// Path: LinkupCore/src/com/znv/linkup/core/GameSettings.java // public class GameSettings { // // /** // * 地板卡片值 // */ // public static byte GroundCardValue = 0; // // /** // * 游戏卡片值,用于地图模版 // */ // public static byte GameCardValue = 1; // // /** // * 障碍卡片值 // */ // public static byte ObstacleCardValue = -1; // // /** // * 空卡片值 // */ // public static byte EmptyCardValue = -2; // // /** // * 消除卡片获得的积分,消除一对卡片得10分 // */ // public static int CardScore = 5; // // /** // * 连击延时时间,2000ms // */ // public static int ComboDelay = 2000; // // /** // * 连击间隔,3连击,6连击,9连击。。。 // */ // public static int ComboMod = 3; // // /** // * 连击分数,3连击则3*10=30 // */ // public static int ComboScore = 10; // // /** // * 剩余时间奖励分数,剩余10s,则奖励40分 // */ // public static int TimeScore = 4; // // /** // * 路径转弯奖励分数,直线不奖励,一个弯奖励5分,2个弯奖励10分 // */ // public static int CornerScore = 5; // // /** // * 消除一对卡片奖励的时间,0s // */ // public static int RewardTime = 0; // // /** // * 减少时间奖励,补偿分数 // */ // public static int RewardScoreMax = 5; // // /** // * 任务系数 // */ // public static int TaskFactor = 10; // // /** // * 重排时尝试次数,默认5次 // */ // public static int RefreshTryCount = 5; // // /** // * 星星的比例 // */ // public static float StarRatio = 0.4f; // } // // Path: LinkupCore/src/com/znv/linkup/core/card/path/LinkInfo.java // public class LinkInfo { // private List<Piece> linkPieces = new ArrayList<Piece>(); // // public LinkInfo(Piece p1, Piece p2) { // linkPieces.add(p1); // linkPieces.add(p2); // } // // public LinkInfo(Piece p1, Piece p2, Piece p3) { // this(p1, p2); // linkPieces.add(p3); // } // // public LinkInfo(Piece p1, Piece p2, Piece p3, Piece p4) { // this(p1, p2, p3); // linkPieces.add(p4); // } // // public List<Piece> getLinkPieces() { // return linkPieces; // } // }
import com.znv.linkup.core.GameSettings; import com.znv.linkup.core.card.path.LinkInfo;
package com.znv.linkup.core.status; /** * 游戏得分处理 * * @author yzb * */ class GameScore { public GameScore() { this(null); } public GameScore(IGameStatus listener) { gameScore = 0; this.listener = listener; if (listener != null) { listener.onScoreChanged(gameScore); } } public void addScore(int score) { this.gameScore += score; if (listener != null) { listener.onScoreChanged(gameScore); } } /** * 根据链路获取奖励分数 * * @param linkInfo * 连接路径信息 * @return 转弯奖励的分数 */
// Path: LinkupCore/src/com/znv/linkup/core/GameSettings.java // public class GameSettings { // // /** // * 地板卡片值 // */ // public static byte GroundCardValue = 0; // // /** // * 游戏卡片值,用于地图模版 // */ // public static byte GameCardValue = 1; // // /** // * 障碍卡片值 // */ // public static byte ObstacleCardValue = -1; // // /** // * 空卡片值 // */ // public static byte EmptyCardValue = -2; // // /** // * 消除卡片获得的积分,消除一对卡片得10分 // */ // public static int CardScore = 5; // // /** // * 连击延时时间,2000ms // */ // public static int ComboDelay = 2000; // // /** // * 连击间隔,3连击,6连击,9连击。。。 // */ // public static int ComboMod = 3; // // /** // * 连击分数,3连击则3*10=30 // */ // public static int ComboScore = 10; // // /** // * 剩余时间奖励分数,剩余10s,则奖励40分 // */ // public static int TimeScore = 4; // // /** // * 路径转弯奖励分数,直线不奖励,一个弯奖励5分,2个弯奖励10分 // */ // public static int CornerScore = 5; // // /** // * 消除一对卡片奖励的时间,0s // */ // public static int RewardTime = 0; // // /** // * 减少时间奖励,补偿分数 // */ // public static int RewardScoreMax = 5; // // /** // * 任务系数 // */ // public static int TaskFactor = 10; // // /** // * 重排时尝试次数,默认5次 // */ // public static int RefreshTryCount = 5; // // /** // * 星星的比例 // */ // public static float StarRatio = 0.4f; // } // // Path: LinkupCore/src/com/znv/linkup/core/card/path/LinkInfo.java // public class LinkInfo { // private List<Piece> linkPieces = new ArrayList<Piece>(); // // public LinkInfo(Piece p1, Piece p2) { // linkPieces.add(p1); // linkPieces.add(p2); // } // // public LinkInfo(Piece p1, Piece p2, Piece p3) { // this(p1, p2); // linkPieces.add(p3); // } // // public LinkInfo(Piece p1, Piece p2, Piece p3, Piece p4) { // this(p1, p2, p3); // linkPieces.add(p4); // } // // public List<Piece> getLinkPieces() { // return linkPieces; // } // } // Path: LinkupCore/src/com/znv/linkup/core/status/GameScore.java import com.znv.linkup.core.GameSettings; import com.znv.linkup.core.card.path.LinkInfo; package com.znv.linkup.core.status; /** * 游戏得分处理 * * @author yzb * */ class GameScore { public GameScore() { this(null); } public GameScore(IGameStatus listener) { gameScore = 0; this.listener = listener; if (listener != null) { listener.onScoreChanged(gameScore); } } public void addScore(int score) { this.gameScore += score; if (listener != null) { listener.onScoreChanged(gameScore); } } /** * 根据链路获取奖励分数 * * @param linkInfo * 连接路径信息 * @return 转弯奖励的分数 */
public int getCornerScore(LinkInfo linkInfo) {
csuyzb/AndroidLinkup
LinkupCore/src/com/znv/linkup/core/status/GameScore.java
// Path: LinkupCore/src/com/znv/linkup/core/GameSettings.java // public class GameSettings { // // /** // * 地板卡片值 // */ // public static byte GroundCardValue = 0; // // /** // * 游戏卡片值,用于地图模版 // */ // public static byte GameCardValue = 1; // // /** // * 障碍卡片值 // */ // public static byte ObstacleCardValue = -1; // // /** // * 空卡片值 // */ // public static byte EmptyCardValue = -2; // // /** // * 消除卡片获得的积分,消除一对卡片得10分 // */ // public static int CardScore = 5; // // /** // * 连击延时时间,2000ms // */ // public static int ComboDelay = 2000; // // /** // * 连击间隔,3连击,6连击,9连击。。。 // */ // public static int ComboMod = 3; // // /** // * 连击分数,3连击则3*10=30 // */ // public static int ComboScore = 10; // // /** // * 剩余时间奖励分数,剩余10s,则奖励40分 // */ // public static int TimeScore = 4; // // /** // * 路径转弯奖励分数,直线不奖励,一个弯奖励5分,2个弯奖励10分 // */ // public static int CornerScore = 5; // // /** // * 消除一对卡片奖励的时间,0s // */ // public static int RewardTime = 0; // // /** // * 减少时间奖励,补偿分数 // */ // public static int RewardScoreMax = 5; // // /** // * 任务系数 // */ // public static int TaskFactor = 10; // // /** // * 重排时尝试次数,默认5次 // */ // public static int RefreshTryCount = 5; // // /** // * 星星的比例 // */ // public static float StarRatio = 0.4f; // } // // Path: LinkupCore/src/com/znv/linkup/core/card/path/LinkInfo.java // public class LinkInfo { // private List<Piece> linkPieces = new ArrayList<Piece>(); // // public LinkInfo(Piece p1, Piece p2) { // linkPieces.add(p1); // linkPieces.add(p2); // } // // public LinkInfo(Piece p1, Piece p2, Piece p3) { // this(p1, p2); // linkPieces.add(p3); // } // // public LinkInfo(Piece p1, Piece p2, Piece p3, Piece p4) { // this(p1, p2, p3); // linkPieces.add(p4); // } // // public List<Piece> getLinkPieces() { // return linkPieces; // } // }
import com.znv.linkup.core.GameSettings; import com.znv.linkup.core.card.path.LinkInfo;
package com.znv.linkup.core.status; /** * 游戏得分处理 * * @author yzb * */ class GameScore { public GameScore() { this(null); } public GameScore(IGameStatus listener) { gameScore = 0; this.listener = listener; if (listener != null) { listener.onScoreChanged(gameScore); } } public void addScore(int score) { this.gameScore += score; if (listener != null) { listener.onScoreChanged(gameScore); } } /** * 根据链路获取奖励分数 * * @param linkInfo * 连接路径信息 * @return 转弯奖励的分数 */ public int getCornerScore(LinkInfo linkInfo) {
// Path: LinkupCore/src/com/znv/linkup/core/GameSettings.java // public class GameSettings { // // /** // * 地板卡片值 // */ // public static byte GroundCardValue = 0; // // /** // * 游戏卡片值,用于地图模版 // */ // public static byte GameCardValue = 1; // // /** // * 障碍卡片值 // */ // public static byte ObstacleCardValue = -1; // // /** // * 空卡片值 // */ // public static byte EmptyCardValue = -2; // // /** // * 消除卡片获得的积分,消除一对卡片得10分 // */ // public static int CardScore = 5; // // /** // * 连击延时时间,2000ms // */ // public static int ComboDelay = 2000; // // /** // * 连击间隔,3连击,6连击,9连击。。。 // */ // public static int ComboMod = 3; // // /** // * 连击分数,3连击则3*10=30 // */ // public static int ComboScore = 10; // // /** // * 剩余时间奖励分数,剩余10s,则奖励40分 // */ // public static int TimeScore = 4; // // /** // * 路径转弯奖励分数,直线不奖励,一个弯奖励5分,2个弯奖励10分 // */ // public static int CornerScore = 5; // // /** // * 消除一对卡片奖励的时间,0s // */ // public static int RewardTime = 0; // // /** // * 减少时间奖励,补偿分数 // */ // public static int RewardScoreMax = 5; // // /** // * 任务系数 // */ // public static int TaskFactor = 10; // // /** // * 重排时尝试次数,默认5次 // */ // public static int RefreshTryCount = 5; // // /** // * 星星的比例 // */ // public static float StarRatio = 0.4f; // } // // Path: LinkupCore/src/com/znv/linkup/core/card/path/LinkInfo.java // public class LinkInfo { // private List<Piece> linkPieces = new ArrayList<Piece>(); // // public LinkInfo(Piece p1, Piece p2) { // linkPieces.add(p1); // linkPieces.add(p2); // } // // public LinkInfo(Piece p1, Piece p2, Piece p3) { // this(p1, p2); // linkPieces.add(p3); // } // // public LinkInfo(Piece p1, Piece p2, Piece p3, Piece p4) { // this(p1, p2, p3); // linkPieces.add(p4); // } // // public List<Piece> getLinkPieces() { // return linkPieces; // } // } // Path: LinkupCore/src/com/znv/linkup/core/status/GameScore.java import com.znv.linkup.core.GameSettings; import com.znv.linkup.core.card.path.LinkInfo; package com.znv.linkup.core.status; /** * 游戏得分处理 * * @author yzb * */ class GameScore { public GameScore() { this(null); } public GameScore(IGameStatus listener) { gameScore = 0; this.listener = listener; if (listener != null) { listener.onScoreChanged(gameScore); } } public void addScore(int score) { this.gameScore += score; if (listener != null) { listener.onScoreChanged(gameScore); } } /** * 根据链路获取奖励分数 * * @param linkInfo * 连接路径信息 * @return 转弯奖励的分数 */ public int getCornerScore(LinkInfo linkInfo) {
return (linkInfo.getLinkPieces().size() - 2) * GameSettings.CornerScore;
csuyzb/AndroidLinkup
Linkup/src/com/znv/linkup/rest/UserInfo.java
// Path: Linkup/src/com/znv/linkup/util/CacheUtil.java // public class CacheUtil { // // /** // * 用share preference来实现是否绑定的开关 // * // * @param context // * @return // */ // public static boolean hasBind(Context context) { // return hasBind(context, "push_flag"); // } // // /** // * 设置是否绑定 // * // * @param context // * @param flag // * 是否绑定 // */ // public static void setBind(Context context, boolean flag) { // setBind(context, "push_flag", flag); // } // // /** // * 获取是否绑定特定字符串 // * // * @param context // * @param bindStr // * 绑定的字符串key // * @return 是否绑定 // */ // public static boolean hasBind(Context context, String bindStr) { // String strValue = getBindStr(context, bindStr); // if ("ok".equalsIgnoreCase(strValue)) { // return true; // } // return false; // } // // /** // * 设置字符串是否绑定 // * // * @param context // * @param bindStr // * 绑定字符串key // * @param flag // * 是否绑定 // */ // public static void setBind(Context context, String bindStr, boolean flag) { // String flagStr = "not"; // if (flag) { // flagStr = "ok"; // } // setBindStr(context, bindStr, flagStr); // } // // /** // * 获取绑定字符串的值 // * // * @param context // * @param bindStr // * 绑定字符串 // * @return 绑定的字符串值 // */ // public static String getBindStr(Context context, String bindStr) { // SharedPreferences sp = PreferenceManager.getDefaultSharedPreferences(context); // return sp.getString(bindStr, ""); // } // // /** // * 设置绑定的字符串键值对 // * // * @param context // * @param bindStr // * 绑定的字符串key // * @param strValue // * 绑定的字符串value // */ // public static void setBindStr(Context context, String bindStr, String strValue) { // SharedPreferences sp = PreferenceManager.getDefaultSharedPreferences(context); // Editor editor = sp.edit(); // editor.putString(bindStr, strValue); // editor.commit(); // } // }
import android.content.Context; import android.graphics.Bitmap; import com.znv.linkup.util.CacheUtil;
package com.znv.linkup.rest; /** * 第三方登录用户信息 * * @author yzb * */ public class UserInfo { public String getUserId() { return userId; } public void setUserId(String userId) { this.userId = userId; } public String getUserName() { return userName; } public void setUserName(String userName) { this.userName = userName; } public String getUserGender() { return userGender; } public void setUserGender(String userGender) { this.userGender = userGender; } public String getUserIcon() { return userIcon; } public void setUserIcon(String userIcon) { this.userIcon = userIcon; } public int getDiamond(Context context) {
// Path: Linkup/src/com/znv/linkup/util/CacheUtil.java // public class CacheUtil { // // /** // * 用share preference来实现是否绑定的开关 // * // * @param context // * @return // */ // public static boolean hasBind(Context context) { // return hasBind(context, "push_flag"); // } // // /** // * 设置是否绑定 // * // * @param context // * @param flag // * 是否绑定 // */ // public static void setBind(Context context, boolean flag) { // setBind(context, "push_flag", flag); // } // // /** // * 获取是否绑定特定字符串 // * // * @param context // * @param bindStr // * 绑定的字符串key // * @return 是否绑定 // */ // public static boolean hasBind(Context context, String bindStr) { // String strValue = getBindStr(context, bindStr); // if ("ok".equalsIgnoreCase(strValue)) { // return true; // } // return false; // } // // /** // * 设置字符串是否绑定 // * // * @param context // * @param bindStr // * 绑定字符串key // * @param flag // * 是否绑定 // */ // public static void setBind(Context context, String bindStr, boolean flag) { // String flagStr = "not"; // if (flag) { // flagStr = "ok"; // } // setBindStr(context, bindStr, flagStr); // } // // /** // * 获取绑定字符串的值 // * // * @param context // * @param bindStr // * 绑定字符串 // * @return 绑定的字符串值 // */ // public static String getBindStr(Context context, String bindStr) { // SharedPreferences sp = PreferenceManager.getDefaultSharedPreferences(context); // return sp.getString(bindStr, ""); // } // // /** // * 设置绑定的字符串键值对 // * // * @param context // * @param bindStr // * 绑定的字符串key // * @param strValue // * 绑定的字符串value // */ // public static void setBindStr(Context context, String bindStr, String strValue) { // SharedPreferences sp = PreferenceManager.getDefaultSharedPreferences(context); // Editor editor = sp.edit(); // editor.putString(bindStr, strValue); // editor.commit(); // } // } // Path: Linkup/src/com/znv/linkup/rest/UserInfo.java import android.content.Context; import android.graphics.Bitmap; import com.znv.linkup.util.CacheUtil; package com.znv.linkup.rest; /** * 第三方登录用户信息 * * @author yzb * */ public class UserInfo { public String getUserId() { return userId; } public void setUserId(String userId) { this.userId = userId; } public String getUserName() { return userName; } public void setUserName(String userName) { this.userName = userName; } public String getUserGender() { return userGender; } public void setUserGender(String userGender) { this.userGender = userGender; } public String getUserIcon() { return userIcon; } public void setUserIcon(String userIcon) { this.userIcon = userIcon; } public int getDiamond(Context context) {
String d = CacheUtil.getBindStr(context, userId + "_diamond");
csuyzb/AndroidLinkup
LinkupCore/src/com/znv/linkup/core/map/RandomMap.java
// Path: LinkupCore/src/com/znv/linkup/core/map/template/MapTemplate.java // public class MapTemplate extends BaseMap { // private static final long serialVersionUID = -8030816635103999967L; // // protected MapTemplate() { // } // // public MapTemplate(int ySize, int xSize) { // this(ySize, xSize, 0, 0); // } // // public MapTemplate(int ySize, int xSize, int empty, int obstacle) { // super(ySize, xSize); // this.EmptyCount = empty; // this.ObstacleCount = obstacle; // this.Data = new Byte[ySize][xSize]; // // initTemplate(); // } // // protected void initTemplate() { // for (int i = 0; i < YSize; i++) { // for (int j = 0; j < XSize; j++) { // if (i == 0 || i == YSize - 1 || j == 0 || j == XSize - 1) { // Data[i][j] = GameSettings.GroundCardValue; // } else { // Data[i][j] = GameSettings.GameCardValue; // } // } // } // } // // @Override // protected boolean isRefresh(int i, int j) { // return Data[i][j] != GameSettings.GroundCardValue; // } // // /** // * 根据地图模版配置字符串解析出地图模版 // * // * @param strMapTemp // * 地图模版配置字符串 // * @return 地图模版 // */ // public static MapTemplate parse(String strMapTemp) { // try { // MapTemplate tpl = new MapTemplate(); // String map = strMapTemp; // String[] data = map.split("\\$"); // String[] strnm = data[0].split("\\*"); // tpl.YSize = Integer.parseInt(strnm[0]); // tpl.XSize = Integer.parseInt(strnm[1]); // tpl.Data = new Byte[tpl.YSize][tpl.XSize]; // String[] rowData = data[1].split(";"); // String[] cellData = null; // for (int i = 0; i < rowData.length; i++) { // cellData = rowData[i].split(","); // for (int j = 0; j < cellData.length; j++) { // tpl.Data[i][j] = convertValue(Byte.parseByte(cellData[j])); // } // } // return tpl; // } catch (Exception ex) { // ex.printStackTrace(); // } // return null; // } // // public static Byte convertValue(Byte bValue) { // return (byte) (bValue > 0 ? 1 : (bValue < 0 ? bValue : 0)); // } // // protected int EmptyCount; // protected int ObstacleCount; // } // // Path: LinkupCore/src/com/znv/linkup/core/map/template/RandomTemplate.java // public class RandomTemplate extends MapTemplate { // private static final long serialVersionUID = -4260503758055093714L; // // public RandomTemplate(int ySize, int xSize) { // super(ySize, xSize); // } // // public RandomTemplate(int ySize, int xSize, int emptyCount, int obstacleCount) { // super(ySize, xSize, emptyCount, obstacleCount); // } // // @Override // /** // * 随机产生可以成功配对消除完成的地图模版 // */ // protected void initTemplate() { // int empty = EmptyCount; // int obstacle = ObstacleCount; // // 必须保证 Rows * Colomns - EmptyCount - ObstacleCount 为偶数 // if (empty + obstacle < YSize * XSize) { // for (int i = 0; i < YSize; i++) { // for (int j = 0; j < XSize; j++) { // if (i == 0 || i == YSize - 1 || j == 0 || j == XSize - 1) { // Data[i][j] = GameSettings.GroundCardValue; // } else { // if (empty > 0) { // Data[i][j] = GameSettings.EmptyCardValue; // empty--; // } else if (obstacle > 0) { // Data[i][j] = GameSettings.ObstacleCardValue; // obstacle--; // } else { // Data[i][j] = GameSettings.GameCardValue; // } // } // } // } // } // // // 随机排列 // randomRefresh(); // } // }
import com.znv.linkup.core.map.template.MapTemplate; import com.znv.linkup.core.map.template.RandomTemplate;
package com.znv.linkup.core.map; /** * 随机地图类 * * @author yzb * */ public class RandomMap extends GameMap { private static final long serialVersionUID = -3788653825318577597L; public RandomMap(int rows, int cols) {
// Path: LinkupCore/src/com/znv/linkup/core/map/template/MapTemplate.java // public class MapTemplate extends BaseMap { // private static final long serialVersionUID = -8030816635103999967L; // // protected MapTemplate() { // } // // public MapTemplate(int ySize, int xSize) { // this(ySize, xSize, 0, 0); // } // // public MapTemplate(int ySize, int xSize, int empty, int obstacle) { // super(ySize, xSize); // this.EmptyCount = empty; // this.ObstacleCount = obstacle; // this.Data = new Byte[ySize][xSize]; // // initTemplate(); // } // // protected void initTemplate() { // for (int i = 0; i < YSize; i++) { // for (int j = 0; j < XSize; j++) { // if (i == 0 || i == YSize - 1 || j == 0 || j == XSize - 1) { // Data[i][j] = GameSettings.GroundCardValue; // } else { // Data[i][j] = GameSettings.GameCardValue; // } // } // } // } // // @Override // protected boolean isRefresh(int i, int j) { // return Data[i][j] != GameSettings.GroundCardValue; // } // // /** // * 根据地图模版配置字符串解析出地图模版 // * // * @param strMapTemp // * 地图模版配置字符串 // * @return 地图模版 // */ // public static MapTemplate parse(String strMapTemp) { // try { // MapTemplate tpl = new MapTemplate(); // String map = strMapTemp; // String[] data = map.split("\\$"); // String[] strnm = data[0].split("\\*"); // tpl.YSize = Integer.parseInt(strnm[0]); // tpl.XSize = Integer.parseInt(strnm[1]); // tpl.Data = new Byte[tpl.YSize][tpl.XSize]; // String[] rowData = data[1].split(";"); // String[] cellData = null; // for (int i = 0; i < rowData.length; i++) { // cellData = rowData[i].split(","); // for (int j = 0; j < cellData.length; j++) { // tpl.Data[i][j] = convertValue(Byte.parseByte(cellData[j])); // } // } // return tpl; // } catch (Exception ex) { // ex.printStackTrace(); // } // return null; // } // // public static Byte convertValue(Byte bValue) { // return (byte) (bValue > 0 ? 1 : (bValue < 0 ? bValue : 0)); // } // // protected int EmptyCount; // protected int ObstacleCount; // } // // Path: LinkupCore/src/com/znv/linkup/core/map/template/RandomTemplate.java // public class RandomTemplate extends MapTemplate { // private static final long serialVersionUID = -4260503758055093714L; // // public RandomTemplate(int ySize, int xSize) { // super(ySize, xSize); // } // // public RandomTemplate(int ySize, int xSize, int emptyCount, int obstacleCount) { // super(ySize, xSize, emptyCount, obstacleCount); // } // // @Override // /** // * 随机产生可以成功配对消除完成的地图模版 // */ // protected void initTemplate() { // int empty = EmptyCount; // int obstacle = ObstacleCount; // // 必须保证 Rows * Colomns - EmptyCount - ObstacleCount 为偶数 // if (empty + obstacle < YSize * XSize) { // for (int i = 0; i < YSize; i++) { // for (int j = 0; j < XSize; j++) { // if (i == 0 || i == YSize - 1 || j == 0 || j == XSize - 1) { // Data[i][j] = GameSettings.GroundCardValue; // } else { // if (empty > 0) { // Data[i][j] = GameSettings.EmptyCardValue; // empty--; // } else if (obstacle > 0) { // Data[i][j] = GameSettings.ObstacleCardValue; // obstacle--; // } else { // Data[i][j] = GameSettings.GameCardValue; // } // } // } // } // } // // // 随机排列 // randomRefresh(); // } // } // Path: LinkupCore/src/com/znv/linkup/core/map/RandomMap.java import com.znv.linkup.core.map.template.MapTemplate; import com.znv.linkup.core.map.template.RandomTemplate; package com.znv.linkup.core.map; /** * 随机地图类 * * @author yzb * */ public class RandomMap extends GameMap { private static final long serialVersionUID = -3788653825318577597L; public RandomMap(int rows, int cols) {
this(new RandomTemplate(rows, cols));
csuyzb/AndroidLinkup
LinkupCore/src/com/znv/linkup/core/map/RandomMap.java
// Path: LinkupCore/src/com/znv/linkup/core/map/template/MapTemplate.java // public class MapTemplate extends BaseMap { // private static final long serialVersionUID = -8030816635103999967L; // // protected MapTemplate() { // } // // public MapTemplate(int ySize, int xSize) { // this(ySize, xSize, 0, 0); // } // // public MapTemplate(int ySize, int xSize, int empty, int obstacle) { // super(ySize, xSize); // this.EmptyCount = empty; // this.ObstacleCount = obstacle; // this.Data = new Byte[ySize][xSize]; // // initTemplate(); // } // // protected void initTemplate() { // for (int i = 0; i < YSize; i++) { // for (int j = 0; j < XSize; j++) { // if (i == 0 || i == YSize - 1 || j == 0 || j == XSize - 1) { // Data[i][j] = GameSettings.GroundCardValue; // } else { // Data[i][j] = GameSettings.GameCardValue; // } // } // } // } // // @Override // protected boolean isRefresh(int i, int j) { // return Data[i][j] != GameSettings.GroundCardValue; // } // // /** // * 根据地图模版配置字符串解析出地图模版 // * // * @param strMapTemp // * 地图模版配置字符串 // * @return 地图模版 // */ // public static MapTemplate parse(String strMapTemp) { // try { // MapTemplate tpl = new MapTemplate(); // String map = strMapTemp; // String[] data = map.split("\\$"); // String[] strnm = data[0].split("\\*"); // tpl.YSize = Integer.parseInt(strnm[0]); // tpl.XSize = Integer.parseInt(strnm[1]); // tpl.Data = new Byte[tpl.YSize][tpl.XSize]; // String[] rowData = data[1].split(";"); // String[] cellData = null; // for (int i = 0; i < rowData.length; i++) { // cellData = rowData[i].split(","); // for (int j = 0; j < cellData.length; j++) { // tpl.Data[i][j] = convertValue(Byte.parseByte(cellData[j])); // } // } // return tpl; // } catch (Exception ex) { // ex.printStackTrace(); // } // return null; // } // // public static Byte convertValue(Byte bValue) { // return (byte) (bValue > 0 ? 1 : (bValue < 0 ? bValue : 0)); // } // // protected int EmptyCount; // protected int ObstacleCount; // } // // Path: LinkupCore/src/com/znv/linkup/core/map/template/RandomTemplate.java // public class RandomTemplate extends MapTemplate { // private static final long serialVersionUID = -4260503758055093714L; // // public RandomTemplate(int ySize, int xSize) { // super(ySize, xSize); // } // // public RandomTemplate(int ySize, int xSize, int emptyCount, int obstacleCount) { // super(ySize, xSize, emptyCount, obstacleCount); // } // // @Override // /** // * 随机产生可以成功配对消除完成的地图模版 // */ // protected void initTemplate() { // int empty = EmptyCount; // int obstacle = ObstacleCount; // // 必须保证 Rows * Colomns - EmptyCount - ObstacleCount 为偶数 // if (empty + obstacle < YSize * XSize) { // for (int i = 0; i < YSize; i++) { // for (int j = 0; j < XSize; j++) { // if (i == 0 || i == YSize - 1 || j == 0 || j == XSize - 1) { // Data[i][j] = GameSettings.GroundCardValue; // } else { // if (empty > 0) { // Data[i][j] = GameSettings.EmptyCardValue; // empty--; // } else if (obstacle > 0) { // Data[i][j] = GameSettings.ObstacleCardValue; // obstacle--; // } else { // Data[i][j] = GameSettings.GameCardValue; // } // } // } // } // } // // // 随机排列 // randomRefresh(); // } // }
import com.znv.linkup.core.map.template.MapTemplate; import com.znv.linkup.core.map.template.RandomTemplate;
package com.znv.linkup.core.map; /** * 随机地图类 * * @author yzb * */ public class RandomMap extends GameMap { private static final long serialVersionUID = -3788653825318577597L; public RandomMap(int rows, int cols) { this(new RandomTemplate(rows, cols)); }
// Path: LinkupCore/src/com/znv/linkup/core/map/template/MapTemplate.java // public class MapTemplate extends BaseMap { // private static final long serialVersionUID = -8030816635103999967L; // // protected MapTemplate() { // } // // public MapTemplate(int ySize, int xSize) { // this(ySize, xSize, 0, 0); // } // // public MapTemplate(int ySize, int xSize, int empty, int obstacle) { // super(ySize, xSize); // this.EmptyCount = empty; // this.ObstacleCount = obstacle; // this.Data = new Byte[ySize][xSize]; // // initTemplate(); // } // // protected void initTemplate() { // for (int i = 0; i < YSize; i++) { // for (int j = 0; j < XSize; j++) { // if (i == 0 || i == YSize - 1 || j == 0 || j == XSize - 1) { // Data[i][j] = GameSettings.GroundCardValue; // } else { // Data[i][j] = GameSettings.GameCardValue; // } // } // } // } // // @Override // protected boolean isRefresh(int i, int j) { // return Data[i][j] != GameSettings.GroundCardValue; // } // // /** // * 根据地图模版配置字符串解析出地图模版 // * // * @param strMapTemp // * 地图模版配置字符串 // * @return 地图模版 // */ // public static MapTemplate parse(String strMapTemp) { // try { // MapTemplate tpl = new MapTemplate(); // String map = strMapTemp; // String[] data = map.split("\\$"); // String[] strnm = data[0].split("\\*"); // tpl.YSize = Integer.parseInt(strnm[0]); // tpl.XSize = Integer.parseInt(strnm[1]); // tpl.Data = new Byte[tpl.YSize][tpl.XSize]; // String[] rowData = data[1].split(";"); // String[] cellData = null; // for (int i = 0; i < rowData.length; i++) { // cellData = rowData[i].split(","); // for (int j = 0; j < cellData.length; j++) { // tpl.Data[i][j] = convertValue(Byte.parseByte(cellData[j])); // } // } // return tpl; // } catch (Exception ex) { // ex.printStackTrace(); // } // return null; // } // // public static Byte convertValue(Byte bValue) { // return (byte) (bValue > 0 ? 1 : (bValue < 0 ? bValue : 0)); // } // // protected int EmptyCount; // protected int ObstacleCount; // } // // Path: LinkupCore/src/com/znv/linkup/core/map/template/RandomTemplate.java // public class RandomTemplate extends MapTemplate { // private static final long serialVersionUID = -4260503758055093714L; // // public RandomTemplate(int ySize, int xSize) { // super(ySize, xSize); // } // // public RandomTemplate(int ySize, int xSize, int emptyCount, int obstacleCount) { // super(ySize, xSize, emptyCount, obstacleCount); // } // // @Override // /** // * 随机产生可以成功配对消除完成的地图模版 // */ // protected void initTemplate() { // int empty = EmptyCount; // int obstacle = ObstacleCount; // // 必须保证 Rows * Colomns - EmptyCount - ObstacleCount 为偶数 // if (empty + obstacle < YSize * XSize) { // for (int i = 0; i < YSize; i++) { // for (int j = 0; j < XSize; j++) { // if (i == 0 || i == YSize - 1 || j == 0 || j == XSize - 1) { // Data[i][j] = GameSettings.GroundCardValue; // } else { // if (empty > 0) { // Data[i][j] = GameSettings.EmptyCardValue; // empty--; // } else if (obstacle > 0) { // Data[i][j] = GameSettings.ObstacleCardValue; // obstacle--; // } else { // Data[i][j] = GameSettings.GameCardValue; // } // } // } // } // } // // // 随机排列 // randomRefresh(); // } // } // Path: LinkupCore/src/com/znv/linkup/core/map/RandomMap.java import com.znv.linkup.core.map.template.MapTemplate; import com.znv.linkup.core.map.template.RandomTemplate; package com.znv.linkup.core.map; /** * 随机地图类 * * @author yzb * */ public class RandomMap extends GameMap { private static final long serialVersionUID = -3788653825318577597L; public RandomMap(int rows, int cols) { this(new RandomTemplate(rows, cols)); }
public RandomMap(MapTemplate template) {
csuyzb/AndroidLinkup
Linkup/src/com/znv/linkup/db/DbScore.java
// Path: LinkupCore/src/com/znv/linkup/core/config/ModeCfg.java // public class ModeCfg { // // public ModeCfg(String modeName) { // this.modeName = modeName; // } // // public String getModeId() { // return modeId; // } // // public void setModeId(String modeId) { // this.modeId = modeId; // } // // public String getModeName() { // return modeName; // } // // public void setModeName(String modeName) { // this.modeName = modeName; // } // // public List<RankCfg> getRankInfos() { // return rankInfos; // } // // private String modeId; // private String modeName; // private List<RankCfg> rankInfos = new ArrayList<RankCfg>(); // }
import java.util.ArrayList; import java.util.List; import android.content.Context; import android.database.Cursor; import android.database.sqlite.SQLiteDatabase; import com.znv.linkup.core.config.ModeCfg;
package com.znv.linkup.db; /** * 关卡积分数据操作类 * * @author yzb * */ public class DbScore { private static DbHelper database = null;
// Path: LinkupCore/src/com/znv/linkup/core/config/ModeCfg.java // public class ModeCfg { // // public ModeCfg(String modeName) { // this.modeName = modeName; // } // // public String getModeId() { // return modeId; // } // // public void setModeId(String modeId) { // this.modeId = modeId; // } // // public String getModeName() { // return modeName; // } // // public void setModeName(String modeName) { // this.modeName = modeName; // } // // public List<RankCfg> getRankInfos() { // return rankInfos; // } // // private String modeId; // private String modeName; // private List<RankCfg> rankInfos = new ArrayList<RankCfg>(); // } // Path: Linkup/src/com/znv/linkup/db/DbScore.java import java.util.ArrayList; import java.util.List; import android.content.Context; import android.database.Cursor; import android.database.sqlite.SQLiteDatabase; import com.znv.linkup.core.config.ModeCfg; package com.znv.linkup.db; /** * 关卡积分数据操作类 * * @author yzb * */ public class DbScore { private static DbHelper database = null;
public static void init(Context context, List<ModeCfg> modeCfgs) {
csuyzb/AndroidLinkup
Linkup/src/com/znv/linkup/view/dialog/InfoDialog.java
// Path: Linkup/src/com/znv/linkup/util/CacheUtil.java // public class CacheUtil { // // /** // * 用share preference来实现是否绑定的开关 // * // * @param context // * @return // */ // public static boolean hasBind(Context context) { // return hasBind(context, "push_flag"); // } // // /** // * 设置是否绑定 // * // * @param context // * @param flag // * 是否绑定 // */ // public static void setBind(Context context, boolean flag) { // setBind(context, "push_flag", flag); // } // // /** // * 获取是否绑定特定字符串 // * // * @param context // * @param bindStr // * 绑定的字符串key // * @return 是否绑定 // */ // public static boolean hasBind(Context context, String bindStr) { // String strValue = getBindStr(context, bindStr); // if ("ok".equalsIgnoreCase(strValue)) { // return true; // } // return false; // } // // /** // * 设置字符串是否绑定 // * // * @param context // * @param bindStr // * 绑定字符串key // * @param flag // * 是否绑定 // */ // public static void setBind(Context context, String bindStr, boolean flag) { // String flagStr = "not"; // if (flag) { // flagStr = "ok"; // } // setBindStr(context, bindStr, flagStr); // } // // /** // * 获取绑定字符串的值 // * // * @param context // * @param bindStr // * 绑定字符串 // * @return 绑定的字符串值 // */ // public static String getBindStr(Context context, String bindStr) { // SharedPreferences sp = PreferenceManager.getDefaultSharedPreferences(context); // return sp.getString(bindStr, ""); // } // // /** // * 设置绑定的字符串键值对 // * // * @param context // * @param bindStr // * 绑定的字符串key // * @param strValue // * 绑定的字符串value // */ // public static void setBindStr(Context context, String bindStr, String strValue) { // SharedPreferences sp = PreferenceManager.getDefaultSharedPreferences(context); // Editor editor = sp.edit(); // editor.putString(bindStr, strValue); // editor.commit(); // } // }
import android.app.Dialog; import android.content.Context; import android.view.View; import android.widget.CheckBox; import android.widget.CompoundButton; import android.widget.TextView; import com.znv.linkup.R; import com.znv.linkup.util.CacheUtil;
package com.znv.linkup.view.dialog; /** * 自定义的警告框 * * @author yzb * */ public class InfoDialog extends Dialog { public InfoDialog(Context context) { super(context, R.style.CustomDialogStyle); setContentView(R.layout.info_dialog); setCancelable(true); setCanceledOnTouchOutside(true); } /** * 是否需要登录按钮 * * @param isLogin */ public void hasLogin(boolean isLogin) { int visible = isLogin ? View.VISIBLE : View.GONE; findViewById(R.id.tvWeibo).setVisibility(visible); findViewById(R.id.tvQQ).setVisibility(visible); } /** * 设置标题 * * @param title * 标题 * @return 警告框实例 */ public InfoDialog setTitle(String title) { TextView tvTitle = (TextView) findViewById(R.id.tvTitle); tvTitle.setText(title); return this; } /** * 设置信息 * * @param msg * 信息 * @return 警告框示例 */ public InfoDialog setMessage(String msg) { TextView tvMessage = (TextView) findViewById(R.id.tvInfo); tvMessage.setText(msg); return this; } /** * 设置确认按钮 * * @param text * 确认按钮文字 * @param listener * 确认操作 * @return 警告框实例 */ public InfoDialog setPositiveButton(final String cacheKey) { CheckBox btn = (CheckBox) findViewById(R.id.cbxKnown); btn.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { @Override public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { if (isChecked) {
// Path: Linkup/src/com/znv/linkup/util/CacheUtil.java // public class CacheUtil { // // /** // * 用share preference来实现是否绑定的开关 // * // * @param context // * @return // */ // public static boolean hasBind(Context context) { // return hasBind(context, "push_flag"); // } // // /** // * 设置是否绑定 // * // * @param context // * @param flag // * 是否绑定 // */ // public static void setBind(Context context, boolean flag) { // setBind(context, "push_flag", flag); // } // // /** // * 获取是否绑定特定字符串 // * // * @param context // * @param bindStr // * 绑定的字符串key // * @return 是否绑定 // */ // public static boolean hasBind(Context context, String bindStr) { // String strValue = getBindStr(context, bindStr); // if ("ok".equalsIgnoreCase(strValue)) { // return true; // } // return false; // } // // /** // * 设置字符串是否绑定 // * // * @param context // * @param bindStr // * 绑定字符串key // * @param flag // * 是否绑定 // */ // public static void setBind(Context context, String bindStr, boolean flag) { // String flagStr = "not"; // if (flag) { // flagStr = "ok"; // } // setBindStr(context, bindStr, flagStr); // } // // /** // * 获取绑定字符串的值 // * // * @param context // * @param bindStr // * 绑定字符串 // * @return 绑定的字符串值 // */ // public static String getBindStr(Context context, String bindStr) { // SharedPreferences sp = PreferenceManager.getDefaultSharedPreferences(context); // return sp.getString(bindStr, ""); // } // // /** // * 设置绑定的字符串键值对 // * // * @param context // * @param bindStr // * 绑定的字符串key // * @param strValue // * 绑定的字符串value // */ // public static void setBindStr(Context context, String bindStr, String strValue) { // SharedPreferences sp = PreferenceManager.getDefaultSharedPreferences(context); // Editor editor = sp.edit(); // editor.putString(bindStr, strValue); // editor.commit(); // } // } // Path: Linkup/src/com/znv/linkup/view/dialog/InfoDialog.java import android.app.Dialog; import android.content.Context; import android.view.View; import android.widget.CheckBox; import android.widget.CompoundButton; import android.widget.TextView; import com.znv.linkup.R; import com.znv.linkup.util.CacheUtil; package com.znv.linkup.view.dialog; /** * 自定义的警告框 * * @author yzb * */ public class InfoDialog extends Dialog { public InfoDialog(Context context) { super(context, R.style.CustomDialogStyle); setContentView(R.layout.info_dialog); setCancelable(true); setCanceledOnTouchOutside(true); } /** * 是否需要登录按钮 * * @param isLogin */ public void hasLogin(boolean isLogin) { int visible = isLogin ? View.VISIBLE : View.GONE; findViewById(R.id.tvWeibo).setVisibility(visible); findViewById(R.id.tvQQ).setVisibility(visible); } /** * 设置标题 * * @param title * 标题 * @return 警告框实例 */ public InfoDialog setTitle(String title) { TextView tvTitle = (TextView) findViewById(R.id.tvTitle); tvTitle.setText(title); return this; } /** * 设置信息 * * @param msg * 信息 * @return 警告框示例 */ public InfoDialog setMessage(String msg) { TextView tvMessage = (TextView) findViewById(R.id.tvInfo); tvMessage.setText(msg); return this; } /** * 设置确认按钮 * * @param text * 确认按钮文字 * @param listener * 确认操作 * @return 警告框实例 */ public InfoDialog setPositiveButton(final String cacheKey) { CheckBox btn = (CheckBox) findViewById(R.id.cbxKnown); btn.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { @Override public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { if (isChecked) {
CacheUtil.setBind(InfoDialog.this.getContext(), cacheKey, true);
csuyzb/AndroidLinkup
LinkupCore/src/com/znv/linkup/core/status/IGameStatus.java
// Path: LinkupCore/src/com/znv/linkup/core/card/PiecePair.java // public class PiecePair { // public PiecePair(Piece p1, Piece p2) { // pieceOne = p1; // pieceTwo = p2; // } // // /** // * 将卡片对排序,序号小的为pieceOne // */ // public void sort() { // if (pieceOne == null || pieceTwo == null) { // return; // } // // if (pieceOne.getIndex() > pieceTwo.getIndex()) { // // 交换卡片对的位置 // Piece p = pieceOne; // pieceOne = pieceTwo; // pieceTwo = p; // } // } // // public Piece getPieceOne() { // return pieceOne; // } // // public void setPieceOne(Piece pieceOne) { // this.pieceOne = pieceOne; // } // // public Piece getPieceTwo() { // return pieceTwo; // } // // public void setPieceTwo(Piece pieceTwo) { // this.pieceTwo = pieceTwo; // } // // private Piece pieceOne; // private Piece pieceTwo; // }
import com.znv.linkup.core.card.PiecePair;
package com.znv.linkup.core.status; /** * 游戏状态处理 * * @author yzb * */ public interface IGameStatus { /** * 连击时的处理 * * @param combo * 连击数 */ void onCombo(int combo); /** * 提示时的处理 * * @param pair * 提示的卡片对 */
// Path: LinkupCore/src/com/znv/linkup/core/card/PiecePair.java // public class PiecePair { // public PiecePair(Piece p1, Piece p2) { // pieceOne = p1; // pieceTwo = p2; // } // // /** // * 将卡片对排序,序号小的为pieceOne // */ // public void sort() { // if (pieceOne == null || pieceTwo == null) { // return; // } // // if (pieceOne.getIndex() > pieceTwo.getIndex()) { // // 交换卡片对的位置 // Piece p = pieceOne; // pieceOne = pieceTwo; // pieceTwo = p; // } // } // // public Piece getPieceOne() { // return pieceOne; // } // // public void setPieceOne(Piece pieceOne) { // this.pieceOne = pieceOne; // } // // public Piece getPieceTwo() { // return pieceTwo; // } // // public void setPieceTwo(Piece pieceTwo) { // this.pieceTwo = pieceTwo; // } // // private Piece pieceOne; // private Piece pieceTwo; // } // Path: LinkupCore/src/com/znv/linkup/core/status/IGameStatus.java import com.znv.linkup.core.card.PiecePair; package com.znv.linkup.core.status; /** * 游戏状态处理 * * @author yzb * */ public interface IGameStatus { /** * 连击时的处理 * * @param combo * 连击数 */ void onCombo(int combo); /** * 提示时的处理 * * @param pair * 提示的卡片对 */
void onPrompt(PiecePair pair);
csuyzb/AndroidLinkup
LinkupCore/src/com/znv/linkup/core/config/LevelCfg.java
// Path: LinkupCore/src/com/znv/linkup/core/GameSettings.java // public class GameSettings { // // /** // * 地板卡片值 // */ // public static byte GroundCardValue = 0; // // /** // * 游戏卡片值,用于地图模版 // */ // public static byte GameCardValue = 1; // // /** // * 障碍卡片值 // */ // public static byte ObstacleCardValue = -1; // // /** // * 空卡片值 // */ // public static byte EmptyCardValue = -2; // // /** // * 消除卡片获得的积分,消除一对卡片得10分 // */ // public static int CardScore = 5; // // /** // * 连击延时时间,2000ms // */ // public static int ComboDelay = 2000; // // /** // * 连击间隔,3连击,6连击,9连击。。。 // */ // public static int ComboMod = 3; // // /** // * 连击分数,3连击则3*10=30 // */ // public static int ComboScore = 10; // // /** // * 剩余时间奖励分数,剩余10s,则奖励40分 // */ // public static int TimeScore = 4; // // /** // * 路径转弯奖励分数,直线不奖励,一个弯奖励5分,2个弯奖励10分 // */ // public static int CornerScore = 5; // // /** // * 消除一对卡片奖励的时间,0s // */ // public static int RewardTime = 0; // // /** // * 减少时间奖励,补偿分数 // */ // public static int RewardScoreMax = 5; // // /** // * 任务系数 // */ // public static int TaskFactor = 10; // // /** // * 重排时尝试次数,默认5次 // */ // public static int RefreshTryCount = 5; // // /** // * 星星的比例 // */ // public static float StarRatio = 0.4f; // }
import java.io.Serializable; import com.znv.linkup.core.GameSettings;
private int scoreTask; private int timeTask; private GameAlign levelAlign; private int maxScore; private int minTime; private boolean isActive; private int levelStar; private boolean isUpload = false; private int[] starScores = null; private int emptyNum; private int obstacleNum; private int pieceWidth; private int pieceHeight; private int beginImageX; private int beginImageY; private int levelBackground; // 关卡地图信息字符串 private String maptplStr; // 星星模式的星星数 private int stars = 0; // 是否已根据屏幕调整 private boolean isAdjust = false; /** * 初始化游戏星级的临界分数 */ public void initStarScores() { int cardCount = (xSize - 2) * (ySize - 2) - emptyNum - obstacleNum; if (starScores == null) { starScores = new int[3];
// Path: LinkupCore/src/com/znv/linkup/core/GameSettings.java // public class GameSettings { // // /** // * 地板卡片值 // */ // public static byte GroundCardValue = 0; // // /** // * 游戏卡片值,用于地图模版 // */ // public static byte GameCardValue = 1; // // /** // * 障碍卡片值 // */ // public static byte ObstacleCardValue = -1; // // /** // * 空卡片值 // */ // public static byte EmptyCardValue = -2; // // /** // * 消除卡片获得的积分,消除一对卡片得10分 // */ // public static int CardScore = 5; // // /** // * 连击延时时间,2000ms // */ // public static int ComboDelay = 2000; // // /** // * 连击间隔,3连击,6连击,9连击。。。 // */ // public static int ComboMod = 3; // // /** // * 连击分数,3连击则3*10=30 // */ // public static int ComboScore = 10; // // /** // * 剩余时间奖励分数,剩余10s,则奖励40分 // */ // public static int TimeScore = 4; // // /** // * 路径转弯奖励分数,直线不奖励,一个弯奖励5分,2个弯奖励10分 // */ // public static int CornerScore = 5; // // /** // * 消除一对卡片奖励的时间,0s // */ // public static int RewardTime = 0; // // /** // * 减少时间奖励,补偿分数 // */ // public static int RewardScoreMax = 5; // // /** // * 任务系数 // */ // public static int TaskFactor = 10; // // /** // * 重排时尝试次数,默认5次 // */ // public static int RefreshTryCount = 5; // // /** // * 星星的比例 // */ // public static float StarRatio = 0.4f; // } // Path: LinkupCore/src/com/znv/linkup/core/config/LevelCfg.java import java.io.Serializable; import com.znv.linkup.core.GameSettings; private int scoreTask; private int timeTask; private GameAlign levelAlign; private int maxScore; private int minTime; private boolean isActive; private int levelStar; private boolean isUpload = false; private int[] starScores = null; private int emptyNum; private int obstacleNum; private int pieceWidth; private int pieceHeight; private int beginImageX; private int beginImageY; private int levelBackground; // 关卡地图信息字符串 private String maptplStr; // 星星模式的星星数 private int stars = 0; // 是否已根据屏幕调整 private boolean isAdjust = false; /** * 初始化游戏星级的临界分数 */ public void initStarScores() { int cardCount = (xSize - 2) * (ySize - 2) - emptyNum - obstacleNum; if (starScores == null) { starScores = new int[3];
int min = cardCount * GameSettings.CardScore + levelTime * GameSettings.TimeScore / 2;
csuyzb/AndroidLinkup
Linkup/src/com/znv/linkup/view/animation/ViewPathAnimator.java
// Path: Linkup/src/com/znv/linkup/view/animation/path/AnimatorPath.java // public class AnimatorPath { // // // The points in the path // ArrayList<PathPoint> mPoints = new ArrayList<PathPoint>(); // // // /** // * Move from the current path point to the new one // * specified by x and y. This will create a discontinuity if this point is // * neither the first point in the path nor the same as the previous point // * in the path. // */ // public void moveTo(float x, float y) { // mPoints.add(PathPoint.moveTo(x, y)); // } // // /** // * Create a straight line from the current path point to the new one // * specified by x and y. // */ // public void lineTo(float x, float y) { // mPoints.add(PathPoint.lineTo(x, y)); // } // // /** // * Create a cubic B�zier curve from the current path point to the new one // * specified by x and y. The curve uses the current path location as the first anchor // * point, the control points (c0X, c0Y) and (c1X, c1Y), and (x, y) as the end anchor point. // */ // public void curveTo(float c0X, float c0Y, float c1X, float c1Y, float x, float y) { // mPoints.add(PathPoint.curveTo(c0X, c0Y, c1X, c1Y, x, y)); // } // // /** // * Returns a Collection of PathPoint objects that describe all points in the path. // */ // public Collection<PathPoint> getPoints() { // return mPoints; // } // } // // Path: Linkup/src/com/znv/linkup/view/animation/path/PathEvaluator.java // public class PathEvaluator implements TypeEvaluator<PathPoint> { // @Override // public PathPoint evaluate(float t, PathPoint startValue, PathPoint endValue) { // float x, y; // if (endValue.mOperation == PathPoint.CURVE) { // float oneMinusT = 1 - t; // x = oneMinusT * oneMinusT * oneMinusT * startValue.mX + // 3 * oneMinusT * oneMinusT * t * endValue.mControl0X + // 3 * oneMinusT * t * t * endValue.mControl1X + // t * t * t * endValue.mX; // y = oneMinusT * oneMinusT * oneMinusT * startValue.mY + // 3 * oneMinusT * oneMinusT * t * endValue.mControl0Y + // 3 * oneMinusT * t * t * endValue.mControl1Y + // t * t * t * endValue.mY; // } else if (endValue.mOperation == PathPoint.LINE) { // x = startValue.mX + t * (endValue.mX - startValue.mX); // y = startValue.mY + t * (endValue.mY - startValue.mY); // } else { // x = endValue.mX; // y = endValue.mY; // } // return PathPoint.moveTo(x, y); // } // } // // Path: Linkup/src/com/znv/linkup/view/animation/view/IAnimatorView.java // public interface IAnimatorView { // /** // * 设置定位点 // * // * @param pp // * 路径点 // */ // void setLocation(PathPoint pp); // // /** // * 设置透明度 // * // * @param alpha // * alpha值,0~1f // */ // void setAlpha(float alpha); // }
import java.util.ArrayList; import java.util.List; import android.animation.Animator; import android.animation.Animator.AnimatorListener; import android.animation.ObjectAnimator; import android.graphics.Point; import com.znv.linkup.view.animation.path.AnimatorPath; import com.znv.linkup.view.animation.path.PathEvaluator; import com.znv.linkup.view.animation.view.IAnimatorView;
package com.znv.linkup.view.animation; /** * 文字或者图片的动画 * * @author yzb * */ public class ViewPathAnimator implements AnimatorListener { private IAnimatorView view = null; private int duration = 400; public ViewPathAnimator(IAnimatorView view) { this.view = view; } /** * 设置动画的起始点 * * @param start * 动画起点 * @param end * 动画终点 */ public void animatePath(Point start, Point end) { List<Point> pathPoints = new ArrayList<Point>(); pathPoints.add(start); pathPoints.add(end); animatePath(pathPoints); } /** * 设置动画的起始点 * * @param pathPoints * 路径点 */ public void animatePath(List<Point> pathPoints) { if (pathPoints == null || pathPoints.size() == 0) { return; }
// Path: Linkup/src/com/znv/linkup/view/animation/path/AnimatorPath.java // public class AnimatorPath { // // // The points in the path // ArrayList<PathPoint> mPoints = new ArrayList<PathPoint>(); // // // /** // * Move from the current path point to the new one // * specified by x and y. This will create a discontinuity if this point is // * neither the first point in the path nor the same as the previous point // * in the path. // */ // public void moveTo(float x, float y) { // mPoints.add(PathPoint.moveTo(x, y)); // } // // /** // * Create a straight line from the current path point to the new one // * specified by x and y. // */ // public void lineTo(float x, float y) { // mPoints.add(PathPoint.lineTo(x, y)); // } // // /** // * Create a cubic B�zier curve from the current path point to the new one // * specified by x and y. The curve uses the current path location as the first anchor // * point, the control points (c0X, c0Y) and (c1X, c1Y), and (x, y) as the end anchor point. // */ // public void curveTo(float c0X, float c0Y, float c1X, float c1Y, float x, float y) { // mPoints.add(PathPoint.curveTo(c0X, c0Y, c1X, c1Y, x, y)); // } // // /** // * Returns a Collection of PathPoint objects that describe all points in the path. // */ // public Collection<PathPoint> getPoints() { // return mPoints; // } // } // // Path: Linkup/src/com/znv/linkup/view/animation/path/PathEvaluator.java // public class PathEvaluator implements TypeEvaluator<PathPoint> { // @Override // public PathPoint evaluate(float t, PathPoint startValue, PathPoint endValue) { // float x, y; // if (endValue.mOperation == PathPoint.CURVE) { // float oneMinusT = 1 - t; // x = oneMinusT * oneMinusT * oneMinusT * startValue.mX + // 3 * oneMinusT * oneMinusT * t * endValue.mControl0X + // 3 * oneMinusT * t * t * endValue.mControl1X + // t * t * t * endValue.mX; // y = oneMinusT * oneMinusT * oneMinusT * startValue.mY + // 3 * oneMinusT * oneMinusT * t * endValue.mControl0Y + // 3 * oneMinusT * t * t * endValue.mControl1Y + // t * t * t * endValue.mY; // } else if (endValue.mOperation == PathPoint.LINE) { // x = startValue.mX + t * (endValue.mX - startValue.mX); // y = startValue.mY + t * (endValue.mY - startValue.mY); // } else { // x = endValue.mX; // y = endValue.mY; // } // return PathPoint.moveTo(x, y); // } // } // // Path: Linkup/src/com/znv/linkup/view/animation/view/IAnimatorView.java // public interface IAnimatorView { // /** // * 设置定位点 // * // * @param pp // * 路径点 // */ // void setLocation(PathPoint pp); // // /** // * 设置透明度 // * // * @param alpha // * alpha值,0~1f // */ // void setAlpha(float alpha); // } // Path: Linkup/src/com/znv/linkup/view/animation/ViewPathAnimator.java import java.util.ArrayList; import java.util.List; import android.animation.Animator; import android.animation.Animator.AnimatorListener; import android.animation.ObjectAnimator; import android.graphics.Point; import com.znv.linkup.view.animation.path.AnimatorPath; import com.znv.linkup.view.animation.path.PathEvaluator; import com.znv.linkup.view.animation.view.IAnimatorView; package com.znv.linkup.view.animation; /** * 文字或者图片的动画 * * @author yzb * */ public class ViewPathAnimator implements AnimatorListener { private IAnimatorView view = null; private int duration = 400; public ViewPathAnimator(IAnimatorView view) { this.view = view; } /** * 设置动画的起始点 * * @param start * 动画起点 * @param end * 动画终点 */ public void animatePath(Point start, Point end) { List<Point> pathPoints = new ArrayList<Point>(); pathPoints.add(start); pathPoints.add(end); animatePath(pathPoints); } /** * 设置动画的起始点 * * @param pathPoints * 路径点 */ public void animatePath(List<Point> pathPoints) { if (pathPoints == null || pathPoints.size() == 0) { return; }
AnimatorPath path = new AnimatorPath();
csuyzb/AndroidLinkup
Linkup/src/com/znv/linkup/view/animation/ViewPathAnimator.java
// Path: Linkup/src/com/znv/linkup/view/animation/path/AnimatorPath.java // public class AnimatorPath { // // // The points in the path // ArrayList<PathPoint> mPoints = new ArrayList<PathPoint>(); // // // /** // * Move from the current path point to the new one // * specified by x and y. This will create a discontinuity if this point is // * neither the first point in the path nor the same as the previous point // * in the path. // */ // public void moveTo(float x, float y) { // mPoints.add(PathPoint.moveTo(x, y)); // } // // /** // * Create a straight line from the current path point to the new one // * specified by x and y. // */ // public void lineTo(float x, float y) { // mPoints.add(PathPoint.lineTo(x, y)); // } // // /** // * Create a cubic B�zier curve from the current path point to the new one // * specified by x and y. The curve uses the current path location as the first anchor // * point, the control points (c0X, c0Y) and (c1X, c1Y), and (x, y) as the end anchor point. // */ // public void curveTo(float c0X, float c0Y, float c1X, float c1Y, float x, float y) { // mPoints.add(PathPoint.curveTo(c0X, c0Y, c1X, c1Y, x, y)); // } // // /** // * Returns a Collection of PathPoint objects that describe all points in the path. // */ // public Collection<PathPoint> getPoints() { // return mPoints; // } // } // // Path: Linkup/src/com/znv/linkup/view/animation/path/PathEvaluator.java // public class PathEvaluator implements TypeEvaluator<PathPoint> { // @Override // public PathPoint evaluate(float t, PathPoint startValue, PathPoint endValue) { // float x, y; // if (endValue.mOperation == PathPoint.CURVE) { // float oneMinusT = 1 - t; // x = oneMinusT * oneMinusT * oneMinusT * startValue.mX + // 3 * oneMinusT * oneMinusT * t * endValue.mControl0X + // 3 * oneMinusT * t * t * endValue.mControl1X + // t * t * t * endValue.mX; // y = oneMinusT * oneMinusT * oneMinusT * startValue.mY + // 3 * oneMinusT * oneMinusT * t * endValue.mControl0Y + // 3 * oneMinusT * t * t * endValue.mControl1Y + // t * t * t * endValue.mY; // } else if (endValue.mOperation == PathPoint.LINE) { // x = startValue.mX + t * (endValue.mX - startValue.mX); // y = startValue.mY + t * (endValue.mY - startValue.mY); // } else { // x = endValue.mX; // y = endValue.mY; // } // return PathPoint.moveTo(x, y); // } // } // // Path: Linkup/src/com/znv/linkup/view/animation/view/IAnimatorView.java // public interface IAnimatorView { // /** // * 设置定位点 // * // * @param pp // * 路径点 // */ // void setLocation(PathPoint pp); // // /** // * 设置透明度 // * // * @param alpha // * alpha值,0~1f // */ // void setAlpha(float alpha); // }
import java.util.ArrayList; import java.util.List; import android.animation.Animator; import android.animation.Animator.AnimatorListener; import android.animation.ObjectAnimator; import android.graphics.Point; import com.znv.linkup.view.animation.path.AnimatorPath; import com.znv.linkup.view.animation.path.PathEvaluator; import com.znv.linkup.view.animation.view.IAnimatorView;
package com.znv.linkup.view.animation; /** * 文字或者图片的动画 * * @author yzb * */ public class ViewPathAnimator implements AnimatorListener { private IAnimatorView view = null; private int duration = 400; public ViewPathAnimator(IAnimatorView view) { this.view = view; } /** * 设置动画的起始点 * * @param start * 动画起点 * @param end * 动画终点 */ public void animatePath(Point start, Point end) { List<Point> pathPoints = new ArrayList<Point>(); pathPoints.add(start); pathPoints.add(end); animatePath(pathPoints); } /** * 设置动画的起始点 * * @param pathPoints * 路径点 */ public void animatePath(List<Point> pathPoints) { if (pathPoints == null || pathPoints.size() == 0) { return; } AnimatorPath path = new AnimatorPath(); path.moveTo(pathPoints.get(0).x, pathPoints.get(0).y); for (int i = 1; i < pathPoints.size(); i++) { path.lineTo(pathPoints.get(i).x, pathPoints.get(i).y); }
// Path: Linkup/src/com/znv/linkup/view/animation/path/AnimatorPath.java // public class AnimatorPath { // // // The points in the path // ArrayList<PathPoint> mPoints = new ArrayList<PathPoint>(); // // // /** // * Move from the current path point to the new one // * specified by x and y. This will create a discontinuity if this point is // * neither the first point in the path nor the same as the previous point // * in the path. // */ // public void moveTo(float x, float y) { // mPoints.add(PathPoint.moveTo(x, y)); // } // // /** // * Create a straight line from the current path point to the new one // * specified by x and y. // */ // public void lineTo(float x, float y) { // mPoints.add(PathPoint.lineTo(x, y)); // } // // /** // * Create a cubic B�zier curve from the current path point to the new one // * specified by x and y. The curve uses the current path location as the first anchor // * point, the control points (c0X, c0Y) and (c1X, c1Y), and (x, y) as the end anchor point. // */ // public void curveTo(float c0X, float c0Y, float c1X, float c1Y, float x, float y) { // mPoints.add(PathPoint.curveTo(c0X, c0Y, c1X, c1Y, x, y)); // } // // /** // * Returns a Collection of PathPoint objects that describe all points in the path. // */ // public Collection<PathPoint> getPoints() { // return mPoints; // } // } // // Path: Linkup/src/com/znv/linkup/view/animation/path/PathEvaluator.java // public class PathEvaluator implements TypeEvaluator<PathPoint> { // @Override // public PathPoint evaluate(float t, PathPoint startValue, PathPoint endValue) { // float x, y; // if (endValue.mOperation == PathPoint.CURVE) { // float oneMinusT = 1 - t; // x = oneMinusT * oneMinusT * oneMinusT * startValue.mX + // 3 * oneMinusT * oneMinusT * t * endValue.mControl0X + // 3 * oneMinusT * t * t * endValue.mControl1X + // t * t * t * endValue.mX; // y = oneMinusT * oneMinusT * oneMinusT * startValue.mY + // 3 * oneMinusT * oneMinusT * t * endValue.mControl0Y + // 3 * oneMinusT * t * t * endValue.mControl1Y + // t * t * t * endValue.mY; // } else if (endValue.mOperation == PathPoint.LINE) { // x = startValue.mX + t * (endValue.mX - startValue.mX); // y = startValue.mY + t * (endValue.mY - startValue.mY); // } else { // x = endValue.mX; // y = endValue.mY; // } // return PathPoint.moveTo(x, y); // } // } // // Path: Linkup/src/com/znv/linkup/view/animation/view/IAnimatorView.java // public interface IAnimatorView { // /** // * 设置定位点 // * // * @param pp // * 路径点 // */ // void setLocation(PathPoint pp); // // /** // * 设置透明度 // * // * @param alpha // * alpha值,0~1f // */ // void setAlpha(float alpha); // } // Path: Linkup/src/com/znv/linkup/view/animation/ViewPathAnimator.java import java.util.ArrayList; import java.util.List; import android.animation.Animator; import android.animation.Animator.AnimatorListener; import android.animation.ObjectAnimator; import android.graphics.Point; import com.znv.linkup.view.animation.path.AnimatorPath; import com.znv.linkup.view.animation.path.PathEvaluator; import com.znv.linkup.view.animation.view.IAnimatorView; package com.znv.linkup.view.animation; /** * 文字或者图片的动画 * * @author yzb * */ public class ViewPathAnimator implements AnimatorListener { private IAnimatorView view = null; private int duration = 400; public ViewPathAnimator(IAnimatorView view) { this.view = view; } /** * 设置动画的起始点 * * @param start * 动画起点 * @param end * 动画终点 */ public void animatePath(Point start, Point end) { List<Point> pathPoints = new ArrayList<Point>(); pathPoints.add(start); pathPoints.add(end); animatePath(pathPoints); } /** * 设置动画的起始点 * * @param pathPoints * 路径点 */ public void animatePath(List<Point> pathPoints) { if (pathPoints == null || pathPoints.size() == 0) { return; } AnimatorPath path = new AnimatorPath(); path.moveTo(pathPoints.get(0).x, pathPoints.get(0).y); for (int i = 1; i < pathPoints.size(); i++) { path.lineTo(pathPoints.get(i).x, pathPoints.get(i).y); }
ObjectAnimator anim = ObjectAnimator.ofObject(view, "location", new PathEvaluator(), path.getPoints().toArray());
DynamicsCRM/crm-mobilesdk-library-for-android
crmsdk2015/src/main/java/com/microsoft/xrm/sdk/OrganizationService.java
// Path: crmsdk2015/src/main/java/com/microsoft/xrm/sdk/Query/QueryBase.java // public abstract class QueryBase { // // // }
import rx.Observable; import android.support.annotation.NonNull; import com.microsoft.xrm.sdk.Query.QueryBase; import java.util.UUID;
package com.microsoft.xrm.sdk; public interface OrganizationService { /** * Creates a record. * @param entity An entity instance that contains the properties to set in the newly created record. */ Observable<UUID> Create(@NonNull Entity entity); /** * Creates a record * @param entity An entity instance that contains the properties to set in the newly created record. * @param callback The callback interface that will be call on complete (use if you don't want to use RXJava) */ void Create(@NonNull Entity entity, @NonNull Callback<UUID> callback); /** * Deletes a record. * @param entityName The logical name of the entity specified in the entityId parameter. * @param id The ID of the record of the record to delete. */ Observable Delete(@NonNull String entityName, @NonNull UUID id); /** * Deletes a record. * @param entityName The logical name of the entity specified in the entityId parameter. * @param id The ID of the record of the record to delete. * @param callback The callback interface that will be call on complete (use if you don't want to use RXJava) */ void Delete(@NonNull String entityName, @NonNull UUID id, @NonNull Callback<?> callback); /** * Executes a message in the form of a request, and returns a response. * @param request The response from the request. You must cast the return value of this method to the specific instance of the response that corresponds to the Request parameter. */ Observable<OrganizationResponse> Execute(OrganizationRequest request); /** * Executes a message in the form of a request, and returns a response. * @param request The response from the request. You must cast the return value of this method to the specific instance of the response that corresponds to the Request parameter. * @param callback The callback interface that will be call on complete (use if you don't want to use RXJava) */ void Execute(@NonNull OrganizationRequest request, @NonNull Callback<OrganizationResponse> callback); /** * Retrieves a record. * @param entitySchemaName property_schemaname that is specified in the entityId parameter. * @param id property_entityid that you want to retrieve. * @param columnSet A query that specifies the set of columns, or attributes, to retrieve. */ Observable<Entity> Retrieve(@NonNull String entitySchemaName, @NonNull UUID id, @NonNull ColumnSet columnSet); /** * Retrieves a record. * @param entitySchemaName property_schemaname that is specified in the entityId parameter. * @param id property_entityid that you want to retrieve. * @param columnSet A query that specifies the set of columns, or attributes, to retrieve. * @param callback The callback interface that will be call on complete (use if you don't want to use RXJava) */ void Retrieve(@NonNull String entitySchemaName, @NonNull UUID id, @NonNull ColumnSet columnSet, @NonNull Callback<Entity> callback); /** * * @param entityName The logical name of the entity that is specified in the entityId parameter. * @param entityId property_entityid to which the related records are associated. * @param relationship The name of the relationship to be used to create the link. * @param relatedEntities property_relatedentities to be associated. */ Observable Associate(String entityName, UUID entityId, Relationship relationship, EntityReferenceCollection relatedEntities); /** * Deletes a link between records. * @param entityName The logical name of the entity that is specified in the entityId parameter. * @param entityId The ID of the record from which the related records are disassociated. * @param relationship The name of the relationship to be used to remove the link. * @param relatedEntities A collection of entity references (references to records) to be disassociated. */ Observable Disassociate(String entityName, UUID entityId, Relationship relationship, EntityReferenceCollection relatedEntities); /** * Retrieves a collection of records. * @param query A query that determines the set of records to retrieve. */
// Path: crmsdk2015/src/main/java/com/microsoft/xrm/sdk/Query/QueryBase.java // public abstract class QueryBase { // // // } // Path: crmsdk2015/src/main/java/com/microsoft/xrm/sdk/OrganizationService.java import rx.Observable; import android.support.annotation.NonNull; import com.microsoft.xrm.sdk.Query.QueryBase; import java.util.UUID; package com.microsoft.xrm.sdk; public interface OrganizationService { /** * Creates a record. * @param entity An entity instance that contains the properties to set in the newly created record. */ Observable<UUID> Create(@NonNull Entity entity); /** * Creates a record * @param entity An entity instance that contains the properties to set in the newly created record. * @param callback The callback interface that will be call on complete (use if you don't want to use RXJava) */ void Create(@NonNull Entity entity, @NonNull Callback<UUID> callback); /** * Deletes a record. * @param entityName The logical name of the entity specified in the entityId parameter. * @param id The ID of the record of the record to delete. */ Observable Delete(@NonNull String entityName, @NonNull UUID id); /** * Deletes a record. * @param entityName The logical name of the entity specified in the entityId parameter. * @param id The ID of the record of the record to delete. * @param callback The callback interface that will be call on complete (use if you don't want to use RXJava) */ void Delete(@NonNull String entityName, @NonNull UUID id, @NonNull Callback<?> callback); /** * Executes a message in the form of a request, and returns a response. * @param request The response from the request. You must cast the return value of this method to the specific instance of the response that corresponds to the Request parameter. */ Observable<OrganizationResponse> Execute(OrganizationRequest request); /** * Executes a message in the form of a request, and returns a response. * @param request The response from the request. You must cast the return value of this method to the specific instance of the response that corresponds to the Request parameter. * @param callback The callback interface that will be call on complete (use if you don't want to use RXJava) */ void Execute(@NonNull OrganizationRequest request, @NonNull Callback<OrganizationResponse> callback); /** * Retrieves a record. * @param entitySchemaName property_schemaname that is specified in the entityId parameter. * @param id property_entityid that you want to retrieve. * @param columnSet A query that specifies the set of columns, or attributes, to retrieve. */ Observable<Entity> Retrieve(@NonNull String entitySchemaName, @NonNull UUID id, @NonNull ColumnSet columnSet); /** * Retrieves a record. * @param entitySchemaName property_schemaname that is specified in the entityId parameter. * @param id property_entityid that you want to retrieve. * @param columnSet A query that specifies the set of columns, or attributes, to retrieve. * @param callback The callback interface that will be call on complete (use if you don't want to use RXJava) */ void Retrieve(@NonNull String entitySchemaName, @NonNull UUID id, @NonNull ColumnSet columnSet, @NonNull Callback<Entity> callback); /** * * @param entityName The logical name of the entity that is specified in the entityId parameter. * @param entityId property_entityid to which the related records are associated. * @param relationship The name of the relationship to be used to create the link. * @param relatedEntities property_relatedentities to be associated. */ Observable Associate(String entityName, UUID entityId, Relationship relationship, EntityReferenceCollection relatedEntities); /** * Deletes a link between records. * @param entityName The logical name of the entity that is specified in the entityId parameter. * @param entityId The ID of the record from which the related records are disassociated. * @param relationship The name of the relationship to be used to remove the link. * @param relatedEntities A collection of entity references (references to records) to be disassociated. */ Observable Disassociate(String entityName, UUID entityId, Relationship relationship, EntityReferenceCollection relatedEntities); /** * Retrieves a collection of records. * @param query A query that determines the set of records to retrieve. */
Observable<EntityCollection> RetrieveMultiple(@NonNull QueryBase query);
DynamicsCRM/crm-mobilesdk-library-for-android
crmsdk2015/src/main/java/com/microsoft/xrm/sdk/Messages/AssociateEntitiesRequest.java
// Path: crmsdk2015/src/main/java/com/microsoft/xrm/sdk/EntityReference.java // public class EntityReference { // // // private static final String ID = "_id"; // private static final String LOGICAL_NAME = "logical_name"; // private static final String NAME = "name"; // // @SerializedName("Id") // @Expose // private UUID Id; // // @SerializedName("LogicalName") // @Expose // private String LogicalName; // // @SerializedName("Name") // @Expose // private String Name; // // public static EntityReference build() { // return new EntityReference(); // } // // public String getLogicalName() { // return LogicalName; // } // // public String getName() { // return Name; // } // // public UUID getId() { // return Id; // } // // public EntityReference setId(UUID id) { // Id = id; // return this; // } // // public EntityReference setLogicalName(String logicalName) { // LogicalName = logicalName; // return this; // } // // public EntityReference setName(String name) { // Name = name; // return this; // } // // public EntityReference() { // // } // // public static EntityReference fromBundle(Bundle bundle) { // return EntityReference.build() // .setId(UUID.fromString(bundle.getString(ID))) // .setLogicalName(bundle.getString(LOGICAL_NAME)) // .setName(bundle.getString(NAME)); // } // // public Bundle toBundle() { // Bundle newBundle = new Bundle(); // newBundle.putString(ID, getId().toString()); // newBundle.putString(LOGICAL_NAME, getLogicalName()); // newBundle.putString(NAME, getName()); // // return newBundle; // } // // /** // * Initializes a new instance of the EntityReference class setting // * the logical name and entity ID. // * @param logicalName The logical name of the entity. // * @param id The ID of the record. // */ // public EntityReference(String logicalName, UUID id) { // this.Id = id; // this.LogicalName = logicalName; // } // // String toValueXml() { // return Utils.objectToXml(Id, "a:Id", true) + // Utils.objectToXml(LogicalName, "a:LogicalName", true) + // Utils.objectToXml(Name, "a:Name", true); // } // // static EntityReference loadFromXml(XmlPullParser parser) { // EntityReference entityReference = new EntityReference(); // // try { // String name = parser.getName(); // parser.nextTag(); // // do { // if (parser.getEventType() != XmlPullParser.START_TAG) { // parser.next(); // continue; // } // // if (parser.getName().equals("Id")) { // parser.next(); // if (parser.getEventType() == XmlPullParser.TEXT) { // entityReference.setId(UUID.fromString(parser.getText())); // } // } // else if (parser.getName().equals("LogicalName")) { // parser.next(); // if (parser.getEventType() == XmlPullParser.TEXT) { // entityReference.setLogicalName(parser.getText()); // } // } // else if (parser.getName().equals("Name")) { // parser.next(); // if (parser.getEventType() == XmlPullParser.TEXT) { // entityReference.setName(parser.getText()); // } // } // else { // Utils.skip(parser); // } // // parser.next(); // } while(!parser.getName().equals(name)); // // } // catch(Exception ex) { // ex.getCause().printStackTrace(); // } // // return entityReference; // } // }
import android.support.annotation.Nullable; import com.microsoft.xrm.sdk.EntityReference; import com.microsoft.xrm.sdk.OrganizationRequest;
package com.microsoft.xrm.sdk.Messages; public final class AssociateEntitiesRequest extends OrganizationRequest { public AssociateEntitiesRequest() { this.setResponseType(new AssociateEntitiesResponse()); this.setRequestName("AssociateEntities"); } @Nullable
// Path: crmsdk2015/src/main/java/com/microsoft/xrm/sdk/EntityReference.java // public class EntityReference { // // // private static final String ID = "_id"; // private static final String LOGICAL_NAME = "logical_name"; // private static final String NAME = "name"; // // @SerializedName("Id") // @Expose // private UUID Id; // // @SerializedName("LogicalName") // @Expose // private String LogicalName; // // @SerializedName("Name") // @Expose // private String Name; // // public static EntityReference build() { // return new EntityReference(); // } // // public String getLogicalName() { // return LogicalName; // } // // public String getName() { // return Name; // } // // public UUID getId() { // return Id; // } // // public EntityReference setId(UUID id) { // Id = id; // return this; // } // // public EntityReference setLogicalName(String logicalName) { // LogicalName = logicalName; // return this; // } // // public EntityReference setName(String name) { // Name = name; // return this; // } // // public EntityReference() { // // } // // public static EntityReference fromBundle(Bundle bundle) { // return EntityReference.build() // .setId(UUID.fromString(bundle.getString(ID))) // .setLogicalName(bundle.getString(LOGICAL_NAME)) // .setName(bundle.getString(NAME)); // } // // public Bundle toBundle() { // Bundle newBundle = new Bundle(); // newBundle.putString(ID, getId().toString()); // newBundle.putString(LOGICAL_NAME, getLogicalName()); // newBundle.putString(NAME, getName()); // // return newBundle; // } // // /** // * Initializes a new instance of the EntityReference class setting // * the logical name and entity ID. // * @param logicalName The logical name of the entity. // * @param id The ID of the record. // */ // public EntityReference(String logicalName, UUID id) { // this.Id = id; // this.LogicalName = logicalName; // } // // String toValueXml() { // return Utils.objectToXml(Id, "a:Id", true) + // Utils.objectToXml(LogicalName, "a:LogicalName", true) + // Utils.objectToXml(Name, "a:Name", true); // } // // static EntityReference loadFromXml(XmlPullParser parser) { // EntityReference entityReference = new EntityReference(); // // try { // String name = parser.getName(); // parser.nextTag(); // // do { // if (parser.getEventType() != XmlPullParser.START_TAG) { // parser.next(); // continue; // } // // if (parser.getName().equals("Id")) { // parser.next(); // if (parser.getEventType() == XmlPullParser.TEXT) { // entityReference.setId(UUID.fromString(parser.getText())); // } // } // else if (parser.getName().equals("LogicalName")) { // parser.next(); // if (parser.getEventType() == XmlPullParser.TEXT) { // entityReference.setLogicalName(parser.getText()); // } // } // else if (parser.getName().equals("Name")) { // parser.next(); // if (parser.getEventType() == XmlPullParser.TEXT) { // entityReference.setName(parser.getText()); // } // } // else { // Utils.skip(parser); // } // // parser.next(); // } while(!parser.getName().equals(name)); // // } // catch(Exception ex) { // ex.getCause().printStackTrace(); // } // // return entityReference; // } // } // Path: crmsdk2015/src/main/java/com/microsoft/xrm/sdk/Messages/AssociateEntitiesRequest.java import android.support.annotation.Nullable; import com.microsoft.xrm.sdk.EntityReference; import com.microsoft.xrm.sdk.OrganizationRequest; package com.microsoft.xrm.sdk.Messages; public final class AssociateEntitiesRequest extends OrganizationRequest { public AssociateEntitiesRequest() { this.setResponseType(new AssociateEntitiesResponse()); this.setRequestName("AssociateEntities"); } @Nullable
public EntityReference getMoniker1() {
DynamicsCRM/crm-mobilesdk-library-for-android
crmsdk2015/src/main/java/com/microsoft/xrm/sdk/Messages/DeleteRequest.java
// Path: crmsdk2015/src/main/java/com/microsoft/xrm/sdk/EntityReference.java // public class EntityReference { // // // private static final String ID = "_id"; // private static final String LOGICAL_NAME = "logical_name"; // private static final String NAME = "name"; // // @SerializedName("Id") // @Expose // private UUID Id; // // @SerializedName("LogicalName") // @Expose // private String LogicalName; // // @SerializedName("Name") // @Expose // private String Name; // // public static EntityReference build() { // return new EntityReference(); // } // // public String getLogicalName() { // return LogicalName; // } // // public String getName() { // return Name; // } // // public UUID getId() { // return Id; // } // // public EntityReference setId(UUID id) { // Id = id; // return this; // } // // public EntityReference setLogicalName(String logicalName) { // LogicalName = logicalName; // return this; // } // // public EntityReference setName(String name) { // Name = name; // return this; // } // // public EntityReference() { // // } // // public static EntityReference fromBundle(Bundle bundle) { // return EntityReference.build() // .setId(UUID.fromString(bundle.getString(ID))) // .setLogicalName(bundle.getString(LOGICAL_NAME)) // .setName(bundle.getString(NAME)); // } // // public Bundle toBundle() { // Bundle newBundle = new Bundle(); // newBundle.putString(ID, getId().toString()); // newBundle.putString(LOGICAL_NAME, getLogicalName()); // newBundle.putString(NAME, getName()); // // return newBundle; // } // // /** // * Initializes a new instance of the EntityReference class setting // * the logical name and entity ID. // * @param logicalName The logical name of the entity. // * @param id The ID of the record. // */ // public EntityReference(String logicalName, UUID id) { // this.Id = id; // this.LogicalName = logicalName; // } // // String toValueXml() { // return Utils.objectToXml(Id, "a:Id", true) + // Utils.objectToXml(LogicalName, "a:LogicalName", true) + // Utils.objectToXml(Name, "a:Name", true); // } // // static EntityReference loadFromXml(XmlPullParser parser) { // EntityReference entityReference = new EntityReference(); // // try { // String name = parser.getName(); // parser.nextTag(); // // do { // if (parser.getEventType() != XmlPullParser.START_TAG) { // parser.next(); // continue; // } // // if (parser.getName().equals("Id")) { // parser.next(); // if (parser.getEventType() == XmlPullParser.TEXT) { // entityReference.setId(UUID.fromString(parser.getText())); // } // } // else if (parser.getName().equals("LogicalName")) { // parser.next(); // if (parser.getEventType() == XmlPullParser.TEXT) { // entityReference.setLogicalName(parser.getText()); // } // } // else if (parser.getName().equals("Name")) { // parser.next(); // if (parser.getEventType() == XmlPullParser.TEXT) { // entityReference.setName(parser.getText()); // } // } // else { // Utils.skip(parser); // } // // parser.next(); // } while(!parser.getName().equals(name)); // // } // catch(Exception ex) { // ex.getCause().printStackTrace(); // } // // return entityReference; // } // } // // Path: crmsdk2015/src/main/java/com/microsoft/xrm/sdk/OrganizationResponse.java // public class OrganizationResponse { // // public String ResponseName; // public DataMapCollection<String, Object> Results; // // public OrganizationResponse() { // // } // // public String getResponseName() { // return this.ResponseName; // } // // public void setResponseName(String responseName) { // this.ResponseName = responseName; // } // // public DataMapCollection<String, Object> getResults() { // if (this.Results == null) { // this.Results = new DataMapCollection<>(); // } // // return this.Results; // } // // public void setResults(DataMapCollection<String, Object> value) { // this.Results = value; // } // // public void storeResult(XmlPullParser parser) { // // } // }
import android.support.annotation.Nullable; import com.microsoft.xrm.sdk.EntityReference; import com.microsoft.xrm.sdk.OrganizationRequest; import com.microsoft.xrm.sdk.OrganizationResponse;
package com.microsoft.xrm.sdk.Messages; public final class DeleteRequest extends OrganizationRequest { public DeleteRequest() { this.setRequestName("Delete");
// Path: crmsdk2015/src/main/java/com/microsoft/xrm/sdk/EntityReference.java // public class EntityReference { // // // private static final String ID = "_id"; // private static final String LOGICAL_NAME = "logical_name"; // private static final String NAME = "name"; // // @SerializedName("Id") // @Expose // private UUID Id; // // @SerializedName("LogicalName") // @Expose // private String LogicalName; // // @SerializedName("Name") // @Expose // private String Name; // // public static EntityReference build() { // return new EntityReference(); // } // // public String getLogicalName() { // return LogicalName; // } // // public String getName() { // return Name; // } // // public UUID getId() { // return Id; // } // // public EntityReference setId(UUID id) { // Id = id; // return this; // } // // public EntityReference setLogicalName(String logicalName) { // LogicalName = logicalName; // return this; // } // // public EntityReference setName(String name) { // Name = name; // return this; // } // // public EntityReference() { // // } // // public static EntityReference fromBundle(Bundle bundle) { // return EntityReference.build() // .setId(UUID.fromString(bundle.getString(ID))) // .setLogicalName(bundle.getString(LOGICAL_NAME)) // .setName(bundle.getString(NAME)); // } // // public Bundle toBundle() { // Bundle newBundle = new Bundle(); // newBundle.putString(ID, getId().toString()); // newBundle.putString(LOGICAL_NAME, getLogicalName()); // newBundle.putString(NAME, getName()); // // return newBundle; // } // // /** // * Initializes a new instance of the EntityReference class setting // * the logical name and entity ID. // * @param logicalName The logical name of the entity. // * @param id The ID of the record. // */ // public EntityReference(String logicalName, UUID id) { // this.Id = id; // this.LogicalName = logicalName; // } // // String toValueXml() { // return Utils.objectToXml(Id, "a:Id", true) + // Utils.objectToXml(LogicalName, "a:LogicalName", true) + // Utils.objectToXml(Name, "a:Name", true); // } // // static EntityReference loadFromXml(XmlPullParser parser) { // EntityReference entityReference = new EntityReference(); // // try { // String name = parser.getName(); // parser.nextTag(); // // do { // if (parser.getEventType() != XmlPullParser.START_TAG) { // parser.next(); // continue; // } // // if (parser.getName().equals("Id")) { // parser.next(); // if (parser.getEventType() == XmlPullParser.TEXT) { // entityReference.setId(UUID.fromString(parser.getText())); // } // } // else if (parser.getName().equals("LogicalName")) { // parser.next(); // if (parser.getEventType() == XmlPullParser.TEXT) { // entityReference.setLogicalName(parser.getText()); // } // } // else if (parser.getName().equals("Name")) { // parser.next(); // if (parser.getEventType() == XmlPullParser.TEXT) { // entityReference.setName(parser.getText()); // } // } // else { // Utils.skip(parser); // } // // parser.next(); // } while(!parser.getName().equals(name)); // // } // catch(Exception ex) { // ex.getCause().printStackTrace(); // } // // return entityReference; // } // } // // Path: crmsdk2015/src/main/java/com/microsoft/xrm/sdk/OrganizationResponse.java // public class OrganizationResponse { // // public String ResponseName; // public DataMapCollection<String, Object> Results; // // public OrganizationResponse() { // // } // // public String getResponseName() { // return this.ResponseName; // } // // public void setResponseName(String responseName) { // this.ResponseName = responseName; // } // // public DataMapCollection<String, Object> getResults() { // if (this.Results == null) { // this.Results = new DataMapCollection<>(); // } // // return this.Results; // } // // public void setResults(DataMapCollection<String, Object> value) { // this.Results = value; // } // // public void storeResult(XmlPullParser parser) { // // } // } // Path: crmsdk2015/src/main/java/com/microsoft/xrm/sdk/Messages/DeleteRequest.java import android.support.annotation.Nullable; import com.microsoft.xrm.sdk.EntityReference; import com.microsoft.xrm.sdk.OrganizationRequest; import com.microsoft.xrm.sdk.OrganizationResponse; package com.microsoft.xrm.sdk.Messages; public final class DeleteRequest extends OrganizationRequest { public DeleteRequest() { this.setRequestName("Delete");
this.setResponseType(new OrganizationResponse());
DynamicsCRM/crm-mobilesdk-library-for-android
crmsdk2015/src/main/java/com/microsoft/xrm/sdk/Messages/DeleteRequest.java
// Path: crmsdk2015/src/main/java/com/microsoft/xrm/sdk/EntityReference.java // public class EntityReference { // // // private static final String ID = "_id"; // private static final String LOGICAL_NAME = "logical_name"; // private static final String NAME = "name"; // // @SerializedName("Id") // @Expose // private UUID Id; // // @SerializedName("LogicalName") // @Expose // private String LogicalName; // // @SerializedName("Name") // @Expose // private String Name; // // public static EntityReference build() { // return new EntityReference(); // } // // public String getLogicalName() { // return LogicalName; // } // // public String getName() { // return Name; // } // // public UUID getId() { // return Id; // } // // public EntityReference setId(UUID id) { // Id = id; // return this; // } // // public EntityReference setLogicalName(String logicalName) { // LogicalName = logicalName; // return this; // } // // public EntityReference setName(String name) { // Name = name; // return this; // } // // public EntityReference() { // // } // // public static EntityReference fromBundle(Bundle bundle) { // return EntityReference.build() // .setId(UUID.fromString(bundle.getString(ID))) // .setLogicalName(bundle.getString(LOGICAL_NAME)) // .setName(bundle.getString(NAME)); // } // // public Bundle toBundle() { // Bundle newBundle = new Bundle(); // newBundle.putString(ID, getId().toString()); // newBundle.putString(LOGICAL_NAME, getLogicalName()); // newBundle.putString(NAME, getName()); // // return newBundle; // } // // /** // * Initializes a new instance of the EntityReference class setting // * the logical name and entity ID. // * @param logicalName The logical name of the entity. // * @param id The ID of the record. // */ // public EntityReference(String logicalName, UUID id) { // this.Id = id; // this.LogicalName = logicalName; // } // // String toValueXml() { // return Utils.objectToXml(Id, "a:Id", true) + // Utils.objectToXml(LogicalName, "a:LogicalName", true) + // Utils.objectToXml(Name, "a:Name", true); // } // // static EntityReference loadFromXml(XmlPullParser parser) { // EntityReference entityReference = new EntityReference(); // // try { // String name = parser.getName(); // parser.nextTag(); // // do { // if (parser.getEventType() != XmlPullParser.START_TAG) { // parser.next(); // continue; // } // // if (parser.getName().equals("Id")) { // parser.next(); // if (parser.getEventType() == XmlPullParser.TEXT) { // entityReference.setId(UUID.fromString(parser.getText())); // } // } // else if (parser.getName().equals("LogicalName")) { // parser.next(); // if (parser.getEventType() == XmlPullParser.TEXT) { // entityReference.setLogicalName(parser.getText()); // } // } // else if (parser.getName().equals("Name")) { // parser.next(); // if (parser.getEventType() == XmlPullParser.TEXT) { // entityReference.setName(parser.getText()); // } // } // else { // Utils.skip(parser); // } // // parser.next(); // } while(!parser.getName().equals(name)); // // } // catch(Exception ex) { // ex.getCause().printStackTrace(); // } // // return entityReference; // } // } // // Path: crmsdk2015/src/main/java/com/microsoft/xrm/sdk/OrganizationResponse.java // public class OrganizationResponse { // // public String ResponseName; // public DataMapCollection<String, Object> Results; // // public OrganizationResponse() { // // } // // public String getResponseName() { // return this.ResponseName; // } // // public void setResponseName(String responseName) { // this.ResponseName = responseName; // } // // public DataMapCollection<String, Object> getResults() { // if (this.Results == null) { // this.Results = new DataMapCollection<>(); // } // // return this.Results; // } // // public void setResults(DataMapCollection<String, Object> value) { // this.Results = value; // } // // public void storeResult(XmlPullParser parser) { // // } // }
import android.support.annotation.Nullable; import com.microsoft.xrm.sdk.EntityReference; import com.microsoft.xrm.sdk.OrganizationRequest; import com.microsoft.xrm.sdk.OrganizationResponse;
package com.microsoft.xrm.sdk.Messages; public final class DeleteRequest extends OrganizationRequest { public DeleteRequest() { this.setRequestName("Delete"); this.setResponseType(new OrganizationResponse()); this.setTarget(null); } @Nullable
// Path: crmsdk2015/src/main/java/com/microsoft/xrm/sdk/EntityReference.java // public class EntityReference { // // // private static final String ID = "_id"; // private static final String LOGICAL_NAME = "logical_name"; // private static final String NAME = "name"; // // @SerializedName("Id") // @Expose // private UUID Id; // // @SerializedName("LogicalName") // @Expose // private String LogicalName; // // @SerializedName("Name") // @Expose // private String Name; // // public static EntityReference build() { // return new EntityReference(); // } // // public String getLogicalName() { // return LogicalName; // } // // public String getName() { // return Name; // } // // public UUID getId() { // return Id; // } // // public EntityReference setId(UUID id) { // Id = id; // return this; // } // // public EntityReference setLogicalName(String logicalName) { // LogicalName = logicalName; // return this; // } // // public EntityReference setName(String name) { // Name = name; // return this; // } // // public EntityReference() { // // } // // public static EntityReference fromBundle(Bundle bundle) { // return EntityReference.build() // .setId(UUID.fromString(bundle.getString(ID))) // .setLogicalName(bundle.getString(LOGICAL_NAME)) // .setName(bundle.getString(NAME)); // } // // public Bundle toBundle() { // Bundle newBundle = new Bundle(); // newBundle.putString(ID, getId().toString()); // newBundle.putString(LOGICAL_NAME, getLogicalName()); // newBundle.putString(NAME, getName()); // // return newBundle; // } // // /** // * Initializes a new instance of the EntityReference class setting // * the logical name and entity ID. // * @param logicalName The logical name of the entity. // * @param id The ID of the record. // */ // public EntityReference(String logicalName, UUID id) { // this.Id = id; // this.LogicalName = logicalName; // } // // String toValueXml() { // return Utils.objectToXml(Id, "a:Id", true) + // Utils.objectToXml(LogicalName, "a:LogicalName", true) + // Utils.objectToXml(Name, "a:Name", true); // } // // static EntityReference loadFromXml(XmlPullParser parser) { // EntityReference entityReference = new EntityReference(); // // try { // String name = parser.getName(); // parser.nextTag(); // // do { // if (parser.getEventType() != XmlPullParser.START_TAG) { // parser.next(); // continue; // } // // if (parser.getName().equals("Id")) { // parser.next(); // if (parser.getEventType() == XmlPullParser.TEXT) { // entityReference.setId(UUID.fromString(parser.getText())); // } // } // else if (parser.getName().equals("LogicalName")) { // parser.next(); // if (parser.getEventType() == XmlPullParser.TEXT) { // entityReference.setLogicalName(parser.getText()); // } // } // else if (parser.getName().equals("Name")) { // parser.next(); // if (parser.getEventType() == XmlPullParser.TEXT) { // entityReference.setName(parser.getText()); // } // } // else { // Utils.skip(parser); // } // // parser.next(); // } while(!parser.getName().equals(name)); // // } // catch(Exception ex) { // ex.getCause().printStackTrace(); // } // // return entityReference; // } // } // // Path: crmsdk2015/src/main/java/com/microsoft/xrm/sdk/OrganizationResponse.java // public class OrganizationResponse { // // public String ResponseName; // public DataMapCollection<String, Object> Results; // // public OrganizationResponse() { // // } // // public String getResponseName() { // return this.ResponseName; // } // // public void setResponseName(String responseName) { // this.ResponseName = responseName; // } // // public DataMapCollection<String, Object> getResults() { // if (this.Results == null) { // this.Results = new DataMapCollection<>(); // } // // return this.Results; // } // // public void setResults(DataMapCollection<String, Object> value) { // this.Results = value; // } // // public void storeResult(XmlPullParser parser) { // // } // } // Path: crmsdk2015/src/main/java/com/microsoft/xrm/sdk/Messages/DeleteRequest.java import android.support.annotation.Nullable; import com.microsoft.xrm.sdk.EntityReference; import com.microsoft.xrm.sdk.OrganizationRequest; import com.microsoft.xrm.sdk.OrganizationResponse; package com.microsoft.xrm.sdk.Messages; public final class DeleteRequest extends OrganizationRequest { public DeleteRequest() { this.setRequestName("Delete"); this.setResponseType(new OrganizationResponse()); this.setTarget(null); } @Nullable
public EntityReference getTarget() {
DynamicsCRM/crm-mobilesdk-library-for-android
crmsdk2015/src/main/java/com/microsoft/xrm/sdk/Messages/RetrieveMultipleRequest.java
// Path: crmsdk2015/src/main/java/com/microsoft/xrm/sdk/Query/QueryBase.java // public abstract class QueryBase { // // // }
import android.support.annotation.Nullable; import com.microsoft.xrm.sdk.OrganizationRequest; import com.microsoft.xrm.sdk.Query.QueryBase;
package com.microsoft.xrm.sdk.Messages; public final class RetrieveMultipleRequest extends OrganizationRequest { public RetrieveMultipleRequest() { this.setRequestName("RetrieveMultiple"); this.setResponseType(new RetrieveMultipleResponse()); this.setQuery(null); }
// Path: crmsdk2015/src/main/java/com/microsoft/xrm/sdk/Query/QueryBase.java // public abstract class QueryBase { // // // } // Path: crmsdk2015/src/main/java/com/microsoft/xrm/sdk/Messages/RetrieveMultipleRequest.java import android.support.annotation.Nullable; import com.microsoft.xrm.sdk.OrganizationRequest; import com.microsoft.xrm.sdk.Query.QueryBase; package com.microsoft.xrm.sdk.Messages; public final class RetrieveMultipleRequest extends OrganizationRequest { public RetrieveMultipleRequest() { this.setRequestName("RetrieveMultiple"); this.setResponseType(new RetrieveMultipleResponse()); this.setQuery(null); }
public RetrieveMultipleRequest(QueryBase query) {
DynamicsCRM/crm-mobilesdk-library-for-android
crmsdk2015/src/main/java/com/microsoft/xrm/sdk/RestOrganizationService.java
// Path: crmsdk2015/src/main/java/com/microsoft/xrm/sdk/Client/QueryOptions.java // public class QueryOptions { // // private HashMap<String, String> queries = new HashMap<>(); // // public QueryOptions() { // // } // // public static QueryOptions build() { // return new QueryOptions(); // } // // HashMap<String, String> getQueryMap() { // return this.queries; // } // // public QueryOptions putExpand(String expand) { // queries.put("$expand", expand); // return this; // } // // public QueryOptions putFilter(String filter) { // queries.put("$filter", filter); // return this; // } // // public QueryOptions putOrderBy(String orderby) { // queries.put("$orderby", orderby); // return this; // } // // public QueryOptions putSelect(String select) { // queries.put("$select", select); // return this; // } // // public QueryOptions putSelect(String... select) { // StringBuilder stringBuilder = new StringBuilder(); // for (String column : select) { // if (stringBuilder.length() > 0) { // stringBuilder.append(','); // } // stringBuilder.append(column); // } // queries.put("$select", stringBuilder.toString()); // return this; // } // // public QueryOptions putSkip(String skip) { // queries.put("$skip", skip); // return this; // } // // public QueryOptions putTop(String top) { // queries.put("$top", top); // return this; // } // }
import rx.Observable; import android.support.annotation.NonNull; import com.microsoft.xrm.sdk.Client.QueryOptions; import java.util.UUID;
package com.microsoft.xrm.sdk; public interface RestOrganizationService { /** * Creates a record. * @param entity An entity instance that contains the properties to set in the newly created record. * must be a subclass of entity to use this method. */ Observable<UUID> Create(Entity entity); void Create(Entity entity, Callback<UUID> callback); Observable<UUID> Create(Entity relatedTo, Entity create, String relationshipName); void Create(Entity relatedTo, Entity create, String relationshipName, Callback<UUID> callback); Observable<UUID> Create(String relatedToSchemaName, UUID relatedToId, Entity create, String relationshipName); void Create(String relatedToSchemaName, UUID relatedToId, Entity create, String relationshipName, Callback<UUID> callback); Observable<?> Delete(String entitySchemaName, UUID id); void Delete(String entitySchemaName, UUID id, Callback<?> callback); // Observable<Entity> Retrieve(String entitySchemaName, UUID id, @NonNull QueryOptions queryOptions); // // void Retrieve(String entitySchemaName, UUID id, @NonNull QueryOptions queryOptions, Callback<Entity> callback);
// Path: crmsdk2015/src/main/java/com/microsoft/xrm/sdk/Client/QueryOptions.java // public class QueryOptions { // // private HashMap<String, String> queries = new HashMap<>(); // // public QueryOptions() { // // } // // public static QueryOptions build() { // return new QueryOptions(); // } // // HashMap<String, String> getQueryMap() { // return this.queries; // } // // public QueryOptions putExpand(String expand) { // queries.put("$expand", expand); // return this; // } // // public QueryOptions putFilter(String filter) { // queries.put("$filter", filter); // return this; // } // // public QueryOptions putOrderBy(String orderby) { // queries.put("$orderby", orderby); // return this; // } // // public QueryOptions putSelect(String select) { // queries.put("$select", select); // return this; // } // // public QueryOptions putSelect(String... select) { // StringBuilder stringBuilder = new StringBuilder(); // for (String column : select) { // if (stringBuilder.length() > 0) { // stringBuilder.append(','); // } // stringBuilder.append(column); // } // queries.put("$select", stringBuilder.toString()); // return this; // } // // public QueryOptions putSkip(String skip) { // queries.put("$skip", skip); // return this; // } // // public QueryOptions putTop(String top) { // queries.put("$top", top); // return this; // } // } // Path: crmsdk2015/src/main/java/com/microsoft/xrm/sdk/RestOrganizationService.java import rx.Observable; import android.support.annotation.NonNull; import com.microsoft.xrm.sdk.Client.QueryOptions; import java.util.UUID; package com.microsoft.xrm.sdk; public interface RestOrganizationService { /** * Creates a record. * @param entity An entity instance that contains the properties to set in the newly created record. * must be a subclass of entity to use this method. */ Observable<UUID> Create(Entity entity); void Create(Entity entity, Callback<UUID> callback); Observable<UUID> Create(Entity relatedTo, Entity create, String relationshipName); void Create(Entity relatedTo, Entity create, String relationshipName, Callback<UUID> callback); Observable<UUID> Create(String relatedToSchemaName, UUID relatedToId, Entity create, String relationshipName); void Create(String relatedToSchemaName, UUID relatedToId, Entity create, String relationshipName, Callback<UUID> callback); Observable<?> Delete(String entitySchemaName, UUID id); void Delete(String entitySchemaName, UUID id, Callback<?> callback); // Observable<Entity> Retrieve(String entitySchemaName, UUID id, @NonNull QueryOptions queryOptions); // // void Retrieve(String entitySchemaName, UUID id, @NonNull QueryOptions queryOptions, Callback<Entity> callback);
Observable<EntityCollection> RetrieveMultiple(String entitySchemaName, UUID id, String relationshipName, @NonNull QueryOptions queryOptions);
DynamicsCRM/crm-mobilesdk-library-for-android
crmsdk2015/src/main/java/com/microsoft/xrm/sdk/Messages/CancelContractRequest.java
// Path: crmsdk2015/src/main/java/com/microsoft/xrm/sdk/OptionSetValue.java // public class OptionSetValue { // // /** // * Initializes a new instance of the OptionSetValue class // */ // public OptionSetValue() { // // } // // /** // * Initializes a new instance of the OptionSetValue class // * @param value The option set value. // */ // public OptionSetValue(int value) { // this.Value = value; // } // // /** // * Gets or sets the current value. // */ // @Expose // @SerializedName("Value") // private int Value; // // public int getValue() { // return this.Value; // } // // public void setValue(int value) { // this.Value = value; // } // // String toValueXml() { // return Utils.objectToXml(getValue(), "a:Value", true); // } // // static OptionSetValue loadFromXml(XmlPullParser parser) { // OptionSetValue optionSetValue = null; // // try { // String name = parser.getName(); // parser.next(); // // do { // if (parser.getEventType() != XmlPullParser.START_TAG) { // parser.next(); // continue; // } // // if (parser.getName().equals("Value")) { // parser.next(); // if (parser.getEventType() == XmlPullParser.TEXT) { // optionSetValue = new OptionSetValue(Integer.parseInt(parser.getText())); // } // } // else { // Utils.skip(parser); // } // // parser.next(); // } while (!parser.getName().equals(name)); // // } // catch(Exception ex) { // ex.getCause().printStackTrace(); // } // // return optionSetValue; // } // }
import android.support.annotation.Nullable; import com.microsoft.xrm.sdk.OptionSetValue; import com.microsoft.xrm.sdk.OrganizationRequest; import java.util.Date; import java.util.UUID;
package com.microsoft.xrm.sdk.Messages; public final class CancelContractRequest extends OrganizationRequest { public CancelContractRequest() { this.setResponseType(new CancelContractResponse()); this.setRequestName("CancelContract"); } @Nullable public Date getCancelDate() { if (this.getParameters().containsKey("CancelDate")) { return (Date) this.getParameters().get("CancelDate"); } return null; } public void setCancelDate(Date value) { this.set("CancelDate", value); } public UUID getContractId() { if (this.getParameters().containsKey("ContractId")) { return (UUID) this.getParameters().get("ContractId"); } return new UUID(0L, 0L); } public void setContractId(UUID value) { this.set("ContractId", value); } @Nullable
// Path: crmsdk2015/src/main/java/com/microsoft/xrm/sdk/OptionSetValue.java // public class OptionSetValue { // // /** // * Initializes a new instance of the OptionSetValue class // */ // public OptionSetValue() { // // } // // /** // * Initializes a new instance of the OptionSetValue class // * @param value The option set value. // */ // public OptionSetValue(int value) { // this.Value = value; // } // // /** // * Gets or sets the current value. // */ // @Expose // @SerializedName("Value") // private int Value; // // public int getValue() { // return this.Value; // } // // public void setValue(int value) { // this.Value = value; // } // // String toValueXml() { // return Utils.objectToXml(getValue(), "a:Value", true); // } // // static OptionSetValue loadFromXml(XmlPullParser parser) { // OptionSetValue optionSetValue = null; // // try { // String name = parser.getName(); // parser.next(); // // do { // if (parser.getEventType() != XmlPullParser.START_TAG) { // parser.next(); // continue; // } // // if (parser.getName().equals("Value")) { // parser.next(); // if (parser.getEventType() == XmlPullParser.TEXT) { // optionSetValue = new OptionSetValue(Integer.parseInt(parser.getText())); // } // } // else { // Utils.skip(parser); // } // // parser.next(); // } while (!parser.getName().equals(name)); // // } // catch(Exception ex) { // ex.getCause().printStackTrace(); // } // // return optionSetValue; // } // } // Path: crmsdk2015/src/main/java/com/microsoft/xrm/sdk/Messages/CancelContractRequest.java import android.support.annotation.Nullable; import com.microsoft.xrm.sdk.OptionSetValue; import com.microsoft.xrm.sdk.OrganizationRequest; import java.util.Date; import java.util.UUID; package com.microsoft.xrm.sdk.Messages; public final class CancelContractRequest extends OrganizationRequest { public CancelContractRequest() { this.setResponseType(new CancelContractResponse()); this.setRequestName("CancelContract"); } @Nullable public Date getCancelDate() { if (this.getParameters().containsKey("CancelDate")) { return (Date) this.getParameters().get("CancelDate"); } return null; } public void setCancelDate(Date value) { this.set("CancelDate", value); } public UUID getContractId() { if (this.getParameters().containsKey("ContractId")) { return (UUID) this.getParameters().get("ContractId"); } return new UUID(0L, 0L); } public void setContractId(UUID value) { this.set("ContractId", value); } @Nullable
public OptionSetValue getStatus() {
DynamicsCRM/crm-mobilesdk-library-for-android
crmsdk2015/src/main/java/com/microsoft/xrm/sdk/Metadata/OptionSetMetadataBase.java
// Path: crmsdk2015/src/main/java/com/microsoft/xrm/sdk/BooleanManagedProperty.java // public class BooleanManagedProperty extends ManagedProperty<Boolean> { // // public BooleanManagedProperty() { // this(false); // } // // public BooleanManagedProperty(boolean value) { // this(value, null); // } // // BooleanManagedProperty(boolean value, String logicalName) { // super(logicalName); // this.setValue(value); // } // // protected String toValueXml() { // return super.ToValueXml() + Utils.objectToXml(this.getValue(), "a:Value", true); // } // }
import com.microsoft.xrm.sdk.BooleanManagedProperty; import com.microsoft.xrm.sdk.Label;
package com.microsoft.xrm.sdk.Metadata; public abstract class OptionSetMetadataBase extends MetadataBase { private Label description; private Label displayName; private Boolean isCustomOptionSet; private Boolean isGlobal; private Boolean isManaged; private String name; private OptionSetType optionSetType;
// Path: crmsdk2015/src/main/java/com/microsoft/xrm/sdk/BooleanManagedProperty.java // public class BooleanManagedProperty extends ManagedProperty<Boolean> { // // public BooleanManagedProperty() { // this(false); // } // // public BooleanManagedProperty(boolean value) { // this(value, null); // } // // BooleanManagedProperty(boolean value, String logicalName) { // super(logicalName); // this.setValue(value); // } // // protected String toValueXml() { // return super.ToValueXml() + Utils.objectToXml(this.getValue(), "a:Value", true); // } // } // Path: crmsdk2015/src/main/java/com/microsoft/xrm/sdk/Metadata/OptionSetMetadataBase.java import com.microsoft.xrm.sdk.BooleanManagedProperty; import com.microsoft.xrm.sdk.Label; package com.microsoft.xrm.sdk.Metadata; public abstract class OptionSetMetadataBase extends MetadataBase { private Label description; private Label displayName; private Boolean isCustomOptionSet; private Boolean isGlobal; private Boolean isManaged; private String name; private OptionSetType optionSetType;
private BooleanManagedProperty isCustomizable;
DynamicsCRM/crm-mobilesdk-library-for-android
crmsdk2015/src/main/java/com/microsoft/xrm/sdk/Messages/RecalculateRequest.java
// Path: crmsdk2015/src/main/java/com/microsoft/xrm/sdk/EntityReference.java // public class EntityReference { // // // private static final String ID = "_id"; // private static final String LOGICAL_NAME = "logical_name"; // private static final String NAME = "name"; // // @SerializedName("Id") // @Expose // private UUID Id; // // @SerializedName("LogicalName") // @Expose // private String LogicalName; // // @SerializedName("Name") // @Expose // private String Name; // // public static EntityReference build() { // return new EntityReference(); // } // // public String getLogicalName() { // return LogicalName; // } // // public String getName() { // return Name; // } // // public UUID getId() { // return Id; // } // // public EntityReference setId(UUID id) { // Id = id; // return this; // } // // public EntityReference setLogicalName(String logicalName) { // LogicalName = logicalName; // return this; // } // // public EntityReference setName(String name) { // Name = name; // return this; // } // // public EntityReference() { // // } // // public static EntityReference fromBundle(Bundle bundle) { // return EntityReference.build() // .setId(UUID.fromString(bundle.getString(ID))) // .setLogicalName(bundle.getString(LOGICAL_NAME)) // .setName(bundle.getString(NAME)); // } // // public Bundle toBundle() { // Bundle newBundle = new Bundle(); // newBundle.putString(ID, getId().toString()); // newBundle.putString(LOGICAL_NAME, getLogicalName()); // newBundle.putString(NAME, getName()); // // return newBundle; // } // // /** // * Initializes a new instance of the EntityReference class setting // * the logical name and entity ID. // * @param logicalName The logical name of the entity. // * @param id The ID of the record. // */ // public EntityReference(String logicalName, UUID id) { // this.Id = id; // this.LogicalName = logicalName; // } // // String toValueXml() { // return Utils.objectToXml(Id, "a:Id", true) + // Utils.objectToXml(LogicalName, "a:LogicalName", true) + // Utils.objectToXml(Name, "a:Name", true); // } // // static EntityReference loadFromXml(XmlPullParser parser) { // EntityReference entityReference = new EntityReference(); // // try { // String name = parser.getName(); // parser.nextTag(); // // do { // if (parser.getEventType() != XmlPullParser.START_TAG) { // parser.next(); // continue; // } // // if (parser.getName().equals("Id")) { // parser.next(); // if (parser.getEventType() == XmlPullParser.TEXT) { // entityReference.setId(UUID.fromString(parser.getText())); // } // } // else if (parser.getName().equals("LogicalName")) { // parser.next(); // if (parser.getEventType() == XmlPullParser.TEXT) { // entityReference.setLogicalName(parser.getText()); // } // } // else if (parser.getName().equals("Name")) { // parser.next(); // if (parser.getEventType() == XmlPullParser.TEXT) { // entityReference.setName(parser.getText()); // } // } // else { // Utils.skip(parser); // } // // parser.next(); // } while(!parser.getName().equals(name)); // // } // catch(Exception ex) { // ex.getCause().printStackTrace(); // } // // return entityReference; // } // }
import android.support.annotation.Nullable; import com.microsoft.xrm.sdk.EntityReference; import com.microsoft.xrm.sdk.OrganizationRequest;
package com.microsoft.xrm.sdk.Messages; public final class RecalculateRequest extends OrganizationRequest { public RecalculateRequest() { this.setResponseType(new RecalculateResponse()); this.setRequestName("Recalculate"); } @Nullable
// Path: crmsdk2015/src/main/java/com/microsoft/xrm/sdk/EntityReference.java // public class EntityReference { // // // private static final String ID = "_id"; // private static final String LOGICAL_NAME = "logical_name"; // private static final String NAME = "name"; // // @SerializedName("Id") // @Expose // private UUID Id; // // @SerializedName("LogicalName") // @Expose // private String LogicalName; // // @SerializedName("Name") // @Expose // private String Name; // // public static EntityReference build() { // return new EntityReference(); // } // // public String getLogicalName() { // return LogicalName; // } // // public String getName() { // return Name; // } // // public UUID getId() { // return Id; // } // // public EntityReference setId(UUID id) { // Id = id; // return this; // } // // public EntityReference setLogicalName(String logicalName) { // LogicalName = logicalName; // return this; // } // // public EntityReference setName(String name) { // Name = name; // return this; // } // // public EntityReference() { // // } // // public static EntityReference fromBundle(Bundle bundle) { // return EntityReference.build() // .setId(UUID.fromString(bundle.getString(ID))) // .setLogicalName(bundle.getString(LOGICAL_NAME)) // .setName(bundle.getString(NAME)); // } // // public Bundle toBundle() { // Bundle newBundle = new Bundle(); // newBundle.putString(ID, getId().toString()); // newBundle.putString(LOGICAL_NAME, getLogicalName()); // newBundle.putString(NAME, getName()); // // return newBundle; // } // // /** // * Initializes a new instance of the EntityReference class setting // * the logical name and entity ID. // * @param logicalName The logical name of the entity. // * @param id The ID of the record. // */ // public EntityReference(String logicalName, UUID id) { // this.Id = id; // this.LogicalName = logicalName; // } // // String toValueXml() { // return Utils.objectToXml(Id, "a:Id", true) + // Utils.objectToXml(LogicalName, "a:LogicalName", true) + // Utils.objectToXml(Name, "a:Name", true); // } // // static EntityReference loadFromXml(XmlPullParser parser) { // EntityReference entityReference = new EntityReference(); // // try { // String name = parser.getName(); // parser.nextTag(); // // do { // if (parser.getEventType() != XmlPullParser.START_TAG) { // parser.next(); // continue; // } // // if (parser.getName().equals("Id")) { // parser.next(); // if (parser.getEventType() == XmlPullParser.TEXT) { // entityReference.setId(UUID.fromString(parser.getText())); // } // } // else if (parser.getName().equals("LogicalName")) { // parser.next(); // if (parser.getEventType() == XmlPullParser.TEXT) { // entityReference.setLogicalName(parser.getText()); // } // } // else if (parser.getName().equals("Name")) { // parser.next(); // if (parser.getEventType() == XmlPullParser.TEXT) { // entityReference.setName(parser.getText()); // } // } // else { // Utils.skip(parser); // } // // parser.next(); // } while(!parser.getName().equals(name)); // // } // catch(Exception ex) { // ex.getCause().printStackTrace(); // } // // return entityReference; // } // } // Path: crmsdk2015/src/main/java/com/microsoft/xrm/sdk/Messages/RecalculateRequest.java import android.support.annotation.Nullable; import com.microsoft.xrm.sdk.EntityReference; import com.microsoft.xrm.sdk.OrganizationRequest; package com.microsoft.xrm.sdk.Messages; public final class RecalculateRequest extends OrganizationRequest { public RecalculateRequest() { this.setResponseType(new RecalculateResponse()); this.setRequestName("Recalculate"); } @Nullable
public EntityReference getTarget() {
DynamicsCRM/crm-mobilesdk-library-for-android
crmsdk2015/src/main/java/com/microsoft/xrm/sdk/Messages/AssignRequest.java
// Path: crmsdk2015/src/main/java/com/microsoft/xrm/sdk/EntityReference.java // public class EntityReference { // // // private static final String ID = "_id"; // private static final String LOGICAL_NAME = "logical_name"; // private static final String NAME = "name"; // // @SerializedName("Id") // @Expose // private UUID Id; // // @SerializedName("LogicalName") // @Expose // private String LogicalName; // // @SerializedName("Name") // @Expose // private String Name; // // public static EntityReference build() { // return new EntityReference(); // } // // public String getLogicalName() { // return LogicalName; // } // // public String getName() { // return Name; // } // // public UUID getId() { // return Id; // } // // public EntityReference setId(UUID id) { // Id = id; // return this; // } // // public EntityReference setLogicalName(String logicalName) { // LogicalName = logicalName; // return this; // } // // public EntityReference setName(String name) { // Name = name; // return this; // } // // public EntityReference() { // // } // // public static EntityReference fromBundle(Bundle bundle) { // return EntityReference.build() // .setId(UUID.fromString(bundle.getString(ID))) // .setLogicalName(bundle.getString(LOGICAL_NAME)) // .setName(bundle.getString(NAME)); // } // // public Bundle toBundle() { // Bundle newBundle = new Bundle(); // newBundle.putString(ID, getId().toString()); // newBundle.putString(LOGICAL_NAME, getLogicalName()); // newBundle.putString(NAME, getName()); // // return newBundle; // } // // /** // * Initializes a new instance of the EntityReference class setting // * the logical name and entity ID. // * @param logicalName The logical name of the entity. // * @param id The ID of the record. // */ // public EntityReference(String logicalName, UUID id) { // this.Id = id; // this.LogicalName = logicalName; // } // // String toValueXml() { // return Utils.objectToXml(Id, "a:Id", true) + // Utils.objectToXml(LogicalName, "a:LogicalName", true) + // Utils.objectToXml(Name, "a:Name", true); // } // // static EntityReference loadFromXml(XmlPullParser parser) { // EntityReference entityReference = new EntityReference(); // // try { // String name = parser.getName(); // parser.nextTag(); // // do { // if (parser.getEventType() != XmlPullParser.START_TAG) { // parser.next(); // continue; // } // // if (parser.getName().equals("Id")) { // parser.next(); // if (parser.getEventType() == XmlPullParser.TEXT) { // entityReference.setId(UUID.fromString(parser.getText())); // } // } // else if (parser.getName().equals("LogicalName")) { // parser.next(); // if (parser.getEventType() == XmlPullParser.TEXT) { // entityReference.setLogicalName(parser.getText()); // } // } // else if (parser.getName().equals("Name")) { // parser.next(); // if (parser.getEventType() == XmlPullParser.TEXT) { // entityReference.setName(parser.getText()); // } // } // else { // Utils.skip(parser); // } // // parser.next(); // } while(!parser.getName().equals(name)); // // } // catch(Exception ex) { // ex.getCause().printStackTrace(); // } // // return entityReference; // } // }
import android.support.annotation.Nullable; import com.microsoft.xrm.sdk.EntityReference; import com.microsoft.xrm.sdk.OrganizationRequest;
package com.microsoft.xrm.sdk.Messages; public final class AssignRequest extends OrganizationRequest { public AssignRequest() { this.setRequestName("Assign"); this.setResponseType(new AssignResponse()); } @Nullable
// Path: crmsdk2015/src/main/java/com/microsoft/xrm/sdk/EntityReference.java // public class EntityReference { // // // private static final String ID = "_id"; // private static final String LOGICAL_NAME = "logical_name"; // private static final String NAME = "name"; // // @SerializedName("Id") // @Expose // private UUID Id; // // @SerializedName("LogicalName") // @Expose // private String LogicalName; // // @SerializedName("Name") // @Expose // private String Name; // // public static EntityReference build() { // return new EntityReference(); // } // // public String getLogicalName() { // return LogicalName; // } // // public String getName() { // return Name; // } // // public UUID getId() { // return Id; // } // // public EntityReference setId(UUID id) { // Id = id; // return this; // } // // public EntityReference setLogicalName(String logicalName) { // LogicalName = logicalName; // return this; // } // // public EntityReference setName(String name) { // Name = name; // return this; // } // // public EntityReference() { // // } // // public static EntityReference fromBundle(Bundle bundle) { // return EntityReference.build() // .setId(UUID.fromString(bundle.getString(ID))) // .setLogicalName(bundle.getString(LOGICAL_NAME)) // .setName(bundle.getString(NAME)); // } // // public Bundle toBundle() { // Bundle newBundle = new Bundle(); // newBundle.putString(ID, getId().toString()); // newBundle.putString(LOGICAL_NAME, getLogicalName()); // newBundle.putString(NAME, getName()); // // return newBundle; // } // // /** // * Initializes a new instance of the EntityReference class setting // * the logical name and entity ID. // * @param logicalName The logical name of the entity. // * @param id The ID of the record. // */ // public EntityReference(String logicalName, UUID id) { // this.Id = id; // this.LogicalName = logicalName; // } // // String toValueXml() { // return Utils.objectToXml(Id, "a:Id", true) + // Utils.objectToXml(LogicalName, "a:LogicalName", true) + // Utils.objectToXml(Name, "a:Name", true); // } // // static EntityReference loadFromXml(XmlPullParser parser) { // EntityReference entityReference = new EntityReference(); // // try { // String name = parser.getName(); // parser.nextTag(); // // do { // if (parser.getEventType() != XmlPullParser.START_TAG) { // parser.next(); // continue; // } // // if (parser.getName().equals("Id")) { // parser.next(); // if (parser.getEventType() == XmlPullParser.TEXT) { // entityReference.setId(UUID.fromString(parser.getText())); // } // } // else if (parser.getName().equals("LogicalName")) { // parser.next(); // if (parser.getEventType() == XmlPullParser.TEXT) { // entityReference.setLogicalName(parser.getText()); // } // } // else if (parser.getName().equals("Name")) { // parser.next(); // if (parser.getEventType() == XmlPullParser.TEXT) { // entityReference.setName(parser.getText()); // } // } // else { // Utils.skip(parser); // } // // parser.next(); // } while(!parser.getName().equals(name)); // // } // catch(Exception ex) { // ex.getCause().printStackTrace(); // } // // return entityReference; // } // } // Path: crmsdk2015/src/main/java/com/microsoft/xrm/sdk/Messages/AssignRequest.java import android.support.annotation.Nullable; import com.microsoft.xrm.sdk.EntityReference; import com.microsoft.xrm.sdk.OrganizationRequest; package com.microsoft.xrm.sdk.Messages; public final class AssignRequest extends OrganizationRequest { public AssignRequest() { this.setRequestName("Assign"); this.setResponseType(new AssignResponse()); } @Nullable
public EntityReference getAssignee() {
DynamicsCRM/crm-mobilesdk-library-for-android
crmsdk2015/src/main/java/com/microsoft/xrm/sdk/Messages/DisassociateEntitiesRequest.java
// Path: crmsdk2015/src/main/java/com/microsoft/xrm/sdk/EntityReference.java // public class EntityReference { // // // private static final String ID = "_id"; // private static final String LOGICAL_NAME = "logical_name"; // private static final String NAME = "name"; // // @SerializedName("Id") // @Expose // private UUID Id; // // @SerializedName("LogicalName") // @Expose // private String LogicalName; // // @SerializedName("Name") // @Expose // private String Name; // // public static EntityReference build() { // return new EntityReference(); // } // // public String getLogicalName() { // return LogicalName; // } // // public String getName() { // return Name; // } // // public UUID getId() { // return Id; // } // // public EntityReference setId(UUID id) { // Id = id; // return this; // } // // public EntityReference setLogicalName(String logicalName) { // LogicalName = logicalName; // return this; // } // // public EntityReference setName(String name) { // Name = name; // return this; // } // // public EntityReference() { // // } // // public static EntityReference fromBundle(Bundle bundle) { // return EntityReference.build() // .setId(UUID.fromString(bundle.getString(ID))) // .setLogicalName(bundle.getString(LOGICAL_NAME)) // .setName(bundle.getString(NAME)); // } // // public Bundle toBundle() { // Bundle newBundle = new Bundle(); // newBundle.putString(ID, getId().toString()); // newBundle.putString(LOGICAL_NAME, getLogicalName()); // newBundle.putString(NAME, getName()); // // return newBundle; // } // // /** // * Initializes a new instance of the EntityReference class setting // * the logical name and entity ID. // * @param logicalName The logical name of the entity. // * @param id The ID of the record. // */ // public EntityReference(String logicalName, UUID id) { // this.Id = id; // this.LogicalName = logicalName; // } // // String toValueXml() { // return Utils.objectToXml(Id, "a:Id", true) + // Utils.objectToXml(LogicalName, "a:LogicalName", true) + // Utils.objectToXml(Name, "a:Name", true); // } // // static EntityReference loadFromXml(XmlPullParser parser) { // EntityReference entityReference = new EntityReference(); // // try { // String name = parser.getName(); // parser.nextTag(); // // do { // if (parser.getEventType() != XmlPullParser.START_TAG) { // parser.next(); // continue; // } // // if (parser.getName().equals("Id")) { // parser.next(); // if (parser.getEventType() == XmlPullParser.TEXT) { // entityReference.setId(UUID.fromString(parser.getText())); // } // } // else if (parser.getName().equals("LogicalName")) { // parser.next(); // if (parser.getEventType() == XmlPullParser.TEXT) { // entityReference.setLogicalName(parser.getText()); // } // } // else if (parser.getName().equals("Name")) { // parser.next(); // if (parser.getEventType() == XmlPullParser.TEXT) { // entityReference.setName(parser.getText()); // } // } // else { // Utils.skip(parser); // } // // parser.next(); // } while(!parser.getName().equals(name)); // // } // catch(Exception ex) { // ex.getCause().printStackTrace(); // } // // return entityReference; // } // }
import android.support.annotation.Nullable; import com.microsoft.xrm.sdk.EntityReference; import com.microsoft.xrm.sdk.OrganizationRequest;
package com.microsoft.xrm.sdk.Messages; public final class DisassociateEntitiesRequest extends OrganizationRequest { public DisassociateEntitiesRequest() { this.setRequestName("DisassociateEntities"); this.setResponseType(new DisassociateEntitiesResponse()); } @Nullable
// Path: crmsdk2015/src/main/java/com/microsoft/xrm/sdk/EntityReference.java // public class EntityReference { // // // private static final String ID = "_id"; // private static final String LOGICAL_NAME = "logical_name"; // private static final String NAME = "name"; // // @SerializedName("Id") // @Expose // private UUID Id; // // @SerializedName("LogicalName") // @Expose // private String LogicalName; // // @SerializedName("Name") // @Expose // private String Name; // // public static EntityReference build() { // return new EntityReference(); // } // // public String getLogicalName() { // return LogicalName; // } // // public String getName() { // return Name; // } // // public UUID getId() { // return Id; // } // // public EntityReference setId(UUID id) { // Id = id; // return this; // } // // public EntityReference setLogicalName(String logicalName) { // LogicalName = logicalName; // return this; // } // // public EntityReference setName(String name) { // Name = name; // return this; // } // // public EntityReference() { // // } // // public static EntityReference fromBundle(Bundle bundle) { // return EntityReference.build() // .setId(UUID.fromString(bundle.getString(ID))) // .setLogicalName(bundle.getString(LOGICAL_NAME)) // .setName(bundle.getString(NAME)); // } // // public Bundle toBundle() { // Bundle newBundle = new Bundle(); // newBundle.putString(ID, getId().toString()); // newBundle.putString(LOGICAL_NAME, getLogicalName()); // newBundle.putString(NAME, getName()); // // return newBundle; // } // // /** // * Initializes a new instance of the EntityReference class setting // * the logical name and entity ID. // * @param logicalName The logical name of the entity. // * @param id The ID of the record. // */ // public EntityReference(String logicalName, UUID id) { // this.Id = id; // this.LogicalName = logicalName; // } // // String toValueXml() { // return Utils.objectToXml(Id, "a:Id", true) + // Utils.objectToXml(LogicalName, "a:LogicalName", true) + // Utils.objectToXml(Name, "a:Name", true); // } // // static EntityReference loadFromXml(XmlPullParser parser) { // EntityReference entityReference = new EntityReference(); // // try { // String name = parser.getName(); // parser.nextTag(); // // do { // if (parser.getEventType() != XmlPullParser.START_TAG) { // parser.next(); // continue; // } // // if (parser.getName().equals("Id")) { // parser.next(); // if (parser.getEventType() == XmlPullParser.TEXT) { // entityReference.setId(UUID.fromString(parser.getText())); // } // } // else if (parser.getName().equals("LogicalName")) { // parser.next(); // if (parser.getEventType() == XmlPullParser.TEXT) { // entityReference.setLogicalName(parser.getText()); // } // } // else if (parser.getName().equals("Name")) { // parser.next(); // if (parser.getEventType() == XmlPullParser.TEXT) { // entityReference.setName(parser.getText()); // } // } // else { // Utils.skip(parser); // } // // parser.next(); // } while(!parser.getName().equals(name)); // // } // catch(Exception ex) { // ex.getCause().printStackTrace(); // } // // return entityReference; // } // } // Path: crmsdk2015/src/main/java/com/microsoft/xrm/sdk/Messages/DisassociateEntitiesRequest.java import android.support.annotation.Nullable; import com.microsoft.xrm.sdk.EntityReference; import com.microsoft.xrm.sdk.OrganizationRequest; package com.microsoft.xrm.sdk.Messages; public final class DisassociateEntitiesRequest extends OrganizationRequest { public DisassociateEntitiesRequest() { this.setRequestName("DisassociateEntities"); this.setResponseType(new DisassociateEntitiesResponse()); } @Nullable
public EntityReference getMoniker1() {
DynamicsCRM/crm-mobilesdk-library-for-android
crmsdk2015/src/main/java/com/microsoft/xrm/sdk/Messages/BackgroundSendEmailRequest.java
// Path: crmsdk2015/src/main/java/com/microsoft/xrm/sdk/Query/QueryBase.java // public abstract class QueryBase { // // // }
import android.support.annotation.Nullable; import com.microsoft.xrm.sdk.OrganizationRequest; import com.microsoft.xrm.sdk.Query.QueryBase;
package com.microsoft.xrm.sdk.Messages; public final class BackgroundSendEmailRequest extends OrganizationRequest { public BackgroundSendEmailRequest() { this.setResponseType(new BackgroundSendEmailResponse()); this.setRequestName("BackgroundSendEmail"); } @Nullable
// Path: crmsdk2015/src/main/java/com/microsoft/xrm/sdk/Query/QueryBase.java // public abstract class QueryBase { // // // } // Path: crmsdk2015/src/main/java/com/microsoft/xrm/sdk/Messages/BackgroundSendEmailRequest.java import android.support.annotation.Nullable; import com.microsoft.xrm.sdk.OrganizationRequest; import com.microsoft.xrm.sdk.Query.QueryBase; package com.microsoft.xrm.sdk.Messages; public final class BackgroundSendEmailRequest extends OrganizationRequest { public BackgroundSendEmailRequest() { this.setResponseType(new BackgroundSendEmailResponse()); this.setRequestName("BackgroundSendEmail"); } @Nullable
public QueryBase getQuery() {
DynamicsCRM/crm-mobilesdk-library-for-android
crmsdk2015/src/main/java/com/microsoft/xrm/sdk/Messages/RemoveRelatedRequest.java
// Path: crmsdk2015/src/main/java/com/microsoft/xrm/sdk/EntityReference.java // public class EntityReference { // // // private static final String ID = "_id"; // private static final String LOGICAL_NAME = "logical_name"; // private static final String NAME = "name"; // // @SerializedName("Id") // @Expose // private UUID Id; // // @SerializedName("LogicalName") // @Expose // private String LogicalName; // // @SerializedName("Name") // @Expose // private String Name; // // public static EntityReference build() { // return new EntityReference(); // } // // public String getLogicalName() { // return LogicalName; // } // // public String getName() { // return Name; // } // // public UUID getId() { // return Id; // } // // public EntityReference setId(UUID id) { // Id = id; // return this; // } // // public EntityReference setLogicalName(String logicalName) { // LogicalName = logicalName; // return this; // } // // public EntityReference setName(String name) { // Name = name; // return this; // } // // public EntityReference() { // // } // // public static EntityReference fromBundle(Bundle bundle) { // return EntityReference.build() // .setId(UUID.fromString(bundle.getString(ID))) // .setLogicalName(bundle.getString(LOGICAL_NAME)) // .setName(bundle.getString(NAME)); // } // // public Bundle toBundle() { // Bundle newBundle = new Bundle(); // newBundle.putString(ID, getId().toString()); // newBundle.putString(LOGICAL_NAME, getLogicalName()); // newBundle.putString(NAME, getName()); // // return newBundle; // } // // /** // * Initializes a new instance of the EntityReference class setting // * the logical name and entity ID. // * @param logicalName The logical name of the entity. // * @param id The ID of the record. // */ // public EntityReference(String logicalName, UUID id) { // this.Id = id; // this.LogicalName = logicalName; // } // // String toValueXml() { // return Utils.objectToXml(Id, "a:Id", true) + // Utils.objectToXml(LogicalName, "a:LogicalName", true) + // Utils.objectToXml(Name, "a:Name", true); // } // // static EntityReference loadFromXml(XmlPullParser parser) { // EntityReference entityReference = new EntityReference(); // // try { // String name = parser.getName(); // parser.nextTag(); // // do { // if (parser.getEventType() != XmlPullParser.START_TAG) { // parser.next(); // continue; // } // // if (parser.getName().equals("Id")) { // parser.next(); // if (parser.getEventType() == XmlPullParser.TEXT) { // entityReference.setId(UUID.fromString(parser.getText())); // } // } // else if (parser.getName().equals("LogicalName")) { // parser.next(); // if (parser.getEventType() == XmlPullParser.TEXT) { // entityReference.setLogicalName(parser.getText()); // } // } // else if (parser.getName().equals("Name")) { // parser.next(); // if (parser.getEventType() == XmlPullParser.TEXT) { // entityReference.setName(parser.getText()); // } // } // else { // Utils.skip(parser); // } // // parser.next(); // } while(!parser.getName().equals(name)); // // } // catch(Exception ex) { // ex.getCause().printStackTrace(); // } // // return entityReference; // } // }
import android.support.annotation.Nullable; import com.microsoft.xrm.sdk.EntityReference; import com.microsoft.xrm.sdk.OrganizationRequest;
package com.microsoft.xrm.sdk.Messages; public final class RemoveRelatedRequest extends OrganizationRequest { public RemoveRelatedRequest() { this.setResponseType(new RemoveRelatedResponse()); this.setRequestName("RemoveRelated"); } @Nullable
// Path: crmsdk2015/src/main/java/com/microsoft/xrm/sdk/EntityReference.java // public class EntityReference { // // // private static final String ID = "_id"; // private static final String LOGICAL_NAME = "logical_name"; // private static final String NAME = "name"; // // @SerializedName("Id") // @Expose // private UUID Id; // // @SerializedName("LogicalName") // @Expose // private String LogicalName; // // @SerializedName("Name") // @Expose // private String Name; // // public static EntityReference build() { // return new EntityReference(); // } // // public String getLogicalName() { // return LogicalName; // } // // public String getName() { // return Name; // } // // public UUID getId() { // return Id; // } // // public EntityReference setId(UUID id) { // Id = id; // return this; // } // // public EntityReference setLogicalName(String logicalName) { // LogicalName = logicalName; // return this; // } // // public EntityReference setName(String name) { // Name = name; // return this; // } // // public EntityReference() { // // } // // public static EntityReference fromBundle(Bundle bundle) { // return EntityReference.build() // .setId(UUID.fromString(bundle.getString(ID))) // .setLogicalName(bundle.getString(LOGICAL_NAME)) // .setName(bundle.getString(NAME)); // } // // public Bundle toBundle() { // Bundle newBundle = new Bundle(); // newBundle.putString(ID, getId().toString()); // newBundle.putString(LOGICAL_NAME, getLogicalName()); // newBundle.putString(NAME, getName()); // // return newBundle; // } // // /** // * Initializes a new instance of the EntityReference class setting // * the logical name and entity ID. // * @param logicalName The logical name of the entity. // * @param id The ID of the record. // */ // public EntityReference(String logicalName, UUID id) { // this.Id = id; // this.LogicalName = logicalName; // } // // String toValueXml() { // return Utils.objectToXml(Id, "a:Id", true) + // Utils.objectToXml(LogicalName, "a:LogicalName", true) + // Utils.objectToXml(Name, "a:Name", true); // } // // static EntityReference loadFromXml(XmlPullParser parser) { // EntityReference entityReference = new EntityReference(); // // try { // String name = parser.getName(); // parser.nextTag(); // // do { // if (parser.getEventType() != XmlPullParser.START_TAG) { // parser.next(); // continue; // } // // if (parser.getName().equals("Id")) { // parser.next(); // if (parser.getEventType() == XmlPullParser.TEXT) { // entityReference.setId(UUID.fromString(parser.getText())); // } // } // else if (parser.getName().equals("LogicalName")) { // parser.next(); // if (parser.getEventType() == XmlPullParser.TEXT) { // entityReference.setLogicalName(parser.getText()); // } // } // else if (parser.getName().equals("Name")) { // parser.next(); // if (parser.getEventType() == XmlPullParser.TEXT) { // entityReference.setName(parser.getText()); // } // } // else { // Utils.skip(parser); // } // // parser.next(); // } while(!parser.getName().equals(name)); // // } // catch(Exception ex) { // ex.getCause().printStackTrace(); // } // // return entityReference; // } // } // Path: crmsdk2015/src/main/java/com/microsoft/xrm/sdk/Messages/RemoveRelatedRequest.java import android.support.annotation.Nullable; import com.microsoft.xrm.sdk.EntityReference; import com.microsoft.xrm.sdk.OrganizationRequest; package com.microsoft.xrm.sdk.Messages; public final class RemoveRelatedRequest extends OrganizationRequest { public RemoveRelatedRequest() { this.setResponseType(new RemoveRelatedResponse()); this.setRequestName("RemoveRelated"); } @Nullable
public EntityReference[] getTarget() {
DynamicsCRM/crm-mobilesdk-library-for-android
crmsdk2015/src/main/java/com/microsoft/xrm/sdk/Utils.java
// Path: crmsdk2015/src/main/java/com/microsoft/xrm/sdk/Query/FetchExpression.java // public final class FetchExpression extends QueryBase { // private String query; // // public FetchExpression(String query) { // this.query = query; // } // // public String getQuery() { // return this.query; // } // // public void setQuery(String value) { // this.query = value; // } // // public String toValueXml() { // return Utils.objectToXml(query, "a:Query", true); // } // // }
import android.text.Html; import android.util.Base64; import com.google.gson.Gson; import com.google.gson.internal.LinkedTreeMap; import com.microsoft.xrm.sdk.Query.FetchExpression; import org.xmlpull.v1.XmlPullParser; import org.xmlpull.v1.XmlPullParserException; import java.io.IOException; import java.lang.reflect.Array; import java.lang.reflect.Method; import java.math.BigDecimal; import java.text.SimpleDateFormat; import java.util.Calendar; import java.util.Date; import java.util.HashMap; import java.util.UUID;
case "ColumnSet": type = "a:ColumnSet"; value = ((ColumnSet)item).toValueXml(); break; case "Entity": type = "a:Entity"; value = ((Entity)item).toValueXml(); break; case "EntityCollection": type = "a:EntityCollection"; value = ((EntityCollection)item).toValueXml(); break; case "EntityReference": type = "a:EntityReference"; value = ((EntityReference)item).toValueXml(); break; case "EntityReferenceCollection": type = "a:EntityReferenceCollection"; if (((EntityReferenceCollection)item).size() == 0) { if (action.equals("b:value")) { return String.format("<%s i:type='%s' />", action, type); } else { return String.format("<%s />", action); } } else { value = ((EntityReferenceCollection) item).toValueXml(); } break;
// Path: crmsdk2015/src/main/java/com/microsoft/xrm/sdk/Query/FetchExpression.java // public final class FetchExpression extends QueryBase { // private String query; // // public FetchExpression(String query) { // this.query = query; // } // // public String getQuery() { // return this.query; // } // // public void setQuery(String value) { // this.query = value; // } // // public String toValueXml() { // return Utils.objectToXml(query, "a:Query", true); // } // // } // Path: crmsdk2015/src/main/java/com/microsoft/xrm/sdk/Utils.java import android.text.Html; import android.util.Base64; import com.google.gson.Gson; import com.google.gson.internal.LinkedTreeMap; import com.microsoft.xrm.sdk.Query.FetchExpression; import org.xmlpull.v1.XmlPullParser; import org.xmlpull.v1.XmlPullParserException; import java.io.IOException; import java.lang.reflect.Array; import java.lang.reflect.Method; import java.math.BigDecimal; import java.text.SimpleDateFormat; import java.util.Calendar; import java.util.Date; import java.util.HashMap; import java.util.UUID; case "ColumnSet": type = "a:ColumnSet"; value = ((ColumnSet)item).toValueXml(); break; case "Entity": type = "a:Entity"; value = ((Entity)item).toValueXml(); break; case "EntityCollection": type = "a:EntityCollection"; value = ((EntityCollection)item).toValueXml(); break; case "EntityReference": type = "a:EntityReference"; value = ((EntityReference)item).toValueXml(); break; case "EntityReferenceCollection": type = "a:EntityReferenceCollection"; if (((EntityReferenceCollection)item).size() == 0) { if (action.equals("b:value")) { return String.format("<%s i:type='%s' />", action, type); } else { return String.format("<%s />", action); } } else { value = ((EntityReferenceCollection) item).toValueXml(); } break;
case "FetchExpression":
DynamicsCRM/crm-mobilesdk-library-for-android
crmsdk2015/src/main/java/com/microsoft/xrm/sdk/Metadata/RelationshipMetadataBase.java
// Path: crmsdk2015/src/main/java/com/microsoft/xrm/sdk/BooleanManagedProperty.java // public class BooleanManagedProperty extends ManagedProperty<Boolean> { // // public BooleanManagedProperty() { // this(false); // } // // public BooleanManagedProperty(boolean value) { // this(value, null); // } // // BooleanManagedProperty(boolean value, String logicalName) { // super(logicalName); // this.setValue(value); // } // // protected String toValueXml() { // return super.ToValueXml() + Utils.objectToXml(this.getValue(), "a:Value", true); // } // }
import com.microsoft.xrm.sdk.BooleanManagedProperty;
package com.microsoft.xrm.sdk.Metadata; public abstract class RelationshipMetadataBase extends MetadataBase { private Boolean isCustomRelationship; private Boolean isValidForAdvancedFind; private String schemaName; private SecurityTypes securityTypes; private Boolean isManaged;
// Path: crmsdk2015/src/main/java/com/microsoft/xrm/sdk/BooleanManagedProperty.java // public class BooleanManagedProperty extends ManagedProperty<Boolean> { // // public BooleanManagedProperty() { // this(false); // } // // public BooleanManagedProperty(boolean value) { // this(value, null); // } // // BooleanManagedProperty(boolean value, String logicalName) { // super(logicalName); // this.setValue(value); // } // // protected String toValueXml() { // return super.ToValueXml() + Utils.objectToXml(this.getValue(), "a:Value", true); // } // } // Path: crmsdk2015/src/main/java/com/microsoft/xrm/sdk/Metadata/RelationshipMetadataBase.java import com.microsoft.xrm.sdk.BooleanManagedProperty; package com.microsoft.xrm.sdk.Metadata; public abstract class RelationshipMetadataBase extends MetadataBase { private Boolean isCustomRelationship; private Boolean isValidForAdvancedFind; private String schemaName; private SecurityTypes securityTypes; private Boolean isManaged;
private BooleanManagedProperty isCustomizable;
jacobtabak/droidcon
app/src/main/java/com/timehop/droidcon2014retrofitsample/data/reddit/RedditType.java
// Path: app/src/main/java/com/timehop/droidcon2014retrofitsample/data/reddit/model/RedditComment.java // public class RedditComment extends RedditSubmission { // RedditObject replies; // String subreddit_id; // String parent_id; // int controversiality; // String body; // String body_html; // String link_id; // int depth; // // public RedditObject getReplies() { // return replies; // } // // public String getSubredditId() { // return subreddit_id; // } // // public String getParentId() { // return parent_id; // } // // public int getControversiality() { // return controversiality; // } // // public String getBody() { // return body; // } // // public String getBodyHtml() { // return body_html; // } // // public String getLinkId() { // return link_id; // } // // public int getDepth() { // return depth; // } // // public void setDepth(int depth) { // this.depth = depth; // } // } // // Path: app/src/main/java/com/timehop/droidcon2014retrofitsample/data/reddit/model/RedditLink.java // public class RedditLink extends RedditSubmission { // private String domain; // private String selftext_html; // private String selftext; // private String link_flair_text; // private boolean clicked; // private boolean hidden; // private String thumbnail; // private boolean is_self; // private String permalink; // private boolean stickied; // private String url; // private String title; // private int num_comments; // private boolean visited; // // public String getDomain() { // return domain; // } // // public String getSelftextHtml() { // return selftext_html; // } // // public String getSelftext() { // return selftext; // } // // public String getLinkFlairText() { // return link_flair_text; // } // // public boolean isClicked() { // return clicked; // } // // public boolean isHidden() { // return hidden; // } // // public String getThumbnail() { // return thumbnail; // } // // public String getSubreddit() { // return subreddit; // } // // public boolean isSelf() { // return is_self; // } // // public String getPermalink() { // return permalink; // } // // public boolean isStickied() { // return stickied; // } // // public String getUrl() { // return url; // } // // public String getTitle() { // return title; // } // // public int getNumComments() { // return num_comments; // } // // public boolean isVisited() { // return visited; // } // } // // Path: app/src/main/java/com/timehop/droidcon2014retrofitsample/data/reddit/model/RedditListing.java // public class RedditListing extends RedditObject { // String modhash; // String after; // String before; // List<RedditObject> children; // // public String getModhash() { // return modhash; // } // // public String getAfter() { // return after; // } // // public String getBefore() { // return before; // } // // public List<RedditObject> getChildren() { // return children; // } // } // // Path: app/src/main/java/com/timehop/droidcon2014retrofitsample/data/reddit/model/RedditMore.java // public class RedditMore extends RedditObject { // int count; // String parent_id; // String id; // String name; // List<String> children; // // public int getCount() { // return count; // } // // public String getParentId() { // return parent_id; // } // // public String getId() { // return id; // } // // public String getName() { // return name; // } // // public List<String> getChildren() { // return children; // } // }
import com.timehop.droidcon2014retrofitsample.data.reddit.model.RedditComment; import com.timehop.droidcon2014retrofitsample.data.reddit.model.RedditLink; import com.timehop.droidcon2014retrofitsample.data.reddit.model.RedditListing; import com.timehop.droidcon2014retrofitsample.data.reddit.model.RedditMore;
package com.timehop.droidcon2014retrofitsample.data.reddit; public enum RedditType { t1(RedditComment.class),
// Path: app/src/main/java/com/timehop/droidcon2014retrofitsample/data/reddit/model/RedditComment.java // public class RedditComment extends RedditSubmission { // RedditObject replies; // String subreddit_id; // String parent_id; // int controversiality; // String body; // String body_html; // String link_id; // int depth; // // public RedditObject getReplies() { // return replies; // } // // public String getSubredditId() { // return subreddit_id; // } // // public String getParentId() { // return parent_id; // } // // public int getControversiality() { // return controversiality; // } // // public String getBody() { // return body; // } // // public String getBodyHtml() { // return body_html; // } // // public String getLinkId() { // return link_id; // } // // public int getDepth() { // return depth; // } // // public void setDepth(int depth) { // this.depth = depth; // } // } // // Path: app/src/main/java/com/timehop/droidcon2014retrofitsample/data/reddit/model/RedditLink.java // public class RedditLink extends RedditSubmission { // private String domain; // private String selftext_html; // private String selftext; // private String link_flair_text; // private boolean clicked; // private boolean hidden; // private String thumbnail; // private boolean is_self; // private String permalink; // private boolean stickied; // private String url; // private String title; // private int num_comments; // private boolean visited; // // public String getDomain() { // return domain; // } // // public String getSelftextHtml() { // return selftext_html; // } // // public String getSelftext() { // return selftext; // } // // public String getLinkFlairText() { // return link_flair_text; // } // // public boolean isClicked() { // return clicked; // } // // public boolean isHidden() { // return hidden; // } // // public String getThumbnail() { // return thumbnail; // } // // public String getSubreddit() { // return subreddit; // } // // public boolean isSelf() { // return is_self; // } // // public String getPermalink() { // return permalink; // } // // public boolean isStickied() { // return stickied; // } // // public String getUrl() { // return url; // } // // public String getTitle() { // return title; // } // // public int getNumComments() { // return num_comments; // } // // public boolean isVisited() { // return visited; // } // } // // Path: app/src/main/java/com/timehop/droidcon2014retrofitsample/data/reddit/model/RedditListing.java // public class RedditListing extends RedditObject { // String modhash; // String after; // String before; // List<RedditObject> children; // // public String getModhash() { // return modhash; // } // // public String getAfter() { // return after; // } // // public String getBefore() { // return before; // } // // public List<RedditObject> getChildren() { // return children; // } // } // // Path: app/src/main/java/com/timehop/droidcon2014retrofitsample/data/reddit/model/RedditMore.java // public class RedditMore extends RedditObject { // int count; // String parent_id; // String id; // String name; // List<String> children; // // public int getCount() { // return count; // } // // public String getParentId() { // return parent_id; // } // // public String getId() { // return id; // } // // public String getName() { // return name; // } // // public List<String> getChildren() { // return children; // } // } // Path: app/src/main/java/com/timehop/droidcon2014retrofitsample/data/reddit/RedditType.java import com.timehop.droidcon2014retrofitsample.data.reddit.model.RedditComment; import com.timehop.droidcon2014retrofitsample.data.reddit.model.RedditLink; import com.timehop.droidcon2014retrofitsample.data.reddit.model.RedditListing; import com.timehop.droidcon2014retrofitsample.data.reddit.model.RedditMore; package com.timehop.droidcon2014retrofitsample.data.reddit; public enum RedditType { t1(RedditComment.class),
t3(RedditLink.class),
jacobtabak/droidcon
app/src/main/java/com/timehop/droidcon2014retrofitsample/data/reddit/RedditType.java
// Path: app/src/main/java/com/timehop/droidcon2014retrofitsample/data/reddit/model/RedditComment.java // public class RedditComment extends RedditSubmission { // RedditObject replies; // String subreddit_id; // String parent_id; // int controversiality; // String body; // String body_html; // String link_id; // int depth; // // public RedditObject getReplies() { // return replies; // } // // public String getSubredditId() { // return subreddit_id; // } // // public String getParentId() { // return parent_id; // } // // public int getControversiality() { // return controversiality; // } // // public String getBody() { // return body; // } // // public String getBodyHtml() { // return body_html; // } // // public String getLinkId() { // return link_id; // } // // public int getDepth() { // return depth; // } // // public void setDepth(int depth) { // this.depth = depth; // } // } // // Path: app/src/main/java/com/timehop/droidcon2014retrofitsample/data/reddit/model/RedditLink.java // public class RedditLink extends RedditSubmission { // private String domain; // private String selftext_html; // private String selftext; // private String link_flair_text; // private boolean clicked; // private boolean hidden; // private String thumbnail; // private boolean is_self; // private String permalink; // private boolean stickied; // private String url; // private String title; // private int num_comments; // private boolean visited; // // public String getDomain() { // return domain; // } // // public String getSelftextHtml() { // return selftext_html; // } // // public String getSelftext() { // return selftext; // } // // public String getLinkFlairText() { // return link_flair_text; // } // // public boolean isClicked() { // return clicked; // } // // public boolean isHidden() { // return hidden; // } // // public String getThumbnail() { // return thumbnail; // } // // public String getSubreddit() { // return subreddit; // } // // public boolean isSelf() { // return is_self; // } // // public String getPermalink() { // return permalink; // } // // public boolean isStickied() { // return stickied; // } // // public String getUrl() { // return url; // } // // public String getTitle() { // return title; // } // // public int getNumComments() { // return num_comments; // } // // public boolean isVisited() { // return visited; // } // } // // Path: app/src/main/java/com/timehop/droidcon2014retrofitsample/data/reddit/model/RedditListing.java // public class RedditListing extends RedditObject { // String modhash; // String after; // String before; // List<RedditObject> children; // // public String getModhash() { // return modhash; // } // // public String getAfter() { // return after; // } // // public String getBefore() { // return before; // } // // public List<RedditObject> getChildren() { // return children; // } // } // // Path: app/src/main/java/com/timehop/droidcon2014retrofitsample/data/reddit/model/RedditMore.java // public class RedditMore extends RedditObject { // int count; // String parent_id; // String id; // String name; // List<String> children; // // public int getCount() { // return count; // } // // public String getParentId() { // return parent_id; // } // // public String getId() { // return id; // } // // public String getName() { // return name; // } // // public List<String> getChildren() { // return children; // } // }
import com.timehop.droidcon2014retrofitsample.data.reddit.model.RedditComment; import com.timehop.droidcon2014retrofitsample.data.reddit.model.RedditLink; import com.timehop.droidcon2014retrofitsample.data.reddit.model.RedditListing; import com.timehop.droidcon2014retrofitsample.data.reddit.model.RedditMore;
package com.timehop.droidcon2014retrofitsample.data.reddit; public enum RedditType { t1(RedditComment.class), t3(RedditLink.class),
// Path: app/src/main/java/com/timehop/droidcon2014retrofitsample/data/reddit/model/RedditComment.java // public class RedditComment extends RedditSubmission { // RedditObject replies; // String subreddit_id; // String parent_id; // int controversiality; // String body; // String body_html; // String link_id; // int depth; // // public RedditObject getReplies() { // return replies; // } // // public String getSubredditId() { // return subreddit_id; // } // // public String getParentId() { // return parent_id; // } // // public int getControversiality() { // return controversiality; // } // // public String getBody() { // return body; // } // // public String getBodyHtml() { // return body_html; // } // // public String getLinkId() { // return link_id; // } // // public int getDepth() { // return depth; // } // // public void setDepth(int depth) { // this.depth = depth; // } // } // // Path: app/src/main/java/com/timehop/droidcon2014retrofitsample/data/reddit/model/RedditLink.java // public class RedditLink extends RedditSubmission { // private String domain; // private String selftext_html; // private String selftext; // private String link_flair_text; // private boolean clicked; // private boolean hidden; // private String thumbnail; // private boolean is_self; // private String permalink; // private boolean stickied; // private String url; // private String title; // private int num_comments; // private boolean visited; // // public String getDomain() { // return domain; // } // // public String getSelftextHtml() { // return selftext_html; // } // // public String getSelftext() { // return selftext; // } // // public String getLinkFlairText() { // return link_flair_text; // } // // public boolean isClicked() { // return clicked; // } // // public boolean isHidden() { // return hidden; // } // // public String getThumbnail() { // return thumbnail; // } // // public String getSubreddit() { // return subreddit; // } // // public boolean isSelf() { // return is_self; // } // // public String getPermalink() { // return permalink; // } // // public boolean isStickied() { // return stickied; // } // // public String getUrl() { // return url; // } // // public String getTitle() { // return title; // } // // public int getNumComments() { // return num_comments; // } // // public boolean isVisited() { // return visited; // } // } // // Path: app/src/main/java/com/timehop/droidcon2014retrofitsample/data/reddit/model/RedditListing.java // public class RedditListing extends RedditObject { // String modhash; // String after; // String before; // List<RedditObject> children; // // public String getModhash() { // return modhash; // } // // public String getAfter() { // return after; // } // // public String getBefore() { // return before; // } // // public List<RedditObject> getChildren() { // return children; // } // } // // Path: app/src/main/java/com/timehop/droidcon2014retrofitsample/data/reddit/model/RedditMore.java // public class RedditMore extends RedditObject { // int count; // String parent_id; // String id; // String name; // List<String> children; // // public int getCount() { // return count; // } // // public String getParentId() { // return parent_id; // } // // public String getId() { // return id; // } // // public String getName() { // return name; // } // // public List<String> getChildren() { // return children; // } // } // Path: app/src/main/java/com/timehop/droidcon2014retrofitsample/data/reddit/RedditType.java import com.timehop.droidcon2014retrofitsample.data.reddit.model.RedditComment; import com.timehop.droidcon2014retrofitsample.data.reddit.model.RedditLink; import com.timehop.droidcon2014retrofitsample.data.reddit.model.RedditListing; import com.timehop.droidcon2014retrofitsample.data.reddit.model.RedditMore; package com.timehop.droidcon2014retrofitsample.data.reddit; public enum RedditType { t1(RedditComment.class), t3(RedditLink.class),
Listing(RedditListing.class),
jacobtabak/droidcon
app/src/main/java/com/timehop/droidcon2014retrofitsample/data/reddit/RedditType.java
// Path: app/src/main/java/com/timehop/droidcon2014retrofitsample/data/reddit/model/RedditComment.java // public class RedditComment extends RedditSubmission { // RedditObject replies; // String subreddit_id; // String parent_id; // int controversiality; // String body; // String body_html; // String link_id; // int depth; // // public RedditObject getReplies() { // return replies; // } // // public String getSubredditId() { // return subreddit_id; // } // // public String getParentId() { // return parent_id; // } // // public int getControversiality() { // return controversiality; // } // // public String getBody() { // return body; // } // // public String getBodyHtml() { // return body_html; // } // // public String getLinkId() { // return link_id; // } // // public int getDepth() { // return depth; // } // // public void setDepth(int depth) { // this.depth = depth; // } // } // // Path: app/src/main/java/com/timehop/droidcon2014retrofitsample/data/reddit/model/RedditLink.java // public class RedditLink extends RedditSubmission { // private String domain; // private String selftext_html; // private String selftext; // private String link_flair_text; // private boolean clicked; // private boolean hidden; // private String thumbnail; // private boolean is_self; // private String permalink; // private boolean stickied; // private String url; // private String title; // private int num_comments; // private boolean visited; // // public String getDomain() { // return domain; // } // // public String getSelftextHtml() { // return selftext_html; // } // // public String getSelftext() { // return selftext; // } // // public String getLinkFlairText() { // return link_flair_text; // } // // public boolean isClicked() { // return clicked; // } // // public boolean isHidden() { // return hidden; // } // // public String getThumbnail() { // return thumbnail; // } // // public String getSubreddit() { // return subreddit; // } // // public boolean isSelf() { // return is_self; // } // // public String getPermalink() { // return permalink; // } // // public boolean isStickied() { // return stickied; // } // // public String getUrl() { // return url; // } // // public String getTitle() { // return title; // } // // public int getNumComments() { // return num_comments; // } // // public boolean isVisited() { // return visited; // } // } // // Path: app/src/main/java/com/timehop/droidcon2014retrofitsample/data/reddit/model/RedditListing.java // public class RedditListing extends RedditObject { // String modhash; // String after; // String before; // List<RedditObject> children; // // public String getModhash() { // return modhash; // } // // public String getAfter() { // return after; // } // // public String getBefore() { // return before; // } // // public List<RedditObject> getChildren() { // return children; // } // } // // Path: app/src/main/java/com/timehop/droidcon2014retrofitsample/data/reddit/model/RedditMore.java // public class RedditMore extends RedditObject { // int count; // String parent_id; // String id; // String name; // List<String> children; // // public int getCount() { // return count; // } // // public String getParentId() { // return parent_id; // } // // public String getId() { // return id; // } // // public String getName() { // return name; // } // // public List<String> getChildren() { // return children; // } // }
import com.timehop.droidcon2014retrofitsample.data.reddit.model.RedditComment; import com.timehop.droidcon2014retrofitsample.data.reddit.model.RedditLink; import com.timehop.droidcon2014retrofitsample.data.reddit.model.RedditListing; import com.timehop.droidcon2014retrofitsample.data.reddit.model.RedditMore;
package com.timehop.droidcon2014retrofitsample.data.reddit; public enum RedditType { t1(RedditComment.class), t3(RedditLink.class), Listing(RedditListing.class),
// Path: app/src/main/java/com/timehop/droidcon2014retrofitsample/data/reddit/model/RedditComment.java // public class RedditComment extends RedditSubmission { // RedditObject replies; // String subreddit_id; // String parent_id; // int controversiality; // String body; // String body_html; // String link_id; // int depth; // // public RedditObject getReplies() { // return replies; // } // // public String getSubredditId() { // return subreddit_id; // } // // public String getParentId() { // return parent_id; // } // // public int getControversiality() { // return controversiality; // } // // public String getBody() { // return body; // } // // public String getBodyHtml() { // return body_html; // } // // public String getLinkId() { // return link_id; // } // // public int getDepth() { // return depth; // } // // public void setDepth(int depth) { // this.depth = depth; // } // } // // Path: app/src/main/java/com/timehop/droidcon2014retrofitsample/data/reddit/model/RedditLink.java // public class RedditLink extends RedditSubmission { // private String domain; // private String selftext_html; // private String selftext; // private String link_flair_text; // private boolean clicked; // private boolean hidden; // private String thumbnail; // private boolean is_self; // private String permalink; // private boolean stickied; // private String url; // private String title; // private int num_comments; // private boolean visited; // // public String getDomain() { // return domain; // } // // public String getSelftextHtml() { // return selftext_html; // } // // public String getSelftext() { // return selftext; // } // // public String getLinkFlairText() { // return link_flair_text; // } // // public boolean isClicked() { // return clicked; // } // // public boolean isHidden() { // return hidden; // } // // public String getThumbnail() { // return thumbnail; // } // // public String getSubreddit() { // return subreddit; // } // // public boolean isSelf() { // return is_self; // } // // public String getPermalink() { // return permalink; // } // // public boolean isStickied() { // return stickied; // } // // public String getUrl() { // return url; // } // // public String getTitle() { // return title; // } // // public int getNumComments() { // return num_comments; // } // // public boolean isVisited() { // return visited; // } // } // // Path: app/src/main/java/com/timehop/droidcon2014retrofitsample/data/reddit/model/RedditListing.java // public class RedditListing extends RedditObject { // String modhash; // String after; // String before; // List<RedditObject> children; // // public String getModhash() { // return modhash; // } // // public String getAfter() { // return after; // } // // public String getBefore() { // return before; // } // // public List<RedditObject> getChildren() { // return children; // } // } // // Path: app/src/main/java/com/timehop/droidcon2014retrofitsample/data/reddit/model/RedditMore.java // public class RedditMore extends RedditObject { // int count; // String parent_id; // String id; // String name; // List<String> children; // // public int getCount() { // return count; // } // // public String getParentId() { // return parent_id; // } // // public String getId() { // return id; // } // // public String getName() { // return name; // } // // public List<String> getChildren() { // return children; // } // } // Path: app/src/main/java/com/timehop/droidcon2014retrofitsample/data/reddit/RedditType.java import com.timehop.droidcon2014retrofitsample.data.reddit.model.RedditComment; import com.timehop.droidcon2014retrofitsample.data.reddit.model.RedditLink; import com.timehop.droidcon2014retrofitsample.data.reddit.model.RedditListing; import com.timehop.droidcon2014retrofitsample.data.reddit.model.RedditMore; package com.timehop.droidcon2014retrofitsample.data.reddit; public enum RedditType { t1(RedditComment.class), t3(RedditLink.class), Listing(RedditListing.class),
more(RedditMore.class);
jacobtabak/droidcon
app/src/main/java/com/timehop/droidcon2014retrofitsample/data/foursquare/FoursquareService.java
// Path: app/src/main/java/com/timehop/droidcon2014retrofitsample/data/foursquare/api/FoursquareErrorHandler.java // public class FoursquareErrorHandler implements ErrorHandler { // @Override // public Throwable handleError(RetrofitError cause) { // if (cause.getResponse() != null && cause.getSuccessType() == FoursquareResponse.class) { // FoursquareResponse response = (FoursquareResponse) cause.getBody(); // if (response.getMeta().getErrorDetail() != null) { // return new FoursquareException(response.getMeta().getErrorDetail(), cause); // } // } // return cause; // } // } // // Path: app/src/main/java/com/timehop/droidcon2014retrofitsample/data/foursquare/api/FoursquareException.java // public class FoursquareException extends Exception { // public FoursquareException(String detailMessage, Throwable throwable) { // super(detailMessage, throwable); // } // } // // Path: app/src/main/java/com/timehop/droidcon2014retrofitsample/data/foursquare/api/FoursquareRequestInterceptor.java // public class FoursquareRequestInterceptor implements RequestInterceptor { // @Override // public void intercept(RequestFacade request) { // request.addQueryParam("client_id", FoursquareCredentials.CLIENT_ID); // request.addQueryParam("client_secret", FoursquareCredentials.CLIENT_SECRET); // request.addQueryParam("v", "20141914"); // } // } // // Path: app/src/main/java/com/timehop/droidcon2014retrofitsample/data/foursquare/api/FoursquareResponse.java // public class FoursquareResponse { // public static final String FIELD_RESPONSE = "response"; // public static final String FIELD_META = "meta"; // // @SerializedName(FIELD_META) @NotNull private Meta meta; // @SerializedName(FIELD_RESPONSE) @Nullable private ResponseWrapper response; // // @NotNull // public Meta getMeta() { // return meta; // } // // public ResponseWrapper getResponse() { // return response; // } // }
import com.timehop.droidcon2014retrofitsample.data.foursquare.api.FoursquareErrorHandler; import com.timehop.droidcon2014retrofitsample.data.foursquare.api.FoursquareException; import com.timehop.droidcon2014retrofitsample.data.foursquare.api.FoursquareRequestInterceptor; import com.timehop.droidcon2014retrofitsample.data.foursquare.api.FoursquareResponse; import retrofit.Callback; import retrofit.RestAdapter; import retrofit.http.GET; import retrofit.http.Query;
package com.timehop.droidcon2014retrofitsample.data.foursquare; public interface FoursquareService { @GET("/venues/search")
// Path: app/src/main/java/com/timehop/droidcon2014retrofitsample/data/foursquare/api/FoursquareErrorHandler.java // public class FoursquareErrorHandler implements ErrorHandler { // @Override // public Throwable handleError(RetrofitError cause) { // if (cause.getResponse() != null && cause.getSuccessType() == FoursquareResponse.class) { // FoursquareResponse response = (FoursquareResponse) cause.getBody(); // if (response.getMeta().getErrorDetail() != null) { // return new FoursquareException(response.getMeta().getErrorDetail(), cause); // } // } // return cause; // } // } // // Path: app/src/main/java/com/timehop/droidcon2014retrofitsample/data/foursquare/api/FoursquareException.java // public class FoursquareException extends Exception { // public FoursquareException(String detailMessage, Throwable throwable) { // super(detailMessage, throwable); // } // } // // Path: app/src/main/java/com/timehop/droidcon2014retrofitsample/data/foursquare/api/FoursquareRequestInterceptor.java // public class FoursquareRequestInterceptor implements RequestInterceptor { // @Override // public void intercept(RequestFacade request) { // request.addQueryParam("client_id", FoursquareCredentials.CLIENT_ID); // request.addQueryParam("client_secret", FoursquareCredentials.CLIENT_SECRET); // request.addQueryParam("v", "20141914"); // } // } // // Path: app/src/main/java/com/timehop/droidcon2014retrofitsample/data/foursquare/api/FoursquareResponse.java // public class FoursquareResponse { // public static final String FIELD_RESPONSE = "response"; // public static final String FIELD_META = "meta"; // // @SerializedName(FIELD_META) @NotNull private Meta meta; // @SerializedName(FIELD_RESPONSE) @Nullable private ResponseWrapper response; // // @NotNull // public Meta getMeta() { // return meta; // } // // public ResponseWrapper getResponse() { // return response; // } // } // Path: app/src/main/java/com/timehop/droidcon2014retrofitsample/data/foursquare/FoursquareService.java import com.timehop.droidcon2014retrofitsample.data.foursquare.api.FoursquareErrorHandler; import com.timehop.droidcon2014retrofitsample.data.foursquare.api.FoursquareException; import com.timehop.droidcon2014retrofitsample.data.foursquare.api.FoursquareRequestInterceptor; import com.timehop.droidcon2014retrofitsample.data.foursquare.api.FoursquareResponse; import retrofit.Callback; import retrofit.RestAdapter; import retrofit.http.GET; import retrofit.http.Query; package com.timehop.droidcon2014retrofitsample.data.foursquare; public interface FoursquareService { @GET("/venues/search")
FoursquareResponse searchVenues(@Query("near") String location) throws FoursquareException;
jacobtabak/droidcon
app/src/main/java/com/timehop/droidcon2014retrofitsample/data/foursquare/FoursquareService.java
// Path: app/src/main/java/com/timehop/droidcon2014retrofitsample/data/foursquare/api/FoursquareErrorHandler.java // public class FoursquareErrorHandler implements ErrorHandler { // @Override // public Throwable handleError(RetrofitError cause) { // if (cause.getResponse() != null && cause.getSuccessType() == FoursquareResponse.class) { // FoursquareResponse response = (FoursquareResponse) cause.getBody(); // if (response.getMeta().getErrorDetail() != null) { // return new FoursquareException(response.getMeta().getErrorDetail(), cause); // } // } // return cause; // } // } // // Path: app/src/main/java/com/timehop/droidcon2014retrofitsample/data/foursquare/api/FoursquareException.java // public class FoursquareException extends Exception { // public FoursquareException(String detailMessage, Throwable throwable) { // super(detailMessage, throwable); // } // } // // Path: app/src/main/java/com/timehop/droidcon2014retrofitsample/data/foursquare/api/FoursquareRequestInterceptor.java // public class FoursquareRequestInterceptor implements RequestInterceptor { // @Override // public void intercept(RequestFacade request) { // request.addQueryParam("client_id", FoursquareCredentials.CLIENT_ID); // request.addQueryParam("client_secret", FoursquareCredentials.CLIENT_SECRET); // request.addQueryParam("v", "20141914"); // } // } // // Path: app/src/main/java/com/timehop/droidcon2014retrofitsample/data/foursquare/api/FoursquareResponse.java // public class FoursquareResponse { // public static final String FIELD_RESPONSE = "response"; // public static final String FIELD_META = "meta"; // // @SerializedName(FIELD_META) @NotNull private Meta meta; // @SerializedName(FIELD_RESPONSE) @Nullable private ResponseWrapper response; // // @NotNull // public Meta getMeta() { // return meta; // } // // public ResponseWrapper getResponse() { // return response; // } // }
import com.timehop.droidcon2014retrofitsample.data.foursquare.api.FoursquareErrorHandler; import com.timehop.droidcon2014retrofitsample.data.foursquare.api.FoursquareException; import com.timehop.droidcon2014retrofitsample.data.foursquare.api.FoursquareRequestInterceptor; import com.timehop.droidcon2014retrofitsample.data.foursquare.api.FoursquareResponse; import retrofit.Callback; import retrofit.RestAdapter; import retrofit.http.GET; import retrofit.http.Query;
package com.timehop.droidcon2014retrofitsample.data.foursquare; public interface FoursquareService { @GET("/venues/search")
// Path: app/src/main/java/com/timehop/droidcon2014retrofitsample/data/foursquare/api/FoursquareErrorHandler.java // public class FoursquareErrorHandler implements ErrorHandler { // @Override // public Throwable handleError(RetrofitError cause) { // if (cause.getResponse() != null && cause.getSuccessType() == FoursquareResponse.class) { // FoursquareResponse response = (FoursquareResponse) cause.getBody(); // if (response.getMeta().getErrorDetail() != null) { // return new FoursquareException(response.getMeta().getErrorDetail(), cause); // } // } // return cause; // } // } // // Path: app/src/main/java/com/timehop/droidcon2014retrofitsample/data/foursquare/api/FoursquareException.java // public class FoursquareException extends Exception { // public FoursquareException(String detailMessage, Throwable throwable) { // super(detailMessage, throwable); // } // } // // Path: app/src/main/java/com/timehop/droidcon2014retrofitsample/data/foursquare/api/FoursquareRequestInterceptor.java // public class FoursquareRequestInterceptor implements RequestInterceptor { // @Override // public void intercept(RequestFacade request) { // request.addQueryParam("client_id", FoursquareCredentials.CLIENT_ID); // request.addQueryParam("client_secret", FoursquareCredentials.CLIENT_SECRET); // request.addQueryParam("v", "20141914"); // } // } // // Path: app/src/main/java/com/timehop/droidcon2014retrofitsample/data/foursquare/api/FoursquareResponse.java // public class FoursquareResponse { // public static final String FIELD_RESPONSE = "response"; // public static final String FIELD_META = "meta"; // // @SerializedName(FIELD_META) @NotNull private Meta meta; // @SerializedName(FIELD_RESPONSE) @Nullable private ResponseWrapper response; // // @NotNull // public Meta getMeta() { // return meta; // } // // public ResponseWrapper getResponse() { // return response; // } // } // Path: app/src/main/java/com/timehop/droidcon2014retrofitsample/data/foursquare/FoursquareService.java import com.timehop.droidcon2014retrofitsample.data.foursquare.api.FoursquareErrorHandler; import com.timehop.droidcon2014retrofitsample.data.foursquare.api.FoursquareException; import com.timehop.droidcon2014retrofitsample.data.foursquare.api.FoursquareRequestInterceptor; import com.timehop.droidcon2014retrofitsample.data.foursquare.api.FoursquareResponse; import retrofit.Callback; import retrofit.RestAdapter; import retrofit.http.GET; import retrofit.http.Query; package com.timehop.droidcon2014retrofitsample.data.foursquare; public interface FoursquareService { @GET("/venues/search")
FoursquareResponse searchVenues(@Query("near") String location) throws FoursquareException;
jacobtabak/droidcon
app/src/main/java/com/timehop/droidcon2014retrofitsample/data/foursquare/FoursquareService.java
// Path: app/src/main/java/com/timehop/droidcon2014retrofitsample/data/foursquare/api/FoursquareErrorHandler.java // public class FoursquareErrorHandler implements ErrorHandler { // @Override // public Throwable handleError(RetrofitError cause) { // if (cause.getResponse() != null && cause.getSuccessType() == FoursquareResponse.class) { // FoursquareResponse response = (FoursquareResponse) cause.getBody(); // if (response.getMeta().getErrorDetail() != null) { // return new FoursquareException(response.getMeta().getErrorDetail(), cause); // } // } // return cause; // } // } // // Path: app/src/main/java/com/timehop/droidcon2014retrofitsample/data/foursquare/api/FoursquareException.java // public class FoursquareException extends Exception { // public FoursquareException(String detailMessage, Throwable throwable) { // super(detailMessage, throwable); // } // } // // Path: app/src/main/java/com/timehop/droidcon2014retrofitsample/data/foursquare/api/FoursquareRequestInterceptor.java // public class FoursquareRequestInterceptor implements RequestInterceptor { // @Override // public void intercept(RequestFacade request) { // request.addQueryParam("client_id", FoursquareCredentials.CLIENT_ID); // request.addQueryParam("client_secret", FoursquareCredentials.CLIENT_SECRET); // request.addQueryParam("v", "20141914"); // } // } // // Path: app/src/main/java/com/timehop/droidcon2014retrofitsample/data/foursquare/api/FoursquareResponse.java // public class FoursquareResponse { // public static final String FIELD_RESPONSE = "response"; // public static final String FIELD_META = "meta"; // // @SerializedName(FIELD_META) @NotNull private Meta meta; // @SerializedName(FIELD_RESPONSE) @Nullable private ResponseWrapper response; // // @NotNull // public Meta getMeta() { // return meta; // } // // public ResponseWrapper getResponse() { // return response; // } // }
import com.timehop.droidcon2014retrofitsample.data.foursquare.api.FoursquareErrorHandler; import com.timehop.droidcon2014retrofitsample.data.foursquare.api.FoursquareException; import com.timehop.droidcon2014retrofitsample.data.foursquare.api.FoursquareRequestInterceptor; import com.timehop.droidcon2014retrofitsample.data.foursquare.api.FoursquareResponse; import retrofit.Callback; import retrofit.RestAdapter; import retrofit.http.GET; import retrofit.http.Query;
package com.timehop.droidcon2014retrofitsample.data.foursquare; public interface FoursquareService { @GET("/venues/search") FoursquareResponse searchVenues(@Query("near") String location) throws FoursquareException; @GET("/venues/search") void searchVenues( @Query("near") String location, Callback<FoursquareResponse> callback); class Implementation { public static FoursquareService get() { return getBuilder() .build() .create(FoursquareService.class); } static RestAdapter.Builder getBuilder() { return new RestAdapter.Builder() .setEndpoint("https://api.foursquare.com/v2")
// Path: app/src/main/java/com/timehop/droidcon2014retrofitsample/data/foursquare/api/FoursquareErrorHandler.java // public class FoursquareErrorHandler implements ErrorHandler { // @Override // public Throwable handleError(RetrofitError cause) { // if (cause.getResponse() != null && cause.getSuccessType() == FoursquareResponse.class) { // FoursquareResponse response = (FoursquareResponse) cause.getBody(); // if (response.getMeta().getErrorDetail() != null) { // return new FoursquareException(response.getMeta().getErrorDetail(), cause); // } // } // return cause; // } // } // // Path: app/src/main/java/com/timehop/droidcon2014retrofitsample/data/foursquare/api/FoursquareException.java // public class FoursquareException extends Exception { // public FoursquareException(String detailMessage, Throwable throwable) { // super(detailMessage, throwable); // } // } // // Path: app/src/main/java/com/timehop/droidcon2014retrofitsample/data/foursquare/api/FoursquareRequestInterceptor.java // public class FoursquareRequestInterceptor implements RequestInterceptor { // @Override // public void intercept(RequestFacade request) { // request.addQueryParam("client_id", FoursquareCredentials.CLIENT_ID); // request.addQueryParam("client_secret", FoursquareCredentials.CLIENT_SECRET); // request.addQueryParam("v", "20141914"); // } // } // // Path: app/src/main/java/com/timehop/droidcon2014retrofitsample/data/foursquare/api/FoursquareResponse.java // public class FoursquareResponse { // public static final String FIELD_RESPONSE = "response"; // public static final String FIELD_META = "meta"; // // @SerializedName(FIELD_META) @NotNull private Meta meta; // @SerializedName(FIELD_RESPONSE) @Nullable private ResponseWrapper response; // // @NotNull // public Meta getMeta() { // return meta; // } // // public ResponseWrapper getResponse() { // return response; // } // } // Path: app/src/main/java/com/timehop/droidcon2014retrofitsample/data/foursquare/FoursquareService.java import com.timehop.droidcon2014retrofitsample.data.foursquare.api.FoursquareErrorHandler; import com.timehop.droidcon2014retrofitsample.data.foursquare.api.FoursquareException; import com.timehop.droidcon2014retrofitsample.data.foursquare.api.FoursquareRequestInterceptor; import com.timehop.droidcon2014retrofitsample.data.foursquare.api.FoursquareResponse; import retrofit.Callback; import retrofit.RestAdapter; import retrofit.http.GET; import retrofit.http.Query; package com.timehop.droidcon2014retrofitsample.data.foursquare; public interface FoursquareService { @GET("/venues/search") FoursquareResponse searchVenues(@Query("near") String location) throws FoursquareException; @GET("/venues/search") void searchVenues( @Query("near") String location, Callback<FoursquareResponse> callback); class Implementation { public static FoursquareService get() { return getBuilder() .build() .create(FoursquareService.class); } static RestAdapter.Builder getBuilder() { return new RestAdapter.Builder() .setEndpoint("https://api.foursquare.com/v2")
.setRequestInterceptor(new FoursquareRequestInterceptor())
jacobtabak/droidcon
app/src/main/java/com/timehop/droidcon2014retrofitsample/data/foursquare/FoursquareService.java
// Path: app/src/main/java/com/timehop/droidcon2014retrofitsample/data/foursquare/api/FoursquareErrorHandler.java // public class FoursquareErrorHandler implements ErrorHandler { // @Override // public Throwable handleError(RetrofitError cause) { // if (cause.getResponse() != null && cause.getSuccessType() == FoursquareResponse.class) { // FoursquareResponse response = (FoursquareResponse) cause.getBody(); // if (response.getMeta().getErrorDetail() != null) { // return new FoursquareException(response.getMeta().getErrorDetail(), cause); // } // } // return cause; // } // } // // Path: app/src/main/java/com/timehop/droidcon2014retrofitsample/data/foursquare/api/FoursquareException.java // public class FoursquareException extends Exception { // public FoursquareException(String detailMessage, Throwable throwable) { // super(detailMessage, throwable); // } // } // // Path: app/src/main/java/com/timehop/droidcon2014retrofitsample/data/foursquare/api/FoursquareRequestInterceptor.java // public class FoursquareRequestInterceptor implements RequestInterceptor { // @Override // public void intercept(RequestFacade request) { // request.addQueryParam("client_id", FoursquareCredentials.CLIENT_ID); // request.addQueryParam("client_secret", FoursquareCredentials.CLIENT_SECRET); // request.addQueryParam("v", "20141914"); // } // } // // Path: app/src/main/java/com/timehop/droidcon2014retrofitsample/data/foursquare/api/FoursquareResponse.java // public class FoursquareResponse { // public static final String FIELD_RESPONSE = "response"; // public static final String FIELD_META = "meta"; // // @SerializedName(FIELD_META) @NotNull private Meta meta; // @SerializedName(FIELD_RESPONSE) @Nullable private ResponseWrapper response; // // @NotNull // public Meta getMeta() { // return meta; // } // // public ResponseWrapper getResponse() { // return response; // } // }
import com.timehop.droidcon2014retrofitsample.data.foursquare.api.FoursquareErrorHandler; import com.timehop.droidcon2014retrofitsample.data.foursquare.api.FoursquareException; import com.timehop.droidcon2014retrofitsample.data.foursquare.api.FoursquareRequestInterceptor; import com.timehop.droidcon2014retrofitsample.data.foursquare.api.FoursquareResponse; import retrofit.Callback; import retrofit.RestAdapter; import retrofit.http.GET; import retrofit.http.Query;
package com.timehop.droidcon2014retrofitsample.data.foursquare; public interface FoursquareService { @GET("/venues/search") FoursquareResponse searchVenues(@Query("near") String location) throws FoursquareException; @GET("/venues/search") void searchVenues( @Query("near") String location, Callback<FoursquareResponse> callback); class Implementation { public static FoursquareService get() { return getBuilder() .build() .create(FoursquareService.class); } static RestAdapter.Builder getBuilder() { return new RestAdapter.Builder() .setEndpoint("https://api.foursquare.com/v2") .setRequestInterceptor(new FoursquareRequestInterceptor())
// Path: app/src/main/java/com/timehop/droidcon2014retrofitsample/data/foursquare/api/FoursquareErrorHandler.java // public class FoursquareErrorHandler implements ErrorHandler { // @Override // public Throwable handleError(RetrofitError cause) { // if (cause.getResponse() != null && cause.getSuccessType() == FoursquareResponse.class) { // FoursquareResponse response = (FoursquareResponse) cause.getBody(); // if (response.getMeta().getErrorDetail() != null) { // return new FoursquareException(response.getMeta().getErrorDetail(), cause); // } // } // return cause; // } // } // // Path: app/src/main/java/com/timehop/droidcon2014retrofitsample/data/foursquare/api/FoursquareException.java // public class FoursquareException extends Exception { // public FoursquareException(String detailMessage, Throwable throwable) { // super(detailMessage, throwable); // } // } // // Path: app/src/main/java/com/timehop/droidcon2014retrofitsample/data/foursquare/api/FoursquareRequestInterceptor.java // public class FoursquareRequestInterceptor implements RequestInterceptor { // @Override // public void intercept(RequestFacade request) { // request.addQueryParam("client_id", FoursquareCredentials.CLIENT_ID); // request.addQueryParam("client_secret", FoursquareCredentials.CLIENT_SECRET); // request.addQueryParam("v", "20141914"); // } // } // // Path: app/src/main/java/com/timehop/droidcon2014retrofitsample/data/foursquare/api/FoursquareResponse.java // public class FoursquareResponse { // public static final String FIELD_RESPONSE = "response"; // public static final String FIELD_META = "meta"; // // @SerializedName(FIELD_META) @NotNull private Meta meta; // @SerializedName(FIELD_RESPONSE) @Nullable private ResponseWrapper response; // // @NotNull // public Meta getMeta() { // return meta; // } // // public ResponseWrapper getResponse() { // return response; // } // } // Path: app/src/main/java/com/timehop/droidcon2014retrofitsample/data/foursquare/FoursquareService.java import com.timehop.droidcon2014retrofitsample.data.foursquare.api.FoursquareErrorHandler; import com.timehop.droidcon2014retrofitsample.data.foursquare.api.FoursquareException; import com.timehop.droidcon2014retrofitsample.data.foursquare.api.FoursquareRequestInterceptor; import com.timehop.droidcon2014retrofitsample.data.foursquare.api.FoursquareResponse; import retrofit.Callback; import retrofit.RestAdapter; import retrofit.http.GET; import retrofit.http.Query; package com.timehop.droidcon2014retrofitsample.data.foursquare; public interface FoursquareService { @GET("/venues/search") FoursquareResponse searchVenues(@Query("near") String location) throws FoursquareException; @GET("/venues/search") void searchVenues( @Query("near") String location, Callback<FoursquareResponse> callback); class Implementation { public static FoursquareService get() { return getBuilder() .build() .create(FoursquareService.class); } static RestAdapter.Builder getBuilder() { return new RestAdapter.Builder() .setEndpoint("https://api.foursquare.com/v2") .setRequestInterceptor(new FoursquareRequestInterceptor())
.setErrorHandler(new FoursquareErrorHandler());
jacobtabak/droidcon
app/src/main/java/com/timehop/droidcon2014retrofitsample/data/foursquare/api/FoursquareResponse.java
// Path: app/src/main/java/com/timehop/droidcon2014retrofitsample/data/foursquare/model/Meta.java // public class Meta { // public static final String FIELD_CODE = "code"; // public static final String FIELD_ERROR_TYPE = "errorType"; // public static final String FIELD_ERROR_DETAIL = "errorDetail"; // public static final String FIELD_MESSAGE = "message"; // // @SerializedName(FIELD_CODE) private int code; // @SerializedName(FIELD_ERROR_TYPE) @Nullable private String errorType; // @SerializedName(FIELD_ERROR_DETAIL) @Nullable private String errorDetail; // @SerializedName(FIELD_MESSAGE) @Nullable private String message; // // public int getCode() { // return code; // } // // @Nullable // public String getErrorType() { // return errorType; // } // // @Nullable // public String getErrorDetail() { // return errorDetail; // } // // @Nullable // public String getMessage() { // return message; // } // } // // Path: app/src/main/java/com/timehop/droidcon2014retrofitsample/data/foursquare/model/ResponseWrapper.java // public class ResponseWrapper { // public static final String FIELD_VENUES = "venues"; // // @SerializedName(FIELD_VENUES) @Nullable private List<Venue> venues; // // @Nullable // public List<Venue> getVenues() { // return venues; // } // }
import com.google.gson.annotations.SerializedName; import com.timehop.droidcon2014retrofitsample.data.foursquare.model.Meta; import com.timehop.droidcon2014retrofitsample.data.foursquare.model.ResponseWrapper; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable;
package com.timehop.droidcon2014retrofitsample.data.foursquare.api; public class FoursquareResponse { public static final String FIELD_RESPONSE = "response"; public static final String FIELD_META = "meta";
// Path: app/src/main/java/com/timehop/droidcon2014retrofitsample/data/foursquare/model/Meta.java // public class Meta { // public static final String FIELD_CODE = "code"; // public static final String FIELD_ERROR_TYPE = "errorType"; // public static final String FIELD_ERROR_DETAIL = "errorDetail"; // public static final String FIELD_MESSAGE = "message"; // // @SerializedName(FIELD_CODE) private int code; // @SerializedName(FIELD_ERROR_TYPE) @Nullable private String errorType; // @SerializedName(FIELD_ERROR_DETAIL) @Nullable private String errorDetail; // @SerializedName(FIELD_MESSAGE) @Nullable private String message; // // public int getCode() { // return code; // } // // @Nullable // public String getErrorType() { // return errorType; // } // // @Nullable // public String getErrorDetail() { // return errorDetail; // } // // @Nullable // public String getMessage() { // return message; // } // } // // Path: app/src/main/java/com/timehop/droidcon2014retrofitsample/data/foursquare/model/ResponseWrapper.java // public class ResponseWrapper { // public static final String FIELD_VENUES = "venues"; // // @SerializedName(FIELD_VENUES) @Nullable private List<Venue> venues; // // @Nullable // public List<Venue> getVenues() { // return venues; // } // } // Path: app/src/main/java/com/timehop/droidcon2014retrofitsample/data/foursquare/api/FoursquareResponse.java import com.google.gson.annotations.SerializedName; import com.timehop.droidcon2014retrofitsample.data.foursquare.model.Meta; import com.timehop.droidcon2014retrofitsample.data.foursquare.model.ResponseWrapper; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; package com.timehop.droidcon2014retrofitsample.data.foursquare.api; public class FoursquareResponse { public static final String FIELD_RESPONSE = "response"; public static final String FIELD_META = "meta";
@SerializedName(FIELD_META) @NotNull private Meta meta;
jacobtabak/droidcon
app/src/main/java/com/timehop/droidcon2014retrofitsample/data/foursquare/api/FoursquareResponse.java
// Path: app/src/main/java/com/timehop/droidcon2014retrofitsample/data/foursquare/model/Meta.java // public class Meta { // public static final String FIELD_CODE = "code"; // public static final String FIELD_ERROR_TYPE = "errorType"; // public static final String FIELD_ERROR_DETAIL = "errorDetail"; // public static final String FIELD_MESSAGE = "message"; // // @SerializedName(FIELD_CODE) private int code; // @SerializedName(FIELD_ERROR_TYPE) @Nullable private String errorType; // @SerializedName(FIELD_ERROR_DETAIL) @Nullable private String errorDetail; // @SerializedName(FIELD_MESSAGE) @Nullable private String message; // // public int getCode() { // return code; // } // // @Nullable // public String getErrorType() { // return errorType; // } // // @Nullable // public String getErrorDetail() { // return errorDetail; // } // // @Nullable // public String getMessage() { // return message; // } // } // // Path: app/src/main/java/com/timehop/droidcon2014retrofitsample/data/foursquare/model/ResponseWrapper.java // public class ResponseWrapper { // public static final String FIELD_VENUES = "venues"; // // @SerializedName(FIELD_VENUES) @Nullable private List<Venue> venues; // // @Nullable // public List<Venue> getVenues() { // return venues; // } // }
import com.google.gson.annotations.SerializedName; import com.timehop.droidcon2014retrofitsample.data.foursquare.model.Meta; import com.timehop.droidcon2014retrofitsample.data.foursquare.model.ResponseWrapper; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable;
package com.timehop.droidcon2014retrofitsample.data.foursquare.api; public class FoursquareResponse { public static final String FIELD_RESPONSE = "response"; public static final String FIELD_META = "meta"; @SerializedName(FIELD_META) @NotNull private Meta meta;
// Path: app/src/main/java/com/timehop/droidcon2014retrofitsample/data/foursquare/model/Meta.java // public class Meta { // public static final String FIELD_CODE = "code"; // public static final String FIELD_ERROR_TYPE = "errorType"; // public static final String FIELD_ERROR_DETAIL = "errorDetail"; // public static final String FIELD_MESSAGE = "message"; // // @SerializedName(FIELD_CODE) private int code; // @SerializedName(FIELD_ERROR_TYPE) @Nullable private String errorType; // @SerializedName(FIELD_ERROR_DETAIL) @Nullable private String errorDetail; // @SerializedName(FIELD_MESSAGE) @Nullable private String message; // // public int getCode() { // return code; // } // // @Nullable // public String getErrorType() { // return errorType; // } // // @Nullable // public String getErrorDetail() { // return errorDetail; // } // // @Nullable // public String getMessage() { // return message; // } // } // // Path: app/src/main/java/com/timehop/droidcon2014retrofitsample/data/foursquare/model/ResponseWrapper.java // public class ResponseWrapper { // public static final String FIELD_VENUES = "venues"; // // @SerializedName(FIELD_VENUES) @Nullable private List<Venue> venues; // // @Nullable // public List<Venue> getVenues() { // return venues; // } // } // Path: app/src/main/java/com/timehop/droidcon2014retrofitsample/data/foursquare/api/FoursquareResponse.java import com.google.gson.annotations.SerializedName; import com.timehop.droidcon2014retrofitsample.data.foursquare.model.Meta; import com.timehop.droidcon2014retrofitsample.data.foursquare.model.ResponseWrapper; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; package com.timehop.droidcon2014retrofitsample.data.foursquare.api; public class FoursquareResponse { public static final String FIELD_RESPONSE = "response"; public static final String FIELD_META = "meta"; @SerializedName(FIELD_META) @NotNull private Meta meta;
@SerializedName(FIELD_RESPONSE) @Nullable private ResponseWrapper response;
jacobtabak/droidcon
app/src/main/java/com/timehop/droidcon2014retrofitsample/data/reddit/RedditObjectDeserializer.java
// Path: app/src/main/java/com/timehop/droidcon2014retrofitsample/data/reddit/model/RedditObject.java // public abstract class RedditObject { // } // // Path: app/src/main/java/com/timehop/droidcon2014retrofitsample/data/reddit/model/RedditObjectWrapper.java // public class RedditObjectWrapper { // RedditType kind; // JsonElement data; // // public RedditType getKind() { // return kind; // } // // public JsonElement getData() { // return data; // } // }
import android.util.Log; import com.google.gson.Gson; import com.google.gson.JsonDeserializationContext; import com.google.gson.JsonDeserializer; import com.google.gson.JsonElement; import com.google.gson.JsonParseException; import com.timehop.droidcon2014retrofitsample.data.reddit.model.RedditObject; import com.timehop.droidcon2014retrofitsample.data.reddit.model.RedditObjectWrapper; import java.lang.reflect.Type;
package com.timehop.droidcon2014retrofitsample.data.reddit; public class RedditObjectDeserializer implements JsonDeserializer<RedditObject> { public static final String TAG = RedditObjectDeserializer.class.getSimpleName(); public static final String KIND = "kind"; public RedditObject deserialize(JsonElement json, Type type, JsonDeserializationContext context) throws JsonParseException { if (!json.isJsonObject()) { // if there are no replies, we're given a String rather than an object return null; } try {
// Path: app/src/main/java/com/timehop/droidcon2014retrofitsample/data/reddit/model/RedditObject.java // public abstract class RedditObject { // } // // Path: app/src/main/java/com/timehop/droidcon2014retrofitsample/data/reddit/model/RedditObjectWrapper.java // public class RedditObjectWrapper { // RedditType kind; // JsonElement data; // // public RedditType getKind() { // return kind; // } // // public JsonElement getData() { // return data; // } // } // Path: app/src/main/java/com/timehop/droidcon2014retrofitsample/data/reddit/RedditObjectDeserializer.java import android.util.Log; import com.google.gson.Gson; import com.google.gson.JsonDeserializationContext; import com.google.gson.JsonDeserializer; import com.google.gson.JsonElement; import com.google.gson.JsonParseException; import com.timehop.droidcon2014retrofitsample.data.reddit.model.RedditObject; import com.timehop.droidcon2014retrofitsample.data.reddit.model.RedditObjectWrapper; import java.lang.reflect.Type; package com.timehop.droidcon2014retrofitsample.data.reddit; public class RedditObjectDeserializer implements JsonDeserializer<RedditObject> { public static final String TAG = RedditObjectDeserializer.class.getSimpleName(); public static final String KIND = "kind"; public RedditObject deserialize(JsonElement json, Type type, JsonDeserializationContext context) throws JsonParseException { if (!json.isJsonObject()) { // if there are no replies, we're given a String rather than an object return null; } try {
RedditObjectWrapper wrapper = new Gson().fromJson(json, RedditObjectWrapper.class);
jacobtabak/droidcon
app/src/androidTest/java/com/timehop/droidcon2014retrofitsample/data/reddit/MockRedditService.java
// Path: app/src/androidTest/java/com/timehop/droidcon2014retrofitsample/data/reddit/model/MockModelHelper.java // public class MockModelHelper { // public static RedditListing createMockLinkListing() { // RedditListing linkListing = new RedditListing(); // linkListing.children = new ArrayList<>(); // linkListing.children.add(new RedditLink()); // return linkListing; // } // // public static RedditListing createMockCommentsListing() { // RedditListing commentListing = new RedditListing(); // commentListing.children = new ArrayList<>(); // commentListing.children.add(new RedditComment()); // return commentListing; // } // // public static List<RedditResponse<RedditListing>> getMockCommentsResponse() { // List <RedditResponse<RedditListing>> response = new ArrayList<>(); // response.add(new RedditResponse<>(MockModelHelper.createMockLinkListing())); // response.add(new RedditResponse<>(MockModelHelper.createMockCommentsListing())); // return response; // } // } // // Path: app/src/main/java/com/timehop/droidcon2014retrofitsample/data/reddit/model/RedditListing.java // public class RedditListing extends RedditObject { // String modhash; // String after; // String before; // List<RedditObject> children; // // public String getModhash() { // return modhash; // } // // public String getAfter() { // return after; // } // // public String getBefore() { // return before; // } // // public List<RedditObject> getChildren() { // return children; // } // } // // Path: app/src/main/java/com/timehop/droidcon2014retrofitsample/data/reddit/model/RedditResponse.java // public class RedditResponse<T> { // RedditResponse(T data) { // this.data = data; // } // // T data; // // public T getData() { // return data; // } // }
import com.timehop.droidcon2014retrofitsample.data.reddit.model.MockModelHelper; import com.timehop.droidcon2014retrofitsample.data.reddit.model.RedditListing; import com.timehop.droidcon2014retrofitsample.data.reddit.model.RedditResponse; import java.util.ArrayList; import java.util.List; import retrofit.Callback; import retrofit.client.Header; import retrofit.client.Response; import retrofit.http.Path;
package com.timehop.droidcon2014retrofitsample.data.reddit; public class MockRedditService implements RedditService { @Override
// Path: app/src/androidTest/java/com/timehop/droidcon2014retrofitsample/data/reddit/model/MockModelHelper.java // public class MockModelHelper { // public static RedditListing createMockLinkListing() { // RedditListing linkListing = new RedditListing(); // linkListing.children = new ArrayList<>(); // linkListing.children.add(new RedditLink()); // return linkListing; // } // // public static RedditListing createMockCommentsListing() { // RedditListing commentListing = new RedditListing(); // commentListing.children = new ArrayList<>(); // commentListing.children.add(new RedditComment()); // return commentListing; // } // // public static List<RedditResponse<RedditListing>> getMockCommentsResponse() { // List <RedditResponse<RedditListing>> response = new ArrayList<>(); // response.add(new RedditResponse<>(MockModelHelper.createMockLinkListing())); // response.add(new RedditResponse<>(MockModelHelper.createMockCommentsListing())); // return response; // } // } // // Path: app/src/main/java/com/timehop/droidcon2014retrofitsample/data/reddit/model/RedditListing.java // public class RedditListing extends RedditObject { // String modhash; // String after; // String before; // List<RedditObject> children; // // public String getModhash() { // return modhash; // } // // public String getAfter() { // return after; // } // // public String getBefore() { // return before; // } // // public List<RedditObject> getChildren() { // return children; // } // } // // Path: app/src/main/java/com/timehop/droidcon2014retrofitsample/data/reddit/model/RedditResponse.java // public class RedditResponse<T> { // RedditResponse(T data) { // this.data = data; // } // // T data; // // public T getData() { // return data; // } // } // Path: app/src/androidTest/java/com/timehop/droidcon2014retrofitsample/data/reddit/MockRedditService.java import com.timehop.droidcon2014retrofitsample.data.reddit.model.MockModelHelper; import com.timehop.droidcon2014retrofitsample.data.reddit.model.RedditListing; import com.timehop.droidcon2014retrofitsample.data.reddit.model.RedditResponse; import java.util.ArrayList; import java.util.List; import retrofit.Callback; import retrofit.client.Header; import retrofit.client.Response; import retrofit.http.Path; package com.timehop.droidcon2014retrofitsample.data.reddit; public class MockRedditService implements RedditService { @Override
public List<RedditResponse<RedditListing>> getComments(String subreddit, String id) {
jacobtabak/droidcon
app/src/androidTest/java/com/timehop/droidcon2014retrofitsample/data/reddit/MockRedditService.java
// Path: app/src/androidTest/java/com/timehop/droidcon2014retrofitsample/data/reddit/model/MockModelHelper.java // public class MockModelHelper { // public static RedditListing createMockLinkListing() { // RedditListing linkListing = new RedditListing(); // linkListing.children = new ArrayList<>(); // linkListing.children.add(new RedditLink()); // return linkListing; // } // // public static RedditListing createMockCommentsListing() { // RedditListing commentListing = new RedditListing(); // commentListing.children = new ArrayList<>(); // commentListing.children.add(new RedditComment()); // return commentListing; // } // // public static List<RedditResponse<RedditListing>> getMockCommentsResponse() { // List <RedditResponse<RedditListing>> response = new ArrayList<>(); // response.add(new RedditResponse<>(MockModelHelper.createMockLinkListing())); // response.add(new RedditResponse<>(MockModelHelper.createMockCommentsListing())); // return response; // } // } // // Path: app/src/main/java/com/timehop/droidcon2014retrofitsample/data/reddit/model/RedditListing.java // public class RedditListing extends RedditObject { // String modhash; // String after; // String before; // List<RedditObject> children; // // public String getModhash() { // return modhash; // } // // public String getAfter() { // return after; // } // // public String getBefore() { // return before; // } // // public List<RedditObject> getChildren() { // return children; // } // } // // Path: app/src/main/java/com/timehop/droidcon2014retrofitsample/data/reddit/model/RedditResponse.java // public class RedditResponse<T> { // RedditResponse(T data) { // this.data = data; // } // // T data; // // public T getData() { // return data; // } // }
import com.timehop.droidcon2014retrofitsample.data.reddit.model.MockModelHelper; import com.timehop.droidcon2014retrofitsample.data.reddit.model.RedditListing; import com.timehop.droidcon2014retrofitsample.data.reddit.model.RedditResponse; import java.util.ArrayList; import java.util.List; import retrofit.Callback; import retrofit.client.Header; import retrofit.client.Response; import retrofit.http.Path;
package com.timehop.droidcon2014retrofitsample.data.reddit; public class MockRedditService implements RedditService { @Override
// Path: app/src/androidTest/java/com/timehop/droidcon2014retrofitsample/data/reddit/model/MockModelHelper.java // public class MockModelHelper { // public static RedditListing createMockLinkListing() { // RedditListing linkListing = new RedditListing(); // linkListing.children = new ArrayList<>(); // linkListing.children.add(new RedditLink()); // return linkListing; // } // // public static RedditListing createMockCommentsListing() { // RedditListing commentListing = new RedditListing(); // commentListing.children = new ArrayList<>(); // commentListing.children.add(new RedditComment()); // return commentListing; // } // // public static List<RedditResponse<RedditListing>> getMockCommentsResponse() { // List <RedditResponse<RedditListing>> response = new ArrayList<>(); // response.add(new RedditResponse<>(MockModelHelper.createMockLinkListing())); // response.add(new RedditResponse<>(MockModelHelper.createMockCommentsListing())); // return response; // } // } // // Path: app/src/main/java/com/timehop/droidcon2014retrofitsample/data/reddit/model/RedditListing.java // public class RedditListing extends RedditObject { // String modhash; // String after; // String before; // List<RedditObject> children; // // public String getModhash() { // return modhash; // } // // public String getAfter() { // return after; // } // // public String getBefore() { // return before; // } // // public List<RedditObject> getChildren() { // return children; // } // } // // Path: app/src/main/java/com/timehop/droidcon2014retrofitsample/data/reddit/model/RedditResponse.java // public class RedditResponse<T> { // RedditResponse(T data) { // this.data = data; // } // // T data; // // public T getData() { // return data; // } // } // Path: app/src/androidTest/java/com/timehop/droidcon2014retrofitsample/data/reddit/MockRedditService.java import com.timehop.droidcon2014retrofitsample.data.reddit.model.MockModelHelper; import com.timehop.droidcon2014retrofitsample.data.reddit.model.RedditListing; import com.timehop.droidcon2014retrofitsample.data.reddit.model.RedditResponse; import java.util.ArrayList; import java.util.List; import retrofit.Callback; import retrofit.client.Header; import retrofit.client.Response; import retrofit.http.Path; package com.timehop.droidcon2014retrofitsample.data.reddit; public class MockRedditService implements RedditService { @Override
public List<RedditResponse<RedditListing>> getComments(String subreddit, String id) {
jacobtabak/droidcon
app/src/androidTest/java/com/timehop/droidcon2014retrofitsample/data/reddit/MockRedditService.java
// Path: app/src/androidTest/java/com/timehop/droidcon2014retrofitsample/data/reddit/model/MockModelHelper.java // public class MockModelHelper { // public static RedditListing createMockLinkListing() { // RedditListing linkListing = new RedditListing(); // linkListing.children = new ArrayList<>(); // linkListing.children.add(new RedditLink()); // return linkListing; // } // // public static RedditListing createMockCommentsListing() { // RedditListing commentListing = new RedditListing(); // commentListing.children = new ArrayList<>(); // commentListing.children.add(new RedditComment()); // return commentListing; // } // // public static List<RedditResponse<RedditListing>> getMockCommentsResponse() { // List <RedditResponse<RedditListing>> response = new ArrayList<>(); // response.add(new RedditResponse<>(MockModelHelper.createMockLinkListing())); // response.add(new RedditResponse<>(MockModelHelper.createMockCommentsListing())); // return response; // } // } // // Path: app/src/main/java/com/timehop/droidcon2014retrofitsample/data/reddit/model/RedditListing.java // public class RedditListing extends RedditObject { // String modhash; // String after; // String before; // List<RedditObject> children; // // public String getModhash() { // return modhash; // } // // public String getAfter() { // return after; // } // // public String getBefore() { // return before; // } // // public List<RedditObject> getChildren() { // return children; // } // } // // Path: app/src/main/java/com/timehop/droidcon2014retrofitsample/data/reddit/model/RedditResponse.java // public class RedditResponse<T> { // RedditResponse(T data) { // this.data = data; // } // // T data; // // public T getData() { // return data; // } // }
import com.timehop.droidcon2014retrofitsample.data.reddit.model.MockModelHelper; import com.timehop.droidcon2014retrofitsample.data.reddit.model.RedditListing; import com.timehop.droidcon2014retrofitsample.data.reddit.model.RedditResponse; import java.util.ArrayList; import java.util.List; import retrofit.Callback; import retrofit.client.Header; import retrofit.client.Response; import retrofit.http.Path;
package com.timehop.droidcon2014retrofitsample.data.reddit; public class MockRedditService implements RedditService { @Override public List<RedditResponse<RedditListing>> getComments(String subreddit, String id) {
// Path: app/src/androidTest/java/com/timehop/droidcon2014retrofitsample/data/reddit/model/MockModelHelper.java // public class MockModelHelper { // public static RedditListing createMockLinkListing() { // RedditListing linkListing = new RedditListing(); // linkListing.children = new ArrayList<>(); // linkListing.children.add(new RedditLink()); // return linkListing; // } // // public static RedditListing createMockCommentsListing() { // RedditListing commentListing = new RedditListing(); // commentListing.children = new ArrayList<>(); // commentListing.children.add(new RedditComment()); // return commentListing; // } // // public static List<RedditResponse<RedditListing>> getMockCommentsResponse() { // List <RedditResponse<RedditListing>> response = new ArrayList<>(); // response.add(new RedditResponse<>(MockModelHelper.createMockLinkListing())); // response.add(new RedditResponse<>(MockModelHelper.createMockCommentsListing())); // return response; // } // } // // Path: app/src/main/java/com/timehop/droidcon2014retrofitsample/data/reddit/model/RedditListing.java // public class RedditListing extends RedditObject { // String modhash; // String after; // String before; // List<RedditObject> children; // // public String getModhash() { // return modhash; // } // // public String getAfter() { // return after; // } // // public String getBefore() { // return before; // } // // public List<RedditObject> getChildren() { // return children; // } // } // // Path: app/src/main/java/com/timehop/droidcon2014retrofitsample/data/reddit/model/RedditResponse.java // public class RedditResponse<T> { // RedditResponse(T data) { // this.data = data; // } // // T data; // // public T getData() { // return data; // } // } // Path: app/src/androidTest/java/com/timehop/droidcon2014retrofitsample/data/reddit/MockRedditService.java import com.timehop.droidcon2014retrofitsample.data.reddit.model.MockModelHelper; import com.timehop.droidcon2014retrofitsample.data.reddit.model.RedditListing; import com.timehop.droidcon2014retrofitsample.data.reddit.model.RedditResponse; import java.util.ArrayList; import java.util.List; import retrofit.Callback; import retrofit.client.Header; import retrofit.client.Response; import retrofit.http.Path; package com.timehop.droidcon2014retrofitsample.data.reddit; public class MockRedditService implements RedditService { @Override public List<RedditResponse<RedditListing>> getComments(String subreddit, String id) {
return MockModelHelper.getMockCommentsResponse();
jacobtabak/droidcon
app/src/main/java/com/timehop/droidcon2014retrofitsample/data/reddit/RedditService.java
// Path: app/src/main/java/com/timehop/droidcon2014retrofitsample/data/reddit/model/RedditListing.java // public class RedditListing extends RedditObject { // String modhash; // String after; // String before; // List<RedditObject> children; // // public String getModhash() { // return modhash; // } // // public String getAfter() { // return after; // } // // public String getBefore() { // return before; // } // // public List<RedditObject> getChildren() { // return children; // } // } // // Path: app/src/main/java/com/timehop/droidcon2014retrofitsample/data/reddit/model/RedditObject.java // public abstract class RedditObject { // } // // Path: app/src/main/java/com/timehop/droidcon2014retrofitsample/data/reddit/model/RedditResponse.java // public class RedditResponse<T> { // RedditResponse(T data) { // this.data = data; // } // // T data; // // public T getData() { // return data; // } // }
import com.google.gson.Gson; import com.google.gson.GsonBuilder; import com.timehop.droidcon2014retrofitsample.data.reddit.model.RedditListing; import com.timehop.droidcon2014retrofitsample.data.reddit.model.RedditObject; import com.timehop.droidcon2014retrofitsample.data.reddit.model.RedditResponse; import org.joda.time.DateTime; import java.util.List; import retrofit.Callback; import retrofit.RestAdapter; import retrofit.converter.GsonConverter; import retrofit.http.GET; import retrofit.http.Path;
package com.timehop.droidcon2014retrofitsample.data.reddit; public interface RedditService { @GET("/r/{subreddit}/comments/{id}.json")
// Path: app/src/main/java/com/timehop/droidcon2014retrofitsample/data/reddit/model/RedditListing.java // public class RedditListing extends RedditObject { // String modhash; // String after; // String before; // List<RedditObject> children; // // public String getModhash() { // return modhash; // } // // public String getAfter() { // return after; // } // // public String getBefore() { // return before; // } // // public List<RedditObject> getChildren() { // return children; // } // } // // Path: app/src/main/java/com/timehop/droidcon2014retrofitsample/data/reddit/model/RedditObject.java // public abstract class RedditObject { // } // // Path: app/src/main/java/com/timehop/droidcon2014retrofitsample/data/reddit/model/RedditResponse.java // public class RedditResponse<T> { // RedditResponse(T data) { // this.data = data; // } // // T data; // // public T getData() { // return data; // } // } // Path: app/src/main/java/com/timehop/droidcon2014retrofitsample/data/reddit/RedditService.java import com.google.gson.Gson; import com.google.gson.GsonBuilder; import com.timehop.droidcon2014retrofitsample.data.reddit.model.RedditListing; import com.timehop.droidcon2014retrofitsample.data.reddit.model.RedditObject; import com.timehop.droidcon2014retrofitsample.data.reddit.model.RedditResponse; import org.joda.time.DateTime; import java.util.List; import retrofit.Callback; import retrofit.RestAdapter; import retrofit.converter.GsonConverter; import retrofit.http.GET; import retrofit.http.Path; package com.timehop.droidcon2014retrofitsample.data.reddit; public interface RedditService { @GET("/r/{subreddit}/comments/{id}.json")
List<RedditResponse<RedditListing>> getComments(
jacobtabak/droidcon
app/src/main/java/com/timehop/droidcon2014retrofitsample/data/reddit/RedditService.java
// Path: app/src/main/java/com/timehop/droidcon2014retrofitsample/data/reddit/model/RedditListing.java // public class RedditListing extends RedditObject { // String modhash; // String after; // String before; // List<RedditObject> children; // // public String getModhash() { // return modhash; // } // // public String getAfter() { // return after; // } // // public String getBefore() { // return before; // } // // public List<RedditObject> getChildren() { // return children; // } // } // // Path: app/src/main/java/com/timehop/droidcon2014retrofitsample/data/reddit/model/RedditObject.java // public abstract class RedditObject { // } // // Path: app/src/main/java/com/timehop/droidcon2014retrofitsample/data/reddit/model/RedditResponse.java // public class RedditResponse<T> { // RedditResponse(T data) { // this.data = data; // } // // T data; // // public T getData() { // return data; // } // }
import com.google.gson.Gson; import com.google.gson.GsonBuilder; import com.timehop.droidcon2014retrofitsample.data.reddit.model.RedditListing; import com.timehop.droidcon2014retrofitsample.data.reddit.model.RedditObject; import com.timehop.droidcon2014retrofitsample.data.reddit.model.RedditResponse; import org.joda.time.DateTime; import java.util.List; import retrofit.Callback; import retrofit.RestAdapter; import retrofit.converter.GsonConverter; import retrofit.http.GET; import retrofit.http.Path;
package com.timehop.droidcon2014retrofitsample.data.reddit; public interface RedditService { @GET("/r/{subreddit}/comments/{id}.json")
// Path: app/src/main/java/com/timehop/droidcon2014retrofitsample/data/reddit/model/RedditListing.java // public class RedditListing extends RedditObject { // String modhash; // String after; // String before; // List<RedditObject> children; // // public String getModhash() { // return modhash; // } // // public String getAfter() { // return after; // } // // public String getBefore() { // return before; // } // // public List<RedditObject> getChildren() { // return children; // } // } // // Path: app/src/main/java/com/timehop/droidcon2014retrofitsample/data/reddit/model/RedditObject.java // public abstract class RedditObject { // } // // Path: app/src/main/java/com/timehop/droidcon2014retrofitsample/data/reddit/model/RedditResponse.java // public class RedditResponse<T> { // RedditResponse(T data) { // this.data = data; // } // // T data; // // public T getData() { // return data; // } // } // Path: app/src/main/java/com/timehop/droidcon2014retrofitsample/data/reddit/RedditService.java import com.google.gson.Gson; import com.google.gson.GsonBuilder; import com.timehop.droidcon2014retrofitsample.data.reddit.model.RedditListing; import com.timehop.droidcon2014retrofitsample.data.reddit.model.RedditObject; import com.timehop.droidcon2014retrofitsample.data.reddit.model.RedditResponse; import org.joda.time.DateTime; import java.util.List; import retrofit.Callback; import retrofit.RestAdapter; import retrofit.converter.GsonConverter; import retrofit.http.GET; import retrofit.http.Path; package com.timehop.droidcon2014retrofitsample.data.reddit; public interface RedditService { @GET("/r/{subreddit}/comments/{id}.json")
List<RedditResponse<RedditListing>> getComments(
jacobtabak/droidcon
app/src/main/java/com/timehop/droidcon2014retrofitsample/data/reddit/RedditService.java
// Path: app/src/main/java/com/timehop/droidcon2014retrofitsample/data/reddit/model/RedditListing.java // public class RedditListing extends RedditObject { // String modhash; // String after; // String before; // List<RedditObject> children; // // public String getModhash() { // return modhash; // } // // public String getAfter() { // return after; // } // // public String getBefore() { // return before; // } // // public List<RedditObject> getChildren() { // return children; // } // } // // Path: app/src/main/java/com/timehop/droidcon2014retrofitsample/data/reddit/model/RedditObject.java // public abstract class RedditObject { // } // // Path: app/src/main/java/com/timehop/droidcon2014retrofitsample/data/reddit/model/RedditResponse.java // public class RedditResponse<T> { // RedditResponse(T data) { // this.data = data; // } // // T data; // // public T getData() { // return data; // } // }
import com.google.gson.Gson; import com.google.gson.GsonBuilder; import com.timehop.droidcon2014retrofitsample.data.reddit.model.RedditListing; import com.timehop.droidcon2014retrofitsample.data.reddit.model.RedditObject; import com.timehop.droidcon2014retrofitsample.data.reddit.model.RedditResponse; import org.joda.time.DateTime; import java.util.List; import retrofit.Callback; import retrofit.RestAdapter; import retrofit.converter.GsonConverter; import retrofit.http.GET; import retrofit.http.Path;
@GET("/r/{subreddit}/comments/{id}.json") void getComments( @Path("subreddit") String subreddit, @Path("id") String id, Callback<List<RedditResponse<RedditListing>>> callback ); @GET("/r/{subreddit}.json") RedditResponse<RedditListing> getSubreddit(@Path("subreddit") String subreddit); @GET("/r/{subreddit}.json") void getSubreddit( @Path("subreddit") String subreddit, Callback<RedditResponse<RedditListing>> callback); public static class Implementation { public static RedditService get() { return getBuilder() .build() .create(RedditService.class); } static RestAdapter.Builder getBuilder() { return new RestAdapter.Builder() .setConverter(new GsonConverter(getGson())) .setEndpoint("http://www.reddit.com"); } private static Gson getGson() { return new GsonBuilder()
// Path: app/src/main/java/com/timehop/droidcon2014retrofitsample/data/reddit/model/RedditListing.java // public class RedditListing extends RedditObject { // String modhash; // String after; // String before; // List<RedditObject> children; // // public String getModhash() { // return modhash; // } // // public String getAfter() { // return after; // } // // public String getBefore() { // return before; // } // // public List<RedditObject> getChildren() { // return children; // } // } // // Path: app/src/main/java/com/timehop/droidcon2014retrofitsample/data/reddit/model/RedditObject.java // public abstract class RedditObject { // } // // Path: app/src/main/java/com/timehop/droidcon2014retrofitsample/data/reddit/model/RedditResponse.java // public class RedditResponse<T> { // RedditResponse(T data) { // this.data = data; // } // // T data; // // public T getData() { // return data; // } // } // Path: app/src/main/java/com/timehop/droidcon2014retrofitsample/data/reddit/RedditService.java import com.google.gson.Gson; import com.google.gson.GsonBuilder; import com.timehop.droidcon2014retrofitsample.data.reddit.model.RedditListing; import com.timehop.droidcon2014retrofitsample.data.reddit.model.RedditObject; import com.timehop.droidcon2014retrofitsample.data.reddit.model.RedditResponse; import org.joda.time.DateTime; import java.util.List; import retrofit.Callback; import retrofit.RestAdapter; import retrofit.converter.GsonConverter; import retrofit.http.GET; import retrofit.http.Path; @GET("/r/{subreddit}/comments/{id}.json") void getComments( @Path("subreddit") String subreddit, @Path("id") String id, Callback<List<RedditResponse<RedditListing>>> callback ); @GET("/r/{subreddit}.json") RedditResponse<RedditListing> getSubreddit(@Path("subreddit") String subreddit); @GET("/r/{subreddit}.json") void getSubreddit( @Path("subreddit") String subreddit, Callback<RedditResponse<RedditListing>> callback); public static class Implementation { public static RedditService get() { return getBuilder() .build() .create(RedditService.class); } static RestAdapter.Builder getBuilder() { return new RestAdapter.Builder() .setConverter(new GsonConverter(getGson())) .setEndpoint("http://www.reddit.com"); } private static Gson getGson() { return new GsonBuilder()
.registerTypeAdapter(RedditObject.class, new RedditObjectDeserializer())
mcxtzhang/all-base-adapter
app/src/main/java/mcxtzhang/commonviewgroupadapter/databinding/viewgroup/DBFlowSwipeActivity.java
// Path: adapter-lib/src/main/java/com/mcxtzhang/commonadapter/viewgroup/VGUtil.java // public class VGUtil { // ViewGroup mParent; // IViewGroupAdapter mAdapter; // // DataSetObserver mDataSetObserver = new DataSetObserver() { // @Override // public void onChanged() { // refreshUI(); // } // // @Override // public void onInvalidated() { // } // }; // // boolean mRemainExistViews; // // OnItemClickListener mOnItemClickListener; // OnItemLongClickListener mOnItemLongClickListener; // // public static class Builder { // private ViewGroup mParent; // private IViewGroupAdapter mAdapter; // private boolean mRemainExistViews; // private OnItemClickListener mOnItemClickListener; // private OnItemLongClickListener mOnItemLongClickListener; // // public Builder setParent(ViewGroup parent) { // mParent = parent; // return this; // } // // public Builder setAdapter(IViewGroupAdapter adapter) { // mAdapter = adapter; // return this; // } // // public Builder setRemainExistViews(boolean remainExistViews) { // mRemainExistViews = remainExistViews; // return this; // } // // public Builder setOnItemClickListener(OnItemClickListener onItemClickListener) { // mOnItemClickListener = onItemClickListener; // return this; // } // // public Builder setOnItemLongClickListener(OnItemLongClickListener onItemLongClickListener) { // mOnItemLongClickListener = onItemLongClickListener; // return this; // } // // public VGUtil build() { // return new VGUtil(mParent, mAdapter, mRemainExistViews, mOnItemClickListener, mOnItemLongClickListener); // } // // // } // // // public VGUtil(ViewGroup parent, IViewGroupAdapter adapter) { // this(parent, adapter, false); // } // // public VGUtil(ViewGroup parent, IViewGroupAdapter adapter, boolean remainExistViews) { // this(parent, adapter, remainExistViews, null, null); // } // // public VGUtil(ViewGroup parent, IViewGroupAdapter adapter, OnItemClickListener onItemClickListener) { // this(parent, adapter, false, onItemClickListener, null); // } // // public VGUtil(ViewGroup parent, IViewGroupAdapter adapter, OnItemLongClickListener onItemLongClickListener) { // this(parent, adapter, false, null, onItemLongClickListener); // } // // public VGUtil(ViewGroup parent, IViewGroupAdapter adapter, boolean remainExistViews, OnItemClickListener onItemClickListener, OnItemLongClickListener onItemLongClickListener) { // if (parent == null || adapter == null) { // throw new IllegalArgumentException("ViewGroup or Adapter can't be null! "); // } // if (mAdapter != null) { // mAdapter.unregisterDataSetObserver(mDataSetObserver); // } // mParent = parent; // mAdapter = adapter; // mAdapter.registerDataSetObserver(mDataSetObserver); // mRemainExistViews = remainExistViews; // mOnItemClickListener = onItemClickListener; // mOnItemLongClickListener = onItemLongClickListener; // } // // /** // * Begin bind views for {@link #mParent} // */ // public VGUtil bind() { // return bind(false); // } // // /** // * Refresh ui for {@link #mParent}. // * This method will reset {@link OnItemClickListener} and {@link OnItemLongClickListener} // * // * @return // */ // public VGUtil refreshUI() { // return bind(true); // } // // private VGUtil bind(boolean refresh) { // if (mParent == null || mAdapter == null) { // return this; // } // //Step 1 // //If need clear all existed views // if (!mRemainExistViews) { // mAdapter.recycleViews(mParent); // } // //Step 2, begin add views // int count = mAdapter.getCount(); // for (int i = 0; i < count; i++) { // //Get itemView by adapter // View itemView = mAdapter.getView(mParent, i); // mParent.addView(itemView); // // //Step 3 (Optional), // //If item has not set click listener before, add click listener for each item. // //If in refresh , reset click listener // if (null != mOnItemClickListener && (!itemView.isClickable() || refresh)) { // final int finalI = i; // itemView.setOnClickListener(new View.OnClickListener() { // @Override // public void onClick(View view) { // mOnItemClickListener.onItemClick(mParent, view, finalI); // } // }); // } // //If item has not set long click listener before, add long click listener for each item. // if (null != mOnItemLongClickListener && (!itemView.isLongClickable() || refresh)) { // final int finalI = i; // itemView.setOnLongClickListener(new View.OnLongClickListener() { // @Override // public boolean onLongClick(View view) { // return mOnItemLongClickListener.onItemLongClick(mParent, view, finalI); // } // }); // } // } // return this; // } // }
import android.databinding.DataBindingUtil; import android.os.Bundle; import android.support.v7.app.AppCompatActivity; import android.view.View; import com.mcxtzhang.commonadapter.databinding.viewgroup.SingleBindingAdapter; import com.mcxtzhang.commonadapter.viewgroup.VGUtil; import com.mcxtzhang.swipemenulib.SwipeMenuLayout; import java.util.ArrayList; import java.util.List; import mcxtzhang.commonviewgroupadapter.R; import mcxtzhang.commonviewgroupadapter.databinding.ActivityDbflowSwipeBinding;
package mcxtzhang.commonviewgroupadapter.databinding.viewgroup; public class DBFlowSwipeActivity extends AppCompatActivity { ActivityDbflowSwipeBinding mBinding; SingleBindingAdapter mAdapter; List<FlowBean> mDatas;
// Path: adapter-lib/src/main/java/com/mcxtzhang/commonadapter/viewgroup/VGUtil.java // public class VGUtil { // ViewGroup mParent; // IViewGroupAdapter mAdapter; // // DataSetObserver mDataSetObserver = new DataSetObserver() { // @Override // public void onChanged() { // refreshUI(); // } // // @Override // public void onInvalidated() { // } // }; // // boolean mRemainExistViews; // // OnItemClickListener mOnItemClickListener; // OnItemLongClickListener mOnItemLongClickListener; // // public static class Builder { // private ViewGroup mParent; // private IViewGroupAdapter mAdapter; // private boolean mRemainExistViews; // private OnItemClickListener mOnItemClickListener; // private OnItemLongClickListener mOnItemLongClickListener; // // public Builder setParent(ViewGroup parent) { // mParent = parent; // return this; // } // // public Builder setAdapter(IViewGroupAdapter adapter) { // mAdapter = adapter; // return this; // } // // public Builder setRemainExistViews(boolean remainExistViews) { // mRemainExistViews = remainExistViews; // return this; // } // // public Builder setOnItemClickListener(OnItemClickListener onItemClickListener) { // mOnItemClickListener = onItemClickListener; // return this; // } // // public Builder setOnItemLongClickListener(OnItemLongClickListener onItemLongClickListener) { // mOnItemLongClickListener = onItemLongClickListener; // return this; // } // // public VGUtil build() { // return new VGUtil(mParent, mAdapter, mRemainExistViews, mOnItemClickListener, mOnItemLongClickListener); // } // // // } // // // public VGUtil(ViewGroup parent, IViewGroupAdapter adapter) { // this(parent, adapter, false); // } // // public VGUtil(ViewGroup parent, IViewGroupAdapter adapter, boolean remainExistViews) { // this(parent, adapter, remainExistViews, null, null); // } // // public VGUtil(ViewGroup parent, IViewGroupAdapter adapter, OnItemClickListener onItemClickListener) { // this(parent, adapter, false, onItemClickListener, null); // } // // public VGUtil(ViewGroup parent, IViewGroupAdapter adapter, OnItemLongClickListener onItemLongClickListener) { // this(parent, adapter, false, null, onItemLongClickListener); // } // // public VGUtil(ViewGroup parent, IViewGroupAdapter adapter, boolean remainExistViews, OnItemClickListener onItemClickListener, OnItemLongClickListener onItemLongClickListener) { // if (parent == null || adapter == null) { // throw new IllegalArgumentException("ViewGroup or Adapter can't be null! "); // } // if (mAdapter != null) { // mAdapter.unregisterDataSetObserver(mDataSetObserver); // } // mParent = parent; // mAdapter = adapter; // mAdapter.registerDataSetObserver(mDataSetObserver); // mRemainExistViews = remainExistViews; // mOnItemClickListener = onItemClickListener; // mOnItemLongClickListener = onItemLongClickListener; // } // // /** // * Begin bind views for {@link #mParent} // */ // public VGUtil bind() { // return bind(false); // } // // /** // * Refresh ui for {@link #mParent}. // * This method will reset {@link OnItemClickListener} and {@link OnItemLongClickListener} // * // * @return // */ // public VGUtil refreshUI() { // return bind(true); // } // // private VGUtil bind(boolean refresh) { // if (mParent == null || mAdapter == null) { // return this; // } // //Step 1 // //If need clear all existed views // if (!mRemainExistViews) { // mAdapter.recycleViews(mParent); // } // //Step 2, begin add views // int count = mAdapter.getCount(); // for (int i = 0; i < count; i++) { // //Get itemView by adapter // View itemView = mAdapter.getView(mParent, i); // mParent.addView(itemView); // // //Step 3 (Optional), // //If item has not set click listener before, add click listener for each item. // //If in refresh , reset click listener // if (null != mOnItemClickListener && (!itemView.isClickable() || refresh)) { // final int finalI = i; // itemView.setOnClickListener(new View.OnClickListener() { // @Override // public void onClick(View view) { // mOnItemClickListener.onItemClick(mParent, view, finalI); // } // }); // } // //If item has not set long click listener before, add long click listener for each item. // if (null != mOnItemLongClickListener && (!itemView.isLongClickable() || refresh)) { // final int finalI = i; // itemView.setOnLongClickListener(new View.OnLongClickListener() { // @Override // public boolean onLongClick(View view) { // return mOnItemLongClickListener.onItemLongClick(mParent, view, finalI); // } // }); // } // } // return this; // } // } // Path: app/src/main/java/mcxtzhang/commonviewgroupadapter/databinding/viewgroup/DBFlowSwipeActivity.java import android.databinding.DataBindingUtil; import android.os.Bundle; import android.support.v7.app.AppCompatActivity; import android.view.View; import com.mcxtzhang.commonadapter.databinding.viewgroup.SingleBindingAdapter; import com.mcxtzhang.commonadapter.viewgroup.VGUtil; import com.mcxtzhang.swipemenulib.SwipeMenuLayout; import java.util.ArrayList; import java.util.List; import mcxtzhang.commonviewgroupadapter.R; import mcxtzhang.commonviewgroupadapter.databinding.ActivityDbflowSwipeBinding; package mcxtzhang.commonviewgroupadapter.databinding.viewgroup; public class DBFlowSwipeActivity extends AppCompatActivity { ActivityDbflowSwipeBinding mBinding; SingleBindingAdapter mAdapter; List<FlowBean> mDatas;
VGUtil mVGUtil;
mcxtzhang/all-base-adapter
app/src/main/java/mcxtzhang/commonviewgroupadapter/rv/RvSingleActivity.java
// Path: app/src/main/java/mcxtzhang/commonviewgroupadapter/TestBean.java // public class TestBean { // private String avatar; // private String name; // // public TestBean(String avatar, String name) { // this.avatar = avatar; // this.name = name; // } // // public String getAvatar() { // return avatar; // } // // public TestBean setAvatar(String avatar) { // this.avatar = avatar; // return this; // } // // public String getName() { // return name; // } // // public TestBean setName(String name) { // this.name = name; // return this; // } // // public static List<TestBean> initDatas() { // List<TestBean> datas = new ArrayList<>(); // datas.add(new TestBean("http://imgs.ebrun.com/resources/2016_03/2016_03_25/201603259771458878793312_origin.jpg", "张")); // datas.add(new TestBean("http://p14.go007.com/2014_11_02_05/a03541088cce31b8_1.jpg", "旭童")); // datas.add(new TestBean("http://news.k618.cn/tech/201604/W020160407281077548026.jpg", "多种type")); // datas.add(new TestBean("http://www.kejik.com/image/1460343965520.jpg", "多种type")); // datas.add(new TestBean("http://cn.chinadaily.com.cn/img/attachement/jpg/site1/20160318/eca86bd77be61855f1b81c.jpg", "多种type")); // datas.add(new TestBean("http://imgs.ebrun.com/resources/2016_04/2016_04_12/201604124411460430531500.jpg", "多种type")); // datas.add(new TestBean("http://imgs.ebrun.com/resources/2016_04/2016_04_24/201604244971461460826484_origin.jpeg", "多种type")); // datas.add(new TestBean("http://www.lnmoto.cn/bbs/data/attachment/forum/201408/12/074018gshshia3is1cw3sg.jpg", "多种type")); // return datas; // } // } // // Path: app/src/main/java/mcxtzhang/commonviewgroupadapter/TestBean.java // public static List<TestBean> initDatas() { // List<TestBean> datas = new ArrayList<>(); // datas.add(new TestBean("http://imgs.ebrun.com/resources/2016_03/2016_03_25/201603259771458878793312_origin.jpg", "张")); // datas.add(new TestBean("http://p14.go007.com/2014_11_02_05/a03541088cce31b8_1.jpg", "旭童")); // datas.add(new TestBean("http://news.k618.cn/tech/201604/W020160407281077548026.jpg", "多种type")); // datas.add(new TestBean("http://www.kejik.com/image/1460343965520.jpg", "多种type")); // datas.add(new TestBean("http://cn.chinadaily.com.cn/img/attachement/jpg/site1/20160318/eca86bd77be61855f1b81c.jpg", "多种type")); // datas.add(new TestBean("http://imgs.ebrun.com/resources/2016_04/2016_04_12/201604124411460430531500.jpg", "多种type")); // datas.add(new TestBean("http://imgs.ebrun.com/resources/2016_04/2016_04_24/201604244971461460826484_origin.jpeg", "多种type")); // datas.add(new TestBean("http://www.lnmoto.cn/bbs/data/attachment/forum/201408/12/074018gshshia3is1cw3sg.jpg", "多种type")); // return datas; // }
import android.os.Bundle; import android.support.v7.app.AppCompatActivity; import android.support.v7.widget.LinearLayoutManager; import android.support.v7.widget.RecyclerView; import android.widget.ImageView; import android.widget.TextView; import com.bumptech.glide.Glide; import com.mcxtzhang.commonadapter.rv.CommonAdapter; import com.mcxtzhang.commonadapter.rv.ViewHolder; import java.util.List; import mcxtzhang.commonviewgroupadapter.R; import mcxtzhang.commonviewgroupadapter.TestBean; import static mcxtzhang.commonviewgroupadapter.TestBean.initDatas;
package mcxtzhang.commonviewgroupadapter.rv; public class RvSingleActivity extends AppCompatActivity { private static final String TAG = "zxt";
// Path: app/src/main/java/mcxtzhang/commonviewgroupadapter/TestBean.java // public class TestBean { // private String avatar; // private String name; // // public TestBean(String avatar, String name) { // this.avatar = avatar; // this.name = name; // } // // public String getAvatar() { // return avatar; // } // // public TestBean setAvatar(String avatar) { // this.avatar = avatar; // return this; // } // // public String getName() { // return name; // } // // public TestBean setName(String name) { // this.name = name; // return this; // } // // public static List<TestBean> initDatas() { // List<TestBean> datas = new ArrayList<>(); // datas.add(new TestBean("http://imgs.ebrun.com/resources/2016_03/2016_03_25/201603259771458878793312_origin.jpg", "张")); // datas.add(new TestBean("http://p14.go007.com/2014_11_02_05/a03541088cce31b8_1.jpg", "旭童")); // datas.add(new TestBean("http://news.k618.cn/tech/201604/W020160407281077548026.jpg", "多种type")); // datas.add(new TestBean("http://www.kejik.com/image/1460343965520.jpg", "多种type")); // datas.add(new TestBean("http://cn.chinadaily.com.cn/img/attachement/jpg/site1/20160318/eca86bd77be61855f1b81c.jpg", "多种type")); // datas.add(new TestBean("http://imgs.ebrun.com/resources/2016_04/2016_04_12/201604124411460430531500.jpg", "多种type")); // datas.add(new TestBean("http://imgs.ebrun.com/resources/2016_04/2016_04_24/201604244971461460826484_origin.jpeg", "多种type")); // datas.add(new TestBean("http://www.lnmoto.cn/bbs/data/attachment/forum/201408/12/074018gshshia3is1cw3sg.jpg", "多种type")); // return datas; // } // } // // Path: app/src/main/java/mcxtzhang/commonviewgroupadapter/TestBean.java // public static List<TestBean> initDatas() { // List<TestBean> datas = new ArrayList<>(); // datas.add(new TestBean("http://imgs.ebrun.com/resources/2016_03/2016_03_25/201603259771458878793312_origin.jpg", "张")); // datas.add(new TestBean("http://p14.go007.com/2014_11_02_05/a03541088cce31b8_1.jpg", "旭童")); // datas.add(new TestBean("http://news.k618.cn/tech/201604/W020160407281077548026.jpg", "多种type")); // datas.add(new TestBean("http://www.kejik.com/image/1460343965520.jpg", "多种type")); // datas.add(new TestBean("http://cn.chinadaily.com.cn/img/attachement/jpg/site1/20160318/eca86bd77be61855f1b81c.jpg", "多种type")); // datas.add(new TestBean("http://imgs.ebrun.com/resources/2016_04/2016_04_12/201604124411460430531500.jpg", "多种type")); // datas.add(new TestBean("http://imgs.ebrun.com/resources/2016_04/2016_04_24/201604244971461460826484_origin.jpeg", "多种type")); // datas.add(new TestBean("http://www.lnmoto.cn/bbs/data/attachment/forum/201408/12/074018gshshia3is1cw3sg.jpg", "多种type")); // return datas; // } // Path: app/src/main/java/mcxtzhang/commonviewgroupadapter/rv/RvSingleActivity.java import android.os.Bundle; import android.support.v7.app.AppCompatActivity; import android.support.v7.widget.LinearLayoutManager; import android.support.v7.widget.RecyclerView; import android.widget.ImageView; import android.widget.TextView; import com.bumptech.glide.Glide; import com.mcxtzhang.commonadapter.rv.CommonAdapter; import com.mcxtzhang.commonadapter.rv.ViewHolder; import java.util.List; import mcxtzhang.commonviewgroupadapter.R; import mcxtzhang.commonviewgroupadapter.TestBean; import static mcxtzhang.commonviewgroupadapter.TestBean.initDatas; package mcxtzhang.commonviewgroupadapter.rv; public class RvSingleActivity extends AppCompatActivity { private static final String TAG = "zxt";
private List<TestBean> mDatas;
mcxtzhang/all-base-adapter
app/src/main/java/mcxtzhang/commonviewgroupadapter/rv/RvSingleActivity.java
// Path: app/src/main/java/mcxtzhang/commonviewgroupadapter/TestBean.java // public class TestBean { // private String avatar; // private String name; // // public TestBean(String avatar, String name) { // this.avatar = avatar; // this.name = name; // } // // public String getAvatar() { // return avatar; // } // // public TestBean setAvatar(String avatar) { // this.avatar = avatar; // return this; // } // // public String getName() { // return name; // } // // public TestBean setName(String name) { // this.name = name; // return this; // } // // public static List<TestBean> initDatas() { // List<TestBean> datas = new ArrayList<>(); // datas.add(new TestBean("http://imgs.ebrun.com/resources/2016_03/2016_03_25/201603259771458878793312_origin.jpg", "张")); // datas.add(new TestBean("http://p14.go007.com/2014_11_02_05/a03541088cce31b8_1.jpg", "旭童")); // datas.add(new TestBean("http://news.k618.cn/tech/201604/W020160407281077548026.jpg", "多种type")); // datas.add(new TestBean("http://www.kejik.com/image/1460343965520.jpg", "多种type")); // datas.add(new TestBean("http://cn.chinadaily.com.cn/img/attachement/jpg/site1/20160318/eca86bd77be61855f1b81c.jpg", "多种type")); // datas.add(new TestBean("http://imgs.ebrun.com/resources/2016_04/2016_04_12/201604124411460430531500.jpg", "多种type")); // datas.add(new TestBean("http://imgs.ebrun.com/resources/2016_04/2016_04_24/201604244971461460826484_origin.jpeg", "多种type")); // datas.add(new TestBean("http://www.lnmoto.cn/bbs/data/attachment/forum/201408/12/074018gshshia3is1cw3sg.jpg", "多种type")); // return datas; // } // } // // Path: app/src/main/java/mcxtzhang/commonviewgroupadapter/TestBean.java // public static List<TestBean> initDatas() { // List<TestBean> datas = new ArrayList<>(); // datas.add(new TestBean("http://imgs.ebrun.com/resources/2016_03/2016_03_25/201603259771458878793312_origin.jpg", "张")); // datas.add(new TestBean("http://p14.go007.com/2014_11_02_05/a03541088cce31b8_1.jpg", "旭童")); // datas.add(new TestBean("http://news.k618.cn/tech/201604/W020160407281077548026.jpg", "多种type")); // datas.add(new TestBean("http://www.kejik.com/image/1460343965520.jpg", "多种type")); // datas.add(new TestBean("http://cn.chinadaily.com.cn/img/attachement/jpg/site1/20160318/eca86bd77be61855f1b81c.jpg", "多种type")); // datas.add(new TestBean("http://imgs.ebrun.com/resources/2016_04/2016_04_12/201604124411460430531500.jpg", "多种type")); // datas.add(new TestBean("http://imgs.ebrun.com/resources/2016_04/2016_04_24/201604244971461460826484_origin.jpeg", "多种type")); // datas.add(new TestBean("http://www.lnmoto.cn/bbs/data/attachment/forum/201408/12/074018gshshia3is1cw3sg.jpg", "多种type")); // return datas; // }
import android.os.Bundle; import android.support.v7.app.AppCompatActivity; import android.support.v7.widget.LinearLayoutManager; import android.support.v7.widget.RecyclerView; import android.widget.ImageView; import android.widget.TextView; import com.bumptech.glide.Glide; import com.mcxtzhang.commonadapter.rv.CommonAdapter; import com.mcxtzhang.commonadapter.rv.ViewHolder; import java.util.List; import mcxtzhang.commonviewgroupadapter.R; import mcxtzhang.commonviewgroupadapter.TestBean; import static mcxtzhang.commonviewgroupadapter.TestBean.initDatas;
package mcxtzhang.commonviewgroupadapter.rv; public class RvSingleActivity extends AppCompatActivity { private static final String TAG = "zxt"; private List<TestBean> mDatas; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_rv_single); RecyclerView recyclerView = (RecyclerView) findViewById(R.id.activity_rv_single); recyclerView.setLayoutManager(new LinearLayoutManager(this));
// Path: app/src/main/java/mcxtzhang/commonviewgroupadapter/TestBean.java // public class TestBean { // private String avatar; // private String name; // // public TestBean(String avatar, String name) { // this.avatar = avatar; // this.name = name; // } // // public String getAvatar() { // return avatar; // } // // public TestBean setAvatar(String avatar) { // this.avatar = avatar; // return this; // } // // public String getName() { // return name; // } // // public TestBean setName(String name) { // this.name = name; // return this; // } // // public static List<TestBean> initDatas() { // List<TestBean> datas = new ArrayList<>(); // datas.add(new TestBean("http://imgs.ebrun.com/resources/2016_03/2016_03_25/201603259771458878793312_origin.jpg", "张")); // datas.add(new TestBean("http://p14.go007.com/2014_11_02_05/a03541088cce31b8_1.jpg", "旭童")); // datas.add(new TestBean("http://news.k618.cn/tech/201604/W020160407281077548026.jpg", "多种type")); // datas.add(new TestBean("http://www.kejik.com/image/1460343965520.jpg", "多种type")); // datas.add(new TestBean("http://cn.chinadaily.com.cn/img/attachement/jpg/site1/20160318/eca86bd77be61855f1b81c.jpg", "多种type")); // datas.add(new TestBean("http://imgs.ebrun.com/resources/2016_04/2016_04_12/201604124411460430531500.jpg", "多种type")); // datas.add(new TestBean("http://imgs.ebrun.com/resources/2016_04/2016_04_24/201604244971461460826484_origin.jpeg", "多种type")); // datas.add(new TestBean("http://www.lnmoto.cn/bbs/data/attachment/forum/201408/12/074018gshshia3is1cw3sg.jpg", "多种type")); // return datas; // } // } // // Path: app/src/main/java/mcxtzhang/commonviewgroupadapter/TestBean.java // public static List<TestBean> initDatas() { // List<TestBean> datas = new ArrayList<>(); // datas.add(new TestBean("http://imgs.ebrun.com/resources/2016_03/2016_03_25/201603259771458878793312_origin.jpg", "张")); // datas.add(new TestBean("http://p14.go007.com/2014_11_02_05/a03541088cce31b8_1.jpg", "旭童")); // datas.add(new TestBean("http://news.k618.cn/tech/201604/W020160407281077548026.jpg", "多种type")); // datas.add(new TestBean("http://www.kejik.com/image/1460343965520.jpg", "多种type")); // datas.add(new TestBean("http://cn.chinadaily.com.cn/img/attachement/jpg/site1/20160318/eca86bd77be61855f1b81c.jpg", "多种type")); // datas.add(new TestBean("http://imgs.ebrun.com/resources/2016_04/2016_04_12/201604124411460430531500.jpg", "多种type")); // datas.add(new TestBean("http://imgs.ebrun.com/resources/2016_04/2016_04_24/201604244971461460826484_origin.jpeg", "多种type")); // datas.add(new TestBean("http://www.lnmoto.cn/bbs/data/attachment/forum/201408/12/074018gshshia3is1cw3sg.jpg", "多种type")); // return datas; // } // Path: app/src/main/java/mcxtzhang/commonviewgroupadapter/rv/RvSingleActivity.java import android.os.Bundle; import android.support.v7.app.AppCompatActivity; import android.support.v7.widget.LinearLayoutManager; import android.support.v7.widget.RecyclerView; import android.widget.ImageView; import android.widget.TextView; import com.bumptech.glide.Glide; import com.mcxtzhang.commonadapter.rv.CommonAdapter; import com.mcxtzhang.commonadapter.rv.ViewHolder; import java.util.List; import mcxtzhang.commonviewgroupadapter.R; import mcxtzhang.commonviewgroupadapter.TestBean; import static mcxtzhang.commonviewgroupadapter.TestBean.initDatas; package mcxtzhang.commonviewgroupadapter.rv; public class RvSingleActivity extends AppCompatActivity { private static final String TAG = "zxt"; private List<TestBean> mDatas; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_rv_single); RecyclerView recyclerView = (RecyclerView) findViewById(R.id.activity_rv_single); recyclerView.setLayoutManager(new LinearLayoutManager(this));
recyclerView.setAdapter(new CommonAdapter<TestBean>(this, mDatas = initDatas(), R.layout.item_test) {
mcxtzhang/all-base-adapter
app/src/main/java/mcxtzhang/commonviewgroupadapter/lvgv/GridViewActivity.java
// Path: app/src/main/java/mcxtzhang/commonviewgroupadapter/TestBean.java // public class TestBean { // private String avatar; // private String name; // // public TestBean(String avatar, String name) { // this.avatar = avatar; // this.name = name; // } // // public String getAvatar() { // return avatar; // } // // public TestBean setAvatar(String avatar) { // this.avatar = avatar; // return this; // } // // public String getName() { // return name; // } // // public TestBean setName(String name) { // this.name = name; // return this; // } // // public static List<TestBean> initDatas() { // List<TestBean> datas = new ArrayList<>(); // datas.add(new TestBean("http://imgs.ebrun.com/resources/2016_03/2016_03_25/201603259771458878793312_origin.jpg", "张")); // datas.add(new TestBean("http://p14.go007.com/2014_11_02_05/a03541088cce31b8_1.jpg", "旭童")); // datas.add(new TestBean("http://news.k618.cn/tech/201604/W020160407281077548026.jpg", "多种type")); // datas.add(new TestBean("http://www.kejik.com/image/1460343965520.jpg", "多种type")); // datas.add(new TestBean("http://cn.chinadaily.com.cn/img/attachement/jpg/site1/20160318/eca86bd77be61855f1b81c.jpg", "多种type")); // datas.add(new TestBean("http://imgs.ebrun.com/resources/2016_04/2016_04_12/201604124411460430531500.jpg", "多种type")); // datas.add(new TestBean("http://imgs.ebrun.com/resources/2016_04/2016_04_24/201604244971461460826484_origin.jpeg", "多种type")); // datas.add(new TestBean("http://www.lnmoto.cn/bbs/data/attachment/forum/201408/12/074018gshshia3is1cw3sg.jpg", "多种type")); // return datas; // } // }
import android.os.Bundle; import android.support.v7.app.AppCompatActivity; import android.util.Log; import android.widget.GridView; import android.widget.ImageView; import com.bumptech.glide.Glide; import com.mcxtzhang.commonadapter.lvgv.CommonAdapter; import com.mcxtzhang.commonadapter.lvgv.ViewHolder; import java.util.ArrayList; import java.util.List; import mcxtzhang.commonviewgroupadapter.R; import mcxtzhang.commonviewgroupadapter.TestBean;
package mcxtzhang.commonviewgroupadapter.lvgv; public class GridViewActivity extends AppCompatActivity { GridView mGridView;
// Path: app/src/main/java/mcxtzhang/commonviewgroupadapter/TestBean.java // public class TestBean { // private String avatar; // private String name; // // public TestBean(String avatar, String name) { // this.avatar = avatar; // this.name = name; // } // // public String getAvatar() { // return avatar; // } // // public TestBean setAvatar(String avatar) { // this.avatar = avatar; // return this; // } // // public String getName() { // return name; // } // // public TestBean setName(String name) { // this.name = name; // return this; // } // // public static List<TestBean> initDatas() { // List<TestBean> datas = new ArrayList<>(); // datas.add(new TestBean("http://imgs.ebrun.com/resources/2016_03/2016_03_25/201603259771458878793312_origin.jpg", "张")); // datas.add(new TestBean("http://p14.go007.com/2014_11_02_05/a03541088cce31b8_1.jpg", "旭童")); // datas.add(new TestBean("http://news.k618.cn/tech/201604/W020160407281077548026.jpg", "多种type")); // datas.add(new TestBean("http://www.kejik.com/image/1460343965520.jpg", "多种type")); // datas.add(new TestBean("http://cn.chinadaily.com.cn/img/attachement/jpg/site1/20160318/eca86bd77be61855f1b81c.jpg", "多种type")); // datas.add(new TestBean("http://imgs.ebrun.com/resources/2016_04/2016_04_12/201604124411460430531500.jpg", "多种type")); // datas.add(new TestBean("http://imgs.ebrun.com/resources/2016_04/2016_04_24/201604244971461460826484_origin.jpeg", "多种type")); // datas.add(new TestBean("http://www.lnmoto.cn/bbs/data/attachment/forum/201408/12/074018gshshia3is1cw3sg.jpg", "多种type")); // return datas; // } // } // Path: app/src/main/java/mcxtzhang/commonviewgroupadapter/lvgv/GridViewActivity.java import android.os.Bundle; import android.support.v7.app.AppCompatActivity; import android.util.Log; import android.widget.GridView; import android.widget.ImageView; import com.bumptech.glide.Glide; import com.mcxtzhang.commonadapter.lvgv.CommonAdapter; import com.mcxtzhang.commonadapter.lvgv.ViewHolder; import java.util.ArrayList; import java.util.List; import mcxtzhang.commonviewgroupadapter.R; import mcxtzhang.commonviewgroupadapter.TestBean; package mcxtzhang.commonviewgroupadapter.lvgv; public class GridViewActivity extends AppCompatActivity { GridView mGridView;
private List<TestBean> mDatas;
mcxtzhang/all-base-adapter
app/src/main/java/mcxtzhang/commonviewgroupadapter/lvgv/ListViewSingleActivity.java
// Path: app/src/main/java/mcxtzhang/commonviewgroupadapter/TestBean.java // public class TestBean { // private String avatar; // private String name; // // public TestBean(String avatar, String name) { // this.avatar = avatar; // this.name = name; // } // // public String getAvatar() { // return avatar; // } // // public TestBean setAvatar(String avatar) { // this.avatar = avatar; // return this; // } // // public String getName() { // return name; // } // // public TestBean setName(String name) { // this.name = name; // return this; // } // // public static List<TestBean> initDatas() { // List<TestBean> datas = new ArrayList<>(); // datas.add(new TestBean("http://imgs.ebrun.com/resources/2016_03/2016_03_25/201603259771458878793312_origin.jpg", "张")); // datas.add(new TestBean("http://p14.go007.com/2014_11_02_05/a03541088cce31b8_1.jpg", "旭童")); // datas.add(new TestBean("http://news.k618.cn/tech/201604/W020160407281077548026.jpg", "多种type")); // datas.add(new TestBean("http://www.kejik.com/image/1460343965520.jpg", "多种type")); // datas.add(new TestBean("http://cn.chinadaily.com.cn/img/attachement/jpg/site1/20160318/eca86bd77be61855f1b81c.jpg", "多种type")); // datas.add(new TestBean("http://imgs.ebrun.com/resources/2016_04/2016_04_12/201604124411460430531500.jpg", "多种type")); // datas.add(new TestBean("http://imgs.ebrun.com/resources/2016_04/2016_04_24/201604244971461460826484_origin.jpeg", "多种type")); // datas.add(new TestBean("http://www.lnmoto.cn/bbs/data/attachment/forum/201408/12/074018gshshia3is1cw3sg.jpg", "多种type")); // return datas; // } // }
import android.os.Bundle; import android.support.v7.app.AppCompatActivity; import android.widget.ImageView; import android.widget.ListView; import com.bumptech.glide.Glide; import com.mcxtzhang.commonadapter.lvgv.CommonAdapter; import com.mcxtzhang.commonadapter.lvgv.ViewHolder; import java.util.ArrayList; import java.util.List; import mcxtzhang.commonviewgroupadapter.R; import mcxtzhang.commonviewgroupadapter.TestBean;
package mcxtzhang.commonviewgroupadapter.lvgv; public class ListViewSingleActivity extends AppCompatActivity { private static final String TAG = "zxt";
// Path: app/src/main/java/mcxtzhang/commonviewgroupadapter/TestBean.java // public class TestBean { // private String avatar; // private String name; // // public TestBean(String avatar, String name) { // this.avatar = avatar; // this.name = name; // } // // public String getAvatar() { // return avatar; // } // // public TestBean setAvatar(String avatar) { // this.avatar = avatar; // return this; // } // // public String getName() { // return name; // } // // public TestBean setName(String name) { // this.name = name; // return this; // } // // public static List<TestBean> initDatas() { // List<TestBean> datas = new ArrayList<>(); // datas.add(new TestBean("http://imgs.ebrun.com/resources/2016_03/2016_03_25/201603259771458878793312_origin.jpg", "张")); // datas.add(new TestBean("http://p14.go007.com/2014_11_02_05/a03541088cce31b8_1.jpg", "旭童")); // datas.add(new TestBean("http://news.k618.cn/tech/201604/W020160407281077548026.jpg", "多种type")); // datas.add(new TestBean("http://www.kejik.com/image/1460343965520.jpg", "多种type")); // datas.add(new TestBean("http://cn.chinadaily.com.cn/img/attachement/jpg/site1/20160318/eca86bd77be61855f1b81c.jpg", "多种type")); // datas.add(new TestBean("http://imgs.ebrun.com/resources/2016_04/2016_04_12/201604124411460430531500.jpg", "多种type")); // datas.add(new TestBean("http://imgs.ebrun.com/resources/2016_04/2016_04_24/201604244971461460826484_origin.jpeg", "多种type")); // datas.add(new TestBean("http://www.lnmoto.cn/bbs/data/attachment/forum/201408/12/074018gshshia3is1cw3sg.jpg", "多种type")); // return datas; // } // } // Path: app/src/main/java/mcxtzhang/commonviewgroupadapter/lvgv/ListViewSingleActivity.java import android.os.Bundle; import android.support.v7.app.AppCompatActivity; import android.widget.ImageView; import android.widget.ListView; import com.bumptech.glide.Glide; import com.mcxtzhang.commonadapter.lvgv.CommonAdapter; import com.mcxtzhang.commonadapter.lvgv.ViewHolder; import java.util.ArrayList; import java.util.List; import mcxtzhang.commonviewgroupadapter.R; import mcxtzhang.commonviewgroupadapter.TestBean; package mcxtzhang.commonviewgroupadapter.lvgv; public class ListViewSingleActivity extends AppCompatActivity { private static final String TAG = "zxt";
private List<TestBean> mDatas;
mcxtzhang/all-base-adapter
app/src/main/java/mcxtzhang/commonviewgroupadapter/rv/header/HeaderBean.java
// Path: app/src/main/java/mcxtzhang/commonviewgroupadapter/rv/mul/RvMulTypeMulBeanActivity.java // public class RvMulTypeMulBeanActivity extends AppCompatActivity { // // private List<IMulTypeHelper> mDatas; // // @Override // protected void onCreate(Bundle savedInstanceState) { // super.onCreate(savedInstanceState); // setContentView(R.layout.activity_rv_mul_type_mul_bean); // RecyclerView recyclerView = (RecyclerView) findViewById(R.id.activity_rv_mul_type_mul_bean); // recyclerView.setLayoutManager(new LinearLayoutManager(this)); // mDatas = initDatas(); // // recyclerView.setAdapter(new BaseMulTypeAdapter(this, mDatas) { // @Override // public void convert(ViewHolder holder, final IMulTypeHelper iMulTypeHelper) { // super.convert(holder, iMulTypeHelper); // // switch (iMulTypeHelper.getItemLayoutId()) { // case R.layout.item_rv_mulbean_1: // holder.setOnClickListener(R.id.tv, new View.OnClickListener() { // @Override // public void onClick(View view) { // MulTypeMulBean1 mulTypeMulBean1 = (MulTypeMulBean1) iMulTypeHelper; // Toast.makeText(mContext, mulTypeMulBean1.getName(), Toast.LENGTH_SHORT).show(); // } // }); // break; // case R.layout.item_rv_mulbean_2: // holder.setOnClickListener(R.id.banner, new View.OnClickListener() { // @Override // public void onClick(View view) { // Toast.makeText(mContext, "你想调到哪里", Toast.LENGTH_SHORT).show(); // } // }); // break; // } // } // }); // // } // // // public List<IMulTypeHelper> initDatas() { // List<IMulTypeHelper> datas = new ArrayList<>(); // datas.add(new MulTypeMulBean2("http://desk.fd.zol-img.com.cn/t_s960x600c5/g5/M00/01/0E/ChMkJlbKwaOIN8zJAAs5DadIS-IAALGbQPo5ngACzkl365.jpg")); // // datas.add(new MulTypeMulBean1("http://imgs.ebrun.com/resources/2016_04/2016_04_12/201604124411460430531500.jpg", "多种type")); // datas.add(new MulTypeMulBean1("http://imgs.ebrun.com/resources/2016_03/2016_03_25/201603259771458878793312_origin.jpg", "张")); // // datas.add(new MulTypeMulBean2("http://cdn.duitang.com/uploads/item/201610/20/20161020070310_c5xWi.jpeg")); // // datas.add(new MulTypeMulBean1("http://p14.go007.com/2014_11_02_05/a03541088cce31b8_1.jpg", "旭童")); // datas.add(new MulTypeMulBean1("http://news.k618.cn/tech/201604/W020160407281077548026.jpg", "多种type")); // datas.add(new MulTypeMulBean1("http://www.kejik.com/image/1460343965520.jpg", "多种type")); // datas.add(new MulTypeMulBean1("http://cn.chinadaily.com.cn/img/attachement/jpg/site1/20160318/eca86bd77be61855f1b81c.jpg", "多种type")); // // datas.add(new MulTypeMulBean2("http://img.pconline.com.cn/images/upload/upc/tx/wallpaper/1512/31/c4/17105160_1451572371249_800x800.jpg")); // // datas.add(new MulTypeMulBean1("http://imgs.ebrun.com/resources/2016_04/2016_04_24/201604244971461460826484_origin.jpeg", "多种type")); // datas.add(new MulTypeMulBean1("http://www.lnmoto.cn/bbs/data/attachment/forum/201408/12/074018gshshia3is1cw3sg.jpg", "多种type")); // return datas; // } // }
import android.content.Intent; import android.view.View; import com.mcxtzhang.commonadapter.rv.IHeaderHelper; import com.mcxtzhang.commonadapter.rv.ViewHolder; import mcxtzhang.commonviewgroupadapter.R; import mcxtzhang.commonviewgroupadapter.rv.mul.RvMulTypeMulBeanActivity;
package mcxtzhang.commonviewgroupadapter.rv.header; /** * 介绍: * 作者:zhangxutong * 邮箱:mcxtzhang@163.com * 主页:http://blog.csdn.net/zxt0601 * 时间: 17/01/08. */ public class HeaderBean implements IHeaderHelper { private String text; public HeaderBean(String text) { this.text = text; } public String getText() { return text; } public HeaderBean setText(String text) { this.text = text; return this; } @Override public int getItemLayoutId() { return R.layout.header_banner; } @Override public void onBind(final ViewHolder holder) { holder.setText(R.id.tv, text); holder.setOnClickListener(R.id.tv, new View.OnClickListener() { @Override public void onClick(View v) { //点击跳转到多ItemType
// Path: app/src/main/java/mcxtzhang/commonviewgroupadapter/rv/mul/RvMulTypeMulBeanActivity.java // public class RvMulTypeMulBeanActivity extends AppCompatActivity { // // private List<IMulTypeHelper> mDatas; // // @Override // protected void onCreate(Bundle savedInstanceState) { // super.onCreate(savedInstanceState); // setContentView(R.layout.activity_rv_mul_type_mul_bean); // RecyclerView recyclerView = (RecyclerView) findViewById(R.id.activity_rv_mul_type_mul_bean); // recyclerView.setLayoutManager(new LinearLayoutManager(this)); // mDatas = initDatas(); // // recyclerView.setAdapter(new BaseMulTypeAdapter(this, mDatas) { // @Override // public void convert(ViewHolder holder, final IMulTypeHelper iMulTypeHelper) { // super.convert(holder, iMulTypeHelper); // // switch (iMulTypeHelper.getItemLayoutId()) { // case R.layout.item_rv_mulbean_1: // holder.setOnClickListener(R.id.tv, new View.OnClickListener() { // @Override // public void onClick(View view) { // MulTypeMulBean1 mulTypeMulBean1 = (MulTypeMulBean1) iMulTypeHelper; // Toast.makeText(mContext, mulTypeMulBean1.getName(), Toast.LENGTH_SHORT).show(); // } // }); // break; // case R.layout.item_rv_mulbean_2: // holder.setOnClickListener(R.id.banner, new View.OnClickListener() { // @Override // public void onClick(View view) { // Toast.makeText(mContext, "你想调到哪里", Toast.LENGTH_SHORT).show(); // } // }); // break; // } // } // }); // // } // // // public List<IMulTypeHelper> initDatas() { // List<IMulTypeHelper> datas = new ArrayList<>(); // datas.add(new MulTypeMulBean2("http://desk.fd.zol-img.com.cn/t_s960x600c5/g5/M00/01/0E/ChMkJlbKwaOIN8zJAAs5DadIS-IAALGbQPo5ngACzkl365.jpg")); // // datas.add(new MulTypeMulBean1("http://imgs.ebrun.com/resources/2016_04/2016_04_12/201604124411460430531500.jpg", "多种type")); // datas.add(new MulTypeMulBean1("http://imgs.ebrun.com/resources/2016_03/2016_03_25/201603259771458878793312_origin.jpg", "张")); // // datas.add(new MulTypeMulBean2("http://cdn.duitang.com/uploads/item/201610/20/20161020070310_c5xWi.jpeg")); // // datas.add(new MulTypeMulBean1("http://p14.go007.com/2014_11_02_05/a03541088cce31b8_1.jpg", "旭童")); // datas.add(new MulTypeMulBean1("http://news.k618.cn/tech/201604/W020160407281077548026.jpg", "多种type")); // datas.add(new MulTypeMulBean1("http://www.kejik.com/image/1460343965520.jpg", "多种type")); // datas.add(new MulTypeMulBean1("http://cn.chinadaily.com.cn/img/attachement/jpg/site1/20160318/eca86bd77be61855f1b81c.jpg", "多种type")); // // datas.add(new MulTypeMulBean2("http://img.pconline.com.cn/images/upload/upc/tx/wallpaper/1512/31/c4/17105160_1451572371249_800x800.jpg")); // // datas.add(new MulTypeMulBean1("http://imgs.ebrun.com/resources/2016_04/2016_04_24/201604244971461460826484_origin.jpeg", "多种type")); // datas.add(new MulTypeMulBean1("http://www.lnmoto.cn/bbs/data/attachment/forum/201408/12/074018gshshia3is1cw3sg.jpg", "多种type")); // return datas; // } // } // Path: app/src/main/java/mcxtzhang/commonviewgroupadapter/rv/header/HeaderBean.java import android.content.Intent; import android.view.View; import com.mcxtzhang.commonadapter.rv.IHeaderHelper; import com.mcxtzhang.commonadapter.rv.ViewHolder; import mcxtzhang.commonviewgroupadapter.R; import mcxtzhang.commonviewgroupadapter.rv.mul.RvMulTypeMulBeanActivity; package mcxtzhang.commonviewgroupadapter.rv.header; /** * 介绍: * 作者:zhangxutong * 邮箱:mcxtzhang@163.com * 主页:http://blog.csdn.net/zxt0601 * 时间: 17/01/08. */ public class HeaderBean implements IHeaderHelper { private String text; public HeaderBean(String text) { this.text = text; } public String getText() { return text; } public HeaderBean setText(String text) { this.text = text; return this; } @Override public int getItemLayoutId() { return R.layout.header_banner; } @Override public void onBind(final ViewHolder holder) { holder.setText(R.id.tv, text); holder.setOnClickListener(R.id.tv, new View.OnClickListener() { @Override public void onClick(View v) { //点击跳转到多ItemType
holder.itemView.getContext().startActivity(new Intent(holder.itemView.getContext(), RvMulTypeMulBeanActivity.class));
artivisi/biller-simulator
biller-simulator-gateway-pln/src/test/java/com/artivisi/ppob/simulator/gateway/pln/NetworkManagementTest.java
// Path: biller-simulator-gateway-pln/src/main/java/com/artivisi/biller/simulator/gateway/pln/constants/MTIConstants.java // public abstract class MTIConstants { // public static final String NETWORK_MANAGEMENT_REQUEST = "0800"; // public static final String NETWORK_MANAGEMENT_RESPONSE = "0810"; // public static final String INQUIRY_REQUEST = "0100"; // public static final String INQUIRY_RESPONSE = "0110"; // public static final String PAYMENT_REQUEST = "0200"; // public static final String PAYMENT_RESPONSE = "0210"; // public static final String REVERSAL_REQUEST = "0400"; // public static final String REVERSAL_RESPONSE = "0410"; // public static final String REVERSAL_REPEAT_REQUEST = "0401"; // public static final String REVERSAL_REPEAT_RESPONSE = "0411"; // } // // Path: biller-simulator-gateway-pln/src/main/java/com/artivisi/biller/simulator/gateway/pln/jpos/PlnChannel.java // public class PlnChannel extends BaseChannel { // private static final int MAX_MSG_LENGTH = 4096; // private static final int MSG_TRAILER = 255; // // @Override // protected void sendMessageTrailler(ISOMsg m, int len) throws IOException { // serverOut.write(MSG_TRAILER); // } // // @Override // protected byte[] streamReceive() throws IOException { // byte[] buf = new byte[MAX_MSG_LENGTH]; // int len = 0; // for (len = 0; len < MAX_MSG_LENGTH; len++) { // int data = serverIn.read(); // if (data == MSG_TRAILER) { // break; // } // buf[len] = (byte) data; // } // if (len == MAX_MSG_LENGTH) { // throw new IOException("packet too long"); // } // // byte[] d = new byte[len]; // System.arraycopy(buf, 0, d, 0, len); // return d; // } // // @Override // public ISOMsg receive() throws IOException, ISOException { // try { // return super.receive(); // } catch (SocketTimeoutException err) { // // tidak dapat response sampai timeout, gpp return null saja // return null; // } // } // // // constructor default override // public PlnChannel(ISOPackager p, ServerSocket serverSocket) // throws IOException { // super(p, serverSocket); // } // // public PlnChannel(ISOPackager p) throws IOException { // super(p); // } // // public PlnChannel(String host, int port, ISOPackager p) { // super(host, port, p); // } // // public PlnChannel() { // } // }
import static org.junit.Assert.assertEquals; import org.jpos.iso.ISOMsg; import org.junit.Test; import com.artivisi.biller.simulator.gateway.pln.constants.MTIConstants; import com.artivisi.biller.simulator.gateway.pln.jpos.PlnChannel;
/** * Copyright (C) 2011 ArtiVisi Intermedia <info@artivisi.com> * * 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 com.artivisi.ppob.simulator.gateway.pln; public class NetworkManagementTest extends BaseTest { @Test public void testSignon() throws Exception { ISOMsg msg = new ISOMsg();
// Path: biller-simulator-gateway-pln/src/main/java/com/artivisi/biller/simulator/gateway/pln/constants/MTIConstants.java // public abstract class MTIConstants { // public static final String NETWORK_MANAGEMENT_REQUEST = "0800"; // public static final String NETWORK_MANAGEMENT_RESPONSE = "0810"; // public static final String INQUIRY_REQUEST = "0100"; // public static final String INQUIRY_RESPONSE = "0110"; // public static final String PAYMENT_REQUEST = "0200"; // public static final String PAYMENT_RESPONSE = "0210"; // public static final String REVERSAL_REQUEST = "0400"; // public static final String REVERSAL_RESPONSE = "0410"; // public static final String REVERSAL_REPEAT_REQUEST = "0401"; // public static final String REVERSAL_REPEAT_RESPONSE = "0411"; // } // // Path: biller-simulator-gateway-pln/src/main/java/com/artivisi/biller/simulator/gateway/pln/jpos/PlnChannel.java // public class PlnChannel extends BaseChannel { // private static final int MAX_MSG_LENGTH = 4096; // private static final int MSG_TRAILER = 255; // // @Override // protected void sendMessageTrailler(ISOMsg m, int len) throws IOException { // serverOut.write(MSG_TRAILER); // } // // @Override // protected byte[] streamReceive() throws IOException { // byte[] buf = new byte[MAX_MSG_LENGTH]; // int len = 0; // for (len = 0; len < MAX_MSG_LENGTH; len++) { // int data = serverIn.read(); // if (data == MSG_TRAILER) { // break; // } // buf[len] = (byte) data; // } // if (len == MAX_MSG_LENGTH) { // throw new IOException("packet too long"); // } // // byte[] d = new byte[len]; // System.arraycopy(buf, 0, d, 0, len); // return d; // } // // @Override // public ISOMsg receive() throws IOException, ISOException { // try { // return super.receive(); // } catch (SocketTimeoutException err) { // // tidak dapat response sampai timeout, gpp return null saja // return null; // } // } // // // constructor default override // public PlnChannel(ISOPackager p, ServerSocket serverSocket) // throws IOException { // super(p, serverSocket); // } // // public PlnChannel(ISOPackager p) throws IOException { // super(p); // } // // public PlnChannel(String host, int port, ISOPackager p) { // super(host, port, p); // } // // public PlnChannel() { // } // } // Path: biller-simulator-gateway-pln/src/test/java/com/artivisi/ppob/simulator/gateway/pln/NetworkManagementTest.java import static org.junit.Assert.assertEquals; import org.jpos.iso.ISOMsg; import org.junit.Test; import com.artivisi.biller.simulator.gateway.pln.constants.MTIConstants; import com.artivisi.biller.simulator.gateway.pln.jpos.PlnChannel; /** * Copyright (C) 2011 ArtiVisi Intermedia <info@artivisi.com> * * 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 com.artivisi.ppob.simulator.gateway.pln; public class NetworkManagementTest extends BaseTest { @Test public void testSignon() throws Exception { ISOMsg msg = new ISOMsg();
msg.setMTI(MTIConstants.NETWORK_MANAGEMENT_REQUEST);
artivisi/biller-simulator
biller-simulator-gateway-pln/src/test/java/com/artivisi/ppob/simulator/gateway/pln/NetworkManagementTest.java
// Path: biller-simulator-gateway-pln/src/main/java/com/artivisi/biller/simulator/gateway/pln/constants/MTIConstants.java // public abstract class MTIConstants { // public static final String NETWORK_MANAGEMENT_REQUEST = "0800"; // public static final String NETWORK_MANAGEMENT_RESPONSE = "0810"; // public static final String INQUIRY_REQUEST = "0100"; // public static final String INQUIRY_RESPONSE = "0110"; // public static final String PAYMENT_REQUEST = "0200"; // public static final String PAYMENT_RESPONSE = "0210"; // public static final String REVERSAL_REQUEST = "0400"; // public static final String REVERSAL_RESPONSE = "0410"; // public static final String REVERSAL_REPEAT_REQUEST = "0401"; // public static final String REVERSAL_REPEAT_RESPONSE = "0411"; // } // // Path: biller-simulator-gateway-pln/src/main/java/com/artivisi/biller/simulator/gateway/pln/jpos/PlnChannel.java // public class PlnChannel extends BaseChannel { // private static final int MAX_MSG_LENGTH = 4096; // private static final int MSG_TRAILER = 255; // // @Override // protected void sendMessageTrailler(ISOMsg m, int len) throws IOException { // serverOut.write(MSG_TRAILER); // } // // @Override // protected byte[] streamReceive() throws IOException { // byte[] buf = new byte[MAX_MSG_LENGTH]; // int len = 0; // for (len = 0; len < MAX_MSG_LENGTH; len++) { // int data = serverIn.read(); // if (data == MSG_TRAILER) { // break; // } // buf[len] = (byte) data; // } // if (len == MAX_MSG_LENGTH) { // throw new IOException("packet too long"); // } // // byte[] d = new byte[len]; // System.arraycopy(buf, 0, d, 0, len); // return d; // } // // @Override // public ISOMsg receive() throws IOException, ISOException { // try { // return super.receive(); // } catch (SocketTimeoutException err) { // // tidak dapat response sampai timeout, gpp return null saja // return null; // } // } // // // constructor default override // public PlnChannel(ISOPackager p, ServerSocket serverSocket) // throws IOException { // super(p, serverSocket); // } // // public PlnChannel(ISOPackager p) throws IOException { // super(p); // } // // public PlnChannel(String host, int port, ISOPackager p) { // super(host, port, p); // } // // public PlnChannel() { // } // }
import static org.junit.Assert.assertEquals; import org.jpos.iso.ISOMsg; import org.junit.Test; import com.artivisi.biller.simulator.gateway.pln.constants.MTIConstants; import com.artivisi.biller.simulator.gateway.pln.jpos.PlnChannel;
/** * Copyright (C) 2011 ArtiVisi Intermedia <info@artivisi.com> * * 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 com.artivisi.ppob.simulator.gateway.pln; public class NetworkManagementTest extends BaseTest { @Test public void testSignon() throws Exception { ISOMsg msg = new ISOMsg(); msg.setMTI(MTIConstants.NETWORK_MANAGEMENT_REQUEST); msg.set(70, "001");
// Path: biller-simulator-gateway-pln/src/main/java/com/artivisi/biller/simulator/gateway/pln/constants/MTIConstants.java // public abstract class MTIConstants { // public static final String NETWORK_MANAGEMENT_REQUEST = "0800"; // public static final String NETWORK_MANAGEMENT_RESPONSE = "0810"; // public static final String INQUIRY_REQUEST = "0100"; // public static final String INQUIRY_RESPONSE = "0110"; // public static final String PAYMENT_REQUEST = "0200"; // public static final String PAYMENT_RESPONSE = "0210"; // public static final String REVERSAL_REQUEST = "0400"; // public static final String REVERSAL_RESPONSE = "0410"; // public static final String REVERSAL_REPEAT_REQUEST = "0401"; // public static final String REVERSAL_REPEAT_RESPONSE = "0411"; // } // // Path: biller-simulator-gateway-pln/src/main/java/com/artivisi/biller/simulator/gateway/pln/jpos/PlnChannel.java // public class PlnChannel extends BaseChannel { // private static final int MAX_MSG_LENGTH = 4096; // private static final int MSG_TRAILER = 255; // // @Override // protected void sendMessageTrailler(ISOMsg m, int len) throws IOException { // serverOut.write(MSG_TRAILER); // } // // @Override // protected byte[] streamReceive() throws IOException { // byte[] buf = new byte[MAX_MSG_LENGTH]; // int len = 0; // for (len = 0; len < MAX_MSG_LENGTH; len++) { // int data = serverIn.read(); // if (data == MSG_TRAILER) { // break; // } // buf[len] = (byte) data; // } // if (len == MAX_MSG_LENGTH) { // throw new IOException("packet too long"); // } // // byte[] d = new byte[len]; // System.arraycopy(buf, 0, d, 0, len); // return d; // } // // @Override // public ISOMsg receive() throws IOException, ISOException { // try { // return super.receive(); // } catch (SocketTimeoutException err) { // // tidak dapat response sampai timeout, gpp return null saja // return null; // } // } // // // constructor default override // public PlnChannel(ISOPackager p, ServerSocket serverSocket) // throws IOException { // super(p, serverSocket); // } // // public PlnChannel(ISOPackager p) throws IOException { // super(p); // } // // public PlnChannel(String host, int port, ISOPackager p) { // super(host, port, p); // } // // public PlnChannel() { // } // } // Path: biller-simulator-gateway-pln/src/test/java/com/artivisi/ppob/simulator/gateway/pln/NetworkManagementTest.java import static org.junit.Assert.assertEquals; import org.jpos.iso.ISOMsg; import org.junit.Test; import com.artivisi.biller.simulator.gateway.pln.constants.MTIConstants; import com.artivisi.biller.simulator.gateway.pln.jpos.PlnChannel; /** * Copyright (C) 2011 ArtiVisi Intermedia <info@artivisi.com> * * 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 com.artivisi.ppob.simulator.gateway.pln; public class NetworkManagementTest extends BaseTest { @Test public void testSignon() throws Exception { ISOMsg msg = new ISOMsg(); msg.setMTI(MTIConstants.NETWORK_MANAGEMENT_REQUEST); msg.set(70, "001");
PlnChannel channel = createChannel();
artivisi/biller-simulator
biller-simulator-service-impl/src/main/java/com/artivisi/biller/simulator/service/impl/BillerSimulatorServiceImpl.java
// Path: biller-simulator-domain/src/main/java/com/artivisi/biller/simulator/entity/Bank.java // @Entity @Table(name="m_bank") // public class Bank { // // @Id @GeneratedValue(generator = "system-uuid") // @GenericGenerator(name = "system-uuid", strategy = "uuid") // private String id; // // @Column(nullable=false, unique=true) // private String kode; // @Column(nullable=false) // private String nama; // public String getId() { // return id; // } // public void setId(String id) { // this.id = id; // } // public String getKode() { // return kode; // } // public void setKode(String kode) { // this.kode = kode; // } // public String getNama() { // return nama; // } // public void setNama(String nama) { // this.nama = nama; // } // // // } // // Path: biller-simulator-domain/src/main/java/com/artivisi/biller/simulator/entity/Mitra.java // @Entity @Table(name="m_mitra") // public class Mitra { // @Id @GeneratedValue(generator = "system-uuid") // @GenericGenerator(name = "system-uuid", strategy = "uuid") // private String id; // @Column(nullable=false, unique=true) // private String kode; // @Column(nullable=false) // private String nama; // // @Column(nullable=false, name="admin_fee") // private BigDecimal adminFee = BigDecimal.ZERO; // // public String getId() { // return id; // } // // public void setId(String id) { // this.id = id; // } // // public String getKode() { // return kode; // } // // public void setKode(String kode) { // this.kode = kode; // } // // public String getNama() { // return nama; // } // // public void setNama(String nama) { // this.nama = nama; // } // // public BigDecimal getAdminFee() { // return adminFee; // } // // public void setAdminFee(BigDecimal adminFee) { // this.adminFee = adminFee; // } // // // } // // Path: biller-simulator-domain/src/main/java/com/artivisi/biller/simulator/service/BillerSimulatorService.java // public interface BillerSimulatorService { // public void save(Bank bank); // public void delete(Bank bank); // public Bank findBankById(String id); // public Bank findBankByKode(String kode); // public List<Bank> findAllBank(); // // public void save(Mitra mitra); // public void delete(Mitra mitra); // public Mitra findMitraById(String id); // public Mitra findMitraByKode(String kode); // public List<Mitra> findAllMitra(); // }
import java.util.List; import org.hibernate.SessionFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import org.springframework.util.StringUtils; import com.artivisi.biller.simulator.entity.Bank; import com.artivisi.biller.simulator.entity.Mitra; import com.artivisi.biller.simulator.service.BillerSimulatorService;
/** * Copyright (C) 2011 ArtiVisi Intermedia <info@artivisi.com> * * 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 com.artivisi.biller.simulator.service.impl; @Service("billerSimulatorService") @Transactional public class BillerSimulatorServiceImpl implements BillerSimulatorService { @Autowired private SessionFactory sessionFactory; @Override
// Path: biller-simulator-domain/src/main/java/com/artivisi/biller/simulator/entity/Bank.java // @Entity @Table(name="m_bank") // public class Bank { // // @Id @GeneratedValue(generator = "system-uuid") // @GenericGenerator(name = "system-uuid", strategy = "uuid") // private String id; // // @Column(nullable=false, unique=true) // private String kode; // @Column(nullable=false) // private String nama; // public String getId() { // return id; // } // public void setId(String id) { // this.id = id; // } // public String getKode() { // return kode; // } // public void setKode(String kode) { // this.kode = kode; // } // public String getNama() { // return nama; // } // public void setNama(String nama) { // this.nama = nama; // } // // // } // // Path: biller-simulator-domain/src/main/java/com/artivisi/biller/simulator/entity/Mitra.java // @Entity @Table(name="m_mitra") // public class Mitra { // @Id @GeneratedValue(generator = "system-uuid") // @GenericGenerator(name = "system-uuid", strategy = "uuid") // private String id; // @Column(nullable=false, unique=true) // private String kode; // @Column(nullable=false) // private String nama; // // @Column(nullable=false, name="admin_fee") // private BigDecimal adminFee = BigDecimal.ZERO; // // public String getId() { // return id; // } // // public void setId(String id) { // this.id = id; // } // // public String getKode() { // return kode; // } // // public void setKode(String kode) { // this.kode = kode; // } // // public String getNama() { // return nama; // } // // public void setNama(String nama) { // this.nama = nama; // } // // public BigDecimal getAdminFee() { // return adminFee; // } // // public void setAdminFee(BigDecimal adminFee) { // this.adminFee = adminFee; // } // // // } // // Path: biller-simulator-domain/src/main/java/com/artivisi/biller/simulator/service/BillerSimulatorService.java // public interface BillerSimulatorService { // public void save(Bank bank); // public void delete(Bank bank); // public Bank findBankById(String id); // public Bank findBankByKode(String kode); // public List<Bank> findAllBank(); // // public void save(Mitra mitra); // public void delete(Mitra mitra); // public Mitra findMitraById(String id); // public Mitra findMitraByKode(String kode); // public List<Mitra> findAllMitra(); // } // Path: biller-simulator-service-impl/src/main/java/com/artivisi/biller/simulator/service/impl/BillerSimulatorServiceImpl.java import java.util.List; import org.hibernate.SessionFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import org.springframework.util.StringUtils; import com.artivisi.biller.simulator.entity.Bank; import com.artivisi.biller.simulator.entity.Mitra; import com.artivisi.biller.simulator.service.BillerSimulatorService; /** * Copyright (C) 2011 ArtiVisi Intermedia <info@artivisi.com> * * 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 com.artivisi.biller.simulator.service.impl; @Service("billerSimulatorService") @Transactional public class BillerSimulatorServiceImpl implements BillerSimulatorService { @Autowired private SessionFactory sessionFactory; @Override
public void save(Bank bank) {
artivisi/biller-simulator
biller-simulator-service-impl/src/main/java/com/artivisi/biller/simulator/service/impl/BillerSimulatorServiceImpl.java
// Path: biller-simulator-domain/src/main/java/com/artivisi/biller/simulator/entity/Bank.java // @Entity @Table(name="m_bank") // public class Bank { // // @Id @GeneratedValue(generator = "system-uuid") // @GenericGenerator(name = "system-uuid", strategy = "uuid") // private String id; // // @Column(nullable=false, unique=true) // private String kode; // @Column(nullable=false) // private String nama; // public String getId() { // return id; // } // public void setId(String id) { // this.id = id; // } // public String getKode() { // return kode; // } // public void setKode(String kode) { // this.kode = kode; // } // public String getNama() { // return nama; // } // public void setNama(String nama) { // this.nama = nama; // } // // // } // // Path: biller-simulator-domain/src/main/java/com/artivisi/biller/simulator/entity/Mitra.java // @Entity @Table(name="m_mitra") // public class Mitra { // @Id @GeneratedValue(generator = "system-uuid") // @GenericGenerator(name = "system-uuid", strategy = "uuid") // private String id; // @Column(nullable=false, unique=true) // private String kode; // @Column(nullable=false) // private String nama; // // @Column(nullable=false, name="admin_fee") // private BigDecimal adminFee = BigDecimal.ZERO; // // public String getId() { // return id; // } // // public void setId(String id) { // this.id = id; // } // // public String getKode() { // return kode; // } // // public void setKode(String kode) { // this.kode = kode; // } // // public String getNama() { // return nama; // } // // public void setNama(String nama) { // this.nama = nama; // } // // public BigDecimal getAdminFee() { // return adminFee; // } // // public void setAdminFee(BigDecimal adminFee) { // this.adminFee = adminFee; // } // // // } // // Path: biller-simulator-domain/src/main/java/com/artivisi/biller/simulator/service/BillerSimulatorService.java // public interface BillerSimulatorService { // public void save(Bank bank); // public void delete(Bank bank); // public Bank findBankById(String id); // public Bank findBankByKode(String kode); // public List<Bank> findAllBank(); // // public void save(Mitra mitra); // public void delete(Mitra mitra); // public Mitra findMitraById(String id); // public Mitra findMitraByKode(String kode); // public List<Mitra> findAllMitra(); // }
import java.util.List; import org.hibernate.SessionFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import org.springframework.util.StringUtils; import com.artivisi.biller.simulator.entity.Bank; import com.artivisi.biller.simulator.entity.Mitra; import com.artivisi.biller.simulator.service.BillerSimulatorService;
@Override public void delete(Bank bank) { if(bank == null || !StringUtils.hasText(bank.getId())) { return; } sessionFactory.getCurrentSession().delete(bank); } @Override public Bank findBankById(String id) { if(!StringUtils.hasText(id)) return null; return (Bank) sessionFactory.getCurrentSession().get(Bank.class, id); } @SuppressWarnings("unchecked") @Override public List<Bank> findAllBank() { return sessionFactory.getCurrentSession().createQuery("from Bank order by kode").list(); } @Override public Bank findBankByKode(String kode) { if(!StringUtils.hasText(kode)) return null; return (Bank) sessionFactory.getCurrentSession().createQuery("from Bank where kode = :kode") .setString("kode", kode.trim()) .uniqueResult(); } @Override
// Path: biller-simulator-domain/src/main/java/com/artivisi/biller/simulator/entity/Bank.java // @Entity @Table(name="m_bank") // public class Bank { // // @Id @GeneratedValue(generator = "system-uuid") // @GenericGenerator(name = "system-uuid", strategy = "uuid") // private String id; // // @Column(nullable=false, unique=true) // private String kode; // @Column(nullable=false) // private String nama; // public String getId() { // return id; // } // public void setId(String id) { // this.id = id; // } // public String getKode() { // return kode; // } // public void setKode(String kode) { // this.kode = kode; // } // public String getNama() { // return nama; // } // public void setNama(String nama) { // this.nama = nama; // } // // // } // // Path: biller-simulator-domain/src/main/java/com/artivisi/biller/simulator/entity/Mitra.java // @Entity @Table(name="m_mitra") // public class Mitra { // @Id @GeneratedValue(generator = "system-uuid") // @GenericGenerator(name = "system-uuid", strategy = "uuid") // private String id; // @Column(nullable=false, unique=true) // private String kode; // @Column(nullable=false) // private String nama; // // @Column(nullable=false, name="admin_fee") // private BigDecimal adminFee = BigDecimal.ZERO; // // public String getId() { // return id; // } // // public void setId(String id) { // this.id = id; // } // // public String getKode() { // return kode; // } // // public void setKode(String kode) { // this.kode = kode; // } // // public String getNama() { // return nama; // } // // public void setNama(String nama) { // this.nama = nama; // } // // public BigDecimal getAdminFee() { // return adminFee; // } // // public void setAdminFee(BigDecimal adminFee) { // this.adminFee = adminFee; // } // // // } // // Path: biller-simulator-domain/src/main/java/com/artivisi/biller/simulator/service/BillerSimulatorService.java // public interface BillerSimulatorService { // public void save(Bank bank); // public void delete(Bank bank); // public Bank findBankById(String id); // public Bank findBankByKode(String kode); // public List<Bank> findAllBank(); // // public void save(Mitra mitra); // public void delete(Mitra mitra); // public Mitra findMitraById(String id); // public Mitra findMitraByKode(String kode); // public List<Mitra> findAllMitra(); // } // Path: biller-simulator-service-impl/src/main/java/com/artivisi/biller/simulator/service/impl/BillerSimulatorServiceImpl.java import java.util.List; import org.hibernate.SessionFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import org.springframework.util.StringUtils; import com.artivisi.biller.simulator.entity.Bank; import com.artivisi.biller.simulator.entity.Mitra; import com.artivisi.biller.simulator.service.BillerSimulatorService; @Override public void delete(Bank bank) { if(bank == null || !StringUtils.hasText(bank.getId())) { return; } sessionFactory.getCurrentSession().delete(bank); } @Override public Bank findBankById(String id) { if(!StringUtils.hasText(id)) return null; return (Bank) sessionFactory.getCurrentSession().get(Bank.class, id); } @SuppressWarnings("unchecked") @Override public List<Bank> findAllBank() { return sessionFactory.getCurrentSession().createQuery("from Bank order by kode").list(); } @Override public Bank findBankByKode(String kode) { if(!StringUtils.hasText(kode)) return null; return (Bank) sessionFactory.getCurrentSession().createQuery("from Bank where kode = :kode") .setString("kode", kode.trim()) .uniqueResult(); } @Override
public void save(Mitra mitra) {
artivisi/biller-simulator
biller-simulator-gateway-pln/src/main/java/com/artivisi/biller/simulator/gateway/pln/service/impl/PlnServiceImpl.java
// Path: biller-simulator-gateway-pln/src/main/java/com/artivisi/biller/simulator/gateway/pln/entity/InquiryPostpaidResponse.java // @Entity @Table(name="inquiry_postpaid_response") // public class InquiryPostpaidResponse { // // @Id @GeneratedValue(generator = "system-uuid") // @GenericGenerator(name = "system-uuid", strategy = "uuid") // private String id; // // @Column(nullable=false) // private String switcher; // @Column(nullable=false) // private String bank; // @Column(nullable=false) // private String stan; // // @OneToMany(mappedBy="inquiryPostpaidResponse", cascade=CascadeType.ALL, orphanRemoval=true) // private List<InquiryPostpaidResponseDetail> details = new ArrayList<InquiryPostpaidResponseDetail>(); // // public List<InquiryPostpaidResponseDetail> getDetails() { // return details; // } // public void setDetails(List<InquiryPostpaidResponseDetail> details) { // this.details = details; // } // public String getId() { // return id; // } // public void setId(String id) { // this.id = id; // } // public String getSwitcher() { // return switcher; // } // public void setSwitcher(String switcher) { // this.switcher = switcher; // } // public String getBank() { // return bank; // } // public void setBank(String bank) { // this.bank = bank; // } // public String getStan() { // return stan; // } // public void setStan(String stan) { // this.stan = stan; // } // } // // Path: biller-simulator-gateway-pln/src/main/java/com/artivisi/biller/simulator/gateway/pln/entity/InquiryPostpaidResponseDetail.java // @Entity @Table(name="inquiry_postpaid_response_detail") // public class InquiryPostpaidResponseDetail { // @Id @GeneratedValue(generator = "system-uuid") // @GenericGenerator(name = "system-uuid", strategy = "uuid") // private String id; // // @ManyToOne // @JoinColumn(name="id_inquiry_postpaid_response", nullable=false) // private InquiryPostpaidResponse inquiryPostpaidResponse; // // @ManyToOne // @JoinColumn(name="id_tagihan_pascabayar", nullable=false) // private TagihanPascabayar tagihanPascabayar; // // public String getId() { // return id; // } // // public void setId(String id) { // this.id = id; // } // // public InquiryPostpaidResponse getInquiryPostpaidResponse() { // return inquiryPostpaidResponse; // } // // public void setInquiryPostpaidResponse( // InquiryPostpaidResponse inquiryPostpaidResponse) { // this.inquiryPostpaidResponse = inquiryPostpaidResponse; // } // // public TagihanPascabayar getTagihanPascabayar() { // return tagihanPascabayar; // } // // public void setTagihanPascabayar(TagihanPascabayar tagihanPascabayar) { // this.tagihanPascabayar = tagihanPascabayar; // } // // // } // // Path: biller-simulator-gateway-pln/src/main/java/com/artivisi/biller/simulator/gateway/pln/service/PlnService.java // public interface PlnService { // public void save(InquiryPostpaidResponse response); // public InquiryPostpaidResponse findInquiryPostpaidResponse(String id); // }
import org.apache.commons.lang.StringUtils; import org.hibernate.Hibernate; import org.hibernate.SessionFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import com.artivisi.biller.simulator.gateway.pln.entity.InquiryPostpaidResponse; import com.artivisi.biller.simulator.gateway.pln.entity.InquiryPostpaidResponseDetail; import com.artivisi.biller.simulator.gateway.pln.service.PlnService;
/** * Copyright (C) 2011 ArtiVisi Intermedia <info@artivisi.com> * * 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 com.artivisi.biller.simulator.gateway.pln.service.impl; @Service @Transactional public class PlnServiceImpl implements PlnService { @Autowired private SessionFactory sessionFactory; @Override
// Path: biller-simulator-gateway-pln/src/main/java/com/artivisi/biller/simulator/gateway/pln/entity/InquiryPostpaidResponse.java // @Entity @Table(name="inquiry_postpaid_response") // public class InquiryPostpaidResponse { // // @Id @GeneratedValue(generator = "system-uuid") // @GenericGenerator(name = "system-uuid", strategy = "uuid") // private String id; // // @Column(nullable=false) // private String switcher; // @Column(nullable=false) // private String bank; // @Column(nullable=false) // private String stan; // // @OneToMany(mappedBy="inquiryPostpaidResponse", cascade=CascadeType.ALL, orphanRemoval=true) // private List<InquiryPostpaidResponseDetail> details = new ArrayList<InquiryPostpaidResponseDetail>(); // // public List<InquiryPostpaidResponseDetail> getDetails() { // return details; // } // public void setDetails(List<InquiryPostpaidResponseDetail> details) { // this.details = details; // } // public String getId() { // return id; // } // public void setId(String id) { // this.id = id; // } // public String getSwitcher() { // return switcher; // } // public void setSwitcher(String switcher) { // this.switcher = switcher; // } // public String getBank() { // return bank; // } // public void setBank(String bank) { // this.bank = bank; // } // public String getStan() { // return stan; // } // public void setStan(String stan) { // this.stan = stan; // } // } // // Path: biller-simulator-gateway-pln/src/main/java/com/artivisi/biller/simulator/gateway/pln/entity/InquiryPostpaidResponseDetail.java // @Entity @Table(name="inquiry_postpaid_response_detail") // public class InquiryPostpaidResponseDetail { // @Id @GeneratedValue(generator = "system-uuid") // @GenericGenerator(name = "system-uuid", strategy = "uuid") // private String id; // // @ManyToOne // @JoinColumn(name="id_inquiry_postpaid_response", nullable=false) // private InquiryPostpaidResponse inquiryPostpaidResponse; // // @ManyToOne // @JoinColumn(name="id_tagihan_pascabayar", nullable=false) // private TagihanPascabayar tagihanPascabayar; // // public String getId() { // return id; // } // // public void setId(String id) { // this.id = id; // } // // public InquiryPostpaidResponse getInquiryPostpaidResponse() { // return inquiryPostpaidResponse; // } // // public void setInquiryPostpaidResponse( // InquiryPostpaidResponse inquiryPostpaidResponse) { // this.inquiryPostpaidResponse = inquiryPostpaidResponse; // } // // public TagihanPascabayar getTagihanPascabayar() { // return tagihanPascabayar; // } // // public void setTagihanPascabayar(TagihanPascabayar tagihanPascabayar) { // this.tagihanPascabayar = tagihanPascabayar; // } // // // } // // Path: biller-simulator-gateway-pln/src/main/java/com/artivisi/biller/simulator/gateway/pln/service/PlnService.java // public interface PlnService { // public void save(InquiryPostpaidResponse response); // public InquiryPostpaidResponse findInquiryPostpaidResponse(String id); // } // Path: biller-simulator-gateway-pln/src/main/java/com/artivisi/biller/simulator/gateway/pln/service/impl/PlnServiceImpl.java import org.apache.commons.lang.StringUtils; import org.hibernate.Hibernate; import org.hibernate.SessionFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import com.artivisi.biller.simulator.gateway.pln.entity.InquiryPostpaidResponse; import com.artivisi.biller.simulator.gateway.pln.entity.InquiryPostpaidResponseDetail; import com.artivisi.biller.simulator.gateway.pln.service.PlnService; /** * Copyright (C) 2011 ArtiVisi Intermedia <info@artivisi.com> * * 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 com.artivisi.biller.simulator.gateway.pln.service.impl; @Service @Transactional public class PlnServiceImpl implements PlnService { @Autowired private SessionFactory sessionFactory; @Override
public void save(InquiryPostpaidResponse response) {
artivisi/biller-simulator
biller-simulator-gateway-pln/src/main/java/com/artivisi/biller/simulator/gateway/pln/service/impl/PlnServiceImpl.java
// Path: biller-simulator-gateway-pln/src/main/java/com/artivisi/biller/simulator/gateway/pln/entity/InquiryPostpaidResponse.java // @Entity @Table(name="inquiry_postpaid_response") // public class InquiryPostpaidResponse { // // @Id @GeneratedValue(generator = "system-uuid") // @GenericGenerator(name = "system-uuid", strategy = "uuid") // private String id; // // @Column(nullable=false) // private String switcher; // @Column(nullable=false) // private String bank; // @Column(nullable=false) // private String stan; // // @OneToMany(mappedBy="inquiryPostpaidResponse", cascade=CascadeType.ALL, orphanRemoval=true) // private List<InquiryPostpaidResponseDetail> details = new ArrayList<InquiryPostpaidResponseDetail>(); // // public List<InquiryPostpaidResponseDetail> getDetails() { // return details; // } // public void setDetails(List<InquiryPostpaidResponseDetail> details) { // this.details = details; // } // public String getId() { // return id; // } // public void setId(String id) { // this.id = id; // } // public String getSwitcher() { // return switcher; // } // public void setSwitcher(String switcher) { // this.switcher = switcher; // } // public String getBank() { // return bank; // } // public void setBank(String bank) { // this.bank = bank; // } // public String getStan() { // return stan; // } // public void setStan(String stan) { // this.stan = stan; // } // } // // Path: biller-simulator-gateway-pln/src/main/java/com/artivisi/biller/simulator/gateway/pln/entity/InquiryPostpaidResponseDetail.java // @Entity @Table(name="inquiry_postpaid_response_detail") // public class InquiryPostpaidResponseDetail { // @Id @GeneratedValue(generator = "system-uuid") // @GenericGenerator(name = "system-uuid", strategy = "uuid") // private String id; // // @ManyToOne // @JoinColumn(name="id_inquiry_postpaid_response", nullable=false) // private InquiryPostpaidResponse inquiryPostpaidResponse; // // @ManyToOne // @JoinColumn(name="id_tagihan_pascabayar", nullable=false) // private TagihanPascabayar tagihanPascabayar; // // public String getId() { // return id; // } // // public void setId(String id) { // this.id = id; // } // // public InquiryPostpaidResponse getInquiryPostpaidResponse() { // return inquiryPostpaidResponse; // } // // public void setInquiryPostpaidResponse( // InquiryPostpaidResponse inquiryPostpaidResponse) { // this.inquiryPostpaidResponse = inquiryPostpaidResponse; // } // // public TagihanPascabayar getTagihanPascabayar() { // return tagihanPascabayar; // } // // public void setTagihanPascabayar(TagihanPascabayar tagihanPascabayar) { // this.tagihanPascabayar = tagihanPascabayar; // } // // // } // // Path: biller-simulator-gateway-pln/src/main/java/com/artivisi/biller/simulator/gateway/pln/service/PlnService.java // public interface PlnService { // public void save(InquiryPostpaidResponse response); // public InquiryPostpaidResponse findInquiryPostpaidResponse(String id); // }
import org.apache.commons.lang.StringUtils; import org.hibernate.Hibernate; import org.hibernate.SessionFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import com.artivisi.biller.simulator.gateway.pln.entity.InquiryPostpaidResponse; import com.artivisi.biller.simulator.gateway.pln.entity.InquiryPostpaidResponseDetail; import com.artivisi.biller.simulator.gateway.pln.service.PlnService;
/** * Copyright (C) 2011 ArtiVisi Intermedia <info@artivisi.com> * * 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 com.artivisi.biller.simulator.gateway.pln.service.impl; @Service @Transactional public class PlnServiceImpl implements PlnService { @Autowired private SessionFactory sessionFactory; @Override public void save(InquiryPostpaidResponse response) { sessionFactory.getCurrentSession().saveOrUpdate(response); } @Override public InquiryPostpaidResponse findInquiryPostpaidResponse(String id) { if(StringUtils.isEmpty(id)) return null; InquiryPostpaidResponse i = (InquiryPostpaidResponse) sessionFactory.getCurrentSession().get(InquiryPostpaidResponse.class, id); if(i!=null){
// Path: biller-simulator-gateway-pln/src/main/java/com/artivisi/biller/simulator/gateway/pln/entity/InquiryPostpaidResponse.java // @Entity @Table(name="inquiry_postpaid_response") // public class InquiryPostpaidResponse { // // @Id @GeneratedValue(generator = "system-uuid") // @GenericGenerator(name = "system-uuid", strategy = "uuid") // private String id; // // @Column(nullable=false) // private String switcher; // @Column(nullable=false) // private String bank; // @Column(nullable=false) // private String stan; // // @OneToMany(mappedBy="inquiryPostpaidResponse", cascade=CascadeType.ALL, orphanRemoval=true) // private List<InquiryPostpaidResponseDetail> details = new ArrayList<InquiryPostpaidResponseDetail>(); // // public List<InquiryPostpaidResponseDetail> getDetails() { // return details; // } // public void setDetails(List<InquiryPostpaidResponseDetail> details) { // this.details = details; // } // public String getId() { // return id; // } // public void setId(String id) { // this.id = id; // } // public String getSwitcher() { // return switcher; // } // public void setSwitcher(String switcher) { // this.switcher = switcher; // } // public String getBank() { // return bank; // } // public void setBank(String bank) { // this.bank = bank; // } // public String getStan() { // return stan; // } // public void setStan(String stan) { // this.stan = stan; // } // } // // Path: biller-simulator-gateway-pln/src/main/java/com/artivisi/biller/simulator/gateway/pln/entity/InquiryPostpaidResponseDetail.java // @Entity @Table(name="inquiry_postpaid_response_detail") // public class InquiryPostpaidResponseDetail { // @Id @GeneratedValue(generator = "system-uuid") // @GenericGenerator(name = "system-uuid", strategy = "uuid") // private String id; // // @ManyToOne // @JoinColumn(name="id_inquiry_postpaid_response", nullable=false) // private InquiryPostpaidResponse inquiryPostpaidResponse; // // @ManyToOne // @JoinColumn(name="id_tagihan_pascabayar", nullable=false) // private TagihanPascabayar tagihanPascabayar; // // public String getId() { // return id; // } // // public void setId(String id) { // this.id = id; // } // // public InquiryPostpaidResponse getInquiryPostpaidResponse() { // return inquiryPostpaidResponse; // } // // public void setInquiryPostpaidResponse( // InquiryPostpaidResponse inquiryPostpaidResponse) { // this.inquiryPostpaidResponse = inquiryPostpaidResponse; // } // // public TagihanPascabayar getTagihanPascabayar() { // return tagihanPascabayar; // } // // public void setTagihanPascabayar(TagihanPascabayar tagihanPascabayar) { // this.tagihanPascabayar = tagihanPascabayar; // } // // // } // // Path: biller-simulator-gateway-pln/src/main/java/com/artivisi/biller/simulator/gateway/pln/service/PlnService.java // public interface PlnService { // public void save(InquiryPostpaidResponse response); // public InquiryPostpaidResponse findInquiryPostpaidResponse(String id); // } // Path: biller-simulator-gateway-pln/src/main/java/com/artivisi/biller/simulator/gateway/pln/service/impl/PlnServiceImpl.java import org.apache.commons.lang.StringUtils; import org.hibernate.Hibernate; import org.hibernate.SessionFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import com.artivisi.biller.simulator.gateway.pln.entity.InquiryPostpaidResponse; import com.artivisi.biller.simulator.gateway.pln.entity.InquiryPostpaidResponseDetail; import com.artivisi.biller.simulator.gateway.pln.service.PlnService; /** * Copyright (C) 2011 ArtiVisi Intermedia <info@artivisi.com> * * 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 com.artivisi.biller.simulator.gateway.pln.service.impl; @Service @Transactional public class PlnServiceImpl implements PlnService { @Autowired private SessionFactory sessionFactory; @Override public void save(InquiryPostpaidResponse response) { sessionFactory.getCurrentSession().saveOrUpdate(response); } @Override public InquiryPostpaidResponse findInquiryPostpaidResponse(String id) { if(StringUtils.isEmpty(id)) return null; InquiryPostpaidResponse i = (InquiryPostpaidResponse) sessionFactory.getCurrentSession().get(InquiryPostpaidResponse.class, id); if(i!=null){
for (InquiryPostpaidResponseDetail detail : i.getDetails()) {
artivisi/biller-simulator
biller-simulator-ui-jsf/src/main/java/com/artivisi/biller/simulator/ui/jsf/controller/pascabayar/TagihanController.java
// Path: biller-simulator-domain/src/main/java/com/artivisi/biller/simulator/dto/GeneratorTagihanPascabayar.java // public class GeneratorTagihanPascabayar { // private Integer normal = 100; // private Integer satuBulanBukanBerjalan = 10; // private Integer tigaBulanTunggakan = 10; // private Integer empatBulanTunggakan = 10; // private Integer enamBulanTunggakan = 10; // private Integer delapanBulanTunggakan = 10; // private Integer sepuluhBulanTunggakan = 10; // private Integer duaMiliar = 10; // public Integer getNormal() { // return normal; // } // public void setNormal(Integer normal) { // this.normal = normal; // } // public Integer getSatuBulanBukanBerjalan() { // return satuBulanBukanBerjalan; // } // public void setSatuBulanBukanBerjalan(Integer satuBulanBukanBerjalan) { // this.satuBulanBukanBerjalan = satuBulanBukanBerjalan; // } // public Integer getTigaBulanTunggakan() { // return tigaBulanTunggakan; // } // public void setTigaBulanTunggakan(Integer tigaBulanTunggakan) { // this.tigaBulanTunggakan = tigaBulanTunggakan; // } // public Integer getEmpatBulanTunggakan() { // return empatBulanTunggakan; // } // public void setEmpatBulanTunggakan(Integer empatBulanTunggakan) { // this.empatBulanTunggakan = empatBulanTunggakan; // } // public Integer getEnamBulanTunggakan() { // return enamBulanTunggakan; // } // public void setEnamBulanTunggakan(Integer enamBulanTunggakan) { // this.enamBulanTunggakan = enamBulanTunggakan; // } // public Integer getDelapanBulanTunggakan() { // return delapanBulanTunggakan; // } // public void setDelapanBulanTunggakan(Integer delapanBulanTunggakan) { // this.delapanBulanTunggakan = delapanBulanTunggakan; // } // public Integer getSepuluhBulanTunggakan() { // return sepuluhBulanTunggakan; // } // public void setSepuluhBulanTunggakan(Integer sepuluhBulanTunggakan) { // this.sepuluhBulanTunggakan = sepuluhBulanTunggakan; // } // public Integer getDuaMiliar() { // return duaMiliar; // } // public void setDuaMiliar(Integer duaMiliar) { // this.duaMiliar = duaMiliar; // } // } // // Path: biller-simulator-domain/src/main/java/com/artivisi/biller/simulator/service/PlnSimulatorService.java // public interface PlnSimulatorService { // public void save(Pelanggan pelanggan); // public void delete(Pelanggan pelanggan); // public Pelanggan findPelangganById(String id); // public Pelanggan findPelangganByIdpel(String idpel); // public Pelanggan findPelangganByMeterNumber(String meternum); // public List<Pelanggan> findAllPelanggan(); // // public void save(TagihanPascabayar tagihanPascabayar); // public void delete(TagihanPascabayar tagihanPascabayar); // public List<TagihanPascabayar> findTagihan(Pelanggan pelanggan); // // public void save(TagihanNontaglis tagihanNontaglis); // public void delete(TagihanNontaglis tagihanNontaglis); // public TagihanNontaglis findTagihanNontaglis(String regnum); // // public void save(TagihanNontaglisDetail tagihanNontaglisDetail); // public void delete(TagihanNontaglisDetail tagihanNontaglisDetail); // public List<TagihanNontaglisDetail> findAllTagihanNontaglisDetail(); // // public void generatePascabayar(GeneratorTagihanPascabayar generator); // // public void save(PembayaranPascabayar pembayaranPascabayar); // public void delete(PembayaranPascabayar pembayaranPascabayar); // public List<PembayaranPascabayar> findPembayaranPascabayar(Date tanggal, String switcher); // }
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.Scope; import org.springframework.stereotype.Controller; import com.artivisi.biller.simulator.dto.GeneratorTagihanPascabayar; import com.artivisi.biller.simulator.service.PlnSimulatorService;
/** * Copyright (C) 2011 ArtiVisi Intermedia <info@artivisi.com> * * 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 com.artivisi.biller.simulator.ui.jsf.controller.pascabayar; @Controller @Scope("request") public class TagihanController {
// Path: biller-simulator-domain/src/main/java/com/artivisi/biller/simulator/dto/GeneratorTagihanPascabayar.java // public class GeneratorTagihanPascabayar { // private Integer normal = 100; // private Integer satuBulanBukanBerjalan = 10; // private Integer tigaBulanTunggakan = 10; // private Integer empatBulanTunggakan = 10; // private Integer enamBulanTunggakan = 10; // private Integer delapanBulanTunggakan = 10; // private Integer sepuluhBulanTunggakan = 10; // private Integer duaMiliar = 10; // public Integer getNormal() { // return normal; // } // public void setNormal(Integer normal) { // this.normal = normal; // } // public Integer getSatuBulanBukanBerjalan() { // return satuBulanBukanBerjalan; // } // public void setSatuBulanBukanBerjalan(Integer satuBulanBukanBerjalan) { // this.satuBulanBukanBerjalan = satuBulanBukanBerjalan; // } // public Integer getTigaBulanTunggakan() { // return tigaBulanTunggakan; // } // public void setTigaBulanTunggakan(Integer tigaBulanTunggakan) { // this.tigaBulanTunggakan = tigaBulanTunggakan; // } // public Integer getEmpatBulanTunggakan() { // return empatBulanTunggakan; // } // public void setEmpatBulanTunggakan(Integer empatBulanTunggakan) { // this.empatBulanTunggakan = empatBulanTunggakan; // } // public Integer getEnamBulanTunggakan() { // return enamBulanTunggakan; // } // public void setEnamBulanTunggakan(Integer enamBulanTunggakan) { // this.enamBulanTunggakan = enamBulanTunggakan; // } // public Integer getDelapanBulanTunggakan() { // return delapanBulanTunggakan; // } // public void setDelapanBulanTunggakan(Integer delapanBulanTunggakan) { // this.delapanBulanTunggakan = delapanBulanTunggakan; // } // public Integer getSepuluhBulanTunggakan() { // return sepuluhBulanTunggakan; // } // public void setSepuluhBulanTunggakan(Integer sepuluhBulanTunggakan) { // this.sepuluhBulanTunggakan = sepuluhBulanTunggakan; // } // public Integer getDuaMiliar() { // return duaMiliar; // } // public void setDuaMiliar(Integer duaMiliar) { // this.duaMiliar = duaMiliar; // } // } // // Path: biller-simulator-domain/src/main/java/com/artivisi/biller/simulator/service/PlnSimulatorService.java // public interface PlnSimulatorService { // public void save(Pelanggan pelanggan); // public void delete(Pelanggan pelanggan); // public Pelanggan findPelangganById(String id); // public Pelanggan findPelangganByIdpel(String idpel); // public Pelanggan findPelangganByMeterNumber(String meternum); // public List<Pelanggan> findAllPelanggan(); // // public void save(TagihanPascabayar tagihanPascabayar); // public void delete(TagihanPascabayar tagihanPascabayar); // public List<TagihanPascabayar> findTagihan(Pelanggan pelanggan); // // public void save(TagihanNontaglis tagihanNontaglis); // public void delete(TagihanNontaglis tagihanNontaglis); // public TagihanNontaglis findTagihanNontaglis(String regnum); // // public void save(TagihanNontaglisDetail tagihanNontaglisDetail); // public void delete(TagihanNontaglisDetail tagihanNontaglisDetail); // public List<TagihanNontaglisDetail> findAllTagihanNontaglisDetail(); // // public void generatePascabayar(GeneratorTagihanPascabayar generator); // // public void save(PembayaranPascabayar pembayaranPascabayar); // public void delete(PembayaranPascabayar pembayaranPascabayar); // public List<PembayaranPascabayar> findPembayaranPascabayar(Date tanggal, String switcher); // } // Path: biller-simulator-ui-jsf/src/main/java/com/artivisi/biller/simulator/ui/jsf/controller/pascabayar/TagihanController.java import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.Scope; import org.springframework.stereotype.Controller; import com.artivisi.biller.simulator.dto.GeneratorTagihanPascabayar; import com.artivisi.biller.simulator.service.PlnSimulatorService; /** * Copyright (C) 2011 ArtiVisi Intermedia <info@artivisi.com> * * 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 com.artivisi.biller.simulator.ui.jsf.controller.pascabayar; @Controller @Scope("request") public class TagihanController {
@Autowired private PlnSimulatorService plnSimulatorService;
artivisi/biller-simulator
biller-simulator-ui-jsf/src/main/java/com/artivisi/biller/simulator/ui/jsf/controller/pascabayar/TagihanController.java
// Path: biller-simulator-domain/src/main/java/com/artivisi/biller/simulator/dto/GeneratorTagihanPascabayar.java // public class GeneratorTagihanPascabayar { // private Integer normal = 100; // private Integer satuBulanBukanBerjalan = 10; // private Integer tigaBulanTunggakan = 10; // private Integer empatBulanTunggakan = 10; // private Integer enamBulanTunggakan = 10; // private Integer delapanBulanTunggakan = 10; // private Integer sepuluhBulanTunggakan = 10; // private Integer duaMiliar = 10; // public Integer getNormal() { // return normal; // } // public void setNormal(Integer normal) { // this.normal = normal; // } // public Integer getSatuBulanBukanBerjalan() { // return satuBulanBukanBerjalan; // } // public void setSatuBulanBukanBerjalan(Integer satuBulanBukanBerjalan) { // this.satuBulanBukanBerjalan = satuBulanBukanBerjalan; // } // public Integer getTigaBulanTunggakan() { // return tigaBulanTunggakan; // } // public void setTigaBulanTunggakan(Integer tigaBulanTunggakan) { // this.tigaBulanTunggakan = tigaBulanTunggakan; // } // public Integer getEmpatBulanTunggakan() { // return empatBulanTunggakan; // } // public void setEmpatBulanTunggakan(Integer empatBulanTunggakan) { // this.empatBulanTunggakan = empatBulanTunggakan; // } // public Integer getEnamBulanTunggakan() { // return enamBulanTunggakan; // } // public void setEnamBulanTunggakan(Integer enamBulanTunggakan) { // this.enamBulanTunggakan = enamBulanTunggakan; // } // public Integer getDelapanBulanTunggakan() { // return delapanBulanTunggakan; // } // public void setDelapanBulanTunggakan(Integer delapanBulanTunggakan) { // this.delapanBulanTunggakan = delapanBulanTunggakan; // } // public Integer getSepuluhBulanTunggakan() { // return sepuluhBulanTunggakan; // } // public void setSepuluhBulanTunggakan(Integer sepuluhBulanTunggakan) { // this.sepuluhBulanTunggakan = sepuluhBulanTunggakan; // } // public Integer getDuaMiliar() { // return duaMiliar; // } // public void setDuaMiliar(Integer duaMiliar) { // this.duaMiliar = duaMiliar; // } // } // // Path: biller-simulator-domain/src/main/java/com/artivisi/biller/simulator/service/PlnSimulatorService.java // public interface PlnSimulatorService { // public void save(Pelanggan pelanggan); // public void delete(Pelanggan pelanggan); // public Pelanggan findPelangganById(String id); // public Pelanggan findPelangganByIdpel(String idpel); // public Pelanggan findPelangganByMeterNumber(String meternum); // public List<Pelanggan> findAllPelanggan(); // // public void save(TagihanPascabayar tagihanPascabayar); // public void delete(TagihanPascabayar tagihanPascabayar); // public List<TagihanPascabayar> findTagihan(Pelanggan pelanggan); // // public void save(TagihanNontaglis tagihanNontaglis); // public void delete(TagihanNontaglis tagihanNontaglis); // public TagihanNontaglis findTagihanNontaglis(String regnum); // // public void save(TagihanNontaglisDetail tagihanNontaglisDetail); // public void delete(TagihanNontaglisDetail tagihanNontaglisDetail); // public List<TagihanNontaglisDetail> findAllTagihanNontaglisDetail(); // // public void generatePascabayar(GeneratorTagihanPascabayar generator); // // public void save(PembayaranPascabayar pembayaranPascabayar); // public void delete(PembayaranPascabayar pembayaranPascabayar); // public List<PembayaranPascabayar> findPembayaranPascabayar(Date tanggal, String switcher); // }
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.Scope; import org.springframework.stereotype.Controller; import com.artivisi.biller.simulator.dto.GeneratorTagihanPascabayar; import com.artivisi.biller.simulator.service.PlnSimulatorService;
/** * Copyright (C) 2011 ArtiVisi Intermedia <info@artivisi.com> * * 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 com.artivisi.biller.simulator.ui.jsf.controller.pascabayar; @Controller @Scope("request") public class TagihanController { @Autowired private PlnSimulatorService plnSimulatorService;
// Path: biller-simulator-domain/src/main/java/com/artivisi/biller/simulator/dto/GeneratorTagihanPascabayar.java // public class GeneratorTagihanPascabayar { // private Integer normal = 100; // private Integer satuBulanBukanBerjalan = 10; // private Integer tigaBulanTunggakan = 10; // private Integer empatBulanTunggakan = 10; // private Integer enamBulanTunggakan = 10; // private Integer delapanBulanTunggakan = 10; // private Integer sepuluhBulanTunggakan = 10; // private Integer duaMiliar = 10; // public Integer getNormal() { // return normal; // } // public void setNormal(Integer normal) { // this.normal = normal; // } // public Integer getSatuBulanBukanBerjalan() { // return satuBulanBukanBerjalan; // } // public void setSatuBulanBukanBerjalan(Integer satuBulanBukanBerjalan) { // this.satuBulanBukanBerjalan = satuBulanBukanBerjalan; // } // public Integer getTigaBulanTunggakan() { // return tigaBulanTunggakan; // } // public void setTigaBulanTunggakan(Integer tigaBulanTunggakan) { // this.tigaBulanTunggakan = tigaBulanTunggakan; // } // public Integer getEmpatBulanTunggakan() { // return empatBulanTunggakan; // } // public void setEmpatBulanTunggakan(Integer empatBulanTunggakan) { // this.empatBulanTunggakan = empatBulanTunggakan; // } // public Integer getEnamBulanTunggakan() { // return enamBulanTunggakan; // } // public void setEnamBulanTunggakan(Integer enamBulanTunggakan) { // this.enamBulanTunggakan = enamBulanTunggakan; // } // public Integer getDelapanBulanTunggakan() { // return delapanBulanTunggakan; // } // public void setDelapanBulanTunggakan(Integer delapanBulanTunggakan) { // this.delapanBulanTunggakan = delapanBulanTunggakan; // } // public Integer getSepuluhBulanTunggakan() { // return sepuluhBulanTunggakan; // } // public void setSepuluhBulanTunggakan(Integer sepuluhBulanTunggakan) { // this.sepuluhBulanTunggakan = sepuluhBulanTunggakan; // } // public Integer getDuaMiliar() { // return duaMiliar; // } // public void setDuaMiliar(Integer duaMiliar) { // this.duaMiliar = duaMiliar; // } // } // // Path: biller-simulator-domain/src/main/java/com/artivisi/biller/simulator/service/PlnSimulatorService.java // public interface PlnSimulatorService { // public void save(Pelanggan pelanggan); // public void delete(Pelanggan pelanggan); // public Pelanggan findPelangganById(String id); // public Pelanggan findPelangganByIdpel(String idpel); // public Pelanggan findPelangganByMeterNumber(String meternum); // public List<Pelanggan> findAllPelanggan(); // // public void save(TagihanPascabayar tagihanPascabayar); // public void delete(TagihanPascabayar tagihanPascabayar); // public List<TagihanPascabayar> findTagihan(Pelanggan pelanggan); // // public void save(TagihanNontaglis tagihanNontaglis); // public void delete(TagihanNontaglis tagihanNontaglis); // public TagihanNontaglis findTagihanNontaglis(String regnum); // // public void save(TagihanNontaglisDetail tagihanNontaglisDetail); // public void delete(TagihanNontaglisDetail tagihanNontaglisDetail); // public List<TagihanNontaglisDetail> findAllTagihanNontaglisDetail(); // // public void generatePascabayar(GeneratorTagihanPascabayar generator); // // public void save(PembayaranPascabayar pembayaranPascabayar); // public void delete(PembayaranPascabayar pembayaranPascabayar); // public List<PembayaranPascabayar> findPembayaranPascabayar(Date tanggal, String switcher); // } // Path: biller-simulator-ui-jsf/src/main/java/com/artivisi/biller/simulator/ui/jsf/controller/pascabayar/TagihanController.java import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.Scope; import org.springframework.stereotype.Controller; import com.artivisi.biller.simulator.dto.GeneratorTagihanPascabayar; import com.artivisi.biller.simulator.service.PlnSimulatorService; /** * Copyright (C) 2011 ArtiVisi Intermedia <info@artivisi.com> * * 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 com.artivisi.biller.simulator.ui.jsf.controller.pascabayar; @Controller @Scope("request") public class TagihanController { @Autowired private PlnSimulatorService plnSimulatorService;
private GeneratorTagihanPascabayar generator = new GeneratorTagihanPascabayar();
artivisi/biller-simulator
biller-simulator-domain/src/main/java/com/artivisi/biller/simulator/service/BillerSimulatorService.java
// Path: biller-simulator-domain/src/main/java/com/artivisi/biller/simulator/entity/Bank.java // @Entity @Table(name="m_bank") // public class Bank { // // @Id @GeneratedValue(generator = "system-uuid") // @GenericGenerator(name = "system-uuid", strategy = "uuid") // private String id; // // @Column(nullable=false, unique=true) // private String kode; // @Column(nullable=false) // private String nama; // public String getId() { // return id; // } // public void setId(String id) { // this.id = id; // } // public String getKode() { // return kode; // } // public void setKode(String kode) { // this.kode = kode; // } // public String getNama() { // return nama; // } // public void setNama(String nama) { // this.nama = nama; // } // // // } // // Path: biller-simulator-domain/src/main/java/com/artivisi/biller/simulator/entity/Mitra.java // @Entity @Table(name="m_mitra") // public class Mitra { // @Id @GeneratedValue(generator = "system-uuid") // @GenericGenerator(name = "system-uuid", strategy = "uuid") // private String id; // @Column(nullable=false, unique=true) // private String kode; // @Column(nullable=false) // private String nama; // // @Column(nullable=false, name="admin_fee") // private BigDecimal adminFee = BigDecimal.ZERO; // // public String getId() { // return id; // } // // public void setId(String id) { // this.id = id; // } // // public String getKode() { // return kode; // } // // public void setKode(String kode) { // this.kode = kode; // } // // public String getNama() { // return nama; // } // // public void setNama(String nama) { // this.nama = nama; // } // // public BigDecimal getAdminFee() { // return adminFee; // } // // public void setAdminFee(BigDecimal adminFee) { // this.adminFee = adminFee; // } // // // }
import java.util.List; import com.artivisi.biller.simulator.entity.Bank; import com.artivisi.biller.simulator.entity.Mitra;
/** * Copyright (C) 2011 ArtiVisi Intermedia <info@artivisi.com> * * 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 com.artivisi.biller.simulator.service; public interface BillerSimulatorService { public void save(Bank bank); public void delete(Bank bank); public Bank findBankById(String id); public Bank findBankByKode(String kode); public List<Bank> findAllBank();
// Path: biller-simulator-domain/src/main/java/com/artivisi/biller/simulator/entity/Bank.java // @Entity @Table(name="m_bank") // public class Bank { // // @Id @GeneratedValue(generator = "system-uuid") // @GenericGenerator(name = "system-uuid", strategy = "uuid") // private String id; // // @Column(nullable=false, unique=true) // private String kode; // @Column(nullable=false) // private String nama; // public String getId() { // return id; // } // public void setId(String id) { // this.id = id; // } // public String getKode() { // return kode; // } // public void setKode(String kode) { // this.kode = kode; // } // public String getNama() { // return nama; // } // public void setNama(String nama) { // this.nama = nama; // } // // // } // // Path: biller-simulator-domain/src/main/java/com/artivisi/biller/simulator/entity/Mitra.java // @Entity @Table(name="m_mitra") // public class Mitra { // @Id @GeneratedValue(generator = "system-uuid") // @GenericGenerator(name = "system-uuid", strategy = "uuid") // private String id; // @Column(nullable=false, unique=true) // private String kode; // @Column(nullable=false) // private String nama; // // @Column(nullable=false, name="admin_fee") // private BigDecimal adminFee = BigDecimal.ZERO; // // public String getId() { // return id; // } // // public void setId(String id) { // this.id = id; // } // // public String getKode() { // return kode; // } // // public void setKode(String kode) { // this.kode = kode; // } // // public String getNama() { // return nama; // } // // public void setNama(String nama) { // this.nama = nama; // } // // public BigDecimal getAdminFee() { // return adminFee; // } // // public void setAdminFee(BigDecimal adminFee) { // this.adminFee = adminFee; // } // // // } // Path: biller-simulator-domain/src/main/java/com/artivisi/biller/simulator/service/BillerSimulatorService.java import java.util.List; import com.artivisi.biller.simulator.entity.Bank; import com.artivisi.biller.simulator.entity.Mitra; /** * Copyright (C) 2011 ArtiVisi Intermedia <info@artivisi.com> * * 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 com.artivisi.biller.simulator.service; public interface BillerSimulatorService { public void save(Bank bank); public void delete(Bank bank); public Bank findBankById(String id); public Bank findBankByKode(String kode); public List<Bank> findAllBank();
public void save(Mitra mitra);
alexanderdean/Unified-Log-Processing
ch05/nile-carts/src/main/java/nile/tasks/AbandonedCartStreamTask.java
// Path: ch05/nile-carts/src/main/java/nile/events/AbandonedCartEvent.java // public class AbandonedCartEvent extends Event { // public final DirectObject directObject; // // public AbandonedCartEvent(String shopper, String cart) { // super(shopper, "abandon"); // this.directObject = new DirectObject(cart); // } // // public static final class DirectObject { // public final Cart cart; // // public DirectObject(String cart) { // this.cart = new Cart(cart); // } // // public static final class Cart { // // private static final int ABANDONED_AFTER_SECS = 1800; // a // // public List<Map<String, Object>> items = // new ArrayList<Map<String, Object>>(); // // public Cart(String json) { // if (json != null) { // try { // this.items = MAPPER.readValue(json, // new TypeReference<List<Map<String, Object>>>() {}); // } catch (IOException ioe) { // throw new RuntimeException("Problem parsing JSON cart", ioe); // } // } // } // // public void addItem(Map<String, Object> item) { // b // this.items.add(item); // } // // public String asJson() { // c // try { // return MAPPER.writeValueAsString(this.items); // } catch (IOException ioe) { // throw new RuntimeException("Problem writing JSON cart", ioe); // } // } // // public static boolean isAbandoned(String timestamp) { // d // DateTime ts = EVENT_DTF.parseDateTime(timestamp); // DateTime cutoff = new DateTime(DateTimeZone.UTC) // .minusSeconds(ABANDONED_AFTER_SECS); // return ts.isBefore(cutoff); // } // } // } // } // // Path: ch05/nile-carts/src/main/java/nile/events/AbandonedCartEvent.java // public static final class Cart { // // private static final int ABANDONED_AFTER_SECS = 1800; // a // // public List<Map<String, Object>> items = // new ArrayList<Map<String, Object>>(); // // public Cart(String json) { // if (json != null) { // try { // this.items = MAPPER.readValue(json, // new TypeReference<List<Map<String, Object>>>() {}); // } catch (IOException ioe) { // throw new RuntimeException("Problem parsing JSON cart", ioe); // } // } // } // // public void addItem(Map<String, Object> item) { // b // this.items.add(item); // } // // public String asJson() { // c // try { // return MAPPER.writeValueAsString(this.items); // } catch (IOException ioe) { // throw new RuntimeException("Problem writing JSON cart", ioe); // } // } // // public static boolean isAbandoned(String timestamp) { // d // DateTime ts = EVENT_DTF.parseDateTime(timestamp); // DateTime cutoff = new DateTime(DateTimeZone.UTC) // .minusSeconds(ABANDONED_AFTER_SECS); // return ts.isBefore(cutoff); // } // }
import java.util.HashMap; import java.util.HashSet; import java.util.Map; import java.util.Set; import org.apache.samza.config.Config; import org.apache.samza.storage.kv.KeyValueStore; import org.apache.samza.storage.kv.KeyValueIterator; import org.apache.samza.storage.kv.Entry; import org.apache.samza.system.IncomingMessageEnvelope; import org.apache.samza.system.OutgoingMessageEnvelope; import org.apache.samza.system.SystemStream; import org.apache.samza.task.InitableTask; import org.apache.samza.task.MessageCollector; import org.apache.samza.task.StreamTask; import org.apache.samza.task.TaskContext; import org.apache.samza.task.TaskCoordinator; import org.apache.samza.task.WindowableTask; import nile.events.AbandonedCartEvent; import nile.events.AbandonedCartEvent.DirectObject.Cart;
package nile.tasks; public class AbandonedCartStreamTask implements StreamTask, InitableTask, WindowableTask { private KeyValueStore<String, String> store; public void init(Config config, TaskContext context) { this.store = (KeyValueStore<String, String>) context.getStore("nile-carts"); } @SuppressWarnings("unchecked") @Override public void process(IncomingMessageEnvelope envelope, MessageCollector collector, TaskCoordinator coordinator) { Map<String, Object> event = (Map<String, Object>) envelope.getMessage(); String verb = (String) event.get("verb"); String shopper = (String) ((Map<String, Object>) event.get("subject")).get("shopper"); if (verb.equals("add")) { // a String timestamp = (String) ((Map<String, Object>) event.get("context")).get("timestamp"); Map<String, Object> item = (Map<String, Object>) ((Map<String, Object>) event.get("directObject")).get("item");
// Path: ch05/nile-carts/src/main/java/nile/events/AbandonedCartEvent.java // public class AbandonedCartEvent extends Event { // public final DirectObject directObject; // // public AbandonedCartEvent(String shopper, String cart) { // super(shopper, "abandon"); // this.directObject = new DirectObject(cart); // } // // public static final class DirectObject { // public final Cart cart; // // public DirectObject(String cart) { // this.cart = new Cart(cart); // } // // public static final class Cart { // // private static final int ABANDONED_AFTER_SECS = 1800; // a // // public List<Map<String, Object>> items = // new ArrayList<Map<String, Object>>(); // // public Cart(String json) { // if (json != null) { // try { // this.items = MAPPER.readValue(json, // new TypeReference<List<Map<String, Object>>>() {}); // } catch (IOException ioe) { // throw new RuntimeException("Problem parsing JSON cart", ioe); // } // } // } // // public void addItem(Map<String, Object> item) { // b // this.items.add(item); // } // // public String asJson() { // c // try { // return MAPPER.writeValueAsString(this.items); // } catch (IOException ioe) { // throw new RuntimeException("Problem writing JSON cart", ioe); // } // } // // public static boolean isAbandoned(String timestamp) { // d // DateTime ts = EVENT_DTF.parseDateTime(timestamp); // DateTime cutoff = new DateTime(DateTimeZone.UTC) // .minusSeconds(ABANDONED_AFTER_SECS); // return ts.isBefore(cutoff); // } // } // } // } // // Path: ch05/nile-carts/src/main/java/nile/events/AbandonedCartEvent.java // public static final class Cart { // // private static final int ABANDONED_AFTER_SECS = 1800; // a // // public List<Map<String, Object>> items = // new ArrayList<Map<String, Object>>(); // // public Cart(String json) { // if (json != null) { // try { // this.items = MAPPER.readValue(json, // new TypeReference<List<Map<String, Object>>>() {}); // } catch (IOException ioe) { // throw new RuntimeException("Problem parsing JSON cart", ioe); // } // } // } // // public void addItem(Map<String, Object> item) { // b // this.items.add(item); // } // // public String asJson() { // c // try { // return MAPPER.writeValueAsString(this.items); // } catch (IOException ioe) { // throw new RuntimeException("Problem writing JSON cart", ioe); // } // } // // public static boolean isAbandoned(String timestamp) { // d // DateTime ts = EVENT_DTF.parseDateTime(timestamp); // DateTime cutoff = new DateTime(DateTimeZone.UTC) // .minusSeconds(ABANDONED_AFTER_SECS); // return ts.isBefore(cutoff); // } // } // Path: ch05/nile-carts/src/main/java/nile/tasks/AbandonedCartStreamTask.java import java.util.HashMap; import java.util.HashSet; import java.util.Map; import java.util.Set; import org.apache.samza.config.Config; import org.apache.samza.storage.kv.KeyValueStore; import org.apache.samza.storage.kv.KeyValueIterator; import org.apache.samza.storage.kv.Entry; import org.apache.samza.system.IncomingMessageEnvelope; import org.apache.samza.system.OutgoingMessageEnvelope; import org.apache.samza.system.SystemStream; import org.apache.samza.task.InitableTask; import org.apache.samza.task.MessageCollector; import org.apache.samza.task.StreamTask; import org.apache.samza.task.TaskContext; import org.apache.samza.task.TaskCoordinator; import org.apache.samza.task.WindowableTask; import nile.events.AbandonedCartEvent; import nile.events.AbandonedCartEvent.DirectObject.Cart; package nile.tasks; public class AbandonedCartStreamTask implements StreamTask, InitableTask, WindowableTask { private KeyValueStore<String, String> store; public void init(Config config, TaskContext context) { this.store = (KeyValueStore<String, String>) context.getStore("nile-carts"); } @SuppressWarnings("unchecked") @Override public void process(IncomingMessageEnvelope envelope, MessageCollector collector, TaskCoordinator coordinator) { Map<String, Object> event = (Map<String, Object>) envelope.getMessage(); String verb = (String) event.get("verb"); String shopper = (String) ((Map<String, Object>) event.get("subject")).get("shopper"); if (verb.equals("add")) { // a String timestamp = (String) ((Map<String, Object>) event.get("context")).get("timestamp"); Map<String, Object> item = (Map<String, Object>) ((Map<String, Object>) event.get("directObject")).get("item");
Cart cart = new Cart(store.get(asCartKey(shopper)));
alexanderdean/Unified-Log-Processing
ch05/nile-carts/src/main/java/nile/tasks/AbandonedCartStreamTask.java
// Path: ch05/nile-carts/src/main/java/nile/events/AbandonedCartEvent.java // public class AbandonedCartEvent extends Event { // public final DirectObject directObject; // // public AbandonedCartEvent(String shopper, String cart) { // super(shopper, "abandon"); // this.directObject = new DirectObject(cart); // } // // public static final class DirectObject { // public final Cart cart; // // public DirectObject(String cart) { // this.cart = new Cart(cart); // } // // public static final class Cart { // // private static final int ABANDONED_AFTER_SECS = 1800; // a // // public List<Map<String, Object>> items = // new ArrayList<Map<String, Object>>(); // // public Cart(String json) { // if (json != null) { // try { // this.items = MAPPER.readValue(json, // new TypeReference<List<Map<String, Object>>>() {}); // } catch (IOException ioe) { // throw new RuntimeException("Problem parsing JSON cart", ioe); // } // } // } // // public void addItem(Map<String, Object> item) { // b // this.items.add(item); // } // // public String asJson() { // c // try { // return MAPPER.writeValueAsString(this.items); // } catch (IOException ioe) { // throw new RuntimeException("Problem writing JSON cart", ioe); // } // } // // public static boolean isAbandoned(String timestamp) { // d // DateTime ts = EVENT_DTF.parseDateTime(timestamp); // DateTime cutoff = new DateTime(DateTimeZone.UTC) // .minusSeconds(ABANDONED_AFTER_SECS); // return ts.isBefore(cutoff); // } // } // } // } // // Path: ch05/nile-carts/src/main/java/nile/events/AbandonedCartEvent.java // public static final class Cart { // // private static final int ABANDONED_AFTER_SECS = 1800; // a // // public List<Map<String, Object>> items = // new ArrayList<Map<String, Object>>(); // // public Cart(String json) { // if (json != null) { // try { // this.items = MAPPER.readValue(json, // new TypeReference<List<Map<String, Object>>>() {}); // } catch (IOException ioe) { // throw new RuntimeException("Problem parsing JSON cart", ioe); // } // } // } // // public void addItem(Map<String, Object> item) { // b // this.items.add(item); // } // // public String asJson() { // c // try { // return MAPPER.writeValueAsString(this.items); // } catch (IOException ioe) { // throw new RuntimeException("Problem writing JSON cart", ioe); // } // } // // public static boolean isAbandoned(String timestamp) { // d // DateTime ts = EVENT_DTF.parseDateTime(timestamp); // DateTime cutoff = new DateTime(DateTimeZone.UTC) // .minusSeconds(ABANDONED_AFTER_SECS); // return ts.isBefore(cutoff); // } // }
import java.util.HashMap; import java.util.HashSet; import java.util.Map; import java.util.Set; import org.apache.samza.config.Config; import org.apache.samza.storage.kv.KeyValueStore; import org.apache.samza.storage.kv.KeyValueIterator; import org.apache.samza.storage.kv.Entry; import org.apache.samza.system.IncomingMessageEnvelope; import org.apache.samza.system.OutgoingMessageEnvelope; import org.apache.samza.system.SystemStream; import org.apache.samza.task.InitableTask; import org.apache.samza.task.MessageCollector; import org.apache.samza.task.StreamTask; import org.apache.samza.task.TaskContext; import org.apache.samza.task.TaskCoordinator; import org.apache.samza.task.WindowableTask; import nile.events.AbandonedCartEvent; import nile.events.AbandonedCartEvent.DirectObject.Cart;
if (verb.equals("add")) { // a String timestamp = (String) ((Map<String, Object>) event.get("context")).get("timestamp"); Map<String, Object> item = (Map<String, Object>) ((Map<String, Object>) event.get("directObject")).get("item"); Cart cart = new Cart(store.get(asCartKey(shopper))); cart.addItem(item); store.put(asTimestampKey(shopper), timestamp); store.put(asCartKey(shopper), cart.asJson()); } else if (verb.equals("place")) { // b resetShopper(shopper); } } @Override public void window(MessageCollector collector, TaskCoordinator coordinator) { KeyValueIterator<String, String> entries = store.all(); while (entries.hasNext()) { // c Entry<String, String> entry = entries.next(); String key = entry.getKey(); String value = entry.getValue(); if (isTimestampKey(key) && Cart.isAbandoned(value)) { // d String shopper = extractShopper(key); String cart = store.get(asCartKey(shopper));
// Path: ch05/nile-carts/src/main/java/nile/events/AbandonedCartEvent.java // public class AbandonedCartEvent extends Event { // public final DirectObject directObject; // // public AbandonedCartEvent(String shopper, String cart) { // super(shopper, "abandon"); // this.directObject = new DirectObject(cart); // } // // public static final class DirectObject { // public final Cart cart; // // public DirectObject(String cart) { // this.cart = new Cart(cart); // } // // public static final class Cart { // // private static final int ABANDONED_AFTER_SECS = 1800; // a // // public List<Map<String, Object>> items = // new ArrayList<Map<String, Object>>(); // // public Cart(String json) { // if (json != null) { // try { // this.items = MAPPER.readValue(json, // new TypeReference<List<Map<String, Object>>>() {}); // } catch (IOException ioe) { // throw new RuntimeException("Problem parsing JSON cart", ioe); // } // } // } // // public void addItem(Map<String, Object> item) { // b // this.items.add(item); // } // // public String asJson() { // c // try { // return MAPPER.writeValueAsString(this.items); // } catch (IOException ioe) { // throw new RuntimeException("Problem writing JSON cart", ioe); // } // } // // public static boolean isAbandoned(String timestamp) { // d // DateTime ts = EVENT_DTF.parseDateTime(timestamp); // DateTime cutoff = new DateTime(DateTimeZone.UTC) // .minusSeconds(ABANDONED_AFTER_SECS); // return ts.isBefore(cutoff); // } // } // } // } // // Path: ch05/nile-carts/src/main/java/nile/events/AbandonedCartEvent.java // public static final class Cart { // // private static final int ABANDONED_AFTER_SECS = 1800; // a // // public List<Map<String, Object>> items = // new ArrayList<Map<String, Object>>(); // // public Cart(String json) { // if (json != null) { // try { // this.items = MAPPER.readValue(json, // new TypeReference<List<Map<String, Object>>>() {}); // } catch (IOException ioe) { // throw new RuntimeException("Problem parsing JSON cart", ioe); // } // } // } // // public void addItem(Map<String, Object> item) { // b // this.items.add(item); // } // // public String asJson() { // c // try { // return MAPPER.writeValueAsString(this.items); // } catch (IOException ioe) { // throw new RuntimeException("Problem writing JSON cart", ioe); // } // } // // public static boolean isAbandoned(String timestamp) { // d // DateTime ts = EVENT_DTF.parseDateTime(timestamp); // DateTime cutoff = new DateTime(DateTimeZone.UTC) // .minusSeconds(ABANDONED_AFTER_SECS); // return ts.isBefore(cutoff); // } // } // Path: ch05/nile-carts/src/main/java/nile/tasks/AbandonedCartStreamTask.java import java.util.HashMap; import java.util.HashSet; import java.util.Map; import java.util.Set; import org.apache.samza.config.Config; import org.apache.samza.storage.kv.KeyValueStore; import org.apache.samza.storage.kv.KeyValueIterator; import org.apache.samza.storage.kv.Entry; import org.apache.samza.system.IncomingMessageEnvelope; import org.apache.samza.system.OutgoingMessageEnvelope; import org.apache.samza.system.SystemStream; import org.apache.samza.task.InitableTask; import org.apache.samza.task.MessageCollector; import org.apache.samza.task.StreamTask; import org.apache.samza.task.TaskContext; import org.apache.samza.task.TaskCoordinator; import org.apache.samza.task.WindowableTask; import nile.events.AbandonedCartEvent; import nile.events.AbandonedCartEvent.DirectObject.Cart; if (verb.equals("add")) { // a String timestamp = (String) ((Map<String, Object>) event.get("context")).get("timestamp"); Map<String, Object> item = (Map<String, Object>) ((Map<String, Object>) event.get("directObject")).get("item"); Cart cart = new Cart(store.get(asCartKey(shopper))); cart.addItem(item); store.put(asTimestampKey(shopper), timestamp); store.put(asCartKey(shopper), cart.asJson()); } else if (verb.equals("place")) { // b resetShopper(shopper); } } @Override public void window(MessageCollector collector, TaskCoordinator coordinator) { KeyValueIterator<String, String> entries = store.all(); while (entries.hasNext()) { // c Entry<String, String> entry = entries.next(); String key = entry.getKey(); String value = entry.getValue(); if (isTimestampKey(key) && Cart.isAbandoned(value)) { // d String shopper = extractShopper(key); String cart = store.get(asCartKey(shopper));
AbandonedCartEvent event =
tensorchen/rrs
src/main/java/cn/com/chenyixiao/rrs/service/impl/FoodServiceImpl.java
// Path: src/main/java/cn/com/chenyixiao/rrs/dao/FoodDAO.java // public interface FoodDAO { // // public void addFood(Food food); // public void updateFood(Food food); // public Food getFood(Long id); // public List<Food> getAllFoods(); // public void deleteFood(Long id); // public void deleteAllFoods(); // // public Long count(); // // public Food findByName(String name); // } // // Path: src/main/java/cn/com/chenyixiao/rrs/dao/RestaurantFoodDAO.java // public interface RestaurantFoodDAO { // // public void addRestaurantFood(RestaurantFood restaurantFood); // public void updateRestaurantFood(RestaurantFood restaurantFood); // public RestaurantFood getRestaurantFood(Long id); // public List<RestaurantFood> getAllRestaurantFoods(); // public void deleteRestaurantFood(Long id); // public void deleteAllRestaurantFood(); // // public Long count(); // // public List<RestaurantFood> getRestaurantFoodsByRestaurantId(Long restaurantId); // } // // Path: src/main/java/cn/com/chenyixiao/rrs/entity/Food.java // @Entity // @Table(name = "food", catalog = "rrs") // public class Food implements java.io.Serializable { // // private long id; // private String name; // // public Food() { // } // // public Food(long id) { // this.id = id; // } // // public Food(long id, String name) { // this.id = id; // this.name = name; // } // // @Id // @GeneratedValue(strategy = GenerationType.IDENTITY) // @Column(name = "id", unique = true, nullable = false) // public long getId() { // return this.id; // } // // public void setId(long id) { // this.id = id; // } // // @Column(name = "name") // public String getName() { // return this.name; // } // // public void setName(String name) { // this.name = name; // } // // } // // Path: src/main/java/cn/com/chenyixiao/rrs/entity/RestaurantFood.java // @Entity // @Table(name = "restaurant_food", catalog = "rrs") // public class RestaurantFood { // private long id; // private long restaurantId; // private long foodId; // // // public RestaurantFood() { // } // // // public RestaurantFood(long id, long restaurantId, long foodId) { // this.id = id; // this.restaurantId = restaurantId; // this.foodId = foodId; // } // // // @Id // @GeneratedValue(strategy = GenerationType.IDENTITY) // @Column(name = "id", unique = true, nullable = false) // public long getId() { // return id; // } // public void setId(long id) { // this.id = id; // } // // @Column(name = "restaurant_id") // public long getRestaurantId() { // return restaurantId; // } // public void setRestaurantId(long restaurantId) { // this.restaurantId = restaurantId; // } // // @Column(name = "food_id") // public long getFoodId() { // return foodId; // } // public void setFoodId(long foodId) { // this.foodId = foodId; // } // // // } // // Path: src/main/java/cn/com/chenyixiao/rrs/service/FoodService.java // public interface FoodService { // // public void addFood(Food food); // public void updateFood(Food food); // public Food getFood(Long id); // public List<Food> getAllFoods(); // public void deleteFood(Long id); // public void deleteAllFoods(); // // public Long count(); // // public Food findByName(String name); // // public List<Food> getFoodsByRestaurantId(Long restaurantId); // }
import java.util.ArrayList; import java.util.List; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import cn.com.chenyixiao.rrs.dao.FoodDAO; import cn.com.chenyixiao.rrs.dao.RestaurantFoodDAO; import cn.com.chenyixiao.rrs.entity.Food; import cn.com.chenyixiao.rrs.entity.RestaurantFood; import cn.com.chenyixiao.rrs.service.FoodService;
package cn.com.chenyixiao.rrs.service.impl; @Service @Transactional
// Path: src/main/java/cn/com/chenyixiao/rrs/dao/FoodDAO.java // public interface FoodDAO { // // public void addFood(Food food); // public void updateFood(Food food); // public Food getFood(Long id); // public List<Food> getAllFoods(); // public void deleteFood(Long id); // public void deleteAllFoods(); // // public Long count(); // // public Food findByName(String name); // } // // Path: src/main/java/cn/com/chenyixiao/rrs/dao/RestaurantFoodDAO.java // public interface RestaurantFoodDAO { // // public void addRestaurantFood(RestaurantFood restaurantFood); // public void updateRestaurantFood(RestaurantFood restaurantFood); // public RestaurantFood getRestaurantFood(Long id); // public List<RestaurantFood> getAllRestaurantFoods(); // public void deleteRestaurantFood(Long id); // public void deleteAllRestaurantFood(); // // public Long count(); // // public List<RestaurantFood> getRestaurantFoodsByRestaurantId(Long restaurantId); // } // // Path: src/main/java/cn/com/chenyixiao/rrs/entity/Food.java // @Entity // @Table(name = "food", catalog = "rrs") // public class Food implements java.io.Serializable { // // private long id; // private String name; // // public Food() { // } // // public Food(long id) { // this.id = id; // } // // public Food(long id, String name) { // this.id = id; // this.name = name; // } // // @Id // @GeneratedValue(strategy = GenerationType.IDENTITY) // @Column(name = "id", unique = true, nullable = false) // public long getId() { // return this.id; // } // // public void setId(long id) { // this.id = id; // } // // @Column(name = "name") // public String getName() { // return this.name; // } // // public void setName(String name) { // this.name = name; // } // // } // // Path: src/main/java/cn/com/chenyixiao/rrs/entity/RestaurantFood.java // @Entity // @Table(name = "restaurant_food", catalog = "rrs") // public class RestaurantFood { // private long id; // private long restaurantId; // private long foodId; // // // public RestaurantFood() { // } // // // public RestaurantFood(long id, long restaurantId, long foodId) { // this.id = id; // this.restaurantId = restaurantId; // this.foodId = foodId; // } // // // @Id // @GeneratedValue(strategy = GenerationType.IDENTITY) // @Column(name = "id", unique = true, nullable = false) // public long getId() { // return id; // } // public void setId(long id) { // this.id = id; // } // // @Column(name = "restaurant_id") // public long getRestaurantId() { // return restaurantId; // } // public void setRestaurantId(long restaurantId) { // this.restaurantId = restaurantId; // } // // @Column(name = "food_id") // public long getFoodId() { // return foodId; // } // public void setFoodId(long foodId) { // this.foodId = foodId; // } // // // } // // Path: src/main/java/cn/com/chenyixiao/rrs/service/FoodService.java // public interface FoodService { // // public void addFood(Food food); // public void updateFood(Food food); // public Food getFood(Long id); // public List<Food> getAllFoods(); // public void deleteFood(Long id); // public void deleteAllFoods(); // // public Long count(); // // public Food findByName(String name); // // public List<Food> getFoodsByRestaurantId(Long restaurantId); // } // Path: src/main/java/cn/com/chenyixiao/rrs/service/impl/FoodServiceImpl.java import java.util.ArrayList; import java.util.List; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import cn.com.chenyixiao.rrs.dao.FoodDAO; import cn.com.chenyixiao.rrs.dao.RestaurantFoodDAO; import cn.com.chenyixiao.rrs.entity.Food; import cn.com.chenyixiao.rrs.entity.RestaurantFood; import cn.com.chenyixiao.rrs.service.FoodService; package cn.com.chenyixiao.rrs.service.impl; @Service @Transactional
public class FoodServiceImpl implements FoodService {
tensorchen/rrs
src/main/java/cn/com/chenyixiao/rrs/service/impl/FoodServiceImpl.java
// Path: src/main/java/cn/com/chenyixiao/rrs/dao/FoodDAO.java // public interface FoodDAO { // // public void addFood(Food food); // public void updateFood(Food food); // public Food getFood(Long id); // public List<Food> getAllFoods(); // public void deleteFood(Long id); // public void deleteAllFoods(); // // public Long count(); // // public Food findByName(String name); // } // // Path: src/main/java/cn/com/chenyixiao/rrs/dao/RestaurantFoodDAO.java // public interface RestaurantFoodDAO { // // public void addRestaurantFood(RestaurantFood restaurantFood); // public void updateRestaurantFood(RestaurantFood restaurantFood); // public RestaurantFood getRestaurantFood(Long id); // public List<RestaurantFood> getAllRestaurantFoods(); // public void deleteRestaurantFood(Long id); // public void deleteAllRestaurantFood(); // // public Long count(); // // public List<RestaurantFood> getRestaurantFoodsByRestaurantId(Long restaurantId); // } // // Path: src/main/java/cn/com/chenyixiao/rrs/entity/Food.java // @Entity // @Table(name = "food", catalog = "rrs") // public class Food implements java.io.Serializable { // // private long id; // private String name; // // public Food() { // } // // public Food(long id) { // this.id = id; // } // // public Food(long id, String name) { // this.id = id; // this.name = name; // } // // @Id // @GeneratedValue(strategy = GenerationType.IDENTITY) // @Column(name = "id", unique = true, nullable = false) // public long getId() { // return this.id; // } // // public void setId(long id) { // this.id = id; // } // // @Column(name = "name") // public String getName() { // return this.name; // } // // public void setName(String name) { // this.name = name; // } // // } // // Path: src/main/java/cn/com/chenyixiao/rrs/entity/RestaurantFood.java // @Entity // @Table(name = "restaurant_food", catalog = "rrs") // public class RestaurantFood { // private long id; // private long restaurantId; // private long foodId; // // // public RestaurantFood() { // } // // // public RestaurantFood(long id, long restaurantId, long foodId) { // this.id = id; // this.restaurantId = restaurantId; // this.foodId = foodId; // } // // // @Id // @GeneratedValue(strategy = GenerationType.IDENTITY) // @Column(name = "id", unique = true, nullable = false) // public long getId() { // return id; // } // public void setId(long id) { // this.id = id; // } // // @Column(name = "restaurant_id") // public long getRestaurantId() { // return restaurantId; // } // public void setRestaurantId(long restaurantId) { // this.restaurantId = restaurantId; // } // // @Column(name = "food_id") // public long getFoodId() { // return foodId; // } // public void setFoodId(long foodId) { // this.foodId = foodId; // } // // // } // // Path: src/main/java/cn/com/chenyixiao/rrs/service/FoodService.java // public interface FoodService { // // public void addFood(Food food); // public void updateFood(Food food); // public Food getFood(Long id); // public List<Food> getAllFoods(); // public void deleteFood(Long id); // public void deleteAllFoods(); // // public Long count(); // // public Food findByName(String name); // // public List<Food> getFoodsByRestaurantId(Long restaurantId); // }
import java.util.ArrayList; import java.util.List; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import cn.com.chenyixiao.rrs.dao.FoodDAO; import cn.com.chenyixiao.rrs.dao.RestaurantFoodDAO; import cn.com.chenyixiao.rrs.entity.Food; import cn.com.chenyixiao.rrs.entity.RestaurantFood; import cn.com.chenyixiao.rrs.service.FoodService;
package cn.com.chenyixiao.rrs.service.impl; @Service @Transactional public class FoodServiceImpl implements FoodService { @Autowired
// Path: src/main/java/cn/com/chenyixiao/rrs/dao/FoodDAO.java // public interface FoodDAO { // // public void addFood(Food food); // public void updateFood(Food food); // public Food getFood(Long id); // public List<Food> getAllFoods(); // public void deleteFood(Long id); // public void deleteAllFoods(); // // public Long count(); // // public Food findByName(String name); // } // // Path: src/main/java/cn/com/chenyixiao/rrs/dao/RestaurantFoodDAO.java // public interface RestaurantFoodDAO { // // public void addRestaurantFood(RestaurantFood restaurantFood); // public void updateRestaurantFood(RestaurantFood restaurantFood); // public RestaurantFood getRestaurantFood(Long id); // public List<RestaurantFood> getAllRestaurantFoods(); // public void deleteRestaurantFood(Long id); // public void deleteAllRestaurantFood(); // // public Long count(); // // public List<RestaurantFood> getRestaurantFoodsByRestaurantId(Long restaurantId); // } // // Path: src/main/java/cn/com/chenyixiao/rrs/entity/Food.java // @Entity // @Table(name = "food", catalog = "rrs") // public class Food implements java.io.Serializable { // // private long id; // private String name; // // public Food() { // } // // public Food(long id) { // this.id = id; // } // // public Food(long id, String name) { // this.id = id; // this.name = name; // } // // @Id // @GeneratedValue(strategy = GenerationType.IDENTITY) // @Column(name = "id", unique = true, nullable = false) // public long getId() { // return this.id; // } // // public void setId(long id) { // this.id = id; // } // // @Column(name = "name") // public String getName() { // return this.name; // } // // public void setName(String name) { // this.name = name; // } // // } // // Path: src/main/java/cn/com/chenyixiao/rrs/entity/RestaurantFood.java // @Entity // @Table(name = "restaurant_food", catalog = "rrs") // public class RestaurantFood { // private long id; // private long restaurantId; // private long foodId; // // // public RestaurantFood() { // } // // // public RestaurantFood(long id, long restaurantId, long foodId) { // this.id = id; // this.restaurantId = restaurantId; // this.foodId = foodId; // } // // // @Id // @GeneratedValue(strategy = GenerationType.IDENTITY) // @Column(name = "id", unique = true, nullable = false) // public long getId() { // return id; // } // public void setId(long id) { // this.id = id; // } // // @Column(name = "restaurant_id") // public long getRestaurantId() { // return restaurantId; // } // public void setRestaurantId(long restaurantId) { // this.restaurantId = restaurantId; // } // // @Column(name = "food_id") // public long getFoodId() { // return foodId; // } // public void setFoodId(long foodId) { // this.foodId = foodId; // } // // // } // // Path: src/main/java/cn/com/chenyixiao/rrs/service/FoodService.java // public interface FoodService { // // public void addFood(Food food); // public void updateFood(Food food); // public Food getFood(Long id); // public List<Food> getAllFoods(); // public void deleteFood(Long id); // public void deleteAllFoods(); // // public Long count(); // // public Food findByName(String name); // // public List<Food> getFoodsByRestaurantId(Long restaurantId); // } // Path: src/main/java/cn/com/chenyixiao/rrs/service/impl/FoodServiceImpl.java import java.util.ArrayList; import java.util.List; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import cn.com.chenyixiao.rrs.dao.FoodDAO; import cn.com.chenyixiao.rrs.dao.RestaurantFoodDAO; import cn.com.chenyixiao.rrs.entity.Food; import cn.com.chenyixiao.rrs.entity.RestaurantFood; import cn.com.chenyixiao.rrs.service.FoodService; package cn.com.chenyixiao.rrs.service.impl; @Service @Transactional public class FoodServiceImpl implements FoodService { @Autowired
private FoodDAO foodDAO;
tensorchen/rrs
src/main/java/cn/com/chenyixiao/rrs/service/impl/FoodServiceImpl.java
// Path: src/main/java/cn/com/chenyixiao/rrs/dao/FoodDAO.java // public interface FoodDAO { // // public void addFood(Food food); // public void updateFood(Food food); // public Food getFood(Long id); // public List<Food> getAllFoods(); // public void deleteFood(Long id); // public void deleteAllFoods(); // // public Long count(); // // public Food findByName(String name); // } // // Path: src/main/java/cn/com/chenyixiao/rrs/dao/RestaurantFoodDAO.java // public interface RestaurantFoodDAO { // // public void addRestaurantFood(RestaurantFood restaurantFood); // public void updateRestaurantFood(RestaurantFood restaurantFood); // public RestaurantFood getRestaurantFood(Long id); // public List<RestaurantFood> getAllRestaurantFoods(); // public void deleteRestaurantFood(Long id); // public void deleteAllRestaurantFood(); // // public Long count(); // // public List<RestaurantFood> getRestaurantFoodsByRestaurantId(Long restaurantId); // } // // Path: src/main/java/cn/com/chenyixiao/rrs/entity/Food.java // @Entity // @Table(name = "food", catalog = "rrs") // public class Food implements java.io.Serializable { // // private long id; // private String name; // // public Food() { // } // // public Food(long id) { // this.id = id; // } // // public Food(long id, String name) { // this.id = id; // this.name = name; // } // // @Id // @GeneratedValue(strategy = GenerationType.IDENTITY) // @Column(name = "id", unique = true, nullable = false) // public long getId() { // return this.id; // } // // public void setId(long id) { // this.id = id; // } // // @Column(name = "name") // public String getName() { // return this.name; // } // // public void setName(String name) { // this.name = name; // } // // } // // Path: src/main/java/cn/com/chenyixiao/rrs/entity/RestaurantFood.java // @Entity // @Table(name = "restaurant_food", catalog = "rrs") // public class RestaurantFood { // private long id; // private long restaurantId; // private long foodId; // // // public RestaurantFood() { // } // // // public RestaurantFood(long id, long restaurantId, long foodId) { // this.id = id; // this.restaurantId = restaurantId; // this.foodId = foodId; // } // // // @Id // @GeneratedValue(strategy = GenerationType.IDENTITY) // @Column(name = "id", unique = true, nullable = false) // public long getId() { // return id; // } // public void setId(long id) { // this.id = id; // } // // @Column(name = "restaurant_id") // public long getRestaurantId() { // return restaurantId; // } // public void setRestaurantId(long restaurantId) { // this.restaurantId = restaurantId; // } // // @Column(name = "food_id") // public long getFoodId() { // return foodId; // } // public void setFoodId(long foodId) { // this.foodId = foodId; // } // // // } // // Path: src/main/java/cn/com/chenyixiao/rrs/service/FoodService.java // public interface FoodService { // // public void addFood(Food food); // public void updateFood(Food food); // public Food getFood(Long id); // public List<Food> getAllFoods(); // public void deleteFood(Long id); // public void deleteAllFoods(); // // public Long count(); // // public Food findByName(String name); // // public List<Food> getFoodsByRestaurantId(Long restaurantId); // }
import java.util.ArrayList; import java.util.List; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import cn.com.chenyixiao.rrs.dao.FoodDAO; import cn.com.chenyixiao.rrs.dao.RestaurantFoodDAO; import cn.com.chenyixiao.rrs.entity.Food; import cn.com.chenyixiao.rrs.entity.RestaurantFood; import cn.com.chenyixiao.rrs.service.FoodService;
package cn.com.chenyixiao.rrs.service.impl; @Service @Transactional public class FoodServiceImpl implements FoodService { @Autowired private FoodDAO foodDAO; @Autowired
// Path: src/main/java/cn/com/chenyixiao/rrs/dao/FoodDAO.java // public interface FoodDAO { // // public void addFood(Food food); // public void updateFood(Food food); // public Food getFood(Long id); // public List<Food> getAllFoods(); // public void deleteFood(Long id); // public void deleteAllFoods(); // // public Long count(); // // public Food findByName(String name); // } // // Path: src/main/java/cn/com/chenyixiao/rrs/dao/RestaurantFoodDAO.java // public interface RestaurantFoodDAO { // // public void addRestaurantFood(RestaurantFood restaurantFood); // public void updateRestaurantFood(RestaurantFood restaurantFood); // public RestaurantFood getRestaurantFood(Long id); // public List<RestaurantFood> getAllRestaurantFoods(); // public void deleteRestaurantFood(Long id); // public void deleteAllRestaurantFood(); // // public Long count(); // // public List<RestaurantFood> getRestaurantFoodsByRestaurantId(Long restaurantId); // } // // Path: src/main/java/cn/com/chenyixiao/rrs/entity/Food.java // @Entity // @Table(name = "food", catalog = "rrs") // public class Food implements java.io.Serializable { // // private long id; // private String name; // // public Food() { // } // // public Food(long id) { // this.id = id; // } // // public Food(long id, String name) { // this.id = id; // this.name = name; // } // // @Id // @GeneratedValue(strategy = GenerationType.IDENTITY) // @Column(name = "id", unique = true, nullable = false) // public long getId() { // return this.id; // } // // public void setId(long id) { // this.id = id; // } // // @Column(name = "name") // public String getName() { // return this.name; // } // // public void setName(String name) { // this.name = name; // } // // } // // Path: src/main/java/cn/com/chenyixiao/rrs/entity/RestaurantFood.java // @Entity // @Table(name = "restaurant_food", catalog = "rrs") // public class RestaurantFood { // private long id; // private long restaurantId; // private long foodId; // // // public RestaurantFood() { // } // // // public RestaurantFood(long id, long restaurantId, long foodId) { // this.id = id; // this.restaurantId = restaurantId; // this.foodId = foodId; // } // // // @Id // @GeneratedValue(strategy = GenerationType.IDENTITY) // @Column(name = "id", unique = true, nullable = false) // public long getId() { // return id; // } // public void setId(long id) { // this.id = id; // } // // @Column(name = "restaurant_id") // public long getRestaurantId() { // return restaurantId; // } // public void setRestaurantId(long restaurantId) { // this.restaurantId = restaurantId; // } // // @Column(name = "food_id") // public long getFoodId() { // return foodId; // } // public void setFoodId(long foodId) { // this.foodId = foodId; // } // // // } // // Path: src/main/java/cn/com/chenyixiao/rrs/service/FoodService.java // public interface FoodService { // // public void addFood(Food food); // public void updateFood(Food food); // public Food getFood(Long id); // public List<Food> getAllFoods(); // public void deleteFood(Long id); // public void deleteAllFoods(); // // public Long count(); // // public Food findByName(String name); // // public List<Food> getFoodsByRestaurantId(Long restaurantId); // } // Path: src/main/java/cn/com/chenyixiao/rrs/service/impl/FoodServiceImpl.java import java.util.ArrayList; import java.util.List; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import cn.com.chenyixiao.rrs.dao.FoodDAO; import cn.com.chenyixiao.rrs.dao.RestaurantFoodDAO; import cn.com.chenyixiao.rrs.entity.Food; import cn.com.chenyixiao.rrs.entity.RestaurantFood; import cn.com.chenyixiao.rrs.service.FoodService; package cn.com.chenyixiao.rrs.service.impl; @Service @Transactional public class FoodServiceImpl implements FoodService { @Autowired private FoodDAO foodDAO; @Autowired
private RestaurantFoodDAO restaurantFoodDAO;
tensorchen/rrs
src/main/java/cn/com/chenyixiao/rrs/service/impl/FoodServiceImpl.java
// Path: src/main/java/cn/com/chenyixiao/rrs/dao/FoodDAO.java // public interface FoodDAO { // // public void addFood(Food food); // public void updateFood(Food food); // public Food getFood(Long id); // public List<Food> getAllFoods(); // public void deleteFood(Long id); // public void deleteAllFoods(); // // public Long count(); // // public Food findByName(String name); // } // // Path: src/main/java/cn/com/chenyixiao/rrs/dao/RestaurantFoodDAO.java // public interface RestaurantFoodDAO { // // public void addRestaurantFood(RestaurantFood restaurantFood); // public void updateRestaurantFood(RestaurantFood restaurantFood); // public RestaurantFood getRestaurantFood(Long id); // public List<RestaurantFood> getAllRestaurantFoods(); // public void deleteRestaurantFood(Long id); // public void deleteAllRestaurantFood(); // // public Long count(); // // public List<RestaurantFood> getRestaurantFoodsByRestaurantId(Long restaurantId); // } // // Path: src/main/java/cn/com/chenyixiao/rrs/entity/Food.java // @Entity // @Table(name = "food", catalog = "rrs") // public class Food implements java.io.Serializable { // // private long id; // private String name; // // public Food() { // } // // public Food(long id) { // this.id = id; // } // // public Food(long id, String name) { // this.id = id; // this.name = name; // } // // @Id // @GeneratedValue(strategy = GenerationType.IDENTITY) // @Column(name = "id", unique = true, nullable = false) // public long getId() { // return this.id; // } // // public void setId(long id) { // this.id = id; // } // // @Column(name = "name") // public String getName() { // return this.name; // } // // public void setName(String name) { // this.name = name; // } // // } // // Path: src/main/java/cn/com/chenyixiao/rrs/entity/RestaurantFood.java // @Entity // @Table(name = "restaurant_food", catalog = "rrs") // public class RestaurantFood { // private long id; // private long restaurantId; // private long foodId; // // // public RestaurantFood() { // } // // // public RestaurantFood(long id, long restaurantId, long foodId) { // this.id = id; // this.restaurantId = restaurantId; // this.foodId = foodId; // } // // // @Id // @GeneratedValue(strategy = GenerationType.IDENTITY) // @Column(name = "id", unique = true, nullable = false) // public long getId() { // return id; // } // public void setId(long id) { // this.id = id; // } // // @Column(name = "restaurant_id") // public long getRestaurantId() { // return restaurantId; // } // public void setRestaurantId(long restaurantId) { // this.restaurantId = restaurantId; // } // // @Column(name = "food_id") // public long getFoodId() { // return foodId; // } // public void setFoodId(long foodId) { // this.foodId = foodId; // } // // // } // // Path: src/main/java/cn/com/chenyixiao/rrs/service/FoodService.java // public interface FoodService { // // public void addFood(Food food); // public void updateFood(Food food); // public Food getFood(Long id); // public List<Food> getAllFoods(); // public void deleteFood(Long id); // public void deleteAllFoods(); // // public Long count(); // // public Food findByName(String name); // // public List<Food> getFoodsByRestaurantId(Long restaurantId); // }
import java.util.ArrayList; import java.util.List; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import cn.com.chenyixiao.rrs.dao.FoodDAO; import cn.com.chenyixiao.rrs.dao.RestaurantFoodDAO; import cn.com.chenyixiao.rrs.entity.Food; import cn.com.chenyixiao.rrs.entity.RestaurantFood; import cn.com.chenyixiao.rrs.service.FoodService;
package cn.com.chenyixiao.rrs.service.impl; @Service @Transactional public class FoodServiceImpl implements FoodService { @Autowired private FoodDAO foodDAO; @Autowired private RestaurantFoodDAO restaurantFoodDAO;
// Path: src/main/java/cn/com/chenyixiao/rrs/dao/FoodDAO.java // public interface FoodDAO { // // public void addFood(Food food); // public void updateFood(Food food); // public Food getFood(Long id); // public List<Food> getAllFoods(); // public void deleteFood(Long id); // public void deleteAllFoods(); // // public Long count(); // // public Food findByName(String name); // } // // Path: src/main/java/cn/com/chenyixiao/rrs/dao/RestaurantFoodDAO.java // public interface RestaurantFoodDAO { // // public void addRestaurantFood(RestaurantFood restaurantFood); // public void updateRestaurantFood(RestaurantFood restaurantFood); // public RestaurantFood getRestaurantFood(Long id); // public List<RestaurantFood> getAllRestaurantFoods(); // public void deleteRestaurantFood(Long id); // public void deleteAllRestaurantFood(); // // public Long count(); // // public List<RestaurantFood> getRestaurantFoodsByRestaurantId(Long restaurantId); // } // // Path: src/main/java/cn/com/chenyixiao/rrs/entity/Food.java // @Entity // @Table(name = "food", catalog = "rrs") // public class Food implements java.io.Serializable { // // private long id; // private String name; // // public Food() { // } // // public Food(long id) { // this.id = id; // } // // public Food(long id, String name) { // this.id = id; // this.name = name; // } // // @Id // @GeneratedValue(strategy = GenerationType.IDENTITY) // @Column(name = "id", unique = true, nullable = false) // public long getId() { // return this.id; // } // // public void setId(long id) { // this.id = id; // } // // @Column(name = "name") // public String getName() { // return this.name; // } // // public void setName(String name) { // this.name = name; // } // // } // // Path: src/main/java/cn/com/chenyixiao/rrs/entity/RestaurantFood.java // @Entity // @Table(name = "restaurant_food", catalog = "rrs") // public class RestaurantFood { // private long id; // private long restaurantId; // private long foodId; // // // public RestaurantFood() { // } // // // public RestaurantFood(long id, long restaurantId, long foodId) { // this.id = id; // this.restaurantId = restaurantId; // this.foodId = foodId; // } // // // @Id // @GeneratedValue(strategy = GenerationType.IDENTITY) // @Column(name = "id", unique = true, nullable = false) // public long getId() { // return id; // } // public void setId(long id) { // this.id = id; // } // // @Column(name = "restaurant_id") // public long getRestaurantId() { // return restaurantId; // } // public void setRestaurantId(long restaurantId) { // this.restaurantId = restaurantId; // } // // @Column(name = "food_id") // public long getFoodId() { // return foodId; // } // public void setFoodId(long foodId) { // this.foodId = foodId; // } // // // } // // Path: src/main/java/cn/com/chenyixiao/rrs/service/FoodService.java // public interface FoodService { // // public void addFood(Food food); // public void updateFood(Food food); // public Food getFood(Long id); // public List<Food> getAllFoods(); // public void deleteFood(Long id); // public void deleteAllFoods(); // // public Long count(); // // public Food findByName(String name); // // public List<Food> getFoodsByRestaurantId(Long restaurantId); // } // Path: src/main/java/cn/com/chenyixiao/rrs/service/impl/FoodServiceImpl.java import java.util.ArrayList; import java.util.List; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import cn.com.chenyixiao.rrs.dao.FoodDAO; import cn.com.chenyixiao.rrs.dao.RestaurantFoodDAO; import cn.com.chenyixiao.rrs.entity.Food; import cn.com.chenyixiao.rrs.entity.RestaurantFood; import cn.com.chenyixiao.rrs.service.FoodService; package cn.com.chenyixiao.rrs.service.impl; @Service @Transactional public class FoodServiceImpl implements FoodService { @Autowired private FoodDAO foodDAO; @Autowired private RestaurantFoodDAO restaurantFoodDAO;
public void addFood(Food food) {
tensorchen/rrs
src/main/java/cn/com/chenyixiao/rrs/service/impl/FoodServiceImpl.java
// Path: src/main/java/cn/com/chenyixiao/rrs/dao/FoodDAO.java // public interface FoodDAO { // // public void addFood(Food food); // public void updateFood(Food food); // public Food getFood(Long id); // public List<Food> getAllFoods(); // public void deleteFood(Long id); // public void deleteAllFoods(); // // public Long count(); // // public Food findByName(String name); // } // // Path: src/main/java/cn/com/chenyixiao/rrs/dao/RestaurantFoodDAO.java // public interface RestaurantFoodDAO { // // public void addRestaurantFood(RestaurantFood restaurantFood); // public void updateRestaurantFood(RestaurantFood restaurantFood); // public RestaurantFood getRestaurantFood(Long id); // public List<RestaurantFood> getAllRestaurantFoods(); // public void deleteRestaurantFood(Long id); // public void deleteAllRestaurantFood(); // // public Long count(); // // public List<RestaurantFood> getRestaurantFoodsByRestaurantId(Long restaurantId); // } // // Path: src/main/java/cn/com/chenyixiao/rrs/entity/Food.java // @Entity // @Table(name = "food", catalog = "rrs") // public class Food implements java.io.Serializable { // // private long id; // private String name; // // public Food() { // } // // public Food(long id) { // this.id = id; // } // // public Food(long id, String name) { // this.id = id; // this.name = name; // } // // @Id // @GeneratedValue(strategy = GenerationType.IDENTITY) // @Column(name = "id", unique = true, nullable = false) // public long getId() { // return this.id; // } // // public void setId(long id) { // this.id = id; // } // // @Column(name = "name") // public String getName() { // return this.name; // } // // public void setName(String name) { // this.name = name; // } // // } // // Path: src/main/java/cn/com/chenyixiao/rrs/entity/RestaurantFood.java // @Entity // @Table(name = "restaurant_food", catalog = "rrs") // public class RestaurantFood { // private long id; // private long restaurantId; // private long foodId; // // // public RestaurantFood() { // } // // // public RestaurantFood(long id, long restaurantId, long foodId) { // this.id = id; // this.restaurantId = restaurantId; // this.foodId = foodId; // } // // // @Id // @GeneratedValue(strategy = GenerationType.IDENTITY) // @Column(name = "id", unique = true, nullable = false) // public long getId() { // return id; // } // public void setId(long id) { // this.id = id; // } // // @Column(name = "restaurant_id") // public long getRestaurantId() { // return restaurantId; // } // public void setRestaurantId(long restaurantId) { // this.restaurantId = restaurantId; // } // // @Column(name = "food_id") // public long getFoodId() { // return foodId; // } // public void setFoodId(long foodId) { // this.foodId = foodId; // } // // // } // // Path: src/main/java/cn/com/chenyixiao/rrs/service/FoodService.java // public interface FoodService { // // public void addFood(Food food); // public void updateFood(Food food); // public Food getFood(Long id); // public List<Food> getAllFoods(); // public void deleteFood(Long id); // public void deleteAllFoods(); // // public Long count(); // // public Food findByName(String name); // // public List<Food> getFoodsByRestaurantId(Long restaurantId); // }
import java.util.ArrayList; import java.util.List; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import cn.com.chenyixiao.rrs.dao.FoodDAO; import cn.com.chenyixiao.rrs.dao.RestaurantFoodDAO; import cn.com.chenyixiao.rrs.entity.Food; import cn.com.chenyixiao.rrs.entity.RestaurantFood; import cn.com.chenyixiao.rrs.service.FoodService;
return foodDAO.getFood(id); } @Override public List<Food> getAllFoods() { return foodDAO.getAllFoods(); } public void deleteFood(Long id) { foodDAO.deleteFood(id); } @Override public void deleteAllFoods() { foodDAO.deleteAllFoods(); } public Long count() { return foodDAO.count(); } @Override public Food findByName(String name) { return foodDAO.findByName(name); } @Override public List<Food> getFoodsByRestaurantId(Long restaurantId) { List<Food> foods = new ArrayList<Food>();
// Path: src/main/java/cn/com/chenyixiao/rrs/dao/FoodDAO.java // public interface FoodDAO { // // public void addFood(Food food); // public void updateFood(Food food); // public Food getFood(Long id); // public List<Food> getAllFoods(); // public void deleteFood(Long id); // public void deleteAllFoods(); // // public Long count(); // // public Food findByName(String name); // } // // Path: src/main/java/cn/com/chenyixiao/rrs/dao/RestaurantFoodDAO.java // public interface RestaurantFoodDAO { // // public void addRestaurantFood(RestaurantFood restaurantFood); // public void updateRestaurantFood(RestaurantFood restaurantFood); // public RestaurantFood getRestaurantFood(Long id); // public List<RestaurantFood> getAllRestaurantFoods(); // public void deleteRestaurantFood(Long id); // public void deleteAllRestaurantFood(); // // public Long count(); // // public List<RestaurantFood> getRestaurantFoodsByRestaurantId(Long restaurantId); // } // // Path: src/main/java/cn/com/chenyixiao/rrs/entity/Food.java // @Entity // @Table(name = "food", catalog = "rrs") // public class Food implements java.io.Serializable { // // private long id; // private String name; // // public Food() { // } // // public Food(long id) { // this.id = id; // } // // public Food(long id, String name) { // this.id = id; // this.name = name; // } // // @Id // @GeneratedValue(strategy = GenerationType.IDENTITY) // @Column(name = "id", unique = true, nullable = false) // public long getId() { // return this.id; // } // // public void setId(long id) { // this.id = id; // } // // @Column(name = "name") // public String getName() { // return this.name; // } // // public void setName(String name) { // this.name = name; // } // // } // // Path: src/main/java/cn/com/chenyixiao/rrs/entity/RestaurantFood.java // @Entity // @Table(name = "restaurant_food", catalog = "rrs") // public class RestaurantFood { // private long id; // private long restaurantId; // private long foodId; // // // public RestaurantFood() { // } // // // public RestaurantFood(long id, long restaurantId, long foodId) { // this.id = id; // this.restaurantId = restaurantId; // this.foodId = foodId; // } // // // @Id // @GeneratedValue(strategy = GenerationType.IDENTITY) // @Column(name = "id", unique = true, nullable = false) // public long getId() { // return id; // } // public void setId(long id) { // this.id = id; // } // // @Column(name = "restaurant_id") // public long getRestaurantId() { // return restaurantId; // } // public void setRestaurantId(long restaurantId) { // this.restaurantId = restaurantId; // } // // @Column(name = "food_id") // public long getFoodId() { // return foodId; // } // public void setFoodId(long foodId) { // this.foodId = foodId; // } // // // } // // Path: src/main/java/cn/com/chenyixiao/rrs/service/FoodService.java // public interface FoodService { // // public void addFood(Food food); // public void updateFood(Food food); // public Food getFood(Long id); // public List<Food> getAllFoods(); // public void deleteFood(Long id); // public void deleteAllFoods(); // // public Long count(); // // public Food findByName(String name); // // public List<Food> getFoodsByRestaurantId(Long restaurantId); // } // Path: src/main/java/cn/com/chenyixiao/rrs/service/impl/FoodServiceImpl.java import java.util.ArrayList; import java.util.List; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import cn.com.chenyixiao.rrs.dao.FoodDAO; import cn.com.chenyixiao.rrs.dao.RestaurantFoodDAO; import cn.com.chenyixiao.rrs.entity.Food; import cn.com.chenyixiao.rrs.entity.RestaurantFood; import cn.com.chenyixiao.rrs.service.FoodService; return foodDAO.getFood(id); } @Override public List<Food> getAllFoods() { return foodDAO.getAllFoods(); } public void deleteFood(Long id) { foodDAO.deleteFood(id); } @Override public void deleteAllFoods() { foodDAO.deleteAllFoods(); } public Long count() { return foodDAO.count(); } @Override public Food findByName(String name) { return foodDAO.findByName(name); } @Override public List<Food> getFoodsByRestaurantId(Long restaurantId) { List<Food> foods = new ArrayList<Food>();
List<RestaurantFood> restaurantFoods =
tensorchen/rrs
src/main/java/cn/com/chenyixiao/rrs/dao/impl/Preference2dDAOImpl.java
// Path: src/main/java/cn/com/chenyixiao/rrs/dao/Preference2dDAO.java // public interface Preference2dDAO { // // public void addPreference2d(Preference2d preference2d); // public void updatePreference2d(Preference2d preference2d); // public Preference2d getPreference2d(Long id); // public List<Preference2d> getAllPreference2ds(); // public void deletePreference2d(Long id); // public void deleteAllPreference2d(); // // public Long count(); // // public List<Preference2d> getPreferencesByUserId(Long userId); // } // // Path: src/main/java/cn/com/chenyixiao/rrs/entity/Preference2d.java // @Entity // @Table(name = "preference2d", catalog = "rrs") // public class Preference2d implements java.io.Serializable { // // private long id; // private Long restaurantId; // private Long userId; // private Double score; // // public Preference2d() { // } // // public Preference2d(long id) { // this.id = id; // } // // public Preference2d(long id, Long restaurantId, Long userId, Double score) { // this.id = id; // this.restaurantId = restaurantId; // this.userId = userId; // this.score = score; // } // // @Id // @GeneratedValue(strategy = GenerationType.IDENTITY) // @Column(name = "id", unique = true, nullable = false) // public long getId() { // return this.id; // } // // public void setId(long id) { // this.id = id; // } // // @Column(name = "restaurant_id") // public Long getRestaurantId() { // return this.restaurantId; // } // // public void setRestaurantId(Long restaurantId) { // this.restaurantId = restaurantId; // } // // @Column(name = "user_id") // public Long getUserId() { // return this.userId; // } // // public void setUserId(Long userId) { // this.userId = userId; // } // // @Column(name = "score", precision = 22, scale = 0) // public Double getScore() { // return this.score; // } // // public void setScore(Double score) { // this.score = score; // } // // }
import java.util.List; import org.hibernate.Query; import org.hibernate.Session; import org.hibernate.SessionFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Repository; import cn.com.chenyixiao.rrs.dao.Preference2dDAO; import cn.com.chenyixiao.rrs.entity.Preference2d;
package cn.com.chenyixiao.rrs.dao.impl; @Repository public class Preference2dDAOImpl implements Preference2dDAO { @Autowired private SessionFactory sessionFactory; private Session getCurrentSession() { return sessionFactory.getCurrentSession(); }
// Path: src/main/java/cn/com/chenyixiao/rrs/dao/Preference2dDAO.java // public interface Preference2dDAO { // // public void addPreference2d(Preference2d preference2d); // public void updatePreference2d(Preference2d preference2d); // public Preference2d getPreference2d(Long id); // public List<Preference2d> getAllPreference2ds(); // public void deletePreference2d(Long id); // public void deleteAllPreference2d(); // // public Long count(); // // public List<Preference2d> getPreferencesByUserId(Long userId); // } // // Path: src/main/java/cn/com/chenyixiao/rrs/entity/Preference2d.java // @Entity // @Table(name = "preference2d", catalog = "rrs") // public class Preference2d implements java.io.Serializable { // // private long id; // private Long restaurantId; // private Long userId; // private Double score; // // public Preference2d() { // } // // public Preference2d(long id) { // this.id = id; // } // // public Preference2d(long id, Long restaurantId, Long userId, Double score) { // this.id = id; // this.restaurantId = restaurantId; // this.userId = userId; // this.score = score; // } // // @Id // @GeneratedValue(strategy = GenerationType.IDENTITY) // @Column(name = "id", unique = true, nullable = false) // public long getId() { // return this.id; // } // // public void setId(long id) { // this.id = id; // } // // @Column(name = "restaurant_id") // public Long getRestaurantId() { // return this.restaurantId; // } // // public void setRestaurantId(Long restaurantId) { // this.restaurantId = restaurantId; // } // // @Column(name = "user_id") // public Long getUserId() { // return this.userId; // } // // public void setUserId(Long userId) { // this.userId = userId; // } // // @Column(name = "score", precision = 22, scale = 0) // public Double getScore() { // return this.score; // } // // public void setScore(Double score) { // this.score = score; // } // // } // Path: src/main/java/cn/com/chenyixiao/rrs/dao/impl/Preference2dDAOImpl.java import java.util.List; import org.hibernate.Query; import org.hibernate.Session; import org.hibernate.SessionFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Repository; import cn.com.chenyixiao.rrs.dao.Preference2dDAO; import cn.com.chenyixiao.rrs.entity.Preference2d; package cn.com.chenyixiao.rrs.dao.impl; @Repository public class Preference2dDAOImpl implements Preference2dDAO { @Autowired private SessionFactory sessionFactory; private Session getCurrentSession() { return sessionFactory.getCurrentSession(); }
public void addPreference2d(Preference2d preference2d) {
tensorchen/rrs
src/main/java/cn/com/chenyixiao/rrs/controller/Preference3dController.java
// Path: src/main/java/cn/com/chenyixiao/rrs/entity/Preference3d.java // @Entity // @Table(name = "preference3d", catalog = "rrs") // public class Preference3d implements java.io.Serializable { // // private long id; // private Long restaurantId; // private Long foodId; // private Long userId; // private String content; // private Double score; // // // public Preference3d() { // } // // public Preference3d(long id) { // this.id = id; // } // // public Preference3d(long id, Long restaurantId, Long foodId, Long userId, // String content, Double score) { // this.id = id; // this.restaurantId = restaurantId; // this.foodId = foodId; // this.userId = userId; // this.content = content; // this.score = score; // } // // @Id // @GeneratedValue(strategy = GenerationType.IDENTITY) // @Column(name = "id", unique = true, nullable = false) // public long getId() { // return this.id; // } // // public void setId(long id) { // this.id = id; // } // // @Column(name = "restaurant_id") // public Long getRestaurantId() { // return this.restaurantId; // } // // public void setRestaurantId(Long restaurantId) { // this.restaurantId = restaurantId; // } // // @Column(name = "food_id") // public Long getFoodId() { // return this.foodId; // } // // public void setFoodId(Long foodId) { // this.foodId = foodId; // } // // @Column(name = "user_id") // public Long getUserId() { // return this.userId; // } // // public void setUserId(Long userId) { // this.userId = userId; // } // // @Column(name = "content") // public String getContent() { // return content; // } // // public void setContent(String content) { // this.content = content; // } // // @Column(name = "score") // public Double getScore() { // return score; // } // // public void setScore(Double score) { // this.score = score; // } // // } // // Path: src/main/java/cn/com/chenyixiao/rrs/service/Preference3dService.java // public interface Preference3dService { // // public void addPreference3d(Preference3d preference3d); // public void updatePreference3d(Preference3d preference3d); // public Preference3d getPreference3d(Long id); // public List<Preference3d> getAllPreference3ds(); // public void deletePreference3d(Long id); // public void deleteAllPreference3d(); // // public Long count(); // // public void addOrUpdatePreference3d(Preference3d preference3d); // // public List<Preference3d> getPreference3dListByUser(Long userId); // }
import java.util.List; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.ResponseBody; import com.google.gson.Gson; import cn.com.chenyixiao.rrs.entity.Preference3d; import cn.com.chenyixiao.rrs.service.Preference3dService;
package cn.com.chenyixiao.rrs.controller; @Controller @RequestMapping(produces="application/json;charset=UTF-8", consumes="application/json;charset=UTF-8") public class Preference3dController { @Autowired
// Path: src/main/java/cn/com/chenyixiao/rrs/entity/Preference3d.java // @Entity // @Table(name = "preference3d", catalog = "rrs") // public class Preference3d implements java.io.Serializable { // // private long id; // private Long restaurantId; // private Long foodId; // private Long userId; // private String content; // private Double score; // // // public Preference3d() { // } // // public Preference3d(long id) { // this.id = id; // } // // public Preference3d(long id, Long restaurantId, Long foodId, Long userId, // String content, Double score) { // this.id = id; // this.restaurantId = restaurantId; // this.foodId = foodId; // this.userId = userId; // this.content = content; // this.score = score; // } // // @Id // @GeneratedValue(strategy = GenerationType.IDENTITY) // @Column(name = "id", unique = true, nullable = false) // public long getId() { // return this.id; // } // // public void setId(long id) { // this.id = id; // } // // @Column(name = "restaurant_id") // public Long getRestaurantId() { // return this.restaurantId; // } // // public void setRestaurantId(Long restaurantId) { // this.restaurantId = restaurantId; // } // // @Column(name = "food_id") // public Long getFoodId() { // return this.foodId; // } // // public void setFoodId(Long foodId) { // this.foodId = foodId; // } // // @Column(name = "user_id") // public Long getUserId() { // return this.userId; // } // // public void setUserId(Long userId) { // this.userId = userId; // } // // @Column(name = "content") // public String getContent() { // return content; // } // // public void setContent(String content) { // this.content = content; // } // // @Column(name = "score") // public Double getScore() { // return score; // } // // public void setScore(Double score) { // this.score = score; // } // // } // // Path: src/main/java/cn/com/chenyixiao/rrs/service/Preference3dService.java // public interface Preference3dService { // // public void addPreference3d(Preference3d preference3d); // public void updatePreference3d(Preference3d preference3d); // public Preference3d getPreference3d(Long id); // public List<Preference3d> getAllPreference3ds(); // public void deletePreference3d(Long id); // public void deleteAllPreference3d(); // // public Long count(); // // public void addOrUpdatePreference3d(Preference3d preference3d); // // public List<Preference3d> getPreference3dListByUser(Long userId); // } // Path: src/main/java/cn/com/chenyixiao/rrs/controller/Preference3dController.java import java.util.List; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.ResponseBody; import com.google.gson.Gson; import cn.com.chenyixiao.rrs.entity.Preference3d; import cn.com.chenyixiao.rrs.service.Preference3dService; package cn.com.chenyixiao.rrs.controller; @Controller @RequestMapping(produces="application/json;charset=UTF-8", consumes="application/json;charset=UTF-8") public class Preference3dController { @Autowired
private Preference3dService preference3dService;
tensorchen/rrs
src/main/java/cn/com/chenyixiao/rrs/controller/Preference3dController.java
// Path: src/main/java/cn/com/chenyixiao/rrs/entity/Preference3d.java // @Entity // @Table(name = "preference3d", catalog = "rrs") // public class Preference3d implements java.io.Serializable { // // private long id; // private Long restaurantId; // private Long foodId; // private Long userId; // private String content; // private Double score; // // // public Preference3d() { // } // // public Preference3d(long id) { // this.id = id; // } // // public Preference3d(long id, Long restaurantId, Long foodId, Long userId, // String content, Double score) { // this.id = id; // this.restaurantId = restaurantId; // this.foodId = foodId; // this.userId = userId; // this.content = content; // this.score = score; // } // // @Id // @GeneratedValue(strategy = GenerationType.IDENTITY) // @Column(name = "id", unique = true, nullable = false) // public long getId() { // return this.id; // } // // public void setId(long id) { // this.id = id; // } // // @Column(name = "restaurant_id") // public Long getRestaurantId() { // return this.restaurantId; // } // // public void setRestaurantId(Long restaurantId) { // this.restaurantId = restaurantId; // } // // @Column(name = "food_id") // public Long getFoodId() { // return this.foodId; // } // // public void setFoodId(Long foodId) { // this.foodId = foodId; // } // // @Column(name = "user_id") // public Long getUserId() { // return this.userId; // } // // public void setUserId(Long userId) { // this.userId = userId; // } // // @Column(name = "content") // public String getContent() { // return content; // } // // public void setContent(String content) { // this.content = content; // } // // @Column(name = "score") // public Double getScore() { // return score; // } // // public void setScore(Double score) { // this.score = score; // } // // } // // Path: src/main/java/cn/com/chenyixiao/rrs/service/Preference3dService.java // public interface Preference3dService { // // public void addPreference3d(Preference3d preference3d); // public void updatePreference3d(Preference3d preference3d); // public Preference3d getPreference3d(Long id); // public List<Preference3d> getAllPreference3ds(); // public void deletePreference3d(Long id); // public void deleteAllPreference3d(); // // public Long count(); // // public void addOrUpdatePreference3d(Preference3d preference3d); // // public List<Preference3d> getPreference3dListByUser(Long userId); // }
import java.util.List; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.ResponseBody; import com.google.gson.Gson; import cn.com.chenyixiao.rrs.entity.Preference3d; import cn.com.chenyixiao.rrs.service.Preference3dService;
package cn.com.chenyixiao.rrs.controller; @Controller @RequestMapping(produces="application/json;charset=UTF-8", consumes="application/json;charset=UTF-8") public class Preference3dController { @Autowired private Preference3dService preference3dService; @ResponseBody @RequestMapping(value = "/preference3d", method = RequestMethod.POST)
// Path: src/main/java/cn/com/chenyixiao/rrs/entity/Preference3d.java // @Entity // @Table(name = "preference3d", catalog = "rrs") // public class Preference3d implements java.io.Serializable { // // private long id; // private Long restaurantId; // private Long foodId; // private Long userId; // private String content; // private Double score; // // // public Preference3d() { // } // // public Preference3d(long id) { // this.id = id; // } // // public Preference3d(long id, Long restaurantId, Long foodId, Long userId, // String content, Double score) { // this.id = id; // this.restaurantId = restaurantId; // this.foodId = foodId; // this.userId = userId; // this.content = content; // this.score = score; // } // // @Id // @GeneratedValue(strategy = GenerationType.IDENTITY) // @Column(name = "id", unique = true, nullable = false) // public long getId() { // return this.id; // } // // public void setId(long id) { // this.id = id; // } // // @Column(name = "restaurant_id") // public Long getRestaurantId() { // return this.restaurantId; // } // // public void setRestaurantId(Long restaurantId) { // this.restaurantId = restaurantId; // } // // @Column(name = "food_id") // public Long getFoodId() { // return this.foodId; // } // // public void setFoodId(Long foodId) { // this.foodId = foodId; // } // // @Column(name = "user_id") // public Long getUserId() { // return this.userId; // } // // public void setUserId(Long userId) { // this.userId = userId; // } // // @Column(name = "content") // public String getContent() { // return content; // } // // public void setContent(String content) { // this.content = content; // } // // @Column(name = "score") // public Double getScore() { // return score; // } // // public void setScore(Double score) { // this.score = score; // } // // } // // Path: src/main/java/cn/com/chenyixiao/rrs/service/Preference3dService.java // public interface Preference3dService { // // public void addPreference3d(Preference3d preference3d); // public void updatePreference3d(Preference3d preference3d); // public Preference3d getPreference3d(Long id); // public List<Preference3d> getAllPreference3ds(); // public void deletePreference3d(Long id); // public void deleteAllPreference3d(); // // public Long count(); // // public void addOrUpdatePreference3d(Preference3d preference3d); // // public List<Preference3d> getPreference3dListByUser(Long userId); // } // Path: src/main/java/cn/com/chenyixiao/rrs/controller/Preference3dController.java import java.util.List; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.ResponseBody; import com.google.gson.Gson; import cn.com.chenyixiao.rrs.entity.Preference3d; import cn.com.chenyixiao.rrs.service.Preference3dService; package cn.com.chenyixiao.rrs.controller; @Controller @RequestMapping(produces="application/json;charset=UTF-8", consumes="application/json;charset=UTF-8") public class Preference3dController { @Autowired private Preference3dService preference3dService; @ResponseBody @RequestMapping(value = "/preference3d", method = RequestMethod.POST)
public String addPreference3d(@RequestBody List<Preference3d> preference3dList) {
tensorchen/rrs
src/main/java/cn/com/chenyixiao/rrs/dao/impl/RestaurantDAOImpl.java
// Path: src/main/java/cn/com/chenyixiao/rrs/dao/RestaurantDAO.java // public interface RestaurantDAO { // // public void addRestaurant(Restaurant restaurant); // public void updateRestaurant(Restaurant restaurant); // public Restaurant getRestaurant(Long id); // public List<Restaurant> getAllRestaurants(); // public void deleteRestaurant(Long id); // public void deleteAllRestaurants(); // // public Long count(); // } // // Path: src/main/java/cn/com/chenyixiao/rrs/entity/Restaurant.java // @Entity // @Table(name = "restaurant", catalog = "rrs") // public class Restaurant implements java.io.Serializable { // // private long id; // private String name; // private String category; // private String region; // // public Restaurant() { // } // // public Restaurant(long id) { // this.id = id; // } // // public Restaurant(long id, String name, String category, String region) { // this.id = id; // this.name = name; // this.category = category; // this.region = region; // } // // @Id // // @Column(name = "id", unique = true, nullable = false) // public long getId() { // return this.id; // } // // public void setId(long id) { // this.id = id; // } // // @Column(name = "name") // public String getName() { // return this.name; // } // // public void setName(String name) { // this.name = name; // } // // @Column(name = "category", length = 45) // public String getCategory() { // return this.category; // } // // public void setCategory(String category) { // this.category = category; // } // // @Column(name = "region", length = 45) // public String getRegion() { // return this.region; // } // // public void setRegion(String region) { // this.region = region; // } // // }
import java.util.List; import org.hibernate.Session; import org.hibernate.SessionFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Repository; import cn.com.chenyixiao.rrs.dao.RestaurantDAO; import cn.com.chenyixiao.rrs.entity.Restaurant;
package cn.com.chenyixiao.rrs.dao.impl; @Repository public class RestaurantDAOImpl implements RestaurantDAO { @Autowired private SessionFactory sessionFactory; private Session getCurrentSession() { return sessionFactory.getCurrentSession(); }
// Path: src/main/java/cn/com/chenyixiao/rrs/dao/RestaurantDAO.java // public interface RestaurantDAO { // // public void addRestaurant(Restaurant restaurant); // public void updateRestaurant(Restaurant restaurant); // public Restaurant getRestaurant(Long id); // public List<Restaurant> getAllRestaurants(); // public void deleteRestaurant(Long id); // public void deleteAllRestaurants(); // // public Long count(); // } // // Path: src/main/java/cn/com/chenyixiao/rrs/entity/Restaurant.java // @Entity // @Table(name = "restaurant", catalog = "rrs") // public class Restaurant implements java.io.Serializable { // // private long id; // private String name; // private String category; // private String region; // // public Restaurant() { // } // // public Restaurant(long id) { // this.id = id; // } // // public Restaurant(long id, String name, String category, String region) { // this.id = id; // this.name = name; // this.category = category; // this.region = region; // } // // @Id // // @Column(name = "id", unique = true, nullable = false) // public long getId() { // return this.id; // } // // public void setId(long id) { // this.id = id; // } // // @Column(name = "name") // public String getName() { // return this.name; // } // // public void setName(String name) { // this.name = name; // } // // @Column(name = "category", length = 45) // public String getCategory() { // return this.category; // } // // public void setCategory(String category) { // this.category = category; // } // // @Column(name = "region", length = 45) // public String getRegion() { // return this.region; // } // // public void setRegion(String region) { // this.region = region; // } // // } // Path: src/main/java/cn/com/chenyixiao/rrs/dao/impl/RestaurantDAOImpl.java import java.util.List; import org.hibernate.Session; import org.hibernate.SessionFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Repository; import cn.com.chenyixiao.rrs.dao.RestaurantDAO; import cn.com.chenyixiao.rrs.entity.Restaurant; package cn.com.chenyixiao.rrs.dao.impl; @Repository public class RestaurantDAOImpl implements RestaurantDAO { @Autowired private SessionFactory sessionFactory; private Session getCurrentSession() { return sessionFactory.getCurrentSession(); }
public void addRestaurant(Restaurant restaurant) {
tensorchen/rrs
src/main/java/cn/com/chenyixiao/rrs/dao/impl/RestaurantFoodDAOImpl.java
// Path: src/main/java/cn/com/chenyixiao/rrs/dao/RestaurantFoodDAO.java // public interface RestaurantFoodDAO { // // public void addRestaurantFood(RestaurantFood restaurantFood); // public void updateRestaurantFood(RestaurantFood restaurantFood); // public RestaurantFood getRestaurantFood(Long id); // public List<RestaurantFood> getAllRestaurantFoods(); // public void deleteRestaurantFood(Long id); // public void deleteAllRestaurantFood(); // // public Long count(); // // public List<RestaurantFood> getRestaurantFoodsByRestaurantId(Long restaurantId); // } // // Path: src/main/java/cn/com/chenyixiao/rrs/entity/RestaurantFood.java // @Entity // @Table(name = "restaurant_food", catalog = "rrs") // public class RestaurantFood { // private long id; // private long restaurantId; // private long foodId; // // // public RestaurantFood() { // } // // // public RestaurantFood(long id, long restaurantId, long foodId) { // this.id = id; // this.restaurantId = restaurantId; // this.foodId = foodId; // } // // // @Id // @GeneratedValue(strategy = GenerationType.IDENTITY) // @Column(name = "id", unique = true, nullable = false) // public long getId() { // return id; // } // public void setId(long id) { // this.id = id; // } // // @Column(name = "restaurant_id") // public long getRestaurantId() { // return restaurantId; // } // public void setRestaurantId(long restaurantId) { // this.restaurantId = restaurantId; // } // // @Column(name = "food_id") // public long getFoodId() { // return foodId; // } // public void setFoodId(long foodId) { // this.foodId = foodId; // } // // // }
import java.util.List; import org.hibernate.Query; import org.hibernate.Session; import org.hibernate.SessionFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Repository; import cn.com.chenyixiao.rrs.dao.RestaurantFoodDAO; import cn.com.chenyixiao.rrs.entity.RestaurantFood;
package cn.com.chenyixiao.rrs.dao.impl; @Repository public class RestaurantFoodDAOImpl implements RestaurantFoodDAO { @Autowired private SessionFactory sessionFactory; private Session getCurrentSession() { return sessionFactory.getCurrentSession(); } @Override
// Path: src/main/java/cn/com/chenyixiao/rrs/dao/RestaurantFoodDAO.java // public interface RestaurantFoodDAO { // // public void addRestaurantFood(RestaurantFood restaurantFood); // public void updateRestaurantFood(RestaurantFood restaurantFood); // public RestaurantFood getRestaurantFood(Long id); // public List<RestaurantFood> getAllRestaurantFoods(); // public void deleteRestaurantFood(Long id); // public void deleteAllRestaurantFood(); // // public Long count(); // // public List<RestaurantFood> getRestaurantFoodsByRestaurantId(Long restaurantId); // } // // Path: src/main/java/cn/com/chenyixiao/rrs/entity/RestaurantFood.java // @Entity // @Table(name = "restaurant_food", catalog = "rrs") // public class RestaurantFood { // private long id; // private long restaurantId; // private long foodId; // // // public RestaurantFood() { // } // // // public RestaurantFood(long id, long restaurantId, long foodId) { // this.id = id; // this.restaurantId = restaurantId; // this.foodId = foodId; // } // // // @Id // @GeneratedValue(strategy = GenerationType.IDENTITY) // @Column(name = "id", unique = true, nullable = false) // public long getId() { // return id; // } // public void setId(long id) { // this.id = id; // } // // @Column(name = "restaurant_id") // public long getRestaurantId() { // return restaurantId; // } // public void setRestaurantId(long restaurantId) { // this.restaurantId = restaurantId; // } // // @Column(name = "food_id") // public long getFoodId() { // return foodId; // } // public void setFoodId(long foodId) { // this.foodId = foodId; // } // // // } // Path: src/main/java/cn/com/chenyixiao/rrs/dao/impl/RestaurantFoodDAOImpl.java import java.util.List; import org.hibernate.Query; import org.hibernate.Session; import org.hibernate.SessionFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Repository; import cn.com.chenyixiao.rrs.dao.RestaurantFoodDAO; import cn.com.chenyixiao.rrs.entity.RestaurantFood; package cn.com.chenyixiao.rrs.dao.impl; @Repository public class RestaurantFoodDAOImpl implements RestaurantFoodDAO { @Autowired private SessionFactory sessionFactory; private Session getCurrentSession() { return sessionFactory.getCurrentSession(); } @Override
public void addRestaurantFood(RestaurantFood restaurantFood) {
tensorchen/rrs
src/main/java/cn/com/chenyixiao/rrs/service/impl/Preference3dServiceImpl.java
// Path: src/main/java/cn/com/chenyixiao/rrs/dao/Preference3dDAO.java // public interface Preference3dDAO { // // public void addPreference3d(Preference3d preference3d); // public void updatePreference3d(Preference3d preference3d); // public Preference3d getPreference3d(Long id); // public List<Preference3d> getAllPreference3ds(); // public void deletePreference3d(Long id); // public void deleteAllPreference3d(); // // public Long count(); // // public List<Preference3d> getPreference3dListByUser(Long userId); // // public Preference3d getPreference3dByURF(Long foodId, // Long userId, Long restaurantId); // } // // Path: src/main/java/cn/com/chenyixiao/rrs/entity/Preference3d.java // @Entity // @Table(name = "preference3d", catalog = "rrs") // public class Preference3d implements java.io.Serializable { // // private long id; // private Long restaurantId; // private Long foodId; // private Long userId; // private String content; // private Double score; // // // public Preference3d() { // } // // public Preference3d(long id) { // this.id = id; // } // // public Preference3d(long id, Long restaurantId, Long foodId, Long userId, // String content, Double score) { // this.id = id; // this.restaurantId = restaurantId; // this.foodId = foodId; // this.userId = userId; // this.content = content; // this.score = score; // } // // @Id // @GeneratedValue(strategy = GenerationType.IDENTITY) // @Column(name = "id", unique = true, nullable = false) // public long getId() { // return this.id; // } // // public void setId(long id) { // this.id = id; // } // // @Column(name = "restaurant_id") // public Long getRestaurantId() { // return this.restaurantId; // } // // public void setRestaurantId(Long restaurantId) { // this.restaurantId = restaurantId; // } // // @Column(name = "food_id") // public Long getFoodId() { // return this.foodId; // } // // public void setFoodId(Long foodId) { // this.foodId = foodId; // } // // @Column(name = "user_id") // public Long getUserId() { // return this.userId; // } // // public void setUserId(Long userId) { // this.userId = userId; // } // // @Column(name = "content") // public String getContent() { // return content; // } // // public void setContent(String content) { // this.content = content; // } // // @Column(name = "score") // public Double getScore() { // return score; // } // // public void setScore(Double score) { // this.score = score; // } // // } // // Path: src/main/java/cn/com/chenyixiao/rrs/service/Preference3dService.java // public interface Preference3dService { // // public void addPreference3d(Preference3d preference3d); // public void updatePreference3d(Preference3d preference3d); // public Preference3d getPreference3d(Long id); // public List<Preference3d> getAllPreference3ds(); // public void deletePreference3d(Long id); // public void deleteAllPreference3d(); // // public Long count(); // // public void addOrUpdatePreference3d(Preference3d preference3d); // // public List<Preference3d> getPreference3dListByUser(Long userId); // }
import java.util.List; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import cn.com.chenyixiao.rrs.dao.Preference3dDAO; import cn.com.chenyixiao.rrs.entity.Preference3d; import cn.com.chenyixiao.rrs.service.Preference3dService;
package cn.com.chenyixiao.rrs.service.impl; @Service @Transactional
// Path: src/main/java/cn/com/chenyixiao/rrs/dao/Preference3dDAO.java // public interface Preference3dDAO { // // public void addPreference3d(Preference3d preference3d); // public void updatePreference3d(Preference3d preference3d); // public Preference3d getPreference3d(Long id); // public List<Preference3d> getAllPreference3ds(); // public void deletePreference3d(Long id); // public void deleteAllPreference3d(); // // public Long count(); // // public List<Preference3d> getPreference3dListByUser(Long userId); // // public Preference3d getPreference3dByURF(Long foodId, // Long userId, Long restaurantId); // } // // Path: src/main/java/cn/com/chenyixiao/rrs/entity/Preference3d.java // @Entity // @Table(name = "preference3d", catalog = "rrs") // public class Preference3d implements java.io.Serializable { // // private long id; // private Long restaurantId; // private Long foodId; // private Long userId; // private String content; // private Double score; // // // public Preference3d() { // } // // public Preference3d(long id) { // this.id = id; // } // // public Preference3d(long id, Long restaurantId, Long foodId, Long userId, // String content, Double score) { // this.id = id; // this.restaurantId = restaurantId; // this.foodId = foodId; // this.userId = userId; // this.content = content; // this.score = score; // } // // @Id // @GeneratedValue(strategy = GenerationType.IDENTITY) // @Column(name = "id", unique = true, nullable = false) // public long getId() { // return this.id; // } // // public void setId(long id) { // this.id = id; // } // // @Column(name = "restaurant_id") // public Long getRestaurantId() { // return this.restaurantId; // } // // public void setRestaurantId(Long restaurantId) { // this.restaurantId = restaurantId; // } // // @Column(name = "food_id") // public Long getFoodId() { // return this.foodId; // } // // public void setFoodId(Long foodId) { // this.foodId = foodId; // } // // @Column(name = "user_id") // public Long getUserId() { // return this.userId; // } // // public void setUserId(Long userId) { // this.userId = userId; // } // // @Column(name = "content") // public String getContent() { // return content; // } // // public void setContent(String content) { // this.content = content; // } // // @Column(name = "score") // public Double getScore() { // return score; // } // // public void setScore(Double score) { // this.score = score; // } // // } // // Path: src/main/java/cn/com/chenyixiao/rrs/service/Preference3dService.java // public interface Preference3dService { // // public void addPreference3d(Preference3d preference3d); // public void updatePreference3d(Preference3d preference3d); // public Preference3d getPreference3d(Long id); // public List<Preference3d> getAllPreference3ds(); // public void deletePreference3d(Long id); // public void deleteAllPreference3d(); // // public Long count(); // // public void addOrUpdatePreference3d(Preference3d preference3d); // // public List<Preference3d> getPreference3dListByUser(Long userId); // } // Path: src/main/java/cn/com/chenyixiao/rrs/service/impl/Preference3dServiceImpl.java import java.util.List; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import cn.com.chenyixiao.rrs.dao.Preference3dDAO; import cn.com.chenyixiao.rrs.entity.Preference3d; import cn.com.chenyixiao.rrs.service.Preference3dService; package cn.com.chenyixiao.rrs.service.impl; @Service @Transactional
public class Preference3dServiceImpl implements Preference3dService {
tensorchen/rrs
src/main/java/cn/com/chenyixiao/rrs/service/impl/Preference3dServiceImpl.java
// Path: src/main/java/cn/com/chenyixiao/rrs/dao/Preference3dDAO.java // public interface Preference3dDAO { // // public void addPreference3d(Preference3d preference3d); // public void updatePreference3d(Preference3d preference3d); // public Preference3d getPreference3d(Long id); // public List<Preference3d> getAllPreference3ds(); // public void deletePreference3d(Long id); // public void deleteAllPreference3d(); // // public Long count(); // // public List<Preference3d> getPreference3dListByUser(Long userId); // // public Preference3d getPreference3dByURF(Long foodId, // Long userId, Long restaurantId); // } // // Path: src/main/java/cn/com/chenyixiao/rrs/entity/Preference3d.java // @Entity // @Table(name = "preference3d", catalog = "rrs") // public class Preference3d implements java.io.Serializable { // // private long id; // private Long restaurantId; // private Long foodId; // private Long userId; // private String content; // private Double score; // // // public Preference3d() { // } // // public Preference3d(long id) { // this.id = id; // } // // public Preference3d(long id, Long restaurantId, Long foodId, Long userId, // String content, Double score) { // this.id = id; // this.restaurantId = restaurantId; // this.foodId = foodId; // this.userId = userId; // this.content = content; // this.score = score; // } // // @Id // @GeneratedValue(strategy = GenerationType.IDENTITY) // @Column(name = "id", unique = true, nullable = false) // public long getId() { // return this.id; // } // // public void setId(long id) { // this.id = id; // } // // @Column(name = "restaurant_id") // public Long getRestaurantId() { // return this.restaurantId; // } // // public void setRestaurantId(Long restaurantId) { // this.restaurantId = restaurantId; // } // // @Column(name = "food_id") // public Long getFoodId() { // return this.foodId; // } // // public void setFoodId(Long foodId) { // this.foodId = foodId; // } // // @Column(name = "user_id") // public Long getUserId() { // return this.userId; // } // // public void setUserId(Long userId) { // this.userId = userId; // } // // @Column(name = "content") // public String getContent() { // return content; // } // // public void setContent(String content) { // this.content = content; // } // // @Column(name = "score") // public Double getScore() { // return score; // } // // public void setScore(Double score) { // this.score = score; // } // // } // // Path: src/main/java/cn/com/chenyixiao/rrs/service/Preference3dService.java // public interface Preference3dService { // // public void addPreference3d(Preference3d preference3d); // public void updatePreference3d(Preference3d preference3d); // public Preference3d getPreference3d(Long id); // public List<Preference3d> getAllPreference3ds(); // public void deletePreference3d(Long id); // public void deleteAllPreference3d(); // // public Long count(); // // public void addOrUpdatePreference3d(Preference3d preference3d); // // public List<Preference3d> getPreference3dListByUser(Long userId); // }
import java.util.List; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import cn.com.chenyixiao.rrs.dao.Preference3dDAO; import cn.com.chenyixiao.rrs.entity.Preference3d; import cn.com.chenyixiao.rrs.service.Preference3dService;
package cn.com.chenyixiao.rrs.service.impl; @Service @Transactional public class Preference3dServiceImpl implements Preference3dService { @Autowired
// Path: src/main/java/cn/com/chenyixiao/rrs/dao/Preference3dDAO.java // public interface Preference3dDAO { // // public void addPreference3d(Preference3d preference3d); // public void updatePreference3d(Preference3d preference3d); // public Preference3d getPreference3d(Long id); // public List<Preference3d> getAllPreference3ds(); // public void deletePreference3d(Long id); // public void deleteAllPreference3d(); // // public Long count(); // // public List<Preference3d> getPreference3dListByUser(Long userId); // // public Preference3d getPreference3dByURF(Long foodId, // Long userId, Long restaurantId); // } // // Path: src/main/java/cn/com/chenyixiao/rrs/entity/Preference3d.java // @Entity // @Table(name = "preference3d", catalog = "rrs") // public class Preference3d implements java.io.Serializable { // // private long id; // private Long restaurantId; // private Long foodId; // private Long userId; // private String content; // private Double score; // // // public Preference3d() { // } // // public Preference3d(long id) { // this.id = id; // } // // public Preference3d(long id, Long restaurantId, Long foodId, Long userId, // String content, Double score) { // this.id = id; // this.restaurantId = restaurantId; // this.foodId = foodId; // this.userId = userId; // this.content = content; // this.score = score; // } // // @Id // @GeneratedValue(strategy = GenerationType.IDENTITY) // @Column(name = "id", unique = true, nullable = false) // public long getId() { // return this.id; // } // // public void setId(long id) { // this.id = id; // } // // @Column(name = "restaurant_id") // public Long getRestaurantId() { // return this.restaurantId; // } // // public void setRestaurantId(Long restaurantId) { // this.restaurantId = restaurantId; // } // // @Column(name = "food_id") // public Long getFoodId() { // return this.foodId; // } // // public void setFoodId(Long foodId) { // this.foodId = foodId; // } // // @Column(name = "user_id") // public Long getUserId() { // return this.userId; // } // // public void setUserId(Long userId) { // this.userId = userId; // } // // @Column(name = "content") // public String getContent() { // return content; // } // // public void setContent(String content) { // this.content = content; // } // // @Column(name = "score") // public Double getScore() { // return score; // } // // public void setScore(Double score) { // this.score = score; // } // // } // // Path: src/main/java/cn/com/chenyixiao/rrs/service/Preference3dService.java // public interface Preference3dService { // // public void addPreference3d(Preference3d preference3d); // public void updatePreference3d(Preference3d preference3d); // public Preference3d getPreference3d(Long id); // public List<Preference3d> getAllPreference3ds(); // public void deletePreference3d(Long id); // public void deleteAllPreference3d(); // // public Long count(); // // public void addOrUpdatePreference3d(Preference3d preference3d); // // public List<Preference3d> getPreference3dListByUser(Long userId); // } // Path: src/main/java/cn/com/chenyixiao/rrs/service/impl/Preference3dServiceImpl.java import java.util.List; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import cn.com.chenyixiao.rrs.dao.Preference3dDAO; import cn.com.chenyixiao.rrs.entity.Preference3d; import cn.com.chenyixiao.rrs.service.Preference3dService; package cn.com.chenyixiao.rrs.service.impl; @Service @Transactional public class Preference3dServiceImpl implements Preference3dService { @Autowired
private Preference3dDAO preference3dDAO;
tensorchen/rrs
src/main/java/cn/com/chenyixiao/rrs/service/impl/Preference3dServiceImpl.java
// Path: src/main/java/cn/com/chenyixiao/rrs/dao/Preference3dDAO.java // public interface Preference3dDAO { // // public void addPreference3d(Preference3d preference3d); // public void updatePreference3d(Preference3d preference3d); // public Preference3d getPreference3d(Long id); // public List<Preference3d> getAllPreference3ds(); // public void deletePreference3d(Long id); // public void deleteAllPreference3d(); // // public Long count(); // // public List<Preference3d> getPreference3dListByUser(Long userId); // // public Preference3d getPreference3dByURF(Long foodId, // Long userId, Long restaurantId); // } // // Path: src/main/java/cn/com/chenyixiao/rrs/entity/Preference3d.java // @Entity // @Table(name = "preference3d", catalog = "rrs") // public class Preference3d implements java.io.Serializable { // // private long id; // private Long restaurantId; // private Long foodId; // private Long userId; // private String content; // private Double score; // // // public Preference3d() { // } // // public Preference3d(long id) { // this.id = id; // } // // public Preference3d(long id, Long restaurantId, Long foodId, Long userId, // String content, Double score) { // this.id = id; // this.restaurantId = restaurantId; // this.foodId = foodId; // this.userId = userId; // this.content = content; // this.score = score; // } // // @Id // @GeneratedValue(strategy = GenerationType.IDENTITY) // @Column(name = "id", unique = true, nullable = false) // public long getId() { // return this.id; // } // // public void setId(long id) { // this.id = id; // } // // @Column(name = "restaurant_id") // public Long getRestaurantId() { // return this.restaurantId; // } // // public void setRestaurantId(Long restaurantId) { // this.restaurantId = restaurantId; // } // // @Column(name = "food_id") // public Long getFoodId() { // return this.foodId; // } // // public void setFoodId(Long foodId) { // this.foodId = foodId; // } // // @Column(name = "user_id") // public Long getUserId() { // return this.userId; // } // // public void setUserId(Long userId) { // this.userId = userId; // } // // @Column(name = "content") // public String getContent() { // return content; // } // // public void setContent(String content) { // this.content = content; // } // // @Column(name = "score") // public Double getScore() { // return score; // } // // public void setScore(Double score) { // this.score = score; // } // // } // // Path: src/main/java/cn/com/chenyixiao/rrs/service/Preference3dService.java // public interface Preference3dService { // // public void addPreference3d(Preference3d preference3d); // public void updatePreference3d(Preference3d preference3d); // public Preference3d getPreference3d(Long id); // public List<Preference3d> getAllPreference3ds(); // public void deletePreference3d(Long id); // public void deleteAllPreference3d(); // // public Long count(); // // public void addOrUpdatePreference3d(Preference3d preference3d); // // public List<Preference3d> getPreference3dListByUser(Long userId); // }
import java.util.List; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import cn.com.chenyixiao.rrs.dao.Preference3dDAO; import cn.com.chenyixiao.rrs.entity.Preference3d; import cn.com.chenyixiao.rrs.service.Preference3dService;
package cn.com.chenyixiao.rrs.service.impl; @Service @Transactional public class Preference3dServiceImpl implements Preference3dService { @Autowired private Preference3dDAO preference3dDAO;
// Path: src/main/java/cn/com/chenyixiao/rrs/dao/Preference3dDAO.java // public interface Preference3dDAO { // // public void addPreference3d(Preference3d preference3d); // public void updatePreference3d(Preference3d preference3d); // public Preference3d getPreference3d(Long id); // public List<Preference3d> getAllPreference3ds(); // public void deletePreference3d(Long id); // public void deleteAllPreference3d(); // // public Long count(); // // public List<Preference3d> getPreference3dListByUser(Long userId); // // public Preference3d getPreference3dByURF(Long foodId, // Long userId, Long restaurantId); // } // // Path: src/main/java/cn/com/chenyixiao/rrs/entity/Preference3d.java // @Entity // @Table(name = "preference3d", catalog = "rrs") // public class Preference3d implements java.io.Serializable { // // private long id; // private Long restaurantId; // private Long foodId; // private Long userId; // private String content; // private Double score; // // // public Preference3d() { // } // // public Preference3d(long id) { // this.id = id; // } // // public Preference3d(long id, Long restaurantId, Long foodId, Long userId, // String content, Double score) { // this.id = id; // this.restaurantId = restaurantId; // this.foodId = foodId; // this.userId = userId; // this.content = content; // this.score = score; // } // // @Id // @GeneratedValue(strategy = GenerationType.IDENTITY) // @Column(name = "id", unique = true, nullable = false) // public long getId() { // return this.id; // } // // public void setId(long id) { // this.id = id; // } // // @Column(name = "restaurant_id") // public Long getRestaurantId() { // return this.restaurantId; // } // // public void setRestaurantId(Long restaurantId) { // this.restaurantId = restaurantId; // } // // @Column(name = "food_id") // public Long getFoodId() { // return this.foodId; // } // // public void setFoodId(Long foodId) { // this.foodId = foodId; // } // // @Column(name = "user_id") // public Long getUserId() { // return this.userId; // } // // public void setUserId(Long userId) { // this.userId = userId; // } // // @Column(name = "content") // public String getContent() { // return content; // } // // public void setContent(String content) { // this.content = content; // } // // @Column(name = "score") // public Double getScore() { // return score; // } // // public void setScore(Double score) { // this.score = score; // } // // } // // Path: src/main/java/cn/com/chenyixiao/rrs/service/Preference3dService.java // public interface Preference3dService { // // public void addPreference3d(Preference3d preference3d); // public void updatePreference3d(Preference3d preference3d); // public Preference3d getPreference3d(Long id); // public List<Preference3d> getAllPreference3ds(); // public void deletePreference3d(Long id); // public void deleteAllPreference3d(); // // public Long count(); // // public void addOrUpdatePreference3d(Preference3d preference3d); // // public List<Preference3d> getPreference3dListByUser(Long userId); // } // Path: src/main/java/cn/com/chenyixiao/rrs/service/impl/Preference3dServiceImpl.java import java.util.List; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import cn.com.chenyixiao.rrs.dao.Preference3dDAO; import cn.com.chenyixiao.rrs.entity.Preference3d; import cn.com.chenyixiao.rrs.service.Preference3dService; package cn.com.chenyixiao.rrs.service.impl; @Service @Transactional public class Preference3dServiceImpl implements Preference3dService { @Autowired private Preference3dDAO preference3dDAO;
public void addPreference3d(Preference3d preference3d) {
tensorchen/rrs
src/main/java/cn/com/chenyixiao/rrs/dao/impl/Preference3dDAOImpl.java
// Path: src/main/java/cn/com/chenyixiao/rrs/dao/Preference3dDAO.java // public interface Preference3dDAO { // // public void addPreference3d(Preference3d preference3d); // public void updatePreference3d(Preference3d preference3d); // public Preference3d getPreference3d(Long id); // public List<Preference3d> getAllPreference3ds(); // public void deletePreference3d(Long id); // public void deleteAllPreference3d(); // // public Long count(); // // public List<Preference3d> getPreference3dListByUser(Long userId); // // public Preference3d getPreference3dByURF(Long foodId, // Long userId, Long restaurantId); // } // // Path: src/main/java/cn/com/chenyixiao/rrs/entity/Preference3d.java // @Entity // @Table(name = "preference3d", catalog = "rrs") // public class Preference3d implements java.io.Serializable { // // private long id; // private Long restaurantId; // private Long foodId; // private Long userId; // private String content; // private Double score; // // // public Preference3d() { // } // // public Preference3d(long id) { // this.id = id; // } // // public Preference3d(long id, Long restaurantId, Long foodId, Long userId, // String content, Double score) { // this.id = id; // this.restaurantId = restaurantId; // this.foodId = foodId; // this.userId = userId; // this.content = content; // this.score = score; // } // // @Id // @GeneratedValue(strategy = GenerationType.IDENTITY) // @Column(name = "id", unique = true, nullable = false) // public long getId() { // return this.id; // } // // public void setId(long id) { // this.id = id; // } // // @Column(name = "restaurant_id") // public Long getRestaurantId() { // return this.restaurantId; // } // // public void setRestaurantId(Long restaurantId) { // this.restaurantId = restaurantId; // } // // @Column(name = "food_id") // public Long getFoodId() { // return this.foodId; // } // // public void setFoodId(Long foodId) { // this.foodId = foodId; // } // // @Column(name = "user_id") // public Long getUserId() { // return this.userId; // } // // public void setUserId(Long userId) { // this.userId = userId; // } // // @Column(name = "content") // public String getContent() { // return content; // } // // public void setContent(String content) { // this.content = content; // } // // @Column(name = "score") // public Double getScore() { // return score; // } // // public void setScore(Double score) { // this.score = score; // } // // }
import java.util.List; import org.hibernate.Query; import org.hibernate.Session; import org.hibernate.SessionFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Repository; import cn.com.chenyixiao.rrs.dao.Preference3dDAO; import cn.com.chenyixiao.rrs.entity.Preference3d;
package cn.com.chenyixiao.rrs.dao.impl; @Repository public class Preference3dDAOImpl implements Preference3dDAO { @Autowired private SessionFactory sessionFactory; private Session getCurrentSession() { return sessionFactory.getCurrentSession(); }
// Path: src/main/java/cn/com/chenyixiao/rrs/dao/Preference3dDAO.java // public interface Preference3dDAO { // // public void addPreference3d(Preference3d preference3d); // public void updatePreference3d(Preference3d preference3d); // public Preference3d getPreference3d(Long id); // public List<Preference3d> getAllPreference3ds(); // public void deletePreference3d(Long id); // public void deleteAllPreference3d(); // // public Long count(); // // public List<Preference3d> getPreference3dListByUser(Long userId); // // public Preference3d getPreference3dByURF(Long foodId, // Long userId, Long restaurantId); // } // // Path: src/main/java/cn/com/chenyixiao/rrs/entity/Preference3d.java // @Entity // @Table(name = "preference3d", catalog = "rrs") // public class Preference3d implements java.io.Serializable { // // private long id; // private Long restaurantId; // private Long foodId; // private Long userId; // private String content; // private Double score; // // // public Preference3d() { // } // // public Preference3d(long id) { // this.id = id; // } // // public Preference3d(long id, Long restaurantId, Long foodId, Long userId, // String content, Double score) { // this.id = id; // this.restaurantId = restaurantId; // this.foodId = foodId; // this.userId = userId; // this.content = content; // this.score = score; // } // // @Id // @GeneratedValue(strategy = GenerationType.IDENTITY) // @Column(name = "id", unique = true, nullable = false) // public long getId() { // return this.id; // } // // public void setId(long id) { // this.id = id; // } // // @Column(name = "restaurant_id") // public Long getRestaurantId() { // return this.restaurantId; // } // // public void setRestaurantId(Long restaurantId) { // this.restaurantId = restaurantId; // } // // @Column(name = "food_id") // public Long getFoodId() { // return this.foodId; // } // // public void setFoodId(Long foodId) { // this.foodId = foodId; // } // // @Column(name = "user_id") // public Long getUserId() { // return this.userId; // } // // public void setUserId(Long userId) { // this.userId = userId; // } // // @Column(name = "content") // public String getContent() { // return content; // } // // public void setContent(String content) { // this.content = content; // } // // @Column(name = "score") // public Double getScore() { // return score; // } // // public void setScore(Double score) { // this.score = score; // } // // } // Path: src/main/java/cn/com/chenyixiao/rrs/dao/impl/Preference3dDAOImpl.java import java.util.List; import org.hibernate.Query; import org.hibernate.Session; import org.hibernate.SessionFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Repository; import cn.com.chenyixiao.rrs.dao.Preference3dDAO; import cn.com.chenyixiao.rrs.entity.Preference3d; package cn.com.chenyixiao.rrs.dao.impl; @Repository public class Preference3dDAOImpl implements Preference3dDAO { @Autowired private SessionFactory sessionFactory; private Session getCurrentSession() { return sessionFactory.getCurrentSession(); }
public void addPreference3d(Preference3d preference3d) {
tensorchen/rrs
src/main/java/cn/com/chenyixiao/rrs/service/impl/RestaurantFoodServiceImpl.java
// Path: src/main/java/cn/com/chenyixiao/rrs/dao/RestaurantFoodDAO.java // public interface RestaurantFoodDAO { // // public void addRestaurantFood(RestaurantFood restaurantFood); // public void updateRestaurantFood(RestaurantFood restaurantFood); // public RestaurantFood getRestaurantFood(Long id); // public List<RestaurantFood> getAllRestaurantFoods(); // public void deleteRestaurantFood(Long id); // public void deleteAllRestaurantFood(); // // public Long count(); // // public List<RestaurantFood> getRestaurantFoodsByRestaurantId(Long restaurantId); // } // // Path: src/main/java/cn/com/chenyixiao/rrs/entity/RestaurantFood.java // @Entity // @Table(name = "restaurant_food", catalog = "rrs") // public class RestaurantFood { // private long id; // private long restaurantId; // private long foodId; // // // public RestaurantFood() { // } // // // public RestaurantFood(long id, long restaurantId, long foodId) { // this.id = id; // this.restaurantId = restaurantId; // this.foodId = foodId; // } // // // @Id // @GeneratedValue(strategy = GenerationType.IDENTITY) // @Column(name = "id", unique = true, nullable = false) // public long getId() { // return id; // } // public void setId(long id) { // this.id = id; // } // // @Column(name = "restaurant_id") // public long getRestaurantId() { // return restaurantId; // } // public void setRestaurantId(long restaurantId) { // this.restaurantId = restaurantId; // } // // @Column(name = "food_id") // public long getFoodId() { // return foodId; // } // public void setFoodId(long foodId) { // this.foodId = foodId; // } // // // } // // Path: src/main/java/cn/com/chenyixiao/rrs/service/RestaurantFoodService.java // public interface RestaurantFoodService { // // public void addRestaurantFood(RestaurantFood restaurantFood); // public void updateRestaurantFood(RestaurantFood restaurantFood); // public RestaurantFood getRestaurantFood(Long id); // public List<RestaurantFood> getAllRestaurantFoods(); // public void deleteRestaurantFood(Long id); // public void deleteAllRestaurantFoods(); // // public Long count(); // // public List<RestaurantFood> getRestaurantFoodsByRestaurantId(Long restaurantId); // }
import java.util.List; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import cn.com.chenyixiao.rrs.dao.RestaurantFoodDAO; import cn.com.chenyixiao.rrs.entity.RestaurantFood; import cn.com.chenyixiao.rrs.service.RestaurantFoodService;
package cn.com.chenyixiao.rrs.service.impl; @Service @Transactional
// Path: src/main/java/cn/com/chenyixiao/rrs/dao/RestaurantFoodDAO.java // public interface RestaurantFoodDAO { // // public void addRestaurantFood(RestaurantFood restaurantFood); // public void updateRestaurantFood(RestaurantFood restaurantFood); // public RestaurantFood getRestaurantFood(Long id); // public List<RestaurantFood> getAllRestaurantFoods(); // public void deleteRestaurantFood(Long id); // public void deleteAllRestaurantFood(); // // public Long count(); // // public List<RestaurantFood> getRestaurantFoodsByRestaurantId(Long restaurantId); // } // // Path: src/main/java/cn/com/chenyixiao/rrs/entity/RestaurantFood.java // @Entity // @Table(name = "restaurant_food", catalog = "rrs") // public class RestaurantFood { // private long id; // private long restaurantId; // private long foodId; // // // public RestaurantFood() { // } // // // public RestaurantFood(long id, long restaurantId, long foodId) { // this.id = id; // this.restaurantId = restaurantId; // this.foodId = foodId; // } // // // @Id // @GeneratedValue(strategy = GenerationType.IDENTITY) // @Column(name = "id", unique = true, nullable = false) // public long getId() { // return id; // } // public void setId(long id) { // this.id = id; // } // // @Column(name = "restaurant_id") // public long getRestaurantId() { // return restaurantId; // } // public void setRestaurantId(long restaurantId) { // this.restaurantId = restaurantId; // } // // @Column(name = "food_id") // public long getFoodId() { // return foodId; // } // public void setFoodId(long foodId) { // this.foodId = foodId; // } // // // } // // Path: src/main/java/cn/com/chenyixiao/rrs/service/RestaurantFoodService.java // public interface RestaurantFoodService { // // public void addRestaurantFood(RestaurantFood restaurantFood); // public void updateRestaurantFood(RestaurantFood restaurantFood); // public RestaurantFood getRestaurantFood(Long id); // public List<RestaurantFood> getAllRestaurantFoods(); // public void deleteRestaurantFood(Long id); // public void deleteAllRestaurantFoods(); // // public Long count(); // // public List<RestaurantFood> getRestaurantFoodsByRestaurantId(Long restaurantId); // } // Path: src/main/java/cn/com/chenyixiao/rrs/service/impl/RestaurantFoodServiceImpl.java import java.util.List; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import cn.com.chenyixiao.rrs.dao.RestaurantFoodDAO; import cn.com.chenyixiao.rrs.entity.RestaurantFood; import cn.com.chenyixiao.rrs.service.RestaurantFoodService; package cn.com.chenyixiao.rrs.service.impl; @Service @Transactional
public class RestaurantFoodServiceImpl implements RestaurantFoodService {
tensorchen/rrs
src/main/java/cn/com/chenyixiao/rrs/service/impl/RestaurantFoodServiceImpl.java
// Path: src/main/java/cn/com/chenyixiao/rrs/dao/RestaurantFoodDAO.java // public interface RestaurantFoodDAO { // // public void addRestaurantFood(RestaurantFood restaurantFood); // public void updateRestaurantFood(RestaurantFood restaurantFood); // public RestaurantFood getRestaurantFood(Long id); // public List<RestaurantFood> getAllRestaurantFoods(); // public void deleteRestaurantFood(Long id); // public void deleteAllRestaurantFood(); // // public Long count(); // // public List<RestaurantFood> getRestaurantFoodsByRestaurantId(Long restaurantId); // } // // Path: src/main/java/cn/com/chenyixiao/rrs/entity/RestaurantFood.java // @Entity // @Table(name = "restaurant_food", catalog = "rrs") // public class RestaurantFood { // private long id; // private long restaurantId; // private long foodId; // // // public RestaurantFood() { // } // // // public RestaurantFood(long id, long restaurantId, long foodId) { // this.id = id; // this.restaurantId = restaurantId; // this.foodId = foodId; // } // // // @Id // @GeneratedValue(strategy = GenerationType.IDENTITY) // @Column(name = "id", unique = true, nullable = false) // public long getId() { // return id; // } // public void setId(long id) { // this.id = id; // } // // @Column(name = "restaurant_id") // public long getRestaurantId() { // return restaurantId; // } // public void setRestaurantId(long restaurantId) { // this.restaurantId = restaurantId; // } // // @Column(name = "food_id") // public long getFoodId() { // return foodId; // } // public void setFoodId(long foodId) { // this.foodId = foodId; // } // // // } // // Path: src/main/java/cn/com/chenyixiao/rrs/service/RestaurantFoodService.java // public interface RestaurantFoodService { // // public void addRestaurantFood(RestaurantFood restaurantFood); // public void updateRestaurantFood(RestaurantFood restaurantFood); // public RestaurantFood getRestaurantFood(Long id); // public List<RestaurantFood> getAllRestaurantFoods(); // public void deleteRestaurantFood(Long id); // public void deleteAllRestaurantFoods(); // // public Long count(); // // public List<RestaurantFood> getRestaurantFoodsByRestaurantId(Long restaurantId); // }
import java.util.List; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import cn.com.chenyixiao.rrs.dao.RestaurantFoodDAO; import cn.com.chenyixiao.rrs.entity.RestaurantFood; import cn.com.chenyixiao.rrs.service.RestaurantFoodService;
package cn.com.chenyixiao.rrs.service.impl; @Service @Transactional public class RestaurantFoodServiceImpl implements RestaurantFoodService { @Autowired
// Path: src/main/java/cn/com/chenyixiao/rrs/dao/RestaurantFoodDAO.java // public interface RestaurantFoodDAO { // // public void addRestaurantFood(RestaurantFood restaurantFood); // public void updateRestaurantFood(RestaurantFood restaurantFood); // public RestaurantFood getRestaurantFood(Long id); // public List<RestaurantFood> getAllRestaurantFoods(); // public void deleteRestaurantFood(Long id); // public void deleteAllRestaurantFood(); // // public Long count(); // // public List<RestaurantFood> getRestaurantFoodsByRestaurantId(Long restaurantId); // } // // Path: src/main/java/cn/com/chenyixiao/rrs/entity/RestaurantFood.java // @Entity // @Table(name = "restaurant_food", catalog = "rrs") // public class RestaurantFood { // private long id; // private long restaurantId; // private long foodId; // // // public RestaurantFood() { // } // // // public RestaurantFood(long id, long restaurantId, long foodId) { // this.id = id; // this.restaurantId = restaurantId; // this.foodId = foodId; // } // // // @Id // @GeneratedValue(strategy = GenerationType.IDENTITY) // @Column(name = "id", unique = true, nullable = false) // public long getId() { // return id; // } // public void setId(long id) { // this.id = id; // } // // @Column(name = "restaurant_id") // public long getRestaurantId() { // return restaurantId; // } // public void setRestaurantId(long restaurantId) { // this.restaurantId = restaurantId; // } // // @Column(name = "food_id") // public long getFoodId() { // return foodId; // } // public void setFoodId(long foodId) { // this.foodId = foodId; // } // // // } // // Path: src/main/java/cn/com/chenyixiao/rrs/service/RestaurantFoodService.java // public interface RestaurantFoodService { // // public void addRestaurantFood(RestaurantFood restaurantFood); // public void updateRestaurantFood(RestaurantFood restaurantFood); // public RestaurantFood getRestaurantFood(Long id); // public List<RestaurantFood> getAllRestaurantFoods(); // public void deleteRestaurantFood(Long id); // public void deleteAllRestaurantFoods(); // // public Long count(); // // public List<RestaurantFood> getRestaurantFoodsByRestaurantId(Long restaurantId); // } // Path: src/main/java/cn/com/chenyixiao/rrs/service/impl/RestaurantFoodServiceImpl.java import java.util.List; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import cn.com.chenyixiao.rrs.dao.RestaurantFoodDAO; import cn.com.chenyixiao.rrs.entity.RestaurantFood; import cn.com.chenyixiao.rrs.service.RestaurantFoodService; package cn.com.chenyixiao.rrs.service.impl; @Service @Transactional public class RestaurantFoodServiceImpl implements RestaurantFoodService { @Autowired
private RestaurantFoodDAO restaurantFoodDAO;
tensorchen/rrs
src/main/java/cn/com/chenyixiao/rrs/service/impl/RestaurantFoodServiceImpl.java
// Path: src/main/java/cn/com/chenyixiao/rrs/dao/RestaurantFoodDAO.java // public interface RestaurantFoodDAO { // // public void addRestaurantFood(RestaurantFood restaurantFood); // public void updateRestaurantFood(RestaurantFood restaurantFood); // public RestaurantFood getRestaurantFood(Long id); // public List<RestaurantFood> getAllRestaurantFoods(); // public void deleteRestaurantFood(Long id); // public void deleteAllRestaurantFood(); // // public Long count(); // // public List<RestaurantFood> getRestaurantFoodsByRestaurantId(Long restaurantId); // } // // Path: src/main/java/cn/com/chenyixiao/rrs/entity/RestaurantFood.java // @Entity // @Table(name = "restaurant_food", catalog = "rrs") // public class RestaurantFood { // private long id; // private long restaurantId; // private long foodId; // // // public RestaurantFood() { // } // // // public RestaurantFood(long id, long restaurantId, long foodId) { // this.id = id; // this.restaurantId = restaurantId; // this.foodId = foodId; // } // // // @Id // @GeneratedValue(strategy = GenerationType.IDENTITY) // @Column(name = "id", unique = true, nullable = false) // public long getId() { // return id; // } // public void setId(long id) { // this.id = id; // } // // @Column(name = "restaurant_id") // public long getRestaurantId() { // return restaurantId; // } // public void setRestaurantId(long restaurantId) { // this.restaurantId = restaurantId; // } // // @Column(name = "food_id") // public long getFoodId() { // return foodId; // } // public void setFoodId(long foodId) { // this.foodId = foodId; // } // // // } // // Path: src/main/java/cn/com/chenyixiao/rrs/service/RestaurantFoodService.java // public interface RestaurantFoodService { // // public void addRestaurantFood(RestaurantFood restaurantFood); // public void updateRestaurantFood(RestaurantFood restaurantFood); // public RestaurantFood getRestaurantFood(Long id); // public List<RestaurantFood> getAllRestaurantFoods(); // public void deleteRestaurantFood(Long id); // public void deleteAllRestaurantFoods(); // // public Long count(); // // public List<RestaurantFood> getRestaurantFoodsByRestaurantId(Long restaurantId); // }
import java.util.List; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import cn.com.chenyixiao.rrs.dao.RestaurantFoodDAO; import cn.com.chenyixiao.rrs.entity.RestaurantFood; import cn.com.chenyixiao.rrs.service.RestaurantFoodService;
package cn.com.chenyixiao.rrs.service.impl; @Service @Transactional public class RestaurantFoodServiceImpl implements RestaurantFoodService { @Autowired private RestaurantFoodDAO restaurantFoodDAO; @Override
// Path: src/main/java/cn/com/chenyixiao/rrs/dao/RestaurantFoodDAO.java // public interface RestaurantFoodDAO { // // public void addRestaurantFood(RestaurantFood restaurantFood); // public void updateRestaurantFood(RestaurantFood restaurantFood); // public RestaurantFood getRestaurantFood(Long id); // public List<RestaurantFood> getAllRestaurantFoods(); // public void deleteRestaurantFood(Long id); // public void deleteAllRestaurantFood(); // // public Long count(); // // public List<RestaurantFood> getRestaurantFoodsByRestaurantId(Long restaurantId); // } // // Path: src/main/java/cn/com/chenyixiao/rrs/entity/RestaurantFood.java // @Entity // @Table(name = "restaurant_food", catalog = "rrs") // public class RestaurantFood { // private long id; // private long restaurantId; // private long foodId; // // // public RestaurantFood() { // } // // // public RestaurantFood(long id, long restaurantId, long foodId) { // this.id = id; // this.restaurantId = restaurantId; // this.foodId = foodId; // } // // // @Id // @GeneratedValue(strategy = GenerationType.IDENTITY) // @Column(name = "id", unique = true, nullable = false) // public long getId() { // return id; // } // public void setId(long id) { // this.id = id; // } // // @Column(name = "restaurant_id") // public long getRestaurantId() { // return restaurantId; // } // public void setRestaurantId(long restaurantId) { // this.restaurantId = restaurantId; // } // // @Column(name = "food_id") // public long getFoodId() { // return foodId; // } // public void setFoodId(long foodId) { // this.foodId = foodId; // } // // // } // // Path: src/main/java/cn/com/chenyixiao/rrs/service/RestaurantFoodService.java // public interface RestaurantFoodService { // // public void addRestaurantFood(RestaurantFood restaurantFood); // public void updateRestaurantFood(RestaurantFood restaurantFood); // public RestaurantFood getRestaurantFood(Long id); // public List<RestaurantFood> getAllRestaurantFoods(); // public void deleteRestaurantFood(Long id); // public void deleteAllRestaurantFoods(); // // public Long count(); // // public List<RestaurantFood> getRestaurantFoodsByRestaurantId(Long restaurantId); // } // Path: src/main/java/cn/com/chenyixiao/rrs/service/impl/RestaurantFoodServiceImpl.java import java.util.List; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import cn.com.chenyixiao.rrs.dao.RestaurantFoodDAO; import cn.com.chenyixiao.rrs.entity.RestaurantFood; import cn.com.chenyixiao.rrs.service.RestaurantFoodService; package cn.com.chenyixiao.rrs.service.impl; @Service @Transactional public class RestaurantFoodServiceImpl implements RestaurantFoodService { @Autowired private RestaurantFoodDAO restaurantFoodDAO; @Override
public void addRestaurantFood(RestaurantFood restaurantFood) {
tensorchen/rrs
src/main/java/cn/com/chenyixiao/rrs/dao/impl/FoodDAOImpl.java
// Path: src/main/java/cn/com/chenyixiao/rrs/dao/FoodDAO.java // public interface FoodDAO { // // public void addFood(Food food); // public void updateFood(Food food); // public Food getFood(Long id); // public List<Food> getAllFoods(); // public void deleteFood(Long id); // public void deleteAllFoods(); // // public Long count(); // // public Food findByName(String name); // } // // Path: src/main/java/cn/com/chenyixiao/rrs/entity/Food.java // @Entity // @Table(name = "food", catalog = "rrs") // public class Food implements java.io.Serializable { // // private long id; // private String name; // // public Food() { // } // // public Food(long id) { // this.id = id; // } // // public Food(long id, String name) { // this.id = id; // this.name = name; // } // // @Id // @GeneratedValue(strategy = GenerationType.IDENTITY) // @Column(name = "id", unique = true, nullable = false) // public long getId() { // return this.id; // } // // public void setId(long id) { // this.id = id; // } // // @Column(name = "name") // public String getName() { // return this.name; // } // // public void setName(String name) { // this.name = name; // } // // }
import java.util.List; import org.hibernate.Query; import org.hibernate.Session; import org.hibernate.SessionFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Repository; import cn.com.chenyixiao.rrs.dao.FoodDAO; import cn.com.chenyixiao.rrs.entity.Food;
package cn.com.chenyixiao.rrs.dao.impl; @Repository public class FoodDAOImpl implements FoodDAO { @Autowired private SessionFactory sessionFactory; private Session getCurrentSession() { return sessionFactory.getCurrentSession(); }
// Path: src/main/java/cn/com/chenyixiao/rrs/dao/FoodDAO.java // public interface FoodDAO { // // public void addFood(Food food); // public void updateFood(Food food); // public Food getFood(Long id); // public List<Food> getAllFoods(); // public void deleteFood(Long id); // public void deleteAllFoods(); // // public Long count(); // // public Food findByName(String name); // } // // Path: src/main/java/cn/com/chenyixiao/rrs/entity/Food.java // @Entity // @Table(name = "food", catalog = "rrs") // public class Food implements java.io.Serializable { // // private long id; // private String name; // // public Food() { // } // // public Food(long id) { // this.id = id; // } // // public Food(long id, String name) { // this.id = id; // this.name = name; // } // // @Id // @GeneratedValue(strategy = GenerationType.IDENTITY) // @Column(name = "id", unique = true, nullable = false) // public long getId() { // return this.id; // } // // public void setId(long id) { // this.id = id; // } // // @Column(name = "name") // public String getName() { // return this.name; // } // // public void setName(String name) { // this.name = name; // } // // } // Path: src/main/java/cn/com/chenyixiao/rrs/dao/impl/FoodDAOImpl.java import java.util.List; import org.hibernate.Query; import org.hibernate.Session; import org.hibernate.SessionFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Repository; import cn.com.chenyixiao.rrs.dao.FoodDAO; import cn.com.chenyixiao.rrs.entity.Food; package cn.com.chenyixiao.rrs.dao.impl; @Repository public class FoodDAOImpl implements FoodDAO { @Autowired private SessionFactory sessionFactory; private Session getCurrentSession() { return sessionFactory.getCurrentSession(); }
public void addFood(Food food) {