本文整理汇总了Java中org.compiere.util.Env.getAD_User_ID方法的典型用法代码示例。如果您正苦于以下问题:Java Env.getAD_User_ID方法的具体用法?Java Env.getAD_User_ID怎么用?Java Env.getAD_User_ID使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.compiere.util.Env
的用法示例。
在下文中一共展示了Env.getAD_User_ID方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getNotificationRecipientUserId
import org.compiere.util.Env; //导入方法依赖的package包/类
private final int getNotificationRecipientUserId(final I_M_InOut inout)
{
//
// In case of reversal i think we shall notify the current user too
if (docActionBL.isDocumentReversedOrVoided(inout))
{
final int currentUserId = Env.getAD_User_ID(Env.getCtx()); // current/triggering user
if (currentUserId > 0)
{
return currentUserId;
}
return inout.getUpdatedBy(); // last updated
}
//
// Fallback: notify only the creator
else
{
return inout.getCreatedBy();
}
}
示例2: setIsApproved
import org.compiere.util.Env; //导入方法依赖的package包/类
/**
* Set Approved
* @param IsApproved approval
*/
@Override
public void setIsApproved (boolean IsApproved)
{
if (IsApproved && !isApproved())
{
int AD_User_ID = Env.getAD_User_ID(getCtx());
I_AD_User user = Services.get(IUserDAO.class).retrieveUserOrNull(getCtx(), AD_User_ID);
String info = user.getName()
+ ": "
+ Msg.translate(getCtx(), "IsApproved")
+ " - " + new Timestamp(System.currentTimeMillis());
addDescription(info);
}
super.setIsApproved (IsApproved);
}
示例3: createPrintingQueueSources
import org.compiere.util.Env; //导入方法依赖的package包/类
@Override
protected List<IPrintingQueueSource> createPrintingQueueSources(final Properties ctxToUse)
{
// out of transaction because methods which are polling the printing queue are working out of transaction
final String trxName = ITrx.TRXNAME_None;
final I_C_Printing_Queue item = InterfaceWrapperHelper.create(ctxToUse, p_C_Printing_Queue_ID, I_C_Printing_Queue.class, trxName);
Check.assumeNotNull(item, "C_Printing_Queue for {} exists", p_C_Printing_Queue_ID);
final int adUserToPrintId = Env.getAD_User_ID(ctxToUse); // logged in user
final SingletonPrintingQueueSource queue = new SingletonPrintingQueueSource(item, adUserToPrintId);
// 04015 : This is a test process. We shall not mark the item as printed
queue.setPersistPrintedFlag(false);
return ImmutableList.<IPrintingQueueSource> of(queue);
}
示例4: getNotificationRecipientUserId
import org.compiere.util.Env; //导入方法依赖的package包/类
private final int getNotificationRecipientUserId(final I_M_Inventory inventory)
{
//
// In case of reversal i think we shall notify the current user too
if(docActionBL.isDocumentReversedOrVoided(inventory))
{
final int currentUserId = Env.getAD_User_ID(Env.getCtx()); // current/triggering user
if(currentUserId > 0)
{
return currentUserId;
}
return inventory.getUpdatedBy(); // last updated
}
//
// Fallback: notify only the creator
else
{
return inventory.getCreatedBy();
}
}
示例5: findPrintingService
import org.compiere.util.Env; //导入方法依赖的package包/类
public IPrintingService findPrintingService(final ProcessInfo pi)
{
final Properties ctx = Env.getCtx();
final int AD_Client_ID = Env.getAD_Client_ID(ctx);
final int AD_Org_ID = Env.getAD_Org_ID(ctx);
final int AD_Role_ID = Env.getAD_Role_ID(ctx);
final int AD_User_ID = Env.getAD_User_ID(ctx);
final int AD_Process_ID = pi.getAD_Process_ID();
final int C_DocType_ID = Services.get(IDocumentBL.class).getC_DocType_ID(ctx, pi.getTable_ID(), pi.getRecord_ID());
final String printerType = null;
return findPrintingService0(ctx,
AD_Client_ID, AD_Org_ID,
AD_Role_ID, AD_User_ID,
C_DocType_ID, AD_Process_ID,
printerType);
}
示例6: toInfoString
import org.compiere.util.Env; //导入方法依赖的package包/类
private String toInfoString(final Properties ctx)
{
final String threadName = (String)ctx.get(CTXNAME_ThreadName);
final String threadId = (String)ctx.get(CTXNAME_ThreadId);
final int adClientId = Env.getAD_Client_ID(ctx);
final int adOrgId = Env.getAD_Org_ID(ctx);
final int adUserId = Env.getAD_User_ID(ctx);
final int adRoleId = Env.getAD_Role_ID(ctx);
final int adSessionId = Env.getAD_Session_ID(ctx);
return "Thread=" + threadName + "(" + threadId + ")"
//
+ "\n"
+ ", Client/Org=" + adClientId + "/" + adOrgId
+ ", User/Role=" + adUserId + "/" + adRoleId
+ ", SessionId=" + adSessionId
//
+ "\n"
+ ", id=" + System.identityHashCode(ctx)
+ ", " + ctx.getClass()
//
+ "\n"
+ ", " + ctx.toString();
}
示例7: checkPreconditionsApplicable
import org.compiere.util.Env; //导入方法依赖的package包/类
@Override
public ProcessPreconditionsResolution checkPreconditionsApplicable(final IProcessPreconditionsContext context)
{
if (!context.isSingleSelection())
{
return ProcessPreconditionsResolution.rejectBecauseNotSingleSelection();
}
if (!I_AD_User.Table_Name.equals(context.getTableName()))
{
return ProcessPreconditionsResolution.rejectWithInternalReason("not running on AD_User table");
}
// Make sure it's the current logged in user
final int adUserId = context.getSingleSelectedRecordId();
if (adUserId != Env.getAD_User_ID(Env.getCtx()))
{
return ProcessPreconditionsResolution.rejectWithInternalReason("not current logged in user");
}
return ProcessPreconditionsResolution.accept();
}
示例8: isEnabled
import org.compiere.util.Env; //导入方法依赖的package包/类
public boolean isEnabled()
{
final Properties ctx = Env.getCtx();
final int loggedUserId = Env.getAD_User_ID(ctx);
synchronized (userId2enabled)
{
Boolean enabled = userId2enabled.get(loggedUserId);
if (enabled == null)
{
try
{
enabled = retrieveEnabled(ctx, loggedUserId);
userId2enabled.put(loggedUserId, enabled);
}
catch (Exception e)
{
logger.error(e.getLocalizedMessage(), e);
enabled = false;
}
}
return enabled;
}
}
示例9: doIt
import org.compiere.util.Env; //导入方法依赖的package包/类
@Override
protected String doIt() throws Exception
{
if (!I_AD_User.Table_Name.equals(getTableName()))
{
throw new AdempiereException("Call it from User window");
}
final Properties ctx = getCtx(); // logged in context
//
// Get the AD_User_ID and make sure it's NOT the currently logged on.
final int adUserId = getRecord_ID();
if (adUserId == Env.getAD_User_ID(ctx))
{
throw new AdempiereException("Changing password for currently logged on user is not allowed by this process");
}
//
// Actually change it's password
Services.get(IUserBL.class).changePassword(ctx, adUserId, oldPassword, newPassword, newPasswordRetype);
return MSG_OK;
}
示例10: isLoginUserAdminForComSystem
import org.compiere.util.Env; //导入方法依赖的package包/类
private boolean isLoginUserAdminForComSystem(final Properties ctx, final I_C_AdvComSystem comSystem, final String trxName)
{
boolean userIsAdmin = false;
if (comSystem.getAD_User_Admin_ID() == Env.getAD_User_ID(ctx))
{
logger.debug("Login user " + Env.getAD_User_ID(ctx) + " is an admin for " + comSystem);
userIsAdmin = true;
}
if (comSystem.getAD_Role_Admin_ID() == Env.getAD_Role_ID(ctx))
{
logger.debug("Login role " + Env.getAD_Role_ID(ctx) + " is an admin for " + comSystem);
userIsAdmin = true;
}
return userIsAdmin;
}
示例11: getNotificationRecipientUserId
import org.compiere.util.Env; //导入方法依赖的package包/类
private final int getNotificationRecipientUserId(final I_M_Movement movement)
{
//
// In case of reversal i think we shall notify the current user too
if (docActionBL.isDocumentReversedOrVoided(movement))
{
final int currentUserId = Env.getAD_User_ID(Env.getCtx()); // current/triggering user
if (currentUserId > 0)
{
return currentUserId;
}
return movement.getUpdatedBy(); // last updated
}
//
// Fallback: notify only the creator
else
{
return movement.getCreatedBy();
}
}
示例12: getEffectiveRolePermissions
import org.compiere.util.Env; //导入方法依赖的package包/类
private final IUserRolePermissions getEffectiveRolePermissions(final I_PA_Goal goal)
{
final int goalRoleId = goal.getAD_Role_ID();
final int goalUserId = goal.getAD_User_ID();
final Properties ctx = getCtx();
final int contextUserId = Env.getAD_User_ID(ctx);
final int contextClientId = Env.getAD_Client_ID(ctx);
final Date contextDate = Env.getDate(ctx);
IUserRolePermissions role = null;
if (goalRoleId > 0)
{
role = Services.get(IUserRolePermissionsDAO.class).retrieveUserRolePermissions(
goalRoleId,
goalUserId > 0 ? goalUserId : contextUserId,
contextClientId,
contextDate);
}
else if (goalUserId > 0)
{
final List<IUserRolePermissions> roles = Services.get(IUserRolePermissionsDAO.class)
.retrieveUserRolesPermissionsForUserWithOrgAccess(getCtx(), goalUserId, getAD_Org_ID());
if (!roles.isEmpty())
{
role = roles.get(0);
}
}
// Fallback
if (role == null)
{
role = Env.getUserRolePermissions(ctx);
}
return role;
}
示例13: unlockShipmentSchedules
import org.compiere.util.Env; //导入方法依赖的package包/类
/**
* Unlock all shipment schedules which were locked in {@link #createPackingDetails(Properties, int)}
*/
public void unlockShipmentSchedules()
{
final int adClientId = Env.getAD_Client_ID(ctx);
final int adUserId = Env.getAD_User_ID(ctx);
trxManager.run(new TrxRunnable()
{
@Override
public void run(final String localTrxName) throws Exception
{
final boolean updateOnlyLocked = true;
shipmentScheduleUpdater.updateShipmentSchedule(
ctx,
adClientId,
adUserId,
adPInstanceId,
updateOnlyLocked,
localTrxName);
shipmentSchedulePA.deleteUnprocessedLocksForShipmentRun(
adPInstanceId,
adUserId,
localTrxName); // 02217
}
});
}
示例14: buildCacheKey
import org.compiere.util.Env; //导入方法依赖的package包/类
private static final ArrayKey buildCacheKey(final Properties ctx)
{
return new ArrayKey(
Env.getAD_Client_ID(ctx),
Env.getAD_Role_ID(ctx),
Env.getAD_User_ID(ctx),
Env.getAD_Language(ctx));
}
示例15: of
import org.compiere.util.Env; //导入方法依赖的package包/类
public static final UserRolePermissionsKey of(final Properties ctx)
{
final int adRoleId = Env.getAD_Role_ID(ctx);
final int adUserId = Env.getAD_User_ID(ctx);
final int adClientId = Env.getAD_Client_ID(ctx);
final Date date = Env.getDate(ctx);
final long dateMillis = normalizeDate(date);
return new UserRolePermissionsKey(adRoleId, adUserId, adClientId, dateMillis);
}