Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
佳 邓
Gitlab4j Api
Commits
22ede8a9
Commit
22ede8a9
authored
Nov 29, 2019
by
Greg Messner
Browse files
Modified to use ProjectCreationLevel and SubgroupCreationLevel enums (#482).
parent
efbd5ae3
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/main/java/org/gitlab4j/api/models/GroupParams.java
View file @
22ede8a9
...
@@ -2,8 +2,33 @@ package org.gitlab4j.api.models;
...
@@ -2,8 +2,33 @@ package org.gitlab4j.api.models;
import
org.gitlab4j.api.GitLabApiForm
;
import
org.gitlab4j.api.GitLabApiForm
;
/**
* This class is utilized by the {@link org.gitlab4j.api.GroupApi#createGroup(GroupParams)}
* and {@link org.gitlab4j.api.GroupApi#updateGroup(Object, GroupParams)} methods to set
* the parameters for the call to the GitLab API.
*/
public
class
GroupParams
{
public
class
GroupParams
{
/**
* Constant to specify the project_creation_level for the group.
*/
public
enum
ProjectCreationLevel
{
NOONE
,
DEVELOPER
,
MAINTAINER
;
public
String
toString
()
{
return
(
name
().
toLowerCase
());
}
}
/**
* Constant to specify the subgroup_creation_level for the group.
*/
public
enum
SubgroupCreationLevel
{
OWNER
,
MAINTAINER
;
public
String
toString
()
{
return
(
name
().
toLowerCase
());
}
}
private
String
name
;
private
String
name
;
private
String
path
;
private
String
path
;
private
String
description
;
private
String
description
;
...
@@ -11,9 +36,9 @@ public class GroupParams {
...
@@ -11,9 +36,9 @@ public class GroupParams {
private
Boolean
shareWithGroupLock
;
private
Boolean
shareWithGroupLock
;
private
Boolean
requireTwoFactorAuthentication
;
private
Boolean
requireTwoFactorAuthentication
;
private
Integer
twoFactorGracePeriod
;
private
Integer
twoFactorGracePeriod
;
private
Access
Level
projectCreationLevel
;
private
ProjectCreation
Level
projectCreationLevel
;
private
Boolean
autoDevopsEnabled
;
private
Boolean
autoDevopsEnabled
;
private
Access
Level
subgroupCreationLevel
;
private
SubgroupCreation
Level
subgroupCreationLevel
;
private
Boolean
emailsDisabled
;
private
Boolean
emailsDisabled
;
private
Boolean
lfsEnabled
;
private
Boolean
lfsEnabled
;
private
Boolean
requestAccessEnabled
;
private
Boolean
requestAccessEnabled
;
...
@@ -92,7 +117,7 @@ public class GroupParams {
...
@@ -92,7 +117,7 @@ public class GroupParams {
return
(
this
);
return
(
this
);
}
}
public
GroupParams
withProjectCreationLevel
(
Access
Level
projectCreationLevel
)
{
public
GroupParams
withProjectCreationLevel
(
ProjectCreation
Level
projectCreationLevel
)
{
this
.
projectCreationLevel
=
projectCreationLevel
;
this
.
projectCreationLevel
=
projectCreationLevel
;
return
(
this
);
return
(
this
);
}
}
...
@@ -102,7 +127,7 @@ public class GroupParams {
...
@@ -102,7 +127,7 @@ public class GroupParams {
return
(
this
);
return
(
this
);
}
}
public
GroupParams
withSubgroupCreationLevel
(
Access
Level
subgroupCreationLevel
)
{
public
GroupParams
withSubgroupCreationLevel
(
SubgroupCreation
Level
subgroupCreationLevel
)
{
this
.
subgroupCreationLevel
=
subgroupCreationLevel
;
this
.
subgroupCreationLevel
=
subgroupCreationLevel
;
return
(
this
);
return
(
this
);
}
}
...
@@ -149,9 +174,9 @@ public class GroupParams {
...
@@ -149,9 +174,9 @@ public class GroupParams {
.
withParam
(
"share_with_group_lock"
,
shareWithGroupLock
)
.
withParam
(
"share_with_group_lock"
,
shareWithGroupLock
)
.
withParam
(
"require_two_factor_authentication"
,
requireTwoFactorAuthentication
)
.
withParam
(
"require_two_factor_authentication"
,
requireTwoFactorAuthentication
)
.
withParam
(
"two_factor_grace_period"
,
twoFactorGracePeriod
)
.
withParam
(
"two_factor_grace_period"
,
twoFactorGracePeriod
)
.
withParam
(
"project_creation_level"
,
getAccessLevelString
(
projectCreationLevel
)
)
.
withParam
(
"project_creation_level"
,
projectCreationLevel
)
.
withParam
(
"auto_devops_enabled"
,
autoDevopsEnabled
)
.
withParam
(
"auto_devops_enabled"
,
autoDevopsEnabled
)
.
withParam
(
"subgroup_creation_level"
,
getAccessLevelString
(
subgroupCreationLevel
)
)
.
withParam
(
"subgroup_creation_level"
,
subgroupCreationLevel
)
.
withParam
(
"emails_disabled"
,
emailsDisabled
)
.
withParam
(
"emails_disabled"
,
emailsDisabled
)
.
withParam
(
"lfs_enabled"
,
lfsEnabled
)
.
withParam
(
"lfs_enabled"
,
lfsEnabled
)
.
withParam
(
"request_access_enabled"
,
requestAccessEnabled
)
.
withParam
(
"request_access_enabled"
,
requestAccessEnabled
)
...
@@ -167,26 +192,4 @@ public class GroupParams {
...
@@ -167,26 +192,4 @@ public class GroupParams {
return
(
form
);
return
(
form
);
}
}
private
String
getAccessLevelString
(
AccessLevel
level
)
{
if
(
level
==
null
)
{
return
null
;
}
switch
(
level
)
{
case
NONE:
return
"noone"
;
case
DEVELOPER:
return
"developer"
;
case
MAINTAINER:
return
"maintainer"
;
default
:
throw
new
RuntimeException
(
"Invalid access level"
);
}
}
}
}
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment