https://github.com/driver733/vk-uploader
VK.com wall posts generator
https://github.com/driver733/vk-uploader
decorator-pattern elegantobjects java oop oop-library vkontakte
Last synced: 23 days ago
JSON representation
VK.com wall posts generator
- Host: GitHub
- URL: https://github.com/driver733/vk-uploader
- Owner: driver733
- License: mit
- Created: 2017-05-20T19:45:18.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2022-03-20T16:13:03.000Z (over 3 years ago)
- Last Synced: 2025-01-30T17:38:28.839Z (10 months ago)
- Topics: decorator-pattern, elegantobjects, java, oop, oop-library, vkontakte
- Language: Java
- Homepage:
- Size: 4.62 MB
- Stars: 19
- Watchers: 4
- Forks: 1
- Open Issues: 27
-
Metadata Files:
- Readme: README.md
- License: LICENSE.txt
Awesome Lists containing this project
README
# VK-Uploader
[](http://www.elegantobjects.org)
[](http://www.rultor.com/p/driver733/VK-Uploader)
[](https://www.jetbrains.com/idea/)
[](https://github.com/driver733/VK-Uploader/actions?query=workflow%3ABuild+branch%3Amaster)
[](https://search.maven.org/artifact/com.driver733/vk-uploader/0.4/jar)
[](http://www.javadoc.io/doc/com.driver733/vk-uploader)
[](http://i.jpeek.org/com.driver733/vk-uploader/)
[](https://sonarcloud.io/dashboard?id=com.driver733%3Avk-uploader)
[](https://coveralls.io/github/driver733/VK-Uploader?branch=master)
[](https://github.com/driver733/VK-Uploader)
[](https://dependabot.com)
[](https://codeclimate.com/github/driver733/VK-Uploader/maintainability)
[](https://codebeat.co/projects/github-com-driver733-vk-uploader-master)
[](https://www.codacy.com/app/driver733/VK-Uploader?utm_source=github.com&utm_medium=referral&utm_content=driver733/VK-Uploader&utm_campaign=Badge_Grade)
[](http://www.0pdd.com/p?name=driver733/VK-Uploader)
[](https://github.com/driver733/VK-Uploader/blob/master/LICENSE.txt)
**VK-Uploader** is a [true object-oriented](http://www.yegor256.com/2014/11/20/seven-virtues-of-good-object.html)
and [immutable](http://www.yegor256.com/2014/06/09/objects-should-be-immutable.html)
[VK (Вконтакте)](vk.com) group management utility. It is based on [EO](https://www.elegantobjects.org) principles:
1. [No](https://github.com/driver733/VK-Uploader/search?l=Java&q=null) `null` usage ([why NULL is bad?](http://www.yegor256.com/2014/05/13/why-null-is-bad.html))
2. No static methods ([why they are bad?](http://www.yegor256.com/2014/05/05/oop-alternative-to-utility-classes.html))
* [No](https://github.com/driver733/VK-Uploader/search?q=%22public+static%22&unscoped_q=%22public+static%22) `public` `static` methods
* [No](https://github.com/driver733/VK-Uploader/search?q=%22private+static%22&unscoped_q=%22public+static%22) `private` `static` methods
3. [No](https://github.com/driver733/VK-Uploader/search?l=Java&q=%22%40Immutable%22) mutable classes ([why they are bad?](http://www.yegor256.com/2014/06/09/objects-should-be-immutable.html))
4. [No](https://github.com/driver733/VK-Uploader/search?q=instanceof&unscoped_q=instanceof) `instanceof` keyword usage, type casting, or reflection ([why?](http://www.yegor256.com/2015/04/02/class-casting-is-anti-pattern.html))
5. No code in constructors ([why?](http://www.yegor256.com/2015/05/07/ctors-must-be-code-free.html))
6. No [getters](https://github.com/driver733/VK-Uploader/search?l=Java&q=%22get%22) and [setters](https://github.com/driver733/VK-Uploader/search?l=Java&q=%22set%22) ([why?](http://www.yegor256.com/2014/09/16/getters-and-setters-are-evil.html))
7. [No](https://github.com/driver733/VK-Uploader/search?l=Java&q=%22implements%22) public methods without contract (interface) ([why?](https://www.yegor256.com/2014/11/20/seven-virtues-of-good-object.html#2-he-works-by-contracts))
8. [No](https://github.com/driver733/VK-Uploader/search?l=Java&q=%22assertThat%22) statements in test methods except assertThat ([why?](http://www.yegor256.com/2017/05/17/single-statement-unit-tests.html))
9. [No](https://github.com/driver733/VK-Uploader/search?q=%22extends%22&unscoped_q=%22extends%22) implementation inheritance ([why?](http://www.yegor256.com/2017/01/31/decorating-envelopes.html) and [why?](http://www.yegor256.com/2016/09/13/inheritance-is-procedural.html))
## Core Entities (Interfaces)
### [WallPost](https://github.com/driver733/VK-Uploader/blob/master/src/main/java/com/driver733/vkuploader/wallpost/WallPost.java)
This interface is implemented by the classes which construct (decorate) VK WallPosts.
For example the [WallPostBase](https://github.com/driver733/VK-Uploader/blob/master/src/main/java/com/driver733/vkuploader/wallpost/WallPostBase.java) class is a fundamental implementation of that interface, as
it encapsulates a [VK API client](https://github.com/VKCOM/vk-java-sdk/blob/master/sdk/src/main/java/com/vk/api/sdk/client/VkApiClient.java) instance and a [UserActor](https://github.com/VKCOM/vk-java-sdk/blob/master/sdk/src/main/java/com/vk/api/sdk/client/actors/UserActor.java) instance.
Other implementations of this interface, such as [WallPostWithMessage](https://github.com/driver733/VK-Uploader/blob/master/src/main/java/com/driver733/vkuploader/wallpost/WallPostWithMessage.java) or [WallPostWithAttachments](https://github.com/driver733/VK-Uploader/blob/master/src/main/java/com/driver733/vkuploader/wallpost/WallPostWithAttachments.java)
add content to a wall post (text and attachments, accordingly).
Also, there are some convenient implementations of that interface, such as [WallPostMusicAlbum](https://github.com/driver733/VK-Uploader/blob/master/src/main/java/com/driver733/vkuploader/wallpost/WallPostMusicAlbum.java) or [WallPostPhotoAlbum](https://github.com/driver733/VK-Uploader/blob/master/src/main/java/com/driver733/vkuploader/wallpost/WallPostPhotoAlbum.java),
which create a [WallPost](https://github.com/driver733/VK-Uploader/blob/master/src/main/java/com/driver733/vkuploader/wallpost/WallPost.java) with audio (music album and a album artwork) or image (photo album) content.
A full list of classes implementing this interface can be found in the package [wallpost](https://github.com/driver733/VK-Uploader/blob/master/src/main/java/com/driver733/vkuploader/wallpost).
In addition, the examples, which showcase how to utilize this interface and its implementations can be found in corresponding [test package](https://github.com/driver733/VK-Uploader/tree/master/src/test/java/com/driver733/vkuploader/wallpost).
### [WallPosts](https://github.com/driver733/VK-Uploader/blob/master/src/main/java/com/driver733/vkuploader/wallpost/wallposts/WallPosts.java)
This interface is implemented by the classes which generate a series of [WallPost](https://github.com/driver733/VK-Uploader/blob/master/src/main/java/com/driver733/vkuploader/wallpost/WallPost.java)s and combine them into a list of [ExecuteBatchQueries](https://github.com/VKCOM/vk-java-sdk/blob/master/sdk/src/main/java/com/vk/api/sdk/queries/execute/ExecuteBatchQuery.java).
After the queries are executed, the `updateProperties` method shall be called in order to cache the queries` results. (usually with properties files).
### [Posts](https://github.com/driver733/VK-Uploader/blob/master/src/main/java/com/driver733/vkuploader/post/posts/Posts.java)
This interface is implemented by classes which create [WallPosts](https://github.com/driver733/VK-Uploader/blob/master/src/main/java/com/driver733/vkuploader/wallpost/wallposts/WallPosts.java).
For example, the [PostableRootDir](https://github.com/driver733/VK-Uploader/blob/master/src/main/java/com/driver733/vkuploader/post/PostableRootDir.java) class creates [WallPosts](https://github.com/driver733/VK-Uploader/blob/master/src/main/java/com/driver733/vkuploader/wallpost/wallposts/WallPosts.java) from the provided directory.
### [Postable](https://github.com/driver733/VK-Uploader/blob/master/src/main/java/com/driver733/vkuploader/post/Postable.java)
This interface serves as an entry point to the [WallPosts](https://github.com/driver733/VK-Uploader/blob/master/src/main/java/com/driver733/vkuploader/wallpost/wallposts/WallPosts.java). The classes which implement this interface
create [WallPosts](https://github.com/driver733/VK-Uploader/blob/master/src/main/java/com/driver733/vkuploader/wallpost/wallposts/WallPosts.java) using a [Posts](https://github.com/driver733/VK-Uploader/blob/master/src/main/java/com/driver733/vkuploader/post/posts/Posts.java) instance and then post (execute the generated queries) them.
### [Entrance](https://github.com/driver733/VK-Uploader/blob/master/src/main/java/com/driver733/vkuploader/post/Entrance.java)
Application starting point. The [EntranceDirectory](https://github.com/driver733/VK-Uploader/blob/master/src/main/java/com/driver733/vkuploader/post/EntranceDirectory.java) class, for instance, tracks the provided folder for changes
and acts upon them (creates [WallPosts](https://github.com/driver733/VK-Uploader/blob/master/src/main/java/com/driver733/vkuploader/wallpost/wallposts/WallPosts.java) and executes them).
## Maven
1. Qulice (static analysis check)
```
$ mvn clean test -DskipTests=true qulice:check
```
2. Unit tests
```
$ mvn clean test
```
3. Integration Tests
```
$ clean verify -Dvk.userId= -Dvk.groupId= -Dvk.token=
```
4. Full Pre-push validation (static analysis + unit tests + integration tests)
```
$ mvn clean verify qulice:check -Dvk.userId= -Dvk.groupId= -Dvk.token=
```
5. Test coverage report (located in `VK-Uploader/target/site`)
```
$ mvn clean test jacoco:report
```
For more info see [Authorization Code Flow for User Access Token](https://vk.com/dev/authcode_flow_user)
## How to contribute
Fork repository, make changes, send us a pull request. We will review
your changes and apply them to the `master` branch shortly, provided
they don't violate our quality standards. To avoid frustration, before
sending us your pull request please run full Maven build:
```
$ mvn clean test -DskipTests=true qulice:check
```
To avoid build errors use maven 3.2+.
Pay attention that our `pom.xml` inherits a lot of configuration
from [jcabi-parent](http://parent.jcabi.com).
[This article](http://www.yegor256.com/2015/02/05/jcabi-parent-maven-pom.html)
explains why it's done this way.
## Got questions?
If you have questions or general suggestions, don't hesitate to submit
a new [Github issue](https://github.com/driver733/VK-Uploader/issues/new).