This repository has been archived by the owner on Nov 9, 2017. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Project iteration grouping: work in progress, implementing search
- Loading branch information
Alex Eng
committed
Apr 16, 2012
1 parent
3ddf15f
commit 08bdf8e
Showing
16 changed files
with
286 additions
and
38 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
143 changes: 143 additions & 0 deletions
143
server/zanata-war/src/main/java/org/zanata/action/VersionGroupAction.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,143 @@ | ||
/* | ||
* Copyright 2010, Red Hat, Inc. and individual contributors as indicated by the | ||
* @author tags. See the copyright.txt file in the distribution for a full | ||
* listing of individual contributors. | ||
* | ||
* This 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 2.1 of the License, or (at your option) | ||
* any later version. | ||
* | ||
* This software 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 Lesser General Public License for more | ||
* details. | ||
* | ||
* You should have received a copy of the GNU Lesser General Public License | ||
* along with this software; if not, write to the Free Software Foundation, | ||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA, or see the FSF | ||
* site: http://www.fsf.org. | ||
*/ | ||
package org.zanata.action; | ||
|
||
import java.io.Serializable; | ||
import java.util.List; | ||
|
||
import org.jboss.seam.ScopeType; | ||
import org.jboss.seam.annotations.In; | ||
import org.jboss.seam.annotations.Logger; | ||
import org.jboss.seam.annotations.Name; | ||
import org.jboss.seam.annotations.Scope; | ||
import org.jboss.seam.log.Log; | ||
import org.zanata.model.HIterationGroup; | ||
import org.zanata.model.HProjectIteration; | ||
import org.zanata.security.BaseSecurityChecker; | ||
import org.zanata.service.VersionGroupService; | ||
|
||
@Name("versionGroupAction") | ||
@Scope(ScopeType.PAGE) | ||
public class VersionGroupAction extends BaseSecurityChecker implements Serializable | ||
{ | ||
private static final long serialVersionUID = 1L; | ||
|
||
@In | ||
private VersionGroupService versionGroupServiceImpl; | ||
|
||
@Logger | ||
Log log; | ||
|
||
private HIterationGroup group; | ||
private String searchTerm; | ||
private List<HProjectIteration> searchResults; | ||
|
||
public void init(String slug) | ||
{ | ||
group = versionGroupServiceImpl.getBySlug(slug); | ||
} | ||
|
||
public String getSearchTerm() | ||
{ | ||
return searchTerm; | ||
} | ||
|
||
public void setSearchTerm(String searchTerm) | ||
{ | ||
this.searchTerm = searchTerm; | ||
} | ||
|
||
public List<HProjectIteration> getSearchResults() | ||
{ | ||
return searchResults; | ||
} | ||
|
||
/* | ||
* public boolean isVersionInGroup(HProjectIteration projectIteration) { if | ||
* (projectIteration == null) { return false; } for (HLocaleMember lm : | ||
* this.locale.getMembers()) { if | ||
* (lm.getPerson().getId().equals(projectIteration.getId())) { return true; } | ||
* } return false; } | ||
* | ||
* | ||
* @Transactional | ||
* | ||
* @Restrict("#{s:hasRole('admin')}") public void joinGroup() { | ||
* log.debug("starting join tribe"); if (authenticatedAccount == null) { | ||
* log.error("failed to load auth person"); return; } try { | ||
* languageTeamServiceImpl.joinLanguageTeam(this.language, | ||
* authenticatedAccount.getPerson().getId()); | ||
* Events.instance().raiseEvent("personJoinedTribe"); | ||
* log.info("{0} joined tribe {1}", authenticatedAccount.getUsername(), | ||
* this.language); | ||
* FacesMessages.instance().add("You are now a member of the {0} language team" | ||
* , this.locale.retrieveNativeName()); } catch (Exception e) { | ||
* FacesMessages.instance().add(Severity.ERROR, e.getMessage()); } } | ||
* | ||
* @Transactional public void leaveGroup() { | ||
* log.debug("starting leave tribe"); if (authenticatedAccount == null) { | ||
* log.error("failed to load auth person"); return; } | ||
* languageTeamServiceImpl.leaveLanguageTeam(this.language, | ||
* authenticatedAccount.getPerson().getId()); | ||
* Events.instance().raiseEvent("personLeftTribe"); | ||
* log.info("{0} left tribe {1}", authenticatedAccount.getUsername(), | ||
* this.language); | ||
* FacesMessages.instance().add("You have left the {0} language team", | ||
* this.locale.retrieveNativeName()); } | ||
* | ||
* @Restrict("#{languageTeamAction.checkPermission('manage-language-team')}") | ||
* public void saveTeamCoordinator(HLocaleMember member) { | ||
* this.localeDAO.makePersistent(this.locale); this.localeDAO.flush(); if | ||
* (member.isCoordinator()) { | ||
* FacesMessages.instance().add("{0} has been made a Team Coordinator", | ||
* member.getPerson().getAccount().getUsername()); } else { | ||
* FacesMessages.instance | ||
* ().add("{0} has been removed from Team Coordinators", | ||
* member.getPerson().getAccount().getUsername()); } } | ||
* | ||
* @Restrict("#{languageTeamAction.checkPermission('manage-language-team')}") | ||
* public void addTeamMember(final Long personId) { | ||
* this.languageTeamServiceImpl.joinLanguageTeam(this.language, personId); // | ||
* reload the locale for changes this.locale = | ||
* localeServiceImpl.getByLocaleId(new LocaleId(language)); } | ||
* | ||
* @Restrict("#{languageTeamAction.checkPermission('manage-language-team')}") | ||
* public void removeMembership(HLocaleMember member) { | ||
* this.languageTeamServiceImpl.leaveLanguageTeam(this.language, | ||
* member.getPerson().getId()); this.locale.getMembers().remove(member); } | ||
* | ||
* public boolean isPersonInTeam(final Long personId) { for (HLocaleMember lm | ||
* : this.locale.getMembers()) { if (lm.getPerson().getId().equals(personId)) | ||
* { return true; } } return false; } | ||
*/ | ||
|
||
public void searchForProjects() | ||
{ | ||
this.searchResults = versionGroupServiceImpl.findAllContainingName(this.searchTerm); | ||
} | ||
|
||
@Override | ||
public Object getSecuredEntity() | ||
{ | ||
return group; | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.