use of com.enonic.xp.schema.relationship.RelationshipType in project xp by enonic.
the class XmlRelationshipTypeParserTest method assertResult.
private void assertResult() throws Exception {
final RelationshipType result = this.builder.build();
assertEquals("myapplication:name", result.getName().toString());
assertEquals("description", result.getDescription());
assertEquals("likes", result.getFromSemantic());
assertEquals("liked by", result.getToSemantic());
assertEquals("[myapplication:animal, myapplication:person]", result.getAllowedFromTypes().toString());
assertEquals("[myapplication:vehicle]", result.getAllowedToTypes().toString());
}
use of com.enonic.xp.schema.relationship.RelationshipType in project xp by enonic.
the class RelationshipTypeServiceImpl method getAll.
@Override
public RelationshipTypes getAll() {
final Set<RelationshipType> list = new LinkedHashSet<>(this.builtInTypes.getAll().getList());
for (final Application application : this.applicationService.getInstalledApplications()) {
final RelationshipTypes types = getByApplication(application.getKey());
list.addAll(types.getList());
}
return RelationshipTypes.from(list);
}
use of com.enonic.xp.schema.relationship.RelationshipType in project xp by enonic.
the class RelationshipTypeServiceImplTest method testSystemTypes.
@Test
public void testSystemTypes() {
RelationshipTypes relationshipTypes = service.getAll();
assertNotNull(relationshipTypes);
assertEquals(2, relationshipTypes.getSize());
relationshipTypes = service.getByApplication(ApplicationKey.SYSTEM);
assertNotNull(relationshipTypes);
assertEquals(2, relationshipTypes.getSize());
RelationshipType relationshipType = service.getByName(RelationshipTypeName.PARENT);
assertNotNull(relationshipType);
relationshipType = service.getByName(RelationshipTypeName.REFERENCE);
assertNotNull(relationshipType);
}
use of com.enonic.xp.schema.relationship.RelationshipType in project xp by enonic.
the class RelationshipTypeLoader method load.
@Override
protected RelationshipType load(final RelationshipTypeName name, final Resource resource) {
final RelationshipType.Builder builder = RelationshipType.create();
parseXml(resource, builder);
final Instant modifiedTime = Instant.ofEpochMilli(resource.getTimestamp());
builder.modifiedTime(modifiedTime);
builder.createdTime(modifiedTime);
builder.icon(loadIcon(name));
return builder.name(name).build();
}
use of com.enonic.xp.schema.relationship.RelationshipType in project xp by enonic.
the class BuiltinRelationshipTypes method generateSystemRelationshipTypes.
private List<RelationshipType> generateSystemRelationshipTypes() {
final List<RelationshipType> relationshipTypes = new ArrayList<>();
for (RelationshipType relationshipType : RELATIONSHIP_TYPES) {
relationshipType = RelationshipType.create(relationshipType).icon(loadSchemaIcon(RELATIONSHIP_TYPES_FOLDER, relationshipType.getName().getLocalName())).build();
relationshipTypes.add(relationshipType);
}
return relationshipTypes;
}
Aggregations