Pollen-commits
Threads by month
- ----- 2026 -----
- June
- May
- April
- March
- February
- January
- ----- 2025 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2024 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2023 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2022 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2021 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2020 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2019 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2018 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2017 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2016 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2015 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2014 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2013 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2012 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2011 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2010 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2009 -----
- December
- November
- October
- September
- August
May 2014
- 5 participants
- 203 discussions
r3943 - in trunk/pollen-ui-angular/src/main/webapp: css js js/controllers partials
by garandel@users.chorem.org 15 May '14
by garandel@users.chorem.org 15 May '14
15 May '14
Author: garandel
Date: 2014-05-15 12:23:42 +0200 (Thu, 15 May 2014)
New Revision: 3943
Url: http://forge.chorem.org/projects/pollen/repository/revisions/3943
Log:
add persistance vote
Added:
trunk/pollen-ui-angular/src/main/webapp/partials/poll-settings.html
Removed:
trunk/pollen-ui-angular/src/main/webapp/partials/poll-popupSettings.html
Modified:
trunk/pollen-ui-angular/src/main/webapp/css/style.css
trunk/pollen-ui-angular/src/main/webapp/js/app.js
trunk/pollen-ui-angular/src/main/webapp/js/controllers/pollCtrl.js
trunk/pollen-ui-angular/src/main/webapp/js/services.js
trunk/pollen-ui-angular/src/main/webapp/partials/inline-poll.html
trunk/pollen-ui-angular/src/main/webapp/partials/poll.html
Modified: trunk/pollen-ui-angular/src/main/webapp/css/style.css
===================================================================
--- trunk/pollen-ui-angular/src/main/webapp/css/style.css 2014-05-14 14:09:23 UTC (rev 3942)
+++ trunk/pollen-ui-angular/src/main/webapp/css/style.css 2014-05-15 10:23:42 UTC (rev 3943)
@@ -195,4 +195,4 @@
.danger {
color: #a94442;
-}
\ No newline at end of file
+}
Modified: trunk/pollen-ui-angular/src/main/webapp/js/app.js
===================================================================
--- trunk/pollen-ui-angular/src/main/webapp/js/app.js 2014-05-14 14:09:23 UTC (rev 3942)
+++ trunk/pollen-ui-angular/src/main/webapp/js/app.js 2014-05-15 10:23:42 UTC (rev 3943)
@@ -145,3 +145,4 @@
}
}
})
+
Modified: trunk/pollen-ui-angular/src/main/webapp/js/controllers/pollCtrl.js
===================================================================
--- trunk/pollen-ui-angular/src/main/webapp/js/controllers/pollCtrl.js 2014-05-14 14:09:23 UTC (rev 3942)
+++ trunk/pollen-ui-angular/src/main/webapp/js/controllers/pollCtrl.js 2014-05-15 10:23:42 UTC (rev 3943)
@@ -129,17 +129,6 @@
});
}
- $scope.popupSettings = function () {
- var modalInstance = $modal.open({
- templateUrl : 'partials/poll-popupSettings.html',
- controller : PollPopupSettingsCtrl,
- size : 'lg',
- resolve : { poll: function () {
- return $scope.data.poll;
- }
- }
- });
- }
var PollPopChoiceCtrl = function ($scope, $filter, $modalInstance, title, choice) {
$scope.title = title;
@@ -164,58 +153,13 @@
}
- var PollPopupSettingsCtrl = function ($scope, $filter, $modalInstance, poll) {
- $scope.poll = poll;
- $scope.toDay = new Date();
-
- $scope.$watch('poll.beginDate', function() {
- if (poll.beginChoiceDate) {
- if (poll.beginChoiceDate < poll.beginDate) {
- poll.beginChoiceDate = poll.beginDate;
- }
- }
- else {
- poll.beginChoiceDate = poll.beginDate;
- }
- });
-
- $scope.$watch('poll.endDate', function() {
- if (poll.endChoiceDate) {
- if (poll.endChoiceDate > poll.endDate) {
- poll.endChoiceDate = poll.endDate;
- }
- }
- else {
- poll.endChoiceDate = poll.endDate;
- }
- });
-
- if (!angular.isDefined($scope.poll.continuousResults)) {
- $scope.poll.continuousResults = false;
+ $scope.printCheckbox= function (value) {
+ if (value) {
+ return 'Oui';
+ } else {
+ return 'Non';
}
-
- if (!angular.isDefined($scope.poll.resultVisibility)) {
- $scope.poll.resultVisibility = 'EVERYBODY';
- }
-
- if (!angular.isDefined($scope.poll.choiceAddAllowed)) {
- $scope.poll.choiceAddAllowed = false;
- }
-
- $scope.close = function () {
- $modalInstance.dismiss();
- }
-
- $scope.printCheckbox= function (value) {
- if (value) {
- return 'Oui';
- } else {
- return 'Non';
- }
- }
}
-
-
}])
.controller('PollCreateCtrl', ['$scope', '$controller', '$location', 'Poll', '$cookieStore', function ($scope, $controller, $location, Poll, $cookieStore) {
@@ -356,31 +300,21 @@
var initVote = function () {
$scope.data.vote = {};
- $scope.data.vote.name = "";
- $scope.data.vote.choices = [];
+ $scope.data.vote.voter = {name : ""};
+ $scope.data.vote.anonymous = false;
+ $scope.data.vote.voteToChoices = [];
for (var i = 0; i < $scope.data.choices.length; ++i) {
- if ($scope.data.choices[i].choiceType == 'TEXT') {
- $scope.data.vote.choices.push({name:$scope.data.choices[i].name, value:false});
- }
- else if ($scope.poll.choices[i].choiceType == 'DATE') {
- $scope.data.choices.push({name: $scope.data.choices[i].date , value:false});
- }
+ $scope.data.vote.voteToChoices.push({choiceId:$scope.data.choices[i].topiaId, voteValue:false});
}
}
PollVote.query({pollId:$routeParams.pollId}, function (data) {
- console.log(data);
$scope.data.votants = data;
})
$scope.voter = function () {
if ($scope.data.vote.name != '') {
- var data = {};
- data.name = $scope.data.vote.name;
- data.choices = angular.copy($scope.data.vote.choices);
- $scope.data.votants.push(data);
-
- PollVote.add({pollId:$routeParams.pollId, permission:$scope.data.poll.creator.permission.token}, data, function (returnRequest) {
+ PollVote.add({pollId:$routeParams.pollId}, $scope.data.vote, function (returnRequest) {
console.log(returnRequest);
});
Modified: trunk/pollen-ui-angular/src/main/webapp/js/services.js
===================================================================
--- trunk/pollen-ui-angular/src/main/webapp/js/services.js 2014-05-14 14:09:23 UTC (rev 3942)
+++ trunk/pollen-ui-angular/src/main/webapp/js/services.js 2014-05-15 10:23:42 UTC (rev 3943)
@@ -67,11 +67,7 @@
.factory('PollVote', ['$resource', function ($resource) {
var transformParam = function (data) {
- var obj = {};
- obj.voter = {name : data.name}
- obj.voteToChoice = angular.copy(data.choices);
-
- return 'vote='+encodeURIComponent(JSON.stringify(obj));
+ return 'vote='+encodeURIComponent(JSON.stringify(data));
};
return $resource(conf.restURL+'/polls/:pollId/votes/:voteId', {voteId : '@topiaId'},
Modified: trunk/pollen-ui-angular/src/main/webapp/partials/inline-poll.html
===================================================================
--- trunk/pollen-ui-angular/src/main/webapp/partials/inline-poll.html 2014-05-14 14:09:23 UTC (rev 3942)
+++ trunk/pollen-ui-angular/src/main/webapp/partials/inline-poll.html 2014-05-15 10:23:42 UTC (rev 3943)
@@ -50,9 +50,9 @@
<!-- begin input vote -->
<tr ng-show="!globalVariables.editMode">
- <td class="pollChoice"> <input type="text" class="form-control" placeholder="votre nom" ng-model="data.vote.name" /> </td>
- <td ng-repeat="choice in data.vote.choices" class="pollChoice">
- <input type="checkbox" name="$index" ng-model="choice.value"/>
+ <td class="pollChoice"> <input type="text" class="form-control" placeholder="votre nom" ng-model="data.vote.voter.name" /> </td>
+ <td ng-repeat="choice in data.vote.voteToChoices" class="pollChoice">
+ <input type="checkbox" name="{{choice.choice.topiaId}}" ng-model="choice.voteValue"/>
</td>
<td>
<input class="btn btn-primary btn-large" type="button" value="Vote" ng-click="voter()" />
Deleted: trunk/pollen-ui-angular/src/main/webapp/partials/poll-popupSettings.html
===================================================================
--- trunk/pollen-ui-angular/src/main/webapp/partials/poll-popupSettings.html 2014-05-14 14:09:23 UTC (rev 3942)
+++ trunk/pollen-ui-angular/src/main/webapp/partials/poll-popupSettings.html 2014-05-15 10:23:42 UTC (rev 3943)
@@ -1,163 +0,0 @@
-<!--
- #%L
- Pollen :: UI (Angular)
- %%
- Copyright (C) 2009 - 2014 CodeLutin
- %%
- This program is free software: you can redistribute it and/or modify
- it under the terms of the GNU Affero General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU Affero General Public License
- along with this program. If not, see <http://www.gnu.org/licenses/>.
- #L%
- -->
-
-
-
-<form class="form-horizontal">
- <div class="modal-header">
- <h3 class="modal-title">Configuration</h3>
- </div>
-
- <div class="modal-body">
-
- <h4>Confiuration global</h4>
-
- <div class="form-group">
- <label class="col-lg-4 control-label" for="popBeginDate">Date de début : </label>
- <div class="col-lg-8">
- <input id="popBeginDate" class="form-control" type="text"
- datepicker-popup="dd/MM/yyyy"
- min-date="toDay"
- max-date="poll.endDate"
- ng-model="poll.beginDate"
- is-open="beginDateOpened"
- ng-click="beginDateOpened = true" />
- </div>
- </div>
-
- <div class="form-group">
- <label class="col-lg-4 control-label" for="popEndDate">Date de fin : </label>
- <div class="col-lg-8">
- <input id="popEndDate" class="form-control" type="text"
- datepicker-popup="dd/MM/yyyy"
- min-date="poll.beginDate"
- ng-model="poll.endDate"
- is-open="endDateOpened"
- ng-click="endDateOpened = true" />
- </div>
- </div>
-
- <div class="form-group">
- <label class="col-lg-4 control-label">Résultat : </label>
- <div class="col-lg-8 btn-group">
- <button type="button" class="btn btn-success" ng-model="poll.resultVisibility" btn-radio="'EVERYBODY'">Public</button>
- <button type="button" class="btn btn-success" ng-model="poll.resultVisibility" btn-radio="'VOTER'">Participants</button>
- <button type="button" class="btn btn-success" ng-model="poll.resultVisibility" btn-radio="'CREATOR'">Créateur</button>
- </div>
- </div>
-
- <div class="form-group">
- <label class="col-lg-4 control-label" for="popContinuousResults">Résultat continue : </label>
- <div class="col-lg-8">
- <button class="btn btn-default" id="popContinuousResults" ng-model="poll.continuousResults" btn-checkbox>{{printCheckbox(poll.continuousResults)}}</button>
- </div>
- </div>
-
- <h4>Configuration des Choix</h4>
-
- <div class="form-group">
- <label class="col-lg-4 control-label" for="popChoiceAddAllowed">Ajout de choix par les votants :</label>
- <div class="col-lg-8">
- <button class="btn btn-default" id="popChoiceAddAllowed" ng-model="poll.choiceAddAllowed" btn-checkbox >{{printCheckbox(poll.choiceAddAllowed)}}</button>
- </div>
- </div>
- <div class="form-group" ng-show="poll.choiceAddAllowed">
- <label class="col-lg-4 control-label" for="popBeginChoiceDate">Date de début : </label>
- <div class="col-lg-8">
- <input class="form-control" type="text" id="popBeginChoiceDate"
- datepicker-popup="dd/MM/yyyy"
- min-date="poll.beginDate"
- max-date="poll.endChoiceDate"
- ng-model="poll.beginChoiceDate"
- is-open="beginChoiceDateOpened"
- ng-click="beginChoiceDateOpened = true" />
- </div>
- </div>
- <div class="form-group" ng-if="poll.choiceAddAllowed" for="popEndChoiceDate">
- <label class="col-lg-4 control-label">Date de fin : </label>
- <div class="col-lg-8">
- <input class="form-control" type="text" id="popEndChoiceDate"
- datepicker-popup="dd/MM/yyyy"
- min-date="poll.beginChoiceDate"
- max-date="poll.endDate"
-
- ng-model="poll.endChoiceDate"
- is-open="endChoiceDateOpened"
- ng-click="endChoiceDateOpened = true" />
- </div>
- </div>
-
- <div class="form-group">
- <label class="col-lg-4 control-label" for="popLimitedVote">Limiter les votes :</label>
- <div class="col-lg-8">
- <button class="btn btn-default" id="popLimitedVote" ng-model="poll.limitedVote" btn-checkbox >{{printCheckbox(poll.limitedVote)}}</button>
- </div>
- </div>
- <div class="form-group" ng-show="poll.limitedVote">
- <label class="col-lg-4 control-label" for="popMaxChoiceNumber">Nombre de vote :</label>
- <div class="col-lg-6">
- <input type="text" class="form-control" id="popMaxChoiceNumber" ng-model="poll.maxChoiceNumber"/>
- </div>
- </div>
-
- <h4> Configuration des Réponses </h4>
-
- <div class="form-group">
- <label class="col-lg-4 control-label">Type : </label>
- <div class="col-lg-8">
- <div class="btn-group">
- <button type="button" class="btn btn-success" ng-model="poll.voteCountingType" btn-radio="1">Normal</button>
- <button type="button" class="btn btn-success" ng-model="poll.voteCountingType" btn-radio="2">Pourcentage</button>
- <button type="button" class="btn btn-success" ng-model="poll.voteCountingType" btn-radio="3">Condorcet</button>
- <button type="button" class="btn btn-success" ng-model="poll.voteCountingType" btn-radio="4">Nombre</button>
- </div>
- <div class="btn-group">
- <button type="button" class="btn btn-success" ng-model="poll.voteCountingType" btn-radio="5">Borda</button>
- <button type="button" class="btn btn-success" ng-model="poll.voteCountingType" btn-radio="6">Vote alternatif</button>
- <button type="button" class="btn btn-success" ng-model="poll.voteCountingType" btn-radio="7">Coombs</button>
- </div>
- <p>Description du types de vote</p>
- </div>
- </div>
- </div>
-
- <div class="form-group">
- <label class="col-lg-4 control-label">Visibilité : </label>
- <div class="col-lg-8 btn-group">
- <button type="button" class="btn btn-success" ng-model="poll.voteVisibility" btn-radio="'EVERYBODY'">Public</button>
- <button type="button" class="btn btn-success" ng-model="poll.voteVisibility" btn-radio="'VOTER'">Participants</button>
- <button type="button" class="btn btn-success" ng-model="poll.voteVisibility" btn-radio="'CREATOR'">Créateur</button>
- <button type="button" class="btn btn-success" ng-model="poll.voteVisibility" btn-radio="'ANONYMOUS'">Anonyme</button>
- </div>
- </div>
-
- <div class="form-group">
- <label class="col-lg-4 control-label">Autoriser les votes anonymes :</label>
- <div class="col-lg-8">
- <button class="btn btn-default" ng-model="poll.anonymousVoteAllowed" btn-checkbox >{{printCheckbox(poll.anonymousVoteAllowed)}}</button>
- </div>
- </div>
-
-
- <div class="modal-footer">
- <button type="button" class="btn btn-primary" ng-click="close()">close</button>
- </div>
-</form>
\ No newline at end of file
Copied: trunk/pollen-ui-angular/src/main/webapp/partials/poll-settings.html (from rev 3940, trunk/pollen-ui-angular/src/main/webapp/partials/poll-popupSettings.html)
===================================================================
--- trunk/pollen-ui-angular/src/main/webapp/partials/poll-settings.html (rev 0)
+++ trunk/pollen-ui-angular/src/main/webapp/partials/poll-settings.html 2014-05-15 10:23:42 UTC (rev 3943)
@@ -0,0 +1,151 @@
+<!--
+ #%L
+ Pollen :: UI (Angular)
+ %%
+ Copyright (C) 2009 - 2014 CodeLutin
+ %%
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU Affero General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU Affero General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+ #L%
+ -->
+
+
+ <h4>Confiuration global</h4>
+
+ <div class="form-group">
+ <label class="col-lg-4 control-label" for="beginDate">Date de début : </label>
+ <div class="col-lg-8">
+ <input id="beginDate" class="form-control" type="text"
+ datepicker-popup="dd/MM/yyyy"
+ min-date="toDay"
+ max-date="data.poll.endDate"
+ ng-model="data.poll.beginDate"
+ is-open="beginDateOpened"
+ ng-click="beginDateOpened = true" />
+ </div>
+ </div>
+
+ <div class="form-group">
+ <label class="col-lg-4 control-label" for="endDate">Date de fin : </label>
+ <div class="col-lg-8">
+ <input id="endDate" class="form-control" type="text"
+ datepicker-popup="dd/MM/yyyy"
+ min-date="data.poll.beginDate"
+ ng-model="data.poll.endDate"
+ is-open="endDateOpened"
+ ng-click="endDateOpened = true" />
+ </div>
+ </div>
+
+ <div class="form-group">
+ <label class="col-lg-4 control-label">Résultat : </label>
+ <div class="col-lg-8 btn-group">
+ <button type="button" class="btn btn-success" ng-model="data.poll.resultVisibility" btn-radio="'EVERYBODY'">Public</button>
+ <button type="button" class="btn btn-success" ng-model="data.poll.resultVisibility" btn-radio="'VOTER'">Participants</button>
+ <button type="button" class="btn btn-success" ng-model="data.poll.resultVisibility" btn-radio="'CREATOR'">Créateur</button>
+ </div>
+ </div>
+
+ <div class="form-group">
+ <label class="col-lg-4 control-label">Résultat continue : </label>
+ <div class="col-lg-8 btn-group">
+ <button class="btn btn-default" ng-model="data.poll.continuousResults" btn-radio="true">Oui</button>
+ <button class="btn btn-default" ng-model="data.poll.continuousResults" btn-radio="false">Non</button>
+ </div>
+ </div>
+
+ <h4>Configuration des Choix</h4>
+
+ <div class="form-group">
+ <label class="col-lg-4 control-label">Ajout de choix par les votants :</label>
+ <div class="col-lg-8 btn-group">
+ <button class="btn btn-default" ng-model="data.poll.choiceAddAllowed" btn-radio="true">Oui</button>
+ <button class="btn btn-default" ng-model="data.poll.choiceAddAllowed" btn-radio="false">Non</button>
+ </div>
+ </div>
+
+ <div class="form-group" ng-show="data.poll.choiceAddAllowed">
+ <label class="col-lg-4 control-label" for="beginChoiceDate">Date de début : </label>
+ <div class="col-lg-8">
+ <input class="form-control" type="text" id="beginChoiceDate"
+ datepicker-popup="dd/MM/yyyy"
+ min-date="data.poll.beginDate"
+ max-date="data.poll.endChoiceDate"
+ ng-model="data.poll.beginChoiceDate"
+ is-open="beginChoiceDateOpened"
+ ng-click="beginChoiceDateOpened = true" />
+ </div>
+ </div>
+ <div class="form-group" ng-if="data.poll.choiceAddAllowed" for="endChoiceDate">
+ <label class="col-lg-4 control-label">Date de fin : </label>
+ <div class="col-lg-8">
+ <input class="form-control" type="text" id="endChoiceDate"
+ datepicker-popup="dd/MM/yyyy"
+ min-date="data.poll.beginChoiceDate"
+ max-date="data.poll.endDate"
+
+ ng-model="data.poll.endChoiceDate"
+ is-open="endChoiceDateOpened"
+ ng-click="endChoiceDateOpened = true" />
+ </div>
+ </div>
+
+ <div class="form-group">
+ <label class="col-lg-4 control-label">Limiter les votes :</label>
+ <div class="col-lg-8 btn-group">
+ <button class="btn btn-default" ng-model="data.poll.limitedVote" btn-radio="true">Oui</button>
+ <button class="btn btn-default" ng-model="data.poll.limitedVote" btn-radio="false">Non</button>
+ </div>
+ </div>
+ <div class="form-group" ng-show="data.poll.limitedVote">
+ <label class="col-lg-4 control-label" for="popMaxChoiceNumber">Nombre de vote :</label>
+ <div class="col-lg-6">
+ <input type="text" class="form-control" id="popMaxChoiceNumber" ng-model="data.poll.maxChoiceNumber"/>
+ </div>
+ </div>
+
+ <h4> Configuration des Réponses </h4>
+
+ <div class="form-group">
+ <label class="col-lg-4 control-label">Type : </label>
+ <div class="col-lg-8">
+ <div class="btn-group">
+ <button type="button" class="btn btn-success" ng-model="data.poll.voteCountingType" btn-radio="1">Normal</button>
+ <button type="button" class="btn btn-success" ng-model="data.poll.voteCountingType" btn-radio="2">Pourcentage</button>
+ <button type="button" class="btn btn-success" ng-model="data.poll.voteCountingType" btn-radio="3">Condorcet</button>
+ <button type="button" class="btn btn-success" ng-model="data.poll.voteCountingType" btn-radio="4">Nombre</button>
+ <button type="button" class="btn btn-success" ng-model="data.poll.voteCountingType" btn-radio="5">Borda</button>
+ <button type="button" class="btn btn-success" ng-model="data.poll.voteCountingType" btn-radio="6">Vote alternatif</button>
+ <button type="button" class="btn btn-success" ng-model="data.poll.voteCountingType" btn-radio="7">Coombs</button>
+ </div>
+ <p>Description du types de vote</p>
+ </div>
+ </div>
+
+ <div class="form-group">
+ <label class="col-lg-4 control-label">Visibilité : </label>
+ <div class="col-lg-8 btn-group">
+ <button type="button" class="btn btn-success" ng-model="data.poll.voteVisibility" btn-radio="'EVERYBODY'">Public</button>
+ <button type="button" class="btn btn-success" ng-model="data.poll.voteVisibility" btn-radio="'VOTER'">Participants</button>
+ <button type="button" class="btn btn-success" ng-model="data.poll.voteVisibility" btn-radio="'CREATOR'">Créateur</button>
+ <button type="button" class="btn btn-success" ng-model="data.poll.voteVisibility" btn-radio="'ANONYMOUS'">Anonyme</button>
+ </div>
+ </div>
+
+ <div class="form-group">
+ <label class="col-lg-4 control-label">Autoriser les votes anonymes :</label>
+ <div class="col-lg-8 btn-group">
+ <button class="btn btn-default" ng-model="data.poll.anonymousVoteAllowed" btn-radio="true">Oui</button>
+ <button class="btn btn-default" ng-model="data.poll.anonymousVoteAllowed" btn-radio="false">Non</button>
+ </div>
+ </div>
Modified: trunk/pollen-ui-angular/src/main/webapp/partials/poll.html
===================================================================
--- trunk/pollen-ui-angular/src/main/webapp/partials/poll.html 2014-05-14 14:09:23 UTC (rev 3942)
+++ trunk/pollen-ui-angular/src/main/webapp/partials/poll.html 2014-05-15 10:23:42 UTC (rev 3943)
@@ -19,7 +19,7 @@
#L%
-->
-<form class="form-inline" name="pollForm" novalidate>
+<form class="form-horizontal">
<alert type="danger" ng-if="globalVariables.errorForm"> Champ non remplie </alert>
<alert type="danger" ng-if="restError.choice"> Vous devez avoir au moins 1 choix </alert>
@@ -60,7 +60,7 @@
</tab>
<tab heading="Setting" ng-show="globalVariables.editMode" >
- <div ng-include="'partials/poll-popupSettings.html'"></div>
+ <div ng-include="'partials/poll-settings.html'"></div>
</tab>
</tabset>
@@ -68,14 +68,12 @@
<hr/>
<button type="button" class="btn btn-default" ng-model="globalVariables.editMode" btn-checkbox>Mode Edition</button>
<button class="btn btn-primary" ng-click="save()">Save</button>
- <button class="btn btn-default" ng-click="popupSettings()">Settings</button>
</div>
<div ng-if="globalVariables.edit">
<hr/>
<button type="button" class="btn btn-default" ng-model="globalVariables.editMode" btn-checkbox>Mode Edition</button>
<button class="btn btn-danger" ng-click="delete();">Delete</button>
- <button class="btn btn-default" ng-click="popupSettings()">Settings</button>
</div>
</form>
\ No newline at end of file
1
0
r3942 - in trunk/pollen-ui-angular/src/main/webapp: css js js/controllers partials
by garandel@users.chorem.org 14 May '14
by garandel@users.chorem.org 14 May '14
14 May '14
Author: garandel
Date: 2014-05-14 16:09:23 +0200 (Wed, 14 May 2014)
New Revision: 3942
Url: http://forge.chorem.org/projects/pollen/repository/revisions/3942
Log:
print error in form
Modified:
trunk/pollen-ui-angular/src/main/webapp/css/style.css
trunk/pollen-ui-angular/src/main/webapp/js/app.js
trunk/pollen-ui-angular/src/main/webapp/js/controllers/pollCtrl.js
trunk/pollen-ui-angular/src/main/webapp/partials/inline-poll.html
trunk/pollen-ui-angular/src/main/webapp/partials/poll.html
Modified: trunk/pollen-ui-angular/src/main/webapp/css/style.css
===================================================================
--- trunk/pollen-ui-angular/src/main/webapp/css/style.css 2014-05-14 08:53:32 UTC (rev 3941)
+++ trunk/pollen-ui-angular/src/main/webapp/css/style.css 2014-05-14 14:09:23 UTC (rev 3942)
@@ -191,4 +191,8 @@
.pollBigVote {
float:right;
margin-top:5px;
+}
+
+.danger {
+ color: #a94442;
}
\ No newline at end of file
Modified: trunk/pollen-ui-angular/src/main/webapp/js/app.js
===================================================================
--- trunk/pollen-ui-angular/src/main/webapp/js/app.js 2014-05-14 08:53:32 UTC (rev 3941)
+++ trunk/pollen-ui-angular/src/main/webapp/js/app.js 2014-05-14 14:09:23 UTC (rev 3942)
@@ -86,24 +86,45 @@
})
.directive('ngExit', function ($timeout) {
- return function (scope, element, attrs) {
- element.bind("keydown keypress", function (event) {
- if(event.which === 27 || event.which === 13) {
- scope.$apply(function (){
- scope.$eval(attrs.ngExit);
- });
+ return {
+ link: function (scope, element, attrs) {
+ element.bind("keydown keypress", function (event) {
+ if(event.which === 27 || event.which === 13) {
+ scope.$apply(function () {
+ scope.$eval(attrs.ngExit);
+ });
- event.preventDefault();
- }
- });
- element.bind('blur', function () {
- $timeout (function () {
- scope.$apply(attrs.ngExit);
- }, 150);
- });
+ event.preventDefault();
+ }
+ });
+
+ element.bind('blur', function () {
+ $timeout (function () {
+ scope.$apply(attrs.ngExit);
+ }, 150);
+ });
+ }
};
})
+.directive('infoError', function() {
+ return {
+ restrict:'E',
+ scope: {
+ error: '=',
+ forData: '=data'
+ },
+ template: '<span class="glyphicon glyphicon-exclamation-sign danger" tooltip="{{error}}" ng-if="error"></span>',
+ link: function (scope, element, attrs) {
+ scope.$watch('forData', function (newVal, oldVal) {
+ if (newVal != oldVal) {
+ delete scope.error;
+ }
+ });
+ }
+ };
+})
+
.directive('autoSave', function ($timeout) {
return {
restrict : 'A',
Modified: trunk/pollen-ui-angular/src/main/webapp/js/controllers/pollCtrl.js
===================================================================
--- trunk/pollen-ui-angular/src/main/webapp/js/controllers/pollCtrl.js 2014-05-14 08:53:32 UTC (rev 3941)
+++ trunk/pollen-ui-angular/src/main/webapp/js/controllers/pollCtrl.js 2014-05-14 14:09:23 UTC (rev 3942)
@@ -84,15 +84,14 @@
$scope.globalVariables.voted = angular.isDefined($scope.data.votants);
$scope.globalVariables.lastType = 'TEXT';
$scope.globalVariables.lastDate = new Date();
+ $scope.restError = {};
- $scope.$watch('pollForm.$valid', function (newVal) {
- $scope.formValid = newVal;
- $scope.globalVariables.errorForm = false;
- });
-
$scope.addChoice = function () {
var index = $scope.data.choices.push(initChoice());
var choice = $scope.data.choices[index-1];
+ if (angular.isDefined($scope.restError)) {
+ delete $scope.restError.choice;
+ }
popupChoice(choice, 'Add Choice', $scope.callBackAddChoice);
}
@@ -236,21 +235,20 @@
initPoll();
$scope.save = function () {
- if ($scope.formValid) {
- var poll = angular.copy($scope.data.poll);
- poll.choice = angular.copy($scope.data.choices);
- Poll.add(poll, function (data) {
- $cookieStore.put('saved', true);
- $location.url('/poll/edit/'+data.topiaId+'?token='+data.permission);
- }, function (error) {
- $scope.globalVariables.restError = true;
- $scope.restError = error;
- }
- );
- }
- else {
- $scope.globalVariables.errorForm = true;
- }
+ var poll = angular.copy($scope.data.poll);
+ poll.choice = angular.copy($scope.data.choices);
+ Poll.add(poll, function (data) {
+ $cookieStore.put('saved', true);
+ $location.url('/poll/edit/'+data.topiaId+'?token='+data.permission);
+ }, function (error) {
+ $scope.globalVariables.restError = true;
+ $scope.restError = error.data;
+ angular.forEach($scope.data.choices, function (choice, index) {
+ if (angular.isDefined(error.data['choice['+index+'].name'])) {
+ choice.restError = {name:error.data['choice['+index+'].name']};
+ }
+ })
+ });
}
$scope.delete = function () {
@@ -264,26 +262,24 @@
$scope.globalVariables.edit = true;
- var timeout = null;
- $scope.autoSave = function (newValue, oldValue) {
- if (newValue != oldValue) {
- if (timeout) {
- $timeout.cancel(timeout);
- }
- timeout = $timeout($scope.save, 10000);
- }
- }
-
$scope.callBackAddChoice = function (choice) {
PollChoice.add({pollId:$routeParams.pollId, permission:$routeParams.token}, choice, function (data) {
+ delete choice.restError;
choice.topiaId = data.topiaId;
console.log(data);
$scope.globalVariables.saved = true;
+ }, function (error) {
+ choice.restError = error.data;
});
}
$scope.callBackEditChoice = function (choice) {
- PollChoice.update({permission:$routeParams.token, pollId:$routeParams.pollId, choiceId:choice.topiaId}, choice);
+ PollChoice.update({permission:$routeParams.token, pollId:$routeParams.pollId, choiceId:choice.topiaId}, choice, function() {
+ delete choice.restError;
+ $scope.globalVariables.saved = true;
+ }, function (error) {
+ choice.restError = error.data;
+ });
}
$scope.deleteChoice = function (choice) {
@@ -302,7 +298,6 @@
var initPoll = function () {
Poll.get({pollId:$routeParams.pollId}).$promise.then(function (poll) {
$scope.data.poll = poll;
- $scope.$watchCollection('data.poll', $scope.autoSave);
});
PollChoice.query({pollId:$routeParams.pollId}).$promise.then(function (choices) {
$scope.data.choices = choices;
@@ -313,18 +308,11 @@
initPoll();
$scope.save = function () {
- $timeout.cancel(timeout);
- if ($scope.formValid) {
- $scope.data.poll.$update({permission:$routeParams.token}, function (data) {
- $scope.globalVariables.saved = true;
- }, function (error) {
- console.log(error);
- });
- }
- else {
- $scope.globalVariables.errorForm = true;
- }
-
+ $scope.data.poll.$update({permission:$routeParams.token}, function (data) {
+ $scope.globalVariables.saved = true;
+ }, function (error) {
+ angular.extend($scope.restError, error.data);
+ });
}
$scope.saveChoice = function (choice) {
Modified: trunk/pollen-ui-angular/src/main/webapp/partials/inline-poll.html
===================================================================
--- trunk/pollen-ui-angular/src/main/webapp/partials/inline-poll.html 2014-05-14 08:53:32 UTC (rev 3941)
+++ trunk/pollen-ui-angular/src/main/webapp/partials/inline-poll.html 2014-05-14 14:09:23 UTC (rev 3942)
@@ -27,9 +27,12 @@
<td><button ng-if="globalVariables.editMode" ng-click="bigVersion()" class="btn btn-default" >Big version</button></td>
<td ng-repeat="choice in data.choices" class="pollChoice pollAnim" ng-mouseenter="showEditHover = true" ng-mouseleave="showEditHover = false">
<div ng-if="choice.choiceType == 'TEXT'" edit-me="showEdit" >
- <div ng-hide="showEdit && !globalVariables.voted" class="fixe-input" title="{{choice.description}}">{{choice.name}} <input type="button" class="btn btn-default" ng-if="!globalVariables.voted && globalVariables.editMode" ng-show="showEditHover" ng-click="editChoice(choice)" value="..."/></div>
+ <div ng-hide="showEdit && !globalVariables.voted" class="fixe-input" title="{{choice.description}}">
+ {{choice.name || 'click for edit'}}
+ <info-Error error="choice.restError.name[0]" data="choice.name"></info-Error>
+ <input type="button" class="btn btn-default" ng-if="!globalVariables.voted && globalVariables.editMode" ng-show="showEditHover" ng-click="editChoice(choice)" value="..."/></div>
<div ng-show="showEdit && !globalVariables.voted">
- <input type="text" class="form-control" ng-model="choice.name" focus-me="showEdit" ng-exit="showEdit = false" auto-save="saveChoice(choice)" required/>
+ <input type="text" class="form-control" ng-model="choice.name" focus-me="showEdit" ng-exit="showEdit = false;" auto-save="saveChoice(choice)" required/>
<input type="button" class="btn btn-default" data-toggle="modal" data-target="#popupAddChoice" ng-click="editChoice(choice)" value="..."/>
</div>
</div>
@@ -46,7 +49,7 @@
<!-- end print choice -->
<!-- begin input vote -->
- <tr>
+ <tr ng-show="!globalVariables.editMode">
<td class="pollChoice"> <input type="text" class="form-control" placeholder="votre nom" ng-model="data.vote.name" /> </td>
<td ng-repeat="choice in data.vote.choices" class="pollChoice">
<input type="checkbox" name="$index" ng-model="choice.value"/>
@@ -58,7 +61,7 @@
<!-- end input vote -->
<!-- begin print vote -->
- <tr ng-repeat="vote in data.votants track by $index" class="pollAnim">
+ <tr ng-repeat="vote in data.votants track by $index" class="pollAnim" ng-show="!globalVariables.editMode">
<td class="pollChoice"> {{vote.name}}</td>
<td ng-repeat="choice in vote.choices" class="pollChoice">
<input type="checkbox" ng-model="choice.value" disabled/>
Modified: trunk/pollen-ui-angular/src/main/webapp/partials/poll.html
===================================================================
--- trunk/pollen-ui-angular/src/main/webapp/partials/poll.html 2014-05-14 08:53:32 UTC (rev 3941)
+++ trunk/pollen-ui-angular/src/main/webapp/partials/poll.html 2014-05-14 14:09:23 UTC (rev 3942)
@@ -22,26 +22,34 @@
<form class="form-inline" name="pollForm" novalidate>
<alert type="danger" ng-if="globalVariables.errorForm"> Champ non remplie </alert>
- <alert type="danger" ng-if="globalVariables.restError"> {{restError}} </alert>
+ <alert type="danger" ng-if="restError.choice"> Vous devez avoir au moins 1 choix </alert>
<alert type="success" ng-if="globalVariables.editMode && globalVariables.saved"> Sondage sauvegardé..</alert>
<alert type="success" ng-if="!globalVariables.editMode && globalVariables.saved"> Vote effectué..</alert>
<alert type="warning" ng-if="globalVariables.voted"> Les votes ont commencé, certaine modification sont inaccessible.. </alert>
<alert type="warning" ng-if="globalVariables.created"> <a href="#/poll/edit/{{pollId}}"> Edition du sondage </a>.. </alert>
+<tabset>
+<tab heading="Poll">
+
<div class="pollTitle" edit-me="showEditTitle">
- <h1 ng-hide="showEditTitle"> {{data.poll.title || 'Click Me for Editing'}} </h1>
+ <h1 ng-hide="showEditTitle">
+ {{data.poll.title || 'Click Me for Editing'}}
+ <info-Error error="restError.title[0]" data="data.poll.title"></info-Error>
+ </h1>
- <h1 ng-show="showEditTitle"><input type="text" class="form-control" focus-me="showEditTitle" ng-model="data.poll.title" ng-exit="showEditTitle = false" auto-save="save()" required/></h1>
+ <h1 ng-show="showEditTitle">
+ <input type="text" class="form-control" focus-me="showEditTitle" ng-model="data.poll.title" ng-exit="showEditTitle = false" auto-save="save()" required/>
+ </h1>
</div>
<div ng-hide="showEditDesc || !globalVariables.editMode && !poll.description " class="pollDesc" edit-me="showEditDesc">
<div ng-bind-html="toHTML(data.poll.description || 'Description (Facultatif). Ce cadre disparait si aucune description n\'est mise')"></div>
</div>
- <div ng-show="showEditDesc" class="pollDesc " ng-exit="showEditDesc = false;">
+ <div ng-show="showEditDesc" class="pollDesc">
<textarea id="descEditor" data-ck-editor ng-model="data.poll.description"></textarea>
- <input type="button" value="Return" class="btn btn-primary" ng-click="showEditDesc = false;"/>
+ <input type="button" value="Return" class="btn btn-primary" ng-click="showEditDesc = false; save()"/>
</div>
<div id="poll">
@@ -50,6 +58,12 @@
</div>
+</tab>
+<tab heading="Setting" ng-show="globalVariables.editMode" >
+ <div ng-include="'partials/poll-popupSettings.html'"></div>
+</tab>
+</tabset>
+
<div ng-if="globalVariables.create">
<hr/>
<button type="button" class="btn btn-default" ng-model="globalVariables.editMode" btn-checkbox>Mode Edition</button>
1
0
14 May '14
Author: garandel
Date: 2014-05-14 10:53:32 +0200 (Wed, 14 May 2014)
New Revision: 3941
Url: http://forge.chorem.org/projects/pollen/repository/revisions/3941
Log:
Add global conf in js/conf.js
Added:
trunk/pollen-ui-angular/src/main/webapp/js/conf.js.exemple
Modified:
trunk/pollen-ui-angular/src/main/webapp/index.html
trunk/pollen-ui-angular/src/main/webapp/js/services.js
Modified: trunk/pollen-ui-angular/src/main/webapp/index.html
===================================================================
--- trunk/pollen-ui-angular/src/main/webapp/index.html 2014-05-13 22:58:53 UTC (rev 3940)
+++ trunk/pollen-ui-angular/src/main/webapp/index.html 2014-05-14 08:53:32 UTC (rev 3941)
@@ -25,6 +25,8 @@
<link href="http://netdna.bootstrapcdn.com/bootstrap/3.1.1/css/bootstrap.min.css" rel="stylesheet"/>
<link rel="stylesheet" href="css/style.css"/>
+ <script src="js/conf.js"></script>
+
<script src="http://cdnjs.cloudflare.com/ajax/libs/lodash.js/2.4.1/lodash.min.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.15/angular.min.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.15/angular-route.min.js"></script>
Added: trunk/pollen-ui-angular/src/main/webapp/js/conf.js.exemple
===================================================================
--- trunk/pollen-ui-angular/src/main/webapp/js/conf.js.exemple (rev 0)
+++ trunk/pollen-ui-angular/src/main/webapp/js/conf.js.exemple 2014-05-14 08:53:32 UTC (rev 3941)
@@ -0,0 +1,4 @@
+var conf = {
+ // Rest-API Base Url
+ restURL : "http://exemple.com/api"
+}
\ No newline at end of file
Modified: trunk/pollen-ui-angular/src/main/webapp/js/services.js
===================================================================
--- trunk/pollen-ui-angular/src/main/webapp/js/services.js 2014-05-13 22:58:53 UTC (rev 3940)
+++ trunk/pollen-ui-angular/src/main/webapp/js/services.js 2014-05-14 08:53:32 UTC (rev 3941)
@@ -20,14 +20,9 @@
*/
angular.module('pollenServices', ['ngResource'])
-.factory('BaseUrl', function() {
+.factory('Poll', ['$resource', function ($resource) {
- return 'http://localhost\\:8080/pollen-rest-api/v1';
-})
-
-.factory('Poll', ['$resource', 'BaseUrl', function ($resource, BaseUrl) {
-
- return $resource(BaseUrl+'/polls/:pollId/:cmd', {pollId:'@topiaId'}, {
+ return $resource(conf.restURL+'/polls/:pollId/:cmd', {pollId:'@topiaId'}, {
'add' : {
method : 'POST',
transformRequest : function (data, headersGetter) {
@@ -42,17 +37,16 @@
transformRequest : function (data, headersGetter) {
return 'poll='+encodeURIComponent(JSON.stringify(data));
}
- ,headers : { 'X-HTTP-Method' : 'PUT'}
}
});
}])
-.factory('PollChoice', ['$resource', 'BaseUrl', function ($resource, BaseUrl) {
+.factory('PollChoice', ['$resource', function ($resource) {
var transformParam = function (data) {
return 'choice='+encodeURIComponent(JSON.stringify(data));
};
- return $resource(BaseUrl+'/polls/:pollId/choices/:choiceId', {choiceId : '@topiaId'},
+ return $resource(conf.restURL+'/polls/:pollId/choices/:choiceId', {choiceId : '@topiaId'},
{
'add' : {
method:'POST',
@@ -71,7 +65,7 @@
);
}])
-.factory('PollVote', ['$resource', 'BaseUrl', function ($resource, BaseUrl) {
+.factory('PollVote', ['$resource', function ($resource) {
var transformParam = function (data) {
var obj = {};
obj.voter = {name : data.name}
@@ -80,7 +74,7 @@
return 'vote='+encodeURIComponent(JSON.stringify(obj));
};
- return $resource(BaseUrl+'/polls/:pollId/votes/:voteId', {voteId : '@topiaId'},
+ return $resource(conf.restURL+'/polls/:pollId/votes/:voteId', {voteId : '@topiaId'},
{
'add' : {
method:'POST',
1
0
13 May '14
See <http://ci.chorem.org/jenkins/job/pollen-nightly/21/changes>
Changes:
[garandel] separate element of model in $scope.data
[Tony CHEMIT] improve conversions and lots of stuff... to be continued...
[garandel] fix create poll
[Tony CHEMIT] fix json serialization
[Tony CHEMIT] - receive object as json
- change from gson to jackson since gson can only deal with field accessors :(
- clean deps
------------------------------------------
[...truncated 2116 lines...]
[INFO] ------------------------------------------------------------------------
[INFO] Downloading: http://nexus.nuiton.org/nexus/content/groups/pollen-group/org/debux/webmoti…
[INFO] Downloading: http://nexus.nuiton.org/nexus/content/repositories/snapshots/org/debux/webm…
[INFO] Downloaded: http://nexus.nuiton.org/nexus/content/groups/pollen-group/org/debux/webmoti… (2 KB at 1.0 KB/sec)
[INFO] Downloading: http://nexus.nuiton.org/nexus/content/groups/pollen-group/org/debux/webmoti…
[INFO] Downloading: http://nexus.nuiton.org/nexus/content/repositories/snapshots/org/debux/webm…
[INFO] Downloaded: http://nexus.nuiton.org/nexus/content/groups/pollen-group/org/debux/webmoti… (613 B at 1.2 KB/sec)
[WARNING] The POM for org.antlr:stringtemplate:jar:3.2.1 is invalid, transitive dependencies (if any) will not be available, enable debug logging for more details
[INFO] Downloading: http://nexus.nuiton.org/nexus/content/repositories/snapshots/org/debux/webm…
[INFO] Downloading: http://nexus.nuiton.org/nexus/content/groups/pollen-group/org/debux/webmoti…
[INFO] Downloaded: http://nexus.nuiton.org/nexus/content/groups/pollen-group/org/debux/webmoti… (2 KB at 1.3 KB/sec)
[INFO]
[INFO] --- maven-clean-plugin:2.5:clean (default-clean) @ pollen-rest-api ---
[INFO] Deleting <http://ci.chorem.org/jenkins/job/pollen-nightly/ws/trunk/pollen-rest-api/ta…>
[INFO]
[INFO] --- maven-enforcer-plugin:1.3.1:enforce (ensure-no-container-api) @ pollen-rest-api ---
[INFO]
[INFO] --- maven-enforcer-plugin:1.3.1:enforce (check-project-files) @ pollen-rest-api ---
[INFO]
[INFO] --- helper-maven-plugin:2.1:share-server-secret (get-redmine-login) @ pollen-rest-api ---
[INFO] Exporting server [redmine-forge.chorem.org] privateKey in ${redmine.apiKey}
[INFO]
[INFO] --- license-maven-plugin:1.6:update-project-license (attach-licenses) @ pollen-rest-api ---
[INFO] Will create or update license file [agpl_v3] to <http://ci.chorem.org/jenkins/job/pollen-nightly/ws/trunk/pollen-rest-api/LI…>
[INFO]
[INFO] --- license-maven-plugin:1.6:add-third-party (attach-licenses) @ pollen-rest-api ---
[WARNING] Unable to obtain POM for artifact : org.antlr:stringtemplate:jar:3.2.1:compile
org.apache.maven.project.InvalidProjectModelException: 1 problem was encountered while building the effective model
[FATAL] Non-readable POM /var/local/forge/data/chorem.org/maven/repository/org/antlr/stringtemplate/3.2.1/stringtemplate-3.2.1.pom: input contained no data @
for project for project
at org.apache.maven.project.DefaultMavenProjectBuilder.transformError(DefaultMavenProjectBuilder.java:193)
at org.apache.maven.project.DefaultMavenProjectBuilder.buildFromRepository(DefaultMavenProjectBuilder.java:240)
at org.apache.maven.project.DefaultMavenProjectBuilder.buildFromRepository(DefaultMavenProjectBuilder.java:251)
at org.codehaus.mojo.license.api.DefaultDependenciesTool.loadProjectDependencies(DefaultDependenciesTool.java:206)
at org.codehaus.mojo.license.api.DefaultThirdPartyHelper.loadDependencies(DefaultThirdPartyHelper.java:152)
at org.codehaus.mojo.license.AddThirdPartyMojo.loadDependencies(AddThirdPartyMojo.java:288)
at org.codehaus.mojo.license.AbstractAddThirdPartyMojo.init(AbstractAddThirdPartyMojo.java:386)
at org.codehaus.mojo.license.AbstractLicenseMojo.execute(AbstractLicenseMojo.java:174)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:133)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:208)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:108)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:76)
at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:51)
at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:116)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:361)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:155)
at org.jvnet.hudson.maven3.launcher.Maven31Launcher.main(Maven31Launcher.java:132)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at org.codehaus.plexus.classworlds.launcher.Launcher.launchStandard(Launcher.java:330)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:238)
at jenkins.maven3.agent.Maven31Main.launch(Maven31Main.java:181)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at hudson.maven.Maven3Builder.call(Maven3Builder.java:134)
at hudson.maven.Maven3Builder.call(Maven3Builder.java:69)
at hudson.remoting.UserRequest.perform(UserRequest.java:118)
at hudson.remoting.UserRequest.perform(UserRequest.java:48)
at hudson.remoting.Request$2.run(Request.java:328)
at hudson.remoting.InterceptingExecutorService$1.call(InterceptingExecutorService.java:72)
at java.util.concurrent.FutureTask.run(FutureTask.java:262)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:745)
[INFO] Load missing file <http://ci.chorem.org/jenkins/job/pollen-nightly/ws/trunk/pollen-rest-api/sr…>
[INFO] Missing file <http://ci.chorem.org/jenkins/job/pollen-nightly/ws/trunk/pollen-rest-api/sr…> is up-to-date.
[INFO] Writing third-party file to <http://ci.chorem.org/jenkins/job/pollen-nightly/ws/trunk/pollen-rest-api/ta…>
[INFO] Will attach third party file from <http://ci.chorem.org/jenkins/job/pollen-nightly/ws/trunk/pollen-rest-api/sr…>
[INFO]
[INFO] >>> i18n-maven-plugin:3.0:bundle (default) @ pollen-rest-api >>>
[INFO]
[INFO] --- i18n-maven-plugin:3.0:collect-i18n-artifacts (collect-i18n-artifacts) @ pollen-rest-api ---
[WARNING] Invalid POM for org.antlr:stringtemplate:jar:3.2.1, transitive dependencies (if any) will not be available, enable debug logging for more details
[INFO] Downloading: https://oss.sonatype.org/content/repositories/snapshots/org/debux/webmotion…
[INFO] Downloaded: https://oss.sonatype.org/content/repositories/snapshots/org/debux/webmotion… (2 KB at 1.1 KB/sec)
[INFO] Downloading: https://oss.sonatype.org/content/repositories/snapshots/org/debux/webmotion…
[INFO] Downloaded: https://oss.sonatype.org/content/repositories/snapshots/org/debux/webmotion… (613 B at 1.9 KB/sec)
[INFO] collected 2 i18n artifacts for locale fr_FR stored in <http://ci.chorem.org/jenkins/job/pollen-nightly/ws/trunk/pollen-rest-api/ta…>
[INFO] collected 2 i18n artifacts for locale en_GB stored in <http://ci.chorem.org/jenkins/job/pollen-nightly/ws/trunk/pollen-rest-api/ta…>
[INFO]
[INFO] <<< i18n-maven-plugin:3.0:bundle (default) @ pollen-rest-api <<<
[INFO]
[INFO] --- i18n-maven-plugin:3.0:bundle (default) @ pollen-rest-api ---
[WARNING] bundle fr_FR contains 6/70 empty entries! (use -Di18n.showEmpty to see these entries)
[WARNING] bundle en_GB contains 6/70 empty entries! (use -Di18n.showEmpty to see these entries)
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ pollen-rest-api ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 3 resources
[INFO] Copying 2 resources
[INFO] Copying 3 resources
[INFO]
[INFO] --- license-maven-plugin:1.6:update-file-header (update-file-header) @ pollen-rest-api ---
[INFO] Will search files to update from root <http://ci.chorem.org/jenkins/job/pollen-nightly/ws/trunk/pollen-rest-api/src>
[INFO] Will search files to update from root <http://ci.chorem.org/jenkins/job/pollen-nightly/ws/trunk/pollen-rest-api/ta…>
[INFO] - adding license header on file <http://ci.chorem.org/jenkins/job/pollen-nightly/ws/trunk/pollen-rest-api/sr…>
[INFO] - adding license header on file <http://ci.chorem.org/jenkins/job/pollen-nightly/ws/trunk/pollen-rest-api/sr…>
[INFO] - adding license header on file <http://ci.chorem.org/jenkins/job/pollen-nightly/ws/trunk/pollen-rest-api/sr…>
[INFO] - adding license header on file <http://ci.chorem.org/jenkins/job/pollen-nightly/ws/trunk/pollen-rest-api/sr…>
[INFO] - adding license header on file <http://ci.chorem.org/jenkins/job/pollen-nightly/ws/trunk/pollen-rest-api/sr…>
[INFO] - adding license header on file <http://ci.chorem.org/jenkins/job/pollen-nightly/ws/trunk/pollen-rest-api/ta…>
[INFO] - adding license header on file <http://ci.chorem.org/jenkins/job/pollen-nightly/ws/trunk/pollen-rest-api/ta…>
[INFO] - adding license header on file <http://ci.chorem.org/jenkins/job/pollen-nightly/ws/trunk/pollen-rest-api/ta…>
[INFO] Scan 34 files header done in 181.982ms.
[INFO]
* uptodate header on 26 files.
* add header on 8 files.
[INFO]
[INFO] --- maven-compiler-plugin:3.1:compile (default-compile) @ pollen-rest-api ---
[INFO] Compiling 20 source files to <http://ci.chorem.org/jenkins/job/pollen-nightly/ws/trunk/pollen-rest-api/ta…>
[WARNING] <http://ci.chorem.org/jenkins/job/pollen-nightly/ws/trunk/pollen-rest-api/sr…>:[304,35] getNullValue(java.lang.Class<?>) in org.nuiton.util.ObjectUtil has been deprecated
[WARNING] <http://ci.chorem.org/jenkins/job/pollen-nightly/ws/trunk/pollen-rest-api/sr…>: Some input files use unchecked or unsafe operations.
[WARNING] <http://ci.chorem.org/jenkins/job/pollen-nightly/ws/trunk/pollen-rest-api/sr…>: Recompile with -Xlint:unchecked for details.
[INFO]
[INFO] --- animal-sniffer-maven-plugin:1.10:check (default) @ pollen-rest-api ---
[INFO] Checking unresolved references to org.codehaus.mojo.signature:java17:1.0
[INFO]
[INFO] --- jredmine-maven-plugin:1.8.1:generate-changes (jredmine-generate-changes) @ pollen-rest-api ---
[INFO] Skipping goal (skipGenerateChanges flag is on).
[INFO]
[INFO] --- maven-antrun-plugin:1.7:run (generate-surefire-workdir) @ pollen-rest-api ---
[INFO] Executing tasks
main:
[mkdir] Created dir: <http://ci.chorem.org/jenkins/job/pollen-nightly/ws/trunk/pollen-rest-api/ta…>
[INFO] Executed tasks
[INFO]
[INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) @ pollen-rest-api ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 1 resource
[INFO]
[INFO] --- maven-compiler-plugin:3.1:testCompile (default-testCompile) @ pollen-rest-api ---
[INFO] Compiling 5 source files to <http://ci.chorem.org/jenkins/job/pollen-nightly/ws/trunk/pollen-rest-api/ta…>
[INFO] -------------------------------------------------------------
[ERROR] COMPILATION ERROR :
[INFO] -------------------------------------------------------------
[ERROR] <http://ci.chorem.org/jenkins/job/pollen-nightly/ws/trunk/pollen-rest-api/sr…>:[38,9] cannot find symbol
symbol: class TopiaEntityList
location: class org.chorem.pollen.rest.api.TopiaEntityArrayConverterTest
[ERROR] <http://ci.chorem.org/jenkins/job/pollen-nightly/ws/trunk/pollen-rest-api/sr…>:[38,61] cannot find symbol
symbol: class TopiaEntityList
location: class org.chorem.pollen.rest.api.TopiaEntityArrayConverterTest
[INFO] 2 errors
[INFO] -------------------------------------------------------------
[JENKINS] Archiving disabled
[JENKINS] Archiving disabled
[JENKINS] Archiving disabled
[JENKINS] Archiving disabled
[JENKINS] Archiving disabled
[JENKINS] Archiving disabled
[JENKINS] Archiving disabled
[JENKINS] Archiving disabled
[JENKINS] Archiving disabled
[JENKINS] Archiving disabled
[JENKINS] Archiving disabled
[JENKINS] Archiving disabled
[JENKINS] Archiving disabled
[JENKINS] Archiving disabled
[JENKINS] Archiving disabled
[JENKINS] Archiving disabled
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary:
[INFO]
[INFO] Pollen ............................................ SUCCESS [ 6.663 s]
[INFO] Pollen :: VoteCounting (Api) ...................... SUCCESS [ 10.737 s]
[INFO] Pollen :: VoteCounting :: Normal .................. SUCCESS [ 4.342 s]
[INFO] Pollen :: VoteCounting :: Percentage .............. SUCCESS [ 3.954 s]
[INFO] Pollen :: VoteCounting :: Condorcet ............... SUCCESS [ 3.763 s]
[INFO] Pollen :: VoteCounting :: Number .................. SUCCESS [ 4.634 s]
[INFO] Pollen :: VoteCounting :: Borda ................... SUCCESS [ 3.684 s]
[INFO] Pollen :: VoteCounting :: Instant Runoff .......... SUCCESS [ 6.921 s]
[INFO] Pollen :: VoteCounting :: Coombs .................. SUCCESS [ 5.324 s]
[INFO] Pollen :: VoteCounting (Aggregator) ............... SUCCESS [ 1.574 s]
[INFO] Pollen :: Persistence ............................. SUCCESS [ 17.950 s]
[INFO] Pollen :: Service ................................. SUCCESS [ 16.993 s]
[INFO] Pollen :: Rest Api ................................ FAILURE [ 23.674 s]
[INFO] Pollen :: UI (CanJS) .............................. SKIPPED
[INFO] Pollen :: UI (Angular) ............................ SKIPPED
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 01:53 min
[INFO] Finished at: 2014-05-08T01:02:38+01:00
[INFO] Final Memory: 153M/615M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1:testCompile (default-testCompile) on project pollen-rest-api: Compilation failure: Compilation failure:
[ERROR] <http://ci.chorem.org/jenkins/job/pollen-nightly/ws/trunk/pollen-rest-api/sr…>:[38,9] cannot find symbol
[ERROR] symbol: class TopiaEntityList
[ERROR] location: class org.chorem.pollen.rest.api.TopiaEntityArrayConverterTest
[ERROR] <http://ci.chorem.org/jenkins/job/pollen-nightly/ws/trunk/pollen-rest-api/sr…>:[38,61] cannot find symbol
[ERROR] symbol: class TopiaEntityList
[ERROR] location: class org.chorem.pollen.rest.api.TopiaEntityArrayConverterTest
[ERROR] -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1:testCompile (default-testCompile) on project pollen-rest-api: Compilation failure
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:212)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:108)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:76)
at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:51)
at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:116)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:361)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:155)
at org.jvnet.hudson.maven3.launcher.Maven31Launcher.main(Maven31Launcher.java:132)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at org.codehaus.plexus.classworlds.launcher.Launcher.launchStandard(Launcher.java:330)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:238)
at jenkins.maven3.agent.Maven31Main.launch(Maven31Main.java:181)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at hudson.maven.Maven3Builder.call(Maven3Builder.java:134)
at hudson.maven.Maven3Builder.call(Maven3Builder.java:69)
at hudson.remoting.UserRequest.perform(UserRequest.java:118)
at hudson.remoting.UserRequest.perform(UserRequest.java:48)
at hudson.remoting.Request$2.run(Request.java:328)
at hudson.remoting.InterceptingExecutorService$1.call(InterceptingExecutorService.java:72)
at java.util.concurrent.FutureTask.run(FutureTask.java:262)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:745)
Caused by: org.apache.maven.plugin.compiler.CompilationFailureException: Compilation failure
at org.apache.maven.plugin.compiler.AbstractCompilerMojo.execute(AbstractCompilerMojo.java:858)
at org.apache.maven.plugin.compiler.TestCompilerMojo.execute(TestCompilerMojo.java:152)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:133)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:208)
... 30 more
[ERROR]
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException
[ERROR]
[ERROR] After correcting the problems, you can resume the build with the command
[ERROR] mvn <goals> -rf :pollen-rest-api
Sending e-mails to: pollen-commits(a)list.chorem.org chemit+chorem-ci(a)codelutin.com
channel stopped
Skipping sonar analysis due to bad build status FAILURE
Failed to send e-mail to garandel because no e-mail address is known, and no default e-mail domain is configured
1
4
Jenkins build is back to normal : pollen-nightly » Pollen :: Rest Api #25
by admin+ci-chorem.org@codelutin.com 13 May '14
by admin+ci-chorem.org@codelutin.com 13 May '14
13 May '14
Build failed in Jenkins: pollen-nightly » Pollen :: Service #22
by admin+ci-chorem.org@codelutin.com 13 May '14
by admin+ci-chorem.org@codelutin.com 13 May '14
13 May '14
See <http://ci.chorem.org/jenkins/job/pollen-nightly/org.chorem.pollen$pollen-se…>
Changes:
[Tony CHEMIT] - use a visitor to copy services objects (outside the services everything should be transient)
- review validation (to avoir multiple redundant codes)
------------------------------------------
[...truncated 154 lines...]
*:readChoice:org.chorem.pollen.persistence.entity.Choice_17b06330-cafc-4c6e-8812-da9be128abc1
*:readChoice:org.chorem.pollen.persistence.entity.Choice_fa335e47-b8b9-4328-9a6f-eed2d689bebc
*:readPoll:org.chorem.pollen.persistence.entity.Poll_700584dc-f2b9-4318-a638-330f8207192c
01:02:37 INFO (SecurityService.java:209) Check permission: :readPoll:org.chorem.pollen.persistence.entity.Poll_2ba68085-25aa-4e1e-86ab-2c946bde5b68
01:02:37 INFO (SecurityService.java:209) Check permission: :editPoll:org.chorem.pollen.persistence.entity.Poll_2ba68085-25aa-4e1e-86ab-2c946bde5b68
01:02:37 INFO (SecurityService.java:209) Check permission: :readPoll:org.chorem.pollen.persistence.entity.Poll_2ba68085-25aa-4e1e-86ab-2c946bde5b68
01:02:37 INFO (SecurityService.java:209) Check permission: :editPoll:org.chorem.pollen.persistence.entity.Poll_2ba68085-25aa-4e1e-86ab-2c946bde5b68
01:02:37 INFO (SecurityService.java:209) Check permission: :readChoice:org.chorem.pollen.persistence.entity.Choice_d933a8bd-e0c8-40e7-8b35-ee9499c76ba4
01:02:37 INFO (SecurityService.java:209) Check permission: :readPoll:org.chorem.pollen.persistence.entity.Poll_2ba68085-25aa-4e1e-86ab-2c946bde5b68
01:02:37 INFO (SecurityService.java:209) Check permission: :editPoll:org.chorem.pollen.persistence.entity.Poll_2ba68085-25aa-4e1e-86ab-2c946bde5b68
01:02:38 INFO (SecurityService.java:209) Check permission: :readChoice:org.chorem.pollen.persistence.entity.Choice_17b06330-cafc-4c6e-8812-da9be128abc1
01:02:38 INFO (SecurityService.java:209) Check permission: :readPoll:org.chorem.pollen.persistence.entity.Poll_2ba68085-25aa-4e1e-86ab-2c946bde5b68
01:02:38 INFO (SecurityService.java:209) Check permission: :editPoll:org.chorem.pollen.persistence.entity.Poll_2ba68085-25aa-4e1e-86ab-2c946bde5b68
01:02:38 DEBUG (FakePollenApplicationContext.java:94) Using port: 10001
01:02:38 DEBUG (FakePollenApplicationContext.java:105) testBasedir: <http://ci.chorem.org/jenkins/job/pollen-nightly/org.chorem.pollen$pollen-se…>
01:02:38 INFO (PollenServiceConfig.java:89) Pollen configuration:
Filename: pollen-services.properties
pollen.data.directory = <http://ci.chorem.org/jenkins/job/pollen-nightly/org.chorem.pollen$pollen-se…>
pollen.default.pollType = FREE
pollen.default.voteCountingType = 1
pollen.default.pollVoteVisibility = EVERYBODY
pollen.default.pollCommentVisibility = EVERYBODY
pollen.default.pollChoiceType = TEXT
pollen.smtp.host =
pollen.smtp.port = 25
pollen.smtp.from =
pollen.devMode = true
logConfigurationFile = null
01:02:38 INFO (FixturesService.java:77) will restore database with fixture set
01:02:38 INFO (SecurityService.java:240) All permissions:
*:readChoice:org.chorem.pollen.persistence.entity.Choice_eb7c37df-9ed9-42af-96e9-f65d364c248f
*:readPoll:org.chorem.pollen.persistence.entity.Poll_21c51b56-f1b1-4d0f-b225-d12d7e47a9eb
*:readChoice:org.chorem.pollen.persistence.entity.Choice_4cee0c8f-a0a7-410f-922c-3981abd9d135
01:02:38 INFO (SecurityService.java:209) Check permission: :readPoll:org.chorem.pollen.persistence.entity.Poll_e1c9f122-487d-4e06-bbca-99980e058c44
01:02:38 INFO (SecurityService.java:240) All permissions:
*:*:org.chorem.pollen.persistence.entity.Choice_1c9160a3-f3de-4f67-8abf-91c949e0309f
*:readChoice:org.chorem.pollen.persistence.entity.Choice_eb7c37df-9ed9-42af-96e9-f65d364c248f
*:readPoll:org.chorem.pollen.persistence.entity.Poll_21c51b56-f1b1-4d0f-b225-d12d7e47a9eb
*:readChoice:org.chorem.pollen.persistence.entity.Choice_4cee0c8f-a0a7-410f-922c-3981abd9d135
*:*:org.chorem.pollen.persistence.entity.Choice_fcc8a325-7016-408a-b86f-92d50ddaf908
*:*:org.chorem.pollen.persistence.entity.Poll_e1c9f122-487d-4e06-bbca-99980e058c44
01:02:38 INFO (SecurityService.java:209) Check permission: :readPoll:org.chorem.pollen.persistence.entity.Poll_e1c9f122-487d-4e06-bbca-99980e058c44
01:02:38 INFO (SecurityService.java:209) Check permission: :editPoll:org.chorem.pollen.persistence.entity.Poll_e1c9f122-487d-4e06-bbca-99980e058c44
01:02:38 INFO (SecurityService.java:209) Check permission: :readPoll:org.chorem.pollen.persistence.entity.Poll_e1c9f122-487d-4e06-bbca-99980e058c44
01:02:38 INFO (SecurityService.java:209) Check permission: :editPoll:org.chorem.pollen.persistence.entity.Poll_e1c9f122-487d-4e06-bbca-99980e058c44
01:02:38 INFO (SecurityService.java:209) Check permission: :readChoice:org.chorem.pollen.persistence.entity.Choice_1c9160a3-f3de-4f67-8abf-91c949e0309f
01:02:38 INFO (SecurityService.java:209) Check permission: :readPoll:org.chorem.pollen.persistence.entity.Poll_e1c9f122-487d-4e06-bbca-99980e058c44
01:02:38 INFO (SecurityService.java:209) Check permission: :editPoll:org.chorem.pollen.persistence.entity.Poll_e1c9f122-487d-4e06-bbca-99980e058c44
01:02:38 INFO (SecurityService.java:209) Check permission: :readChoice:org.chorem.pollen.persistence.entity.Choice_fcc8a325-7016-408a-b86f-92d50ddaf908
01:02:38 INFO (SecurityService.java:209) Check permission: :readPoll:org.chorem.pollen.persistence.entity.Poll_e1c9f122-487d-4e06-bbca-99980e058c44
01:02:38 INFO (SecurityService.java:209) Check permission: :editPoll:org.chorem.pollen.persistence.entity.Poll_e1c9f122-487d-4e06-bbca-99980e058c44
01:02:38 INFO (SecurityService.java:209) Check permission: :readPoll:org.chorem.pollen.persistence.entity.Poll_e1c9f122-487d-4e06-bbca-99980e058c44
01:02:38 INFO (SecurityService.java:209) Check permission: :editPoll:org.chorem.pollen.persistence.entity.Poll_e1c9f122-487d-4e06-bbca-99980e058c44
01:02:38 INFO (SecurityService.java:209) Check permission: :readPoll:org.chorem.pollen.persistence.entity.Poll_e1c9f122-487d-4e06-bbca-99980e058c44
01:02:38 INFO (SecurityService.java:209) Check permission: :editPoll:org.chorem.pollen.persistence.entity.Poll_e1c9f122-487d-4e06-bbca-99980e058c44
01:02:38 DEBUG (FakePollenApplicationContext.java:94) Using port: 10002
01:02:38 DEBUG (FakePollenApplicationContext.java:105) testBasedir: <http://ci.chorem.org/jenkins/job/pollen-nightly/org.chorem.pollen$pollen-se…>
01:02:38 INFO (PollenServiceConfig.java:89) Pollen configuration:
Filename: pollen-services.properties
pollen.data.directory = <http://ci.chorem.org/jenkins/job/pollen-nightly/org.chorem.pollen$pollen-se…>
pollen.default.pollType = FREE
pollen.default.voteCountingType = 1
pollen.default.pollVoteVisibility = EVERYBODY
pollen.default.pollCommentVisibility = EVERYBODY
pollen.default.pollChoiceType = TEXT
pollen.smtp.host =
pollen.smtp.port = 25
pollen.smtp.from =
pollen.devMode = true
logConfigurationFile = null
01:02:39 INFO (FixturesService.java:77) will restore database with fixture set
01:02:39 INFO (SecurityService.java:240) All permissions:
*:readPoll:org.chorem.pollen.persistence.entity.Poll_71fcf3a0-382f-409d-9a49-0a2627e66a7e
*:readChoice:org.chorem.pollen.persistence.entity.Choice_c1d7692d-5cde-40ba-bafd-b49d39a5d88e
*:readChoice:org.chorem.pollen.persistence.entity.Choice_20f2136d-147a-42da-b3e2-c3d69a0e9f4d
01:02:39 INFO (SecurityService.java:209) Check permission: :readPoll:org.chorem.pollen.persistence.entity.Poll_a1d7eb10-0478-43c9-aa9a-8e9bddfd4437
01:02:39 INFO (SecurityService.java:240) All permissions:
*:readPoll:org.chorem.pollen.persistence.entity.Poll_71fcf3a0-382f-409d-9a49-0a2627e66a7e
*:readChoice:org.chorem.pollen.persistence.entity.Choice_c1d7692d-5cde-40ba-bafd-b49d39a5d88e
*:*:org.chorem.pollen.persistence.entity.Choice_b383c4f8-7d4e-449b-8188-d283527a58ab
*:*:org.chorem.pollen.persistence.entity.Choice_23beec40-d279-474d-976e-4465e7371e91
*:readChoice:org.chorem.pollen.persistence.entity.Choice_20f2136d-147a-42da-b3e2-c3d69a0e9f4d
*:*:org.chorem.pollen.persistence.entity.Poll_a1d7eb10-0478-43c9-aa9a-8e9bddfd4437
01:02:39 INFO (SecurityService.java:209) Check permission: :readPoll:org.chorem.pollen.persistence.entity.Poll_a1d7eb10-0478-43c9-aa9a-8e9bddfd4437
01:02:39 INFO (SecurityService.java:209) Check permission: :editPoll:org.chorem.pollen.persistence.entity.Poll_a1d7eb10-0478-43c9-aa9a-8e9bddfd4437
01:02:39 INFO (SecurityService.java:209) Check permission: :readPoll:org.chorem.pollen.persistence.entity.Poll_a1d7eb10-0478-43c9-aa9a-8e9bddfd4437
01:02:39 INFO (SecurityService.java:209) Check permission: :editPoll:org.chorem.pollen.persistence.entity.Poll_a1d7eb10-0478-43c9-aa9a-8e9bddfd4437
01:02:39 INFO (SecurityService.java:209) Check permission: :readChoice:org.chorem.pollen.persistence.entity.Choice_b383c4f8-7d4e-449b-8188-d283527a58ab
01:02:39 INFO (SecurityService.java:209) Check permission: :readPoll:org.chorem.pollen.persistence.entity.Poll_a1d7eb10-0478-43c9-aa9a-8e9bddfd4437
01:02:39 INFO (SecurityService.java:209) Check permission: :editPoll:org.chorem.pollen.persistence.entity.Poll_a1d7eb10-0478-43c9-aa9a-8e9bddfd4437
01:02:39 INFO (SecurityService.java:209) Check permission: :readChoice:org.chorem.pollen.persistence.entity.Choice_23beec40-d279-474d-976e-4465e7371e91
01:02:39 INFO (SecurityService.java:209) Check permission: :readPoll:org.chorem.pollen.persistence.entity.Poll_a1d7eb10-0478-43c9-aa9a-8e9bddfd4437
01:02:39 INFO (SecurityService.java:209) Check permission: :editPoll:org.chorem.pollen.persistence.entity.Poll_a1d7eb10-0478-43c9-aa9a-8e9bddfd4437
01:02:39 INFO (SecurityService.java:209) Check permission: :readPoll:org.chorem.pollen.persistence.entity.Poll_a1d7eb10-0478-43c9-aa9a-8e9bddfd4437
01:02:39 INFO (SecurityService.java:209) Check permission: :editPoll:org.chorem.pollen.persistence.entity.Poll_a1d7eb10-0478-43c9-aa9a-8e9bddfd4437
01:02:39 INFO (SecurityService.java:209) Check permission: :readPoll:org.chorem.pollen.persistence.entity.Poll_a1d7eb10-0478-43c9-aa9a-8e9bddfd4437
01:02:39 INFO (SecurityService.java:209) Check permission: :editPoll:org.chorem.pollen.persistence.entity.Poll_a1d7eb10-0478-43c9-aa9a-8e9bddfd4437
Tests run: 4, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 5.956 sec - in org.chorem.pollen.service.PollServiceTest
Running org.chorem.pollen.service.PollenUserServiceTest
01:02:39 DEBUG (FakePollenApplicationContext.java:94) Using port: 10003
01:02:39 DEBUG (FakePollenApplicationContext.java:105) testBasedir: <http://ci.chorem.org/jenkins/job/pollen-nightly/org.chorem.pollen$pollen-se…>
01:02:39 INFO (PollenServiceConfig.java:89) Pollen configuration:
Filename: pollen-services.properties
pollen.data.directory = <http://ci.chorem.org/jenkins/job/pollen-nightly/org.chorem.pollen$pollen-se…>
pollen.default.pollType = FREE
pollen.default.voteCountingType = 1
pollen.default.pollVoteVisibility = EVERYBODY
pollen.default.pollCommentVisibility = EVERYBODY
pollen.default.pollChoiceType = TEXT
pollen.smtp.host =
pollen.smtp.port = 25
pollen.smtp.from =
pollen.devMode = true
logConfigurationFile = null
01:02:39 INFO (FixturesService.java:77) will restore database with fixture set
01:02:40 DEBUG (FakePollenApplicationContext.java:94) Using port: 10004
01:02:40 DEBUG (FakePollenApplicationContext.java:105) testBasedir: <http://ci.chorem.org/jenkins/job/pollen-nightly/org.chorem.pollen$pollen-se…>
01:02:40 INFO (PollenServiceConfig.java:89) Pollen configuration:
Filename: pollen-services.properties
pollen.data.directory = <http://ci.chorem.org/jenkins/job/pollen-nightly/org.chorem.pollen$pollen-se…>
pollen.default.pollType = FREE
pollen.default.voteCountingType = 1
pollen.default.pollVoteVisibility = EVERYBODY
pollen.default.pollCommentVisibility = EVERYBODY
pollen.default.pollChoiceType = TEXT
pollen.smtp.host =
pollen.smtp.port = 25
pollen.smtp.from =
pollen.devMode = true
logConfigurationFile = null
01:02:40 INFO (FixturesService.java:77) will restore database with fixture set
01:02:40 DEBUG (FakePollenApplicationContext.java:94) Using port: 10005
01:02:40 DEBUG (FakePollenApplicationContext.java:105) testBasedir: <http://ci.chorem.org/jenkins/job/pollen-nightly/org.chorem.pollen$pollen-se…>
01:02:40 INFO (PollenServiceConfig.java:89) Pollen configuration:
Filename: pollen-services.properties
pollen.data.directory = <http://ci.chorem.org/jenkins/job/pollen-nightly/org.chorem.pollen$pollen-se…>
pollen.default.pollType = FREE
pollen.default.voteCountingType = 1
pollen.default.pollVoteVisibility = EVERYBODY
pollen.default.pollCommentVisibility = EVERYBODY
pollen.default.pollChoiceType = TEXT
pollen.smtp.host =
pollen.smtp.port = 25
pollen.smtp.from =
pollen.devMode = true
logConfigurationFile = null
01:02:40 INFO (FixturesService.java:77) will restore database with fixture set
01:02:40 DEBUG (FakePollenApplicationContext.java:94) Using port: 10006
01:02:40 DEBUG (FakePollenApplicationContext.java:105) testBasedir: <http://ci.chorem.org/jenkins/job/pollen-nightly/org.chorem.pollen$pollen-se…>
01:02:40 INFO (PollenServiceConfig.java:89) Pollen configuration:
Filename: pollen-services.properties
pollen.data.directory = <http://ci.chorem.org/jenkins/job/pollen-nightly/org.chorem.pollen$pollen-se…>
pollen.default.pollType = FREE
pollen.default.voteCountingType = 1
pollen.default.pollVoteVisibility = EVERYBODY
pollen.default.pollCommentVisibility = EVERYBODY
pollen.default.pollChoiceType = TEXT
pollen.smtp.host =
pollen.smtp.port = 25
pollen.smtp.from =
pollen.devMode = true
logConfigurationFile = null
01:02:41 INFO (FixturesService.java:77) will restore database with fixture set
01:02:41 DEBUG (FakePollenApplicationContext.java:94) Using port: 10007
01:02:41 DEBUG (FakePollenApplicationContext.java:105) testBasedir: <http://ci.chorem.org/jenkins/job/pollen-nightly/org.chorem.pollen$pollen-se…>
01:02:41 INFO (PollenServiceConfig.java:89) Pollen configuration:
Filename: pollen-services.properties
pollen.data.directory = <http://ci.chorem.org/jenkins/job/pollen-nightly/org.chorem.pollen$pollen-se…>
pollen.default.pollType = FREE
pollen.default.voteCountingType = 1
pollen.default.pollVoteVisibility = EVERYBODY
pollen.default.pollCommentVisibility = EVERYBODY
pollen.default.pollChoiceType = TEXT
pollen.smtp.host =
pollen.smtp.port = 25
pollen.smtp.from =
pollen.devMode = true
logConfigurationFile = null
01:02:41 INFO (FixturesService.java:77) will restore database with fixture set
Tests run: 5, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 2.529 sec - in org.chorem.pollen.service.PollenUserServiceTest
Results :
Tests run: 9, Failures: 0, Errors: 0, Skipped: 0
[JENKINS] Recording test results
[INFO]
[INFO] --- maven-jar-plugin:2.4:jar (default-jar) @ pollen-services ---
[INFO] Building jar: <http://ci.chorem.org/jenkins/job/pollen-nightly/org.chorem.pollen$pollen-se…>
[INFO]
[INFO] >>> maven-source-plugin:2.2.1:jar (attach-sources) @ pollen-services >>>
[INFO]
[INFO] --- maven-enforcer-plugin:1.3.1:enforce (ensure-no-container-api) @ pollen-services ---
[INFO]
[INFO] --- maven-enforcer-plugin:1.3.1:enforce (check-project-files) @ pollen-services ---
[INFO]
[INFO] --- helper-maven-plugin:2.1:share-server-secret (get-redmine-login) @ pollen-services ---
[INFO] Skipping goal (runOnce flag is on and goal was already executed).
[WARNING] Failed to getClass for org.apache.maven.plugin.source.SourceJarMojo
[INFO]
[INFO] <<< maven-source-plugin:2.2.1:jar (attach-sources) @ pollen-services <<<
[INFO]
[INFO] --- maven-source-plugin:2.2.1:jar (attach-sources) @ pollen-services ---
[INFO] Building jar: <http://ci.chorem.org/jenkins/job/pollen-nightly/org.chorem.pollen$pollen-se…>
[INFO]
[INFO] --- maven-javadoc-plugin:2.9.1:jar (attach-javadocs) @ pollen-services ---
[INFO] Building jar: <http://ci.chorem.org/jenkins/job/pollen-nightly/org.chorem.pollen$pollen-se…>
[INFO]
[INFO] --- maven-site-plugin:3.3:attach-descriptor (attach-descriptor) @ pollen-services ---
[INFO]
[INFO] --- helper-maven-plugin:2.1:share-server-secret (get-pgp-passphrase) @ pollen-services ---
[INFO] Exporting server [gpg-signer] username in ${gpg.keyname}
[INFO] Exporting server [gpg-signer] password in ${gpg.passphrase}
[INFO]
[INFO] --- helper-maven-plugin:2.1:collect-files (collect-build-artifacts) @ pollen-services ---
[INFO] Loaded /var/local/forge/data/chorem.org/jenkins/workspace/pollen-nightly/trunk/target/collect-artifacts.txt
[INFO] Copying pollen-services-2.0-SNAPSHOT.jar to /var/local/forge/data/chorem.org/jenkins/workspace/pollen-nightly/trunk/target/collect/org.chorem.pollen--pollen-services/pollen-services-2.0-SNAPSHOT.jar
[INFO] Copying THIRD-PARTY.properties to /var/local/forge/data/chorem.org/jenkins/workspace/pollen-nightly/trunk/target/collect/org.chorem.pollen--pollen-services/THIRD-PARTY.properties
[INFO] Copying pollen-services-2.0-SNAPSHOT-sources.jar to /var/local/forge/data/chorem.org/jenkins/workspace/pollen-nightly/trunk/target/collect/org.chorem.pollen--pollen-services/pollen-services-2.0-SNAPSHOT-sources.jar
[INFO] Copying pollen-services-2.0-SNAPSHOT-javadoc.jar to /var/local/forge/data/chorem.org/jenkins/workspace/pollen-nightly/trunk/target/collect/org.chorem.pollen--pollen-services/pollen-services-2.0-SNAPSHOT-javadoc.jar
[INFO]
[INFO] --- helper-maven-plugin:2.1:collect-files (collect-build-attachements) @ pollen-services ---
[WARNING] Skipping goal (No file to collect).
[INFO]
[INFO] --- maven-gpg-plugin:1.5:sign (sign-artifacts) @ pollen-services ---
[INFO]
[INFO] --- maven-dependency-plugin:2.8:analyze-only (analyze) @ pollen-services ---
[INFO] Used declared dependencies found:
[INFO] org.chorem.pollen:pollen-persistence:jar:2.0-SNAPSHOT:compile
[INFO] org.nuiton.topia:topia-persistence:jar:3.0-SNAPSHOT:compile
[INFO] org.nuiton.topia:topia-junit:jar:3.0-SNAPSHOT:compile
[INFO] org.hibernate:hibernate-core:jar:4.3.5.Final:runtime
[INFO] com.esotericsoftware.yamlbeans:yamlbeans:jar:1.06:compile
[INFO] org.apache.commons:commons-email:jar:1.3.2:compile
[INFO] com.github.spullara.mustache.java:compiler:jar:0.8.13:compile
[INFO] commons-logging:commons-logging:jar:1.1.3:compile
[INFO] org.apache.commons:commons-collections4:jar:4.0:compile
[INFO] commons-io:commons-io:jar:2.4:compile
[INFO] org.apache.commons:commons-lang3:jar:3.3.2:compile
[INFO] commons-codec:commons-codec:jar:1.9:compile
[INFO] com.google.guava:guava:jar:16.0.1:compile
[INFO] junit:junit:jar:4.11:provided
[INFO] org.nuiton.i18n:nuiton-i18n:jar:3.0:compile
[INFO] org.nuiton:nuiton-utils:jar:2.7.1:compile
[INFO] org.nuiton:nuiton-config:jar:3.0-alpha-2:compile
[INFO] org.apache.shiro:shiro-core:jar:1.2.2:compile
[WARNING] Used undeclared dependencies found:
[WARNING] commons-beanutils:commons-beanutils:jar:1.9.1:compile
[JENKINS] Archiving disabled
1
3
Author: tchemit
Date: 2014-05-14 00:58:53 +0200 (Wed, 14 May 2014)
New Revision: 3940
Url: http://forge.chorem.org/projects/pollen/repository/revisions/3940
Log:
optimize dependencies
Modified:
trunk/pollen-rest-api/pom.xml
trunk/pollen-services/pom.xml
Modified: trunk/pollen-rest-api/pom.xml
===================================================================
--- trunk/pollen-rest-api/pom.xml 2014-05-13 22:45:45 UTC (rev 3939)
+++ trunk/pollen-rest-api/pom.xml 2014-05-13 22:58:53 UTC (rev 3940)
@@ -94,6 +94,10 @@
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
</dependency>
+ <dependency>
+ <groupId>org.apache.commons</groupId>
+ <artifactId>commons-lang3</artifactId>
+ </dependency>
<dependency>
<groupId>org.apache.httpcomponents</groupId>
Modified: trunk/pollen-services/pom.xml
===================================================================
--- trunk/pollen-services/pom.xml 2014-05-13 22:45:45 UTC (rev 3939)
+++ trunk/pollen-services/pom.xml 2014-05-13 22:58:53 UTC (rev 3940)
@@ -70,6 +70,10 @@
<artifactId>commons-io</artifactId>
</dependency>
<dependency>
+ <groupId>commons-beanutils</groupId>
+ <artifactId>commons-beanutils</artifactId>
+ </dependency>
+ <dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
</dependency>
1
0
r3939 - trunk/pollen-rest-api/src/main/java/org/chorem/pollen/rest/api
by tchemit@users.chorem.org 13 May '14
by tchemit@users.chorem.org 13 May '14
13 May '14
Author: tchemit
Date: 2014-05-14 00:45:45 +0200 (Wed, 14 May 2014)
New Revision: 3939
Url: http://forge.chorem.org/projects/pollen/repository/revisions/3939
Log:
implements CORS response from pollen not webmotion
Modified:
trunk/pollen-rest-api/src/main/java/org/chorem/pollen/rest/api/PollenRestApiRequestFilter.java
trunk/pollen-rest-api/src/main/java/org/chorem/pollen/rest/api/RequestResponses.java
Modified: trunk/pollen-rest-api/src/main/java/org/chorem/pollen/rest/api/PollenRestApiRequestFilter.java
===================================================================
--- trunk/pollen-rest-api/src/main/java/org/chorem/pollen/rest/api/PollenRestApiRequestFilter.java 2014-05-13 14:27:12 UTC (rev 3938)
+++ trunk/pollen-rest-api/src/main/java/org/chorem/pollen/rest/api/PollenRestApiRequestFilter.java 2014-05-13 22:45:45 UTC (rev 3939)
@@ -31,9 +31,13 @@
import org.chorem.pollen.services.service.security.PollenSecurityContext;
import org.chorem.pollen.services.service.security.SecurityService;
import org.debux.webmotion.server.WebMotionFilter;
+import org.debux.webmotion.server.call.Call;
import org.debux.webmotion.server.call.CookieManager;
import org.debux.webmotion.server.call.HttpContext;
+import org.debux.webmotion.server.render.Render;
+import org.debux.webmotion.server.render.RenderStatus;
+import javax.servlet.http.HttpServletResponse;
import java.util.Locale;
import java.util.Map;
@@ -47,12 +51,26 @@
public static final String REQUEST_PERMISSION_PARAMETER = "permission";
- public void inject(HttpContext context) throws PollenInvalidSessionTokenException {
+ public void inject(Call call, HttpContext context) throws PollenInvalidSessionTokenException {
PollenRestApiRequestContext requestContext = prepareRequestContext(context);
doProcess();
+ if (HttpContext.METHOD_OPTIONS.equals(context.getMethod())) {
+
+ Render render = call.getRender();
+
+ if (render instanceof RenderStatus &&
+ HttpServletResponse.SC_OK == ((RenderStatus) render).getCode()) {
+
+ // operation accepted
+ RequestResponses.addOptionCorsHeaders(context);
+
+ }
+
+ }
+
RequestResponses.prepareResponse(context, requestContext);
}
Modified: trunk/pollen-rest-api/src/main/java/org/chorem/pollen/rest/api/RequestResponses.java
===================================================================
--- trunk/pollen-rest-api/src/main/java/org/chorem/pollen/rest/api/RequestResponses.java 2014-05-13 14:27:12 UTC (rev 3938)
+++ trunk/pollen-rest-api/src/main/java/org/chorem/pollen/rest/api/RequestResponses.java 2014-05-13 22:45:45 UTC (rev 3939)
@@ -1,5 +1,6 @@
package org.chorem.pollen.rest.api;
+import org.apache.commons.lang3.StringUtils;
import org.chorem.pollen.persistence.entity.SessionToken;
import org.chorem.pollen.services.service.security.PollenSecurityContext;
import org.debux.webmotion.server.call.CookieManager;
@@ -17,6 +18,10 @@
public static final String COOKIE_USER_SESSION = "userSession";
+ public static final String HEADER_ACCESS_CONTROL_REQUEST_HEADERS = "Access-Control-Request-Headers";
+
+ public static final String HEADER_ACCESS_CONTROL_ALLOW_HEADERS = "Access-Control-Allow-Headers";
+
public static void prepareResponse(HttpContext context) {
PollenRestApiRequestContext requestContext = PollenRestApiRequestContext.getRequestContext(context);
@@ -48,4 +53,12 @@
}
+ public static void addOptionCorsHeaders(HttpContext context) {
+
+ String requestHeaders = context.getHeader(HEADER_ACCESS_CONTROL_REQUEST_HEADERS);
+
+ if (StringUtils.isNotBlank(requestHeaders)) {
+ context.getResponse().addHeader(HEADER_ACCESS_CONTROL_ALLOW_HEADERS, requestHeaders);
+ }
+ }
}
1
0
r3938 - in trunk/pollen-rest-api/src/main/java/org/chorem/pollen/rest/api: . v1
by tchemit@users.chorem.org 13 May '14
by tchemit@users.chorem.org 13 May '14
13 May '14
Author: tchemit
Date: 2014-05-13 16:27:12 +0200 (Tue, 13 May 2014)
New Revision: 3938
Url: http://forge.chorem.org/projects/pollen/repository/revisions/3938
Log:
always prepare response even if there was an error
Added:
trunk/pollen-rest-api/src/main/java/org/chorem/pollen/rest/api/RequestResponses.java
Modified:
trunk/pollen-rest-api/src/main/java/org/chorem/pollen/rest/api/PollenRestApiRequestFilter.java
trunk/pollen-rest-api/src/main/java/org/chorem/pollen/rest/api/v1/ErrorAction.java
Modified: trunk/pollen-rest-api/src/main/java/org/chorem/pollen/rest/api/PollenRestApiRequestFilter.java
===================================================================
--- trunk/pollen-rest-api/src/main/java/org/chorem/pollen/rest/api/PollenRestApiRequestFilter.java 2014-05-12 22:30:20 UTC (rev 3937)
+++ trunk/pollen-rest-api/src/main/java/org/chorem/pollen/rest/api/PollenRestApiRequestFilter.java 2014-05-13 14:27:12 UTC (rev 3938)
@@ -34,7 +34,6 @@
import org.debux.webmotion.server.call.CookieManager;
import org.debux.webmotion.server.call.HttpContext;
-import javax.servlet.http.HttpServletResponse;
import java.util.Locale;
import java.util.Map;
@@ -48,15 +47,13 @@
public static final String REQUEST_PERMISSION_PARAMETER = "permission";
- public static final String POLLEN_SESSION = "pollenSession";
-
public void inject(HttpContext context) throws PollenInvalidSessionTokenException {
PollenRestApiRequestContext requestContext = prepareRequestContext(context);
doProcess();
- prepareResponse(context, requestContext);
+ RequestResponses.prepareResponse(context, requestContext);
}
@@ -84,42 +81,17 @@
}
- protected void prepareResponse(HttpContext context, PollenRestApiRequestContext requestContext) {
-
- HttpServletResponse response = context.getResponse();
- response.addHeader(HttpContext.HEADER_ACCESS_CONTROL_ALLOW_ORIGIN, "*");
- response.addHeader(HttpContext.HEADER_ACCESS_CONTROL_ALLOW_CREDENTIALS, "true");
-
- CookieManager cookieManager = context.getCookieManager();
-
- PollenSecurityContext securityContext = requestContext.getSecurityContext();
- SessionToken sessionToken = securityContext.getSessionToken();
- if (sessionToken != null) {
-
- CookieManager.CookieEntity pollenSession = cookieManager.create(POLLEN_SESSION, sessionToken.getPollenToken().getToken());
- cookieManager.add(pollenSession);
-
- } else {
-
- cookieManager.remove(POLLEN_SESSION);
-
- }
-
- }
-
protected PollenSecurityContext createSecurityContext(HttpContext httpContext,
PollenRestApiApplicationContext applicationContext,
PollenRestApiRequestContext requestContext) throws PollenInvalidSessionTokenException {
-
SecurityService securityService = requestContext.getSecurityService();
// --- get session token (from cookie) --- //
- CookieManager.CookieEntity pollenSession = httpContext.getCookieManager().get(POLLEN_SESSION);
+ CookieManager.CookieEntity pollenSession = httpContext.getCookieManager().get(RequestResponses.COOKIE_USER_SESSION);
String authParam = pollenSession == null ? null : pollenSession.getValue();
SessionToken sessionToken = securityService.getSessionTokenByToken(authParam);
-
// --- get mainPrincipal (from request parameters) --- //
Map<String, String[]> parameters = httpContext.getParameters();
String[] strings = parameters.get(REQUEST_PERMISSION_PARAMETER);
Added: trunk/pollen-rest-api/src/main/java/org/chorem/pollen/rest/api/RequestResponses.java
===================================================================
--- trunk/pollen-rest-api/src/main/java/org/chorem/pollen/rest/api/RequestResponses.java (rev 0)
+++ trunk/pollen-rest-api/src/main/java/org/chorem/pollen/rest/api/RequestResponses.java 2014-05-13 14:27:12 UTC (rev 3938)
@@ -0,0 +1,51 @@
+package org.chorem.pollen.rest.api;
+
+import org.chorem.pollen.persistence.entity.SessionToken;
+import org.chorem.pollen.services.service.security.PollenSecurityContext;
+import org.debux.webmotion.server.call.CookieManager;
+import org.debux.webmotion.server.call.HttpContext;
+
+import javax.servlet.http.HttpServletResponse;
+
+/**
+ * Created on 5/13/14.
+ *
+ * @author Tony Chemit <chemit(a)codelutin.com>
+ * @since 2.0
+ */
+public class RequestResponses {
+
+ public static final String COOKIE_USER_SESSION = "userSession";
+
+ public static void prepareResponse(HttpContext context) {
+
+ PollenRestApiRequestContext requestContext = PollenRestApiRequestContext.getRequestContext(context);
+
+ prepareResponse(context, requestContext);
+
+ }
+
+ public static void prepareResponse(HttpContext context, PollenRestApiRequestContext requestContext) {
+
+ HttpServletResponse response = context.getResponse();
+ response.addHeader(HttpContext.HEADER_ACCESS_CONTROL_ALLOW_ORIGIN, "*");
+ response.addHeader(HttpContext.HEADER_ACCESS_CONTROL_ALLOW_CREDENTIALS, "true");
+
+ CookieManager cookieManager = context.getCookieManager();
+
+ PollenSecurityContext securityContext = requestContext.getSecurityContext();
+ SessionToken sessionToken = securityContext.getSessionToken();
+ if (sessionToken != null) {
+
+ CookieManager.CookieEntity pollenSession = cookieManager.create(COOKIE_USER_SESSION, sessionToken.getPollenToken().getToken());
+ cookieManager.add(pollenSession);
+
+ } else {
+
+ cookieManager.remove(COOKIE_USER_SESSION);
+
+ }
+
+ }
+
+}
Property changes on: trunk/pollen-rest-api/src/main/java/org/chorem/pollen/rest/api/RequestResponses.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision
Added: svn:eol-style
+ native
Modified: trunk/pollen-rest-api/src/main/java/org/chorem/pollen/rest/api/v1/ErrorAction.java
===================================================================
--- trunk/pollen-rest-api/src/main/java/org/chorem/pollen/rest/api/v1/ErrorAction.java 2014-05-12 22:30:20 UTC (rev 3937)
+++ trunk/pollen-rest-api/src/main/java/org/chorem/pollen/rest/api/v1/ErrorAction.java 2014-05-13 14:27:12 UTC (rev 3938)
@@ -23,8 +23,10 @@
* #L%
*/
+import org.chorem.pollen.rest.api.RequestResponses;
import org.chorem.pollen.services.service.InvalidFormException;
import org.debux.webmotion.server.WebMotionController;
+import org.debux.webmotion.server.call.HttpContext;
import org.debux.webmotion.server.render.Render;
import javax.servlet.http.HttpServletResponse;
@@ -37,36 +39,46 @@
*/
public class ErrorAction extends WebMotionController {
- public InvalidFormException on400Form(InvalidFormException e) {
+ public InvalidFormException on400Form(HttpContext context, InvalidFormException e) {
+ RequestResponses.prepareResponse(context);
+
// just return the exception,
return e;
}
- public Render on404(Exception e) {
+ public Render on404(HttpContext context, Exception e) {
+ RequestResponses.prepareResponse(context);
+
Render render = renderError(HttpServletResponse.SC_NOT_FOUND, e.getMessage());
return render;
}
- public Render on401(Exception e) {
+ public Render on401(HttpContext context, Exception e) {
+ RequestResponses.prepareResponse(context);
+
Render render = renderError(HttpServletResponse.SC_UNAUTHORIZED, e.getMessage());
return render;
}
- public Render on403(Exception e) {
+ public Render on403(HttpContext context, Exception e) {
+ RequestResponses.prepareResponse(context);
+
Render render = renderError(HttpServletResponse.SC_FORBIDDEN, e.getMessage());
return render;
}
- public Render on500(Exception e) {
+ public Render on500(HttpContext context, Exception e) {
+ RequestResponses.prepareResponse(context);
+
Render render = renderError(HttpServletResponse.SC_INTERNAL_SERVER_ERROR, e.getMessage());
return render;
1
0
r3937 - in trunk: pollen-rest-api/src/main/java/org/chorem/pollen/rest/api/v1 pollen-services/src/main/java/org/chorem/pollen/services/service
by tchemit@users.chorem.org 12 May '14
by tchemit@users.chorem.org 12 May '14
12 May '14
Author: tchemit
Date: 2014-05-13 00:30:20 +0200 (Tue, 13 May 2014)
New Revision: 3937
Url: http://forge.chorem.org/projects/pollen/repository/revisions/3937
Log:
somebody lies to me\! He told me it did not need edited value in return, but he does in facts... D
Modified:
trunk/pollen-rest-api/src/main/java/org/chorem/pollen/rest/api/v1/ChoiceApi.java
trunk/pollen-rest-api/src/main/java/org/chorem/pollen/rest/api/v1/CommentApi.java
trunk/pollen-rest-api/src/main/java/org/chorem/pollen/rest/api/v1/PollApi.java
trunk/pollen-services/src/main/java/org/chorem/pollen/services/service/ChoiceService.java
trunk/pollen-services/src/main/java/org/chorem/pollen/services/service/CommentService.java
trunk/pollen-services/src/main/java/org/chorem/pollen/services/service/PollService.java
Modified: trunk/pollen-rest-api/src/main/java/org/chorem/pollen/rest/api/v1/ChoiceApi.java
===================================================================
--- trunk/pollen-rest-api/src/main/java/org/chorem/pollen/rest/api/v1/ChoiceApi.java 2014-05-12 22:29:33 UTC (rev 3936)
+++ trunk/pollen-rest-api/src/main/java/org/chorem/pollen/rest/api/v1/ChoiceApi.java 2014-05-12 22:30:20 UTC (rev 3937)
@@ -61,10 +61,12 @@
}
- public void editChoice(ChoiceService choiceService, String pollId, Choice choice) throws InvalidFormException {
+ public Choice editChoice(ChoiceService choiceService, String pollId, Choice choice) throws InvalidFormException {
- choiceService.editChoice(pollId, choice);
+ Choice editChoice = choiceService.editChoice(pollId, choice);
+ return editChoice;
+
}
public void deleteChoice(ChoiceService choiceService, String pollId, String choiceId) {
Modified: trunk/pollen-rest-api/src/main/java/org/chorem/pollen/rest/api/v1/CommentApi.java
===================================================================
--- trunk/pollen-rest-api/src/main/java/org/chorem/pollen/rest/api/v1/CommentApi.java 2014-05-12 22:29:33 UTC (rev 3936)
+++ trunk/pollen-rest-api/src/main/java/org/chorem/pollen/rest/api/v1/CommentApi.java 2014-05-12 22:30:20 UTC (rev 3937)
@@ -61,10 +61,12 @@
}
- public void editComment(CommentService commentService, String pollId, Comment comment) throws InvalidFormException {
+ public Comment editComment(CommentService commentService, String pollId, Comment comment) throws InvalidFormException {
- commentService.editComment(pollId, comment);
+ Comment editComment = commentService.editComment(pollId, comment);
+ return editComment;
+
}
public void deleteComment(CommentService commentService, String pollId, String commentId) {
Modified: trunk/pollen-rest-api/src/main/java/org/chorem/pollen/rest/api/v1/PollApi.java
===================================================================
--- trunk/pollen-rest-api/src/main/java/org/chorem/pollen/rest/api/v1/PollApi.java 2014-05-12 22:29:33 UTC (rev 3936)
+++ trunk/pollen-rest-api/src/main/java/org/chorem/pollen/rest/api/v1/PollApi.java 2014-05-12 22:30:20 UTC (rev 3937)
@@ -106,10 +106,12 @@
}
- public void editPoll(PollService pollService, Poll poll) throws InvalidFormException {
+ public Poll editPoll(PollService pollService, Poll poll) throws InvalidFormException {
- pollService.editPoll(poll);
+ Poll editPoll = pollService.editPoll(poll);
+ return editPoll;
+
}
public void deletePoll(PollService pollService, String pollId) {
Modified: trunk/pollen-services/src/main/java/org/chorem/pollen/services/service/ChoiceService.java
===================================================================
--- trunk/pollen-services/src/main/java/org/chorem/pollen/services/service/ChoiceService.java 2014-05-12 22:29:33 UTC (rev 3936)
+++ trunk/pollen-services/src/main/java/org/chorem/pollen/services/service/ChoiceService.java 2014-05-12 22:30:20 UTC (rev 3937)
@@ -117,7 +117,7 @@
}
- public void editChoice(String pollId, Choice choice) throws InvalidFormException {
+ public Choice editChoice(String pollId, Choice choice) throws InvalidFormException {
checkNotNull(choice);
checkIsPersisted(choice);
@@ -134,6 +134,8 @@
getNotificationService().onChoiceEdited(poll, result);
+ return copy(result);
+
}
public void deleteChoice(String pollId, String choiceId) {
Modified: trunk/pollen-services/src/main/java/org/chorem/pollen/services/service/CommentService.java
===================================================================
--- trunk/pollen-services/src/main/java/org/chorem/pollen/services/service/CommentService.java 2014-05-12 22:29:33 UTC (rev 3936)
+++ trunk/pollen-services/src/main/java/org/chorem/pollen/services/service/CommentService.java 2014-05-12 22:30:20 UTC (rev 3937)
@@ -83,7 +83,7 @@
}
- public void editComment(String pollId, Comment comment) throws InvalidFormException {
+ public Comment editComment(String pollId, Comment comment) throws InvalidFormException {
checkNotNull(pollId);
checkNotNull(comment);
@@ -99,6 +99,8 @@
getNotificationService().onCommentEdited(poll, result);
+ return copy(result);
+
}
public void deleteComment(String pollId, String commentId) {
Modified: trunk/pollen-services/src/main/java/org/chorem/pollen/services/service/PollService.java
===================================================================
--- trunk/pollen-services/src/main/java/org/chorem/pollen/services/service/PollService.java 2014-05-12 22:29:33 UTC (rev 3936)
+++ trunk/pollen-services/src/main/java/org/chorem/pollen/services/service/PollService.java 2014-05-12 22:30:20 UTC (rev 3937)
@@ -156,7 +156,7 @@
}
- public void editPoll(Poll poll) throws InvalidFormException {
+ public Poll editPoll(Poll poll) throws InvalidFormException {
checkNotNull(poll);
checkIsPersisted(poll);
@@ -170,6 +170,8 @@
getNotificationService().onPollEdited(savedPoll);
+ return copy(savedPoll);
+
}
public void deletePoll(String pollId) {
1
0