Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Genesys PGR
Genesys Catalog
Genesys Catalog Server
Commits
ae45bc18
Commit
ae45bc18
authored
Jan 19, 2018
by
Matija Obreza
Browse files
`Descriptor` updated with publisher
- API endpoint to delete a descriptor - Descriptor#publisher added
parent
01420582
Changes
6
Hide whitespace changes
Inline
Side-by-side
genesys-catalog-core/src/main/java/org/genesys/catalog/model/vocab/ControlledVocabulary.java
View file @
ae45bc18
...
...
@@ -60,6 +60,12 @@ public class ControlledVocabulary extends UuidModel implements Publishable, AclA
@Column
()
private
boolean
published
;
/**
* Trait title in English.
*/
@Column
(
nullable
=
true
,
length
=
200
)
private
String
publisher
;
/**
* Trait title in English.
*/
...
...
@@ -125,6 +131,24 @@ public class ControlledVocabulary extends UuidModel implements Publishable, AclA
public
void
setPublished
(
final
boolean
published
)
{
this
.
published
=
published
;
}
/**
* Gets the publisher.
*
* @return the publisher
*/
public
String
getPublisher
()
{
return
publisher
;
}
/**
* Sets the publisher.
*
* @param publisher the new publisher
*/
public
void
setPublisher
(
String
publisher
)
{
this
.
publisher
=
publisher
;
}
/**
* Gets the version tag.
...
...
@@ -235,4 +259,5 @@ public class ControlledVocabulary extends UuidModel implements Publishable, AclA
this
.
terms
=
terms
;
}
}
genesys-catalog-core/src/main/java/org/genesys/catalog/service/DescriptorService.java
View file @
ae45bc18
...
...
@@ -33,20 +33,20 @@ public interface DescriptorService {
/**
* Creates the descriptor.
*
* @param
input the input
* @param
descriptor the descriptor
* @return the descriptor
*/
@PreAuthorize
(
"isAuthenticated()"
)
Descriptor
createDescriptor
(
Descriptor
input
);
Descriptor
createDescriptor
(
Descriptor
descriptor
);
/**
* Update descriptor.
*
* @param
input
updatable descriptor
* @param
descriptor
updatable descriptor
* @return updated descriptor
*/
@PreAuthorize
(
"hasRole('ADMINISTRATOR') or
hasPermission(#
input
, 'WRITE')"
)
Descriptor
updateDescriptor
(
Descriptor
input
);
@PreAuthorize
(
"hasRole('ADMINISTRATOR') or hasPermission(#
descriptor
, 'WRITE')"
)
Descriptor
updateDescriptor
(
Descriptor
descriptor
);
/**
* copy descriptor.
...
...
@@ -100,6 +100,7 @@ public interface DescriptorService {
* @param descriptor descriptor
* @return removed Descriptor
*/
@PreAuthorize
(
"hasRole('ADMINISTRATOR') or hasPermission(#descriptor, 'delete')"
)
Descriptor
removeDescriptor
(
Descriptor
descriptor
);
/**
...
...
genesys-catalog-core/src/main/java/org/genesys/catalog/service/impl/VocabularyServiceImpl.java
View file @
ae45bc18
...
...
@@ -107,6 +107,7 @@ public class VocabularyServiceImpl implements VocabularyService {
vocabulary
.
setDescription
(
input
.
getDescription
());
vocabulary
.
setPublished
(
input
.
isPublished
());
vocabulary
.
setPublisher
(
input
.
getPublisher
());
vocabulary
.
setTitle
(
input
.
getTitle
());
vocabulary
.
setTermUrlPrefix
(
input
.
getTermUrlPrefix
());
vocabulary
.
setUrl
(
input
.
getUrl
());
...
...
genesys-catalog-core/src/test/java/org/genesys/catalog/service/ControlledVocabularyTest.java
View file @
ae45bc18
...
...
@@ -182,10 +182,12 @@ public class ControlledVocabularyTest extends CatalogServiceTest {
vocab1
.
setUuid
(
uuid
);
vocab1
.
setVersion
(
result
.
getVersion
());
vocab1
.
setTitle
(
VOCABULARY_TITLE_2
);
vocab1
.
setPublisher
(
"PUBLISHER"
);
result
=
vocabularyService
.
updateVocabulary
(
vocab1
);
assertThat
(
result
.
getUuid
(),
is
(
uuid
));
assertThat
(
result
.
getTitle
(),
is
(
VOCABULARY_TITLE_2
));
assertThat
(
result
.
getDescription
(),
is
(
nullValue
()));
assertThat
(
result
.
getPublisher
(),
is
(
vocab1
.
getPublisher
()));
result
.
setTitle
(
VOCABULARY_TITLE_1
);
result
.
setDescription
(
VOCABULARY_DESC_1
);
...
...
genesys-catalog-server/src/main/java/org/genesys/catalog/server/controller/api/v0/DescriptorController.java
View file @
ae45bc18
...
...
@@ -27,6 +27,7 @@ import org.springframework.data.domain.Page;
import
org.springframework.data.domain.PageRequest
;
import
org.springframework.data.domain.Sort
;
import
org.springframework.security.access.prepost.PreAuthorize
;
import
org.springframework.web.bind.annotation.DeleteMapping
;
import
org.springframework.web.bind.annotation.GetMapping
;
import
org.springframework.web.bind.annotation.PathVariable
;
import
org.springframework.web.bind.annotation.PostMapping
;
...
...
@@ -85,6 +86,18 @@ public class DescriptorController {
return
descriptorService
.
upsertDescriptors
(
source
);
}
/**
* Delete descriptor.
*
* @param uuid the uuid
* @param version the version
* @return the descriptor
*/
@DeleteMapping
(
value
=
"/{UUID},{version}"
)
public
Descriptor
deleteDescriptor
(
@PathVariable
(
"UUID"
)
final
UUID
uuid
,
@PathVariable
(
"version"
)
final
int
version
)
{
return
descriptorService
.
removeDescriptor
(
descriptorService
.
getDescriptor
(
uuid
,
version
));
}
/**
* Loads descriptor by uuid and version and tries to publish it.
*
...
...
genesys-catalog-server/src/main/resources/liquibase/liquibase-changeLog.yml
View file @
ae45bc18
...
...
@@ -3115,3 +3115,15 @@ databaseChangeLog:
type
:
BIT(1)
defaultValueBoolean
:
false
tableName
:
descriptor
-
changeSet
:
id
:
1516386605000-1
author
:
mobreza
comment
:
Add publisher to Controlled Vocabulary
changes
:
-
addColumn
:
columns
:
-
column
:
name
:
publisher
type
:
VARCHAR(200)
tableName
:
controlled_vocabulary
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