test_class.file: services/thingsearch/persistence/src/test/java/org/eclipse/ditto/services/thingsearch/persistence/write/mapping/EnforcedThingMapperTest.java
test_class.identifier: EnforcedThingMapperTest
test_case.body: @Test
      public void testV2Thing() {
          final JsonObject thing = JsonFactory.newObject("{\n" +
                  "  \"thingId\": \"hello:world\",\n" +
                  "  \"_namespace\": \"hello\",\n" +
                  "  \"_revision\": 1024,\n" +
                  "  \"_modified\": \"2019-01-02T03:04:05.006Z\",\n" +
                  "  \"policyId\": \"hello:world\",\n" +
                  "  \"features\": {\n" +
                  "    \"hi\": {\n" +
                  "      \"definition\": [\n" +
                  "        \"earth:v0:1\",\n" +
                  "        \"mars:v0:2\"\n" +
                  "      ],\n" +
                  "      \"properties\": {\n" +
                  "        \"there\": true\n" +
                  "      }\n" +
                  "    }\n" +
                  "  },\n" +
                  "  \"attributes\": {\n" +
                  "    \"hello\": \"world\"\n" +
                  "  }\n" +
                  "}");
  
          final Enforcer enforcer = PolicyEnforcers.defaultEvaluator(
                  PoliciesModelFactory.newPolicyBuilder(PolicyId.of("policy", "id"))
                          .forLabel("grant-root")
                          .setSubject("g:0", SubjectType.GENERATED)
                          .setGrantedPermissions(THING, "/", Permission.READ)
                          .forLabel("grant-d")
                          .setSubject("g:1", SubjectType.GENERATED)
                          .setGrantedPermissions(THING, "/features/hi/properties/there", Permission.READ)
                          .build());
  
          final long policyRevision = 56L;
  
          final JsonObject expectedJson = JsonFactory.newObject("{\n" +
                  "  \"_id\": \"hello:world\",\n" +
                  "  \"_revision\": { \"$numberLong\": \"1024\" },\n" +
                  "  \"_namespace\": \"hello\",\n" +
                  "  \"gr\":[\"g:0\",\"g:1\"],\n"+
                  "  \"policyId\": \"hello:world\",\n" +
                  "  \"__policyRev\": { \"$numberLong\": \"56\" },\n" +
                  "  \"s\": {\n" +
                  "    \"thingId\": \"hello:world\",\n" +
                  "    \"_namespace\": \"hello\",\n" +
                  "    \"_revision\": 1024,\n" +
                  "    \"_modified\": \"2019-01-02T03:04:05.006Z\",\n" +
                  "    \"policyId\": \"hello:world\",\n" +
                  "    \"features\": { \"hi\": { \"definition\": [ \"earth:v0:1\", \"mars:v0:2\" ], \"properties\": { \"there\": true } } },\n" +
                  "    \"attributes\": { \"hello\": \"world\" }\n" +
                  "  },\n" +
                  "  \"d\": [\n" +
                  "    { \"k\": \"/thingId\", \"v\": \"hello:world\", \"g\": [ \"g:0\" ], \"r\": [] },\n" +
                  "    { \"k\": \"/_namespace\", \"v\": \"hello\", \"g\": [ \"g:0\" ], \"r\": [] },\n" +
                  "    { \"k\": \"/_revision\", \"v\": 1024, \"g\": [ \"g:0\" ], \"r\": [] },\n" +
                  "    { \"k\": \"/_modified\", \"v\": \"2019-01-02T03:04:05.006Z\", \"g\": [ \"g:0\" ], \"r\": [] },\n" +
                  "    { \"k\": \"/policyId\", \"v\": \"hello:world\", \"g\": [ \"g:0\" ], \"r\": [] },\n" +
                  "    { \"k\": \"/features/hi/definition\"," +
                  "      \"v\": \"earth:v0:1\", \"g\": [ \"g:0\" ], \"r\": [] },\n" +
                  "    { \"k\": \"/features/*/definition\"," +
                  "      \"v\": \"earth:v0:1\", \"g\": [ \"g:0\" ], \"r\": [] },\n" +
                  "    { \"k\": \"/features/hi/definition\"," +
                  "      \"v\": \"mars:v0:2\", \"g\": [ \"g:0\" ], \"r\": [] },\n" +
                  "    { \"k\": \"/features/*/definition\"," +
                  "      \"v\": \"mars:v0:2\", \"g\": [ \"g:0\" ], \"r\": [] },\n" +
                  "    { \"k\": \"/features/hi/properties/there\", \"v\": true, \"g\": [ \"g:1\", \"g:0\" ], \"r\": [] },\n" +
                  "    { \"k\": \"/features/*/properties/there\", \"v\": true, \"g\": [ \"g:1\", \"g:0\" ], \"r\": [] },\n" +
                  "    { \"k\": \"/attributes/hello\", \"v\": \"world\", \"g\": [ \"g:0\" ], \"r\": [] }\n" +
                  "  ]\n" +
                  "}");
  
          final Document result = EnforcedThingMapper.mapThing(thing, enforcer, policyRevision);
  
          assertThat(JsonFactory.newObject(result.toJson())).isEqualTo(expectedJson);
      }
test_case.class_method_signature: EnforcedThingMapperTest.testV2Thing()
test_case.full_signature: @Test public void testV2Thing()
test_case.identifier: testV2Thing
test_case.invocations: newObject defaultEvaluator build setGrantedPermissions setSubject forLabel setGrantedPermissions setSubject forLabel newPolicyBuilder of newObject mapThing isEqualTo assertThat newObject toJson
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void testV2Thing()
focal_class.declarator: THING_ROOT_RESOURCE_KEY = ResourceKey.newInstance(ThingCommand.RESOURCE_TYPE, "/")
focal_class.modifier: private static final
focal_class.original_string: private static final ResourceKey THING_ROOT_RESOURCE_KEY = ResourceKey.newInstance(ThingCommand.RESOURCE_TYPE, "/");
focal_class.type: ResourceKey
focal_class.var_name: THING_ROOT_RESOURCE_KEY
focal_class.file: services/thingsearch/persistence/src/main/java/org/eclipse/ditto/services/thingsearch/persistence/write/mapping/EnforcedThingMapper.java
focal_class.identifier: EnforcedThingMapper
focal_class.class_method_signature: EnforcedThingMapper.mapThing(final JsonObject thing, final Enforcer enforcer, final long policyRevision)
focal_class.full_signature: public static Document mapThing(final JsonObject thing, final Enforcer enforcer, final long policyRevision)
focal_class.identifier: mapThing
focal_class.modifiers: public static
focal_class.parameters: (final JsonObject thing, final Enforcer enforcer, final long policyRevision)
focal_class.return: Document
focal_class.signature: Document mapThing(final JsonObject thing, final Enforcer enforcer, final long policyRevision)
focal_class.class_method_signature: EnforcedThingMapper.toWriteModel(final JsonObject thing,
              final Enforcer enforcer,
              final long policyRevision)
focal_class.full_signature: public static ThingWriteModel toWriteModel(final JsonObject thing,
              final Enforcer enforcer,
              final long policyRevision)
focal_class.identifier: toWriteModel
focal_class.modifiers: public static
focal_class.parameters: (final JsonObject thing,
              final Enforcer enforcer,
              final long policyRevision)
focal_class.return: ThingWriteModel
focal_class.signature: ThingWriteModel toWriteModel(final JsonObject thing,
              final Enforcer enforcer,
              final long policyRevision)
focal_class.class_method_signature: EnforcedThingMapper.toWriteModel(final JsonObject thing,
              final Enforcer enforcer,
              final long policyRevision,
              final int maxArraySize)
focal_class.full_signature: public static ThingWriteModel toWriteModel(final JsonObject thing,
              final Enforcer enforcer,
              final long policyRevision,
              final int maxArraySize)
focal_class.identifier: toWriteModel
focal_class.modifiers: public static
focal_class.parameters: (final JsonObject thing,
              final Enforcer enforcer,
              final long policyRevision,
              final int maxArraySize)
focal_class.return: ThingWriteModel
focal_class.signature: ThingWriteModel toWriteModel(final JsonObject thing,
              final Enforcer enforcer,
              final long policyRevision,
              final int maxArraySize)
focal_class.class_method_signature: EnforcedThingMapper.getGlobalRead(final Enforcer enforcer)
focal_class.full_signature: private static BsonArray getGlobalRead(final Enforcer enforcer)
focal_class.identifier: getGlobalRead
focal_class.modifiers: private static
focal_class.parameters: (final Enforcer enforcer)
focal_class.return: BsonArray
focal_class.signature: BsonArray getGlobalRead(final Enforcer enforcer)
focal_class.class_method_signature: EnforcedThingMapper.pruneArrays(final JsonObject thing, final long maxArraySize)
focal_class.full_signature: private static JsonObject pruneArrays(final JsonObject thing, final long maxArraySize)
focal_class.identifier: pruneArrays
focal_class.modifiers: private static
focal_class.parameters: (final JsonObject thing, final long maxArraySize)
focal_class.return: JsonObject
focal_class.signature: JsonObject pruneArrays(final JsonObject thing, final long maxArraySize)
focal_method.body: public static Document mapThing(final JsonObject thing, final Enforcer enforcer, final long policyRevision) {
          return toWriteModel(thing, enforcer, policyRevision).getThingDocument();
      }
focal_method.class_method_signature: EnforcedThingMapper.mapThing(final JsonObject thing, final Enforcer enforcer, final long policyRevision)
focal_method.full_signature: public static Document mapThing(final JsonObject thing, final Enforcer enforcer, final long policyRevision)
focal_method.identifier: mapThing
focal_method.invocations: getThingDocument toWriteModel
focal_method.modifiers: public static
focal_method.parameters: (final JsonObject thing, final Enforcer enforcer, final long policyRevision)
focal_method.return: Document
focal_method.signature: Document mapThing(final JsonObject thing, final Enforcer enforcer, final long policyRevision)