org.eclipse.kapua.service.account.Account类的使用及代码示例

x33g5p2x  于2022-01-17 转载在 其他  
字(9.8k)|赞(0)|评价(0)|浏览(124)

本文整理了Java中org.eclipse.kapua.service.account.Account类的一些代码示例,展示了Account类的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Account类的具体详情如下:
包路径:org.eclipse.kapua.service.account.Account
类名称:Account

Account介绍

[英]Account org.eclipse.kapua.model.KapuaEntity.
[中]账户组织。日食卡普亚。模型卡普亚实体。

代码示例

代码示例来源:origin: eclipse/kapua

@Override
public Account update(Account account)
    throws KapuaException {
  if (!accounts.containsKey(account.getId())) {
    throw KapuaException.internalError("User not found");
  }
  AccountMock accountMock = accounts.get(account.getId());
  return accountMock;
}

代码示例来源:origin: eclipse/kapua

@Given("^I set the database to device timestamp indexing$")
public void setDatabaseToDeviceTimestampIndexing() throws KapuaException {
  Account account = (Account) stepData.get("LastAccount");
  updateConfiguration(messageStoreService, account.getId(), account.getScopeId(),
      DataIndexBy.DEVICE_TIMESTAMP, MetricsIndexBy.TIMESTAMP, 30, true);
}

代码示例来源:origin: org.eclipse.kapua/kapua-account-internal

ArgumentValidator.notNull(account.getId(), "account.id");
ArgumentValidator.notEmptyOrNull(account.getName(), "account.name");
ArgumentValidator.notNull(account.getOrganization(), "account.organization");
ArgumentValidator.match(account.getOrganization().getEmail(), CommonsValidationRegex.EMAIL_REGEXP, "account.organization.email");
if (KapuaSecurityUtils.getSession().getScopeId().equals(account.getId())) {
  authorizationService.checkPermission(permissionFactory.newPermission(AccountDomains.ACCOUNT_DOMAIN, Actions.write, account.getId()));
} else {
  authorizationService.checkPermission(permissionFactory.newPermission(AccountDomains.ACCOUNT_DOMAIN, Actions.write, account.getScopeId()));
Account oldAccount = find(account.getId());
if (oldAccount == null) {
  throw new KapuaEntityNotFoundException(Account.TYPE, account.getId());
if (oldAccount.getScopeId() != null) {
  parentAccount = KapuaSecurityUtils.doPrivileged(() -> find(oldAccount.getScopeId()));
if (parentAccount != null && parentAccount.getExpirationDate() != null) {
  if (account.getExpirationDate() == null || parentAccount.getExpirationDate().before(account.getExpirationDate())) {
    throw new KapuaIllegalArgumentException("expirationDate", account.getExpirationDate() != null ? account.getExpirationDate().toString() : "no expiration date set");
if (account.getExpirationDate() != null) {
  AccountListResult childrenAccounts = findChildsRecursively(account.getId());
  if (childrenAccounts.getItems().stream().anyMatch(childAccount -> {

代码示例来源:origin: org.eclipse.kapua/kapua-security-shiro

if (account.getExpirationDate() != null && !account.getExpirationDate().after(new Date())) {
  throw new ExpiredAccountException(account.getExpirationDate());
  credentialServiceConfig = KapuaSecurityUtils.doPrivileged(() -> credentialService.getConfigValues(account.getId()));
  boolean lockoutPolicyEnabled = (boolean) credentialServiceConfig.get("lockoutPolicy.enabled");
  if (lockoutPolicyEnabled) {

代码示例来源:origin: org.eclipse.kapua/kapua-account-internal

if (parentAccount != null && parentAccount.getExpirationDate() != null) {
  if (accountCreator.getExpirationDate() == null || parentAccount.getExpirationDate().before(accountCreator.getExpirationDate())) {
  String parentAccountPath = AccountDAO.find(em, null, accountCreator.getScopeId()).getParentAccountPath() + "/" + account.getId();
  account.setParentAccountPath(parentAccountPath);
  return AccountDAO.update(em, account);
});

代码示例来源:origin: org.eclipse.kapua/kapua-account-internal

@Override
public AccountListResult findChildsRecursively(KapuaId scopeId) throws KapuaException {
  //
  // Argument validation
  ArgumentValidator.notNull(scopeId, "scopeId");
  //
  // Make sure account exists
  Account account = findById(scopeId);
  if (account == null) {
    throw new KapuaEntityNotFoundException(Account.TYPE, scopeId);
  }
  //
  // Check Access
  authorizationService.checkPermission(permissionFactory.newPermission(AccountDomains.ACCOUNT_DOMAIN, Actions.read, account.getId()));
  return entityManagerSession.onResult(em -> {
    AccountListResult result = null;
    TypedQuery<Account> q;
    q = em.createNamedQuery("Account.findChildAccountsRecursive", Account.class);
    q.setParameter("parentAccountPath", "\\" + account.getParentAccountPath() + "/%");
    result = new AccountListResultImpl();
    result.addItems(q.getResultList());
    return result;
  });
}

代码示例来源:origin: eclipse/kapua

kcc.update(accessToken, account.getName(), accessToken.getScopeId(), accessToken.getUserId(), (((TransportConnector) context.getConnector()).getName()),
    brokerIpResolver.getBrokerIpOrHostName(), MULTI_ACCOUNT_CLIENT_ID);
kcc.updateOldConnectionId(CONNECTION_MAP.get(kcc.getFullClientId()));

代码示例来源:origin: org.eclipse.kapua/kapua-security-shiro

Account account = KapuaSecurityUtils.doPrivileged(() -> ACCOUNT_SERVICE.find(permission.getTargetScopeId()));
if (account != null && account.getScopeId() != null) {
  String parentAccountPath = account.getParentAccountPath();

代码示例来源:origin: eclipse/kapua

query.setScopeId(account.getScopeId());
endpointInfoCount = EndpointInfoDAO.count(em, query);

代码示例来源:origin: org.eclipse.kapua/kapua-security-shiro

if (account.getExpirationDate() != null && !account.getExpirationDate().after(new Date())) {
  throw new ExpiredAccountException(account.getExpirationDate());

代码示例来源:origin: eclipse/kapua

if (account.getExpirationDate() != null && !account.getExpirationDate().after(new Date())) {
  throw new ExpiredAccountException(account.getExpirationDate());
  credentialServiceConfig = KapuaSecurityUtils.doPrivileged(() -> credentialService.getConfigValues(account.getId()));
  boolean lockoutPolicyEnabled = (boolean) credentialServiceConfig.get("lockoutPolicy.enabled");
  if (lockoutPolicyEnabled) {

代码示例来源:origin: eclipse/kapua

if (parentAccount != null && parentAccount.getExpirationDate() != null) {
  if (accountCreator.getExpirationDate() == null || parentAccount.getExpirationDate().before(accountCreator.getExpirationDate())) {
  String parentAccountPath = AccountDAO.find(em, null, accountCreator.getScopeId()).getParentAccountPath() + "/" + account.getId();
  account.setParentAccountPath(parentAccountPath);
  return AccountDAO.update(em, account);
});

代码示例来源:origin: eclipse/kapua

@Override
public AccountListResult findChildsRecursively(KapuaId scopeId) throws KapuaException {
  //
  // Argument validation
  ArgumentValidator.notNull(scopeId, "scopeId");
  //
  // Make sure account exists
  Account account = findById(scopeId);
  if (account == null) {
    throw new KapuaEntityNotFoundException(Account.TYPE, scopeId);
  }
  //
  // Check Access
  authorizationService.checkPermission(permissionFactory.newPermission(AccountDomains.ACCOUNT_DOMAIN, Actions.read, account.getId()));
  return entityManagerSession.onResult(em -> {
    AccountListResult result = null;
    TypedQuery<Account> q;
    q = em.createNamedQuery("Account.findChildAccountsRecursive", Account.class);
    q.setParameter("parentAccountPath", "\\" + account.getParentAccountPath() + "/%");
    result = new AccountListResultImpl();
    result.addItems(q.getResultList());
    return result;
  });
}

代码示例来源:origin: org.eclipse.kapua/kapua-account-internal

if (settings.getString(SystemSettingKey.SYS_PROVISION_ACCOUNT_NAME).equals(accountx.getName())) {
  throw new KapuaIllegalAccessException(action.name());
if (settings.getString(SystemSettingKey.SYS_ADMIN_USERNAME).equals(accountx.getName())) {
  throw new KapuaIllegalAccessException(action.name());

代码示例来源:origin: eclipse/kapua

Account account = KapuaSecurityUtils.doPrivileged(() -> ACCOUNT_SERVICE.find(permission.getTargetScopeId()));
if (account != null && account.getScopeId() != null) {
  String parentAccountPath = account.getParentAccountPath();

代码示例来源:origin: eclipse/kapua

query.setScopeId(account.getScopeId());
endpointInfoListResult = EndpointInfoDAO.query(em, query);

代码示例来源:origin: eclipse/kapua

if (account.getExpirationDate() != null && !account.getExpirationDate().after(new Date())) {
  throw new ExpiredAccountException(account.getExpirationDate());

代码示例来源:origin: org.eclipse.kapua/kapua-account-internal

@Override
  protected Map<String, Object> getConfigValues(Account entity) throws KapuaException {
    return super.getConfigValues(entity.getId());
  }
}

代码示例来源:origin: eclipse/kapua

@Given("^I set the database to server timestamp indexing$")
public void setDatabaseToServerTimestampIndexing() throws KapuaException {
  Account account = (Account) stepData.get("LastAccount");
  updateConfiguration(messageStoreService, account.getId(), account.getScopeId(),
      DataIndexBy.SERVER_TIMESTAMP, MetricsIndexBy.TIMESTAMP, 30, true);
}

代码示例来源:origin: eclipse/kapua

ArgumentValidator.notNull(account.getId(), "account.id");
ArgumentValidator.notEmptyOrNull(account.getName(), "account.name");
ArgumentValidator.notNull(account.getOrganization(), "account.organization");
ArgumentValidator.match(account.getOrganization().getEmail(), CommonsValidationRegex.EMAIL_REGEXP, "account.organization.email");
if (KapuaSecurityUtils.getSession().getScopeId().equals(account.getId())) {
  authorizationService.checkPermission(permissionFactory.newPermission(AccountDomains.ACCOUNT_DOMAIN, Actions.write, account.getId()));
} else {
  authorizationService.checkPermission(permissionFactory.newPermission(AccountDomains.ACCOUNT_DOMAIN, Actions.write, account.getScopeId()));
Account oldAccount = find(account.getId());
if (oldAccount == null) {
  throw new KapuaEntityNotFoundException(Account.TYPE, account.getId());
if (oldAccount.getScopeId() != null) {
  parentAccount = KapuaSecurityUtils.doPrivileged(() -> find(oldAccount.getScopeId()));
if (parentAccount != null && parentAccount.getExpirationDate() != null) {
  if (account.getExpirationDate() == null || parentAccount.getExpirationDate().before(account.getExpirationDate())) {
    throw new KapuaIllegalArgumentException("expirationDate", account.getExpirationDate() != null ? account.getExpirationDate().toString() : "no expiration date set");
if (account.getExpirationDate() != null) {
  SystemSetting setting = SystemSetting.getInstance();
  if (setting.getString(SystemSettingKey.SYS_ADMIN_ACCOUNT).equals(account.getName())) {

相关文章