/** * 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(); }
/** * 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); }
/** * 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; }
public static AlternateIdConstraint getBlockSnapshotWwnConstraint(String wwn) { DataObjectType doType = TypeMap.getDoType(BlockSnapshot.class); return new AlternateIdConstraintImpl(doType.getColumnField("wwn"), wwn); }
public static AlternateIdConstraint getUnManagedVolumeInitiatorNetworkIdConstraint( String altId) { DataObjectType doType = TypeMap.getDoType(UnManagedVolume.class); return new AlternateIdConstraintImpl(doType.getColumnField("initiatorNetworkIds"), altId); }
public static AlternateIdConstraint getFileSystemShareACLConstraint( String fileSystemShareACLIndex) { DataObjectType doType = TypeMap.getDoType(CifsShareACL.class); return new AlternateIdConstraintImpl( doType.getColumnField("fileSystemShareACLIndex"), fileSystemShareACLIndex); }
public static AlternateIdConstraint getRpSourceVolumeByTarget(String targetVolumeId) { DataObjectType doType = TypeMap.getDoType(Volume.class); return new AlternateIdConstraintImpl(doType.getColumnField("rpTargets"), targetVolumeId); }
public static AlternateIdConstraint getVolumesByAssociatedId(String volumeId) { DataObjectType doType = TypeMap.getDoType(Volume.class); return new AlternateIdConstraintImpl(doType.getColumnField("associatedVolumes"), volumeId); }
public static AlternateIdConstraint getTasksByResourceConstraint(URI resourceId) { DataObjectType doType = TypeMap.getDoType(Task.class); return new AlternateIdConstraintImpl( doType.getColumnField("resource"), resourceId.toString()); }
public static AlternateIdConstraint getDecommissionedResourceNativeGuidConstraint( String resourceId) { DataObjectType doType = TypeMap.getDoType(DecommissionedResource.class); return new AlternateIdConstraintImpl(doType.getColumnField(NATIVE_GUID), resourceId); }
public static AlternateIdConstraint getRequestedTokenMapTokenIdConstraint(String tokenId) { DataObjectType doType = TypeMap.getDoType(RequestedTokenMap.class); return new AlternateIdConstraintImpl(doType.getColumnField("tokenId"), tokenId); }
public static AlternateIdConstraint getProxyTokenUserNameConstraint(String userName) { DataObjectType doType = TypeMap.getDoType(ProxyToken.class); return new AlternateIdConstraintImpl(doType.getColumnField("username"), userName); }
public static AlternateIdConstraint getRPSiteArrayByStorageSystemConstraint( String storageDevice) { DataObjectType doType = TypeMap.getDoType(RPSiteArray.class); return new AlternateIdConstraintImpl(doType.getColumnField("storageSystem"), storageDevice); }
public static AlternateIdConstraint getRPSiteArrayProtectionSystemConstraint( String protectionSystemId) { DataObjectType doType = TypeMap.getDoType(RPSiteArray.class); return new AlternateIdConstraintImpl( doType.getColumnField("rpProtectionSystem"), protectionSystemId); }
public static AlternateIdConstraint getRAGroupByNativeGuidConstraint(String nativeGuid) { DataObjectType doType = TypeMap.getDoType(RemoteDirectorGroup.class); return new AlternateIdConstraintImpl(doType.getColumnField(NATIVE_GUID), nativeGuid); }
public static AlternateIdConstraint getVolumeNativeIdConstraint(String altId) { DataObjectType doType = TypeMap.getDoType(Volume.class); return new AlternateIdConstraintImpl(doType.getColumnField("nativeId"), altId); }
public static AlternateIdConstraint getCustomConfigByConfigType(String configType) { DataObjectType doType = TypeMap.getDoType(CustomConfig.class); return new AlternateIdConstraintImpl(doType.getColumnField("configType"), configType); }
public static AlternateIdConstraint getConstraint( Class<? extends DataObject> type, String columnField, String queryCond) { DataObjectType doType = TypeMap.getDoType(type); return new AlternateIdConstraintImpl(doType.getColumnField(columnField), queryCond); }
public static AlternateIdConstraint getSnapshotExportRuleConstraint(String snapExportIndex) { DataObjectType doType = TypeMap.getDoType(FileExportRule.class); return new AlternateIdConstraintImpl( doType.getColumnField("snapshotExportIndex"), snapExportIndex); }
public static AlternateIdConstraint getExportMaskByNameConstraint(String maskName) { DataObjectType doType = TypeMap.getDoType(ExportMask.class); return new AlternateIdConstraintImpl(doType.getColumnField("maskName"), maskName); }
public static AlternateIdConstraint getWorkflowByOrchTaskId(String orchTaskId) { DataObjectType doType = TypeMap.getDoType(Workflow.class); return new AlternateIdConstraintImpl(doType.getColumnField("orchTaskId"), orchTaskId); }
public static AlternateIdConstraint getBlockConsistencyGroupByAlternateNameConstraint( String alternateName) { DataObjectType doType = TypeMap.getDoType(BlockConsistencyGroup.class); return new AlternateIdConstraintImpl(doType.getColumnField("alternateLabel"), alternateName); }
public static AlternateIdConstraint getSnapshotShareACLConstraint( String snapshotShareACLIndex) { DataObjectType doType = TypeMap.getDoType(CifsShareACL.class); return new AlternateIdConstraintImpl( doType.getColumnField("snapshotShareACLIndex"), snapshotShareACLIndex); }
public static AlternateIdConstraint getVirtualDataCenterByShortIdConstraint(String vdcShortId) { DataObjectType doType = TypeMap.getDoType(VirtualDataCenter.class); return new AlternateIdConstraintImpl(doType.getColumnField("shortId"), vdcShortId); }
public static AlternateIdConstraint getUnManagedExportMaskPathConstraint(String altId) { DataObjectType doType = TypeMap.getDoType(UnManagedExportMask.class); return new AlternateIdConstraintImpl(doType.getColumnField("maskingViewPath"), altId); }
public static AlternateIdConstraint getVirtualPoolByMirrorVpool(String mirrorVpool) { DataObjectType doType = TypeMap.getDoType(VirtualPool.class); return new AlternateIdConstraintImpl(doType.getColumnField("mirrorVirtualPool"), mirrorVpool); }
public static AlternateIdConstraint getFileSystemInfoNativeGUIdConstraint(String altId) { DataObjectType doType = TypeMap.getDoType(UnManagedFileSystem.class); return new AlternateIdConstraintImpl(doType.getColumnField(NATIVE_GUID), altId); }
/** * 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); }
public static AlternateIdConstraint getStorageDeviceSmisIpConstraint(String altId) { DataObjectType doType = TypeMap.getDoType(StorageSystem.class); return new AlternateIdConstraintImpl(doType.getColumnField("smisProviderIP"), altId); }
public static AlternateIdConstraint getTasksByRequestIdConstraint(String requestId) { DataObjectType doType = TypeMap.getDoType(Task.class); return new AlternateIdConstraintImpl(doType.getColumnField("requestId"), requestId); }