Search in sources :

Example 1 with Country

use of com.liferay.blade.samples.dspservicebuilder.model.Country in project liferay-blade-samples by liferay.

the class CountryModelImpl method equals.

@Override
public boolean equals(Object object) {
    if (this == object) {
        return true;
    }
    if (!(object instanceof Country)) {
        return false;
    }
    Country country = (Country) object;
    long primaryKey = country.getPrimaryKey();
    if (getPrimaryKey() == primaryKey) {
        return true;
    } else {
        return false;
    }
}
Also used : Country(com.liferay.blade.samples.dspservicebuilder.model.Country)

Example 2 with Country

use of com.liferay.blade.samples.dspservicebuilder.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();
}
Also used : Function(java.util.function.Function) Country(com.liferay.blade.samples.dspservicebuilder.model.Country) HashMap(java.util.HashMap) LinkedHashMap(java.util.LinkedHashMap) Map(java.util.Map) StringBundler(com.liferay.petra.string.StringBundler)

Example 3 with Country

use of com.liferay.blade.samples.dspservicebuilder.model.Country in project liferay-blade-samples by liferay.

the class CountryPersistenceImpl method create.

/**
 * Creates a new country with the primary key. Does not add the country to the database.
 *
 * @param countryId the primary key for the new country
 * @return the new country
 */
@Override
public Country create(long countryId) {
    Country country = new CountryImpl();
    country.setNew(true);
    country.setPrimaryKey(countryId);
    return country;
}
Also used : CountryImpl(com.liferay.blade.samples.dspservicebuilder.model.impl.CountryImpl) Country(com.liferay.blade.samples.dspservicebuilder.model.Country)

Example 4 with Country

use of com.liferay.blade.samples.dspservicebuilder.model.Country in project liferay-blade-samples by liferay.

the class CountryPersistenceImpl method clearCache.

@Override
public void clearCache(List<Country> countries) {
    finderCache.clearCache(FINDER_CLASS_NAME_LIST_WITH_PAGINATION);
    finderCache.clearCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
    for (Country country : countries) {
        entityCache.removeResult(entityCacheEnabled, CountryImpl.class, country.getPrimaryKey());
    }
}
Also used : Country(com.liferay.blade.samples.dspservicebuilder.model.Country)

Example 5 with Country

use of com.liferay.blade.samples.dspservicebuilder.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();
}
Also used : Function(java.util.function.Function) Country(com.liferay.blade.samples.dspservicebuilder.model.Country) HashMap(java.util.HashMap) LinkedHashMap(java.util.LinkedHashMap) Map(java.util.Map) StringBundler(com.liferay.petra.string.StringBundler)

Aggregations

Country (com.liferay.blade.samples.dspservicebuilder.model.Country)7 StringBundler (com.liferay.petra.string.StringBundler)3 NoSuchCountryException (com.liferay.blade.samples.dspservicebuilder.exception.NoSuchCountryException)2 CountryImpl (com.liferay.blade.samples.dspservicebuilder.model.impl.CountryImpl)2 Session (com.liferay.portal.kernel.dao.orm.Session)2 HashMap (java.util.HashMap)2 LinkedHashMap (java.util.LinkedHashMap)2 Map (java.util.Map)2 Function (java.util.function.Function)2 FinderPath (com.liferay.portal.kernel.dao.orm.FinderPath)1 Query (com.liferay.portal.kernel.dao.orm.Query)1