Codota Logo
org.apache.cloudstack.context
Code IndexAdd Codota to your IDE (free)

How to use org.apache.cloudstack.context

Best Java code snippets using org.apache.cloudstack.context (Showing top 20 results out of 315)

  • Add the Codota plugin to your IDE and get smart completions
private void myMethod () {
Charset c =
  • Codota IconString charsetName;Charset.forName(charsetName)
  • Codota IconCharset.defaultCharset()
  • Codota IconContentType contentType;contentType.getCharset()
  • Smart code suggestions by Codota
}
origin: apache/cloudstack

/**
 * Simple call to {@link CallContext#current()} to retrieve the current calling account.
 * This method facilitates unit testing, it avoids mocking static methods.
 */
protected Account getCurrentAccount() {
  return CallContext.current().getCallingAccount();
}
origin: apache/cloudstack

private Long getSnapshotUserId() {
  Long userId = CallContext.current().getCallingUserId();
  if (userId == null) {
    return User.UID_SYSTEM;
  }
  return userId;
}
origin: apache/cloudstack

public static void setActionEventInfo(String eventType, String description) {
  CallContext context = CallContext.current();
  if (context != null) {
    context.setEventType(eventType);
    context.setEventDescription(description);
  }
}
origin: apache/cloudstack

@Override
public long getEntityOwnerId() {
  return CallContext.current().getCallingAccountId();
}
origin: apache/cloudstack

@Override
public Object onEnterContext(boolean reentry) {
  if (!reentry && CallContext.current() == null) {
    CallContext.registerSystemCallContextOnceOnly();
  }
  return null;
}
origin: apache/cloudstack

public static void unregisterAll() {
  while (unregister() != null) {
    // NOOP
  }
}
origin: apache/cloudstack

public static void setActionEventInfo(String eventType, String description) {
  LogContext context = LogContext.current();
  if (context != null) {
    context.setEventType(eventType);
    context.setEventDescription(description);
  }
}
origin: apache/cloudstack

@Override
public void onLeaveContext(Object unused, boolean reentry) {
  if (!reentry) {
    CallContext.unregisterAll();
  }
}
origin: apache/cloudstack

@Override
public Object onEnterContext(boolean reentry) {
  if (!reentry && LogContext.current() == null) {
    LogContext.registerSystemLogContextOnceOnly();
  }
  return null;
}
origin: apache/cloudstack

@Override
public void onLeaveContext(Object unused, boolean reentry) {
  if (!reentry) {
    LogContext.unregister();
  }
}
origin: apache/cloudstack

/**
 * This method should only be called if you can propagate the context id
 * from another LogContext.
 *
 * @param callingUser calling user
 * @param callingAccount calling account
 * @param contextId context id propagated from another call context
 * @return LogContext
 */
public static LogContext register(User callingUser, Account callingAccount, String contextId) {
  return register(callingUser, callingAccount, null, null, contextId);
}
origin: apache/cloudstack

@Override
public long getEntityOwnerId() {
  return CallContext.current().getCallingAccountId();
}
origin: apache/cloudstack

/**
 * Returns the calling account using the method {@link CallContext#getCallingAccount()}.
 * We are introducing this method to avoid using 'PowerMockRunner' in unit tests. Then, we can mock the calls to this method, which facilitates the development of test cases.
 */
protected Account getCurrentCallingAccount() {
  return CallContext.current().getCallingAccount();
}
origin: apache/cloudstack

public long getAutoscaleUserId() {
  if (autoscaleUserId != null) {
    return autoscaleUserId;
  } else {
    return CallContext.current().getCallingUserId();
  }
}
origin: apache/cloudstack

@Override
final public long getEntityOwnerId() {
  return CallContext.current().getCallingAccountId();
}
origin: apache/cloudstack

/**
 * @return
 */
protected Account getCaller() {
  final Account caller = CallContext.current().getCallingAccount();
  return caller;
}
origin: apache/cloudstack

@Override
public long getEntityOwnerId() {
  return CallContext.current().getCallingAccountId();
}
origin: apache/cloudstack

@Override
public long getEntityOwnerId() {
  return CallContext.current().getCallingAccountId();
}
origin: apache/cloudstack

@Override
public long getEntityOwnerId() {
  return CallContext.current().getCallingAccountId();
}
origin: apache/cloudstack

@Override
public long getEntityOwnerId() {
  return CallContext.current().getCallingAccountId();
}
org.apache.cloudstack.context

Most used classes

  • CallContext
    CallContext records information about the environment the call is made. This class must be always be
  • LogContext
    LogContext records information about the environment the API call is made. This class must be always
Codota Logo
  • Products

    Search for Java codeSearch for JavaScript codeEnterprise
  • IDE Plugins

    IntelliJ IDEAWebStormAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogCodota Academy Plugin user guide Terms of usePrivacy policyJava Code IndexJavascript Code Index
Get Codota for your IDE now