Author: tchemit Date: 2012-07-12 12:18:02 +0200 (Thu, 12 Jul 2012) New Revision: 261 Url: http://nuiton.org/repositories/revision/jredmine/261 Log: ove back some stuff to client (but will be removed soon) Added: trunk/jredmine-client/src/main/java/org/nuiton/jredmine/model/ trunk/jredmine-client/src/main/java/org/nuiton/jredmine/model/RedmineModelEnum.java trunk/jredmine-client/src/main/java/org/nuiton/jredmine/model/RedmineModelScope.java Removed: trunk/jredmine-domain/src/main/java/org/nuiton/jredmine/model/RedmineModelEnum.java trunk/jredmine-domain/src/main/java/org/nuiton/jredmine/model/RedmineModelScope.java Added: trunk/jredmine-client/src/main/java/org/nuiton/jredmine/model/RedmineModelEnum.java =================================================================== --- trunk/jredmine-client/src/main/java/org/nuiton/jredmine/model/RedmineModelEnum.java (rev 0) +++ trunk/jredmine-client/src/main/java/org/nuiton/jredmine/model/RedmineModelEnum.java 2012-07-12 10:18:02 UTC (rev 261) @@ -0,0 +1,97 @@ +/* + * #%L + * JRedmine :: Client + * + * $Id$ + * $HeadURL: http://svn.nuiton.org/svn/jredmine/trunk/jredmine-domain/src/main/java/org/n... $ + * %% + * Copyright (C) 2009 - 2010 Tony Chemit, CodeLutin + * %% + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser 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 Lesser Public License for more details. + * + * You should have received a copy of the GNU General Lesser Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/lgpl-3.0.html>. + * #L% + */ +package org.nuiton.jredmine.model; + +import org.nuiton.jredmine.rest.RedmineRestClient; + +/** + * Un énumération pour connaitre l'ensemble des classes du modèle. + * + * @author tchemit <chemit@codelutin.com> + * @since 1.0.0 + */ +public enum RedmineModelEnum { + + issueStatus(IssueStatus.class, RedmineModelScope.none, RedmineRestClient.GET_ISSUE_STATUS_LIST), + issuePriority(IssuePriority.class, RedmineModelScope.none, RedmineRestClient.GET_ISSUE_PRIORITY_LIST), + project(Project.class, RedmineModelScope.none, RedmineRestClient.GET_PROJECT_LIST), + issueCategory(IssueCategory.class, RedmineModelScope.project, RedmineRestClient.GET_ISSUE_CATEGORY_LIST), + tracker(Tracker.class, RedmineModelScope.project, RedmineRestClient.GET_TRACKER_LIST), + user(User.class, RedmineModelScope.project, RedmineRestClient.GET_USER_LIST), + news(News.class, RedmineModelScope.project, RedmineRestClient.GET_NEWS_LIST), + version(Version.class, RedmineModelScope.project, RedmineRestClient.GET_VERSION_LIST), + issue(Issue.class, RedmineModelScope.version, RedmineRestClient.GET_ISSUE_LIST), + timeEntry(TimeEntry.class, RedmineModelScope.issue, RedmineRestClient.GET_ISSUE_TIME_ENTRY_LIST), + attachment(Attachment.class, RedmineModelScope.version, RedmineRestClient.GET_ATTACHMENTS_LIST); + + private final Class<?> modelType; + + private final RedmineModelScope scope; + + private final String requestAll; + + RedmineModelEnum(Class<?> modelType, RedmineModelScope scope, String requestAll) { + this.modelType = modelType; + this.scope = scope; + this.requestAll = requestAll; + } + + + public Class<?> getModelType() { + return modelType; + } + + public RedmineModelScope getScope() { + return scope; + } + + public String getRequestAll() { + return requestAll; + } + + public static RedmineModelEnum valueOf(Class<?> type) { + for (RedmineModelEnum e : values()) { + if (e.getModelType().equals(type)) { + return e; + } + } + return null; + } + + public static RedmineModelEnum safeValueOf(Class<?> type) { + if (type == null) { + throw new NullPointerException("klass parameter can not be null"); + } + + // check dataType is authorized + + RedmineModelEnum r = valueOf(type); + if (r == null) { + throw new IllegalArgumentException("the type " + type.getName() + " is not allowed!"); + } + + return r; + } +} Property changes on: trunk/jredmine-client/src/main/java/org/nuiton/jredmine/model/RedmineModelEnum.java ___________________________________________________________________ Added: svn:keywords + Author Date Id Revision Added: svn:eol-style + native Added: trunk/jredmine-client/src/main/java/org/nuiton/jredmine/model/RedmineModelScope.java =================================================================== --- trunk/jredmine-client/src/main/java/org/nuiton/jredmine/model/RedmineModelScope.java (rev 0) +++ trunk/jredmine-client/src/main/java/org/nuiton/jredmine/model/RedmineModelScope.java 2012-07-12 10:18:02 UTC (rev 261) @@ -0,0 +1,56 @@ +/* + * #%L + * JRedmine :: Client + * + * $Id$ + * $HeadURL: http://svn.nuiton.org/svn/jredmine/trunk/jredmine-domain/src/main/java/org/n... $ + * %% + * Copyright (C) 2009 - 2010 Tony Chemit, CodeLutin + * %% + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser 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 Lesser Public License for more details. + * + * You should have received a copy of the GNU General Lesser Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/lgpl-3.0.html>. + * #L% + */ +package org.nuiton.jredmine.model; + +/** + * Une enumeration pour caracteriser le scope d'une donnée dans le modèle. + * <p/> + * <p/> + * Pour une donnée qui ne dépend de rien, elle est en scope {@link #none}. + * <p/> + * Pour une donnée qui dépend d'un projet, elle est en scope {@link #project}. + * <p/> + * Pour une donnée qui dépend d'une version, elle est en scpoe {@link #version}. + * <p/> + * Pour une donnée qui dépend d'une issue, elle est en scpoe {@link #issue}. + * <p/> + * A savoir qu'une donnée de scope {@link #version} (resp. {@link #issue}), + * elle est aussi de scope {@link #project} car la version (resp. l'issue) + * dépend en dépend. + * + * @author tchemit <chemit@codelutin.com> + * @since 1.0.0 + */ +public enum RedmineModelScope { + + /** none scope, requires nothing. */ + none, + /** project scope, requires a project. */ + project, + /** version scope, requires a project and a version. */ + version, + /** issue scope, requires a project and an issue. */ + issue +} Property changes on: trunk/jredmine-client/src/main/java/org/nuiton/jredmine/model/RedmineModelScope.java ___________________________________________________________________ Added: svn:keywords + Author Date Id Revision Added: svn:eol-style + native Deleted: trunk/jredmine-domain/src/main/java/org/nuiton/jredmine/model/RedmineModelEnum.java =================================================================== --- trunk/jredmine-domain/src/main/java/org/nuiton/jredmine/model/RedmineModelEnum.java 2012-07-12 10:16:06 UTC (rev 260) +++ trunk/jredmine-domain/src/main/java/org/nuiton/jredmine/model/RedmineModelEnum.java 2012-07-12 10:18:02 UTC (rev 261) @@ -1,97 +0,0 @@ -/* - * #%L - * JRedmine :: Client - * - * $Id$ - * $HeadURL$ - * %% - * Copyright (C) 2009 - 2010 Tony Chemit, CodeLutin - * %% - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser 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 Lesser Public License for more details. - * - * You should have received a copy of the GNU General Lesser Public - * License along with this program. If not, see - * <http://www.gnu.org/licenses/lgpl-3.0.html>. - * #L% - */ -package org.nuiton.jredmine.model; - -import org.nuiton.jredmine.rest.RedmineRestClient; - -/** - * Un énumération pour connaitre l'ensemble des classes du modèle. - * - * @author tchemit <chemit@codelutin.com> - * @since 1.0.0 - */ -public enum RedmineModelEnum { - - issueStatus(IssueStatus.class, RedmineModelScope.none, RedmineRestClient.GET_ISSUE_STATUS_LIST), - issuePriority(IssuePriority.class, RedmineModelScope.none, RedmineRestClient.GET_ISSUE_PRIORITY_LIST), - project(Project.class, RedmineModelScope.none, RedmineRestClient.GET_PROJECT_LIST), - issueCategory(IssueCategory.class, RedmineModelScope.project, RedmineRestClient.GET_ISSUE_CATEGORY_LIST), - tracker(Tracker.class, RedmineModelScope.project, RedmineRestClient.GET_TRACKER_LIST), - user(User.class, RedmineModelScope.project, RedmineRestClient.GET_USER_LIST), - news(News.class, RedmineModelScope.project, RedmineRestClient.GET_NEWS_LIST), - version(Version.class, RedmineModelScope.project, RedmineRestClient.GET_VERSION_LIST), - issue(Issue.class, RedmineModelScope.version, RedmineRestClient.GET_ISSUE_LIST), - timeEntry(TimeEntry.class, RedmineModelScope.issue, RedmineRestClient.GET_ISSUE_TIME_ENTRY_LIST), - attachment(Attachment.class, RedmineModelScope.version, RedmineRestClient.GET_ATTACHMENTS_LIST); - - private final Class<?> modelType; - - private final RedmineModelScope scope; - - private final String requestAll; - - RedmineModelEnum(Class<?> modelType, RedmineModelScope scope, String requestAll) { - this.modelType = modelType; - this.scope = scope; - this.requestAll = requestAll; - } - - - public Class<?> getModelType() { - return modelType; - } - - public RedmineModelScope getScope() { - return scope; - } - - public String getRequestAll() { - return requestAll; - } - - public static RedmineModelEnum valueOf(Class<?> type) { - for (RedmineModelEnum e : values()) { - if (e.getModelType().equals(type)) { - return e; - } - } - return null; - } - - public static RedmineModelEnum safeValueOf(Class<?> type) { - if (type == null) { - throw new NullPointerException("klass parameter can not be null"); - } - - // check dataType is authorized - - RedmineModelEnum r = valueOf(type); - if (r == null) { - throw new IllegalArgumentException("the type " + type.getName() + " is not allowed!"); - } - - return r; - } -} Deleted: trunk/jredmine-domain/src/main/java/org/nuiton/jredmine/model/RedmineModelScope.java =================================================================== --- trunk/jredmine-domain/src/main/java/org/nuiton/jredmine/model/RedmineModelScope.java 2012-07-12 10:16:06 UTC (rev 260) +++ trunk/jredmine-domain/src/main/java/org/nuiton/jredmine/model/RedmineModelScope.java 2012-07-12 10:18:02 UTC (rev 261) @@ -1,56 +0,0 @@ -/* - * #%L - * JRedmine :: Client - * - * $Id$ - * $HeadURL$ - * %% - * Copyright (C) 2009 - 2010 Tony Chemit, CodeLutin - * %% - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser 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 Lesser Public License for more details. - * - * You should have received a copy of the GNU General Lesser Public - * License along with this program. If not, see - * <http://www.gnu.org/licenses/lgpl-3.0.html>. - * #L% - */ -package org.nuiton.jredmine.model; - -/** - * Une enumeration pour caracteriser le scope d'une donnée dans le modèle. - * <p/> - * <p/> - * Pour une donnée qui ne dépend de rien, elle est en scope {@link #none}. - * <p/> - * Pour une donnée qui dépend d'un projet, elle est en scope {@link #project}. - * <p/> - * Pour une donnée qui dépend d'une version, elle est en scpoe {@link #version}. - * <p/> - * Pour une donnée qui dépend d'une issue, elle est en scpoe {@link #issue}. - * <p/> - * A savoir qu'une donnée de scope {@link #version} (resp. {@link #issue}), - * elle est aussi de scope {@link #project} car la version (resp. l'issue) - * dépend en dépend. - * - * @author tchemit <chemit@codelutin.com> - * @since 1.0.0 - */ -public enum RedmineModelScope { - - /** none scope, requires nothing. */ - none, - /** project scope, requires a project. */ - project, - /** version scope, requires a project and a version. */ - version, - /** issue scope, requires a project and an issue. */ - issue -}