@Test void testCheckEntityExists() { when(dataService.hasEntityType("typeId")).thenReturn(true); when(dataService.getRepository("typeId")).thenReturn(repository); when(repository.findOneById("identifier")).thenReturn(mock(Entity.class)); entityHelper.checkEntityExists(new ObjectIdentityImpl("entity-typeId", "identifier")); }
public void checkEntityExists(ObjectIdentity objectIdentity) { checkEntityTypeExists(objectIdentity.getType()); String entityTypeId = getEntityTypeIdFromType(objectIdentity.getType()); if (getEntityByIdentifier(objectIdentity.getIdentifier(), entityTypeId) == null) { throw new UnknownEntityException(entityTypeId, objectIdentity.getIdentifier()); } }
EntityHelper { public void checkEntityExists(ObjectIdentity objectIdentity) { checkEntityTypeExists(objectIdentity.getType()); String entityTypeId = getEntityTypeIdFromType(objectIdentity.getType()); if (getEntityByIdentifier(objectIdentity.getIdentifier(), entityTypeId) == null) { throw new UnknownEntityException(entityTypeId, objectIdentity.getIdentifier()); } } }
EntityHelper { public void checkEntityExists(ObjectIdentity objectIdentity) { checkEntityTypeExists(objectIdentity.getType()); String entityTypeId = getEntityTypeIdFromType(objectIdentity.getType()); if (getEntityByIdentifier(objectIdentity.getIdentifier(), entityTypeId) == null) { throw new UnknownEntityException(entityTypeId, objectIdentity.getIdentifier()); } } EntityHelper(DataService dataService); }
EntityHelper { public void checkEntityExists(ObjectIdentity objectIdentity) { checkEntityTypeExists(objectIdentity.getType()); String entityTypeId = getEntityTypeIdFromType(objectIdentity.getType()); if (getEntityByIdentifier(objectIdentity.getIdentifier(), entityTypeId) == null) { throw new UnknownEntityException(entityTypeId, objectIdentity.getIdentifier()); } } EntityHelper(DataService dataService); ObjectIdentity getObjectIdentity(String classId, String objectIdentifier); String getLabel(String typeId, String untypedIdentifier); String getLabel(String typeId); LabelledObjectIdentity getLabelledObjectIdentity(ObjectIdentity objectIdentity); void checkEntityExists(ObjectIdentity objectIdentity); void checkEntityTypeExists(String typeId); void checkIsNotSystem(String typeId); }
EntityHelper { public void checkEntityExists(ObjectIdentity objectIdentity) { checkEntityTypeExists(objectIdentity.getType()); String entityTypeId = getEntityTypeIdFromType(objectIdentity.getType()); if (getEntityByIdentifier(objectIdentity.getIdentifier(), entityTypeId) == null) { throw new UnknownEntityException(entityTypeId, objectIdentity.getIdentifier()); } } EntityHelper(DataService dataService); ObjectIdentity getObjectIdentity(String classId, String objectIdentifier); String getLabel(String typeId, String untypedIdentifier); String getLabel(String typeId); LabelledObjectIdentity getLabelledObjectIdentity(ObjectIdentity objectIdentity); void checkEntityExists(ObjectIdentity objectIdentity); void checkEntityTypeExists(String typeId); void checkIsNotSystem(String typeId); static final String ENTITY_PREFIX; static final String PLUGIN; static final String SYS_PLUGIN; }