added configuration parameters for repository archive

This commit is contained in:
Sebastian Sdorra
2012-03-27 15:04:24 +02:00
parent 7b74ef7820
commit a1f12e6ec0
5 changed files with 112 additions and 4 deletions

View File

@@ -33,6 +33,10 @@
package sonia.scm;
//~--- non-JDK imports --------------------------------------------------------
import sonia.scm.config.ScmConfiguration;
/**
* Configuration object for a SCM-Manager
* client (WebInterface, RestClient, ...).
@@ -48,6 +52,20 @@ public class ScmClientConfig
*/
public ScmClientConfig() {}
/**
* Constructs {@link ScmClientConfig} object
*
*
* @param configuration SCM-Manager main configuration
* @since 1.14
*/
public ScmClientConfig(ScmConfiguration configuration)
{
this.dateFormat = configuration.getDateFormat();
this.disableGroupingGrid = configuration.isDisableGroupingGrid();
this.enableRepositoryArchive = configuration.isEnableRepositoryArchive();
}
/**
* Constructs {@link ScmClientConfig} object
*
@@ -100,6 +118,18 @@ public class ScmClientConfig
return disableGroupingGrid;
}
/**
* Returns true if the repository archive is disabled.
*
*
* @return true if the repository archive is disabled
* @since 1.14
*/
public boolean isEnableRepositoryArchive()
{
return enableRepositoryArchive;
}
//~--- set methods ----------------------------------------------------------
/**
@@ -127,11 +157,26 @@ public class ScmClientConfig
this.disableGroupingGrid = disableGroupingGrid;
}
/**
* Enable or disable the repository archive. Default is disabled.
*
*
* @param enableRepositoryArchive true to disable the repository archive
* @since 1.14
*/
public void setEnableRepositoryArchive(boolean enableRepositoryArchive)
{
this.enableRepositoryArchive = enableRepositoryArchive;
}
//~--- fields ---------------------------------------------------------------
/** Field description */
private String dateFormat;
/** Field description */
private boolean enableRepositoryArchive = true;
/** Field description */
private boolean disableGroupingGrid = true;
}

View File

@@ -165,6 +165,7 @@ public class ScmConfiguration
this.forceBaseUrl = other.forceBaseUrl;
this.baseUrl = other.baseUrl;
this.disableGroupingGrid = other.disableGroupingGrid;
this.enableRepositoryArchive = other.enableRepositoryArchive;
// deprecated fields
this.sslPort = other.sslPort;
@@ -381,6 +382,18 @@ public class ScmConfiguration
return enableProxy;
}
/**
* Returns true if the repository archive is enabled.
*
*
* @return true if the repository archive is enabled
* @since 1.14
*/
public boolean isEnableRepositoryArchive()
{
return enableRepositoryArchive;
}
/**
* Returns true if ssl is enabled.
*
@@ -475,6 +488,18 @@ public class ScmConfiguration
this.disableGroupingGrid = disableGroupingGrid;
}
/**
* Enable or disable the repository archive. Default is disabled.
*
*
* @param enableRepositoryArchive true to disable the repository archive
* @since 1.14
*/
public void setDisableRepositoryArchive(boolean enableRepositoryArchive)
{
this.enableRepositoryArchive = enableRepositoryArchive;
}
/**
* Method description
*
@@ -682,6 +707,9 @@ public class ScmConfiguration
private Set<ConfigChangedListener> listeners =
new HashSet<ConfigChangedListener>();
/** Field description */
private boolean enableRepositoryArchive = false;
/** Field description */
private boolean disableGroupingGrid = false;

View File

@@ -345,6 +345,18 @@ public class Repository extends BasicPropertiesAware implements ModelObject
return url;
}
/**
* Returns true if the repository is archived.
*
*
* @return true if the repository is archived
* @since 1.14
*/
public boolean isArchived()
{
return archived;
}
/**
* Returns true if the {@link Repository} is public readable.
*
@@ -377,6 +389,18 @@ public class Repository extends BasicPropertiesAware implements ModelObject
//~--- set methods ----------------------------------------------------------
/**
* Archive or un archive this repository.
*
*
* @param archived true to enable archive
* @since 1.14
*/
public void setArchived(boolean archived)
{
this.archived = archived;
}
/**
* Sets the contact of the {@link Repository}. The contact address should be
* a email address of a person who is responsible for the {@link Repository}.
@@ -516,6 +540,9 @@ public class Repository extends BasicPropertiesAware implements ModelObject
@XmlElement(name = "public")
private boolean publicReadable = false;
/** Field description */
private boolean archived = false;
/** Field description */
private String type;

View File

@@ -247,8 +247,7 @@ public class AuthenticationResource
{
return new ScmState(contextProvider, securityContext,
repositoryManger.getConfiguredTypes(),
new ScmClientConfig(configuration.getDateFormat(),
configuration.isDisableGroupingGrid()));
new ScmClientConfig(configuration));
}
//~--- fields ---------------------------------------------------------------

View File

@@ -58,7 +58,8 @@ Sonia.config.ScmConfigPanel = Ext.extend(Sonia.config.ConfigPanel,{
forceBaseUrlText: 'Force Base Url',
// TODO i18n
disableGroupingGridText: 'Disable repository Groups',
disableGroupingGridText: 'Disable repository groups',
enableRepositoryArchiveText: 'Enable repository archive',
// help
@@ -84,7 +85,9 @@ Sonia.config.ScmConfigPanel = Ext.extend(Sonia.config.ConfigPanel,{
forceBaseUrlHelpText: 'Redirects to the base url if the request comes from a other url',
// TODO i18n
disableGroupingGridHelpText: 'Disable repository Groups. A complete page reload is required after a change of this value.',
disableGroupingGridHelpText: 'Disable repository groups. A complete page reload is required after a change of this value.',
// TODO
enableRepositoryArchiveHelpText: 'Enable repository archives.',
initComponent: function(){
@@ -112,6 +115,12 @@ Sonia.config.ScmConfigPanel = Ext.extend(Sonia.config.ConfigPanel,{
name: 'disableGroupingGrid',
inputValue: 'true',
helpText: this.disableGroupingGridHelpText
},{
xtype: 'checkbox',
fieldLabel: this.enableRepositoryArchiveText,
name: 'enableRepositoryArchive',
inputValue: 'true',
helpText: this.enableRepositoryArchiveHelpText
},{
xtype: 'textfield',
fieldLabel: this.dateFormatText,