[jboss-svn-commits] JBL Code SVN: r11014 - in labs/jbosslabs/trunk/portal-extensions/forge-common/src/java/org/jboss/forge/common/projects: project and 1 other directories.
jboss-svn-commits at lists.jboss.org
jboss-svn-commits at lists.jboss.org
Mon Apr 16 11:43:49 EDT 2007
Author: szimano
Date: 2007-04-16 11:43:49 -0400 (Mon, 16 Apr 2007)
New Revision: 11014
Modified:
labs/jbosslabs/trunk/portal-extensions/forge-common/src/java/org/jboss/forge/common/projects/ProjectsDescriptor.java
labs/jbosslabs/trunk/portal-extensions/forge-common/src/java/org/jboss/forge/common/projects/project/Category.java
labs/jbosslabs/trunk/portal-extensions/forge-common/src/java/org/jboss/forge/common/projects/project/Downloads.java
labs/jbosslabs/trunk/portal-extensions/forge-common/src/java/org/jboss/forge/common/projects/project/File.java
labs/jbosslabs/trunk/portal-extensions/forge-common/src/java/org/jboss/forge/common/projects/project/rw/CategoriesRW.java
labs/jbosslabs/trunk/portal-extensions/forge-common/src/java/org/jboss/forge/common/projects/project/rw/CategoryRW.java
labs/jbosslabs/trunk/portal-extensions/forge-common/src/java/org/jboss/forge/common/projects/project/rw/DownloadsRW.java
labs/jbosslabs/trunk/portal-extensions/forge-common/src/java/org/jboss/forge/common/projects/project/rw/FileRW.java
labs/jbosslabs/trunk/portal-extensions/forge-common/src/java/org/jboss/forge/common/projects/project/rw/FilesRW.java
Log:
human sizes for files and file's size and release date generation
Modified: labs/jbosslabs/trunk/portal-extensions/forge-common/src/java/org/jboss/forge/common/projects/ProjectsDescriptor.java
===================================================================
--- labs/jbosslabs/trunk/portal-extensions/forge-common/src/java/org/jboss/forge/common/projects/ProjectsDescriptor.java 2007-04-16 15:03:35 UTC (rev 11013)
+++ labs/jbosslabs/trunk/portal-extensions/forge-common/src/java/org/jboss/forge/common/projects/ProjectsDescriptor.java 2007-04-16 15:43:49 UTC (rev 11014)
@@ -322,7 +322,7 @@
setReference(cat);
}
- d.updateMaps();
+ d.updateMaps(project.getId());
}
}
Modified: labs/jbosslabs/trunk/portal-extensions/forge-common/src/java/org/jboss/forge/common/projects/project/Category.java
===================================================================
--- labs/jbosslabs/trunk/portal-extensions/forge-common/src/java/org/jboss/forge/common/projects/project/Category.java 2007-04-16 15:03:35 UTC (rev 11013)
+++ labs/jbosslabs/trunk/portal-extensions/forge-common/src/java/org/jboss/forge/common/projects/project/Category.java 2007-04-16 15:43:49 UTC (rev 11014)
@@ -105,10 +105,28 @@
public abstract void setCategories(Categories value);
// added by tomek
-
+ /**
+ * Get parent category of this category
+ *
+ * @return parent Category
+ */
public Category getParent();
+ /**
+ * Set parent category for this category (it will be done automatically - you
+ * shouldn't use it)
+ *
+ * @param parent
+ * parent category
+ */
public void setParent(Category parent);
+ /**
+ * Get full name of this file. If category "JBoss" is in subcategory
+ * releases and in subsubcategory 2.0Beta it will return
+ * releases/2.0Beta/JBoss
+ *
+ * @return Full path for category
+ */
public String getFullName();
}
\ No newline at end of file
Modified: labs/jbosslabs/trunk/portal-extensions/forge-common/src/java/org/jboss/forge/common/projects/project/Downloads.java
===================================================================
--- labs/jbosslabs/trunk/portal-extensions/forge-common/src/java/org/jboss/forge/common/projects/project/Downloads.java 2007-04-16 15:03:35 UTC (rev 11013)
+++ labs/jbosslabs/trunk/portal-extensions/forge-common/src/java/org/jboss/forge/common/projects/project/Downloads.java 2007-04-16 15:43:49 UTC (rev 11014)
@@ -107,5 +107,5 @@
// tomek
- public void updateMaps();
+ public void updateMaps(String projectId);
}
\ No newline at end of file
Modified: labs/jbosslabs/trunk/portal-extensions/forge-common/src/java/org/jboss/forge/common/projects/project/File.java
===================================================================
--- labs/jbosslabs/trunk/portal-extensions/forge-common/src/java/org/jboss/forge/common/projects/project/File.java 2007-04-16 15:03:35 UTC (rev 11013)
+++ labs/jbosslabs/trunk/portal-extensions/forge-common/src/java/org/jboss/forge/common/projects/project/File.java 2007-04-16 15:43:49 UTC (rev 11014)
@@ -8,10 +8,8 @@
/**
* Gets the value of the id property.
*
- * @return
- * possible object is
- * {@link String }
- *
+ * @return possible object is {@link String }
+ *
*/
public abstract String getId();
@@ -19,19 +17,16 @@
* Sets the value of the id property.
*
* @param value
- * allowed object is
- * {@link String }
- *
+ * allowed object is {@link String }
+ *
*/
public abstract void setId(String value);
/**
* Gets the value of the name property.
*
- * @return
- * possible object is
- * {@link String }
- *
+ * @return possible object is {@link String }
+ *
*/
public abstract String getName();
@@ -39,19 +34,16 @@
* Sets the value of the name property.
*
* @param value
- * allowed object is
- * {@link String }
- *
+ * allowed object is {@link String }
+ *
*/
public abstract void setName(String value);
/**
* Gets the value of the description property.
*
- * @return
- * possible object is
- * {@link String }
- *
+ * @return possible object is {@link String }
+ *
*/
public abstract String getDescription();
@@ -59,19 +51,16 @@
* Sets the value of the description property.
*
* @param value
- * allowed object is
- * {@link String }
- *
+ * allowed object is {@link String }
+ *
*/
public abstract void setDescription(String value);
/**
* Gets the value of the size property.
*
- * @return
- * possible object is
- * {@link String }
- *
+ * @return possible object is {@link String }
+ *
*/
public abstract String getSize();
@@ -79,19 +68,16 @@
* Sets the value of the size property.
*
* @param value
- * allowed object is
- * {@link String }
- *
+ * allowed object is {@link String }
+ *
*/
public abstract void setSize(String value);
/**
* Gets the value of the license property.
*
- * @return
- * possible object is
- * {@link String }
- *
+ * @return possible object is {@link String }
+ *
*/
public abstract String getLicense();
@@ -99,19 +85,16 @@
* Sets the value of the license property.
*
* @param value
- * allowed object is
- * {@link String }
- *
+ * allowed object is {@link String }
+ *
*/
public abstract void setLicense(String value);
/**
* Gets the value of the release property.
*
- * @return
- * possible object is
- * {@link String }
- *
+ * @return possible object is {@link String }
+ *
*/
public abstract String getRelease();
@@ -119,19 +102,16 @@
* Sets the value of the release property.
*
* @param value
- * allowed object is
- * {@link String }
- *
+ * allowed object is {@link String }
+ *
*/
public abstract void setRelease(String value);
/**
* Gets the value of the type property.
*
- * @return
- * possible object is
- * {@link String }
- *
+ * @return possible object is {@link String }
+ *
*/
public abstract String getType();
@@ -139,9 +119,8 @@
* Sets the value of the type property.
*
* @param value
- * allowed object is
- * {@link String }
- *
+ * allowed object is {@link String }
+ *
*/
public abstract void setType(String value);
@@ -149,15 +128,16 @@
* Gets the value of the button property.
*
* <p>
- * This accessor method returns a reference to the live list,
- * not a snapshot. Therefore any modification you make to the
- * returned list will be present inside the JAXB object.
- * This is why there is not a <CODE>set</CODE> method for the button property.
+ * This accessor method returns a reference to the live list, not a
+ * snapshot. Therefore any modification you make to the returned list will
+ * be present inside the JAXB object. This is why there is not a <CODE>set</CODE>
+ * method for the button property.
*
* <p>
* For example, to add a new item, do as follows:
+ *
* <pre>
- * getButton().add(newItem);
+ * getButton().add(newItem);
* </pre>
*
*
@@ -172,10 +152,8 @@
/**
* Gets the value of the visible property.
*
- * @return
- * possible object is
- * {@link Boolean }
- *
+ * @return possible object is {@link Boolean }
+ *
*/
public abstract boolean isVisible();
@@ -183,16 +161,40 @@
* Sets the value of the visible property.
*
* @param value
- * allowed object is
- * {@link Boolean }
- *
+ * allowed object is {@link Boolean }
+ *
*/
public abstract void setVisible(Boolean value);
-
+
+ /**
+ * Get parent category of this file
+ *
+ * @return parent Category
+ */
public Category getParent();
-
+
+ /**
+ * Set parent category for this file (it will be done automatically - you
+ * shouldn't use it)
+ *
+ * @param parent
+ * parent category
+ */
public void setParent(Category parent);
+ /**
+ * Gets full name of this file. It the file "final.tgz" is in subcategory
+ * releases and in subsubcategory 2.0Beta it will return
+ * releases/2.0Beta/final.tgz
+ *
+ * @return Full path for file
+ */
public String getFullName();
+ /**
+ * Get humanly redable size of file.
+ *
+ * @return Size in bytes, kilobytes or megabites depeneding on the file size
+ */
+ public String getHumanSize();
}
\ No newline at end of file
Modified: labs/jbosslabs/trunk/portal-extensions/forge-common/src/java/org/jboss/forge/common/projects/project/rw/CategoriesRW.java
===================================================================
--- labs/jbosslabs/trunk/portal-extensions/forge-common/src/java/org/jboss/forge/common/projects/project/rw/CategoriesRW.java 2007-04-16 15:03:35 UTC (rev 11013)
+++ labs/jbosslabs/trunk/portal-extensions/forge-common/src/java/org/jboss/forge/common/projects/project/rw/CategoriesRW.java 2007-04-16 15:43:49 UTC (rev 11014)
@@ -96,13 +96,13 @@
return childCategories.get(categoryId);
}
- protected void updateMaps() {
+ protected void updateMapsSizesDates(String projectId) {
childCategories.clear();
if (category != null)
for (CategoryRW c : category) {
childCategories.put(c.getId(), c);
- c.updateMaps();
+ c.updateMapsSizesDates(projectId);
}
}
Modified: labs/jbosslabs/trunk/portal-extensions/forge-common/src/java/org/jboss/forge/common/projects/project/rw/CategoryRW.java
===================================================================
--- labs/jbosslabs/trunk/portal-extensions/forge-common/src/java/org/jboss/forge/common/projects/project/rw/CategoryRW.java 2007-04-16 15:03:35 UTC (rev 11013)
+++ labs/jbosslabs/trunk/portal-extensions/forge-common/src/java/org/jboss/forge/common/projects/project/rw/CategoryRW.java 2007-04-16 15:43:49 UTC (rev 11014)
@@ -176,16 +176,15 @@
@XmlTransient
private Category parent;
- protected void updateMaps() {
+ protected void updateMapsSizesDates(String projectId) {
if (categories != null)
- categories.updateMaps();
+ categories.updateMapsSizesDates(projectId);
if (files != null)
- files.updateMaps();
+ files.updateMapsSizesDates(projectId);
}
public void setParent(Category parent) {
- System.out.println("setting parent: " + parent.getId() + " for: " + id);
this.parent = parent;
}
Modified: labs/jbosslabs/trunk/portal-extensions/forge-common/src/java/org/jboss/forge/common/projects/project/rw/DownloadsRW.java
===================================================================
--- labs/jbosslabs/trunk/portal-extensions/forge-common/src/java/org/jboss/forge/common/projects/project/rw/DownloadsRW.java 2007-04-16 15:03:35 UTC (rev 11013)
+++ labs/jbosslabs/trunk/portal-extensions/forge-common/src/java/org/jboss/forge/common/projects/project/rw/DownloadsRW.java 2007-04-16 15:43:49 UTC (rev 11014)
@@ -252,12 +252,12 @@
// tomek
- public void updateMaps() {
+ public void updateMaps(String projectId) {
if (categories != null)
- categories.updateMaps();
+ categories.updateMapsSizesDates(projectId);
if (files != null)
- files.updateMaps();
+ files.updateMapsSizesDates(projectId);
}
}
Modified: labs/jbosslabs/trunk/portal-extensions/forge-common/src/java/org/jboss/forge/common/projects/project/rw/FileRW.java
===================================================================
--- labs/jbosslabs/trunk/portal-extensions/forge-common/src/java/org/jboss/forge/common/projects/project/rw/FileRW.java 2007-04-16 15:03:35 UTC (rev 11013)
+++ labs/jbosslabs/trunk/portal-extensions/forge-common/src/java/org/jboss/forge/common/projects/project/rw/FileRW.java 2007-04-16 15:43:49 UTC (rev 11014)
@@ -32,404 +32,420 @@
import javax.xml.bind.annotation.XmlTransient;
import javax.xml.bind.annotation.XmlType;
+import org.jboss.forge.common.ForgeHelper;
+import org.jboss.forge.common.projects.ProjectsHelper;
import org.jboss.forge.common.projects.project.Category;
import org.jboss.forge.common.projects.project.File;
+import org.jboss.shotoku.ContentManager;
+import org.jboss.shotoku.Node;
+import org.jboss.shotoku.exceptions.RepositoryException;
+import org.jboss.shotoku.exceptions.ResourceDoesNotExist;
-
/**
*
- * Class for keeping information about one file available for download.
- * PLEASE, DO NOT MODIFY THIS CLASS UNLESS YOU KNOW JAXB.
- * @author Ryszard Kozmik
- *
+ * Class for keeping information about one file available for download. PLEASE,
+ * DO NOT MODIFY THIS CLASS UNLESS YOU KNOW JAXB.
*
+ * @author Ryszard Kozmik
*
*
+ *
+ *
*/
@XmlAccessorType(XmlAccessType.FIELD)
- at XmlType(name = "file", propOrder = {
- "id",
- "name",
- "description",
- "size",
- "license",
- "release",
- "type",
- "button"
-})
-public class FileRW
- implements File, Serializable
-{
+ at XmlType(name = "file", propOrder = { "id", "name", "description", "size",
+ "license", "release", "type", "button" })
+public class FileRW implements File, Serializable {
- private final static long serialVersionUID = 1L;
- @XmlElement(required = true)
- protected String id;
- protected String name;
- protected String description;
- protected String size;
- protected String license;
- protected String release;
- protected String type;
- protected List<FileRW.Button> button = new CopyOnWriteArrayList<FileRW.Button>();
- @XmlAttribute
- protected Boolean visible;
+ private final static long serialVersionUID = 1L;
- /**
- * Gets the value of the id property.
- *
- * @return
- * possible object is
- * {@link String }
- *
- */
- public String getId() {
- return id;
- }
+ @XmlElement(required = true)
+ protected String id;
- /**
- * Sets the value of the id property.
- *
- * @param value
- * allowed object is
- * {@link String }
- *
- */
- public void setId(String value) {
- this.id = value;
- }
+ protected String name;
- /**
- * Gets the value of the name property.
- *
- * @return
- * possible object is
- * {@link String }
- *
- */
- public String getName() {
- return name;
- }
+ protected String description;
- /**
- * Sets the value of the name property.
- *
- * @param value
- * allowed object is
- * {@link String }
- *
- */
- public void setName(String value) {
- this.name = value;
- }
+ protected String size;
- /**
- * Gets the value of the description property.
- *
- * @return
- * possible object is
- * {@link String }
- *
- */
- public String getDescription() {
- return description;
- }
+ protected String license;
- /**
- * Sets the value of the description property.
- *
- * @param value
- * allowed object is
- * {@link String }
- *
- */
- public void setDescription(String value) {
- this.description = value;
- }
+ protected String release;
- /**
- * Gets the value of the size property.
- *
- * @return
- * possible object is
- * {@link String }
- *
- */
- public String getSize() {
- return size;
- }
+ protected String type;
- /**
- * Sets the value of the size property.
- *
- * @param value
- * allowed object is
- * {@link String }
- *
- */
- public void setSize(String value) {
- this.size = value;
- }
+ protected List<FileRW.Button> button = new CopyOnWriteArrayList<FileRW.Button>();
- /**
- * Gets the value of the license property.
- *
- * @return
- * possible object is
- * {@link String }
- *
- */
- public String getLicense() {
- return license;
- }
+ @XmlAttribute
+ protected Boolean visible;
- /**
- * Sets the value of the license property.
- *
- * @param value
- * allowed object is
- * {@link String }
- *
- */
- public void setLicense(String value) {
- this.license = value;
- }
+ /**
+ * Gets the value of the id property.
+ *
+ * @return possible object is {@link String }
+ *
+ */
+ public String getId() {
+ return id;
+ }
- /**
- * Gets the value of the release property.
- *
- * @return
- * possible object is
- * {@link String }
- *
- */
- public String getRelease() {
- return release;
- }
+ /**
+ * Sets the value of the id property.
+ *
+ * @param value
+ * allowed object is {@link String }
+ *
+ */
+ public void setId(String value) {
+ this.id = value;
+ }
- /**
- * Sets the value of the release property.
- *
- * @param value
- * allowed object is
- * {@link String }
- *
- */
- public void setRelease(String value) {
- this.release = value;
- }
+ /**
+ * Gets the value of the name property.
+ *
+ * @return possible object is {@link String }
+ *
+ */
+ public String getName() {
+ return name;
+ }
- /**
- * Gets the value of the type property.
- *
- * @return
- * possible object is
- * {@link String }
- *
- */
- public String getType() {
- return type;
- }
+ /**
+ * Sets the value of the name property.
+ *
+ * @param value
+ * allowed object is {@link String }
+ *
+ */
+ public void setName(String value) {
+ this.name = value;
+ }
- /**
- * Sets the value of the type property.
- *
- * @param value
- * allowed object is
- * {@link String }
- *
- */
- public void setType(String value) {
- this.type = value;
- }
+ /**
+ * Gets the value of the description property.
+ *
+ * @return possible object is {@link String }
+ *
+ */
+ public String getDescription() {
+ return description;
+ }
- /**
- * Gets the value of the button property.
- *
- * <p>
- * This accessor method returns a reference to the live list,
- * not a snapshot. Therefore any modification you make to the
- * returned list will be present inside the JAXB object.
- * This is why there is not a <CODE>set</CODE> method for the button property.
- *
- * <p>
- * For example, to add a new item, do as follows:
- * <pre>
- * getButton().add(newItem);
- * </pre>
- *
- *
- * <p>
- * Objects of the following type(s) are allowed in the list
- * {@link FileRW.Button }
- *
- *
- */
- public List<FileRW.Button> getButton() {
- if (button == null) {
- button = new CopyOnWriteArrayList<FileRW.Button>();
- }
- return this.button;
- }
+ /**
+ * Sets the value of the description property.
+ *
+ * @param value
+ * allowed object is {@link String }
+ *
+ */
+ public void setDescription(String value) {
+ this.description = value;
+ }
- /**
- * Gets the value of the visible property.
- *
- * @return
- * possible object is
- * {@link Boolean }
- *
- */
- public boolean isVisible() {
- if (visible == null) {
- return true;
- } else {
- return visible;
- }
- }
+ /**
+ * Gets the value of the size property.
+ *
+ * @return possible object is {@link String }
+ *
+ */
+ public String getSize() {
+ return size;
+ }
- /**
- * Sets the value of the visible property.
- *
- * @param value
- * allowed object is
- * {@link Boolean }
- *
- */
- public void setVisible(Boolean value) {
- this.visible = value;
- }
+ /**
+ * Sets the value of the size property.
+ *
+ * @param value
+ * allowed object is {@link String }
+ *
+ */
+ public void setSize(String value) {
+ this.size = value;
+ }
+ /**
+ * Gets the value of the license property.
+ *
+ * @return possible object is {@link String }
+ *
+ */
+ public String getLicense() {
+ return license;
+ }
- /**
- * <p>Java class for anonymous complex type.
- *
- * <p>The following schema fragment specifies the expected content contained within this class.
- *
- * <pre>
- * <complexType>
- * <complexContent>
- * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- * <sequence>
- * <element name="id" type="{http://www.w3.org/2001/XMLSchema}string"/>
- * <element name="name" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
- * <element name="freezone" type="{http://www.w3.org/2001/XMLSchema}boolean" minOccurs="0"/>
- * </sequence>
- * </restriction>
- * </complexContent>
- * </complexType>
- * </pre>
- *
- *
- */
- @XmlAccessorType(XmlAccessType.FIELD)
- @XmlType(name = "", propOrder = {
- "id",
- "name",
- "freezone"
- })
- public static class Button
- implements org.jboss.forge.common.projects.project.Button, Serializable
- {
+ /**
+ * Sets the value of the license property.
+ *
+ * @param value
+ * allowed object is {@link String }
+ *
+ */
+ public void setLicense(String value) {
+ this.license = value;
+ }
- private final static long serialVersionUID = 1L;
- @XmlElement(required = true)
- protected String id;
- protected String name;
- protected Boolean freezone;
+ /**
+ * Gets the value of the release property.
+ *
+ * @return possible object is {@link String }
+ *
+ */
+ public String getRelease() {
+ return release;
+ }
- /**
- * Gets the value of the id property.
- *
- * @return
- * possible object is
- * {@link String }
- *
- */
- public String getId() {
- return id;
- }
+ /**
+ * Sets the value of the release property.
+ *
+ * @param value
+ * allowed object is {@link String }
+ *
+ */
+ public void setRelease(String value) {
+ this.release = value;
+ }
- /**
- * Sets the value of the id property.
- *
- * @param value
- * allowed object is
- * {@link String }
- *
- */
- public void setId(String value) {
- this.id = value;
- }
+ /**
+ * Gets the value of the type property.
+ *
+ * @return possible object is {@link String }
+ *
+ */
+ public String getType() {
+ return type;
+ }
- /**
- * Gets the value of the name property.
- *
- * @return
- * possible object is
- * {@link String }
- *
- */
- public String getName() {
- return name;
- }
+ /**
+ * Sets the value of the type property.
+ *
+ * @param value
+ * allowed object is {@link String }
+ *
+ */
+ public void setType(String value) {
+ this.type = value;
+ }
- /**
- * Sets the value of the name property.
- *
- * @param value
- * allowed object is
- * {@link String }
- *
- */
- public void setName(String value) {
- this.name = value;
- }
+ /**
+ * Gets the value of the button property.
+ *
+ * <p>
+ * This accessor method returns a reference to the live list, not a
+ * snapshot. Therefore any modification you make to the returned list will
+ * be present inside the JAXB object. This is why there is not a <CODE>set</CODE>
+ * method for the button property.
+ *
+ * <p>
+ * For example, to add a new item, do as follows:
+ *
+ * <pre>
+ * getButton().add(newItem);
+ * </pre>
+ *
+ *
+ * <p>
+ * Objects of the following type(s) are allowed in the list
+ * {@link FileRW.Button }
+ *
+ *
+ */
+ public List<FileRW.Button> getButton() {
+ if (button == null) {
+ button = new CopyOnWriteArrayList<FileRW.Button>();
+ }
+ return this.button;
+ }
- /**
- * Gets the value of the freezone property.
- *
- * @return
- * possible object is
- * {@link Boolean }
- *
- */
- public Boolean isFreezone() {
- return freezone;
- }
+ /**
+ * Gets the value of the visible property.
+ *
+ * @return possible object is {@link Boolean }
+ *
+ */
+ public boolean isVisible() {
+ if (visible == null) {
+ return true;
+ } else {
+ return visible;
+ }
+ }
- /**
- * Sets the value of the freezone property.
- *
- * @param value
- * allowed object is
- * {@link Boolean }
- *
- */
- public void setFreezone(Boolean value) {
- this.freezone = value;
- }
+ /**
+ * Sets the value of the visible property.
+ *
+ * @param value
+ * allowed object is {@link Boolean }
+ *
+ */
+ public void setVisible(Boolean value) {
+ this.visible = value;
+ }
- }
-
-// tomek
- @XmlTransient
- private Category parent;
-
- public void setParent(Category parent) {
- this.parent = parent;
- }
-
- public Category getParent() {
+ /**
+ * <p>
+ * Java class for anonymous complex type.
+ *
+ * <p>
+ * The following schema fragment specifies the expected content contained
+ * within this class.
+ *
+ * <pre>
+ * <complexType>
+ * <complexContent>
+ * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ * <sequence>
+ * <element name="id" type="{http://www.w3.org/2001/XMLSchema}string"/>
+ * <element name="name" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ * <element name="freezone" type="{http://www.w3.org/2001/XMLSchema}boolean" minOccurs="0"/>
+ * </sequence>
+ * </restriction>
+ * </complexContent>
+ * </complexType>
+ * </pre>
+ *
+ *
+ */
+ @XmlAccessorType(XmlAccessType.FIELD)
+ @XmlType(name = "", propOrder = { "id", "name", "freezone" })
+ public static class Button implements
+ org.jboss.forge.common.projects.project.Button, Serializable {
+
+ private final static long serialVersionUID = 1L;
+
+ @XmlElement(required = true)
+ protected String id;
+
+ protected String name;
+
+ protected Boolean freezone;
+
+ /**
+ * Gets the value of the id property.
+ *
+ * @return possible object is {@link String }
+ *
+ */
+ public String getId() {
+ return id;
+ }
+
+ /**
+ * Sets the value of the id property.
+ *
+ * @param value
+ * allowed object is {@link String }
+ *
+ */
+ public void setId(String value) {
+ this.id = value;
+ }
+
+ /**
+ * Gets the value of the name property.
+ *
+ * @return possible object is {@link String }
+ *
+ */
+ public String getName() {
+ return name;
+ }
+
+ /**
+ * Sets the value of the name property.
+ *
+ * @param value
+ * allowed object is {@link String }
+ *
+ */
+ public void setName(String value) {
+ this.name = value;
+ }
+
+ /**
+ * Gets the value of the freezone property.
+ *
+ * @return possible object is {@link Boolean }
+ *
+ */
+ public Boolean isFreezone() {
+ return freezone;
+ }
+
+ /**
+ * Sets the value of the freezone property.
+ *
+ * @param value
+ * allowed object is {@link Boolean }
+ *
+ */
+ public void setFreezone(Boolean value) {
+ this.freezone = value;
+ }
+
+ }
+
+ // tomek
+ @XmlTransient
+ private Category parent;
+
+ public void setParent(Category parent) {
+ this.parent = parent;
+ }
+
+ public Category getParent() {
return parent;
}
-
- public String getFullName() {
- System.out.println("id: "+id+" parent: "+parent);
-
- if (parent == null) {
- return id;
- }
-
- return parent.getFullName() + "/" + id;
- }
+
+ public String getFullName() {
+
+ if (parent == null) {
+ return id;
+ }
+
+ return parent.getFullName() + "/" + id;
+ }
+
+ protected void updateSizesDates(String projectId) {
+ if (!getId().startsWith("http://") && !getId().startsWith("https://")) {
+ String path = "/default/members/" + projectId + "/downloads";
+
+ try {
+ Node n = ContentManager.getContentManager(path).getNode(
+ getFullName());
+ size = String.valueOf(n.getLength());
+ release = n.getLastModificationDate().toString();
+ } catch (RepositoryException e) {
+ e.printStackTrace();
+ } catch (ResourceDoesNotExist e) {
+ // it's not a shotoku path or doesn't exist. ignore
+ }
+
+ }
+ }
+
+ private static final long MEGABYTE = 1024L * 1024L;
+
+ private static final long KILOBYTE = 1024L;
+
+ public String getHumanSize() {
+
+ try {
+ if (size != null && size.length() > 0) {
+ long sl = Long.parseLong(size);
+ if (sl > KILOBYTE) {
+ if (sl > MEGABYTE) {
+ return String.valueOf(sl / MEGABYTE) + " MB";
+ }
+
+ return String.valueOf(sl / KILOBYTE) + " KB";
+ }
+
+ return String.valueOf(sl) + " B";
+ }
+ } catch (NumberFormatException e) {
+ // wrong number - ignore
+ }
+
+ return size;
+ }
}
Modified: labs/jbosslabs/trunk/portal-extensions/forge-common/src/java/org/jboss/forge/common/projects/project/rw/FilesRW.java
===================================================================
--- labs/jbosslabs/trunk/portal-extensions/forge-common/src/java/org/jboss/forge/common/projects/project/rw/FilesRW.java 2007-04-16 15:03:35 UTC (rev 11013)
+++ labs/jbosslabs/trunk/portal-extensions/forge-common/src/java/org/jboss/forge/common/projects/project/rw/FilesRW.java 2007-04-16 15:43:49 UTC (rev 11014)
@@ -153,12 +153,13 @@
@XmlTransient
private Map<String, File> childFiles = new HashMap<String, File>();
- protected void updateMaps() {
+ public void updateMapsSizesDates(String projectId) {
childFiles.clear();
if (file != null)
for (FileRW f : file) {
childFiles.put(f.getId(), f);
+ f.updateSizesDates(projectId);
}
}
More information about the jboss-svn-commits
mailing list