Author: bpoussin Date: 2013-09-24 20:05:27 +0200 (Tue, 24 Sep 2013) New Revision: 363 Url: http://chorem.org/projects/bow/repository/revisions/363 Log: remove migration action, migration is done during reindexation Removed: trunk/bow-ui/src/main/java/org/chorem/bow/action/admin/MigrateDataAction.java Modified: trunk/bow-ui/src/main/resources/struts.xml Deleted: trunk/bow-ui/src/main/java/org/chorem/bow/action/admin/MigrateDataAction.java =================================================================== --- trunk/bow-ui/src/main/java/org/chorem/bow/action/admin/MigrateDataAction.java 2013-09-24 18:03:50 UTC (rev 362) +++ trunk/bow-ui/src/main/java/org/chorem/bow/action/admin/MigrateDataAction.java 2013-09-24 18:05:27 UTC (rev 363) @@ -1,95 +0,0 @@ -/* - * #%L - * BOW UI - * - * $Id$ - * $HeadURL$ - * %% - * Copyright (C) 2010 - 2011 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% - */ -package org.chorem.bow.action.admin; - - -import java.util.List; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.chorem.bow.BowProxy; -import org.chorem.bow.BowSession; -import org.chorem.bow.action.BowBaseAction; -import org.nuiton.wikitty.entities.Wikitty; -import org.nuiton.wikitty.query.WikittyQuery; -import org.nuiton.wikitty.query.WikittyQueryMaker; -import org.nuiton.wikitty.query.WikittyQueryResult; - - -/** - * Lance la migration des données de la version 0.4 vers 0.5 - * - * @author poussin - * @version $Revision$ - * <p/> - * Last update: $Date$ - * by : $Author$ - */ -public class MigrateDataAction extends BowBaseAction { - - /** to use log facility, just put in your code: log.info(\"...\"); */ - private static final Log log = LogFactory.getLog(MigrateDataAction.class); - - /** nombre d'objet a migrer pour chaque iteration */ - protected int MAX=1000; - - public void setMAX(int MAX) { - if (MAX > 0) { - this.MAX = MAX; - } - } - - @Override - public String execute() { - try { - BowSession session = getBowSession(); - if (session.isAdmin()) { //If is admin - // les classes de migration ont deja ete enregistrees lors - // de la creation de BowProxy - // Il faut donc simplement parcourir tous les objets - BowProxy proxy = getBowProxy(); - - WikittyQuery criteria = new WikittyQueryMaker().rTrue().end(); - - int i = 0; - int count = 0; - WikittyQueryResult<Wikitty> wikitties; - do { - criteria.setOffset(i); - criteria.setLimit(MAX); - i+=MAX; - wikitties = proxy.findAllByQuery(Wikitty.class, criteria); - List<Wikitty> ws = wikitties.getAll(); - proxy.storeWikitty(ws); - count += ws.size(); - } while (wikitties.size() >= MAX); - log.info(String.format("Migration of %s BowBookmark done", count)); - } - } catch (Exception eee) { - addActionError(_("bow.error.internal")); - log.error(eee.getMessage(), eee); - } - return SUCCESS; - } - -} Modified: trunk/bow-ui/src/main/resources/struts.xml =================================================================== --- trunk/bow-ui/src/main/resources/struts.xml 2013-09-24 18:03:50 UTC (rev 362) +++ trunk/bow-ui/src/main/resources/struts.xml 2013-09-24 18:05:27 UTC (rev 363) @@ -253,9 +253,5 @@ <result name="error">/WEB-INF/jsp/admin.jsp</result> <result>/WEB-INF/jsp/admin.jsp</result> </action> - <action name="migrateData" class="org.chorem.bow.action.admin.MigrateDataAction"> - <result name="error">/WEB-INF/jsp/admin.jsp</result> - <result>/WEB-INF/jsp/admin.jsp</result> - </action> </package> </struts>