| | |
| | | import com.gitblit.models.UserModel;
|
| | | import com.gitblit.utils.FederationUtils;
|
| | | import com.gitblit.utils.JGitUtils;
|
| | | import com.gitblit.utils.JsonUtils;
|
| | | import com.gitblit.utils.StringUtils;
|
| | | import com.google.gson.Gson;
|
| | | import com.google.gson.GsonBuilder;
|
| | |
|
| | | /**
|
| | | * GitBlit is the servlet context listener singleton that acts as the core for
|
| | |
| | | public void setUserService(IUserService userService) {
|
| | | logger.info("Setting up user service " + userService.toString());
|
| | | this.userService = userService;
|
| | | this.userService.setup(settings);
|
| | | }
|
| | |
|
| | | /**
|
| | |
| | | * @param proposal
|
| | | * the proposal
|
| | | * @param gitblitUrl
|
| | | * the url of your gitblit instance
|
| | | * the url of your gitblit instance to send an email to
|
| | | * administrators
|
| | | * @return true if the proposal was submitted
|
| | | */
|
| | | public boolean submitFederationProposal(FederationProposal proposal, String gitblitUrl) {
|
| | | // convert proposal to json
|
| | | Gson gson = new GsonBuilder().setPrettyPrinting().create();
|
| | | String json = gson.toJson(proposal);
|
| | | String json = JsonUtils.toJsonString(proposal);
|
| | |
|
| | | try {
|
| | | // make the proposals folder
|
| | |
| | | && file.getName().toLowerCase().endsWith(Constants.PROPOSAL_EXT);
|
| | | }
|
| | | });
|
| | | Gson gson = new Gson();
|
| | | for (File file : files) {
|
| | | String json = com.gitblit.utils.FileUtils.readContent(file, null);
|
| | | FederationProposal proposal = gson.fromJson(json, FederationProposal.class);
|
| | | FederationProposal proposal = JsonUtils.fromJsonString(json, FederationProposal.class);
|
| | | list.add(proposal);
|
| | | }
|
| | | }
|