Skip to content
Snippets Groups Projects
Commit 5d816f33 authored by Florian Spreckelsen's avatar Florian Spreckelsen
Browse files

AUDIT: Review !57

parent d0925114
No related branches found
No related tags found
2 merge requests!58REL: prepare release 0.7.2,!57F 220
Pipeline #20705 passed
Showing with 19 additions and 1 deletion
......@@ -542,6 +542,7 @@ public class Entity extends AbstractObservable implements EntityInterface {
@Override
public SerializeFieldStrategy getSerializeFieldStrategy() {
// @review Florian Spreckelsen 2022-03-22
if (this.serializeFieldStrategy == null) {
this.serializeFieldStrategy = new SerializeFieldStrategy(getSelections());
}
......@@ -1079,6 +1080,7 @@ public class Entity extends AbstractObservable implements EntityInterface {
@Override
public void setSerializeFieldStrategy(SerializeFieldStrategy s) {
// @review Florian Spreckelsen 2022-03-22
this.serializeFieldStrategy = s;
}
}
......@@ -578,11 +578,13 @@ public class EntityWrapper implements EntityInterface {
@Override
public void setSerializeFieldStrategy(SerializeFieldStrategy s) {
// @review Florian Spreckelsen 2022-03-22
this.entity.setSerializeFieldStrategy(s);
}
@Override
public SerializeFieldStrategy getSerializeFieldStrategy() {
// @review Florian Spreckelsen 2022-03-22
return this.entity.getSerializeFieldStrategy();
}
}
......@@ -83,6 +83,8 @@ public class EntityToElementStrategy implements ToElementStrategy {
final EntityInterface entity,
final SerializeFieldStrategy serializeFieldStrategy) {
// @review Florian Spreckelsen 2022-03-22
if (entity.getEntityACL() != null) {
element.addContent(entity.getEntityACL().getPermissionsFor(SecurityUtils.getSubject()));
}
......
......@@ -10,6 +10,7 @@ package org.caosdb.server.entity.xml;
*/
public class IdAndServerMessagesOnlyStrategy extends SerializeFieldStrategy {
// @review Florian Spreckelsen 2022-03-22
@Override
public boolean isToBeSet(String field) {
return "id".equals(field)
......
......@@ -99,6 +99,8 @@ public class CaosDBToGrpcConverters {
public EntityResponse.Builder convert(final EntityInterface from) {
// @review Florian Spreckelsen 2022-03-22
SerializeFieldStrategy s = from.getSerializeFieldStrategy();
final Builder entityBuilder = Entity.newBuilder();
......@@ -153,6 +155,7 @@ public class CaosDBToGrpcConverters {
}
private FileDescriptor.Builder convert(SerializeFieldStrategy s, FileProperties fileProperties) {
// @review Florian Spreckelsen 2022-03-22
FileDescriptor.Builder result = null;
if (s.isToBeSet("path")) {
result = FileDescriptor.newBuilder();
......@@ -227,6 +230,7 @@ public class CaosDBToGrpcConverters {
}
public org.caosdb.api.entity.v1.Property convert(final Property from) {
// @review Florian Spreckelsen 2022-03-22
final org.caosdb.api.entity.v1.Property.Builder builder =
org.caosdb.api.entity.v1.Property.newBuilder();
......@@ -448,7 +452,7 @@ public class CaosDBToGrpcConverters {
public Iterable<? extends org.caosdb.api.entity.v1.Property> convertProperties(
final EntityInterface from) {
// @review Florian Spreckelsen 2022-03-22
final Iterator<org.caosdb.server.entity.wrapper.Property> iterator =
from.getProperties().iterator();
return () ->
......@@ -505,6 +509,7 @@ public class CaosDBToGrpcConverters {
public void appendMessages(
final EntityInterface from, final org.caosdb.api.entity.v1.EntityResponse.Builder builder) {
// @review Florian Spreckelsen 2022-03-22
SerializeFieldStrategy s = from.getSerializeFieldStrategy();
if (from.hasMessage(Message.MessageType.Error.toString()) && s.isToBeSet("error")) {
builder.addAllErrors(convert(from.getMessages(Message.MessageType.Error.toString())));
......@@ -519,6 +524,7 @@ public class CaosDBToGrpcConverters {
public void appendMessages(
final EntityInterface from, final org.caosdb.api.entity.v1.IdResponse.Builder builder) {
// @review Florian Spreckelsen 2022-03-22
SerializeFieldStrategy s = from.getSerializeFieldStrategy();
if (from.hasMessage(Message.MessageType.Error.toString()) && s.isToBeSet("error")) {
builder.addAllErrors(convert(from.getMessages(Message.MessageType.Error.toString())));
......
......@@ -86,6 +86,7 @@ public class EntityTransactionServiceImpl extends EntityTransactionServiceImplBa
* @throws Exception
*/
public MultiTransactionResponse retrieve(final MultiTransactionRequest request) throws Exception {
// @review Florian Spreckelsen 2022-03-22
final MultiTransactionResponse.Builder builder = MultiTransactionResponse.newBuilder();
final RetrieveContainer container =
new RetrieveContainer(
......
......@@ -77,6 +77,8 @@ public class Retrieve extends Transaction<RetrieveContainer> {
@Override
protected void postTransaction() {
// @review Florian Spreckelsen 2022-03-22
// generate Error for missing RETRIEVE:ENTITY Permission.
for (final EntityInterface e : getContainer()) {
if (e.hasEntityACL()) {
......
......@@ -64,6 +64,7 @@ public class CaosDBToGrpcConvertersTest {
@Test
public void testIdServerMessagesOnlyStrategy() {
// @review Florian Spreckelsen 2022-03-22
RetrieveEntity entity = new RetrieveEntity(null);
// must be printed
......
......@@ -28,6 +28,7 @@ import org.junit.Test;
public class RetrieveTest {
// @review Florian Spreckelsen 2022-03-22
@BeforeClass
public static void setup() throws IOException {
CaosDBServer.initServerProperties();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment