Package org.lilyproject.repository.api

Examples of org.lilyproject.repository.api.HierarchyPath


                    elements[i] = result.object;
                } else {
                    return new ActionResult(false, null, duration);
                }
            }
            return new ActionResult(true, new HierarchyPath(elements), duration);
    }
View Full Code Here


                values.add(index, result.object);
                return new ActionResult(true, values, result.duration);
            }
            return result;
        } else if (valueType.getBaseName().equals("PATH")) {
            HierarchyPath path = (HierarchyPath) value;
            Object[] values = path.getElements();
            int index = (int) (Math.random() * values.length);
            // LinkedRecordTypeName should only be given in case of link fields
            ActionResult result = updateLinkValue(testAction, values[index], valueType.getNestedValueType());
            if (result.success && result.object != null) {
                values[index] = result.object;
View Full Code Here

            Object[] elements = ((HierarchyPath)value).getElements();
            Object[] newElements = new Object[elements.length];
            for (int i = 0; i < newElements.length; i++) {
                newElements[i] = cloneValue(elements[i], parentRecords);
            }
            return new HierarchyPath(newElements);
        }
        if (value instanceof List) {
            List<Object> newList = new ArrayList<Object>();
            List<Object> values = (List<Object>)value;
            for (Object object : values) {
View Full Code Here

            if (subValue != null) {
                elements.add(subValue);
            }
        }

        return new HierarchyPath(elements.toArray(new Object[elements.size()]));
    }
View Full Code Here

        return array;
    }

    private JsonNode pathToJson(Object value, ValueType valueType, WriteOptions options, Namespaces namespaces,
            LRepository repository) throws RepositoryException, InterruptedException {
        HierarchyPath path = (HierarchyPath)value;
        ArrayNode array = JsonNodeFactory.instance.arrayNode();
        for (Object element : path.getElements()) {
            array.add(valueToJson(element, valueType, options, namespaces, repository));
        }
        return array;
    }
View Full Code Here

        random.nextBytes(bytes4);
        Blob blob4 = writeBlob(bytes4, "aMediaType", "testUpdateMutableHierarchyBlob4");

        Record record = repository.newRecord();
        record.setRecordType(recordType.getName(), null);
        record.setField(fieldName, new HierarchyPath(blob, blob2));
        record = repository.create(record);

        Record record2 = repository.newRecord(record.getId());
        record2.setRecordType(recordType.getName(), null);
        record2.setField(fieldName, new HierarchyPath(blob2, blob3, blob4));
        record2 = repository.update(record2, false, false);

        // Mutable update of first version
        Record record3 = repository.newRecord(record.getId());
        record3.setVersion(record.getVersion());
        record3.setRecordType(recordType.getName(), null);
        record3.setField(fieldName, new HierarchyPath(blob4, blob4));
        record3 = repository.update(record3, true, false);

        // Blob2
        byte[] readBytes = readBlob(record2.getId(), record2.getVersion(), fieldName, 0);
        assertTrue(Arrays.equals(bytes2, readBytes));
View Full Code Here

        random.nextBytes(bytes4);
        Blob blob4 = writeBlob(bytes4, "aMediaType", "testUpdateMutableMultivalueHierarchyBlob4");

        Record record = repository.newRecord();
        record.setRecordType(recordType.getName(), null);
        record.setField(fieldName, Arrays.asList(new HierarchyPath(blob, blob2), new HierarchyPath(blob3)));
        record = repository.create(record);

        Record record2 = repository.newRecord(record.getId());
        record2.setRecordType(recordType.getName(), null);
        record2.setField(fieldName, Arrays.asList(new HierarchyPath(blob2), new HierarchyPath(blob3, blob4)));
        record2 = repository.update(record2, false, false);

        // Mutable update of first version
        Record record3 = repository.newRecord(record.getId());
        record3.setVersion(record.getVersion());
        record3.setRecordType(recordType.getName(), null);
        record3.setField(fieldName, Arrays.asList(new HierarchyPath(blob3, blob4), new HierarchyPath(blob4)));
        record3 = repository.update(record3, true, false);

        // Blob2
        byte[] readBytes = readBlob(record2.getId(), record2.getVersion(), fieldName, 0, 0);
        assertTrue(Arrays.equals(bytes2, readBytes));
View Full Code Here

        random.nextBytes(bytes4);
        Blob blob4 = writeBlob(bytes4, "aMediaType", "testUpdateMutableMultivalueHierarchyBlob4");

        Record record = repository.newRecord();
        record.setRecordType(recordType.getName(), null);
        record.setField(fieldName, Arrays.asList(new HierarchyPath(blob, blob2), new HierarchyPath(blob3)));
        record = repository.create(record);

        Record record2 = repository.newRecord(record.getId());
        record2.setRecordType(recordType.getName(), null);
        record2.setField(fieldName, Arrays.asList(new HierarchyPath(blob2), new HierarchyPath(blob3, blob4)));
        record2 = repository.update(record2, false, false);

        repository.delete(record.getId());

        assertBlobDelete(expectDelete, blob);
View Full Code Here

            .field(fieldType2.getName(), 888)
            .build();

        testType("recordValueTypeId", "RECORD<{testRecordType}recordValueTypeRecordType>", recordField1);
        testType("recordValueTypeId", "LIST<RECORD<{testRecordType}recordValueTypeRecordType>>", Arrays.asList(recordField1, recordField2));
        testType("recordValueTypeId", "PATH<RECORD<{testRecordType}recordValueTypeRecordType>>", new HierarchyPath(recordField1, recordField2));
        testType("recordValueTypeId", "LIST<PATH<RECORD<{testRecordType}recordValueTypeRecordType>>>", Arrays.asList(new HierarchyPath(recordField1, recordField2), new HierarchyPath(recordField1, recordField3)));
    }
View Full Code Here

        testType("recordValueTypeId", "LINK", new Link(idGenerator.newRecordId()));
        testType("recordValueTypeId", "LINK<{testLinkType}linkValueTypeRecordType>", new Link(idGenerator.newRecordId()));
        testType("recordValueTypeId", "LIST<LINK<{testLinkType}linkValueTypeRecordType>>", Arrays.asList(new Link(idGenerator.newRecordId()), new Link(idGenerator.newRecordId())));
        testType("recordValueTypeId", "LIST<LINK>", Arrays.asList(new Link(idGenerator.newRecordId()), new Link(idGenerator.newRecordId())));
        testType("recordValueTypeId", "PATH<LINK<{testLinkType}linkValueTypeRecordType>>", new HierarchyPath(new Link(idGenerator.newRecordId()), new Link(idGenerator.newRecordId())));
        testType("recordValueTypeId", "PATH<LINK>", new HierarchyPath(new Link(idGenerator.newRecordId()), new Link(idGenerator.newRecordId())));
        testType("recordValueTypeId", "LIST<PATH<LINK<{testLinkType}linkValueTypeRecordType>>>", Arrays.asList(new HierarchyPath(new Link(idGenerator.newRecordId()), new Link(idGenerator.newRecordId())), new HierarchyPath(new Link(idGenerator.newRecordId()), new Link(idGenerator.newRecordId()))));
        testType("recordValueTypeId", "LIST<PATH<LINK>>", Arrays.asList(new HierarchyPath(new Link(idGenerator.newRecordId()), new Link(idGenerator.newRecordId())), new HierarchyPath(new Link(idGenerator.newRecordId()), new Link(idGenerator.newRecordId()))));
    }
View Full Code Here

TOP

Related Classes of org.lilyproject.repository.api.HierarchyPath

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.