Improved: Remove redundant specification of type arguments
(OFBIZ-10937) Since Java 1.7, when defining generic types it is unnecessary to redefine those types in the constructor when it is done in the declared type. git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-framework/trunk@1857906 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
@@ -181,7 +181,7 @@ public final class Datasource {
|
||||
if (sqlLoadPathElementList.isEmpty()) {
|
||||
this.sqlLoadPathList = Collections.emptyList();
|
||||
} else {
|
||||
List<SqlLoadPath> sqlLoadPathList = new ArrayList<SqlLoadPath>(sqlLoadPathElementList.size());
|
||||
List<SqlLoadPath> sqlLoadPathList = new ArrayList<>(sqlLoadPathElementList.size());
|
||||
for (Element sqlLoadPathElement : sqlLoadPathElementList) {
|
||||
sqlLoadPathList.add(new SqlLoadPath(sqlLoadPathElement));
|
||||
}
|
||||
@@ -191,7 +191,7 @@ public final class Datasource {
|
||||
if (readDataElementList.isEmpty()) {
|
||||
this.readDataList = Collections.emptyList();
|
||||
} else {
|
||||
List<ReadData> readDataList = new ArrayList<ReadData>(readDataElementList.size());
|
||||
List<ReadData> readDataList = new ArrayList<>(readDataElementList.size());
|
||||
for (Element readDataElement : readDataElementList) {
|
||||
readDataList.add(new ReadData(readDataElement));
|
||||
}
|
||||
|
||||
+2
-2
@@ -98,8 +98,8 @@ public final class DelegatorElement {
|
||||
if (groupMapElementList.isEmpty()) {
|
||||
throw new GenericEntityConfException("<delegator> element child elements <group-map> are missing" + lineNumberText);
|
||||
} else {
|
||||
List<GroupMap> groupMapList = new ArrayList<GroupMap>(groupMapElementList.size());
|
||||
Map<String, String> groupMapMap = new HashMap<String, String>();
|
||||
List<GroupMap> groupMapList = new ArrayList<>(groupMapElementList.size());
|
||||
Map<String, String> groupMapMap = new HashMap<>();
|
||||
for (Element groupMapElement : groupMapElementList) {
|
||||
GroupMap groupMap = new GroupMap(groupMapElement);
|
||||
groupMapList.add(groupMap);
|
||||
|
||||
+16
-16
@@ -81,8 +81,8 @@ public final class EntityConfig {
|
||||
if (resourceLoaderElementList.isEmpty()) {
|
||||
throw new GenericEntityConfException("<entity-config> element child elements <resource-loader> are missing");
|
||||
} else {
|
||||
List<ResourceLoader> resourceLoaderList = new ArrayList<ResourceLoader>(resourceLoaderElementList.size());
|
||||
Map<String, ResourceLoader> resourceLoaderMap = new HashMap<String, ResourceLoader>();
|
||||
List<ResourceLoader> resourceLoaderList = new ArrayList<>(resourceLoaderElementList.size());
|
||||
Map<String, ResourceLoader> resourceLoaderMap = new HashMap<>();
|
||||
for (Element resourceLoaderElement : resourceLoaderElementList) {
|
||||
ResourceLoader resourceLoader = new ResourceLoader(resourceLoaderElement);
|
||||
resourceLoaderList.add(resourceLoader);
|
||||
@@ -113,8 +113,8 @@ public final class EntityConfig {
|
||||
if (delegatorElementList.isEmpty()) {
|
||||
throw new GenericEntityConfException("<entity-config> element child elements <delegator> are missing");
|
||||
} else {
|
||||
List<DelegatorElement> delegatorList = new ArrayList<DelegatorElement>(delegatorElementList.size());
|
||||
Map<String, DelegatorElement> delegatorMap = new HashMap<String, DelegatorElement>();
|
||||
List<DelegatorElement> delegatorList = new ArrayList<>(delegatorElementList.size());
|
||||
Map<String, DelegatorElement> delegatorMap = new HashMap<>();
|
||||
for (Element delegatorElement : delegatorElementList) {
|
||||
DelegatorElement delegator = new DelegatorElement(delegatorElement);
|
||||
delegatorList.add(delegator);
|
||||
@@ -127,8 +127,8 @@ public final class EntityConfig {
|
||||
if (entityModelReaderElementList.isEmpty()) {
|
||||
throw new GenericEntityConfException("<entity-config> element child elements <entity-model-reader> are missing");
|
||||
} else {
|
||||
List<EntityModelReader> entityModelReaderList = new ArrayList<EntityModelReader>(entityModelReaderElementList.size());
|
||||
Map<String, EntityModelReader> entityModelReaderMap = new HashMap<String, EntityModelReader>();
|
||||
List<EntityModelReader> entityModelReaderList = new ArrayList<>(entityModelReaderElementList.size());
|
||||
Map<String, EntityModelReader> entityModelReaderMap = new HashMap<>();
|
||||
for (Element entityModelReaderElement : entityModelReaderElementList) {
|
||||
EntityModelReader entityModelReader = new EntityModelReader(entityModelReaderElement);
|
||||
entityModelReaderList.add(entityModelReader);
|
||||
@@ -141,8 +141,8 @@ public final class EntityConfig {
|
||||
if (entityGroupReaderElementList.isEmpty()) {
|
||||
throw new GenericEntityConfException("<entity-config> element child elements <entity-group-reader> are missing");
|
||||
} else {
|
||||
List<EntityGroupReader> entityGroupReaderList = new ArrayList<EntityGroupReader>(entityGroupReaderElementList.size());
|
||||
Map<String, EntityGroupReader> entityGroupReaderMap = new HashMap<String, EntityGroupReader>();
|
||||
List<EntityGroupReader> entityGroupReaderList = new ArrayList<>(entityGroupReaderElementList.size());
|
||||
Map<String, EntityGroupReader> entityGroupReaderMap = new HashMap<>();
|
||||
for (Element entityGroupReaderElement : entityGroupReaderElementList) {
|
||||
EntityGroupReader entityGroupReader = new EntityGroupReader(entityGroupReaderElement);
|
||||
entityGroupReaderList.add(entityGroupReader);
|
||||
@@ -156,8 +156,8 @@ public final class EntityConfig {
|
||||
this.entityEcaReaderList = Collections.emptyList();
|
||||
this.entityEcaReaderMap = Collections.emptyMap();
|
||||
} else {
|
||||
List<EntityEcaReader> entityEcaReaderList = new ArrayList<EntityEcaReader>(entityEcaReaderElementList.size());
|
||||
Map<String, EntityEcaReader> entityEcaReaderMap = new HashMap<String, EntityEcaReader>();
|
||||
List<EntityEcaReader> entityEcaReaderList = new ArrayList<>(entityEcaReaderElementList.size());
|
||||
Map<String, EntityEcaReader> entityEcaReaderMap = new HashMap<>();
|
||||
for (Element entityEcaReaderElement : entityEcaReaderElementList) {
|
||||
EntityEcaReader entityEcaReader = new EntityEcaReader(entityEcaReaderElement);
|
||||
entityEcaReaderList.add(new EntityEcaReader(entityEcaReaderElement));
|
||||
@@ -171,8 +171,8 @@ public final class EntityConfig {
|
||||
this.entityDataReaderList = Collections.emptyList();
|
||||
this.entityDataReaderMap = Collections.emptyMap();
|
||||
} else {
|
||||
List<EntityDataReader> entityDataReaderList = new ArrayList<EntityDataReader>(entityDataReaderElementList.size());
|
||||
Map<String, EntityDataReader> entityDataReaderMap = new HashMap<String, EntityDataReader>();
|
||||
List<EntityDataReader> entityDataReaderList = new ArrayList<>(entityDataReaderElementList.size());
|
||||
Map<String, EntityDataReader> entityDataReaderMap = new HashMap<>();
|
||||
for (Element entityDataReaderElement : entityDataReaderElementList) {
|
||||
EntityDataReader entityDataReader = new EntityDataReader(entityDataReaderElement);
|
||||
entityDataReaderList.add(entityDataReader);
|
||||
@@ -185,8 +185,8 @@ public final class EntityConfig {
|
||||
if (fieldTypeElementList.isEmpty()) {
|
||||
throw new GenericEntityConfException("<entity-config> element child elements <field-type> are missing");
|
||||
} else {
|
||||
List<FieldType> fieldTypeList = new ArrayList<FieldType>(fieldTypeElementList.size());
|
||||
Map<String, FieldType> fieldTypeMap = new HashMap<String, FieldType>();
|
||||
List<FieldType> fieldTypeList = new ArrayList<>(fieldTypeElementList.size());
|
||||
Map<String, FieldType> fieldTypeMap = new HashMap<>();
|
||||
for (Element fieldTypeElement : fieldTypeElementList) {
|
||||
FieldType fieldType = new FieldType(fieldTypeElement);
|
||||
fieldTypeList.add(fieldType);
|
||||
@@ -199,8 +199,8 @@ public final class EntityConfig {
|
||||
if (datasourceElementList.isEmpty()) {
|
||||
throw new GenericEntityConfException("<entity-config> element child elements <datasource> are missing");
|
||||
} else {
|
||||
List<Datasource> datasourceList = new ArrayList<Datasource>(datasourceElementList.size());
|
||||
Map<String, Datasource> datasourceMap = new HashMap<String, Datasource>();
|
||||
List<Datasource> datasourceList = new ArrayList<>(datasourceElementList.size());
|
||||
Map<String, Datasource> datasourceMap = new HashMap<>();
|
||||
for (Element datasourceElement : datasourceElementList) {
|
||||
Datasource datasource = new Datasource(datasourceElement);
|
||||
datasourceList.add(datasource);
|
||||
|
||||
+1
-1
@@ -57,7 +57,7 @@ public final class EntityDataReader {
|
||||
if (resourceElementList.isEmpty()) {
|
||||
this.resourceList = Collections.emptyList();
|
||||
} else {
|
||||
List<Resource> resourceList = new ArrayList<Resource>(resourceElementList.size());
|
||||
List<Resource> resourceList = new ArrayList<>(resourceElementList.size());
|
||||
for (Element resourceElement : resourceElementList) {
|
||||
resourceList.add(new Resource(resourceElement));
|
||||
}
|
||||
|
||||
+1
-1
@@ -49,7 +49,7 @@ public final class EntityEcaReader {
|
||||
if (resourceElementList.isEmpty()) {
|
||||
this.resourceList = Collections.emptyList();
|
||||
} else {
|
||||
List<Resource> resourceList = new ArrayList<Resource>(resourceElementList.size());
|
||||
List<Resource> resourceList = new ArrayList<>(resourceElementList.size());
|
||||
for (Element resourceElement : resourceElementList) {
|
||||
resourceList.add(new Resource(resourceElement));
|
||||
}
|
||||
|
||||
+1
-1
@@ -53,7 +53,7 @@ public final class EntityGroupReader {
|
||||
if (resourceElementList.isEmpty()) {
|
||||
this.resourceList = Collections.emptyList();
|
||||
} else {
|
||||
List<Resource> resourceList = new ArrayList<Resource>(resourceElementList.size());
|
||||
List<Resource> resourceList = new ArrayList<>(resourceElementList.size());
|
||||
for (Element resourceElement : resourceElementList) {
|
||||
resourceList.add(new Resource(resourceElement));
|
||||
}
|
||||
|
||||
+1
-1
@@ -49,7 +49,7 @@ public final class EntityModelReader {
|
||||
if (resourceElementList.isEmpty()) {
|
||||
this.resourceList = Collections.emptyList();
|
||||
} else {
|
||||
List<Resource> resourceList = new ArrayList<Resource>(resourceElementList.size());
|
||||
List<Resource> resourceList = new ArrayList<>(resourceElementList.size());
|
||||
for (Element resourceElement : resourceElementList) {
|
||||
resourceList.add(new Resource(resourceElement));
|
||||
}
|
||||
|
||||
+2
-2
@@ -146,7 +146,7 @@ public class DBCPConnectionFactory implements ConnectionFactory {
|
||||
poolConfig.setTestOnReturn(jdbcElement.getTestOnReturn());
|
||||
poolConfig.setTestWhileIdle(jdbcElement.getTestWhileIdle());
|
||||
|
||||
GenericObjectPool<PoolableConnection> pool = new GenericObjectPool<PoolableConnection>(factory, poolConfig);
|
||||
GenericObjectPool<PoolableConnection> pool = new GenericObjectPool<>(factory, poolConfig);
|
||||
factory.setPool(pool);
|
||||
|
||||
mds = new DebugManagedDataSource<>(pool, xacf.getTransactionRegistry());
|
||||
@@ -165,7 +165,7 @@ public class DBCPConnectionFactory implements ConnectionFactory {
|
||||
}
|
||||
|
||||
public static Map<String, Object> getDataSourceInfo(String helperName) {
|
||||
Map<String, Object> dataSourceInfo = new HashMap<String, Object>();
|
||||
Map<String, Object> dataSourceInfo = new HashMap<>();
|
||||
DebugManagedDataSource<? extends Connection> mds = dsCache.get(helperName);
|
||||
if (mds != null) {
|
||||
dataSourceInfo = mds.getInfo();
|
||||
|
||||
+1
-1
@@ -52,7 +52,7 @@ public class DebugManagedDataSource<C extends Connection> extends ManagedDataSou
|
||||
}
|
||||
|
||||
public Map<String, Object> getInfo() {
|
||||
Map<String, Object> dataSourceInfo = new HashMap<String, Object>();
|
||||
Map<String, Object> dataSourceInfo = new HashMap<>();
|
||||
dataSourceInfo.put("poolNumActive", super.getPool().getNumActive());
|
||||
dataSourceInfo.put("poolNumIdle", super.getPool().getNumIdle());
|
||||
dataSourceInfo.put("poolNumTotal", (super.getPool().getNumIdle() + super.getPool().getNumActive()));
|
||||
|
||||
@@ -71,7 +71,7 @@ public class GenericDAO {
|
||||
|
||||
public static final String module = GenericDAO.class.getName();
|
||||
|
||||
private static final ConcurrentHashMap<String, GenericDAO> genericDAOs = new ConcurrentHashMap<String, GenericDAO>();
|
||||
private static final ConcurrentHashMap<String, GenericDAO> genericDAOs = new ConcurrentHashMap<>();
|
||||
private final GenericHelperInfo helperInfo;
|
||||
private final ModelFieldTypeReader modelFieldTypeReader;
|
||||
private final Datasource datasource;
|
||||
@@ -183,7 +183,7 @@ public class GenericDAO {
|
||||
ModelEntity modelEntity = entity.getModelEntity();
|
||||
|
||||
// we don't want to update ALL fields, just the nonpk fields that are in the passed GenericEntity
|
||||
List<ModelField> partialFields = new LinkedList<ModelField>();
|
||||
List<ModelField> partialFields = new LinkedList<>();
|
||||
Collection<String> keys = entity.getAllKeys();
|
||||
|
||||
Iterator<ModelField> nopkIter = modelEntity.getNopksIterator();
|
||||
@@ -293,7 +293,7 @@ public class GenericDAO {
|
||||
|
||||
StringBuilder sql = new StringBuilder("UPDATE ").append(modelEntity.getTableName(datasource));
|
||||
sql.append(" SET ");
|
||||
List<EntityConditionParam> params = new LinkedList<EntityConditionParam>();
|
||||
List<EntityConditionParam> params = new LinkedList<>();
|
||||
for (Map.Entry<String, ? extends Object> entry: fieldsToSet.entrySet()) {
|
||||
String name = entry.getKey();
|
||||
ModelField field = modelEntity.getField(name);
|
||||
@@ -350,7 +350,7 @@ public class GenericDAO {
|
||||
throw new GenericEntityException("Failed to get model entity for " + meName, e);
|
||||
}
|
||||
|
||||
Map<String, Object> findByMap = new HashMap<String, Object>();
|
||||
Map<String, Object> findByMap = new HashMap<>();
|
||||
|
||||
// Now iterate the ModelViewLinks to construct the "WHERE" part for update/insert
|
||||
Iterator<ModelViewEntity.ModelViewLink> linkIter = modelViewEntity.getViewLinksIterator();
|
||||
@@ -420,7 +420,7 @@ public class GenericDAO {
|
||||
}
|
||||
|
||||
// Construct fieldsToSave list for this member entity
|
||||
List<ModelField> meFieldsToSave = new LinkedList<ModelField>();
|
||||
List<ModelField> meFieldsToSave = new LinkedList<>();
|
||||
for (ModelField modelField: fieldsToSave) {
|
||||
if (memberModelEntity.isField(modelField.getName())) {
|
||||
ModelField meModelField = memberModelEntity.getField(modelField.getName());
|
||||
@@ -513,9 +513,9 @@ public class GenericDAO {
|
||||
}
|
||||
|
||||
// we don't want to select ALL fields, just the nonpk fields that are in the passed GenericEntity
|
||||
List<ModelField> partialFields = new LinkedList<ModelField>();
|
||||
List<ModelField> partialFields = new LinkedList<>();
|
||||
|
||||
Set<String> tempKeys = new TreeSet<String>(keys);
|
||||
Set<String> tempKeys = new TreeSet<>(keys);
|
||||
|
||||
Iterator<ModelField> entityFieldIter = modelEntity.getFieldsIterator();
|
||||
while (entityFieldIter.hasNext()) {
|
||||
@@ -595,12 +595,12 @@ public class GenericDAO {
|
||||
}
|
||||
|
||||
// make two ArrayLists of fields, one for fields to select and the other for where clause fields (to find by)
|
||||
List<ModelField> selectFields = new LinkedList<ModelField>();
|
||||
List<ModelField> selectFields = new LinkedList<>();
|
||||
if (UtilValidate.isNotEmpty(fieldsToSelect)) {
|
||||
Set<String> tempKeys = new HashSet<String>();
|
||||
Set<String> tempKeys = new HashSet<>();
|
||||
tempKeys.addAll(fieldsToSelect);
|
||||
Set<String> fieldSetsToInclude = new HashSet<String>();
|
||||
Set<String> addedFields = new HashSet<String>();
|
||||
Set<String> fieldSetsToInclude = new HashSet<>();
|
||||
Set<String> addedFields = new HashSet<>();
|
||||
for (String fieldToSelect : fieldsToSelect) {
|
||||
if (tempKeys.contains(fieldToSelect)) {
|
||||
ModelField curField = modelEntity.getField(fieldToSelect);
|
||||
@@ -622,8 +622,8 @@ public class GenericDAO {
|
||||
}
|
||||
if (UtilValidate.isNotEmpty(fieldSetsToInclude)) {
|
||||
Iterator<ModelField> fieldIter = modelEntity.getFieldsIterator();
|
||||
Set<String> extraFields = new HashSet<String>();
|
||||
Set<String> reasonSets = new HashSet<String>();
|
||||
Set<String> extraFields = new HashSet<>();
|
||||
Set<String> reasonSets = new HashSet<>();
|
||||
while (fieldIter.hasNext()) {
|
||||
ModelField curField = fieldIter.next();
|
||||
String fieldSet = curField.getFieldSet();
|
||||
@@ -668,9 +668,9 @@ public class GenericDAO {
|
||||
List<EntityCondition> viewHavingConditions = null;
|
||||
List<String> viewOrderByList = null;
|
||||
if (modelViewEntity != null) {
|
||||
viewWhereConditions = new LinkedList<EntityCondition>();
|
||||
viewHavingConditions = new LinkedList<EntityCondition>();
|
||||
viewOrderByList = new LinkedList<String>();
|
||||
viewWhereConditions = new LinkedList<>();
|
||||
viewHavingConditions = new LinkedList<>();
|
||||
viewOrderByList = new LinkedList<>();
|
||||
modelViewEntity.populateViewEntityConditionInformation(modelFieldTypeReader, viewWhereConditions, viewHavingConditions, viewOrderByList, null);
|
||||
}
|
||||
|
||||
@@ -678,7 +678,7 @@ public class GenericDAO {
|
||||
sqlBuffer.append(SqlJdbcUtil.makeFromClause(modelEntity, modelFieldTypeReader, datasource));
|
||||
|
||||
// WHERE clause
|
||||
List<EntityConditionParam> whereEntityConditionParams = new LinkedList<EntityConditionParam>();
|
||||
List<EntityConditionParam> whereEntityConditionParams = new LinkedList<>();
|
||||
makeConditionWhereString(sqlBuffer, " WHERE ", modelEntity, whereEntityCondition, viewWhereConditions, whereEntityConditionParams);
|
||||
|
||||
// GROUP BY clause for view-entity
|
||||
@@ -687,11 +687,11 @@ public class GenericDAO {
|
||||
}
|
||||
|
||||
// HAVING clause
|
||||
List<EntityConditionParam> havingEntityConditionParams = new LinkedList<EntityConditionParam>();
|
||||
List<EntityConditionParam> havingEntityConditionParams = new LinkedList<>();
|
||||
makeConditionHavingString(sqlBuffer, " HAVING ", modelEntity, havingEntityCondition, viewHavingConditions, havingEntityConditionParams);
|
||||
|
||||
// ORDER BY clause
|
||||
List<String> orderByExpanded = new LinkedList<String>();
|
||||
List<String> orderByExpanded = new LinkedList<>();
|
||||
// add the manually specified ones, then the ones in the view entity's entity-condition
|
||||
if (orderBy != null) {
|
||||
orderByExpanded.addAll(orderBy);
|
||||
@@ -755,7 +755,7 @@ public class GenericDAO {
|
||||
modelViewEntity = (ModelViewEntity) modelEntity;
|
||||
}
|
||||
|
||||
List<EntityCondition> conditions = new LinkedList<EntityCondition>();
|
||||
List<EntityCondition> conditions = new LinkedList<>();
|
||||
if (UtilValidate.isNotEmpty(whereEntityCondition)) {
|
||||
conditions.add(whereEntityCondition);
|
||||
}
|
||||
@@ -857,7 +857,7 @@ public class GenericDAO {
|
||||
|
||||
// get the column name string to select
|
||||
StringBuilder selsb = new StringBuilder();
|
||||
List<String> fldlist = new LinkedList<String>();
|
||||
List<String> fldlist = new LinkedList<>();
|
||||
|
||||
for (Iterator<ModelField> iterator = modelEntityTwo.getFieldsIterator(); iterator.hasNext();) {
|
||||
ModelField mf = iterator.next();
|
||||
@@ -885,7 +885,7 @@ public class GenericDAO {
|
||||
|
||||
// construct the source entity qualifier
|
||||
// get the fields from relation description
|
||||
Map<ModelField, Object> bindMap = new HashMap<ModelField, Object>();
|
||||
Map<ModelField, Object> bindMap = new HashMap<>();
|
||||
for (ModelKeyMap mkm : modelRelationOne.getKeyMaps()) {
|
||||
// get the equivalent column names in the relation
|
||||
String sfldname = mkm.getFieldName();
|
||||
@@ -914,7 +914,7 @@ public class GenericDAO {
|
||||
sqlsb.append(SqlJdbcUtil.makeOrderByClause(modelEntityTwo, orderBy, true, datasource));
|
||||
|
||||
// now execute the query
|
||||
List<GenericValue> retlist = new LinkedList<GenericValue>();
|
||||
List<GenericValue> retlist = new LinkedList<>();
|
||||
Delegator gd = value.getDelegator();
|
||||
|
||||
try (SQLProcessor sqlP = new SQLProcessor(value.getDelegator(), helperInfo)) {
|
||||
@@ -1016,9 +1016,9 @@ public class GenericDAO {
|
||||
List<EntityCondition> viewHavingConditions = null;
|
||||
List<String> viewOrderByList = null;
|
||||
if (modelViewEntity != null) {
|
||||
viewWhereConditions = new LinkedList<EntityCondition>();
|
||||
viewHavingConditions = new LinkedList<EntityCondition>();
|
||||
viewOrderByList = new LinkedList<String>();
|
||||
viewWhereConditions = new LinkedList<>();
|
||||
viewHavingConditions = new LinkedList<>();
|
||||
viewOrderByList = new LinkedList<>();
|
||||
modelViewEntity.populateViewEntityConditionInformation(modelFieldTypeReader, viewWhereConditions, viewHavingConditions, viewOrderByList, null);
|
||||
}
|
||||
|
||||
@@ -1026,7 +1026,7 @@ public class GenericDAO {
|
||||
sqlBuffer.append(SqlJdbcUtil.makeFromClause(modelEntity, modelFieldTypeReader, datasource));
|
||||
|
||||
// WHERE clause
|
||||
List<EntityConditionParam> whereEntityConditionParams = new LinkedList<EntityConditionParam>();
|
||||
List<EntityConditionParam> whereEntityConditionParams = new LinkedList<>();
|
||||
makeConditionWhereString(sqlBuffer, " WHERE ", modelEntity, whereEntityCondition, viewWhereConditions, whereEntityConditionParams);
|
||||
|
||||
// GROUP BY clause for view-entity
|
||||
@@ -1035,7 +1035,7 @@ public class GenericDAO {
|
||||
}
|
||||
|
||||
// HAVING clause
|
||||
List<EntityConditionParam> havingEntityConditionParams = new LinkedList<EntityConditionParam>();
|
||||
List<EntityConditionParam> havingEntityConditionParams = new LinkedList<>();
|
||||
makeConditionHavingString(sqlBuffer, " HAVING ", modelEntity, havingEntityCondition, viewHavingConditions, havingEntityConditionParams);
|
||||
|
||||
if (isGroupBy) {
|
||||
|
||||
+1
-1
@@ -104,7 +104,7 @@ public class GenericHelperDAO implements GenericHelper {
|
||||
*/
|
||||
public List<GenericValue> findAllByPrimaryKeys(List<GenericPK> primaryKeys) throws GenericEntityException {
|
||||
if (primaryKeys == null) return null;
|
||||
List<GenericValue> results = new LinkedList<GenericValue>();
|
||||
List<GenericValue> results = new LinkedList<>();
|
||||
|
||||
for (GenericPK primaryKey: primaryKeys) {
|
||||
GenericValue result = this.findByPrimaryKey(primaryKey);
|
||||
|
||||
+1
-1
@@ -36,7 +36,7 @@ public class GenericHelperFactory {
|
||||
public static final String module = GenericHelperFactory.class.getName();
|
||||
|
||||
// protected static UtilCache helperCache = new UtilCache("entity.GenericHelpers", 0, 0);
|
||||
protected static final Map<String, GenericHelper> helperCache = new HashMap<String, GenericHelper>();
|
||||
protected static final Map<String, GenericHelper> helperCache = new HashMap<>();
|
||||
|
||||
public static GenericHelper getHelper(GenericHelperInfo helperInfo) {
|
||||
GenericHelper helper = helperCache.get(helperInfo.getHelperFullName());
|
||||
|
||||
+1
-1
@@ -98,7 +98,7 @@ public class ReadOnlyHelperDAO implements GenericHelper {
|
||||
*/
|
||||
public List<GenericValue> findAllByPrimaryKeys(List<GenericPK> primaryKeys) throws GenericEntityException {
|
||||
if (primaryKeys == null) return null;
|
||||
List<GenericValue> results = new LinkedList<GenericValue>();
|
||||
List<GenericValue> results = new LinkedList<>();
|
||||
|
||||
for (GenericPK primaryKey: primaryKeys) {
|
||||
GenericValue result = this.findByPrimaryKey(primaryKey);
|
||||
|
||||
@@ -172,8 +172,8 @@ public class DatabaseUtil {
|
||||
|
||||
// get ALL tables from this database
|
||||
TreeSet<String> tableNames = this.getTableNames(messages);
|
||||
TreeSet<String> fkTableNames = tableNames == null ? null : new TreeSet<String>(tableNames);
|
||||
TreeSet<String> indexTableNames = tableNames == null ? null : new TreeSet<String>(tableNames);
|
||||
TreeSet<String> fkTableNames = tableNames == null ? null : new TreeSet<>(tableNames);
|
||||
TreeSet<String> indexTableNames = tableNames == null ? null : new TreeSet<>(tableNames);
|
||||
|
||||
if (tableNames == null) {
|
||||
String message = "Could not get table name information from the database, aborting.";
|
||||
@@ -202,12 +202,12 @@ public class DatabaseUtil {
|
||||
|
||||
timer.timerString("Before Individual Table/Column Check");
|
||||
|
||||
List<ModelEntity> modelEntityList = new ArrayList<ModelEntity>(modelEntities.values());
|
||||
List<ModelEntity> modelEntityList = new ArrayList<>(modelEntities.values());
|
||||
// sort using compareTo method on ModelEntity
|
||||
Collections.sort(modelEntityList);
|
||||
int curEnt = 0;
|
||||
int totalEnt = modelEntityList.size();
|
||||
List<ModelEntity> entitiesAdded = new LinkedList<ModelEntity>();
|
||||
List<ModelEntity> entitiesAdded = new LinkedList<>();
|
||||
String schemaName;
|
||||
try {
|
||||
schemaName = getSchemaName(messages);
|
||||
@@ -217,7 +217,7 @@ public class DatabaseUtil {
|
||||
Debug.logError(message, module);
|
||||
return;
|
||||
}
|
||||
List<Future<CreateTableCallable>> tableFutures = new LinkedList<Future<CreateTableCallable>>();
|
||||
List<Future<CreateTableCallable>> tableFutures = new LinkedList<>();
|
||||
for (ModelEntity entity: modelEntityList) {
|
||||
curEnt++;
|
||||
|
||||
@@ -252,7 +252,7 @@ public class DatabaseUtil {
|
||||
if (tableNames.contains(tableName)) {
|
||||
tableNames.remove(tableName);
|
||||
|
||||
Map<String, ModelField> fieldColNames = new HashMap<String, ModelField>();
|
||||
Map<String, ModelField> fieldColNames = new HashMap<>();
|
||||
Iterator<ModelField> fieldIter = entity.getFieldsIterator();
|
||||
while (fieldIter.hasNext()) {
|
||||
ModelField field = fieldIter.next();
|
||||
@@ -425,7 +425,7 @@ public class DatabaseUtil {
|
||||
// for each newly added table, add fk indices
|
||||
if (datasourceInfo.getUseForeignKeyIndices()) {
|
||||
int totalFkIndices = 0;
|
||||
List<Future<AbstractCountingCallable>> fkIndicesFutures = new LinkedList<Future<AbstractCountingCallable>>();
|
||||
List<Future<AbstractCountingCallable>> fkIndicesFutures = new LinkedList<>();
|
||||
for (ModelEntity curEntity: entitiesAdded) {
|
||||
if (curEntity.getRelationsOneSize() > 0) {
|
||||
fkIndicesFutures.add(executor.submit(new AbstractCountingCallable(curEntity, modelEntities) {
|
||||
@@ -454,7 +454,7 @@ public class DatabaseUtil {
|
||||
// for each newly added table, add declared indexes
|
||||
if (datasourceInfo.getUseIndices()) {
|
||||
int totalDis = 0;
|
||||
List<Future<AbstractCountingCallable>> disFutures = new LinkedList<Future<AbstractCountingCallable>>();
|
||||
List<Future<AbstractCountingCallable>> disFutures = new LinkedList<>();
|
||||
for (ModelEntity curEntity: entitiesAdded) {
|
||||
if (curEntity.getIndexesSize() > 0) {
|
||||
disFutures.add(executor.submit(new AbstractCountingCallable(curEntity, modelEntities) {
|
||||
@@ -720,12 +720,12 @@ public class DatabaseUtil {
|
||||
// go through each table and make a ModelEntity object, add to list
|
||||
// for each entity make corresponding ModelField objects
|
||||
// then print out XML for the entities/fields
|
||||
List<ModelEntity> newEntList = new LinkedList<ModelEntity>();
|
||||
List<ModelEntity> newEntList = new LinkedList<>();
|
||||
|
||||
boolean isCaseSensitive = getIsCaseSensitive(messages);
|
||||
|
||||
// iterate over the table names is alphabetical order
|
||||
for (String tableName: new TreeSet<String>(colInfo.keySet())) {
|
||||
for (String tableName: new TreeSet<>(colInfo.keySet())) {
|
||||
Map<String, ColumnCheckInfo> colMap = colInfo.get(tableName);
|
||||
ModelEntity newEntity = new ModelEntity(tableName, colMap, modelFieldTypeReader, isCaseSensitive);
|
||||
newEntList.add(newEntity);
|
||||
@@ -777,7 +777,7 @@ public class DatabaseUtil {
|
||||
return dbData;
|
||||
}
|
||||
|
||||
private static final List<Detection> detections = new ArrayList<Detection>();
|
||||
private static final List<Detection> detections = new ArrayList<>();
|
||||
private static final String goodFormatStr;
|
||||
private static final String badFormatStr;
|
||||
|
||||
@@ -922,7 +922,7 @@ public class DatabaseUtil {
|
||||
if (Debug.infoOn()) Debug.logInfo("Getting Table Info From Database", module);
|
||||
|
||||
// get ALL tables from this database
|
||||
TreeSet<String> tableNames = new TreeSet<String>();
|
||||
TreeSet<String> tableNames = new TreeSet<>();
|
||||
ResultSet tableSet = null;
|
||||
|
||||
String lookupSchemaName = null;
|
||||
@@ -1029,7 +1029,7 @@ public class DatabaseUtil {
|
||||
private Map<String, Map<String, ColumnCheckInfo>> getColumnInfo(Set<String> tableNames, boolean getPks, Collection<String> messages, ExecutorService executor) {
|
||||
// if there are no tableNames, don't even try to get the columns
|
||||
if (tableNames.size() == 0) {
|
||||
return new HashMap<String, Map<String, ColumnCheckInfo>>();
|
||||
return new HashMap<>();
|
||||
}
|
||||
|
||||
Connection connection = null;
|
||||
@@ -1059,7 +1059,7 @@ public class DatabaseUtil {
|
||||
|
||||
if (Debug.infoOn()) Debug.logInfo("Getting Column Info From Database", module);
|
||||
|
||||
Map<String, Map<String, ColumnCheckInfo>> colInfo = new HashMap<String, Map<String, ColumnCheckInfo>>();
|
||||
Map<String, Map<String, ColumnCheckInfo>> colInfo = new HashMap<>();
|
||||
try {
|
||||
String lookupSchemaName = getSchemaName(dbData);
|
||||
boolean needsUpperCase = false;
|
||||
@@ -1114,7 +1114,7 @@ public class DatabaseUtil {
|
||||
|
||||
Map<String, ColumnCheckInfo> tableColInfo = colInfo.get(ccInfo.tableName);
|
||||
if (tableColInfo == null) {
|
||||
tableColInfo = new HashMap<String, ColumnCheckInfo>();
|
||||
tableColInfo = new HashMap<>();
|
||||
colInfo.put(ccInfo.tableName, tableColInfo);
|
||||
}
|
||||
tableColInfo.put(ccInfo.columnName, ccInfo);
|
||||
@@ -1153,7 +1153,7 @@ public class DatabaseUtil {
|
||||
}
|
||||
if (pkCount == 0) {
|
||||
Debug.logInfo("Searching in " + tableNames.size() + " tables for primary key fields ...", module);
|
||||
List<Future<AbstractCountingCallable>> pkFetcherFutures = new LinkedList<Future<AbstractCountingCallable>>();
|
||||
List<Future<AbstractCountingCallable>> pkFetcherFutures = new LinkedList<>();
|
||||
for (String curTable: tableNames) {
|
||||
curTable = curTable.substring(curTable.indexOf('.') + 1); //cut off schema name
|
||||
pkFetcherFutures.add(executor.submit(createPrimaryKeyFetcher(dbData, lookupSchemaName, needsUpperCase, colInfo, messages, curTable)));
|
||||
@@ -1266,7 +1266,7 @@ public class DatabaseUtil {
|
||||
|
||||
if (Debug.infoOn()) Debug.logInfo("Getting Foreign Key (Reference) Info From Database", module);
|
||||
|
||||
Map<String, Map<String, ReferenceCheckInfo>> refInfo = new HashMap<String, Map<String, ReferenceCheckInfo>>();
|
||||
Map<String, Map<String, ReferenceCheckInfo>> refInfo = new HashMap<>();
|
||||
|
||||
try {
|
||||
// ResultSet rsCols = dbData.getCrossReference(null, null, null, null, null, null);
|
||||
@@ -1323,7 +1323,7 @@ public class DatabaseUtil {
|
||||
|
||||
Map<String, ReferenceCheckInfo> tableRefInfo = refInfo.get(rcInfo.fkTableName);
|
||||
if (tableRefInfo == null) {
|
||||
tableRefInfo = new HashMap<String, ReferenceCheckInfo>();
|
||||
tableRefInfo = new HashMap<>();
|
||||
refInfo.put(rcInfo.fkTableName, tableRefInfo);
|
||||
if (Debug.verboseOn()) Debug.logVerbose("Adding new Map for table: " + rcInfo.fkTableName, module);
|
||||
}
|
||||
@@ -1400,7 +1400,7 @@ public class DatabaseUtil {
|
||||
|
||||
if (Debug.infoOn()) Debug.logInfo("Getting Index Info From Database", module);
|
||||
|
||||
Map<String, Set<String>> indexInfo = new HashMap<String, Set<String>>();
|
||||
Map<String, Set<String>> indexInfo = new HashMap<>();
|
||||
try {
|
||||
int totalIndices = 0;
|
||||
String lookupSchemaName = getSchemaName(dbData);
|
||||
@@ -1445,7 +1445,7 @@ public class DatabaseUtil {
|
||||
|
||||
Set<String> tableIndexList = indexInfo.get(tableName);
|
||||
if (tableIndexList == null) {
|
||||
tableIndexList = new TreeSet<String>();
|
||||
tableIndexList = new TreeSet<>();
|
||||
indexInfo.put(tableName, tableIndexList);
|
||||
if (Debug.verboseOn()) Debug.logVerbose("Adding new Map for table: " + tableName, module);
|
||||
}
|
||||
@@ -1535,7 +1535,7 @@ public class DatabaseUtil {
|
||||
private abstract class AbstractCountingCallable implements Callable<AbstractCountingCallable> {
|
||||
protected final ModelEntity entity;
|
||||
protected final Map<String, ModelEntity> modelEntities;
|
||||
protected final List<String> messages = new LinkedList<String>();
|
||||
protected final List<String> messages = new LinkedList<>();
|
||||
protected int count;
|
||||
|
||||
protected AbstractCountingCallable(ModelEntity entity, Map<String, ModelEntity> modelEntities) {
|
||||
@@ -1890,7 +1890,7 @@ public class DatabaseUtil {
|
||||
return;
|
||||
}
|
||||
|
||||
if (messages == null) messages = new ArrayList<String>();
|
||||
if (messages == null) messages = new ArrayList<>();
|
||||
|
||||
for (String fieldInfo: fieldsWrongSize) {
|
||||
String entityName = fieldInfo.substring(0, fieldInfo.indexOf('.'));
|
||||
@@ -2190,7 +2190,7 @@ public class DatabaseUtil {
|
||||
/* ====================================================================== */
|
||||
/* ====================================================================== */
|
||||
public void createPrimaryKey(ModelEntity entity, boolean usePkConstraintNames, int constraintNameClipLength, List<String> messages) {
|
||||
if (messages == null) messages = new ArrayList<String>();
|
||||
if (messages == null) messages = new ArrayList<>();
|
||||
String err = createPrimaryKey(entity, usePkConstraintNames, constraintNameClipLength);
|
||||
if (UtilValidate.isNotEmpty(err)) {
|
||||
messages.add(err);
|
||||
@@ -2249,7 +2249,7 @@ public class DatabaseUtil {
|
||||
}
|
||||
|
||||
public void deletePrimaryKey(ModelEntity entity, boolean usePkConstraintNames, int constraintNameClipLength, List<String> messages) {
|
||||
if (messages == null) messages = new ArrayList<String>();
|
||||
if (messages == null) messages = new ArrayList<>();
|
||||
String err = deletePrimaryKey(entity, usePkConstraintNames, constraintNameClipLength);
|
||||
if (UtilValidate.isNotEmpty(err)) {
|
||||
messages.add(err);
|
||||
@@ -2405,7 +2405,7 @@ public class DatabaseUtil {
|
||||
}
|
||||
|
||||
public void deleteDeclaredIndices(ModelEntity entity, List<String> messages) {
|
||||
if (messages == null) messages = new ArrayList<String>();
|
||||
if (messages == null) messages = new ArrayList<>();
|
||||
String err = deleteDeclaredIndices(entity);
|
||||
if (UtilValidate.isNotEmpty(err)) {
|
||||
messages.add(err);
|
||||
@@ -2572,7 +2572,7 @@ public class DatabaseUtil {
|
||||
}
|
||||
|
||||
public void deleteForeignKeyIndices(ModelEntity entity, List<String> messages) {
|
||||
if (messages == null) messages = new ArrayList<String>();
|
||||
if (messages == null) messages = new ArrayList<>();
|
||||
String err = deleteForeignKeyIndices(entity, datasourceInfo.getConstraintNameClipLength());
|
||||
if (UtilValidate.isNotEmpty(err)) {
|
||||
messages.add(err);
|
||||
|
||||
@@ -54,7 +54,7 @@ public abstract class JdbcValueHandler<T> {
|
||||
for the specified Java type. The JdbcValueHandler instances are
|
||||
initialized with the SQL type recommended by Sun/Oracle.
|
||||
*/
|
||||
Map<String, JdbcValueHandler<?>> result = new HashMap<String, JdbcValueHandler<?>>();
|
||||
Map<String, JdbcValueHandler<?>> result = new HashMap<>();
|
||||
// JDBC 1
|
||||
result.put("Array", new ArrayJdbcValueHandler(Types.ARRAY));
|
||||
result.put("java.sql.Array", new ArrayJdbcValueHandler(Types.ARRAY));
|
||||
@@ -102,7 +102,7 @@ public abstract class JdbcValueHandler<T> {
|
||||
method must be called with the correct type, or an
|
||||
exception will be thrown.
|
||||
*/
|
||||
Map<String, Integer> result = new HashMap<String, Integer>();
|
||||
Map<String, Integer> result = new HashMap<>();
|
||||
// SQL 2003 Data Types
|
||||
result.put("ARRAY", Types.ARRAY);
|
||||
result.put("BIGINT", Types.BIGINT);
|
||||
|
||||
@@ -56,7 +56,7 @@ public class SQLProcessor implements AutoCloseable {
|
||||
public static final String module = SQLProcessor.class.getName();
|
||||
|
||||
/** Used for testing connections when test is enabled */
|
||||
private static final List<String> CONNECTION_TEST_LIST = new ArrayList<String>();
|
||||
private static final List<String> CONNECTION_TEST_LIST = new ArrayList<>();
|
||||
public static final int MAX_CONNECTIONS = 1000;
|
||||
public static final boolean ENABLE_TEST = false;
|
||||
|
||||
|
||||
@@ -72,7 +72,7 @@ public final class SqlJdbcUtil {
|
||||
public static final String module = SqlJdbcUtil.class.getName();
|
||||
|
||||
private static final int CHAR_BUFFER_SIZE = 4096;
|
||||
private static Map<String, Integer> fieldTypeMap = new HashMap<String, Integer>();
|
||||
private static Map<String, Integer> fieldTypeMap = new HashMap<>();
|
||||
static {
|
||||
fieldTypeMap.put("java.lang.String", 1);
|
||||
fieldTypeMap.put("String", 1);
|
||||
@@ -141,7 +141,7 @@ public final class SqlJdbcUtil {
|
||||
// view-link and already be in the big join; SO keep a set of all aliases
|
||||
// in the join so far and if the left entity alias isn't there yet, and this
|
||||
// isn't the first one, throw an exception
|
||||
Set<String> joinedAliasSet = new TreeSet<String>();
|
||||
Set<String> joinedAliasSet = new TreeSet<>();
|
||||
|
||||
// TODO: at view-link read time make sure they are ordered properly so that each
|
||||
// left hand alias after the first view-link has already been linked before
|
||||
@@ -463,9 +463,9 @@ public final class SqlJdbcUtil {
|
||||
sql.append(makeFromClause(modelEntity, modelFieldTypeReader, datasourceInfo));
|
||||
String viewWhereClause = makeViewWhereClause(modelEntity, datasourceInfo.getJoinStyle());
|
||||
ModelViewEntity modelViewEntity = (ModelViewEntity)modelEntity;
|
||||
List<EntityCondition> whereConditions = new LinkedList<EntityCondition>();
|
||||
List<EntityCondition> havingConditions = new LinkedList<EntityCondition>();
|
||||
List<String> orderByList = new LinkedList<String>();
|
||||
List<EntityCondition> whereConditions = new LinkedList<>();
|
||||
List<EntityCondition> havingConditions = new LinkedList<>();
|
||||
List<String> orderByList = new LinkedList<>();
|
||||
|
||||
modelViewEntity.populateViewEntityConditionInformation(modelFieldTypeReader, whereConditions, havingConditions, orderByList, null);
|
||||
String viewConditionClause;
|
||||
|
||||
@@ -58,22 +58,22 @@ public class DynamicViewEntity {
|
||||
protected String title = "";
|
||||
|
||||
/** Contains member-entity alias name definitions: key is alias, value is ModelMemberEntity */
|
||||
protected Map<String, ModelMemberEntity> memberModelMemberEntities = new HashMap<String, ModelMemberEntity>();
|
||||
protected Map<String, ModelMemberEntity> memberModelMemberEntities = new HashMap<>();
|
||||
|
||||
/** List of alias-alls which act as a shortcut for easily pulling over member entity fields */
|
||||
protected List<ModelAliasAll> aliasAlls = new ArrayList<ModelAliasAll>();
|
||||
protected List<ModelAliasAll> aliasAlls = new ArrayList<>();
|
||||
|
||||
/** List of aliases with information in addition to what is in the standard field list */
|
||||
protected List<ModelAlias> aliases = new ArrayList<ModelAlias>();
|
||||
protected List<ModelAlias> aliases = new ArrayList<>();
|
||||
|
||||
/** List of fields to group by */
|
||||
protected List<String> groupBy;
|
||||
|
||||
/** List of view links to define how entities are connected (or "joined") */
|
||||
protected List<ModelViewLink> viewLinks = new ArrayList<ModelViewLink>();
|
||||
protected List<ModelViewLink> viewLinks = new ArrayList<>();
|
||||
|
||||
/** relations defining relationships between this entity and other entities */
|
||||
protected List<ModelRelation> relations = new ArrayList<ModelRelation>();
|
||||
protected List<ModelRelation> relations = new ArrayList<>();
|
||||
|
||||
public DynamicViewEntity() {
|
||||
}
|
||||
|
||||
@@ -142,7 +142,7 @@ public final class ModelField extends ModelChild {
|
||||
List<String>validators = Collections.emptyList();
|
||||
List<? extends Element> elementList = UtilXml.childElementList(fieldElement, "validate");
|
||||
if (!elementList.isEmpty()) {
|
||||
validators = new ArrayList<String>(elementList.size());
|
||||
validators = new ArrayList<>(elementList.size());
|
||||
for (Element validateElement : elementList) {
|
||||
validators.add(validateElement.getAttribute("name").intern());
|
||||
}
|
||||
|
||||
+1
-1
@@ -50,7 +50,7 @@ public class ModelFieldTypeReader implements Serializable {
|
||||
|
||||
protected static Map<String, ModelFieldType> createFieldTypeCache(Element docElement, String location) {
|
||||
docElement.normalize();
|
||||
Map<String, ModelFieldType> fieldTypeMap = new HashMap<String, ModelFieldType>();
|
||||
Map<String, ModelFieldType> fieldTypeMap = new HashMap<>();
|
||||
List<? extends Element> fieldTypeList = UtilXml.childElementList(docElement, "field-type-def");
|
||||
for (Element curFieldType: fieldTypeList) {
|
||||
String fieldTypeName = curFieldType.getAttribute("type");
|
||||
|
||||
@@ -91,7 +91,7 @@ public final class ModelRelation extends ModelChild {
|
||||
List<ModelKeyMap >keyMaps = Collections.emptyList();
|
||||
List<? extends Element> elementList = UtilXml.childElementList(relationElement, "key-map");
|
||||
if (!elementList.isEmpty()) {
|
||||
keyMaps = new ArrayList<ModelKeyMap>(elementList.size());
|
||||
keyMaps = new ArrayList<>(elementList.size());
|
||||
for (Element keyMapElement : elementList) {
|
||||
keyMaps.add(new ModelKeyMap(keyMapElement));
|
||||
}
|
||||
@@ -138,7 +138,7 @@ public final class ModelRelation extends ModelChild {
|
||||
this.isAutoRelation = isAutoRelation;
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append(modelEntity == null ? "Unknown" : modelEntity.getEntityName()).append("->").append(title).append(relEntityName).append("[");
|
||||
Set<ModelKeyMap> keyMapSet = new TreeSet<ModelKeyMap>(keyMaps);
|
||||
Set<ModelKeyMap> keyMapSet = new TreeSet<>(keyMaps);
|
||||
Iterator<ModelKeyMap> setIter = keyMapSet.iterator();
|
||||
while (setIter.hasNext()) {
|
||||
ModelKeyMap keyMap = setIter.next();
|
||||
|
||||
@@ -553,7 +553,7 @@ public class ModelViewEntity extends ModelEntity {
|
||||
|
||||
List<String> aliases = containedModelFields.get(alias.getField());
|
||||
if (aliases == null) {
|
||||
aliases = new LinkedList<String>();
|
||||
aliases = new LinkedList<>();
|
||||
containedModelFields.put(alias.getField(), aliases);
|
||||
}
|
||||
aliases.add(alias.getName());
|
||||
|
||||
@@ -80,7 +80,7 @@ public class Converters implements ConverterLoader {
|
||||
}
|
||||
|
||||
public JSON convert(GenericValue obj) throws ConversionException {
|
||||
Map<String, Object> fieldMap = new HashMap<String, Object>(obj);
|
||||
Map<String, Object> fieldMap = new HashMap<>(obj);
|
||||
fieldMap.put("_DELEGATOR_NAME_", obj.getDelegator().getDelegatorName());
|
||||
fieldMap.put("_ENTITY_NAME_", obj.getEntityName());
|
||||
try {
|
||||
@@ -97,7 +97,7 @@ public class Converters implements ConverterLoader {
|
||||
}
|
||||
|
||||
public List<GenericValue> convert(GenericValue obj) throws ConversionException {
|
||||
List<GenericValue> tempList = new LinkedList<GenericValue>();
|
||||
List<GenericValue> tempList = new LinkedList<>();
|
||||
tempList.add(obj);
|
||||
return tempList;
|
||||
}
|
||||
@@ -109,7 +109,7 @@ public class Converters implements ConverterLoader {
|
||||
}
|
||||
|
||||
public Set<GenericValue> convert(GenericValue obj) throws ConversionException {
|
||||
Set<GenericValue> tempSet = new HashSet<GenericValue>();
|
||||
Set<GenericValue> tempSet = new HashSet<>();
|
||||
tempSet.add(obj);
|
||||
return tempSet;
|
||||
}
|
||||
|
||||
@@ -52,7 +52,7 @@ public final class EntityCrypto {
|
||||
public static final String module = EntityCrypto.class.getName();
|
||||
|
||||
private final Delegator delegator;
|
||||
private final ConcurrentMap<String, byte[]> keyMap = new ConcurrentHashMap<String, byte[]>();
|
||||
private final ConcurrentMap<String, byte[]> keyMap = new ConcurrentHashMap<>();
|
||||
private final StorageHandler[] handlers;
|
||||
|
||||
public EntityCrypto(Delegator delegator, String kekText) throws EntityCryptoException {
|
||||
|
||||
@@ -92,7 +92,7 @@ public class EntityDataLoader {
|
||||
|
||||
public static <E> List<URL> getUrlList(String helperName, String componentName, List<E> readerNames) {
|
||||
String paths = getPathsString(helperName);
|
||||
List<URL> urlList = new LinkedList<URL>();
|
||||
List<URL> urlList = new LinkedList<>();
|
||||
|
||||
// first get files from resources
|
||||
if (readerNames != null) {
|
||||
@@ -167,7 +167,7 @@ public class EntityDataLoader {
|
||||
File loadDir = new File(path);
|
||||
if (loadDir.exists() && loadDir.isDirectory()) {
|
||||
File[] files = loadDir.listFiles();
|
||||
List<File> tempFileList = new LinkedList<File>();
|
||||
List<File> tempFileList = new LinkedList<>();
|
||||
if (files != null) {
|
||||
for (File file : files) {
|
||||
if (file.getName().toLowerCase(Locale.getDefault()).endsWith(".xml")) {
|
||||
@@ -199,9 +199,9 @@ public class EntityDataLoader {
|
||||
}
|
||||
|
||||
public static List<URL> getUrlByComponentList(String helperName, List<String> components, List<String> readerNames) {
|
||||
List<URL> urlList = new LinkedList<URL>();
|
||||
List<URL> urlList = new LinkedList<>();
|
||||
for (String readerName: readerNames) {
|
||||
List<String> loadReaderNames = new LinkedList<String>();
|
||||
List<String> loadReaderNames = new LinkedList<>();
|
||||
loadReaderNames.add(readerName);
|
||||
for (String component : components) {
|
||||
urlList.addAll(getUrlList(helperName, component, loadReaderNames));
|
||||
@@ -212,7 +212,7 @@ public class EntityDataLoader {
|
||||
|
||||
public static List<URL> getUrlByComponentList(String helperName, List<String> components) {
|
||||
Datasource datasourceInfo = EntityConfig.getDatasource(helperName);
|
||||
List<String> readerNames = new LinkedList<String>();
|
||||
List<String> readerNames = new LinkedList<>();
|
||||
for (ReadData readerInfo : datasourceInfo.getReadDataList()) {
|
||||
String readerName = readerInfo.getReaderName();
|
||||
// ignore the "tenant" reader if the multitenant property is "N"
|
||||
@@ -291,7 +291,7 @@ public class EntityDataLoader {
|
||||
|
||||
if (baseName != null) {
|
||||
try {
|
||||
List<GenericValue> toBeStored = new LinkedList<GenericValue>();
|
||||
List<GenericValue> toBeStored = new LinkedList<>();
|
||||
toBeStored.add(
|
||||
delegator.makeValue(
|
||||
"SecurityPermission",
|
||||
|
||||
@@ -503,7 +503,7 @@ public class EntityQuery {
|
||||
}
|
||||
|
||||
private EntityCondition makeDateCondition() {
|
||||
List<EntityCondition> conditions = new ArrayList<EntityCondition>();
|
||||
List<EntityCondition> conditions = new ArrayList<>();
|
||||
if (UtilValidate.isEmpty(this.filterByFieldNames)) {
|
||||
this.filterByDate(filterByDateMoment, "fromDate", "thruDate");
|
||||
}
|
||||
@@ -523,7 +523,7 @@ public class EntityQuery {
|
||||
public <T> List<T> getFieldList(final String fieldName) throws GenericEntityException {select(fieldName);
|
||||
try (EntityListIterator genericValueEli = queryIterator()) {
|
||||
if (Boolean.TRUE.equals(this.distinct)) {
|
||||
Set<T> distinctSet = new HashSet<T>();
|
||||
Set<T> distinctSet = new HashSet<>();
|
||||
GenericValue value = null;
|
||||
while ((value = genericValueEli.next()) != null) {
|
||||
T fieldValue = UtilGenerics.<T>cast(value.get(fieldName));
|
||||
@@ -531,10 +531,10 @@ public class EntityQuery {
|
||||
distinctSet.add(fieldValue);
|
||||
}
|
||||
}
|
||||
return new ArrayList<T>(distinctSet);
|
||||
return new ArrayList<>(distinctSet);
|
||||
}
|
||||
else {
|
||||
List<T> fieldList = new LinkedList<T>();
|
||||
List<T> fieldList = new LinkedList<>();
|
||||
GenericValue value = null;
|
||||
while ((value = genericValueEli.next()) != null) {
|
||||
T fieldValue = UtilGenerics.<T>cast(value.get(fieldName));
|
||||
|
||||
@@ -161,7 +161,7 @@ public class EntitySaxReader extends DefaultHandler {
|
||||
|
||||
public List<Object> getMessageList() {
|
||||
if (this.checkDataOnly && this.messageList == null) {
|
||||
messageList = new LinkedList<Object>();
|
||||
messageList = new LinkedList<>();
|
||||
}
|
||||
return this.messageList;
|
||||
}
|
||||
@@ -322,7 +322,7 @@ public class EntitySaxReader extends DefaultHandler {
|
||||
Template template = new Template("FMImportFilter", templateReader, config);
|
||||
NodeModel nodeModel = NodeModel.wrap(this.rootNodeForTemplate);
|
||||
|
||||
Map<String, Object> context = new HashMap<String, Object>();
|
||||
Map<String, Object> context = new HashMap<>();
|
||||
TemplateHashModel staticModels = FreeMarkerWorker.getDefaultOfbizWrapper().getStaticModels();
|
||||
context.put("Static", staticModels);
|
||||
|
||||
|
||||
@@ -82,7 +82,7 @@ public final class EntityTypeUtil {
|
||||
|
||||
public static List<GenericValue> getDescendantTypes(GenericValue typeValue) {
|
||||
// assumes Child relation is "Child<entityName>"
|
||||
List<GenericValue> descendantTypes = new ArrayList<GenericValue>();
|
||||
List<GenericValue> descendantTypes = new ArrayList<>();
|
||||
|
||||
// first get all childrenTypes ...
|
||||
List<GenericValue> childrenTypes = null;
|
||||
|
||||
@@ -63,7 +63,7 @@ public final class EntityUtil {
|
||||
|
||||
@SafeVarargs
|
||||
public static <V> Map<String, V> makeFields(V... args) {
|
||||
Map<String, V> fields = new HashMap<String, V>();
|
||||
Map<String, V> fields = new HashMap<>();
|
||||
if (args != null) {
|
||||
for (int i = 0; i < args.length;) {
|
||||
if (!(args[i] instanceof String)) throw new IllegalArgumentException("Key(" + i + "), with value(" + args[i] + ") is not a String.");
|
||||
@@ -197,7 +197,7 @@ public final class EntityUtil {
|
||||
if (fromDateName == null) fromDateName = "fromDate";
|
||||
if (thruDateName == null) thruDateName = "thruDate";
|
||||
|
||||
List<T> result = new LinkedList<T>();
|
||||
List<T> result = new LinkedList<>();
|
||||
Iterator<T> iter = datedValues.iterator();
|
||||
|
||||
if (allAreSame) {
|
||||
@@ -314,9 +314,9 @@ public final class EntityUtil {
|
||||
*/
|
||||
public static <T extends GenericEntity> List<T> localizedOrderBy(Collection<T> values, List<String> orderBy, Locale locale) {
|
||||
if (values == null) return null;
|
||||
if (values.isEmpty()) return new ArrayList<T>();
|
||||
if (values.isEmpty()) return new ArrayList<>();
|
||||
//force check entity label before order by
|
||||
List<T> localizedValues = new ArrayList<T>();
|
||||
List<T> localizedValues = new ArrayList<>();
|
||||
for (T value : values) {
|
||||
T newValue = UtilGenerics.cast(value.clone());
|
||||
for (String orderByField : orderBy) {
|
||||
@@ -345,14 +345,14 @@ public final class EntityUtil {
|
||||
*/
|
||||
public static <T extends GenericEntity> List<T> orderBy(Collection<T> values, List<String> orderBy) {
|
||||
if (values == null) return null;
|
||||
if (values.isEmpty()) return new ArrayList<T>();
|
||||
if (values.isEmpty()) return new ArrayList<>();
|
||||
if (UtilValidate.isEmpty(orderBy)) {
|
||||
List<T> newList = new ArrayList<T>();
|
||||
List<T> newList = new ArrayList<>();
|
||||
newList.addAll(values);
|
||||
return newList;
|
||||
}
|
||||
|
||||
List<T> result = new ArrayList<T>();
|
||||
List<T> result = new ArrayList<>();
|
||||
result.addAll(values);
|
||||
if (Debug.verboseOn()) Debug.logVerbose("Sorting " + values.size() + " values, orderBy=" + orderBy.toString(), module);
|
||||
Collections.sort(result, new OrderByList(orderBy));
|
||||
@@ -371,7 +371,7 @@ public final class EntityUtil {
|
||||
public static List<GenericValue> getRelated(String relationName, Map<String, ? extends Object> fields, List<GenericValue> values, boolean useCache) throws GenericEntityException {
|
||||
if (values == null) return null;
|
||||
|
||||
List<GenericValue> result = new LinkedList<GenericValue>();
|
||||
List<GenericValue> result = new LinkedList<>();
|
||||
for (GenericValue value: values) {
|
||||
result.addAll(value.getRelated(relationName, fields, null, useCache));
|
||||
}
|
||||
@@ -413,7 +413,7 @@ public final class EntityUtil {
|
||||
search = null;
|
||||
for (GenericValue entity: entities) {
|
||||
if (now.equals(entity.get("fromDate"))) {
|
||||
search = new HashMap<String, Object>();
|
||||
search = new HashMap<>();
|
||||
for (Map.Entry<String, ? super Object> entry: entity.getPrimaryKey().entrySet()) {
|
||||
search.put(entry.getKey(), entry.getValue());
|
||||
}
|
||||
@@ -424,14 +424,14 @@ public final class EntityUtil {
|
||||
entity.store();
|
||||
}
|
||||
if (search == null) {
|
||||
search = new HashMap<String, Object>();
|
||||
search = new HashMap<>();
|
||||
search.putAll(EntityUtil.getFirst(entities));
|
||||
}
|
||||
} else {
|
||||
/* why is this being done? leaving out for now...
|
||||
search = new HashMap(search);
|
||||
*/
|
||||
search = new HashMap<String, Object>();
|
||||
search = new HashMap<>();
|
||||
search.putAll(find);
|
||||
}
|
||||
if (now.equals(search.get("fromDate"))) {
|
||||
@@ -472,10 +472,10 @@ public final class EntityUtil {
|
||||
if (genericValueEli == null || fieldName == null) {
|
||||
return null;
|
||||
}
|
||||
List<T> fieldList = new LinkedList<T>();
|
||||
List<T> fieldList = new LinkedList<>();
|
||||
Set<T> distinctSet = null;
|
||||
if (distinct) {
|
||||
distinctSet = new HashSet<T>();
|
||||
distinctSet = new HashSet<>();
|
||||
}
|
||||
|
||||
GenericValue value = null;
|
||||
@@ -537,7 +537,7 @@ public final class EntityUtil {
|
||||
endIndex = size;
|
||||
}
|
||||
|
||||
return new PagedList<GenericValue>(startIndex, endIndex, size, viewIndex, viewSize, dataItems);
|
||||
return new PagedList<>(startIndex, endIndex, size, viewIndex, viewSize, dataItems);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -43,7 +43,7 @@ public class SequenceUtil {
|
||||
|
||||
public static final String module = SequenceUtil.class.getName();
|
||||
|
||||
private final ConcurrentMap<String, SequenceBank> sequences = new ConcurrentHashMap<String, SequenceBank>();
|
||||
private final ConcurrentMap<String, SequenceBank> sequences = new ConcurrentHashMap<>();
|
||||
private final GenericHelperInfo helperInfo;
|
||||
private final String tableName;
|
||||
private final String nameColName;
|
||||
|
||||
Reference in New Issue
Block a user