use of com.liferay.blade.samples.jdbcservicebuilder.model.Country in project liferay-blade-samples by liferay.
the class CountryPersistenceTest method testFindByPrimaryKeyExisting.
@Test
public void testFindByPrimaryKeyExisting() throws Exception {
Country newCountry = addCountry();
Country existingCountry = _persistence.findByPrimaryKey(newCountry.getPrimaryKey());
Assert.assertEquals(existingCountry, newCountry);
}
use of com.liferay.blade.samples.jdbcservicebuilder.model.Country in project liferay-blade-samples by liferay.
the class CountryPersistenceTest method addCountry.
protected Country addCountry() throws Exception {
long pk = RandomTestUtil.nextLong();
Country country = _persistence.create(pk);
country.setCountryName(RandomTestUtil.randomString());
_countries.add(_persistence.update(country));
return country;
}
use of com.liferay.blade.samples.jdbcservicebuilder.model.Country in project liferay-blade-samples by liferay.
the class CountryPersistenceTest method testRemove.
@Test
public void testRemove() throws Exception {
Country newCountry = addCountry();
_persistence.remove(newCountry);
Country existingCountry = _persistence.fetchByPrimaryKey(newCountry.getPrimaryKey());
Assert.assertNull(existingCountry);
}
use of com.liferay.blade.samples.jdbcservicebuilder.model.Country in project liferay-blade-samples by liferay.
the class CountryModelImpl method toXmlString.
@Override
public String toXmlString() {
Map<String, Function<Country, Object>> attributeGetterFunctions = getAttributeGetterFunctions();
StringBundler sb = new StringBundler(5 * attributeGetterFunctions.size() + 4);
sb.append("<model><model-name>");
sb.append(getModelClassName());
sb.append("</model-name>");
for (Map.Entry<String, Function<Country, Object>> entry : attributeGetterFunctions.entrySet()) {
String attributeName = entry.getKey();
Function<Country, Object> attributeGetterFunction = entry.getValue();
sb.append("<column><column-name>");
sb.append(attributeName);
sb.append("</column-name><column-value><![CDATA[");
sb.append(attributeGetterFunction.apply((Country) this));
sb.append("]]></column-value></column>");
}
sb.append("</model>");
return sb.toString();
}
use of com.liferay.blade.samples.jdbcservicebuilder.model.Country in project liferay-blade-samples by liferay.
the class CountryModelImpl method toString.
@Override
public String toString() {
Map<String, Function<Country, Object>> attributeGetterFunctions = getAttributeGetterFunctions();
StringBundler sb = new StringBundler(4 * attributeGetterFunctions.size() + 2);
sb.append("{");
for (Map.Entry<String, Function<Country, Object>> entry : attributeGetterFunctions.entrySet()) {
String attributeName = entry.getKey();
Function<Country, Object> attributeGetterFunction = entry.getValue();
sb.append(attributeName);
sb.append("=");
sb.append(attributeGetterFunction.apply((Country) this));
sb.append(", ");
}
if (sb.index() > 1) {
sb.setIndex(sb.index() - 1);
}
sb.append("}");
return sb.toString();
}
Aggregations