本文整理汇总了Java中org.hibernate.annotations.common.util.StringHelper.isEmpty方法的典型用法代码示例。如果您正苦于以下问题:Java StringHelper.isEmpty方法的具体用法?Java StringHelper.isEmpty怎么用?Java StringHelper.isEmpty使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.hibernate.annotations.common.util.StringHelper
的用法示例。
在下文中一共展示了StringHelper.isEmpty方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getQueryHintString
import org.hibernate.annotations.common.util.StringHelper; //导入方法依赖的package包/类
@Override
public String getQueryHintString(String sql, List<String> hints) {
final String hint = StringHelper.join( ", ", hints.iterator() );
if ( StringHelper.isEmpty( hint ) ) {
return sql;
}
final int pos = sql.indexOf( "select" );
if ( pos > -1 ) {
final StringBuilder buffer = new StringBuilder( sql.length() + hint.length() + 8 );
if ( pos > 0 ) {
buffer.append( sql.substring( 0, pos ) );
}
buffer.append( "select /*+ " ).append( hint ).append( " */" )
.append( sql.substring( pos + "select".length() ) );
sql = buffer.toString();
}
return sql;
}
示例2: getTopEntity
import org.hibernate.annotations.common.util.StringHelper; //导入方法依赖的package包/类
private Entity getTopEntity(Entity entity,StringBuffer dataPath){
if(StringHelper.isEmpty(entity.getParentId())){
if(dataPath.length()>0){
dataPath.insert(0, "#");
}
return entity;
}else{
int pointPos=dataPath.indexOf(".");
if(pointPos==-1){
dataPath.insert(0, "."+entity.getName());
}else{
dataPath.insert(0, ".#"+entity.getName());
}
return getTopEntity(entityManager.loadEntity(entity.getParentId()),dataPath);
}
}
示例3: createDataSetElement
import org.hibernate.annotations.common.util.StringHelper; //导入方法依赖的package包/类
private Element createDataSetElement(Entity entity,RuleSet ruleSet) throws Exception{
if(StringHelper.isEmpty(entity.getParentId())){
BaseElement element = generateDataSetElement(ruleSet);
element.addAttribute("id", "dataSet"+entity.getName());
String entityName=entity.getName();
Element dataTypeElement=createPropertyElement("dataType","["+entityName+"]");
element.add(dataTypeElement);
Element dataProviderElement=createPropertyElement("dataProvider","dataProvider"+entityName.substring(0,1).toUpperCase()+entityName.substring(1,entityName.length()));
element.add(dataProviderElement);
element.add(createDataSetParameterElement(entity));
if(entity.getPageSize()>0){
Element pageSizeElement=createPropertyElement("pageSize",String.valueOf(entity.getPageSize()));
element.add(pageSizeElement);
}
return element;
}else{
return null;
}
}
示例4: sqlCreateString
import org.hibernate.annotations.common.util.StringHelper; //导入方法依赖的package包/类
public String sqlCreateString(Dialect dialect, Mapping p, String defaultCatalog, String defaultSchema) {
if ( isGenerated( dialect ) ) {
// Certain dialects (ex: HANA) don't support FKs as expected, but other constraints can still be created.
// If that's the case, hasAlterTable() will be true, but getAddForeignKeyConstraintString will return
// empty string. Prevent blank "alter table" statements.
String constraintString = sqlConstraintString( dialect, getName(), defaultCatalog, defaultSchema );
if ( !StringHelper.isEmpty( constraintString ) ) {
StringBuilder buf = new StringBuilder( "alter table " )
.append( getTable().getQualifiedName( dialect, defaultCatalog, defaultSchema ) )
.append( constraintString );
return buf.toString();
}
}
return null;
}
示例5: buildDialect
import org.hibernate.annotations.common.util.StringHelper; //导入方法依赖的package包/类
@Override
public Dialect buildDialect(Map configValues, DialectResolutionInfoSource resolutionInfoSource) throws HibernateException {
final String dialectName = (String) configValues.get( AvailableSettings.DIALECT );
if ( !StringHelper.isEmpty( dialectName ) ) {
return constructDialect( dialectName );
}
else {
return determineDialect( resolutionInfoSource );
}
}
示例6: executeActions
import org.hibernate.annotations.common.util.StringHelper; //导入方法依赖的package包/类
private Map<String,Object> executeActions(String actionBeanIds,Map<String,Object> parameter){
Map<String,Object> map=new HashMap<String,Object>();
if(StringHelper.isEmpty(actionBeanIds))return map;
String[] actions=actionBeanIds.split(",");
for(String beanId:actions){
IAction action=ContextHolder.getBean(beanId);
Map<String,Object> resultMap=action.execute(parameter);
if(resultMap!=null){
map.putAll(resultMap);
}
}
return map;
}
示例7: findTopEntity
import org.hibernate.annotations.common.util.StringHelper; //导入方法依赖的package包/类
private Entity findTopEntity(PageInfo page){
Entity topEntity=null;
for(Entity entity:this.retriveAllPageEntity(page)){
if(StringHelper.isEmpty(entity.getParentId())){
topEntity=entity;
break;
}
}
return topEntity;
}
示例8: getDnForPushApplication
import org.hibernate.annotations.common.util.StringHelper; //导入方法依赖的package包/类
/**
* Build DN string for oxPush Application
*/
public String getDnForPushApplication(String inum) {
String orgDn = OrganizationService.instance().getDnForOrganization();
if (StringHelper.isEmpty(inum)) {
return String.format("ou=application,ou=push,%s", orgDn);
}
return String.format("inum=%s,ou=application,ou=push,%s", inum, orgDn);
}
示例9: getDnForPushDevice
import org.hibernate.annotations.common.util.StringHelper; //导入方法依赖的package包/类
/**
* Build DN string for oxPush Device
*/
public String getDnForPushDevice(String inum) {
String orgDn = OrganizationService.instance().getDnForOrganization();
if (StringHelper.isEmpty(inum)) {
return String.format("ou=device,ou=push,%s", orgDn);
}
return String.format("inum=%s,ou=device,ou=push,%s", inum, orgDn);
}
示例10: getDnForResourceSet
import org.hibernate.annotations.common.util.StringHelper; //导入方法依赖的package包/类
/**
* Build DN string for resource set
*/
public String getDnForResourceSet(String inum) {
String orgDn = OrganizationService.instance().getDnForOrganization();
if (StringHelper.isEmpty(inum)) {
return String.format("ou=resource_sets,ou=uma,%s", orgDn);
}
return String.format("inum=%s,ou=resource_sets,ou=uma,%s", inum, orgDn);
}
示例11: getDnForScopeDescription
import org.hibernate.annotations.common.util.StringHelper; //导入方法依赖的package包/类
/**
* Build DN string for scope description
*/
public String getDnForScopeDescription(String inum) {
String orgDn = OrganizationService.instance().getDnForOrganization();
if (StringHelper.isEmpty(inum)) {
return String.format("ou=scopes,ou=uma,%s", orgDn);
}
return String.format("inum=%s,ou=scopes,ou=uma,%s", inum, orgDn);
}
示例12: stringToObject
import org.hibernate.annotations.common.util.StringHelper; //导入方法依赖的package包/类
public Object stringToObject(String stringValue) {
if ( StringHelper.isEmpty( stringValue ) ) return null;
try {
return DateTools.stringToDate( stringValue );
}
catch (ParseException e) {
throw new SearchException( "Unable to parse into date: " + stringValue, e );
}
}
示例13: insertData
import org.hibernate.annotations.common.util.StringHelper; //导入方法依赖的package包/类
private void insertData(Map<String,Object> map,Map<String,Object> parameter){
String entityTablePrimaryKeys=(String)parameter.get(Constants.ENTITY_TABLE_PRIMARY_KEYS);
String entityTableName=(String)parameter.get(Constants.ENTITY_TABLE_NAME);
Collection<Map<String,Object>> entityFields=(Collection<Map<String,Object>>)parameter.get(Constants.ENTITY_FIELDS);
StringBuffer sb=new StringBuffer();
StringBuffer valuesSB=new StringBuffer();
sb.append("insert into "+entityTableName+"(");
if(StringHelper.isEmpty(entityTablePrimaryKeys)){
throw new IllegalArgumentException(entityTableName+"中未定义主键,无法新增数据!");
}
String[] primaryKeys=entityTablePrimaryKeys.split(",");
if(primaryKeys.length==0){
throw new IllegalArgumentException(entityTableName+"中未定义主键,无法新增数据!");
}
int i=0;
List<Object> params=new ArrayList<Object>();
for(String field:map.keySet()){
Map<String,Object> entityField=this.retriveEntityField(entityFields, field);
if(entityField==null)continue;
boolean key=false;
for(String primaryKey:primaryKeys){
if(field.equals(primaryKey)){
key=true;
break;
}
}
if(i>0){
sb.append(",");
valuesSB.append(",");
}
if(key){
//调用主键生成器生成主键值
if(!entityField.get("keyGenerateType").toString().equals(KeyGenerateType.autoincrement.toString())){
valuesSB.append("?");
String beanId=(String)entityField.get("keyGenerator");
if(StringHelper.isNotEmpty(beanId)){
sb.append(field);
IGenerator<?> generator=(IGenerator<?>)ContextHolder.getBean(beanId);
Object keyValue=generator.execute(parameter);
map.put(field, keyValue);
params.add(keyValue);
i++;
}else{
sb.append(field);
params.add(map.get(field));
i++;
}
}
}else if("true".equals(entityField.get("submittable").toString())){
sb.append(field);
valuesSB.append("?");
params.add(map.get(field));
i++;
}
}
sb.append(") values(");
sb.append(valuesSB.toString());
sb.append(")");
this.getJdbcTemplate().update(sb.toString(),params.toArray());
}
示例14: updateData
import org.hibernate.annotations.common.util.StringHelper; //导入方法依赖的package包/类
private void updateData(Map<String,Object> map,Map<String,Object> parameter){
String entityTablePrimaryKeys=(String)parameter.get(Constants.ENTITY_TABLE_PRIMARY_KEYS);
String entityTableName=(String)parameter.get(Constants.ENTITY_TABLE_NAME);
Collection<Map<String,Object>> entityFields=(Collection<Map<String,Object>>)parameter.get(Constants.ENTITY_FIELDS);
StringBuffer sb=new StringBuffer();
sb.append("update "+entityTableName+" set ");
if(StringHelper.isEmpty(entityTablePrimaryKeys)){
throw new IllegalArgumentException(entityTableName+"中未定义主键,无法新增数据!");
}
String[] primaryKeys=entityTablePrimaryKeys.split(",");
if(primaryKeys.length==0){
throw new IllegalArgumentException(entityTableName+"中未定义主键,无法新增数据!");
}
int i=0;
List<Object> params=new ArrayList<Object>();
for(String field:map.keySet()){
Map<String,Object> entityField=this.retriveEntityField(entityFields, field);
if(entityField==null)continue;
boolean update=true;
for(String primaryKey:primaryKeys){
if(field.equals(primaryKey)){
update=false;
break;
}
}
if(update){
if(i>0){
sb.append(",");
}
sb.append(field+"=?");
params.add(map.get(field));
i++;
}
}
sb.append(" where 1=1");
for(String fieldName:primaryKeys){
params.add(map.get(fieldName));
sb.append(" and "+fieldName+"=?");
}
this.getJdbcTemplate().update(sb.toString(),params.toArray());
}
示例15: startRelationServers
import org.hibernate.annotations.common.util.StringHelper; //导入方法依赖的package包/类
/**
* 提供給內部連線
*/
protected void startRelationServers() throws Exception {
// ------------------------------------------------
// relationServers, 127.0.0.1:3300, 127.0.0.1:3301
// ------------------------------------------------
// 內部不用加密
for (String ipPort : relationServers) {
if (StringHelper.isEmpty(ipPort)) {
continue;
}
//
String[] buff = ipPort.split(":");
// [0]=ip
// [1]=port
if (buff.length == 2) {
ServerServiceImpl serverService = new ServerServiceImpl(ipPort, true);
//
serverService.setApplicationContext(applicationContext);
serverService.setBeanFactory(beanFactory);
serverService.setResourceLoader(resourceLoader);
//
serverService.setThreadService(threadService);
serverService.setMessageService(messageService);
serverService.setProtocolService(protocolService);
serverService.setAuthKeyService(authKeyService);
serverService.setAcceptorServiceImpl(this);
serverService.setContextServiceImpl(contextServiceImpl);
//
serverService.setIp(buff[0]);
int port = NumberHelper.toInt(buff[1]);
serverService.setPort(port);
//
int maxCounter = (int) NumberHelper.divide(maxClient, relationServers.size());
serverService.setMaxClient(maxCounter);
serverService.setModuleTypeClass(moduleTypeClass);
serverService.setMessageTypeClass(messageTypeClass);
//
serverService.start();
} else {
LOGGER.error(
"[" + id + "]" + " Wrong [" + ipPort + "] format, ex: [127.0.0.1:3300] or [localhost:3300]");
}
}
}