Author: glandais Date: 2008-02-04 15:17:29 +0000 (Mon, 04 Feb 2008) New Revision: 633 Modified: trunk/simexplorer-is-web/src/java/fr/cemagref/simexplorer/is/ui/web/SimExplorerWebException.java trunk/simexplorer-is-web/src/java/fr/cemagref/simexplorer/is/ui/web/components/Back.java trunk/simexplorer-is-web/src/java/fr/cemagref/simexplorer/is/ui/web/components/Layout.java trunk/simexplorer-is-web/src/java/fr/cemagref/simexplorer/is/ui/web/grid/ElementDataSource.java trunk/simexplorer-is-web/src/java/fr/cemagref/simexplorer/is/ui/web/pages/ElementDelete.java trunk/simexplorer-is-web/src/java/fr/cemagref/simexplorer/is/ui/web/pages/ElementDetail.java trunk/simexplorer-is-web/src/java/fr/cemagref/simexplorer/is/ui/web/pages/ElementExport.java trunk/simexplorer-is-web/src/java/fr/cemagref/simexplorer/is/ui/web/pages/ElementHistory.java trunk/simexplorer-is-web/src/java/fr/cemagref/simexplorer/is/ui/web/pages/ElementImport.java trunk/simexplorer-is-web/src/java/fr/cemagref/simexplorer/is/ui/web/pages/ElementList.java trunk/simexplorer-is-web/src/java/fr/cemagref/simexplorer/is/ui/web/pages/ElementPage.java trunk/simexplorer-is-web/src/java/fr/cemagref/simexplorer/is/ui/web/pages/ElementPageDetail.java trunk/simexplorer-is-web/src/java/fr/cemagref/simexplorer/is/ui/web/pages/ElementRights.java trunk/simexplorer-is-web/src/java/fr/cemagref/simexplorer/is/ui/web/pages/ExceptionReport.java trunk/simexplorer-is-web/src/java/fr/cemagref/simexplorer/is/ui/web/pages/GroupEdit.java trunk/simexplorer-is-web/src/java/fr/cemagref/simexplorer/is/ui/web/pages/GroupList.java trunk/simexplorer-is-web/src/java/fr/cemagref/simexplorer/is/ui/web/pages/Install.java trunk/simexplorer-is-web/src/java/fr/cemagref/simexplorer/is/ui/web/pages/Login.java trunk/simexplorer-is-web/src/java/fr/cemagref/simexplorer/is/ui/web/pages/UserEdit.java trunk/simexplorer-is-web/src/java/fr/cemagref/simexplorer/is/ui/web/pages/UserList.java trunk/simexplorer-is-web/src/java/fr/cemagref/simexplorer/is/ui/web/pages/security/AdminPage.java trunk/simexplorer-is-web/src/java/fr/cemagref/simexplorer/is/ui/web/pages/security/ProtectedPage.java trunk/simexplorer-is-web/src/java/fr/cemagref/simexplorer/is/ui/web/pages/security/SuperAdminPage.java trunk/simexplorer-is-web/src/java/fr/cemagref/simexplorer/is/ui/web/pages/security/UserPage.java trunk/simexplorer-is-web/src/java/fr/cemagref/simexplorer/is/ui/web/services/AppModule.java trunk/simexplorer-is-web/src/java/fr/cemagref/simexplorer/is/ui/web/services/GroupValueEncoder.java trunk/simexplorer-is-web/src/java/fr/cemagref/simexplorer/is/ui/web/services/RemoteSecurityService.java trunk/simexplorer-is-web/src/java/fr/cemagref/simexplorer/is/ui/web/services/RemoteService.java trunk/simexplorer-is-web/src/java/fr/cemagref/simexplorer/is/ui/web/services/RemoteStorageService.java trunk/simexplorer-is-web/src/java/fr/cemagref/simexplorer/is/ui/web/services/UserValueEncoder.java trunk/simexplorer-is-web/src/java/fr/cemagref/simexplorer/is/ui/web/tools/AttachmentStreamResponse.java trunk/simexplorer-is-web/src/java/fr/cemagref/simexplorer/is/ui/web/tools/DownloadableFile.java trunk/simexplorer-is-web/src/java/fr/cemagref/simexplorer/is/ui/web/tools/XMLAttachment.java trunk/simexplorer-is-web/src/java/fr/cemagref/simexplorer/is/ui/web/tools/ZipAttachment.java Log: Javadoc Modified: trunk/simexplorer-is-web/src/java/fr/cemagref/simexplorer/is/ui/web/SimExplorerWebException.java =================================================================== --- trunk/simexplorer-is-web/src/java/fr/cemagref/simexplorer/is/ui/web/SimExplorerWebException.java 2008-02-04 15:13:55 UTC (rev 632) +++ trunk/simexplorer-is-web/src/java/fr/cemagref/simexplorer/is/ui/web/SimExplorerWebException.java 2008-02-04 15:17:29 UTC (rev 633) @@ -17,22 +17,49 @@ * ##% */ package fr.cemagref.simexplorer.is.ui.web; +/** + * The Class SimExplorerWebException. + */ public class SimExplorerWebException extends RuntimeException { + /** The Constant serialVersionUID. */ private static final long serialVersionUID = 4644835311729988659L; + /** + * Instantiates a new sim explorer web exception. + */ public SimExplorerWebException() { super(); } + /** + * Instantiates a new sim explorer web exception. + * + * @param cause + * the cause + */ public SimExplorerWebException(Throwable cause) { super(cause); } + /** + * Instantiates a new sim explorer web exception. + * + * @param message + * the message + */ public SimExplorerWebException(String message) { super(message); } + /** + * Instantiates a new sim explorer web exception. + * + * @param message + * the message + * @param cause + * the cause + */ public SimExplorerWebException(String message, Throwable cause) { super(message, cause); } Modified: trunk/simexplorer-is-web/src/java/fr/cemagref/simexplorer/is/ui/web/components/Back.java =================================================================== --- trunk/simexplorer-is-web/src/java/fr/cemagref/simexplorer/is/ui/web/components/Back.java 2008-02-04 15:13:55 UTC (rev 632) +++ trunk/simexplorer-is-web/src/java/fr/cemagref/simexplorer/is/ui/web/components/Back.java 2008-02-04 15:17:29 UTC (rev 633) @@ -19,15 +19,30 @@ import org.apache.tapestry.annotations.Parameter; +/** + * The Class Back. + */ public class Back { + /** The label. */ @Parameter(required = true) private String label; + /** + * Gets the label. + * + * @return the label + */ public String getLabel() { return label; } + /** + * Sets the label. + * + * @param label + * the new label + */ public void setLabel(String label) { this.label = label; } Modified: trunk/simexplorer-is-web/src/java/fr/cemagref/simexplorer/is/ui/web/components/Layout.java =================================================================== --- trunk/simexplorer-is-web/src/java/fr/cemagref/simexplorer/is/ui/web/components/Layout.java 2008-02-04 15:13:55 UTC (rev 632) +++ trunk/simexplorer-is-web/src/java/fr/cemagref/simexplorer/is/ui/web/components/Layout.java 2008-02-04 15:17:29 UTC (rev 633) @@ -21,20 +21,15 @@ import javax.servlet.http.HttpSession; -import org.apache.tapestry.annotations.ApplicationState; -import org.apache.tapestry.annotations.Component; import org.apache.tapestry.annotations.IncludeStylesheet; import org.apache.tapestry.annotations.InjectPage; import org.apache.tapestry.annotations.Parameter; import org.apache.tapestry.annotations.Service; -import org.apache.tapestry.corelib.components.Form; -import org.apache.tapestry.corelib.components.TextField; import org.apache.tapestry.ioc.annotations.Inject; import org.apache.tapestry.services.PersistentLocale; import org.apache.tapestry.services.RequestGlobals; import de.hsofttec.t5components.annotations.SetterGetter; - import fr.cemagref.simexplorer.is.ui.web.pages.ElementList; /** @@ -48,39 +43,37 @@ @IncludeStylesheet("css/Layout.css") public class Layout { + /** The persistent locale. */ @Inject @Service("PersistentLocale") private PersistentLocale persistentLocale; - @ApplicationState - private String token; - - @Component - private TextField searchField; - + /** The _search text. */ @SetterGetter private String _searchText; - @Component - private Form form; - + /** The element list. */ @InjectPage private ElementList elementList; + /** The request globals. */ @Inject private RequestGlobals requestGlobals; - /** - * page title - */ + /** page title. */ @Parameter("defaulttitle") private String title; + /** + * Instantiates a new layout. + */ public Layout() { super(); } /** + * Gets the title. + * * @return the title */ public String getTitle() { @@ -88,22 +81,37 @@ } /** - * Set default title + * Set default title. */ void getDefaultTitle() { title = ""; } + /** + * On action from switch locale fr. + * + * @return the object + */ Object onActionFromSwitchLocaleFr() { persistentLocale.set(new Locale("fr")); return null; } + /** + * On action from switch locale en. + * + * @return the object + */ Object onActionFromSwitchLocaleEn() { persistentLocale.set(new Locale("en")); return null; } + /** + * On success. + * + * @return the object + */ Object onSuccess() { elementList.searchQuery(_searchText); // form.recordError(searchField, "Invalid request."); @@ -111,29 +119,60 @@ return elementList; } + /** + * On action from application list. + * + * @return the object + */ public Object onActionFromApplicationList() { elementList.searchQuery(null); return elementList; } + /** + * On action from logout. + * + * @return the object + */ public Object onActionFromLogout() { - HttpSession session = requestGlobals.getHTTPServletRequest().getSession(); + HttpSession session = requestGlobals.getHTTPServletRequest() + .getSession(); session.invalidate(); return elementList; } + /** + * Gets the login name. + * + * @return the login name + */ public String getLoginName() { return elementList.getUserLogged().getLogin(); } + /** + * Gets the logged. + * + * @return the logged + */ public boolean getLogged() { return elementList.isUserLogged(); } + /** + * Gets the administrator. + * + * @return the administrator + */ public boolean getAdministrator() { return elementList.isUserAdmin(); } + /** + * Gets the super administrator. + * + * @return the super administrator + */ public boolean getSuperAdministrator() { return elementList.isUserSuperAdmin(); } Modified: trunk/simexplorer-is-web/src/java/fr/cemagref/simexplorer/is/ui/web/grid/ElementDataSource.java =================================================================== --- trunk/simexplorer-is-web/src/java/fr/cemagref/simexplorer/is/ui/web/grid/ElementDataSource.java 2008-02-04 15:13:55 UTC (rev 632) +++ trunk/simexplorer-is-web/src/java/fr/cemagref/simexplorer/is/ui/web/grid/ElementDataSource.java 2008-02-04 15:17:29 UTC (rev 633) @@ -26,36 +26,31 @@ import fr.cemagref.simexplorer.is.ui.web.services.RemoteStorageService; /** - * Datasource of element list + * Datasource of element list. * * @author glandais - * */ public class ElementDataSource implements GridDataSource { - /** - * Query being searched - */ + /** Query being searched. */ private String query = ""; - /** - * Bookmark on first item index - */ + + /** Bookmark on first item index. */ private int indexStart = 0; - /** - * Cached entities - */ + + /** Cached entities. */ private MetaData[] entities = null; - /** - * Authentification token - */ + /** Authentification token. */ private String token; /** - * Build datasource with text query + * Build datasource with text query. * * @param token + * the token * @param query + * the query */ public ElementDataSource(String token, String query) { super(); @@ -64,9 +59,10 @@ } /** - * Build datasource without text query + * Build datasource without text query. * * @param token + * the token */ public ElementDataSource(String token) { super(); @@ -96,7 +92,7 @@ /* (non-Javadoc) * @see org.apache.tapestry.grid.GridDataSource#getRowType() */ - public Class getRowType() { + public Class<?> getRowType() { return MetaData.class; } @@ -140,7 +136,7 @@ } /** - * Current query + * Current query. * * @return Current text query */ Modified: trunk/simexplorer-is-web/src/java/fr/cemagref/simexplorer/is/ui/web/pages/ElementDelete.java =================================================================== --- trunk/simexplorer-is-web/src/java/fr/cemagref/simexplorer/is/ui/web/pages/ElementDelete.java 2008-02-04 15:13:55 UTC (rev 632) +++ trunk/simexplorer-is-web/src/java/fr/cemagref/simexplorer/is/ui/web/pages/ElementDelete.java 2008-02-04 15:17:29 UTC (rev 633) @@ -17,22 +17,26 @@ * ##% */ package fr.cemagref.simexplorer.is.ui.web.pages; -import org.apache.tapestry.ComponentResources; import org.apache.tapestry.annotations.InjectPage; -import org.apache.tapestry.annotations.Persist; -import org.apache.tapestry.ioc.annotations.Inject; -import fr.cemagref.simexplorer.is.entities.data.LoggableElement; import fr.cemagref.simexplorer.is.service.SimExplorerServiceException; import fr.cemagref.simexplorer.is.ui.web.SimExplorerWebException; -import fr.cemagref.simexplorer.is.ui.web.pages.security.UserPage; import fr.cemagref.simexplorer.is.ui.web.services.RemoteStorageService; +/** + * The Class ElementDelete. + */ public class ElementDelete extends ElementPage { + /** The element detail. */ @InjectPage private ElementDetail elementDetail; + /** + * On action from confirm. + * + * @return the object + */ public Object onActionFromConfirm() { try { RemoteStorageService.getStorageService().deleteElement(getToken(), @@ -44,6 +48,11 @@ return elementDetail; } + /** + * On action from confirm all. + * + * @return the object + */ public Object onActionFromConfirmAll() { try { RemoteStorageService.getStorageService().deleteElement(getToken(), @@ -54,6 +63,10 @@ return elementDetail; } + /* (non-Javadoc) + * @see fr.cemagref.simexplorer.is.ui.web.pages.security.ProtectedPage#getWindowTitle() + */ + @Override public String getWindowTitle() { return ""; } Modified: trunk/simexplorer-is-web/src/java/fr/cemagref/simexplorer/is/ui/web/pages/ElementDetail.java =================================================================== --- trunk/simexplorer-is-web/src/java/fr/cemagref/simexplorer/is/ui/web/pages/ElementDetail.java 2008-02-04 15:13:55 UTC (rev 632) +++ trunk/simexplorer-is-web/src/java/fr/cemagref/simexplorer/is/ui/web/pages/ElementDetail.java 2008-02-04 15:17:29 UTC (rev 633) @@ -17,25 +17,12 @@ * ##% */ package fr.cemagref.simexplorer.is.ui.web.pages; -import java.io.InputStream; import java.util.ArrayList; -import java.util.Iterator; import java.util.List; import java.util.Set; -import java.util.StringTokenizer; -import java.util.Map.Entry; -import org.apache.tapestry.ComponentResources; -import org.apache.tapestry.Link; -import org.apache.tapestry.StreamResponse; -import org.apache.tapestry.annotations.InjectPage; -import org.apache.tapestry.ioc.annotations.Inject; import org.codelutin.tapestry.beans.TreeNode; -import com.healthmarketscience.rmiio.RemoteInputStream; -import com.healthmarketscience.rmiio.RemoteInputStreamClient; - -import fr.cemagref.simexplorer.is.attachment.ContentType; import fr.cemagref.simexplorer.is.entities.data.Code; import fr.cemagref.simexplorer.is.entities.data.Component; import fr.cemagref.simexplorer.is.entities.data.Constant; @@ -43,21 +30,23 @@ import fr.cemagref.simexplorer.is.entities.data.ExplorationApplication; import fr.cemagref.simexplorer.is.entities.data.ExplorationData; import fr.cemagref.simexplorer.is.entities.data.Library; -import fr.cemagref.simexplorer.is.entities.data.LoggableElement; import fr.cemagref.simexplorer.is.entities.data.Structure; -import fr.cemagref.simexplorer.is.entities.metadata.MetaData; -import fr.cemagref.simexplorer.is.ui.web.SimExplorerWebException; -import fr.cemagref.simexplorer.is.ui.web.services.RemoteStorageService; -import fr.cemagref.simexplorer.is.ui.web.tools.AttachmentStreamResponse; +/** + * The Class ElementDetail. + */ public class ElementDetail extends ElementPageDetail { + /* (non-Javadoc) + * @see fr.cemagref.simexplorer.is.ui.web.pages.security.ProtectedPage#getWindowTitle() + */ + @Override public String getWindowTitle() { return ""; } /** - * Headers of tree grid + * Headers of tree grid. * * @return Headers */ @@ -70,12 +59,22 @@ return result; } + /** + * Gets the nodes. + * + * @return the nodes + */ public List<TreeNode> getNodes() { List<TreeNode> nodes = new ArrayList<TreeNode>(); nodes.add(generateElement()); return nodes; } + /** + * Generate element. + * + * @return the tree node + */ private TreeNode generateElement() { TreeNode node = null; if (getElement() instanceof ExplorationApplication) { @@ -94,6 +93,14 @@ return node; } + /** + * Generate header. + * + * @param caption + * the caption + * + * @return the string + */ private String generateHeader(String caption) { StringBuilder sb = new StringBuilder(); sb.append("<b>"); @@ -102,6 +109,11 @@ return sb.toString(); } + /** + * Generate exploration application. + * + * @return the tree node + */ private TreeNode generateExplorationApplication() { TreeNode node; node = new TreeNode(); @@ -132,6 +144,14 @@ return node; } + /** + * Generate explorations. + * + * @param explorationApplication + * the exploration application + * + * @return the list< tree node> + */ private List<TreeNode> generateExplorations( ExplorationApplication explorationApplication) { List<TreeNode> res = new ArrayList<TreeNode>(); @@ -144,6 +164,14 @@ return res; } + /** + * Generate exploration data. + * + * @param explorationData + * the exploration data + * + * @return the tree node + */ private TreeNode generateExplorationData(ExplorationData explorationData) { TreeNode explorationDataNode = new TreeNode(); explorationDataNode.setType(TreeNode.TYPE_FOLDER); @@ -168,6 +196,14 @@ return explorationDataNode; } + /** + * Generate values. + * + * @param explorationData + * the exploration data + * + * @return the list< tree node> + */ private List<TreeNode> generateValues(ExplorationData explorationData) { Set<ConstantValue> values = explorationData.getValuesMap(); List<TreeNode> res = new ArrayList<TreeNode>(); @@ -183,6 +219,14 @@ return res; } + /** + * Generate result. + * + * @param explorationData + * the exploration data + * + * @return the tree node + */ private TreeNode generateResult(ExplorationData explorationData) { TreeNode res = new TreeNode(); res.setType(TreeNode.TYPE_DOCUMENT); @@ -192,6 +236,14 @@ return res; } + /** + * Generate components. + * + * @param explorationApplication + * the exploration application + * + * @return the list< tree node> + */ private List<TreeNode> generateComponents( ExplorationApplication explorationApplication) { Set<Component> components = explorationApplication.getComponents(); @@ -204,12 +256,25 @@ return res; } + /** + * Inits the node. + * + * @return the tree node + */ private TreeNode initNode() { TreeNode node = new TreeNode(); node.setType(TreeNode.TYPE_FOLDER); return node; } + /** + * Generate component. + * + * @param component + * the component + * + * @return the tree node + */ private TreeNode generateComponent(Component component) { TreeNode componentNode = new TreeNode(); componentNode.setType(TreeNode.TYPE_FOLDER); @@ -254,6 +319,14 @@ return componentNode; } + /** + * Generate libraries. + * + * @param component + * the component + * + * @return the list< tree node> + */ private List<TreeNode> generateLibraries(Component component) { Set<Library> libraries = component.getLibraries(); @@ -266,6 +339,14 @@ return res; } + /** + * Generate library. + * + * @param library + * the library + * + * @return the tree node + */ private TreeNode generateLibrary(Library library) { TreeNode node = new TreeNode(); node.setType(TreeNode.TYPE_DOCUMENT); @@ -276,6 +357,14 @@ return node; } + /** + * Generate codes. + * + * @param codes + * the codes + * + * @return the list< tree node> + */ private List<TreeNode> generateCodes(Set<Code> codes) { List<TreeNode> res = new ArrayList<TreeNode>(); for (Code code : codes) { @@ -288,6 +377,15 @@ return res; } + /** + * Generate structures. + * + * @param structures + * the structures + * + * @return the list< tree node> + */ + @SuppressWarnings("unused") private List<TreeNode> generateStructures(Set<Structure> structures) { List<TreeNode> res = new ArrayList<TreeNode>(); for (Structure structure : structures) { @@ -299,6 +397,14 @@ return res; } + /** + * Generate constants. + * + * @param constants + * the constants + * + * @return the list< tree node> + */ private List<TreeNode> generateConstants(Set<Constant> constants) { List<TreeNode> res = new ArrayList<TreeNode>(); for (Constant constant : constants) { Modified: trunk/simexplorer-is-web/src/java/fr/cemagref/simexplorer/is/ui/web/pages/ElementExport.java =================================================================== --- trunk/simexplorer-is-web/src/java/fr/cemagref/simexplorer/is/ui/web/pages/ElementExport.java 2008-02-04 15:13:55 UTC (rev 632) +++ trunk/simexplorer-is-web/src/java/fr/cemagref/simexplorer/is/ui/web/pages/ElementExport.java 2008-02-04 15:17:29 UTC (rev 633) @@ -20,7 +20,6 @@ import java.io.InputStream; import java.util.ArrayList; import java.util.List; -import java.util.Map; import java.util.Set; import java.util.StringTokenizer; @@ -31,7 +30,6 @@ import com.healthmarketscience.rmiio.RemoteInputStreamClient; import fr.cemagref.simexplorer.is.attachment.Attachment; -import fr.cemagref.simexplorer.is.attachment.ContentType; import fr.cemagref.simexplorer.is.entities.data.Component; import fr.cemagref.simexplorer.is.entities.data.ExplorationApplication; import fr.cemagref.simexplorer.is.entities.data.ExplorationData; @@ -44,12 +42,24 @@ import fr.cemagref.simexplorer.is.ui.web.tools.XMLAttachment; import fr.cemagref.simexplorer.is.ui.web.tools.ZipAttachment; +/** + * The Class ElementExport. + */ public class ElementExport extends ElementPageDetail { + /* (non-Javadoc) + * @see fr.cemagref.simexplorer.is.ui.web.pages.security.ProtectedPage#getWindowTitle() + */ + @Override public String getWindowTitle() { return ""; } + /** + * On action from download xml. + * + * @return the object + */ public Object onActionFromDownloadXML() { Object response; @@ -70,6 +80,11 @@ return response; } + /** + * On action from download full. + * + * @return the object + */ public Object onActionFromDownloadFull() { Object response; @@ -89,6 +104,14 @@ return response; } + /** + * On download file. + * + * @param context + * the context + * + * @return the object + */ public Object onDownloadFile(String context) { StreamResponse response; @@ -111,7 +134,7 @@ } /** - * Headers of tree grid + * Headers of tree grid. * * @return Headers */ @@ -124,12 +147,22 @@ return result; } + /** + * Gets the nodes. + * + * @return the nodes + */ public List<TreeNode> getNodes() { List<TreeNode> nodes = new ArrayList<TreeNode>(); nodes.add(generateNodes()); return nodes; } + /** + * Generate nodes. + * + * @return the tree node + */ private TreeNode generateNodes() { TreeNode node = null; if (getElement() instanceof ExplorationApplication) { @@ -147,6 +180,11 @@ return node; } + /** + * Generate exploration application. + * + * @return the tree node + */ private TreeNode generateExplorationApplication() { TreeNode node; node = new TreeNode(); @@ -175,6 +213,14 @@ return node; } + /** + * Generate explorations. + * + * @param explorationApplication + * the exploration application + * + * @return the list< tree node> + */ private List<TreeNode> generateExplorations( ExplorationApplication explorationApplication) { List<TreeNode> res = new ArrayList<TreeNode>(); @@ -187,6 +233,14 @@ return res; } + /** + * Generate exploration data. + * + * @param explorationData + * the exploration data + * + * @return the tree node + */ private TreeNode generateExplorationData(ExplorationData explorationData) { TreeNode explorationDataNode = new TreeNode(); explorationDataNode.setType(TreeNode.TYPE_FOLDER); @@ -207,6 +261,14 @@ return explorationDataNode; } + /** + * Generate components. + * + * @param explorationApplication + * the exploration application + * + * @return the list< tree node> + */ private List<TreeNode> generateComponents( ExplorationApplication explorationApplication) { Set<Component> components = explorationApplication.getComponents(); @@ -219,6 +281,14 @@ return res; } + /** + * Generate component. + * + * @param component + * the component + * + * @return the tree node + */ private TreeNode generateComponent(Component component) { TreeNode componentNode = new TreeNode(); componentNode.setType(TreeNode.TYPE_FOLDER); @@ -242,9 +312,16 @@ return componentNode; } + /** + * Generate libraries. + * + * @param libraries + * the libraries + * + * @return the list< tree node> + */ private List<TreeNode> generateLibraries(Set<Library> libraries) { List<TreeNode> res = new ArrayList<TreeNode>(); - int i = 0; for (Library library : libraries) { TreeNode node = generateLibrary(library); res.add(node); @@ -252,6 +329,14 @@ return res; } + /** + * Generate library. + * + * @param library + * the library + * + * @return the tree node + */ private TreeNode generateLibrary(Library library) { TreeNode node = new TreeNode(); node.setType(TreeNode.TYPE_FOLDER); @@ -268,6 +353,16 @@ return node; } + /** + * Generate download. + * + * @param explorationData + * the exploration data + * @param attachment + * the attachment + * + * @return the tree node + */ private TreeNode generateDownload(LoggableElement explorationData, Attachment attachment) { TreeNode node = new TreeNode(); Modified: trunk/simexplorer-is-web/src/java/fr/cemagref/simexplorer/is/ui/web/pages/ElementHistory.java =================================================================== --- trunk/simexplorer-is-web/src/java/fr/cemagref/simexplorer/is/ui/web/pages/ElementHistory.java 2008-02-04 15:13:55 UTC (rev 632) +++ trunk/simexplorer-is-web/src/java/fr/cemagref/simexplorer/is/ui/web/pages/ElementHistory.java 2008-02-04 15:17:29 UTC (rev 633) @@ -22,35 +22,40 @@ import java.util.Comparator; import java.util.List; -import org.apache.tapestry.ComponentResources; -import org.apache.tapestry.Link; import org.apache.tapestry.annotations.Persist; -import org.apache.tapestry.ioc.annotations.Inject; import org.codelutin.tapestry.beans.TreeNode; -import fr.cemagref.simexplorer.is.entities.data.LoggableElement; import fr.cemagref.simexplorer.is.entities.metadata.MetaData; import fr.cemagref.simexplorer.is.entities.metadata.Version; import fr.cemagref.simexplorer.is.ui.web.SimExplorerWebException; import fr.cemagref.simexplorer.is.ui.web.services.RemoteStorageService; +/** + * The Class ElementHistory. + */ public class ElementHistory extends ElementPageDetail { - public class MetadataVersionComparator implements - Comparator<MetaData> { + /** + * The Class MetadataVersionComparator. + */ + public class MetadataVersionComparator implements Comparator<MetaData> { + /* (non-Javadoc) + * @see java.util.Comparator#compare(java.lang.Object, java.lang.Object) + */ public int compare(MetaData arg0, MetaData arg1) { return arg0.getVersion().compareTo(arg1.getVersion()); } } + /** The versions. */ @Persist private MetaData[] versions; - @Inject - private ComponentResources resources; - + /* (non-Javadoc) + * @see fr.cemagref.simexplorer.is.ui.web.pages.ElementPage#setup(java.lang.String, java.lang.String) + */ @Override public void setup(String uuid, String version) { super.setup(uuid, version); @@ -62,12 +67,16 @@ } } + /* (non-Javadoc) + * @see fr.cemagref.simexplorer.is.ui.web.pages.security.ProtectedPage#getWindowTitle() + */ + @Override public String getWindowTitle() { return ""; } /** - * Headers of tree grid + * Headers of tree grid. * * @return Headers */ @@ -79,12 +88,22 @@ return result; } + /** + * Gets the versions. + * + * @return the versions + */ public List<TreeNode> getVersions() { List<TreeNode> nodes = new ArrayList<TreeNode>(); nodes.add(generateNodes()); return nodes; } + /** + * Generate nodes. + * + * @return the tree node + */ private TreeNode generateNodes() { Arrays.sort(versions, new MetadataVersionComparator()); TreeNode rootNode = new TreeNode(); @@ -98,6 +117,16 @@ return rootNode; } + /** + * Insert node. + * + * @param mde + * the mde + * @param pos + * the pos + * @param parent + * the parent + */ private void insertNode(MetaData mde, int pos, TreeNode parent) { List<TreeNode> nodes = parent.getChildren(); if (pos == mde.getVersion().getLength()) { @@ -119,6 +148,18 @@ } } + /** + * Generate folder. + * + * @param mde + * the mde + * @param pos + * the pos + * @param parent + * the parent + * + * @return the tree node + */ private TreeNode generateFolder(MetaData mde, int pos, TreeNode parent) { TreeNode node = new TreeNode(); node.setChildren(new ArrayList<TreeNode>()); @@ -129,6 +170,16 @@ return node; } + /** + * Generate version. + * + * @param version + * the version + * @param pos + * the pos + * + * @return the version + */ private Version generateVersion(Version version, int pos) { Version v = new Version(""); for (int i = 0; i <= pos; i++) { @@ -137,6 +188,14 @@ return v; } + /** + * Generate leaf. + * + * @param mde + * the mde + * + * @return the tree node + */ private TreeNode generateLeaf(MetaData mde) { TreeNode node = new TreeNode(); // FIXME date tostring @@ -148,6 +207,14 @@ return node; } + /** + * Gets the version. + * + * @param treeNode + * the tree node + * + * @return the version + */ private Version getVersion(TreeNode treeNode) { return (Version) treeNode.getObject(); } Modified: trunk/simexplorer-is-web/src/java/fr/cemagref/simexplorer/is/ui/web/pages/ElementImport.java =================================================================== --- trunk/simexplorer-is-web/src/java/fr/cemagref/simexplorer/is/ui/web/pages/ElementImport.java 2008-02-04 15:13:55 UTC (rev 632) +++ trunk/simexplorer-is-web/src/java/fr/cemagref/simexplorer/is/ui/web/pages/ElementImport.java 2008-02-04 15:17:29 UTC (rev 633) @@ -27,14 +27,22 @@ import fr.cemagref.simexplorer.is.ui.web.pages.security.UserPage; import fr.cemagref.simexplorer.is.ui.web.services.RemoteStorageService; +/** + * The Class ElementImport. + */ public class ElementImport extends UserPage { + /** The _file ea. */ @SetterGetter private UploadedFile _fileEA; + /** The _file lib. */ @SetterGetter private UploadedFile _fileLib; + /** + * On success. + */ public void onSuccess() { if (_fileEA != null) { RemoteInputStreamServer zipRemoteStream = new SimpleRemoteInputStream( @@ -58,6 +66,10 @@ } } + /* (non-Javadoc) + * @see fr.cemagref.simexplorer.is.ui.web.pages.security.ProtectedPage#getWindowTitle() + */ + @Override public String getWindowTitle() { return ""; } Modified: trunk/simexplorer-is-web/src/java/fr/cemagref/simexplorer/is/ui/web/pages/ElementList.java =================================================================== --- trunk/simexplorer-is-web/src/java/fr/cemagref/simexplorer/is/ui/web/pages/ElementList.java 2008-02-04 15:13:55 UTC (rev 632) +++ trunk/simexplorer-is-web/src/java/fr/cemagref/simexplorer/is/ui/web/pages/ElementList.java 2008-02-04 15:17:29 UTC (rev 633) @@ -34,26 +34,38 @@ import fr.cemagref.simexplorer.is.ui.web.grid.ElementDataSource; import fr.cemagref.simexplorer.is.ui.web.pages.security.UserPage; +/** + * The Class ElementList. + */ public class ElementList extends UserPage { + /** The model. */ @Retain private BeanModel model; + /** The bean model source. */ @Inject private BeanModelSource beanModelSource; + /** The resources. */ @Inject private ComponentResources resources; + /** The element data source. */ @Persist private ElementDataSource elementDataSource; + /** The _element. */ @SetterGetter private MetaData _element; + /** The element detail. */ @InjectPage private ElementDetail elementDetail; + /** + * Page loaded. + */ void pageLoaded() { model = beanModelSource.create(MetaData.class, true, resources); List<String> wantedProperties = new ArrayList<String>(); @@ -75,10 +87,21 @@ elementDataSource = new ElementDataSource(getToken()); } + /** + * Gets the model. + * + * @return the model + */ public BeanModel getModel() { return model; } + /** + * Search query. + * + * @param query + * the query + */ public void searchQuery(String query) { if (query == null || query.equals("")) { elementDataSource = new ElementDataSource(getToken()); @@ -87,6 +110,11 @@ } } + /** + * Gets the elements. + * + * @return the elements + */ public ElementDataSource getElements() { if (elementDataSource == null) { elementDataSource = new ElementDataSource(getToken()); @@ -94,11 +122,24 @@ return elementDataSource; } + /** + * Gets the detail element context. + * + * @return the detail element context + */ public String getDetailElementContext() { String result = _element.getUuid() + "," + _element.getVersion(); return result; } + /** + * On action from detail element. + * + * @param context + * the context + * + * @return the object + */ public Object onActionFromDetailElement(String context) { StringTokenizer st = new StringTokenizer(context, ","); String uuid = st.nextToken(); @@ -107,6 +148,10 @@ return elementDetail; } + /* (non-Javadoc) + * @see fr.cemagref.simexplorer.is.ui.web.pages.security.ProtectedPage#getWindowTitle() + */ + @Override public String getWindowTitle() { String windowTitle = null; if (elementDataSource.getQuery() != null Modified: trunk/simexplorer-is-web/src/java/fr/cemagref/simexplorer/is/ui/web/pages/ElementPage.java =================================================================== --- trunk/simexplorer-is-web/src/java/fr/cemagref/simexplorer/is/ui/web/pages/ElementPage.java 2008-02-04 15:13:55 UTC (rev 632) +++ trunk/simexplorer-is-web/src/java/fr/cemagref/simexplorer/is/ui/web/pages/ElementPage.java 2008-02-04 15:17:29 UTC (rev 633) @@ -17,9 +17,7 @@ * ##% */ package fr.cemagref.simexplorer.is.ui.web.pages; -import org.apache.tapestry.ComponentResources; import org.apache.tapestry.annotations.Persist; -import org.apache.tapestry.ioc.annotations.Inject; import fr.cemagref.simexplorer.is.entities.data.LoggableElement; import fr.cemagref.simexplorer.is.entities.metadata.MetaData; @@ -27,13 +25,17 @@ import fr.cemagref.simexplorer.is.ui.web.pages.security.UserPage; import fr.cemagref.simexplorer.is.ui.web.services.RemoteStorageService; +/** + * The Class ElementPage. + */ public abstract class ElementPage extends UserPage { + /** The element. */ @Persist private LoggableElement element; /** - * Prepare page + * Prepare page. * * @param uuid * Id of element to display @@ -49,10 +51,20 @@ } } + /** + * Gets the element. + * + * @return the element + */ public LoggableElement getElement() { return element; } + /** + * Gets the metadata. + * + * @return the metadata + */ public MetaData getMetadata() { return element.getMetaData(); } Modified: trunk/simexplorer-is-web/src/java/fr/cemagref/simexplorer/is/ui/web/pages/ElementPageDetail.java =================================================================== --- trunk/simexplorer-is-web/src/java/fr/cemagref/simexplorer/is/ui/web/pages/ElementPageDetail.java 2008-02-04 15:13:55 UTC (rev 632) +++ trunk/simexplorer-is-web/src/java/fr/cemagref/simexplorer/is/ui/web/pages/ElementPageDetail.java 2008-02-04 15:17:29 UTC (rev 633) @@ -26,29 +26,45 @@ import org.apache.tapestry.annotations.InjectPage; import org.apache.tapestry.ioc.annotations.Inject; -import fr.cemagref.simexplorer.is.entities.data.LoggableElement; import fr.cemagref.simexplorer.is.entities.metadata.MetaData; +/** + * The Class ElementPageDetail. + */ public abstract class ElementPageDetail extends ElementPage { + /** The resources. */ @Inject private ComponentResources resources; + /** The element export. */ @InjectPage private ElementExport elementExport; + /** The element history. */ @InjectPage private ElementHistory elementHistory; + /** The element delete. */ @InjectPage private ElementDelete elementDelete; + /** The element rights. */ @InjectPage private ElementRights elementRights; + /** The element detail. */ @InjectPage private ElementDetail elementDetail; + /** + * On export. + * + * @param context + * the context + * + * @return the object + */ public Object onExport(String context) { StringTokenizer st = new StringTokenizer(context, ","); String uuid = st.nextToken(); @@ -57,6 +73,14 @@ return elementExport; } + /** + * On history. + * + * @param context + * the context + * + * @return the object + */ public Object onHistory(String context) { StringTokenizer st = new StringTokenizer(context, ","); String uuid = st.nextToken(); @@ -65,6 +89,14 @@ return elementHistory; } + /** + * On delete. + * + * @param context + * the context + * + * @return the object + */ public Object onDelete(String context) { StringTokenizer st = new StringTokenizer(context, ","); String uuid = st.nextToken(); @@ -73,6 +105,14 @@ return elementDelete; } + /** + * On rights. + * + * @param context + * the context + * + * @return the object + */ public Object onRights(String context) { StringTokenizer st = new StringTokenizer(context, ","); String uuid = st.nextToken(); @@ -81,6 +121,14 @@ return elementRights; } + /** + * On details. + * + * @param context + * the context + * + * @return the object + */ public Object onDetails(String context) { StringTokenizer st = new StringTokenizer(context, ","); String uuid = st.nextToken(); @@ -89,6 +137,18 @@ return elementDetail; } + /** + * Generate string. + * + * @param actionCaption + * the action caption + * @param action + * the action + * @param context + * the context + * + * @return the string + */ protected String generateString(String actionCaption, String action, String context) { Link link = resources.createActionLink(action, false, context); @@ -101,12 +161,36 @@ return sb.toString(); } + /** + * Generate string. + * + * @param actionCaption + * the action caption + * @param action + * the action + * @param element + * the element + * + * @return the string + */ protected String generateString(String actionCaption, String action, MetaData element) { String context = element.getUuid() + "," + element.getVersion(); return generateString(actionCaption, action, context); } + /** + * Generate actions. + * + * @param element + * the element + * @param security + * the security + * @param actions + * the actions + * + * @return the string + */ private String generateActions(MetaData element, boolean security, String... actions) { StringBuilder sb = new StringBuilder(""); @@ -125,6 +209,24 @@ return res; } + /** + * Generate string array. + * + * @param s1 + * the s1 + * @param s2 + * the s2 + * @param s3 + * the s3 + * @param element + * the element + * @param security + * the security + * @param actions + * the actions + * + * @return the string[] + */ protected String[] generateStringArray(String s1, String s2, String s3, MetaData element, boolean security, String... actions) { List<String> result = new ArrayList<String>(); @@ -140,6 +242,14 @@ return result.toArray(new String[result.size()]); } + /** + * Generate string array. + * + * @param s + * the s + * + * @return the string[] + */ protected String[] generateStringArray(String... s) { return s; } Modified: trunk/simexplorer-is-web/src/java/fr/cemagref/simexplorer/is/ui/web/pages/ElementRights.java =================================================================== --- trunk/simexplorer-is-web/src/java/fr/cemagref/simexplorer/is/ui/web/pages/ElementRights.java 2008-02-04 15:13:55 UTC (rev 632) +++ trunk/simexplorer-is-web/src/java/fr/cemagref/simexplorer/is/ui/web/pages/ElementRights.java 2008-02-04 15:17:29 UTC (rev 633) @@ -36,41 +36,66 @@ import fr.cemagref.simexplorer.is.ui.web.services.RemoteSecurityService; import fr.cemagref.simexplorer.is.ui.web.services.UserValueEncoder; +/** + * The Class ElementRights. + */ public class ElementRights extends ElementPage { + /** The user encoder. */ @Persist private UserValueEncoder userEncoder; + /** The group encoder. */ @Persist private GroupValueEncoder groupEncoder; + /** The owner users. */ @Persist private List<User> ownerUsers; + + /** The owner groups. */ @Persist private List<Group> ownerGroups; + /** The read users. */ @Persist private List<User> readUsers; + + /** The read groups. */ @Persist private List<Group> readGroups; + /** The write users. */ @Persist private List<User> writeUsers; + + /** The write groups. */ @Persist private List<Group> writeGroups; + /** The admin users. */ @Persist private List<User> adminUsers; + + /** The admin groups. */ @Persist private List<Group> adminGroups; + /** The element detail. */ @InjectPage private ElementDetail elementDetail; + /* (non-Javadoc) + * @see fr.cemagref.simexplorer.is.ui.web.pages.security.ProtectedPage#getWindowTitle() + */ + @Override public String getWindowTitle() { return ""; } + /* (non-Javadoc) + * @see fr.cemagref.simexplorer.is.ui.web.pages.ElementPage#setup(java.lang.String, java.lang.String) + */ @Override public void setup(String uuid, String version) { super.setup(uuid, version); @@ -127,6 +152,16 @@ } + /** + * Gets the permission. + * + * @param actor + * the actor + * @param permissions + * the permissions + * + * @return the permission + */ private Permission getPermission(Actor actor, Map<Actor, Permission> permissions) { Permission permission = permissions.get(actor); @@ -143,6 +178,11 @@ return permission; } + /** + * On success. + * + * @return the object + */ public Object onSuccess() { Map<Actor, Permission> permissions = new HashMap<Actor, Permission>(); @@ -181,6 +221,11 @@ return elementDetail; } + /** + * Gets the users. + * + * @return the users + */ public List<User> getUsers() { List<User> result = new ArrayList<User>(); try { @@ -193,6 +238,11 @@ return result; } + /** + * Gets the groups. + * + * @return the groups + */ public List<Group> getGroups() { List<Group> result = new ArrayList<Group>(); try { @@ -206,74 +256,172 @@ return result; } + /** + * Gets the owner users. + * + * @return the owner users + */ public List<User> getOwnerUsers() { return ownerUsers; } + /** + * Sets the owner users. + * + * @param ownerUsers + * the new owner users + */ public void setOwnerUsers(List<User> ownerUsers) { this.ownerUsers = ownerUsers; } + /** + * Gets the read users. + * + * @return the read users + */ public List<User> getReadUsers() { return readUsers; } + /** + * Sets the read users. + * + * @param readUsers + * the new read users + */ public void setReadUsers(List<User> readUsers) { this.readUsers = readUsers; } + /** + * Gets the read groups. + * + * @return the read groups + */ public List<Group> getReadGroups() { return readGroups; } + /** + * Sets the read groups. + * + * @param readGroups + * the new read groups + */ public void setReadGroups(List<Group> readGroups) { this.readGroups = readGroups; } + /** + * Gets the write users. + * + * @return the write users + */ public List<User> getWriteUsers() { return writeUsers; } + /** + * Sets the write users. + * + * @param writeUsers + * the new write users + */ public void setWriteUsers(List<User> writeUsers) { this.writeUsers = writeUsers; } + /** + * Gets the write groups. + * + * @return the write groups + */ public List<Group> getWriteGroups() { return writeGroups; } + /** + * Sets the write groups. + * + * @param writeGroups + * the new write groups + */ public void setWriteGroups(List<Group> writeGroups) { this.writeGroups = writeGroups; } + /** + * Gets the admin users. + * + * @return the admin users + */ public List<User> getAdminUsers() { return adminUsers; } + /** + * Sets the admin users. + * + * @param adminUsers + * the new admin users + */ public void setAdminUsers(List<User> adminUsers) { this.adminUsers = adminUsers; } + /** + * Gets the admin groups. + * + * @return the admin groups + */ public List<Group> getAdminGroups() { return adminGroups; } + /** + * Sets the admin groups. + * + * @param adminGroups + * the new admin groups + */ public void setAdminGroups(List<Group> adminGroups) { this.adminGroups = adminGroups; } + /** + * Gets the user encoder. + * + * @return the user encoder + */ public UserValueEncoder getUserEncoder() { return userEncoder; } + /** + * Gets the group encoder. + * + * @return the group encoder + */ public GroupValueEncoder getGroupEncoder() { return groupEncoder; } + /** + * Gets the owner groups. + * + * @return the owner groups + */ public List<Group> getOwnerGroups() { return ownerGroups; } + /** + * Sets the owner groups. + * + * @param ownerGroups + * the new owner groups + */ public void setOwnerGroups(List<Group> ownerGroups) { this.ownerGroups = ownerGroups; } Modified: trunk/simexplorer-is-web/src/java/fr/cemagref/simexplorer/is/ui/web/pages/ExceptionReport.java =================================================================== --- trunk/simexplorer-is-web/src/java/fr/cemagref/simexplorer/is/ui/web/pages/ExceptionReport.java 2008-02-04 15:13:55 UTC (rev 632) +++ trunk/simexplorer-is-web/src/java/fr/cemagref/simexplorer/is/ui/web/pages/ExceptionReport.java 2008-02-04 15:17:29 UTC (rev 633) @@ -17,7 +17,6 @@ * ##% */ package fr.cemagref.simexplorer.is.ui.web.pages; -import java.io.FileNotFoundException; import java.util.List; import org.apache.tapestry.ioc.annotations.Inject; @@ -27,76 +26,117 @@ import org.apache.tapestry.services.ExceptionReporter; import de.hsofttec.t5components.annotations.SetterGetter; - import fr.cemagref.simexplorer.is.ui.web.SimExplorerWebException; +/** + * The Class ExceptionReport. + */ public class ExceptionReport implements ExceptionReporter { + /** The _unknown. */ @SetterGetter(onlyGetter = true) private boolean _unknown; + /** The exception. */ private SimExplorerWebException exception; + /** The _stack. */ + @SuppressWarnings("unused") @SetterGetter(onlyGetter = true) private List<ExceptionInfo> _stack; + /** The _info. */ @SetterGetter private ExceptionInfo _info; + /** The _property name. */ @SetterGetter private String _propertyName; + /** The _frame. */ + @SuppressWarnings("unused") @SetterGetter private String _frame; + /** The analyzer. */ @Inject private ExceptionAnalyzer analyzer; + /** + * Gets the window title. + * + * @return the window title + */ public String getWindowTitle() { return "Error"; } - public void reportException(Throwable exception) { - SimExplorerWebException simException = getException(exception); + /* (non-Javadoc) + * @see org.apache.tapestry.services.ExceptionReporter#reportException(java.lang.Throwable) + */ + public void reportException(Throwable exceptionReported) { + SimExplorerWebException simException = getException(exceptionReported); if (simException != null) { _unknown = false; this.exception = simException; _unknown = true; - ExceptionAnalysis analysis = analyzer.analyze(exception); + ExceptionAnalysis analysis = analyzer.analyze(exceptionReported); _stack = analysis.getExceptionInfos(); } else { _unknown = true; - ExceptionAnalysis analysis = analyzer.analyze(exception); + ExceptionAnalysis analysis = analyzer.analyze(exceptionReported); _stack = analysis.getExceptionInfos(); } } - private SimExplorerWebException getException(Throwable exception) { - if (exception != null) { - if (exception instanceof SimExplorerWebException) { - SimExplorerWebException result = (SimExplorerWebException) exception; + /** + * Gets the exception. + * + * @param exceptionReported + * the exception reported + * + * @return the exception + */ + private SimExplorerWebException getException(Throwable exceptionReported) { + if (exceptionReported != null) { + if (exceptionReported instanceof SimExplorerWebException) { + SimExplorerWebException result = (SimExplorerWebException) exceptionReported; return result; } - return getException(exception.getCause()); + return getException(exceptionReported.getCause()); } return null; } + /** + * Gets the error message. + * + * @return the error message + */ public String getErrorMessage() { if (!_unknown) { return exception.getMessage(); - } else { - return ""; } + return ""; } + /** + * Gets the show property list. + * + * @return the show property list + */ public boolean getShowPropertyList() { // True if either is non-empty return !(_info.getPropertyNames().isEmpty() && _info.getStackTrace() .isEmpty()); } + /** + * Gets the property value. + * + * @return the property value + */ public Object getPropertyValue() { return _info.getProperty(_propertyName); } Modified: trunk/simexplorer-is-web/src/java/fr/cemagref/simexplorer/is/ui/web/pages/GroupEdit.java =================================================================== --- trunk/simexplorer-is-web/src/java/fr/cemagref/simexplorer/is/ui/web/pages/GroupEdit.java 2008-02-04 15:13:55 UTC (rev 632) +++ trunk/simexplorer-is-web/src/java/fr/cemagref/simexplorer/is/ui/web/pages/GroupEdit.java 2008-02-04 15:17:29 UTC (rev 633) @@ -34,30 +34,49 @@ import fr.cemagref.simexplorer.is.ui.web.services.RemoteSecurityService; import fr.cemagref.simexplorer.is.ui.web.services.UserValueEncoder; +/** + * The Class GroupEdit. + */ public class GroupEdit extends AdminPage { + /** The group. */ @Persist private Group group; + /** The group list. */ @InjectPage private GroupList groupList; + /** The users in group. */ @Persist private List<User> usersInGroup; + /** The groups in group. */ @Persist private List<Group> groupsInGroup; + /** The user encoder. */ @Persist private UserValueEncoder userEncoder; + /** The group encoder. */ @Persist private GroupValueEncoder groupEncoder; + /* (non-Javadoc) + * @see fr.cemagref.simexplorer.is.ui.web.pages.security.ProtectedPage#getWindowTitle() + */ + @Override public String getWindowTitle() { return ""; } + /** + * Sets the up. + * + * @param groupId + * the new up + */ void setup(int groupId) { this.usersInGroup = new ArrayList<User>(); this.groupsInGroup = new ArrayList<Group>(); @@ -87,6 +106,11 @@ groupEncoder = new GroupValueEncoder(getToken()); } + /** + * On success. + * + * @return the object + */ public Object onSuccess() { try { if (group.getId() == null) { @@ -108,8 +132,8 @@ Integer[] groupsIds = new Integer[groupsInGroup.size()]; i = 0; - for (Group group : groupsInGroup) { - groupsIds[i] = group.getId(); + for (Group aGroup : groupsInGroup) { + groupsIds[i] = aGroup.getId(); i++; } RemoteSecurityService.getAuthentificationService() @@ -121,10 +145,20 @@ return groupList; } + /** + * On action from cancel. + * + * @return the object + */ public Object onActionFromCancel() { return groupList; } + /** + * Gets the users. + * + * @return the users + */ public List<User> getUsers() { List<User> result = new ArrayList<User>(); try { @@ -137,6 +171,11 @@ return result; } + /** + * Gets the groups. + * + * @return the groups + */ public List<Group> getGroups() { List<Group> result = new ArrayList<Group>(); try { @@ -150,50 +189,114 @@ return result; } - public ValueEncoder getUserEncoder() { + /** + * Gets the user encoder. + * + * @return the user encoder + */ + public ValueEncoder<User> getUserEncoder() { return userEncoder; } - public ValueEncoder getGroupEncoder() { + /** + * Gets the group encoder. + * + * @return the group encoder + */ + public ValueEncoder<Group> getGroupEncoder() { return groupEncoder; } + /** + * Gets the super admin. + * + * @return the super admin + */ public boolean getSuperAdmin() { return isUserSuperAdmin(); } + /** + * Gets the users in group. + * + * @return the users in group + */ public List<User> getUsersInGroup() { return usersInGroup; } + /** + * Sets the users in group. + * + * @param usersInGroup + * the new users in group + */ public void setUsersInGroup(List<User> usersInGroup) { this.usersInGroup = usersInGroup; } + /** + * Gets the group. + * + * @return the group + */ public Group getGroup() { return group; } + /** + * Gets the group list. + * + * @return the group list + */ public GroupList getGroupList() { return groupList; } + /** + * Sets the group list. + * + * @param groupList + * the new group list + */ public void setGroupList(GroupList groupList) { this.groupList = groupList; } + /** + * Gets the groups in group. + * + * @return the groups in group + */ public List<Group> getGroupsInGroup() { return groupsInGroup; } + /** + * Sets the groups in group. + * + * @param groupsInGroup + * the new groups in group + */ public void setGroupsInGroup(List<Group> groupsInGroup) { this.groupsInGroup = groupsInGroup; } + /** + * Gets the owner. + * + * @return the owner + */ public User getOwner() { return this.group.getOwner(); } + /** + * Sets the owner. + * + * @param owner + * the new owner + */ public void setOwner(User owner) { this.group.setOwner(owner); } Modified: trunk/simexplorer-is-web/src/java/fr/cemagref/simexplorer/is/ui/web/pages/GroupList.java =================================================================== --- trunk/simexplorer-is-web/src/java/fr/cemagref/simexplorer/is/ui/web/pages/GroupList.java 2008-02-04 15:13:55 UTC (rev 632) +++ trunk/simexplorer-is-web/src/java/fr/cemagref/simexplorer/is/ui/web/pages/GroupList.java 2008-02-04 15:17:29 UTC (rev 633) @@ -28,34 +28,49 @@ import org.apache.tapestry.services.BeanModelSource; import de.hsofttec.t5components.annotations.SetterGetter; - import fr.cemagref.simexplorer.is.security.entities.Group; import fr.cemagref.simexplorer.is.service.SimExplorerServiceException; import fr.cemagref.simexplorer.is.ui.web.SimExplorerWebException; import fr.cemagref.simexplorer.is.ui.web.pages.security.AdminPage; import fr.cemagref.simexplorer.is.ui.web.services.RemoteSecurityService; +/** + * The Class GroupList. + */ public class GroupList extends AdminPage { + /** The model. */ @Retain private BeanModel model; + /** The _group. */ + @SuppressWarnings("unused") @SetterGetter private Group _group; + /** The bean model source. */ @Inject private BeanModelSource beanModelSource; + /** The resources. */ @Inject private ComponentResources resources; + /** The group edit. */ @InjectPage private GroupEdit groupEdit; + /* (non-Javadoc) + * @see fr.cemagref.simexplorer.is.ui.web.pages.security.ProtectedPage#getWindowTitle() + */ + @Override public String getWindowTitle() { return ""; } - + + /** + * Page loaded. + */ void pageLoaded() { model = beanModelSource.create(Group.class, true, resources); List<String> wantedProperties = new ArrayList<String>(); @@ -70,6 +85,11 @@ model.add("delete", null); } + /** + * Gets the groups. + * + * @return the groups + */ public Group[] getGroups() { Group[] groups; @@ -90,6 +110,14 @@ return groups; } + /** + * On action from delete. + * + * @param context + * the context + * + * @return the object + */ public Object onActionFromDelete(Integer context) { try { RemoteSecurityService.getAuthentificationService().deleteGroup( @@ -100,24 +128,53 @@ return null; } + /** + * On action from edit. + * + * @param context + * the context + * + * @return the object + */ public Object onActionFromEdit(Integer context) { groupEdit.setup(context); return groupEdit; } + /** + * On action from add. + * + * @return the object + */ public Object onActionFromAdd() { groupEdit.setup(-1); return groupEdit; } + /** + * Gets the model. + * + * @return the model + */ public BeanModel getModel() { return model; } + /** + * Gets the group edit. + * + * @return the group edit + */ public GroupEdit getGroupEdit() { return groupEdit; } + /** + * Sets the group edit. + * + * @param groupEdit + * the new group edit + */ public void setGroupEdit(GroupEdit groupEdit) { this.groupEdit = groupEdit; } Modified: trunk/simexplorer-is-web/src/java/fr/cemagref/simexplorer/is/ui/web/pages/Install.java =================================================================== --- trunk/simexplorer-is-web/src/java/fr/cemagref/simexplorer/is/ui/web/pages/Install.java 2008-02-04 15:13:55 UTC (rev 632) +++ trunk/simexplorer-is-web/src/java/fr/cemagref/simexplorer/is/ui/web/pages/Install.java 2008-02-04 15:17:29 UTC (rev 633) @@ -43,16 +43,28 @@ import fr.cemagref.simexplorer.is.ui.web.pages.security.SuperAdminPage; import fr.cemagref.simexplorer.is.ui.web.services.RemoteStorageService; +/** + * The Class Install. + */ public class Install extends SuperAdminPage { + /** The element list. */ @InjectPage private ElementList elementList; + /* (non-Javadoc) + * @see fr.cemagref.simexplorer.is.ui.web.pages.security.ProtectedPage#getWindowTitle() + */ @Override public String getWindowTitle() { return ""; } + /** + * On action from generate data. + * + * @return the object + */ public Object onActionFromGenerateData() { ElementGenerator elementGenerator = new ElementGenerator(); Modified: trunk/simexplorer-is-web/src/java/fr/cemagref/simexplorer/is/ui/web/pages/Login.java =================================================================== --- trunk/simexplorer-is-web/src/java/fr/cemagref/simexplorer/is/ui/web/pages/Login.java 2008-02-04 15:13:55 UTC (rev 632) +++ trunk/simexplorer-is-web/src/java/fr/cemagref/simexplorer/is/ui/web/pages/Login.java 2008-02-04 15:17:29 UTC (rev 633) @@ -25,18 +25,31 @@ import fr.cemagref.simexplorer.is.ui.web.SimExplorerWebException; import fr.cemagref.simexplorer.is.ui.web.services.RemoteSecurityService; +/** + * The Class Login. + */ public class Login { + /** The user. */ @Persist private String user; + + /** The password. */ private String password; + /** The element list. */ @InjectPage private ElementList elementList; + /** The token. */ @ApplicationState private String token; + /** + * On success. + * + * @return the object + */ public Object onSuccess() { Object result = null; try { @@ -52,26 +65,58 @@ return result; } + /** + * Gets the user. + * + * @return the user + */ public String getUser() { return user; } + /** + * Sets the user. + * + * @param user + * the new user + */ public void setUser(String user) { this.user = user; } + /** + * Gets the password. + * + * @return the password + */ public String getPassword() { return password; } + /** + * Sets the password. + * + * @param password + * the new password + */ public void setPassword(String password) { this.password = password; } + /** + * Gets the element list. + * + * @return the element list + */ public ElementList getElementList() { return elementList; } + /** + * Gets the window title. + * + * @return the window title + */ public String getWindowTitle() { return "Login"; } Modified: trunk/simexplorer-is-web/src/java/fr/cemagref/simexplorer/is/ui/web/pages/UserEdit.java =================================================================== --- trunk/simexplorer-is-web/src/java/fr/cemagref/simexplorer/is/ui/web/pages/UserEdit.java 2008-02-04 15:13:55 UTC (rev 632) +++ trunk/simexplorer-is-web/src/java/fr/cemagref/simexplorer/is/ui/web/pages/UserEdit.java 2008-02-04 15:17:29 UTC (rev 633) @@ -40,36 +40,55 @@ import fr.cemagref.simexplorer.is.ui.web.services.GroupValueEncoder; import fr.cemagref.simexplorer.is.ui.web.services.RemoteSecurityService; +/** + * The Class UserEdit. + */ public class UserEdit extends AdminPage { + /** The user. */ @Persist private User user; + /** The user list. */ @InjectPage private UserList userList; + /** The groups of user. */ @Persist private List<Group> groupsOfUser; + /** The group encoder. */ @Persist private GroupValueEncoder groupEncoder; + /** The group model. */ @Retain private BeanModel groupModel; + /** The bean model source. */ @Inject private BeanModelSource beanModelSource; + /** The resources. */ @Inject private ComponentResources resources; + /** The _group. */ + @SuppressWarnings("unused") @SetterGetter private Group _group; + /* (non-Javadoc) + * @see fr.cemagref.simexplorer.is.ui.web.pages.security.ProtectedPage#getWindowTitle() + */ + @Override public String getWindowTitle() { return ""; } + /** + * Page loaded. + */ void pageLoaded() { groupModel = beanModelSource.create(Group.class, true, resources); List<String> wantedProperties = new ArrayList<String>(); @@ -82,6 +101,12 @@ } } + /** + * Sets the up. + * + * @param userId + * the new up + */ void setup(int userId) { this.groupsOfUser = new ArrayList<Group>(); if (userId == -1) { @@ -102,6 +127,11 @@ groupEncoder = new GroupValueEncoder(getToken()); } + /** + * On success. + * + * @return the object + */ public Object onSuccess() { try { if (user.getId() == null) { @@ -127,6 +157,11 @@ return userList; } + /** + * Gets the groups. + * + * @return the groups + */ public List<Group> getGroups() { Group[] groups; try { @@ -140,51 +175,102 @@ return result; } + /** + * Gets the owned groups. + * + * @return the owned groups + */ public Group[] getOwnedGroups() { try { if (user.getId() == null) { return new Group[0]; - } else { - return RemoteSecurityService.getAuthentificationService() - .getGroupsOwnedBy(getToken(), user); } + return RemoteSecurityService.getAuthentificationService() + .getGroupsOwnedBy(getToken(), user); } catch (SimExplorerServiceException e) { throw new SimExplorerWebException(e); } } - public ValueEncoder getGroupEncoder() { + /** + * Gets the group encoder. + * + * @return the group encoder + */ + public ValueEncoder<Group> getGroupEncoder() { return groupEncoder; } + /** + * Gets the creating. + * + * @return the creating + */ public boolean getCreating() { return (user.getId() == null); } + /** + * On action from cancel. + * + * @return the object + */ public Object onActionFromCancel() { return userList; } + /** + * Gets the user list. + * + * @return the user list + */ public UserList getUserList() { return userList; } + /** + * Sets the user list. + * + * @param userList + * the new user list + */ public void setUserList(UserList userList) { this.userList = userList; } + /** + * Gets the user. + * + * @return the user + */ public User getUser() { return user; } + /** + * Gets the groups of user. + * + * @return the groups of user + */ public List<Group> getGroupsOfUser() { return groupsOfUser; } + /** + * Sets the groups of user. + * + * @param groupsOfUser + * the new groups of user + */ public void setGroupsOfUser(List<Group> groupsOfUser) { this.groupsOfUser = groupsOfUser; } + /** + * Gets the group model. + * + * @return the group model + */ public BeanModel getGroupModel() { return groupModel; } Modified: trunk/simexplorer-is-web/src/java/fr/cemagref/simexplorer/is/ui/web/pages/UserList.java =================================================================== --- trunk/simexplorer-is-web/src/java/fr/cemagref/simexplorer/is/ui/web/pages/UserList.java 2008-02-04 15:13:55 UTC (rev 632) +++ trunk/simexplorer-is-web/src/java/fr/cemagref/simexplorer/is/ui/web/pages/UserList.java 2008-02-04 15:17:29 UTC (rev 633) @@ -35,27 +35,43 @@ import fr.cemagref.simexplorer.is.ui.web.pages.security.AdminPage; import fr.cemagref.simexplorer.is.ui.web.services.RemoteSecurityService; +/** + * The Class UserList. + */ public class UserList extends AdminPage { + /** The model. */ @Retain private BeanModel model; + /** The _user. */ + @SuppressWarnings("unused") @SetterGetter private User _user; + /** The bean model source. */ @Inject private BeanModelSource beanModelSource; + /** The resources. */ @Inject private ComponentResources resources; + /** The user edit. */ @InjectPage private UserEdit userEdit; + /* (non-Javadoc) + * @see fr.cemagref.simexplorer.is.ui.web.pages.security.ProtectedPage#getWindowTitle() + */ + @Override public String getWindowTitle() { return ""; } + /** + * Page loaded. + */ void pageLoaded() { model = beanModelSource.create(User.class, true, resources); List<String> wantedProperties = new ArrayList<String>(); @@ -74,6 +90,11 @@ model.add("delete", null); } + /** + * Gets the users. + * + * @return the users + */ public User[] getUsers() { User[] users; try { @@ -86,6 +107,14 @@ return users; } + /** + * On action from delete. + * + * @param context + * the context + * + * @return the object + */ public Object onActionFromDelete(Integer context) { try { RemoteSecurityService.getAuthentificationService().deleteUser( @@ -96,24 +125,53 @@ return null; } + /** + * On action from edit. + * + * @param context + * the context + * + * @return the object + */ public Object onActionFromEdit(Integer context) { userEdit.setup(context); return userEdit; } + /** + * On action from add. + * + * @return the object + */ public Object onActionFromAdd() { userEdit.setup(-1); return userEdit; } + /** + * Gets the user edit. + * + * @return the user edit + */ public UserEdit getUserEdit() { return userEdit; } + /** + * Sets the user edit. + * + * @param userEdit + * the new user edit + */ public void setUserEdit(UserEdit userEdit) { this.userEdit = userEdit; } + /** + * Gets the model. + * + * @return the model + */ public BeanModel getModel() { return model; } Modified: trunk/simexplorer-is-web/src/java/fr/cemagref/simexplorer/is/ui/web/pages/security/AdminPage.java =================================================================== --- trunk/simexplorer-is-web/src/java/fr/cemagref/simexplorer/is/ui/web/pages/security/AdminPage.java 2008-02-04 15:13:55 UTC (rev 632) +++ trunk/simexplorer-is-web/src/java/fr/cemagref/simexplorer/is/ui/web/pages/security/AdminPage.java 2008-02-04 15:17:29 UTC (rev 633) @@ -17,11 +17,17 @@ * ##% */ package fr.cemagref.simexplorer.is.ui.web.pages.security; +/** + * The Class AdminPage. + */ public abstract class AdminPage extends ProtectedPage { + /* (non-Javadoc) + * @see fr.cemagref.simexplorer.is.ui.web.pages.security.ProtectedPage#hasAccessToPage() + */ @Override public boolean hasAccessToPage() { return isUserAdmin(); } - + } Modified: trunk/simexplorer-is-web/src/java/fr/cemagref/simexplorer/is/ui/web/pages/security/ProtectedPage.java =================================================================== --- trunk/simexplorer-is-web/src/java/fr/cemagref/simexplorer/is/ui/web/pages/security/ProtectedPage.java 2008-02-04 15:13:55 UTC (rev 632) +++ trunk/simexplorer-is-web/src/java/fr/cemagref/simexplorer/is/ui/web/pages/security/ProtectedPage.java 2008-02-04 15:17:29 UTC (rev 633) @@ -25,23 +25,36 @@ import fr.cemagref.simexplorer.is.ui.web.SimExplorerWebException; import fr.cemagref.simexplorer.is.ui.web.services.RemoteSecurityService; +/** + * The Class ProtectedPage. + */ public abstract class ProtectedPage { + /** The token. */ @ApplicationState private String token; + /** The user. */ @Persist private User user; + /** The user logged. */ @Persist private boolean userLogged; + /** The user admin. */ @Persist private boolean userAdmin; + /** The user super admin. */ @Persist private boolean userSuperAdmin; + /** + * On activate. + * + * @return the object + */ Object onActivate() { getUserRights(); if (!userLogged) @@ -51,6 +64,10 @@ return null; } + /** + * Gets the user rights. + * + */ private void getUserRights() { user = computeUserLogged(); if (user != null) { @@ -64,10 +81,20 @@ } } + /** + * Gets the token. + * + * @return the token + */ public String getToken() { return token; } + /** + * Compute user logged. + * + * @return the user + */ private User computeUserLogged() { User loggedUser = null; if (token != null) { @@ -81,22 +108,52 @@ return loggedUser; } + /** + * Checks for access to page. + * + * @return true, if successful + */ abstract boolean hasAccessToPage(); + /** + * Gets the window title. + * + * @return the window title + */ public abstract String getWindowTitle(); + /** + * Gets the user logged. + * + * @return the user logged + */ public User getUserLogged() { return user; } + /** + * Checks if is user logged. + * + * @return true, if is user logged + */ public boolean isUserLogged() { return userLogged; } + /** + * Checks if is user admin. + * + * @return true, if is user admin + */ public boolean isUserAdmin() { return userAdmin; } + /** + * Checks if is user super admin. + * + * @return true, if is user super admin + */ public boolean isUserSuperAdmin() { return userSuperAdmin; } Modified: trunk/simexplorer-is-web/src/java/fr/cemagref/simexplorer/is/ui/web/pages/security/SuperAdminPage.java =================================================================== --- trunk/simexplorer-is-web/src/java/fr/cemagref/simexplorer/is/ui/web/pages/security/SuperAdminPage.java 2008-02-04 15:13:55 UTC (rev 632) +++ trunk/simexplorer-is-web/src/java/fr/cemagref/simexplorer/is/ui/web/pages/security/SuperAdminPage.java 2008-02-04 15:17:29 UTC (rev 633) @@ -17,8 +17,14 @@ * ##% */ package fr.cemagref.simexplorer.is.ui.web.pages.security; +/** + * The Class SuperAdminPage. + */ public abstract class SuperAdminPage extends ProtectedPage { + /* (non-Javadoc) + * @see fr.cemagref.simexplorer.is.ui.web.pages.security.ProtectedPage#hasAccessToPage() + */ @Override public boolean hasAccessToPage() { return isUserSuperAdmin(); Modified: trunk/simexplorer-is-web/src/java/fr/cemagref/simexplorer/is/ui/web/pages/security/UserPage.java =================================================================== --- trunk/simexplorer-is-web/src/java/fr/cemagref/simexplorer/is/ui/web/pages/security/UserPage.java 2008-02-04 15:13:55 UTC (rev 632) +++ trunk/simexplorer-is-web/src/java/fr/cemagref/simexplorer/is/ui/web/pages/security/UserPage.java 2008-02-04 15:17:29 UTC (rev 633) @@ -17,8 +17,14 @@ * ##% */ package fr.cemagref.simexplorer.is.ui.web.pages.security; +/** + * The Class UserPage. + */ public abstract class UserPage extends ProtectedPage { + /* (non-Javadoc) + * @see fr.cemagref.simexplorer.is.ui.web.pages.security.ProtectedPage#hasAccessToPage() + */ @Override public boolean hasAccessToPage() { return isUserLogged(); Modified: trunk/simexplorer-is-web/src/java/fr/cemagref/simexplorer/is/ui/web/services/AppModule.java =================================================================== --- trunk/simexplorer-is-web/src/java/fr/cemagref/simexplorer/is/ui/web/services/AppModule.java 2008-02-04 15:13:55 UTC (rev 632) +++ trunk/simexplorer-is-web/src/java/fr/cemagref/simexplorer/is/ui/web/services/AppModule.java 2008-02-04 15:17:29 UTC (rev 633) @@ -19,7 +19,6 @@ import java.io.IOException; -import org.apache.tapestry.internal.services.GenericValueEncoderFactory; import org.apache.tapestry.ioc.MappedConfiguration; import org.apache.tapestry.ioc.OrderedConfiguration; import org.apache.tapestry.ioc.ServiceBinder; @@ -31,10 +30,17 @@ import org.apache.tapestry.services.ValueEncoderFactory; import org.slf4j.Logger; -import fr.cemagref.simexplorer.is.security.entities.Group; -import fr.cemagref.simexplorer.is.security.entities.User; +/** + * The Class AppModule. + */ +public class AppModule { -public class AppModule { + /** + * Bind. + * + * @param binder + * the binder + */ public static void bind(ServiceBinder binder) { /* binder.bind(RemoteStorageService.class, RemoteStorageServiceImpl.class); @@ -47,12 +53,25 @@ // invoking the constructor. } + /** + * Contribute application defaults. + * + * @param configuration + * the configuration + */ public static void contributeApplicationDefaults( MappedConfiguration<String, String> configuration) { configuration.add("tapestry.supported-locales", "en"); configuration.add("tapestry.supported-locales", "fr"); } + /** + * Contribute value encoder source. + * + * @param configuration + * the configuration + */ + @SuppressWarnings("unchecked") public static void contributeValueEncoderSource( MappedConfiguration<Class, ValueEncoderFactory> configuration) { /* @@ -81,6 +100,11 @@ * the service interface and would be "RequestFilter". Since Tapestry * already defines a service named "RequestFilter" we use an explicit * service id that we can reference inside the contribution method. + * + * @param log + * the log + * + * @return the request filter */ public RequestFilter buildTimingFilter(final Logger log) { return new RequestFilter() { @@ -109,6 +133,11 @@ * This is a contribution to the RequestHandler service configuration. This * is how we extend Tapestry using the timing filter. A common use for this * kind of filter is transaction management or security. + * + * @param configuration + * the configuration + * @param filter + * the filter */ public void contributeRequestHandler( OrderedConfiguration<RequestFilter> configuration, Modified: trunk/simexplorer-is-web/src/java/fr/cemagref/simexplorer/is/ui/web/services/GroupValueEncoder.java =================================================================== --- trunk/simexplorer-is-web/src/java/fr/cemagref/simexplorer/is/ui/web/services/GroupValueEncoder.java 2008-02-04 15:13:55 UTC (rev 632) +++ trunk/simexplorer-is-web/src/java/fr/cemagref/simexplorer/is/ui/web/services/GroupValueEncoder.java 2008-02-04 15:17:29 UTC (rev 633) @@ -23,19 +23,35 @@ import fr.cemagref.simexplorer.is.service.SimExplorerServiceException; import fr.cemagref.simexplorer.is.ui.web.SimExplorerWebException; +/** + * The Class GroupValueEncoder. + */ public class GroupValueEncoder implements ValueEncoder<Group> { + /** The token. */ private String token; + /** + * Instantiates a new group value encoder. + * + * @param token + * the token + */ public GroupValueEncoder(String token) { super(); this.token = token; } + /* (non-Javadoc) + * @see org.apache.tapestry.ValueEncoder#toClient(java.lang.Object) + */ public String toClient(Group arg0) { return Integer.toString(arg0.getId()); } + /* (non-Javadoc) + * @see org.apache.tapestry.ValueEncoder#toValue(java.lang.String) + */ public Group toValue(String arg0) { Group group = null; try { Modified: trunk/simexplorer-is-web/src/java/fr/cemagref/simexplorer/is/ui/web/services/RemoteSecurityService.java =================================================================== --- trunk/simexplorer-is-web/src/java/fr/cemagref/simexplorer/is/ui/web/services/RemoteSecurityService.java 2008-02-04 15:13:55 UTC (rev 632) +++ trunk/simexplorer-is-web/src/java/fr/cemagref/simexplorer/is/ui/web/services/RemoteSecurityService.java 2008-02-04 15:17:29 UTC (rev 633) @@ -19,8 +19,16 @@ import fr.cemagref.simexplorer.is.service.AuthenticationService; +/** + * The Class RemoteSecurityService. + */ public class RemoteSecurityService extends RemoteService { + /** + * Gets the authentification service. + * + * @return the authentification service + */ public static AuthenticationService getAuthentificationService() { return (AuthenticationService) getService("AuthenticationService"); } Modified: trunk/simexplorer-is-web/src/java/fr/cemagref/simexplorer/is/ui/web/services/RemoteService.java =================================================================== --- trunk/simexplorer-is-web/src/java/fr/cemagref/simexplorer/is/ui/web/services/RemoteService.java 2008-02-04 15:13:55 UTC (rev 632) +++ trunk/simexplorer-is-web/src/java/fr/cemagref/simexplorer/is/ui/web/services/RemoteService.java 2008-02-04 15:17:29 UTC (rev 633) @@ -27,10 +27,22 @@ import fr.cemagref.simexplorer.is.ui.web.SimExplorerWebException; +/** + * The Class RemoteService. + */ public abstract class RemoteService { + /** The services. */ protected static Map<String, Object> services = new HashMap<String, Object>(); + /** + * Gets the service. + * + * @param serviceName + * the service name + * + * @return the service + */ protected static Object getService(String serviceName) { Object service = null; Modified: trunk/simexplorer-is-web/src/java/fr/cemagref/simexplorer/is/ui/web/services/RemoteStorageService.java =================================================================== --- trunk/simexplorer-is-web/src/java/fr/cemagref/simexplorer/is/ui/web/services/RemoteStorageService.java 2008-02-04 15:13:55 UTC (rev 632) +++ trunk/simexplorer-is-web/src/java/fr/cemagref/simexplorer/is/ui/web/services/RemoteStorageService.java 2008-02-04 15:17:29 UTC (rev 633) @@ -19,9 +19,17 @@ import fr.cemagref.simexplorer.is.service.StorageService; +/** + * The Class RemoteStorageService. + */ public class RemoteStorageService extends RemoteService { + /** + * Gets the storage service. + * + * @return the storage service + */ public static StorageService getStorageService() { return (StorageService) getService("StorageService"); - } + } } Modified: trunk/simexplorer-is-web/src/java/fr/cemagref/simexplorer/is/ui/web/services/UserValueEncoder.java =================================================================== --- trunk/simexplorer-is-web/src/java/fr/cemagref/simexplorer/is/ui/web/services/UserValueEncoder.java 2008-02-04 15:13:55 UTC (rev 632) +++ trunk/simexplorer-is-web/src/java/fr/cemagref/simexplorer/is/ui/web/services/UserValueEncoder.java 2008-02-04 15:17:29 UTC (rev 633) @@ -23,19 +23,35 @@ import fr.cemagref.simexplorer.is.service.SimExplorerServiceException; import fr.cemagref.simexplorer.is.ui.web.SimExplorerWebException; +/** + * The Class UserValueEncoder. + */ public class UserValueEncoder implements ValueEncoder<User> { + /** The token. */ private String token; + /** + * Instantiates a new user value encoder. + * + * @param token + * the token + */ public UserValueEncoder(String token) { super(); this.token = token; } + /* (non-Javadoc) + * @see org.apache.tapestry.ValueEncoder#toClient(java.lang.Object) + */ public String toClient(User arg0) { return Integer.toString(arg0.getId()); } + /* (non-Javadoc) + * @see org.apache.tapestry.ValueEncoder#toValue(java.lang.String) + */ public User toValue(String arg0) { User user = null; try { Modified: trunk/simexplorer-is-web/src/java/fr/cemagref/simexplorer/is/ui/web/tools/AttachmentStreamResponse.java =================================================================== --- trunk/simexplorer-is-web/src/java/fr/cemagref/simexplorer/is/ui/web/tools/AttachmentStreamResponse.java 2008-02-04 15:13:55 UTC (rev 632) +++ trunk/simexplorer-is-web/src/java/fr/cemagref/simexplorer/is/ui/web/tools/AttachmentStreamResponse.java 2008-02-04 15:17:29 UTC (rev 633) @@ -17,34 +17,58 @@ * ##% */ package fr.cemagref.simexplorer.is.ui.web.tools; -import java.io.IOException; import java.io.InputStream; import org.apache.tapestry.StreamResponse; import org.apache.tapestry.services.Response; +/** + * The Class AttachmentStreamResponse. + */ public class AttachmentStreamResponse implements StreamResponse { + + /** The is. */ private InputStream is = null; + /** The content type. */ protected String contentType = "application/octet-stream"; + /** The extension. */ protected String extension = null; + /** The filename. */ protected String filename = null; + /** + * Instantiates a new attachment stream response. + * + * @param is + * the is + * @param filenameIn + * the filename in + */ public AttachmentStreamResponse(InputStream is, String filenameIn) { this.is = is; this.filename = filenameIn; } + /* (non-Javadoc) + * @see org.apache.tapestry.StreamResponse#getContentType() + */ public String getContentType() { return contentType; } + /* (non-Javadoc) + * @see org.apache.tapestry.StreamResponse#getStream() + */ public InputStream getStream() { return is; } + /* (non-Javadoc) + * @see org.apache.tapestry.StreamResponse#prepareResponse(org.apache.tapestry.services.Response) + */ public void prepareResponse(Response arg0) { arg0.setHeader("Content-Disposition", "attachment; filename=" + filename + ((extension == null) ? "" : ("." + extension))); Modified: trunk/simexplorer-is-web/src/java/fr/cemagref/simexplorer/is/ui/web/tools/DownloadableFile.java =================================================================== --- trunk/simexplorer-is-web/src/java/fr/cemagref/simexplorer/is/ui/web/tools/DownloadableFile.java 2008-02-04 15:13:55 UTC (rev 632) +++ trunk/simexplorer-is-web/src/java/fr/cemagref/simexplorer/is/ui/web/tools/DownloadableFile.java 2008-02-04 15:17:29 UTC (rev 633) @@ -19,23 +19,51 @@ import fr.cemagref.simexplorer.is.entities.metadata.MetaData; +/** + * The Class DownloadableFile. + */ public class DownloadableFile { + /** The meta data. */ private MetaData metaData; + + /** The filename. */ private String filename; + /** + * Gets the filename. + * + * @return the filename + */ public String getFilename() { return filename; } + /** + * Sets the filename. + * + * @param filename + * the new filename + */ public void setFilename(String filename) { this.filename = filename; } + /** + * Gets the meta data entity. + * + * @return the meta data entity + */ public MetaData getMetaDataEntity() { return metaData; } + /** + * Sets the meta data entity. + * + * @param metaData + * the new meta data entity + */ public void setMetaDataEntity(MetaData metaData) { this.metaData = metaData; } Modified: trunk/simexplorer-is-web/src/java/fr/cemagref/simexplorer/is/ui/web/tools/XMLAttachment.java =================================================================== --- trunk/simexplorer-is-web/src/java/fr/cemagref/simexplorer/is/ui/web/tools/XMLAttachment.java 2008-02-04 15:13:55 UTC (rev 632) +++ trunk/simexplorer-is-web/src/java/fr/cemagref/simexplorer/is/ui/web/tools/XMLAttachment.java 2008-02-04 15:17:29 UTC (rev 633) @@ -19,8 +19,19 @@ import java.io.InputStream; +/** + * The Class XMLAttachment. + */ public class XMLAttachment extends AttachmentStreamResponse { + /** + * Instantiates a new XML attachment. + * + * @param is + * the is + * @param filenameIn + * the filename in + */ public XMLAttachment(InputStream is, String filenameIn) { super(is, filenameIn); this.contentType = "text/xml"; Modified: trunk/simexplorer-is-web/src/java/fr/cemagref/simexplorer/is/ui/web/tools/ZipAttachment.java =================================================================== --- trunk/simexplorer-is-web/src/java/fr/cemagref/simexplorer/is/ui/web/tools/ZipAttachment.java 2008-02-04 15:13:55 UTC (rev 632) +++ trunk/simexplorer-is-web/src/java/fr/cemagref/simexplorer/is/ui/web/tools/ZipAttachment.java 2008-02-04 15:17:29 UTC (rev 633) @@ -19,8 +19,19 @@ import java.io.InputStream; +/** + * The Class ZipAttachment. + */ public class ZipAttachment extends AttachmentStreamResponse { + /** + * Instantiates a new zip attachment. + * + * @param is + * the is + * @param filenameIn + * the filename in + */ public ZipAttachment(InputStream is, String filenameIn) { super(is, filenameIn); this.contentType = "application/zip";