本文整理汇总了Java中org.compiere.util.Env.isBaseLanguage方法的典型用法代码示例。如果您正苦于以下问题:Java Env.isBaseLanguage方法的具体用法?Java Env.isBaseLanguage怎么用?Java Env.isBaseLanguage使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.compiere.util.Env
的用法示例。
在下文中一共展示了Env.isBaseLanguage方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: translate
import org.compiere.util.Env; //导入方法依赖的package包/类
public static <T> T translate(final T model, final Class<T> cl, String trlAdLanguage)
{
final PO po = getStrictPO(model);
if (trlAdLanguage == null)
{
final Properties ctx = getCtx(model);
trlAdLanguage = Env.getAD_Language(ctx);
}
if (Env.isBaseLanguage(trlAdLanguage, po.get_TableName()))
{
// no need to translate because context language is same as base language
trlAdLanguage = null;
}
final boolean useOldValues = false;
return create(po, cl, useOldValues, trlAdLanguage);
}
示例2: getProcessData
import org.compiere.util.Env; //导入方法依赖的package包/类
public KeyNamePair[] getProcessData()
{
// Processes
final IUserRolePermissions role = Env.getUserRolePermissions(); // metas
// int AD_Role_ID = Env.getAD_Role_ID(Env.getCtx());
boolean trl = !Env.isBaseLanguage(Env.getCtx(), "AD_Process");
String lang = Env.getAD_Language(Env.getCtx());
// TODO: ASP - implement process and window access ASP control
String sql = "SELECT DISTINCT p.AD_Process_ID,"
+ (trl ? "trl.Name" : "p.Name ")
+ " FROM AD_Process p INNER JOIN AD_Process_Access pa ON (p.AD_Process_ID=pa.AD_Process_ID) "
+ (trl ? "LEFT JOIN AD_Process_Trl trl on (trl.AD_Process_ID=p.AD_Process_ID and trl.AD_Language=" + DB.TO_STRING(lang) + ")" : "")
+ " WHERE "+role.getIncludedRolesWhereClause("pa.AD_Role_ID", null) // metas: use included roles
+ " AND p.IsReport='Y' AND p.IsActive='Y' AND pa.IsActive='Y' "
+ "ORDER BY 2";
return DB.getKeyNamePairs(sql, true);
}
示例3: getTableData
import org.compiere.util.Env; //导入方法依赖的package包/类
public KeyNamePair[] getTableData()
{
// Tables
final IUserRolePermissions role = Env.getUserRolePermissions(); // metas
// int AD_Role_ID = Env.getAD_Role_ID(Env.getCtx());
boolean trl = !Env.isBaseLanguage(Env.getCtx(), "AD_Table");
String lang = Env.getAD_Language(Env.getCtx());
String sql = "SELECT DISTINCT t.AD_Table_ID,"
+ (trl ? "trl.Name" : "t.Name")
+ " FROM AD_Table t INNER JOIN AD_Tab tab ON (tab.AD_Table_ID=t.AD_Table_ID)"
+ " INNER JOIN AD_Window_Access wa ON (tab.AD_Window_ID=wa.AD_Window_ID) "
+ (trl ? "LEFT JOIN AD_Table_Trl trl on (trl.AD_Table_ID=t.AD_Table_ID and trl.AD_Language=" + DB.TO_STRING(lang) + ")" : "")
+ " WHERE "+role.getIncludedRolesWhereClause("wa.AD_Role_ID", null) // metas
+ " AND t.IsActive='Y' AND tab.IsActive='Y' "
+ "ORDER BY 2";
return DB.getKeyNamePairs(sql, true);
}
示例4: getSQL_ColumnType
import org.compiere.util.Env; //导入方法依赖的package包/类
/**
* Get SQL Code of ColumnType for given sqlValue
* @param sqlValue
* @return sql select code
*/
private String getSQL_ColumnType(String sqlValue) {
int columnType_Ref_ID = MTable.get(Env.getCtx(), MHRConcept.Table_ID)
.getColumn(MHRConcept.COLUMNNAME_ColumnType)
.getAD_Reference_Value_ID();
String sql;
if (Env.isBaseLanguage(Env.getCtx(), MRefList.Table_Name)) {
sql = "SELECT zz.Name FROM AD_Ref_List zz WHERE zz.AD_Reference_ID="+columnType_Ref_ID;
}
else {
sql = "SELECT zz.Name FROM AD_Ref_List zz, AD_Ref_List_Trl zzt"
+" WHERE zz.AD_Reference_ID="+columnType_Ref_ID
+" AND zzt.AD_Ref_List_ID=zz.AD_Ref_List_ID"
+" AND zzt.AD_Language="+DB.TO_STRING(Env.getAD_Language(Env.getCtx()));
}
sql += " AND zz.Value = "+sqlValue;
return sql;
}
示例5: getPrintName
import org.compiere.util.Env; //导入方法依赖的package包/类
/**************************************************************************
* Get print name with language
* @param language language - ignored if IsMultiLingualDocument not 'Y'
* @return print name
*/
public String getPrintName (Language language)
{
if (language == null || Env.isBaseLanguage(language, "AD_PrintFormatItem"))
return getPrintName();
loadTranslations();
String retValue = m_translationLabel.get(language.getAD_Language());
if (retValue == null || retValue.length() == 0)
return getPrintName();
return retValue;
}
示例6: getPrintNameSuffix
import org.compiere.util.Env; //导入方法依赖的package包/类
/**
* Get print name suffix with language
* @param language language - ignored if IsMultiLingualDocument not 'Y'
* @return print name suffix
*/
public String getPrintNameSuffix (Language language)
{
if (language == null || Env.isBaseLanguage(language, "AD_PrintFormatItem"))
return getPrintNameSuffix();
loadTranslations();
String retValue = m_translationSuffix.get(language.getAD_Language());
if (retValue == null || retValue.length() == 0)
return getPrintNameSuffix();
return retValue;
}
示例7: loadTrl
import org.compiere.util.Env; //导入方法依赖的package包/类
/**
* Load Translation
*/
private void loadTrl()
{
if (Env.isBaseLanguage(getCtx(), "AD_Workflow") || get_ID() == 0)
return;
String sql = "SELECT Name, Description, Help FROM AD_Workflow_Trl WHERE AD_Workflow_ID=? AND AD_Language=?";
PreparedStatement pstmt = null;
ResultSet rs = null;
try
{
pstmt = DB.prepareStatement(sql, null);
pstmt.setInt(1, get_ID());
pstmt.setString(2, Env.getAD_Language(getCtx()));
rs = pstmt.executeQuery();
if (rs.next())
{
m_name_trl = rs.getString(1);
m_description_trl = rs.getString(2);
m_help_trl = rs.getString(3);
m_translated = true;
}
}
catch (SQLException e)
{
//log.error(sql, e);
throw new DBException(e, sql);
}
finally
{
DB.close(rs, pstmt);
rs = null; pstmt = null;
}
log.debug("Translated={}", m_translated);
}
示例8: loadTrl
import org.compiere.util.Env; //导入方法依赖的package包/类
/**
* Load Translation
*/
private void loadTrl()
{
if (Env.isBaseLanguage(getCtx(), "AD_Workflow") || get_ID() == 0)
return;
final String sql = "SELECT Name, Description, Help FROM AD_WF_Node_Trl"
+" WHERE AD_WF_Node_ID=? AND AD_Language=?";
PreparedStatement pstmt = null;
ResultSet rs = null;
try
{
pstmt = DB.prepareStatement(sql, get_TrxName());
pstmt.setInt(1, get_ID());
pstmt.setString(2, Env.getAD_Language(getCtx()));
rs = pstmt.executeQuery();
if (rs.next())
{
m_name_trl = rs.getString(1);
m_description_trl = rs.getString(2);
m_help_trl = rs.getString(3);
m_translated = true;
}
}
catch (SQLException e)
{
//log.error(sql, e);
throw new DBException(e, sql);
}
finally
{
DB.close(rs, pstmt);
rs = null; pstmt = null;
}
log.debug("Trl=" + m_translated);
}
示例9: get_Translation
import org.compiere.util.Env; //导入方法依赖的package包/类
/**
* Get Translation of column (if needed).
* It checks if the base language is used or the column is not translated.
* If there is no translation then it fallback to original value.
*
* @param columnName
* @param AD_Language
* @return translated string
* @throws IllegalArgumentException if columnName or AD_Language is null or model has multiple PK
*/
public final String get_Translation(@NonNull final String columnName, @NonNull final String AD_Language)
{
String retValue = null;
//
// Check if NOT base language and column is translated => load trl from db
final POTrlInfo trlInfo = p_info.getTrlInfo();
if (is_Translatable() && !Env.isBaseLanguage(AD_Language, get_TableName()) && trlInfo.isColumnTranslated(columnName))
{
// Load translation from database
// metas: begin
final IModelTranslation trlMap = get_ModelTranslation(AD_Language);
if (trlMap.isTranslated(columnName))
{
retValue = trlMap.getTranslation(columnName);
// Case: is possible that the translation in one language to be empty
// and we don't want to fallback to original value (where is possible to not be empty)
if (retValue == null)
retValue = "";
}
}
//
// If no translation found or not translated, fallback to original:
if (retValue == null)
{
Object val = get_Value(columnName);
retValue = (val != null ? val.toString() : null);
}
//
return retValue;
}
示例10: readReference
import org.compiere.util.Env; //导入方法依赖的package包/类
/**
* Fill m_Values with Ref_List values
* @param AD_Reference_ID reference
*/
private void readReference( int AD_Reference_ID)
{
m_values = new HashMap<String,String>();
String SQL;
// metas: added IsActive='Y' to where clauses
if (Env.isBaseLanguage(Env.getCtx(), "AD_Ref_List"))
SQL = "SELECT Value, Name FROM AD_Ref_List WHERE AD_Reference_ID=? AND IsActive='Y'";
else
SQL = "SELECT l.Value, t.Name FROM AD_Ref_List l, AD_Ref_List_Trl t "
+ "WHERE l.AD_Ref_List_ID=t.AD_Ref_List_ID"
+ " AND t.AD_Language='" + Env.getAD_Language(Env.getCtx()) + "'"
+ " AND l.AD_Reference_ID=? AND l.IsActive='Y'";
// metas end
try
{
PreparedStatement pstmt = DB.prepareStatement(SQL, null);
pstmt.setInt(1, AD_Reference_ID);
ResultSet rs = pstmt.executeQuery();
while (rs.next())
{
String value = rs.getString(1);
String name = rs.getString(2);
// metas: tsa: if debugging display ColumnNames instead of regular name
if (Services.get(IDeveloperModeBL.class).isEnabled())
{
name = value + "_" + name;
}
// metas: end
m_values.put(value, name);
}
rs.close();
pstmt.close();
}
catch (SQLException e)
{
log.error(SQL, e);
}
}
示例11: createFields
import org.compiere.util.Env; //导入方法依赖的package包/类
private void createFields()
{
// ASP
// NOTE: if you are going to change the "p." alias for AD_Process_Para, pls check the ASPFilters implementation.
final String ASPFilter = Services.get(IASPFiltersFactory.class)
.getASPFiltersForClient(Env.getAD_Client_ID(ctx))
.getSQLWhereClause(I_AD_Process_Para.class);
//
final String sql;
if (Env.isBaseLanguage(ctx, "AD_Process_Para"))
{
sql = "SELECT p.Name, p.Description, p.Help, "
+ "p.AD_Reference_ID, p.AD_Process_Para_ID, "
+ "p.FieldLength, p.IsMandatory, p.IsRange, p.ColumnName, "
+ "p.DefaultValue, p.DefaultValue2, p.VFormat, p.ValueMin, p.ValueMax, "
+ "p.SeqNo, p.AD_Reference_Value_ID, p.AD_Val_Rule_ID, p.ReadOnlyLogic, p.DisplayLogic "
+ ", p.IsEncrypted " // metas: tsa: US745
+ ", p.isAutoComplete" // 05887
+ ", p.EntityType as FieldEntityType"
+ " FROM AD_Process_Para p"
+ " WHERE p.AD_Process_ID=?" // 1
+ " AND p.IsActive='Y' "
+ ASPFilter + " ORDER BY SeqNo";
}
else
{
sql = "SELECT t.Name, t.Description, t.Help, "
+ "p.AD_Reference_ID, p.AD_Process_Para_ID, "
+ "p.FieldLength, p.IsMandatory, p.IsRange, p.ColumnName, "
+ "p.DefaultValue, p.DefaultValue2, p.VFormat, p.ValueMin, p.ValueMax, "
+ "p.SeqNo, p.AD_Reference_Value_ID, p.AD_Val_Rule_ID, p.ReadOnlyLogic, p.DisplayLogic "
+ ", p.IsEncrypted " // metas: tsa: US745
+ ", p.isAutoComplete" // 05887
+ ", p.EntityType as FieldEntityType"
+ " FROM AD_Process_Para p"
+ " INNER JOIN AD_Process_Para_Trl t ON (p.AD_Process_Para_ID=t.AD_Process_Para_ID)"
+ "WHERE p.AD_Process_ID=?" // 1
+ " AND t.AD_Language='" + Env.getAD_Language(ctx) + "'"
+ " AND p.IsActive='Y' "
+ ASPFilter + " ORDER BY SeqNo";
}
// Create Fields
PreparedStatement pstmt = null;
ResultSet rs = null;
try
{
pstmt = DB.prepareStatement(sql, ITrx.TRXNAME_None);
pstmt.setInt(1, getAD_Process_ID());
rs = pstmt.executeQuery();
while (rs.next())
{
createField(rs);
}
}
catch (final SQLException e)
{
throw new DBException(e, sql);
}
finally
{
DB.close(rs, pstmt);
rs = null;
pstmt = null;
}
}
示例12: getSQL
import org.compiere.util.Env; //导入方法依赖的package包/类
/**
* Return the SQL statement used for the {@link #create(Properties, int, int, int, int, boolean, boolean, ResultSet)}.
*
* @param ctx context
* @return SQL
*/
static String getSQL (final Properties ctx, final int adTabId, final boolean loadAllLanguages, final List<Object> sqlParams)
{
final String viewName;
final boolean filterByLanguage;
if(loadAllLanguages)
{
viewName = "AD_Field_vt";
filterByLanguage = false;
}
else if (!Env.isBaseLanguage(ctx, I_AD_Field.Table_Name))
{
viewName = "AD_Field_vt";
filterByLanguage = true;
}
else
{
viewName = "AD_Field_v";
filterByLanguage = false;
}
final StringBuilder sql = new StringBuilder("SELECT * FROM ")
.append(viewName)
.append(" WHERE AD_Tab_ID=?");
sqlParams.add(adTabId);
// NOTE: IsActive is part of View
// Only those fields which entity type allows to be displayed in UI
// NOTE: instead of filtering we will, later, set IsDisplayed and IsDisplayedGrid flags.
// sql.append(" AND (").append(EntityTypesCache.instance.getDisplayedInUIEntityTypeSQLWhereClause("FieldEntityType")).append(")");
if (filterByLanguage)
{
sql.append(" AND AD_Language=?");
sqlParams.add(Env.getAD_Language(ctx));
}
sql.append(" ORDER BY IsDisplayed DESC, SeqNo, AD_Field_ID");
return sql.toString();
}
示例13: initWorkbench
import org.compiere.util.Env; //导入方法依赖的package包/类
/**
* Init Workbench
* @param ad_Workbench_ID workbench
* @return true if initialized
*/
public boolean initWorkbench (int ad_Workbench_ID)
{
AD_Workbench_ID = ad_Workbench_ID;
// Get WB info
String sql = null;
if (Env.isBaseLanguage(m_ctx, "AD_Workbench"))
sql = "SELECT w.Name,w.Description,w.Help," // 1..3
+ " w.AD_Column_ID,w.AD_Image_ID,w.AD_Color_ID,w.PA_Goal_ID," // 4..7
+ " c.ColumnName " // 8
+ "FROM AD_Workbench w, AD_Column c "
+ "WHERE w.AD_Workbench_ID=?" // #1
+ " AND w.IsActive='Y'"
+ " AND w.AD_Column_ID=c.AD_Column_ID";
else
sql = "SELECT t.Name,t.Description,t.Help,"
+ " w.AD_Column_ID,w.AD_Image_ID,w.AD_Color_ID,w.PA_Goal_ID,"
+ " c.ColumnName "
+ "FROM AD_Workbench w, AD_Workbench_Trl t, AD_Column c "
+ "WHERE w.AD_Workbench_ID=?" // #1
+ " AND w.IsActive='Y'"
+ " AND w.AD_Workbench_ID=t.AD_Workbench_ID"
+ " AND t.AD_Language='" + Env.getAD_Language(m_ctx) + "'"
+ " AND w.AD_Column_ID=c.AD_Column_ID";
try
{
PreparedStatement pstmt = DB.prepareStatement(sql, null);
pstmt.setInt(1, AD_Workbench_ID);
ResultSet rs = pstmt.executeQuery();
if (rs.next())
{
Name = rs.getString(1);
Description = rs.getString(2);
if (Description == null)
Description = "";
Help = rs.getString(3);
if (Help == null)
Help = "";
//
AD_Column_ID = rs.getInt(4);
AD_Image_ID = rs.getInt(5);
AD_Color_ID = rs.getInt(6);
PA_Goal_ID = rs.getInt(7);
ColumnName = rs.getString(8);
}
else
AD_Workbench_ID = 0;
rs.close();
pstmt.close();
}
catch (SQLException e)
{
log.error(sql, e);
}
if (AD_Workbench_ID == 0)
return false;
return initWorkbenchWindows();
}
示例14: buildSql
import org.compiere.util.Env; //导入方法依赖的package包/类
private static final String buildSql(final Properties ctx, final int AD_Window_ID, final boolean loadAllLanguages, final List<Object> sqlParams)
{
//
final boolean useTrl;
final boolean filterByLanguage;
if (loadAllLanguages)
{
useTrl = true;
filterByLanguage = false;
}
else if (!Env.isBaseLanguage(ctx, I_AD_Window.Table_Name))
{
useTrl= true;
filterByLanguage = true;
}
else
{
useTrl = false;
filterByLanguage = false;
}
final StringBuilder sql;
if (!useTrl)
{
sql = new StringBuilder("SELECT "
+ " w.Name"
+ ", w.Description"
+ ", w.Help"
+ ", w.WindowType"
+ ", w.AD_Color_ID, w.AD_Image_ID, w.WinHeight, w.WinWidth "
+ ", IsSOTrx "
+ ", IsOneInstanceOnly " // 10 // metas: US831
);
sql.append(" FROM AD_Window w WHERE w.AD_Window_ID=? AND w.IsActive=?");
sqlParams.add(AD_Window_ID);
sqlParams.add(true); // IsActive
}
else
{
sql = new StringBuilder("SELECT "
+ " trl.AD_Language"
+ ", trl.Name"
+ ", w.Name as Name_BaseLang"
+ ", trl.Description"
+ ", w.Description as Description_BaseLang"
+ ", trl.Help"
+ ", w.Help as Help_BaseLang"
+ ", w.WindowType"
+ ", w.AD_Color_ID, w.AD_Image_ID, w.WinHeight, w.WinWidth "
+ ", w.IsSOTrx "
+ ", w.IsOneInstanceOnly " // 10 // metas: US831
);
sql.append(" FROM AD_Window w INNER JOIN AD_Window_Trl trl ON (trl.AD_Window_ID=w.AD_Window_ID)");
sql.append(" WHERE w.AD_Window_ID=? AND w.IsActive=?");
sqlParams.add(AD_Window_ID);
sqlParams.add(true); // IsActive
if(filterByLanguage)
{
sql.append(" AND trl.AD_Language=?");
sqlParams.add(Env.getAD_Language(ctx));
}
}
return sql.toString();
}
示例15: getListDescription
import org.compiere.util.Env; //导入方法依赖的package包/类
/**
* Get Reference List Value Description (cached)
* @param ctx context
* @param ListName reference
* @param Value value
* @return List or null
*/
public static String getListDescription (Properties ctx, String ListName, String Value)
{
String AD_Language = Env.getAD_Language(ctx);
String key = AD_Language + "_" + ListName + "_" + Value;
String retValue = s_cache.get(key);
if (retValue != null)
return retValue;
boolean isBaseLanguage = Env.isBaseLanguage(AD_Language, "AD_Ref_List");
String sql = isBaseLanguage ?
"SELECT a.Description FROM AD_Ref_List a, AD_Reference b"
+ " WHERE b.Name=? AND a.Value=?"
+ " AND a.AD_Reference_ID = b.AD_Reference_ID"
:
"SELECT t.Description FROM AD_Reference r"
+" INNER JOIN AD_Ref_List rl ON (r.AD_Reference_ID=rl.AD_Reference_ID)"
+" INNER JOIN AD_Ref_List_Trl t ON (t.AD_Ref_List_ID=rl.AD_Ref_List_ID)"
+" WHERE r.Name=? AND rl.Value=? AND t.AD_Language=?";
PreparedStatement pstmt = null;
ResultSet rs = null;
try
{
pstmt = DB.prepareStatement (sql,null);
pstmt.setString (1, ListName);
pstmt.setString(2, Value);
if (!isBaseLanguage)
pstmt.setString(3, AD_Language);
rs = pstmt.executeQuery ();
if (rs.next ())
retValue = rs.getString(1);
rs.close ();
pstmt.close ();
pstmt = null;
}
catch (SQLException ex)
{
s_log.error(sql + " -- " + key, ex);
}
finally
{
DB.close(rs, pstmt);
rs = null; pstmt = null;
}
// Save into Cache
if (retValue == null)
{
retValue = "";
s_log.info("getListDescription - Not found " + key);
}
s_cache.put(key, retValue);
//
return retValue;
}