use of com.liferay.blade.samples.jndiservicebuilder.model.Region in project liferay-blade-samples by liferay.
the class RegionPersistenceTest method testFetchByPrimaryKeysWithMultiplePrimaryKeysWhereSomePrimaryKeysExist.
@Test
public void testFetchByPrimaryKeysWithMultiplePrimaryKeysWhereSomePrimaryKeysExist() throws Exception {
Region newRegion = addRegion();
long pk = RandomTestUtil.nextLong();
Set<Serializable> primaryKeys = new HashSet<Serializable>();
primaryKeys.add(newRegion.getPrimaryKey());
primaryKeys.add(pk);
Map<Serializable, Region> regions = _persistence.fetchByPrimaryKeys(primaryKeys);
Assert.assertEquals(1, regions.size());
Assert.assertEquals(newRegion, regions.get(newRegion.getPrimaryKey()));
}
use of com.liferay.blade.samples.jndiservicebuilder.model.Region in project liferay-blade-samples by liferay.
the class RegionModelImpl method toXmlString.
@Override
public String toXmlString() {
Map<String, Function<Region, 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<Region, Object>> entry : attributeGetterFunctions.entrySet()) {
String attributeName = entry.getKey();
Function<Region, Object> attributeGetterFunction = entry.getValue();
sb.append("<column><column-name>");
sb.append(attributeName);
sb.append("</column-name><column-value><![CDATA[");
sb.append(attributeGetterFunction.apply((Region) this));
sb.append("]]></column-value></column>");
}
sb.append("</model>");
return sb.toString();
}
use of com.liferay.blade.samples.jndiservicebuilder.model.Region in project liferay-blade-samples by liferay.
the class RegionModelImpl method toString.
@Override
public String toString() {
Map<String, Function<Region, Object>> attributeGetterFunctions = getAttributeGetterFunctions();
StringBundler sb = new StringBundler(4 * attributeGetterFunctions.size() + 2);
sb.append("{");
for (Map.Entry<String, Function<Region, Object>> entry : attributeGetterFunctions.entrySet()) {
String attributeName = entry.getKey();
Function<Region, Object> attributeGetterFunction = entry.getValue();
sb.append(attributeName);
sb.append("=");
sb.append(attributeGetterFunction.apply((Region) this));
sb.append(", ");
}
if (sb.index() > 1) {
sb.setIndex(sb.index() - 1);
}
sb.append("}");
return sb.toString();
}
Aggregations