コード例 #1
0
  /**
   * get user's mail address from UserPreference CF
   *
   * @param userName
   * @return
   */
  private String getMailAddressOfUser(String userName) {

    DataObjectType doType = TypeMap.getDoType(UserPreferences.class);
    AlternateIdConstraint constraint =
        new AlternateIdConstraintImpl(doType.getColumnField(UserPreferences.USER_ID), userName);
    NamedElementQueryResultList queryResults = new NamedElementQueryResultList();
    this.dbClient.queryByConstraint(constraint, queryResults);

    List<URI> userPrefsIds = new ArrayList<>();
    for (NamedElementQueryResultList.NamedElement namedElement : queryResults) {
      userPrefsIds.add(namedElement.getId());
    }
    if (userPrefsIds.isEmpty()) {
      return null;
    }

    final List<UserPreferences> userPrefs = new ArrayList<>();
    Iterator<UserPreferences> iter =
        this.dbClient.queryIterativeObjects(UserPreferences.class, userPrefsIds);
    while (iter.hasNext()) {
      userPrefs.add(iter.next());
    }

    if (userPrefs.size() > 1) {
      throw new IllegalStateException("There should only be 1 user preferences object for a user");
    }
    if (userPrefs.isEmpty()) {
      // if there isn't a user prefs object in the DB yet then we haven't saved one for this user
      // yet.
      return null;
    }

    return userPrefs.get(0).getEmail();
  }
コード例 #2
0
 /**
  * Query objects on updated time.
  *
  * @param clazz type of objects to query
  * @param value Value to query on
  * @param columnName Name of the indexed column to query on
  * @param startTime Start time Date or null for no filtering on start time
  * @param endTime End time Date or null for no filtering on end time
  * @return
  */
 public static DecommissionedConstraint getTimeConstraint(
     Class<? extends DataObject> clazz,
     Boolean value,
     String columnName,
     Date startTime,
     Date endTime) {
   DataObjectType doType = TypeMap.getDoType(clazz);
   return new TimeConstraintImpl(
       clazz, value, doType.getColumnField(columnName).getIndexCF(), startTime, endTime);
 }
コード例 #3
0
  /**
   * Check if there are useful data in the DB we don't check the data whose type is in
   * excludeClasses
   *
   * @return true if there are data no matter inactive or not
   */
  private boolean hasDataInDb() {
    Collection<DataObjectType> doTypes = TypeMap.getAllDoTypes();

    for (DataObjectType doType : doTypes) {
      Class clazz = doType.getDataObjectClass();

      if (hasDataInCF(clazz)) {
        return true;
      }
    }

    return false;
  }
コード例 #4
0
 public static AlternateIdConstraint getBlockSnapshotWwnConstraint(String wwn) {
   DataObjectType doType = TypeMap.getDoType(BlockSnapshot.class);
   return new AlternateIdConstraintImpl(doType.getColumnField("wwn"), wwn);
 }
コード例 #5
0
 public static AlternateIdConstraint getUnManagedVolumeInitiatorNetworkIdConstraint(
     String altId) {
   DataObjectType doType = TypeMap.getDoType(UnManagedVolume.class);
   return new AlternateIdConstraintImpl(doType.getColumnField("initiatorNetworkIds"), altId);
 }
コード例 #6
0
 public static AlternateIdConstraint getFileSystemShareACLConstraint(
     String fileSystemShareACLIndex) {
   DataObjectType doType = TypeMap.getDoType(CifsShareACL.class);
   return new AlternateIdConstraintImpl(
       doType.getColumnField("fileSystemShareACLIndex"), fileSystemShareACLIndex);
 }
コード例 #7
0
 public static AlternateIdConstraint getRpSourceVolumeByTarget(String targetVolumeId) {
   DataObjectType doType = TypeMap.getDoType(Volume.class);
   return new AlternateIdConstraintImpl(doType.getColumnField("rpTargets"), targetVolumeId);
 }
コード例 #8
0
 public static AlternateIdConstraint getVolumesByAssociatedId(String volumeId) {
   DataObjectType doType = TypeMap.getDoType(Volume.class);
   return new AlternateIdConstraintImpl(doType.getColumnField("associatedVolumes"), volumeId);
 }
コード例 #9
0
 public static AlternateIdConstraint getTasksByResourceConstraint(URI resourceId) {
   DataObjectType doType = TypeMap.getDoType(Task.class);
   return new AlternateIdConstraintImpl(
       doType.getColumnField("resource"), resourceId.toString());
 }
コード例 #10
0
 public static AlternateIdConstraint getDecommissionedResourceNativeGuidConstraint(
     String resourceId) {
   DataObjectType doType = TypeMap.getDoType(DecommissionedResource.class);
   return new AlternateIdConstraintImpl(doType.getColumnField(NATIVE_GUID), resourceId);
 }
コード例 #11
0
 public static AlternateIdConstraint getRequestedTokenMapTokenIdConstraint(String tokenId) {
   DataObjectType doType = TypeMap.getDoType(RequestedTokenMap.class);
   return new AlternateIdConstraintImpl(doType.getColumnField("tokenId"), tokenId);
 }
コード例 #12
0
 public static AlternateIdConstraint getProxyTokenUserNameConstraint(String userName) {
   DataObjectType doType = TypeMap.getDoType(ProxyToken.class);
   return new AlternateIdConstraintImpl(doType.getColumnField("username"), userName);
 }
コード例 #13
0
 public static AlternateIdConstraint getRPSiteArrayByStorageSystemConstraint(
     String storageDevice) {
   DataObjectType doType = TypeMap.getDoType(RPSiteArray.class);
   return new AlternateIdConstraintImpl(doType.getColumnField("storageSystem"), storageDevice);
 }
コード例 #14
0
 public static AlternateIdConstraint getRPSiteArrayProtectionSystemConstraint(
     String protectionSystemId) {
   DataObjectType doType = TypeMap.getDoType(RPSiteArray.class);
   return new AlternateIdConstraintImpl(
       doType.getColumnField("rpProtectionSystem"), protectionSystemId);
 }
コード例 #15
0
 public static AlternateIdConstraint getRAGroupByNativeGuidConstraint(String nativeGuid) {
   DataObjectType doType = TypeMap.getDoType(RemoteDirectorGroup.class);
   return new AlternateIdConstraintImpl(doType.getColumnField(NATIVE_GUID), nativeGuid);
 }
コード例 #16
0
 public static AlternateIdConstraint getVolumeNativeIdConstraint(String altId) {
   DataObjectType doType = TypeMap.getDoType(Volume.class);
   return new AlternateIdConstraintImpl(doType.getColumnField("nativeId"), altId);
 }
コード例 #17
0
 public static AlternateIdConstraint getCustomConfigByConfigType(String configType) {
   DataObjectType doType = TypeMap.getDoType(CustomConfig.class);
   return new AlternateIdConstraintImpl(doType.getColumnField("configType"), configType);
 }
コード例 #18
0
 public static AlternateIdConstraint getConstraint(
     Class<? extends DataObject> type, String columnField, String queryCond) {
   DataObjectType doType = TypeMap.getDoType(type);
   return new AlternateIdConstraintImpl(doType.getColumnField(columnField), queryCond);
 }
コード例 #19
0
 public static AlternateIdConstraint getSnapshotExportRuleConstraint(String snapExportIndex) {
   DataObjectType doType = TypeMap.getDoType(FileExportRule.class);
   return new AlternateIdConstraintImpl(
       doType.getColumnField("snapshotExportIndex"), snapExportIndex);
 }
コード例 #20
0
 public static AlternateIdConstraint getExportMaskByNameConstraint(String maskName) {
   DataObjectType doType = TypeMap.getDoType(ExportMask.class);
   return new AlternateIdConstraintImpl(doType.getColumnField("maskName"), maskName);
 }
コード例 #21
0
 public static AlternateIdConstraint getWorkflowByOrchTaskId(String orchTaskId) {
   DataObjectType doType = TypeMap.getDoType(Workflow.class);
   return new AlternateIdConstraintImpl(doType.getColumnField("orchTaskId"), orchTaskId);
 }
コード例 #22
0
 public static AlternateIdConstraint getBlockConsistencyGroupByAlternateNameConstraint(
     String alternateName) {
   DataObjectType doType = TypeMap.getDoType(BlockConsistencyGroup.class);
   return new AlternateIdConstraintImpl(doType.getColumnField("alternateLabel"), alternateName);
 }
コード例 #23
0
 public static AlternateIdConstraint getSnapshotShareACLConstraint(
     String snapshotShareACLIndex) {
   DataObjectType doType = TypeMap.getDoType(CifsShareACL.class);
   return new AlternateIdConstraintImpl(
       doType.getColumnField("snapshotShareACLIndex"), snapshotShareACLIndex);
 }
コード例 #24
0
 public static AlternateIdConstraint getVirtualDataCenterByShortIdConstraint(String vdcShortId) {
   DataObjectType doType = TypeMap.getDoType(VirtualDataCenter.class);
   return new AlternateIdConstraintImpl(doType.getColumnField("shortId"), vdcShortId);
 }
コード例 #25
0
 public static AlternateIdConstraint getUnManagedExportMaskPathConstraint(String altId) {
   DataObjectType doType = TypeMap.getDoType(UnManagedExportMask.class);
   return new AlternateIdConstraintImpl(doType.getColumnField("maskingViewPath"), altId);
 }
コード例 #26
0
 public static AlternateIdConstraint getVirtualPoolByMirrorVpool(String mirrorVpool) {
   DataObjectType doType = TypeMap.getDoType(VirtualPool.class);
   return new AlternateIdConstraintImpl(doType.getColumnField("mirrorVirtualPool"), mirrorVpool);
 }
コード例 #27
0
 public static AlternateIdConstraint getFileSystemInfoNativeGUIdConstraint(String altId) {
   DataObjectType doType = TypeMap.getDoType(UnManagedFileSystem.class);
   return new AlternateIdConstraintImpl(doType.getColumnField(NATIVE_GUID), altId);
 }
コード例 #28
0
 /**
  * Deprecated - Needed only for 2.1 migration callback.
  *
  * @param cg
  * @return
  */
 @Deprecated
 public static AlternateIdConstraint getBlockSnapshotByConsistencyGroup(String cg) {
   DataObjectType doType = TypeMap.getDoType(BlockSnapshot.class);
   return new AlternateIdConstraintImpl(doType.getColumnField("consistencyGroups"), cg);
 }
コード例 #29
0
 public static AlternateIdConstraint getStorageDeviceSmisIpConstraint(String altId) {
   DataObjectType doType = TypeMap.getDoType(StorageSystem.class);
   return new AlternateIdConstraintImpl(doType.getColumnField("smisProviderIP"), altId);
 }
コード例 #30
0
 public static AlternateIdConstraint getTasksByRequestIdConstraint(String requestId) {
   DataObjectType doType = TypeMap.getDoType(Task.class);
   return new AlternateIdConstraintImpl(doType.getColumnField("requestId"), requestId);
 }