From a5069fc9e182699c448d68ac1587810ba73ca03b Mon Sep 17 00:00:00 2001 From: fedoreno <fedoreno> Date: Wed, 27 Apr 2016 13:58:55 +0000 Subject: [PATCH] SSDM-3511: reformatted SVN: 36340 --- .../server/ServiceForDataStoreServer.java | 3387 +++++++++++++++++ .../ServiceForDataStoreServerLogger.java | 2 +- .../generic/server/TrackingServerLogger.java | 5 +- .../generic/server/TrackingServiceServer.java | 5 +- .../TrustedCrossOriginDomainsProvider.java | 4 +- .../WhiteListBasedRemoteHostValidator.java | 8 +- ...entToDataSetRelatedEntitiesTranslator.java | 6 +- .../v1/GeneralInformationChangingService.java | 13 +- ...lInformationChangingServiceJsonServer.java | 8 +- ...neralInformationChangingServiceLogger.java | 2 +- .../api/v1/GeneralInformationService.java | 45 +- .../GeneralInformationServiceJsonServer.java | 7 +- .../v1/GeneralInformationServiceServer.java | 11 +- ...pleToDataSetRelatedEntitiesTranslator.java | 6 +- .../v1/WebInformationServiceJsonServer.java | 7 +- .../authorization/ActiveAuthorization.java | 3 +- .../server/authorization/Argument.java | 3 +- .../server/authorization/CapabilityMap.java | 8 +- .../DefaultAccessController.java | 16 +- .../authorization/IAccessController.java | 11 +- .../authorization/IReturnValueFilter.java | 7 +- .../server/authorization/NoAuthorization.java | 3 +- .../authorization/NoReturnValueFilter.java | 3 +- .../server/authorization/SpaceOwnerKind.java | 3 +- .../annotation/AuthorizationGuard.java | 4 +- .../annotation/RolesAllowed.java | 4 +- .../predicate/AbstractPredicate.java | 12 +- .../predicate/AbstractProjectPredicate.java | 3 +- .../predicate/AbstractTechIdPredicate.java | 3 +- .../predicate/AtomicOperationsPredicate.java | 3 +- .../DataSetUpdatesCollectionPredicate.java | 5 +- .../predicate/DataSetUpdatesPredicate.java | 8 +- .../DelegatedNullableAbstractPredicate.java | 4 +- .../predicate/DelegatedPredicate.java | 8 +- .../ExistingSpaceIdentifierPredicate.java | 1 - .../predicate/ExperimentUpdatesPredicate.java | 5 +- .../authorization/predicate/IPredicate.java | 4 +- .../ListSamplesByPropertyPredicate.java | 8 +- .../NewDataSetsWithTypePredicate.java | 3 +- .../NullableGroupIdentifierPredicate.java | 3 +- .../predicate/RevertDeletionPredicate.java | 3 +- .../predicate/SamplePredicate.java | 5 +- .../predicate/SampleTechIdPredicate.java | 3 +- .../SampleUpdatesCollectionPredicate.java | 3 +- .../predicate/SampleUpdatesPredicate.java | 5 +- .../validator/AbstractValidator.java | 3 +- .../authorization/validator/IValidator.java | 7 +- .../validator/ProjectValidator.java | 2 +- .../SearchDomainSearchResultValidator.java | 2 + .../batch/AbstractBatchOperationDelegate.java | 3 +- .../server/batch/BatchOperationExecutor.java | 14 +- .../generic/server/batch/SampleUpdate.java | 9 +- .../business/DataStoreServiceFactory.java | 7 +- .../business/IDataStoreServiceFactory.java | 5 +- .../business/IEntityOperationChecker.java | 10 +- .../server/business/IRelationshipService.java | 92 +- .../PropertiesBatchEvaluationErrors.java | 4 +- .../bo/AbstractMaterialBusinessObject.java | 12 +- .../bo/AbstractSampleBusinessObject.java | 6 +- ...bstractSampleIdentifierBusinessObject.java | 8 +- .../server/business/bo/AttachmentBO.java | 4 +- .../business/bo/AuthorizationGroupBO.java | 10 +- .../server/business/bo/CorePluginTable.java | 4 +- .../bo/DataAccessExceptionTranslator.java | 25 +- .../server/business/bo/DataSetTable.java | 4 +- .../server/business/bo/DeletionTable.java | 4 +- .../business/bo/EntityCodeGenerator.java | 14 +- .../server/business/bo/EntityTypeBO.java | 4 +- .../business/bo/EntityTypePropertyTypeBO.java | 8 +- .../server/business/bo/ExperimentBO.java | 10 +- .../server/business/bo/ExperimentTable.java | 8 +- .../business/bo/GridCustomColumnBO.java | 4 +- .../business/bo/GridCustomFilterBO.java | 4 +- .../server/business/bo/IAttachmentBO.java | 7 +- .../business/bo/IAuthorizationGroupBO.java | 14 +- .../server/business/bo/IBusinessObject.java | 5 +- .../bo/ICommonBusinessObjectFactory.java | 5 +- .../server/business/bo/ICorePluginTable.java | 3 +- .../server/business/bo/IEntityTypeBO.java | 3 +- .../bo/IEntityTypePropertyTypeBO.java | 3 +- .../business/bo/IExternalDataTable.java | 18 +- .../bo/IGridCustomFilterOrColumnBO.java | 5 +- .../server/business/bo/IPropertyTypeBO.java | 4 +- .../server/business/bo/ISampleTable.java | 15 +- .../business/bo/ISearchDomainSearcher.java | 1 - .../generic/server/business/bo/ISpaceBO.java | 8 +- .../server/business/bo/MaterialBO.java | 4 +- .../server/business/bo/MaterialTable.java | 10 +- .../server/business/bo/MetaprojectBO.java | 4 +- ...tExceptionFallbackExceptionTranslator.java | 3 +- .../generic/server/business/bo/ProjectBO.java | 6 +- .../server/business/bo/PropertyTypeBO.java | 4 +- .../server/business/bo/PropertyTypeTable.java | 4 +- .../business/bo/RootEntitiesFinder.java | 4 +- .../generic/server/business/bo/SampleBO.java | 4 +- .../bo/SampleCodeGeneratorByType.java | 2 +- .../generic/server/business/bo/ScriptBO.java | 8 +- .../business/bo/SearchDomainSearcher.java | 22 +- .../generic/server/business/bo/TrashBO.java | 120 +- .../server/business/bo/VocabularyTermBO.java | 4 +- .../bo/common/AbstractBatchIterator.java | 10 +- .../server/business/bo/common/CodeRecord.java | 1 - .../bo/common/EntityPropertiesEnricher.java | 4 +- .../common/GenericEntityPropertyRecord.java | 1 - .../bo/common/IEntityPropertiesEnricher.java | 4 +- .../IEntityPropertiesHolderResolver.java | 2 +- .../bo/common/IPropertyListingQuery.java | 5 +- .../common/MaterialEntityPropertyRecord.java | 1 - .../ExperimentProjectSpaceCodeRecord.java | 5 +- .../entity/ISecondaryEntityListingQuery.java | 16 +- .../bo/common/entity/SecondaryEntityDAO.java | 4 +- .../bo/datasetlister/DatasetLister.java | 2 +- .../datasetlister/IDatasetListingQuery.java | 16 +- .../datasetlister/IDataSetLister.java | 9 +- .../samplelister/ISampleLister.java | 3 +- .../samplelister/ISampleListingQuery.java | 16 +- .../DataSetTypeWithoutExperimentChecker.java | 7 +- .../business/importer/DatabaseInstance.java | 1 - .../importer/DatabaseInstanceImporter.java | 2 +- .../coreplugin/JettyWebAppPluginInjector.java | 8 +- .../server/dataaccess/IAttachmentDAO.java | 2 +- .../dataaccess/IAuthorizationGroupDAO.java | 3 +- .../dataaccess/IDataSourceProvider.java | 6 +- .../server/dataaccess/IDataStoreDAO.java | 2 +- .../server/dataaccess/IDeletionDAO.java | 15 +- .../IDynamicPropertyEvaluationScheduler.java | 1 - ...cPropertyEvaluationSchedulerWithQueue.java | 17 +- .../IEntityPropertiesConverter.java | 16 +- .../dataaccess/IEntityPropertyTypeDAO.java | 14 +- .../generic/server/dataaccess/IEventDAO.java | 3 +- .../server/dataaccess/IFileFormatTypeDAO.java | 2 +- .../server/dataaccess/ILocatorTypeDAO.java | 2 +- .../server/dataaccess/IMetaprojectDAO.java | 6 +- .../server/dataaccess/IPropertyTypeDAO.java | 3 +- .../dataaccess/IPropertyValueValidator.java | 3 +- .../server/dataaccess/ISampleTypeDAO.java | 5 +- .../server/dataaccess/IVocabularyDAO.java | 12 +- .../server/dataaccess/IVocabularyTermDAO.java | 8 +- .../PlaceholderPropertyCreator.java | 9 +- .../server/dataaccess/PropertyValidator.java | 3 +- .../server/dataaccess/db/AbstractDAO.java | 12 +- ...bstractGenericEntityWithPropertiesDAO.java | 10 +- .../server/dataaccess/db/AttachmentDAO.java | 12 +- .../server/dataaccess/db/DAOFactory.java | 4 +- .../generic/server/dataaccess/db/DataDAO.java | 8 +- .../db/DatabaseAndIndexReplacer.java | 10 +- .../db/DynamicPropertiesInterceptor.java | 3 +- .../server/dataaccess/db/ExperimentDAO.java | 2 +- .../server/dataaccess/db/IPermIdDAO.java | 3 +- .../dataaccess/db/IndexCreationUtil.java | 5 +- .../server/dataaccess/db/MaterialDAO.java | 2 +- .../server/dataaccess/db/SampleDAO.java | 27 +- .../db/deletion/AttachmentEntry.java | 14 +- .../db/deletion/AttributeEntry.java | 4 +- .../db/deletion/EntityHistoryCreator.java | 61 +- .../db/deletion/EntityModification.java | 2 +- .../db/deletion/PropertyHistoryEntry.java | 6 +- .../db/deletion/RelationshipHistoryEntry.java | 6 +- .../dataaccess/db/search/CharacterHelper.java | 2 +- .../db/search/HibernateSearchContext.java | 3 +- .../search/IFullTextIndexUpdateScheduler.java | 5 +- .../db/search/IFullTextIndexUpdater.java | 5 +- .../db/search/IFullTextIndexer.java | 9 +- .../dataaccess/db/search/IndexMode.java | 8 +- .../db/search/IndexingQueryOptimizer.java | 7 +- .../db/search/LuceneQueryBuilder.java | 4 +- .../PackageBasedIndexedEntityFinder.java | 6 +- .../search/detailed/DetailedQueryBuilder.java | 21 +- .../search/detailed/IndexFieldNameHelper.java | 2 +- .../DynamicPropertyEvaluator.java | 26 +- .../IBatchDynamicPropertyEvaluator.java | 10 +- .../calculator/DynamicPropertyAdaptor.java | 3 +- .../calculator/DynamicPropertyFunctions.java | 9 +- .../ISampleAdaptorRelationsQuery.java | 4 +- .../calculator/XmlPropertyAdaptor.java | 3 +- .../calculator/api/ISampleAdaptor.java | 12 +- .../AbstractEntityValidator.java | 3 +- .../api/IEntityValidator.java | 6 +- .../migration/MigrationStepFrom022To023.java | 6 +- .../migration/MigrationStepFrom023To024.java | 5 +- .../migration/MigrationStepFrom025To026.java | 3 +- .../migration/MigrationStepFrom046To047.java | 4 +- .../server/dataaccess/util/UpdateUtils.java | 8 +- .../server/jython/api/v1/IDataSetType.java | 3 +- .../server/jython/api/v1/IEntityType.java | 1 - .../IMasterDataRegistrationTransaction.java | 58 +- .../jython/api/v1/IPropertyAssignment.java | 7 +- .../api/v1/IPropertyAssignmentImmutable.java | 3 +- .../server/jython/api/v1/IPropertyType.java | 12 +- .../jython/api/v1/IPropertyTypeImmutable.java | 8 +- .../server/jython/api/v1/IVocabulary.java | 3 +- .../jython/api/v1/IVocabularyImmutable.java | 3 +- .../ExternalDataManagementSystemWrapper.java | 3 +- ...ataRegistrationScriptRunnerStandalone.java | 3 +- .../v1/impl/PropertyAssignmentWrapper.java | 3 +- .../server/jython/api/v1/impl/Script.java | 2 +- .../server/plugin/AbstractPluginRegistry.java | 3 +- .../plugin/DataSetServerPluginRegistry.java | 1 - .../server/plugin/IDataSetServerPlugin.java | 2 +- .../plugin/IDataSetTypeSlaveServerPlugin.java | 7 +- .../plugin/ISampleTypeSlaveServerPlugin.java | 4 +- .../generic/server/plugin/IServerPlugin.java | 7 +- .../plugin/IServerPluginWithWildcards.java | 6 +- .../plugin/SampleServerPluginRegistry.java | 3 +- .../plugin/WildcardSupportingPluginMap.java | 3 +- ...SampleRegistrationTempCodeUpdaterTask.java | 8 +- .../task/DataSetRegistrationSummaryTask.java | 13 +- .../task/MaterialExternalDBSyncTask.java | 4 +- .../task/RevokeUserAccessMaintenanceTask.java | 243 +- .../server/util/LifeCycleListener.java | 3 +- .../server/util/MethodInvocationUtils.java | 8 +- .../generic/shared/AbstractServerLogger.java | 2 +- .../DatabaseCreateOrDeleteModification.java | 4 +- .../shared/DatabaseUpdateModification.java | 4 +- .../openbis/generic/shared/ICommonServer.java | 4 +- .../generic/shared/IDataStoreService.java | 4 +- .../generic/shared/IRemoteHostValidator.java | 2 +- .../shared/IServiceForDataStoreServer.java | 2 +- .../generic/shared/ISessionProvider.java | 2 +- .../openbis/generic/shared/ResourceNames.java | 5 +- .../generic/shared/api/v1/Translator.java | 3 +- .../generic/shared/basic/CodeConverter.java | 12 +- .../generic/shared/basic/CodeNormalizer.java | 4 +- .../shared/basic/DataSetUploadInfo.java | 2 - .../EntityVisitComparatorByTimeStamp.java | 2 +- .../generic/shared/basic/ExpressionUtil.java | 5 +- .../shared/basic/GenericSharedConstants.java | 2 +- .../generic/shared/basic/GridRowModel.java | 3 +- .../shared/basic/IColumnDefinition.java | 3 +- ...EntityInformationHolderWithIdentifier.java | 3 +- .../IEntityInformationHolderWithPermId.java | 3 +- ...EntityInformationHolderWithProperties.java | 3 +- ...anagedPropertyGridInformationProvider.java | 3 +- .../shared/basic/MaterialCodeConverter.java | 3 +- .../generic/shared/basic/MetaprojectName.java | 3 +- .../shared/basic/PermlinkUtilities.java | 2 +- .../generic/shared/basic/PrimitiveValue.java | 8 +- .../shared/basic/SimpleImageHtmlRenderer.java | 1 - .../generic/shared/basic/TableCellUtil.java | 9 +- .../shared/basic/URLMethodWithParameters.java | 5 +- .../shared/basic/ValidationUtilities.java | 2 +- .../generic/shared/basic/ViewMode.java | 5 +- .../shared/basic/WildcardSupportingMap.java | 6 +- .../shared/basic/annotation/DoNotEscape.java | 6 +- .../basic/dto/AbstractEntityProperty.java | 7 +- .../basic/dto/AbstractExternalData.java | 6 +- .../basic/dto/AssociatedEntityKind.java | 5 +- .../basic/dto/AttachmentWithContent.java | 8 +- .../basic/dto/BasicProjectIdentifier.java | 3 +- .../basic/dto/BatchRegistrationResult.java | 4 +- .../shared/basic/dto/CodeAndLabel.java | 5 +- .../shared/basic/dto/ColumnSetting.java | 5 +- .../shared/basic/dto/ContainerDataSet.java | 4 +- .../shared/basic/dto/DateTableCell.java | 9 +- .../generic/shared/basic/dto/Deletion.java | 3 +- .../basic/dto/DetailedSearchCriterion.java | 6 +- .../shared/basic/dto/DetailedSearchField.java | 3 +- .../shared/basic/dto/DoubleTableCell.java | 10 +- .../shared/basic/dto/EntityReference.java | 3 +- .../generic/shared/basic/dto/EntityType.java | 2 +- .../basic/dto/EntityTypePropertyType.java | 19 +- .../generic/shared/basic/dto/EntityVisit.java | 3 +- .../shared/basic/dto/ExperimentType.java | 2 +- .../shared/basic/dto/FileFormatType.java | 1 - .../basic/dto/GenericEntityProperty.java | 4 +- .../basic/dto/IDatasetLocationNode.java | 3 +- .../shared/basic/dto/IEntityProperty.java | 4 +- .../shared/basic/dto/IExpressionUpdates.java | 3 +- .../shared/basic/dto/IPropertiesBean.java | 3 +- .../basic/dto/ISerializableComparable.java | 4 +- .../shared/basic/dto/ImageTableCell.java | 24 +- .../basic/dto/LastModificationState.java | 34 +- .../generic/shared/basic/dto/LinkDataSet.java | 4 +- .../generic/shared/basic/dto/LinkModel.java | 12 +- .../basic/dto/ListMaterialCriteria.java | 7 +- .../basic/dto/ListOrSearchSampleCriteria.java | 4 +- .../dto/ManagedHtmlWidgetDescription.java | 5 +- .../basic/dto/ManagedUiActionDescription.java | 3 +- .../dto/ManagedUiTableActionDescription.java | 4 +- .../dto/MaterialAttributeSearchFieldKind.java | 2 +- .../basic/dto/MaterialEntityProperty.java | 3 +- .../shared/basic/dto/MaterialIdentifier.java | 12 +- .../shared/basic/dto/NewColumnOrFilter.java | 3 +- .../shared/basic/dto/NewPTNewAssigment.java | 11 +- .../generic/shared/basic/dto/NewSample.java | 10 +- .../basic/dto/PortletConfiguration.java | 4 +- .../shared/basic/dto/PropertyType.java | 4 +- .../shared/basic/dto/RelationshipType.java | 4 +- .../shared/basic/dto/ReportingPluginType.java | 11 +- .../shared/basic/dto/RoleAssignment.java | 1 - .../shared/basic/dto/RoleWithHierarchy.java | 14 +- .../generic/shared/basic/dto/Sample.java | 7 +- .../dto/SampleAttributeSearchFieldKind.java | 2 +- .../basic/dto/SampleParentWithDerived.java | 3 +- .../basic/dto/SampleTypePropertyType.java | 1 - ...earchDomainSearchResultWithFullEntity.java | 2 +- .../SearchFieldBooleanCriterionFactory.java | 3 +- .../dto/SearchFieldDateCriterionFactory.java | 3 +- .../SerializableComparableIDDecorator.java | 17 +- .../dto/SimpleAttributeSearchFieldKind.java | 3 +- .../basic/dto/StandardPortletNames.java | 6 +- .../basic/dto/TrackingDataSetCriteria.java | 8 +- .../basic/dto/TrackingSampleCriteria.java | 7 +- .../shared/basic/dto/TypedTableModel.java | 5 +- .../dto/VocabularyTermEntityProperty.java | 3 +- ...IManagedInputWidgetDescriptionFactory.java | 3 +- .../basic/dto/api/IManagedProperty.java | 9 +- .../basic/dto/api/IManagedUiAction.java | 9 +- .../basic/dto/api/IManagedUiDescription.java | 13 +- .../basic/dto/api/IManagedUiTableAction.java | 8 +- .../basic/dto/api/ValidationException.java | 1 - .../shared/coreplugin/CorePluginsUtils.java | 8 +- .../shared/coreplugin/IPluginType.java | 3 +- .../dto/AbstractRegistrationHolder.java | 5 +- .../generic/shared/dto/AttachmentPE.java | 4 +- .../generic/shared/dto/CorePluginPE.java | 4 +- .../openbis/generic/shared/dto/DataPE.java | 4 +- .../generic/shared/dto/DataSetPropertyPE.java | 2 +- .../shared/dto/DataSetRelationshipPE.java | 2 +- .../shared/dto/DataSetTypePropertyTypePE.java | 4 +- .../shared/dto/DataSetUploadContext.java | 6 +- .../shared/dto/DataSourceDefinition.java | 12 +- .../shared/dto/DataSourceWithDefinition.java | 2 +- .../shared/dto/DataStoreServerInfo.java | 6 +- .../generic/shared/dto/DataTypePE.java | 4 +- .../shared/dto/DeletedExternalDataPE.java | 5 +- .../EntityCollectionForCreationOrUpdate.java | 6 +- .../dto/EntityOperationsLogEntryPE.java | 6 +- .../shared/dto/EntityPropertyFiller.java | 4 +- .../generic/shared/dto/EntityPropertyPE.java | 52 +- .../shared/dto/ExperimentPropertyPE.java | 2 +- .../dto/ExperimentTypePropertyTypePE.java | 4 +- .../generic/shared/dto/ExternalDataPE.java | 2 +- .../generic/shared/dto/ExtractableData.java | 12 +- .../HibernateAbstractRegistrationHolder.java | 6 +- ...EntityInformationWithPropertiesHolder.java | 1 - .../generic/shared/dto/IIdAndCodeHolder.java | 3 +- .../generic/shared/dto/IMatchingEntity.java | 1 - .../shared/dto/IUntypedValueSetter.java | 2 +- .../generic/shared/dto/LimitFilter.java | 3 +- .../generic/shared/dto/LocatorTypePE.java | 4 +- .../generic/shared/dto/MaterialPE.java | 2 +- .../shared/dto/MaterialPropertyPE.java | 2 +- .../dto/MaterialTypePropertyTypePE.java | 4 +- .../generic/shared/dto/MetaprojectPE.java | 2 +- .../shared/dto/NewContainerDataSet.java | 3 +- .../generic/shared/dto/NewExternalData.java | 14 +- .../generic/shared/dto/NewLinkDataSet.java | 1 - .../shared/dto/NewProcessingInstruction.java | 2 +- .../generic/shared/dto/NewProperty.java | 1 - .../shared/dto/OpenBISSessionHolder.java | 3 +- .../shared/dto/ProcessingInstructionDTO.java | 2 +- .../shared/dto/ProcessingParameters.java | 5 +- .../generic/shared/dto/RoleAssignmentPE.java | 281 +- .../dto/SampleParentWithDerivedDTO.java | 3 +- .../generic/shared/dto/SamplePropertyPE.java | 4 +- .../shared/dto/SampleRelationshipPE.java | 2 +- .../generic/shared/dto/SampleSkeleton.java | 10 +- .../shared/dto/SampleTypePropertyTypePE.java | 4 +- .../generic/shared/dto/StorageFormat.java | 6 +- .../generic/shared/dto/TimeInterval.java | 2 +- .../generic/shared/dto/VocabularyTermPE.java | 4 +- .../dto/hibernate/InternalNamespace.java | 5 +- .../shared/dto/hibernate/Location.java | 2 +- .../dto/hibernate/SearchFieldConstants.java | 8 +- .../hibernate/SortableNumberBridgeUtils.java | 64 +- .../identifier/LocalExperimentIdentifier.java | 3 +- .../shared/dto/types/DataSetTypeCode.java | 3 +- .../shared/dto/types/ExperimentTypeCode.java | 3 +- .../SimpleTableModelBuilderAdaptor.java | 7 +- .../api/EntityLinkElementKind.java | 3 +- .../shared/managed_property/api/IElement.java | 14 +- .../managed_property/api/IElementFactory.java | 8 +- .../api/IEntityInformationProvider.java | 12 +- .../api/IRowBuilderAdaptor.java | 6 +- .../api/ISimpleTableModelBuilderAdaptor.java | 3 +- .../api/IStructuredPropertyConverter.java | 3 +- .../structured/ElementFactory.java | 4 +- .../XmlOrJsonStructuredPropertyConverter.java | 4 +- .../shared/parser/BisExcelFileLoader.java | 4 +- .../shared/parser/BisTabFileLoader.java | 4 +- .../shared/parser/GlobalProperties.java | 6 +- .../shared/parser/GlobalPropertiesLoader.java | 5 +- .../UpdatedSampleParserObjectFactory.java | 8 +- .../translator/DeletedEntityTranslator.java | 4 +- .../translator/PropertyTranslatorUtils.java | 3 +- .../generic/shared/util/CacheManager.java | 54 +- .../generic/shared/util/DataTypeUtils.java | 2 +- .../generic/shared/util/EntityHelper.java | 8 +- .../generic/shared/util/ICacheManager.java | 5 +- .../generic/shared/util/IColumnGroup.java | 32 +- .../generic/shared/util/IColumnMetaData.java | 3 +- .../shared/util/IDataSourceFactory.java | 4 +- .../cisd/openbis/generic/shared/util/Key.java | 6 +- .../util/MaterialConfigurationProvider.java | 3 +- .../shared/util/RelationshipUtils.java | 6 +- .../generic/shared/util/RuntimeCache.java | 21 +- .../util/RuntimeCacheEventListener.java | 2 +- .../generic/shared/util/ServerUtils.java | 3 +- .../generic/shared/util/SpaceCodeHelper.java | 17 +- .../openbis/generic/shared/util/UuidUtil.java | 4 +- .../shared/util/WebClientFilesUpdater.java | 6 +- .../openbis/generic/shared/util/XmlUtils.java | 2 +- .../AbstractPluginBusinessObjectFactory.java | 4 +- .../plugin/AbstractSampleServerPlugin.java | 10 +- .../client/web/client/IDemoClientService.java | 5 +- .../client/web/client/application/Dict.java | 3 +- .../application/module/StatisticsWidget.java | 2 +- .../web/server/DemoClientServiceServlet.java | 7 +- .../demo/server/DemoSampleServerPlugin.java | 3 +- .../plugin/demo/shared/IDemoServer.java | 4 +- .../plugin/demo/shared/ResourceNames.java | 5 +- .../application/DelegatedClientPlugin.java | 3 +- .../dataset/DataSetRelationshipBrowser.java | 4 +- .../dataset/GenericDataSetViewer.java | 2 +- ...ractGenericExperimentRegisterEditForm.java | 3 +- .../experiment/ExperimentPropertiesPanel.java | 20 +- .../experiment/PropertiesEditor.java | 3 +- .../material/GenericMaterialViewer.java | 21 +- .../sample/EntityConnectionTypeProvider.java | 3 +- .../sample/GenericSampleViewer.java | 22 +- .../web/server/GenericClientService.java | 4 +- .../server/GenericClientServiceServlet.java | 7 +- .../UpdatedDataSetParserObjectFactory.java | 8 +- .../server/AbstractGenericServerPlugin.java | 4 +- .../server/GenericDataSetServerPlugin.java | 2 +- .../plugin/generic/server/GenericServer.java | 34 +- .../generic/server/GenericServerLogger.java | 2 +- .../generic/server/GenericServiceServer.java | 5 +- .../shared/IGenericServerInternal.java | 2 - .../plugin/generic/shared/ResourceNames.java | 5 +- .../query/client/api/v1/IQueryApiFacade.java | 16 +- .../web/client/IQueryClientService.java | 5 +- .../web/client/IQueryClientServiceAsync.java | 3 +- .../client/web/client/application/Dict.java | 3 +- .../module/QueryDatabaseSelectionWidget.java | 2 +- .../client/dto/QueryBrowserGridColumnIDs.java | 8 + .../web/server/QueryClientServiceServlet.java | 7 +- .../cisd/openbis/plugin/query/server/DAO.java | 5 +- .../server/api/v1/QueryServiceJsonServer.java | 7 +- .../query/server/api/v1/ResourceNames.java | 2 - .../resultfilter/QueryResultFilter.java | 6 +- .../IQueryDatabaseDefinitionProvider.java | 3 +- .../plugin/query/shared/ResourceNames.java | 5 +- .../query/shared/api/v1/IQueryApiServer.java | 19 +- .../shared/api/v1/dto/QueryDescription.java | 7 +- .../shared/api/v1/dto/QueryTableModel.java | 6 +- .../asapi/v3/cache/SearchCacheTest.java | 2 +- .../AbstractSearchMethodExecutorTest.java | 8 +- .../sample/FullSampleIdentifierTest.java | 28 +- .../asapi/v3/AbstractDataSetTest.java | 13 +- .../asapi/v3/CreateExperimentTest.java | 2 +- .../asapi/v3/CreateMaterialTest.java | 7 +- .../systemtest/asapi/v3/CreateSampleTest.java | 5 +- .../asapi/v3/EntityDeletionTest.java | 3 +- .../systemtest/asapi/v3/GetSampleTest.java | 10 +- .../asapi/v3/ProjectSampleTest.java | 1572 ++------ .../asapi/v3/SearchDataSetTypeTest.java | 24 +- .../asapi/v3/SearchExperimentTypeTest.java | 20 +- .../asapi/v3/SearchMaterialTypeTest.java | 20 +- .../systemtest/asapi/v3/SearchSampleTest.java | 12 +- .../asapi/v3/SearchSampleTypeTest.java | 24 +- .../asapi/v3/SearchServiceTest.java | 20 +- .../asapi/v3/UpdateExperimentTest.java | 49 +- .../openbis/systemtest/deletion/Change.java | 4 +- .../deletion/DataSetDeletionTest.java | 4 +- .../systemtest/deletion/DeletionTest.java | 101 +- .../deletion/ExperimentDeletionTest.java | 18 +- .../deletion/ProjectDeletionTest.java | 22 +- .../deletion/SampleDeletionTest.java | 33 +- .../openbis/generic/OpenbisClientTest.java | 5 +- .../generic/client/console/LexerTest.java | 4 +- .../application/DummyAuthenticationTest.java | 6 +- .../web/client/application/SearchCommand.java | 3 +- .../VocabularyRegistrationTest.java | 2 +- .../application/locator/OpenViewCommand.java | 4 +- .../application/ui/InvokeActionMenu.java | 3 +- .../ui/amc/CheckAuthorizationGroupTable.java | 3 +- .../application/ui/amc/CheckPersonTable.java | 3 +- .../ui/amc/CheckRoleAssignmentTable.java | 3 +- .../ui/amc/OpenAddPersonDialog.java | 3 +- .../application/ui/amc/RemovePerson.java | 3 +- .../ui/amc/ShowAuthorizationGroup.java | 3 +- .../application/ui/data/ShowDataSet.java | 5 +- .../ui/data/ShowDataSetEditor.java | 3 +- .../ui/experiment/CheckExperimentTable.java | 3 +- .../ui/experiment/ShowExperiment.java | 3 +- .../filter/OpenFilterSettingsCommand.java | 5 +- .../ui/material/CheckMaterialTable.java | 3 +- .../ui/project/CheckProjectTable.java | 3 +- .../project/FillProjectRegistrationForm.java | 3 +- .../CheckPropertyTypeAssignmentTable.java | 3 +- .../property_type/CheckPropertyTypeTable.java | 3 +- .../ui/sample/ExportSamplesTestCommand.java | 12 +- .../application/ui/sample/ShowSample.java | 3 +- .../application/ui/util/GridTestUtils.java | 9 +- .../AbstractDefaultTestCommand.java | 4 +- .../testframework/AbstractGWTTestCase.java | 10 +- .../testframework/AbstractProperty.java | 16 +- .../testframework/CheckTableCommand.java | 7 +- .../web/client/testframework/GWTTestUtil.java | 17 +- .../testframework/IMessageValidator.java | 2 - .../web/client/testframework/IProperty.java | 6 +- .../testframework/IPropertyChecker.java | 8 +- .../client/testframework/ITestCommand.java | 13 +- .../PropertyCheckingManager.java | 2 +- .../client/testframework/RemoteConsole.java | 18 +- .../web/client/testframework/TestUtil.java | 5 +- .../WaitForAllActiveCallbacksFinish.java | 4 +- .../client/testframework/WidgetPicker.java | 6 +- .../clientnonjs/HelpPageIdentifierTest.java | 18 +- .../web/clientnonjs/URLListEncoderTest.java | 10 +- .../ViewLocatorResolverRegistryTest.java | 6 +- .../web/server/CommonClientServiceTest.java | 4 +- .../WebClientConfigurationProviderTest.java | 15 +- .../client/web/server/calculator/RowTest.java | 29 +- .../server/resultset/ScriptProviderTest.java | 2 +- .../web/server/util/FilterUtilsTest.java | 5 +- .../web/server/util/TSVRendererTest.java | 22 +- .../util/XMLPropertyTransformerTest.java | 2 +- .../generic/server/CommonServerTest.java | 2 +- .../DataStoreServiceRegistratorTest.java | 8 +- .../DatabaseLastModificationAdvisorTest.java | 4 +- .../server/ETLServiceDatabaseTest.java | 2 +- .../server/JythonEvaluatorPoolTest.java | 36 +- .../server/ServerInterfaceRegressionTest.java | 2 +- .../DefaultAccessControllerTest.java | 53 +- .../predicate/CollectionPredicateTest.java | 18 +- .../validator/ExternalDataValidatorTest.java | 4 +- .../validator/GroupValidatorTest.java | 9 +- .../PropertiesBatchEvaluationErrorsTest.java | 1 - .../server/business/bo/DataBOTest.java | 12 +- .../server/business/bo/ExperimentBOTest.java | 3 +- .../business/bo/PropertyValidatorTest.java | 46 +- .../server/business/bo/SampleBOTest.java | 1 - .../business/bo/SearchDomainSearcherTest.java | 18 +- .../server/business/bo/TrashBOTest.java | 164 +- .../common/EntityPropertiesEnricherTest.java | 6 +- .../SecondaryEntityListingQueryTest.java | 6 +- .../DatasetListingQueryTest.java | 16 +- .../business/bo/entitygraph/DataSetNode.java | 23 +- .../bo/entitygraph/EntityGraphGenerator.java | 82 +- .../business/bo/entitygraph/EntityNode.java | 10 +- .../bo/entitygraph/ExperimentNode.java | 12 +- .../business/bo/entitygraph/SampleNode.java | 25 +- .../server/business/bo/entitygraph/Utils.java | 8 +- .../samplelister/SampleListerTest.java | 10 +- .../SampleSetListingQueryTest.java | 4 +- .../dataaccess/db/AttachmentDAOTest.java | 2 +- .../db/AuthorizationGroupDAOTest.java | 2 +- .../dataaccess/db/CorePluginDAOTest.java | 2 +- .../server/dataaccess/db/DataDAOTest.java | 6 +- .../dataaccess/db/DatabaseCreationUtil.java | 9 +- .../server/dataaccess/db/DeletionDAOTest.java | 2 +- .../db/EntityOperationsLogDAOTest.java | 2 +- .../db/EntityPropertyTypeDAOTest.java | 18 +- .../db/EntityResolverQueryTest.java | 2 +- .../server/dataaccess/db/EventDAOTest.java | 2 +- .../db/GridCustomColumnDAOTest.java | 2 +- .../db/GridCustomFilterDAOTest.java | 2 +- .../dataaccess/db/MetaprojectDAOTest.java | 2 +- .../server/dataaccess/db/PermIdDAOTest.java | 2 +- .../dataaccess/db/SqlDataMigrationTest.java | 2 +- .../dataaccess/db/SqlMigrationTest.java | 2 +- .../db/search/LuceneQueryBuilderTest.java | 4 +- .../DataSetRegistrationSummaryTaskTest.java | 2 +- .../task/MaterialExternalDBSyncTaskTest.java | 2 +- .../util/AnnotationAppliedTestCase.java | 27 +- .../server/util/SimpleDateRendererTest.java | 12 +- .../server/util/TimeIntervalChecker.java | 13 +- .../generic/shared/DataSetInfoHelperTest.java | 4 +- .../openbis/generic/shared/INormalizer.java | 2 - .../shared/ServletParamsParsingTestUtils.java | 2 +- .../generic/shared/api/v1/TranslatorTest.java | 28 +- .../shared/api/v1/dto/DataSetBuilder.java | 14 +- .../shared/api/v1/dto/DataSetTest.java | 2 +- .../shared/api/v1/dto/DataSetTypeTest.java | 2 +- .../shared/api/v1/dto/SampleBuilder.java | 20 +- .../generic/shared/api/v1/dto/SampleTest.java | 2 +- .../PropertiesBasedDataSetFilterTest.java | 8 +- .../v1/filter/TypeBasedDataSetFilterTest.java | 2 - .../shared/basic/BasicURLEncoderTest.java | 4 +- .../shared/basic/ExpressionUtilTest.java | 6 +- .../openbis/generic/shared/basic/Row.java | 4 +- .../shared/basic/WebAppsPropertiesTest.java | 6 +- .../shared/basic/dto/PrimitiveValueTest.java | 4 +- .../generic/shared/basic/dto/WebAppTest.java | 8 +- .../basic/dto/builders/DataStoreBuilder.java | 8 +- .../basic/dto/builders/PropertyBuilder.java | 3 +- .../shared/basic/utils/GroupByMapTest.java | 2 +- .../coreplugin/CorePluginsInjectorTest.java | 2 +- .../builders/AbstractEntityTypePEBuilder.java | 2 +- .../shared/dto/builders/SamplePEBuilder.java | 27 +- .../JythonManagedPropertyEvaluatorTest.java | 2 +- .../NewSampleParserObjectFactoryTest.java | 32 +- .../UpdatedSampleParserObjectFactoryTest.java | 28 +- .../generic/shared/util/CacheManagerTest.java | 58 +- .../generic/shared/util/EntityHelperTest.java | 2 +- .../application/dataset/CheckDataSet.java | 3 +- .../dataset/GenericDataSetViewerTest.java | 8 +- .../GenericExperimentRegistrationTest.java | 1 - .../GenericExperimentViewerTest.java | 5 +- .../sample/GenericSampleRegistrationTest.java | 3 +- .../sample/GenericSampleViewerTest.java | 2 +- .../client/application/sample/Property.java | 11 +- .../remoteapitest/RemoteApiTestCase.java | 5 +- .../AbstractDataSetAssignmentTestCase.java | 1 + .../AbstractEntityDeletionTestCase.java | 214 +- ...ssignDataSetToExperimentAndSampleTest.java | 2 +- ...oExperimentAndSampleViaDropBoxAPITest.java | 8 +- .../AssignExperimentToProjectTest.java | 2 +- .../systemtest/AssignProjectToSpaceTest.java | 2 +- .../AssignSampleToExperimentTest.java | 12 +- ...gnSampleToExperimentViaDropBoxAPITest.java | 12 +- .../systemtest/AssignSampleToSpaceTest.java | 4 +- .../systemtest/AttachmentUploadTest.java | 39 +- .../systemtest/AuthenticationSystemTest.java | 4 +- .../systemtest/EntityDeletionTest.java | 4 +- .../systemtest/EntityOperationTest.java | 12 +- .../openbis/systemtest/FilterSystemTest.java | 4 +- .../systemtest/RegisterDataSetTest.java | 68 +- .../openbis/systemtest/SystemTestCase.java | 2 +- .../systemtest/TypedTableAssertions.java | 15 +- .../UnassignSampleFromExperimentTest.java | 4 +- .../UnassignSampleFromSpaceTest.java | 8 +- .../systemtest/UpdateDataSetParentsTest.java | 8 +- .../openbis/systemtest/UpdateDataSetTest.java | 59 +- .../UpdateSampleContainmentTest.java | 12 +- .../systemtest/UpdateSampleParentsTest.java | 12 +- .../api/common/json/JsonApiClient.java | 40 +- .../api/v1/GeneralInformationServiceTest.java | 2 +- .../CommonServerAuthorizationTest.java | 4 +- .../ETLServiceAuthorizationTest.java | 4 +- .../authorization/PersonManagementTest.java | 1 + .../openbis/systemtest/base/BaseTest.java | 2 +- .../base/RelationshipServiceStub.java | 4 +- .../systemtest/base/builder/Builder.java | 2 +- .../base/builder/DataSetUpdateBuilder.java | 2 +- .../base/builder/ExternalDataBuilder.java | 12 +- .../base/builder/UpdateBuilder.java | 2 +- .../entitygraph/EntityGraphManager.java | 281 +- .../MultiThreadOptimisticLockingTestCase.java | 3 +- ...ltiThreadProjectOptimisticLockingTest.java | 8 +- ...ultiThreadSampleOptimisticLockingTest.java | 8 +- .../optimistic_locking/ToolBox.java | 10 +- .../plugin/generic/EntityValidationTest.java | 4 +- .../generic/FileFormatTypeHeadlessTest.java | 1 - .../plugin/query/QuerySystemTestCase.java | 5 +- ...ampleToSampleRelationshipsHistoryTest.java | 2 +- .../cisd/openbis/util/LogRecordingUtils.java | 11 +- 650 files changed, 6768 insertions(+), 4540 deletions(-) diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/ServiceForDataStoreServer.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/ServiceForDataStoreServer.java index e69de29bb2d..2b06d92ab77 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/ServiceForDataStoreServer.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/ServiceForDataStoreServer.java @@ -0,0 +1,3387 @@ +/* + * Copyright 2009 ETH Zuerich, CISD + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package ch.systemsx.cisd.openbis.generic.server; + +import java.util.ArrayList; +import java.util.Collection; +import java.util.Collections; +import java.util.Date; +import java.util.EnumSet; +import java.util.HashMap; +import java.util.HashSet; +import java.util.LinkedList; +import java.util.List; +import java.util.Map; +import java.util.Set; +import java.util.Stack; +import java.util.UUID; + +import javax.servlet.http.HttpServletRequest; + +import org.apache.commons.collections.CollectionUtils; +import org.springframework.beans.factory.annotation.Autowired; + +import ch.ethz.sis.openbis.generic.asapi.v3.dto.dataset.Complete; +import ch.ethz.sis.openbis.generic.asapi.v3.dto.dataset.create.DataSetCreation; +import ch.ethz.sis.openbis.generic.asapi.v3.dto.dataset.create.LinkedDataCreation; +import ch.ethz.sis.openbis.generic.asapi.v3.dto.dataset.create.PhysicalDataCreation; +import ch.ethz.sis.openbis.generic.asapi.v3.dto.dataset.id.DataSetPermId; +import ch.ethz.sis.openbis.generic.asapi.v3.dto.dataset.id.FileFormatTypePermId; +import ch.ethz.sis.openbis.generic.asapi.v3.dto.dataset.id.IDataSetId; +import ch.ethz.sis.openbis.generic.asapi.v3.dto.dataset.id.LocatorTypePermId; +import ch.ethz.sis.openbis.generic.asapi.v3.dto.dataset.id.StorageFormatPermId; +import ch.ethz.sis.openbis.generic.asapi.v3.dto.datastore.id.DataStorePermId; +import ch.ethz.sis.openbis.generic.asapi.v3.dto.entitytype.id.EntityTypePermId; +import ch.ethz.sis.openbis.generic.asapi.v3.dto.externaldms.id.ExternalDmsPermId; +import ch.ethz.sis.openbis.generic.asapi.v3.dto.sample.id.ISampleId; +import ch.ethz.sis.openbis.generic.asapi.v3.dto.sample.id.SamplePermId; +import ch.ethz.sis.openbis.generic.server.asapi.v3.context.IProgress; +import ch.ethz.sis.openbis.generic.server.asapi.v3.context.IProgressListener; +import ch.ethz.sis.openbis.generic.server.asapi.v3.executor.IOperationContext; +import ch.ethz.sis.openbis.generic.server.asapi.v3.executor.OperationContext; +import ch.ethz.sis.openbis.generic.server.asapi.v3.executor.dataset.ICreateDataSetExecutor; +import ch.ethz.sis.openbis.generic.server.asapi.v3.executor.sample.ListSampleTechIdByIdentifier; +import ch.rinn.restrictions.Private; +import ch.systemsx.cisd.authentication.DefaultSessionManager; +import ch.systemsx.cisd.authentication.DummyAuthenticationService; +import ch.systemsx.cisd.authentication.IAuthenticationService; +import ch.systemsx.cisd.authentication.ISessionManager; +import ch.systemsx.cisd.common.exceptions.ConfigurationFailureException; +import ch.systemsx.cisd.common.exceptions.UserFailureException; +import ch.systemsx.cisd.common.servlet.IRequestContextProvider; +import ch.systemsx.cisd.common.servlet.RequestContextProviderAdapter; +import ch.systemsx.cisd.openbis.common.conversation.context.ServiceConversationsThreadContext; +import ch.systemsx.cisd.openbis.common.conversation.progress.IServiceConversationProgressListener; +import ch.systemsx.cisd.openbis.common.spring.IInvocationLoggerContext; +import ch.systemsx.cisd.openbis.generic.server.api.v1.SearchCriteriaToDetailedSearchCriteriaTranslator; +import ch.systemsx.cisd.openbis.generic.server.authorization.AuthorizationServiceUtils; +import ch.systemsx.cisd.openbis.generic.server.authorization.annotation.AuthorizationGuard; +import ch.systemsx.cisd.openbis.generic.server.authorization.annotation.ReturnValueFilter; +import ch.systemsx.cisd.openbis.generic.server.authorization.annotation.RolesAllowed; +import ch.systemsx.cisd.openbis.generic.server.authorization.predicate.AbstractTechIdPredicate.ExperimentTechIdPredicate; +import ch.systemsx.cisd.openbis.generic.server.authorization.predicate.AtomicOperationsPredicate; +import ch.systemsx.cisd.openbis.generic.server.authorization.predicate.DataSetCodeCollectionPredicate; +import ch.systemsx.cisd.openbis.generic.server.authorization.predicate.DataSetCodePredicate; +import ch.systemsx.cisd.openbis.generic.server.authorization.predicate.DataSetUpdatesPredicate; +import ch.systemsx.cisd.openbis.generic.server.authorization.predicate.ExistingSampleOwnerIdentifierPredicate; +import ch.systemsx.cisd.openbis.generic.server.authorization.predicate.ExistingSpaceIdentifierPredicate; +import ch.systemsx.cisd.openbis.generic.server.authorization.predicate.ExperimentPermIdPredicate; +import ch.systemsx.cisd.openbis.generic.server.authorization.predicate.ListSampleCriteriaPredicate; +import ch.systemsx.cisd.openbis.generic.server.authorization.predicate.ListSamplesByPropertyPredicate; +import ch.systemsx.cisd.openbis.generic.server.authorization.predicate.NewExperimentPredicate; +import ch.systemsx.cisd.openbis.generic.server.authorization.predicate.NewSamplePredicate; +import ch.systemsx.cisd.openbis.generic.server.authorization.predicate.NewSamplesWithTypePredicate; +import ch.systemsx.cisd.openbis.generic.server.authorization.predicate.ProjectPermIdPredicate; +import ch.systemsx.cisd.openbis.generic.server.authorization.predicate.SampleOwnerIdentifierPredicate; +import ch.systemsx.cisd.openbis.generic.server.authorization.predicate.SamplePermIdPredicate; +import ch.systemsx.cisd.openbis.generic.server.authorization.predicate.SampleTechIdPredicate; +import ch.systemsx.cisd.openbis.generic.server.authorization.predicate.SampleUpdatesPredicate; +import ch.systemsx.cisd.openbis.generic.server.authorization.predicate.SpaceIdentifierPredicate; +import ch.systemsx.cisd.openbis.generic.server.authorization.validator.ProjectValidator; +import ch.systemsx.cisd.openbis.generic.server.authorization.validator.SampleValidator; +import ch.systemsx.cisd.openbis.generic.server.batch.BatchOperationExecutor; +import ch.systemsx.cisd.openbis.generic.server.batch.DataSetBatchUpdate; +import ch.systemsx.cisd.openbis.generic.server.batch.DataSetCheckBeforeBatchUpdate; +import ch.systemsx.cisd.openbis.generic.server.batch.SampleBatchRegistration; +import ch.systemsx.cisd.openbis.generic.server.batch.SampleCheckBeforeUpdate; +import ch.systemsx.cisd.openbis.generic.server.batch.SampleUpdate; +import ch.systemsx.cisd.openbis.generic.server.business.IDataStoreServiceFactory; +import ch.systemsx.cisd.openbis.generic.server.business.IPropertiesBatchManager; +import ch.systemsx.cisd.openbis.generic.server.business.IServiceConversationClientManagerLocal; +import ch.systemsx.cisd.openbis.generic.server.business.IServiceConversationServerManagerLocal; +import ch.systemsx.cisd.openbis.generic.server.business.bo.EntityCodeGenerator; +import ch.systemsx.cisd.openbis.generic.server.business.bo.EntityObjectIdHelper; +import ch.systemsx.cisd.openbis.generic.server.business.bo.IAuthorizationGroupBO; +import ch.systemsx.cisd.openbis.generic.server.business.bo.ICommonBusinessObjectFactory; +import ch.systemsx.cisd.openbis.generic.server.business.bo.IDataBO; +import ch.systemsx.cisd.openbis.generic.server.business.bo.IDataSetTable; +import ch.systemsx.cisd.openbis.generic.server.business.bo.IExperimentBO; +import ch.systemsx.cisd.openbis.generic.server.business.bo.IExperimentTable; +import ch.systemsx.cisd.openbis.generic.server.business.bo.IMaterialBO; +import ch.systemsx.cisd.openbis.generic.server.business.bo.IMetaprojectBO; +import ch.systemsx.cisd.openbis.generic.server.business.bo.IProjectBO; +import ch.systemsx.cisd.openbis.generic.server.business.bo.IRoleAssignmentTable; +import ch.systemsx.cisd.openbis.generic.server.business.bo.ISampleBO; +import ch.systemsx.cisd.openbis.generic.server.business.bo.ISampleTable; +import ch.systemsx.cisd.openbis.generic.server.business.bo.ISpaceBO; +import ch.systemsx.cisd.openbis.generic.server.business.bo.IVocabularyBO; +import ch.systemsx.cisd.openbis.generic.server.business.bo.datasetlister.IDatasetLister; +import ch.systemsx.cisd.openbis.generic.server.business.bo.fetchoptions.experimentlister.ExperimentLister; +import ch.systemsx.cisd.openbis.generic.server.business.bo.materiallister.IMaterialLister; +import ch.systemsx.cisd.openbis.generic.server.business.bo.samplelister.ISampleLister; +import ch.systemsx.cisd.openbis.generic.server.business.bo.util.DataSetRegistrationCache; +import ch.systemsx.cisd.openbis.generic.server.dataaccess.IDAOFactory; +import ch.systemsx.cisd.openbis.generic.server.dataaccess.IDataDAO; +import ch.systemsx.cisd.openbis.generic.server.dataaccess.IDataSetTypeDAO; +import ch.systemsx.cisd.openbis.generic.server.dataaccess.IDataStoreDAO; +import ch.systemsx.cisd.openbis.generic.server.dataaccess.IDataStoreDataSourceManager; +import ch.systemsx.cisd.openbis.generic.server.dataaccess.IEntityPropertyTypeDAO; +import ch.systemsx.cisd.openbis.generic.server.dataaccess.IEntityTypeDAO; +import ch.systemsx.cisd.openbis.generic.server.dataaccess.IMetaprojectDAO; +import ch.systemsx.cisd.openbis.generic.server.dataaccess.IPersonDAO; +import ch.systemsx.cisd.openbis.generic.server.dataaccess.ISampleTypeDAO; +import ch.systemsx.cisd.openbis.generic.server.dataaccess.db.search.IFullTextIndexUpdateScheduler; +import ch.systemsx.cisd.openbis.generic.server.dataaccess.db.search.IndexUpdateOperation; +import ch.systemsx.cisd.openbis.generic.shared.IDataStoreService; +import ch.systemsx.cisd.openbis.generic.shared.IOpenBisSessionManager; +import ch.systemsx.cisd.openbis.generic.shared.IServer; +import ch.systemsx.cisd.openbis.generic.shared.IServiceForDataStoreServer; +import ch.systemsx.cisd.openbis.generic.shared.LogMessagePrefixGenerator; +import ch.systemsx.cisd.openbis.generic.shared.api.v1.dto.DataSetFetchOption; +import ch.systemsx.cisd.openbis.generic.shared.api.v1.dto.SearchCriteria; +import ch.systemsx.cisd.openbis.generic.shared.api.v1.dto.SearchableEntityKind; +import ch.systemsx.cisd.openbis.generic.shared.basic.EntityOperationsState; +import ch.systemsx.cisd.openbis.generic.shared.basic.TechId; +import ch.systemsx.cisd.openbis.generic.shared.basic.dto.AbstractExternalData; +import ch.systemsx.cisd.openbis.generic.shared.basic.dto.ArchiverDataSetCriteria; +import ch.systemsx.cisd.openbis.generic.shared.basic.dto.Attachment; +import ch.systemsx.cisd.openbis.generic.shared.basic.dto.AttachmentHolderKind; +import ch.systemsx.cisd.openbis.generic.shared.basic.dto.AttachmentWithContent; +import ch.systemsx.cisd.openbis.generic.shared.basic.dto.AuthorizationGroup; +import ch.systemsx.cisd.openbis.generic.shared.basic.dto.DataSetArchivingStatus; +import ch.systemsx.cisd.openbis.generic.shared.basic.dto.DataSetTypePropertyType; +import ch.systemsx.cisd.openbis.generic.shared.basic.dto.DataSetTypeWithVocabularyTerms; +import ch.systemsx.cisd.openbis.generic.shared.basic.dto.DatabaseInstance; +import ch.systemsx.cisd.openbis.generic.shared.basic.dto.DeletedDataSet; +import ch.systemsx.cisd.openbis.generic.shared.basic.dto.DetailedSearchCriteria; +import ch.systemsx.cisd.openbis.generic.shared.basic.dto.EntityType; +import ch.systemsx.cisd.openbis.generic.shared.basic.dto.EntityTypePropertyType; +import ch.systemsx.cisd.openbis.generic.shared.basic.dto.Experiment; +import ch.systemsx.cisd.openbis.generic.shared.basic.dto.ExperimentFetchOption; +import ch.systemsx.cisd.openbis.generic.shared.basic.dto.ExperimentFetchOptions; +import ch.systemsx.cisd.openbis.generic.shared.basic.dto.ExperimentType; +import ch.systemsx.cisd.openbis.generic.shared.basic.dto.ExperimentTypePropertyType; +import ch.systemsx.cisd.openbis.generic.shared.basic.dto.ExternalDataManagementSystem; +import ch.systemsx.cisd.openbis.generic.shared.basic.dto.Grantee; +import ch.systemsx.cisd.openbis.generic.shared.basic.dto.IDatasetLocationNode; +import ch.systemsx.cisd.openbis.generic.shared.basic.dto.IEntityProperty; +import ch.systemsx.cisd.openbis.generic.shared.basic.dto.ListMaterialCriteria; +import ch.systemsx.cisd.openbis.generic.shared.basic.dto.ListOrSearchSampleCriteria; +import ch.systemsx.cisd.openbis.generic.shared.basic.dto.ListSampleCriteria; +import ch.systemsx.cisd.openbis.generic.shared.basic.dto.Material; +import ch.systemsx.cisd.openbis.generic.shared.basic.dto.MaterialIdentifier; +import ch.systemsx.cisd.openbis.generic.shared.basic.dto.MaterialType; +import ch.systemsx.cisd.openbis.generic.shared.basic.dto.MaterialTypePropertyType; +import ch.systemsx.cisd.openbis.generic.shared.basic.dto.Metaproject; +import ch.systemsx.cisd.openbis.generic.shared.basic.dto.MetaprojectAssignments; +import ch.systemsx.cisd.openbis.generic.shared.basic.dto.MetaprojectAssignmentsFetchOption; +import ch.systemsx.cisd.openbis.generic.shared.basic.dto.NewExperiment; +import ch.systemsx.cisd.openbis.generic.shared.basic.dto.NewMaterial; +import ch.systemsx.cisd.openbis.generic.shared.basic.dto.NewMaterialWithType; +import ch.systemsx.cisd.openbis.generic.shared.basic.dto.NewMetaproject; +import ch.systemsx.cisd.openbis.generic.shared.basic.dto.NewProject; +import ch.systemsx.cisd.openbis.generic.shared.basic.dto.NewSample; +import ch.systemsx.cisd.openbis.generic.shared.basic.dto.NewSamplesWithTypes; +import ch.systemsx.cisd.openbis.generic.shared.basic.dto.NewSpace; +import ch.systemsx.cisd.openbis.generic.shared.basic.dto.Person; +import ch.systemsx.cisd.openbis.generic.shared.basic.dto.Project; +import ch.systemsx.cisd.openbis.generic.shared.basic.dto.PropertyType; +import ch.systemsx.cisd.openbis.generic.shared.basic.dto.PropertyTypeWithVocabulary; +import ch.systemsx.cisd.openbis.generic.shared.basic.dto.RoleAssignment; +import ch.systemsx.cisd.openbis.generic.shared.basic.dto.RoleWithHierarchy; +import ch.systemsx.cisd.openbis.generic.shared.basic.dto.RoleWithHierarchy.RoleCode; +import ch.systemsx.cisd.openbis.generic.shared.basic.dto.Sample; +import ch.systemsx.cisd.openbis.generic.shared.basic.dto.SampleType; +import ch.systemsx.cisd.openbis.generic.shared.basic.dto.SampleTypePropertyType; +import ch.systemsx.cisd.openbis.generic.shared.basic.dto.SourceType; +import ch.systemsx.cisd.openbis.generic.shared.basic.dto.Space; +import ch.systemsx.cisd.openbis.generic.shared.basic.dto.TrackingDataSetCriteria; +import ch.systemsx.cisd.openbis.generic.shared.basic.dto.Vocabulary; +import ch.systemsx.cisd.openbis.generic.shared.basic.dto.VocabularyTerm; +import ch.systemsx.cisd.openbis.generic.shared.basic.dto.id.IObjectId; +import ch.systemsx.cisd.openbis.generic.shared.basic.dto.id.experiment.ExperimentPermIdId; +import ch.systemsx.cisd.openbis.generic.shared.basic.dto.id.metaproject.IMetaprojectId; +import ch.systemsx.cisd.openbis.generic.shared.basic.dto.id.metaproject.MetaprojectIdentifierId; +import ch.systemsx.cisd.openbis.generic.shared.dto.AtomicEntityOperationDetails; +import ch.systemsx.cisd.openbis.generic.shared.dto.AtomicEntityOperationResult; +import ch.systemsx.cisd.openbis.generic.shared.dto.AttachmentHolderPE; +import ch.systemsx.cisd.openbis.generic.shared.dto.AttachmentPE; +import ch.systemsx.cisd.openbis.generic.shared.dto.AuthorizationGroupPE; +import ch.systemsx.cisd.openbis.generic.shared.dto.DataPE; +import ch.systemsx.cisd.openbis.generic.shared.dto.DataSetBatchUpdatesDTO; +import ch.systemsx.cisd.openbis.generic.shared.dto.DataSetShareId; +import ch.systemsx.cisd.openbis.generic.shared.dto.DataSetTypePE; +import ch.systemsx.cisd.openbis.generic.shared.dto.DataSetTypePropertyTypePE; +import ch.systemsx.cisd.openbis.generic.shared.dto.DataSetUpdatesDTO; +import ch.systemsx.cisd.openbis.generic.shared.dto.DataStorePE; +import ch.systemsx.cisd.openbis.generic.shared.dto.DataStoreServerInfo; +import ch.systemsx.cisd.openbis.generic.shared.dto.DataStoreServicePE; +import ch.systemsx.cisd.openbis.generic.shared.dto.EntityCollectionForCreationOrUpdate; +import ch.systemsx.cisd.openbis.generic.shared.dto.EntityOperationsLogEntryPE; +import ch.systemsx.cisd.openbis.generic.shared.dto.EntityTypePE; +import ch.systemsx.cisd.openbis.generic.shared.dto.EntityTypePropertyTypePE; +import ch.systemsx.cisd.openbis.generic.shared.dto.ExperimentPE; +import ch.systemsx.cisd.openbis.generic.shared.dto.ExperimentTypePE; +import ch.systemsx.cisd.openbis.generic.shared.dto.ExperimentUpdatesDTO; +import ch.systemsx.cisd.openbis.generic.shared.dto.ExternalDataManagementSystemPE; +import ch.systemsx.cisd.openbis.generic.shared.dto.ExternalDataPE; +import ch.systemsx.cisd.openbis.generic.shared.dto.IEntityInformationHolderDTO; +import ch.systemsx.cisd.openbis.generic.shared.dto.ListSamplesByPropertyCriteria; +import ch.systemsx.cisd.openbis.generic.shared.dto.MaterialPE; +import ch.systemsx.cisd.openbis.generic.shared.dto.MaterialUpdateDTO; +import ch.systemsx.cisd.openbis.generic.shared.dto.MetaprojectAssignmentPE; +import ch.systemsx.cisd.openbis.generic.shared.dto.MetaprojectPE; +import ch.systemsx.cisd.openbis.generic.shared.dto.MetaprojectUpdatesDTO; +import ch.systemsx.cisd.openbis.generic.shared.dto.NewContainerDataSet; +import ch.systemsx.cisd.openbis.generic.shared.dto.NewExternalData; +import ch.systemsx.cisd.openbis.generic.shared.dto.NewLinkDataSet; +import ch.systemsx.cisd.openbis.generic.shared.dto.NewProperty; +import ch.systemsx.cisd.openbis.generic.shared.dto.NewRoleAssignment; +import ch.systemsx.cisd.openbis.generic.shared.dto.PermId; +import ch.systemsx.cisd.openbis.generic.shared.dto.PersonPE; +import ch.systemsx.cisd.openbis.generic.shared.dto.ProjectPE; +import ch.systemsx.cisd.openbis.generic.shared.dto.ProjectUpdatesDTO; +import ch.systemsx.cisd.openbis.generic.shared.dto.PropertyTypePE; +import ch.systemsx.cisd.openbis.generic.shared.dto.RoleAssignmentPE; +import ch.systemsx.cisd.openbis.generic.shared.dto.SamplePE; +import ch.systemsx.cisd.openbis.generic.shared.dto.SamplePropertyPE; +import ch.systemsx.cisd.openbis.generic.shared.dto.SampleTypePE; +import ch.systemsx.cisd.openbis.generic.shared.dto.SampleUpdatesDTO; +import ch.systemsx.cisd.openbis.generic.shared.dto.Session; +import ch.systemsx.cisd.openbis.generic.shared.dto.SimpleDataSetInformationDTO; +import ch.systemsx.cisd.openbis.generic.shared.dto.SpacePE; +import ch.systemsx.cisd.openbis.generic.shared.dto.SpaceRoleAssignment; +import ch.systemsx.cisd.openbis.generic.shared.dto.VocabularyPE; +import ch.systemsx.cisd.openbis.generic.shared.dto.VocabularyTermPE; +import ch.systemsx.cisd.openbis.generic.shared.dto.VocabularyUpdatesDTO; +import ch.systemsx.cisd.openbis.generic.shared.dto.identifier.ExperimentIdentifier; +import ch.systemsx.cisd.openbis.generic.shared.dto.identifier.ProjectIdentifier; +import ch.systemsx.cisd.openbis.generic.shared.dto.identifier.ProjectIdentifierFactory; +import ch.systemsx.cisd.openbis.generic.shared.dto.identifier.SampleIdentifier; +import ch.systemsx.cisd.openbis.generic.shared.dto.identifier.SampleIdentifierFactory; +import ch.systemsx.cisd.openbis.generic.shared.dto.identifier.SpaceIdentifier; +import ch.systemsx.cisd.openbis.generic.shared.dto.properties.EntityKind; +import ch.systemsx.cisd.openbis.generic.shared.managed_property.IManagedPropertyEvaluatorFactory; +import ch.systemsx.cisd.openbis.generic.shared.translator.AttachmentTranslator; +import ch.systemsx.cisd.openbis.generic.shared.translator.AuthorizationGroupTranslator; +import ch.systemsx.cisd.openbis.generic.shared.translator.DataSetTranslator; +import ch.systemsx.cisd.openbis.generic.shared.translator.DataSetTypePropertyTypeTranslator; +import ch.systemsx.cisd.openbis.generic.shared.translator.DataSetTypeTranslator; +import ch.systemsx.cisd.openbis.generic.shared.translator.EntityPropertyTranslator; +import ch.systemsx.cisd.openbis.generic.shared.translator.ExperimentTranslator; +import ch.systemsx.cisd.openbis.generic.shared.translator.ExperimentTranslator.LoadableFields; +import ch.systemsx.cisd.openbis.generic.shared.translator.ExperimentTypePropertyTypeTranslator; +import ch.systemsx.cisd.openbis.generic.shared.translator.ExperimentTypeTranslator; +import ch.systemsx.cisd.openbis.generic.shared.translator.ExternalDataManagementSystemTranslator; +import ch.systemsx.cisd.openbis.generic.shared.translator.MaterialTranslator; +import ch.systemsx.cisd.openbis.generic.shared.translator.MaterialTypePropertyTypeTranslator; +import ch.systemsx.cisd.openbis.generic.shared.translator.MetaprojectTranslator; +import ch.systemsx.cisd.openbis.generic.shared.translator.PersonTranslator; +import ch.systemsx.cisd.openbis.generic.shared.translator.ProjectTranslator; +import ch.systemsx.cisd.openbis.generic.shared.translator.RoleAssignmentTranslator; +import ch.systemsx.cisd.openbis.generic.shared.translator.SampleTranslator; +import ch.systemsx.cisd.openbis.generic.shared.translator.SampleTypePropertyTypeTranslator; +import ch.systemsx.cisd.openbis.generic.shared.translator.SampleTypeTranslator; +import ch.systemsx.cisd.openbis.generic.shared.translator.SimpleDataSetHelper; +import ch.systemsx.cisd.openbis.generic.shared.translator.SpaceTranslator; +import ch.systemsx.cisd.openbis.generic.shared.translator.VocabularyTermTranslator; +import ch.systemsx.cisd.openbis.generic.shared.translator.VocabularyTranslator; +import ch.systemsx.cisd.openbis.generic.shared.util.HibernateUtils; + +/** + * @author Franz-Josef Elmer + */ +public class ServiceForDataStoreServer extends AbstractCommonServer<IServiceForDataStoreServer> + implements IServiceForDataStoreServer +{ + + @Private + static final EnumSet<DataSetFetchOption> DATASET_FETCH_OPTIONS_FILE_DATASETS = EnumSet.of( + DataSetFetchOption.BASIC, DataSetFetchOption.EXPERIMENT, DataSetFetchOption.SAMPLE); + + private final IDAOFactory daoFactory; + + private final IDataStoreServiceFactory dssFactory; + + private final TrustedCrossOriginDomainsProvider trustedOriginDomainProvider; + + private final IETLEntityOperationChecker entityOperationChecker; + + private final ISessionManager<Session> sessionManagerForEntityOperation; + + private final IDataStoreServiceRegistrator dataStoreServiceRegistrator; + + private final IDataStoreDataSourceManager dataSourceManager; + + private IServiceConversationClientManagerLocal conversationClient; + + private IServiceConversationServerManagerLocal conversationServer; + + private IManagedPropertyEvaluatorFactory managedPropertyEvaluatorFactory; + + @Autowired + private ICreateDataSetExecutor createDataSetExecutor; + + private long timeout = 5; // minutes + + public ServiceForDataStoreServer(IAuthenticationService authenticationService, + IOpenBisSessionManager sessionManager, IDAOFactory daoFactory, + ICommonBusinessObjectFactory boFactory, IDataStoreServiceFactory dssFactory, + TrustedCrossOriginDomainsProvider trustedOriginDomainProvider, + IETLEntityOperationChecker entityOperationChecker, + IDataStoreServiceRegistrator dataStoreServiceRegistrator, + IDataStoreDataSourceManager dataSourceManager, + IManagedPropertyEvaluatorFactory managedPropertyEvaluatorFactory) + { + this(authenticationService, sessionManager, daoFactory, null, boFactory, dssFactory, + trustedOriginDomainProvider, entityOperationChecker, dataStoreServiceRegistrator, + dataSourceManager, new DefaultSessionManager<Session>(new SessionFactory(), + new LogMessagePrefixGenerator(), new DummyAuthenticationService(), + new RequestContextProviderAdapter(new IRequestContextProvider() + { + @Override + public HttpServletRequest getHttpServletRequest() + { + return null; + } + }), + 30), + managedPropertyEvaluatorFactory, null); + } + + ServiceForDataStoreServer(IAuthenticationService authenticationService, + IOpenBisSessionManager sessionManager, IDAOFactory daoFactory, + IPropertiesBatchManager propertiesBatchManager, ICommonBusinessObjectFactory boFactory, + IDataStoreServiceFactory dssFactory, + TrustedCrossOriginDomainsProvider trustedOriginDomainProvider, + IETLEntityOperationChecker entityOperationChecker, + IDataStoreServiceRegistrator dataStoreServiceRegistrator, + IDataStoreDataSourceManager dataSourceManager, + ISessionManager<Session> sessionManagerForEntityOperation, + IManagedPropertyEvaluatorFactory managedPropertyEvaluatorFactory, ICreateDataSetExecutor createDataSetExecutor) + { + super(authenticationService, sessionManager, daoFactory, propertiesBatchManager, boFactory); + this.daoFactory = daoFactory; + this.dssFactory = dssFactory; + this.trustedOriginDomainProvider = trustedOriginDomainProvider; + this.entityOperationChecker = entityOperationChecker; + this.dataStoreServiceRegistrator = dataStoreServiceRegistrator; + this.dataSourceManager = dataSourceManager; + this.sessionManagerForEntityOperation = sessionManagerForEntityOperation; + this.managedPropertyEvaluatorFactory = managedPropertyEvaluatorFactory; + this.createDataSetExecutor = createDataSetExecutor; + } + + @Override + public IServiceForDataStoreServer createLogger(IInvocationLoggerContext context) + { + return new ServiceForDataStoreServerLogger(getSessionManager(), context); + } + + @Override + public int getVersion() + { + return IServer.VERSION; + } + + @Override + @RolesAllowed(RoleWithHierarchy.SPACE_ETL_SERVER) + public DatabaseInstance getHomeDatabaseInstance(final String sessionToken) + { + final DatabaseInstance result = new DatabaseInstance(); + result.setCode("CISD"); + result.setHomeDatabase(true); + result.setId(1L); + String uuid = getDatabaseInstanceUUID(); + result.setIdentifier(uuid); + result.setUuid(uuid); + return result; + } + + private String getDatabaseInstanceUUID() + { + List<DataStorePE> stores = daoFactory.getDataStoreDAO().listDataStores(); + if (stores.size() == 0) + { + return UUID.randomUUID().toString().toUpperCase(); + } else + { + return stores.get(0).getDatabaseInstanceUUID(); + } + } + + @Override + @RolesAllowed(RoleWithHierarchy.SPACE_ETL_SERVER) + public void registerDataStoreServer(String sessionToken, DataStoreServerInfo info) + { + Session session = getSession(sessionToken); + + String dssSessionToken = info.getSessionToken(); + String dssURL = checkVersion(info, session, dssSessionToken); + IDataStoreDAO dataStoreDAO = daoFactory.getDataStoreDAO(); + DataStorePE dataStore = dataStoreDAO.tryToFindDataStoreByCode(info.getDataStoreCode()); + if (dataStore == null) + { + dataStore = new DataStorePE(); + dataStore.setDatabaseInstanceUUID(getDatabaseInstanceUUID()); + } + dataStore.setCode(info.getDataStoreCode()); + dataStore.setDownloadUrl(info.getDownloadUrl()); + dataStore.setRemoteUrl(dssURL); + dataStore.setSessionToken(dssSessionToken); + dataStore.setArchiverConfigured(info.isArchiverConfigured()); + dataStore.setServices(new HashSet<DataStoreServicePE>()); // services will be set by the + // dataStoreServiceRegistrator + // setServices(dataStore, info.getServicesDescriptions(), dataStoreDAO); + dataStoreDAO.createOrUpdateDataStore(dataStore); + dataStoreServiceRegistrator.setServiceDescriptions(dataStore, + info.getServicesDescriptions()); + dataSourceManager.handle(info.getDataStoreCode(), info.getDataSourceDefinitions()); + + conversationClient.setDataStoreInformation(dssURL, info.getTimeoutInMinutes()); + conversationServer.setDataStoreInformation(info.getDataStoreCode(), dssURL, + info.getTimeoutInMinutes()); + } + + private String checkVersion(DataStoreServerInfo info, Session session, String dssSessionToken) + { + int port = info.getPort(); + String remoteHost = session.getRemoteHost() + ":" + port; + String dssURL = (info.isUseSSL() ? "https://" : "http://") + remoteHost; + checkVersion(dssSessionToken, dssURL); + return dssURL; + } + + private void checkVersion(String dssSessionToken, final String dssURL) + { + final IDataStoreService service = dssFactory.create(dssURL, timeout * 60 * 1000); + if (operationLog.isInfoEnabled()) + { + operationLog.info("Obtain version of Data Store Server at " + dssURL); + } + int dssVersion = service.getVersion(dssSessionToken); + if (IDataStoreService.VERSION != dssVersion) + { + String msg = + "Data Store Server version is " + dssVersion + " instead of " + + IDataStoreService.VERSION; + notificationLog.error(msg); + throw new ConfigurationFailureException(msg); + } + if (operationLog.isInfoEnabled()) + { + operationLog.info("Data Store Server (version " + dssVersion + ") registered for " + + dssURL); + } + } + + @Override + @RolesAllowed(RoleWithHierarchy.SPACE_ETL_SERVER) + public String createPermId(final String sessionToken) throws UserFailureException + { + checkSession(sessionToken); // throws exception if invalid sessionToken + return daoFactory.getPermIdDAO().createPermId(); + } + + @Override + @RolesAllowed(RoleWithHierarchy.SPACE_ETL_SERVER) + public List<String> createPermIds(String sessionToken, int n) throws UserFailureException + { + checkSession(sessionToken); + return daoFactory.getPermIdDAO().createPermIds(n); + } + + @Override + @RolesAllowed(RoleWithHierarchy.SPACE_ETL_SERVER) + public long drawANewUniqueID(String sessionToken) throws UserFailureException + { + checkSession(sessionToken); + return daoFactory.getCodeSequenceDAO().getNextCodeSequenceId(); + } + + @Override + @RolesAllowed({ RoleWithHierarchy.SPACE_OBSERVER, RoleWithHierarchy.SPACE_ETL_SERVER }) + public List<Experiment> listExperiments(String sessionToken, + @AuthorizationGuard(guardClass = SpaceIdentifierPredicate.class) List<ExperimentIdentifier> experimentIdentifiers, + ExperimentFetchOptions experimentFetchOptions) + { + if (sessionToken == null) + { + throw new IllegalArgumentException("SessionToken was null"); + } + if (experimentIdentifiers == null) + { + throw new IllegalArgumentException("ExperimentIdentifiers were null"); + } + if (experimentFetchOptions == null) + { + throw new IllegalArgumentException("ExperimentFetchOptions were null"); + } + + checkSession(sessionToken); + + if (experimentFetchOptions.isSubsetOf(ExperimentFetchOption.BASIC, + ExperimentFetchOption.METAPROJECTS)) + { + ExperimentLister lister = + new ExperimentLister(getDAOFactory(), getSession(sessionToken) + .getBaseIndexURL()); + return lister.listExperiments(experimentIdentifiers, experimentFetchOptions); + } else + { + List<Experiment> experiments = new ArrayList<Experiment>(); + for (ExperimentIdentifier experimentIdentifier : experimentIdentifiers) + { + Experiment experiment = tryGetExperiment(sessionToken, experimentIdentifier); + if (experiment != null) + { + experiment.setFetchOptions(new ExperimentFetchOptions(ExperimentFetchOption + .values())); + experiments.add(experiment); + } + } + return experiments; + } + } + + @Override + @RolesAllowed({ RoleWithHierarchy.SPACE_OBSERVER, RoleWithHierarchy.SPACE_ETL_SERVER }) + public List<Experiment> listExperimentsForProjects(String sessionToken, + @AuthorizationGuard(guardClass = SpaceIdentifierPredicate.class) List<ProjectIdentifier> projectIdentifiers, + ExperimentFetchOptions experimentFetchOptions) + { + if (sessionToken == null) + { + throw new IllegalArgumentException("SessionToken was null"); + } + if (projectIdentifiers == null) + { + throw new IllegalArgumentException("ProjectIdentifiers were null"); + } + if (experimentFetchOptions == null) + { + throw new IllegalArgumentException("ExperimentFetchOptions were null"); + } + + checkSession(sessionToken); + + if (experimentFetchOptions.isSubsetOf(ExperimentFetchOption.BASIC, + ExperimentFetchOption.METAPROJECTS)) + { + ExperimentLister lister = + new ExperimentLister(daoFactory, getSession(sessionToken).getBaseIndexURL()); + return lister.listExperimentsForProjects(projectIdentifiers, experimentFetchOptions); + } else + { + List<Experiment> experiments = new ArrayList<Experiment>(); + for (ProjectIdentifier projectIdentifier : projectIdentifiers) + { + List<Experiment> projectExperiments = + listExperiments(sessionToken, projectIdentifier); + if (projectExperiments != null) + { + for (Experiment projectExperiment : projectExperiments) + { + if (projectExperiment != null) + { + projectExperiment.setFetchOptions(new ExperimentFetchOptions( + ExperimentFetchOption.values())); + experiments.add(projectExperiment); + } + } + + } + } + return experiments; + } + } + + @Override + @RolesAllowed({ RoleWithHierarchy.SPACE_OBSERVER, RoleWithHierarchy.SPACE_ETL_SERVER }) + public Experiment tryGetExperiment(String sessionToken, + @AuthorizationGuard(guardClass = ExistingSpaceIdentifierPredicate.class) ExperimentIdentifier experimentIdentifier) + throws UserFailureException + { + assert sessionToken != null : "Unspecified session token."; + assert experimentIdentifier != null : "Unspecified experiment identifier."; + + final Session session = getSession(sessionToken); + ExperimentPE experiment = tryLoadExperimentByIdentifier(session, experimentIdentifier); + return translateExperimentWithMetaprojects(session, experiment); + } + + @Override + @RolesAllowed({ RoleWithHierarchy.SPACE_OBSERVER, RoleWithHierarchy.SPACE_ETL_SERVER }) + public Experiment tryGetExperimentByPermId(String sessionToken, @AuthorizationGuard(guardClass = ExperimentPermIdPredicate.class) PermId permId) + throws UserFailureException + { + assert sessionToken != null : "Unspecified session token."; + assert permId != null : "Unspecified experiment perm id."; + + final Session session = getSession(sessionToken); + ExperimentPE experiment = tryLoadExperimentByPermId(session, permId.getId()); + return translateExperimentWithMetaprojects(session, experiment); + } + + private Experiment translateExperimentWithMetaprojects(final Session session, ExperimentPE experiment) + { + if (experiment == null) + { + return null; + } + enrichWithProperties(experiment); + + Collection<MetaprojectPE> metaprojectPEs = + getDAOFactory().getMetaprojectDAO().listMetaprojectsForEntity( + session.tryGetPerson(), experiment); + + return ExperimentTranslator.translate(experiment, session.getBaseIndexURL(), + MetaprojectTranslator.translate(metaprojectPEs), managedPropertyEvaluatorFactory, + LoadableFields.PROPERTIES); + } + + @Override + @RolesAllowed({ RoleWithHierarchy.SPACE_OBSERVER, RoleWithHierarchy.SPACE_ETL_SERVER }) + @ReturnValueFilter(validatorClass = SampleValidator.class) + public List<Sample> listSamples(final String sessionToken, + @AuthorizationGuard(guardClass = ListSampleCriteriaPredicate.class) + final ListSampleCriteria criteria) + { + final Session session = getSession(sessionToken); + final ISampleLister sampleLister = businessObjectFactory.createSampleLister(session); + return sampleLister.list(new ListOrSearchSampleCriteria(criteria)); + } + + @Override + @RolesAllowed(RoleWithHierarchy.SPACE_ETL_SERVER) + public Sample tryGetSampleWithExperiment(final String sessionToken, + @AuthorizationGuard(guardClass = ExistingSampleOwnerIdentifierPredicate.class) + final SampleIdentifier sampleIdentifier) throws UserFailureException + { + assert sessionToken != null : "Unspecified session token."; + assert sampleIdentifier != null : "Unspecified sample identifier."; + + final Session session = getSession(sessionToken); + SamplePE sample = tryLoadSample(session, sampleIdentifier); + return translateSampleWithMetaProjects(session, sample); + } + + @Override + @RolesAllowed(RoleWithHierarchy.SPACE_ETL_SERVER) + public Sample tryGetSampleByPermId(String sessionToken, @AuthorizationGuard(guardClass = SamplePermIdPredicate.class) PermId permId) + throws UserFailureException + { + assert sessionToken != null : "Unspecified session token."; + assert permId != null : "Unspecified sample perm id."; + + final Session session = getSession(sessionToken); + SamplePE sample = tryLoadSample(session, permId.getId()); + return translateSampleWithMetaProjects(session, sample); + } + + private Sample translateSampleWithMetaProjects(final Session session, SamplePE sample) + { + Collection<MetaprojectPE> metaprojects = Collections.emptySet(); + if (sample != null) + { + HibernateUtils.initialize(sample.getProperties()); + enrichWithProperties(sample.getExperiment()); + metaprojects = + getDAOFactory().getMetaprojectDAO().listMetaprojectsForEntity( + session.tryGetPerson(), sample); + } + return SampleTranslator.translate(sample, session.getBaseIndexURL(), true, true, + MetaprojectTranslator.translate(metaprojects), managedPropertyEvaluatorFactory); + } + + @Override + @RolesAllowed(RoleWithHierarchy.SPACE_ETL_SERVER) + public SampleIdentifier tryGetSampleIdentifier(String sessionToken, String samplePermID) + throws UserFailureException + { + assert sessionToken != null : "Unspecified session token."; + assert samplePermID != null : "Unspecified sample perm ID."; + + final SamplePE sample = daoFactory.getSampleDAO().tryToFindByPermID(samplePermID); + return (sample == null) ? null : sample.getSampleIdentifier(); + } + + @Override + @RolesAllowed(RoleWithHierarchy.SPACE_ETL_SERVER) + public Map<String, SampleIdentifier> listSamplesByPermId(final String sessionToken, + List<String> samplePermIds) + { + List<SamplePE> samples = + daoFactory.getSampleDAO().listByPermID(new HashSet<String>(samplePermIds)); + + Map<String, SampleIdentifier> map = new HashMap<String, SampleIdentifier>(); + + for (SamplePE sample : samples) + { + map.put(sample.getPermId(), sample.getSampleIdentifier()); + } + + return map; + } + + private ExperimentPE tryLoadExperimentByIdentifier(final Session session, + ExperimentIdentifier experimentIdentifier) + { + final IExperimentBO experimentBO = businessObjectFactory.createExperimentBO(session); + return experimentBO.tryFindByExperimentIdentifier(experimentIdentifier); + } + + private ExperimentPE tryLoadExperimentByPermId(final Session session, + String permId) + { + final IExperimentBO experimentBO = businessObjectFactory.createExperimentBO(session); + return experimentBO.tryFindByExperimentId(new ExperimentPermIdId(permId)); + } + + private SamplePE tryLoadSample(final Session session, SampleIdentifier sampleIdentifier) + { + SamplePE result = null; + final ISampleBO sampleBO = businessObjectFactory.createSampleBO(session); + try + { + sampleBO.tryToLoadBySampleIdentifier(sampleIdentifier); + result = sampleBO.tryToGetSample(); + } catch (UserFailureException ufe) + { + // sample does not exist + } + return result; + } + + private SamplePE tryLoadSample(final Session session, String permId) + { + SamplePE result = null; + final ISampleBO sampleBO = businessObjectFactory.createSampleBO(session); + try + { + sampleBO.tryToLoadBySamplePermId(permId); + result = sampleBO.tryToGetSample(); + } catch (UserFailureException ufe) + { + // sample does not exist + } + return result; + } + + private void enrichWithProperties(ExperimentPE experiment) + { + if (experiment == null) + { + return; + } + HibernateUtils.initialize(experiment.getProperties()); + } + + @Override + @RolesAllowed(RoleWithHierarchy.SPACE_ETL_SERVER) + public ExperimentType getExperimentType(String sessionToken, String experimentTypeCode) + throws UserFailureException + { + checkSession(sessionToken); + + IEntityTypeDAO entityTypeDAO = getDAOFactory().getEntityTypeDAO(EntityKind.EXPERIMENT); + EntityTypePE entityType = entityTypeDAO.tryToFindEntityTypeByCode(experimentTypeCode); + if (entityType == null) + { + throw new UserFailureException("No Experiment type found with code '" + + experimentTypeCode + "'."); + } + assert entityType instanceof ExperimentTypePE : "Not an ExperimentTypePE: " + entityType; + ExperimentTypePE experimentType = (ExperimentTypePE) entityType; + HibernateUtils.initialize(experimentType.getExperimentTypePropertyTypes()); + return ExperimentTypeTranslator.translate(experimentType, null); + } + + @Override + @RolesAllowed(RoleWithHierarchy.SPACE_ETL_SERVER) + public SampleType getSampleType(String sessionToken, String sampleTypeCode) + throws UserFailureException + { + checkSession(sessionToken); + + ISampleTypeDAO sampleTypeDAO = getDAOFactory().getSampleTypeDAO(); + SampleTypePE sampleType = sampleTypeDAO.tryFindSampleTypeByCode(sampleTypeCode); + if (sampleType == null) + { + throw new UserFailureException("No sample type found with code '" + sampleTypeCode + + "'."); + } + HibernateUtils.initialize(sampleType.getSampleTypePropertyTypes()); + return SampleTypeTranslator.translate(sampleType, null); + } + + @Override + @RolesAllowed(RoleWithHierarchy.SPACE_ETL_SERVER) + public DataSetTypeWithVocabularyTerms getDataSetType(String sessionToken, String dataSetTypeCode) + throws UserFailureException + { + checkSession(sessionToken); + + IDataSetTypeDAO dataSetTypeDAO = getDAOFactory().getDataSetTypeDAO(); + DataSetTypePE dataSetType = dataSetTypeDAO.tryToFindDataSetTypeByCode(dataSetTypeCode); + if (dataSetType == null) + { + throw new UserFailureException("No data set type found with code '" + dataSetTypeCode + + "'."); + } + Set<DataSetTypePropertyTypePE> dataSetTypePropertyTypes = + dataSetType.getDataSetTypePropertyTypes(); + HibernateUtils.initialize(dataSetTypePropertyTypes); + DataSetTypeWithVocabularyTerms result = new DataSetTypeWithVocabularyTerms(); + result.setDataSetType(DataSetTypeTranslator.translate(dataSetType, null)); + for (DataSetTypePropertyTypePE dataSetTypePropertyTypePE : dataSetTypePropertyTypes) + { + PropertyTypePE propertyTypePE = dataSetTypePropertyTypePE.getPropertyType(); + PropertyTypeWithVocabulary propertyType = new PropertyTypeWithVocabulary(); + propertyType.setCode(propertyTypePE.getCode()); + VocabularyPE vocabulary = propertyTypePE.getVocabulary(); + if (vocabulary != null) + { + Set<VocabularyTermPE> terms = vocabulary.getTerms(); + HibernateUtils.initialize(terms); + propertyType.setTerms(VocabularyTermTranslator.translateTerms(terms)); + } + result.addPropertyType(propertyType); + } + return result; + } + + @Override + @RolesAllowed({ RoleWithHierarchy.SPACE_OBSERVER, RoleWithHierarchy.SPACE_ETL_SERVER }) + public List<AbstractExternalData> listDataSetsByExperimentID(final String sessionToken, + @AuthorizationGuard(guardClass = ExperimentTechIdPredicate.class) + final TechId experimentID) throws UserFailureException + { + Session session = getSession(sessionToken); + IDatasetLister datasetLister = createDatasetLister(session); + List<AbstractExternalData> datasets = + datasetLister.listByExperimentTechId(experimentID, true); + Collections.sort(datasets); + return datasets; + } + + @Override + @RolesAllowed({ RoleWithHierarchy.SPACE_OBSERVER, RoleWithHierarchy.SPACE_ETL_SERVER }) + public List<AbstractExternalData> listDataSetsBySampleID(final String sessionToken, + @AuthorizationGuard(guardClass = SampleTechIdPredicate.class) + final TechId sampleId, final boolean showOnlyDirectlyConnected) + throws UserFailureException + { + final Session session = getSession(sessionToken); + final IDatasetLister datasetLister = createDatasetLister(session); + final List<AbstractExternalData> datasets = + datasetLister.listBySampleTechId(sampleId, showOnlyDirectlyConnected); + Collections.sort(datasets); + return datasets; + } + + @Override + @RolesAllowed({ RoleWithHierarchy.SPACE_OBSERVER, RoleWithHierarchy.SPACE_ETL_SERVER }) + public List<AbstractExternalData> listDataSetsByCode(String sessionToken, + @AuthorizationGuard(guardClass = DataSetCodeCollectionPredicate.class) List<String> dataSetCodes) throws UserFailureException + { + final Session session = getSession(sessionToken); + final IDatasetLister datasetLister = createDatasetLister(session); + return datasetLister.listByDatasetCode(dataSetCodes); + } + + @Override + @RolesAllowed(value = { RoleWithHierarchy.SPACE_OBSERVER, RoleWithHierarchy.SPACE_ETL_SERVER }) + @ReturnValueFilter(validatorClass = ProjectValidator.class) + public List<Project> listProjects(String sessionToken) + { + checkSession(sessionToken); + final List<ProjectPE> projects = getDAOFactory().getProjectDAO().listProjects(); + Collections.sort(projects); + return ProjectTranslator.translate(projects); + } + + @Override + @RolesAllowed(value = { RoleWithHierarchy.SPACE_OBSERVER, RoleWithHierarchy.SPACE_ETL_SERVER }) + public List<Experiment> listExperiments(String sessionToken, + @AuthorizationGuard(guardClass = SpaceIdentifierPredicate.class) ProjectIdentifier projectIdentifier) + { + final Session session = getSession(sessionToken); + final IExperimentTable experimentTable = + businessObjectFactory.createExperimentTable(session); + experimentTable.load(EntityType.ALL_TYPES_CODE, projectIdentifier); + final List<ExperimentPE> experiments = experimentTable.getExperiments(); + return translateExperimentsWithMetaprojectAssignments(session, experiments); + } + + private List<Experiment> translateExperimentsWithMetaprojectAssignments(final Session session, final List<ExperimentPE> experiments) + { + final Collection<MetaprojectAssignmentPE> assignmentPEs = + getDAOFactory().getMetaprojectDAO().listMetaprojectAssignmentsForEntities( + session.tryGetPerson(), experiments, EntityKind.EXPERIMENT); + Map<Long, Set<Metaproject>> assignments = + MetaprojectTranslator.translateMetaprojectAssignments(assignmentPEs); + Collections.sort(experiments); + return ExperimentTranslator.translate(experiments, session.getBaseIndexURL(), assignments, + managedPropertyEvaluatorFactory); + } + + @Override + @RolesAllowed({ RoleWithHierarchy.SPACE_OBSERVER, RoleWithHierarchy.SPACE_ETL_SERVER }) + public IEntityProperty[] tryGetPropertiesOfTopSample(final String sessionToken, + @AuthorizationGuard(guardClass = SampleOwnerIdentifierPredicate.class) + final SampleIdentifier sampleIdentifier) throws UserFailureException + { + assert sessionToken != null : "Unspecified session token."; + assert sampleIdentifier != null : "Unspecified sample identifier."; + + final Session session = getSession(sessionToken); + final ISampleBO sampleBO = businessObjectFactory.createSampleBO(session); + sampleBO.loadBySampleIdentifier(sampleIdentifier); + SamplePE sample = sampleBO.getSample(); + if (sample == null) + { + return null; + } + SamplePE top = sample.getTop(); + Set<SamplePropertyPE> properties = top.getProperties(); + HibernateUtils.initialize(properties); + return EntityPropertyTranslator.translate(properties.toArray(new SamplePropertyPE[0]), + new HashMap<PropertyTypePE, PropertyType>(), managedPropertyEvaluatorFactory); + } + + @Override + @RolesAllowed({ RoleWithHierarchy.SPACE_OBSERVER, RoleWithHierarchy.SPACE_ETL_SERVER }) + public IEntityProperty[] tryGetPropertiesOfSample(String sessionToken, + @AuthorizationGuard(guardClass = SampleOwnerIdentifierPredicate.class) SampleIdentifier sampleIdentifier) throws UserFailureException + { + assert sessionToken != null : "Unspecified session token."; + assert sampleIdentifier != null : "Unspecified sample identifier."; + + final Session session = getSession(sessionToken); + final ISampleBO sampleBO = businessObjectFactory.createSampleBO(session); + sampleBO.loadBySampleIdentifier(sampleIdentifier); + SamplePE sample = sampleBO.getSample(); + if (sample == null) + { + return null; + } + Set<SamplePropertyPE> properties = sample.getProperties(); + HibernateUtils.initialize(properties); + return EntityPropertyTranslator.translate(properties.toArray(new SamplePropertyPE[0]), + new HashMap<PropertyTypePE, PropertyType>(), managedPropertyEvaluatorFactory); + } + + @Override + @RolesAllowed(RoleWithHierarchy.SPACE_ETL_SERVER) + public void registerEntities(String sessionToken, EntityCollectionForCreationOrUpdate collection) + throws UserFailureException + { + Session session = getSession(sessionToken); + + for (NewExperiment experiment : collection.getNewExperiments()) + { + registerExperiment(session, experiment); + } + + DataSetRegistrationCache cache = new DataSetRegistrationCache(); + for (NewExternalData dataSet : collection.getNewDataSets()) + { + registerDataSetInternal(session, dataSet, cache); + } + } + + @Override + @RolesAllowed(RoleWithHierarchy.SPACE_ETL_SERVER) + public long registerExperiment(String sessionToken, + @AuthorizationGuard(guardClass = NewExperimentPredicate.class) NewExperiment experiment) throws UserFailureException + { + assert sessionToken != null : "Unspecified session token."; + assert experiment != null : "Unspecified new example."; + + final Session session = getSession(sessionToken); + return registerExperiment(session, experiment); + } + + private long registerExperiment(final Session session, NewExperiment experiment) + { + IExperimentBO experimentBO = businessObjectFactory.createExperimentBO(session); + experimentBO.define(experiment); + experimentBO.save(); + return experimentBO.getExperiment().getId(); + } + + @Override + @RolesAllowed(RoleWithHierarchy.SPACE_ETL_SERVER) + public void registerSamples(final String sessionToken, + @AuthorizationGuard(guardClass = NewSamplesWithTypePredicate.class) + final List<NewSamplesWithTypes> newSamplesWithType, String userIDOrNull) + throws UserFailureException + { + assert sessionToken != null : "Unspecified session token."; + final Session session = getSession(sessionToken); + PersonPE registratorOrNull = + userIDOrNull != null ? getOrCreatePerson(sessionToken, userIDOrNull) : null; + for (NewSamplesWithTypes samples : newSamplesWithType) + { + registerSamples(session, samples, registratorOrNull); + } + } + + @Override + @RolesAllowed(RoleWithHierarchy.SPACE_ETL_SERVER) + public long registerSample(final String sessionToken, + @AuthorizationGuard(guardClass = NewSamplePredicate.class) + final NewSample newSample, String userIDOrNull) throws UserFailureException + { + assert sessionToken != null : "Unspecified session token."; + assert newSample != null : "Unspecified new sample."; + + final Session session = getSession(sessionToken); + SamplePE samplePE = registerSampleInternal(session, newSample, userIDOrNull); + return samplePE.getId(); + } + + private PersonPE getOrCreatePerson(String sessionToken, String userID) + { + PersonPE person = getDAOFactory().getPersonDAO().tryFindPersonByUserId(userID); + if (person != null) + { + return person; + } + List<PersonPE> persons = registerPersons(sessionToken, Collections.singletonList(userID)); + return persons.get(0); + } + + @Override + @RolesAllowed(RoleWithHierarchy.SPACE_ETL_SERVER) + public void updateSample(String sessionToken, + @AuthorizationGuard(guardClass = SampleUpdatesPredicate.class) SampleUpdatesDTO updates) + { + final Session session = getSession(sessionToken); + updateSampleInternal(updates, session); + } + + @Override + @RolesAllowed(RoleWithHierarchy.SPACE_ETL_SERVER) + public void registerDataSet(final String sessionToken, + @AuthorizationGuard(guardClass = SampleOwnerIdentifierPredicate.class) + final SampleIdentifier sampleIdentifier, final NewExternalData externalData) + throws UserFailureException + { + assert sessionToken != null : "Unspecified session token."; + assert sampleIdentifier != null : "Unspecified sample identifier."; + + final Session session = getSession(sessionToken); + registerDataSetInternal(session, sampleIdentifier, externalData, new DataSetRegistrationCache()); + } + + @Override + @RolesAllowed(RoleWithHierarchy.SPACE_ETL_SERVER) + public void registerDataSet(final String sessionToken, + @AuthorizationGuard(guardClass = SpaceIdentifierPredicate.class) + final ExperimentIdentifier experimentIdentifier, final NewExternalData externalData) + throws UserFailureException + { + assert sessionToken != null : "Unspecified session token."; + assert experimentIdentifier != null : "Unspecified experiment identifier."; + + final Session session = getSession(sessionToken); + registerDataSetInternal(session, experimentIdentifier, externalData, new DataSetRegistrationCache()); + } + + @Override + @RolesAllowed(RoleWithHierarchy.SPACE_ETL_SERVER) + public void addPropertiesToDataSet(String sessionToken, List<NewProperty> properties, + String dataSetCode, @AuthorizationGuard(guardClass = SpaceIdentifierPredicate.class) + final SpaceIdentifier identifier) throws UserFailureException + { + assert sessionToken != null : "Unspecified session token."; + final Session session = getSession(sessionToken); + final IDataBO dataBO = businessObjectFactory.createDataBO(session); + dataBO.addPropertiesToDataSet(dataSetCode, properties); + } + + @Override + @RolesAllowed(RoleWithHierarchy.SPACE_ETL_SERVER) + public boolean isDataSetOnTrashCanOrDeleted(String sessionToken, + @AuthorizationGuard(guardClass = DataSetCodePredicate.class) String dataSetCode) + { + // Check if dataset is available for retrieval + DataPE dataSet = getDAOFactory().getDataDAO().tryToFindFullDataSetByCode(dataSetCode, false, false); + boolean isDataSetAvailable = dataSet != null; + // Check if the dataset is on the table, since can't be retrieved is on the trashcan + boolean isDataSetOnTrashCan = getDAOFactory().getDataDAO().exists(dataSetCode); + // Check if the dataset is finally deleted + boolean isDataSetDeleted = getDAOFactory().getEventDAO().tryFind( + dataSetCode, + ch.systemsx.cisd.openbis.generic.shared.dto.EventPE.EntityType.DATASET, + ch.systemsx.cisd.openbis.generic.shared.dto.EventType.DELETION) != null; + + return !isDataSetAvailable && (isDataSetOnTrashCan || isDataSetDeleted); + } + + @Override + @RolesAllowed(RoleWithHierarchy.SPACE_ETL_SERVER) + public void updateShareIdAndSize(String sessionToken, + @AuthorizationGuard(guardClass = DataSetCodePredicate.class) String dataSetCode, String shareId, long size) throws UserFailureException + { + final Session session = getSession(sessionToken); + IDataDAO dataSetDAO = getDAOFactory().getDataDAO(); + + DataPE dataSet = dataSetDAO.tryToFindFullDataSetByCode(dataSetCode, false, false); + if (dataSet == null) // Dataset is not available for retrieval + { + // Check if the dataset is on the table, since can't be retrieved is on the trashcan + boolean isDataSetOnTrashCan = getDAOFactory().getDataDAO().exists(dataSetCode); + // Check if the dataset is finally deleted + boolean isDataSetDeleted = getDAOFactory().getEventDAO().tryFind( + dataSetCode, + ch.systemsx.cisd.openbis.generic.shared.dto.EventPE.EntityType.DATASET, + ch.systemsx.cisd.openbis.generic.shared.dto.EventType.DELETION) != null; + + if (isDataSetOnTrashCan) + { + operationLog.info("The data set has been moved to the trashcan and the share will not be updated: " + dataSetCode); + return; + } else if (isDataSetDeleted) + { + operationLog.info("The data set has been deleted and the share will not be updated: " + dataSetCode); + return; + } else + { + throw new UserFailureException("Unknown data set, that has not been deleted, check for storage errors: " + dataSetCode); + } + } + ExternalDataPE externalData = dataSet.tryAsExternalData(); + if (externalData == null) + { + throw new UserFailureException("Can't update share id and size of a virtual data set: " + + dataSetCode); + } + // data sets consisting out of empty folders have a size of 0, + // but we want the size of a data set to be strictly positive + long positiveSize = Math.max(1, size); + externalData.setShareId(shareId); + externalData.setSize(positiveSize); + dataSetDAO.updateDataSet(dataSet, session.tryGetPerson()); + } + + @Override + @RolesAllowed(RoleWithHierarchy.SPACE_ETL_SERVER) + public void updateDataSetStatuses(String sessionToken, + @AuthorizationGuard(guardClass = DataSetCodeCollectionPredicate.class) List<String> dataSetCodes, final DataSetArchivingStatus newStatus, + boolean presentInArchive) throws UserFailureException + { + assert sessionToken != null : "Unspecified session token."; + final Session session = getSession(sessionToken); + final IDataBO dataBO = businessObjectFactory.createDataBO(session); + dataBO.updateStatuses(dataSetCodes, newStatus, presentInArchive); + } + + @Override + @RolesAllowed(RoleWithHierarchy.SPACE_ETL_SERVER) + public boolean compareAndSetDataSetStatus(String sessionToken, String dataSetCode, + DataSetArchivingStatus oldStatus, DataSetArchivingStatus newStatus, + boolean newPresentInArchive) throws UserFailureException + { + assert sessionToken != null : "Unspecified session token."; + final Session session = getSession(sessionToken); + final IDataBO dataBO = businessObjectFactory.createDataBO(session); + dataBO.loadByCode(dataSetCode); + return dataBO.compareAndSetDataSetStatus(oldStatus, newStatus, newPresentInArchive); + } + + @Override + @RolesAllowed(RoleWithHierarchy.SPACE_ETL_SERVER) + public int archiveDatasets(String sessionToken, + @AuthorizationGuard(guardClass = DataSetCodeCollectionPredicate.class) List<String> datasetCodes, boolean removeFromDataStore) + { + return super.archiveDatasets(sessionToken, datasetCodes, removeFromDataStore); + } + + @Override + @RolesAllowed(RoleWithHierarchy.SPACE_ETL_SERVER) + public int unarchiveDatasets(String sessionToken, + @AuthorizationGuard(guardClass = DataSetCodeCollectionPredicate.class) List<String> datasetCodes) + { + return super.unarchiveDatasets(sessionToken, datasetCodes); + } + + @Override + @RolesAllowed(value = { RoleWithHierarchy.SPACE_OBSERVER, RoleWithHierarchy.SPACE_ETL_SERVER }) + public IDatasetLocationNode tryGetDataSetLocation(String sessionToken, + @AuthorizationGuard(guardClass = DataSetCodePredicate.class) String dataSetCode) throws UserFailureException + { + assert sessionToken != null : "Unspecified session token."; + assert dataSetCode != null : "Unspecified data set code."; + + Session session = getSession(sessionToken); + IDatasetLister lister = businessObjectFactory.createDatasetLister(session); + return lister.listLocationsByDatasetCode(dataSetCode); + } + + @Override + @RolesAllowed(value = { RoleWithHierarchy.SPACE_OBSERVER, RoleWithHierarchy.SPACE_ETL_SERVER }) + public AbstractExternalData tryGetLocalDataSet(String sessionToken, String dataSetCode, + String dataStore) throws UserFailureException + { + AbstractExternalData dataSet = tryGetDataSet(sessionToken, dataSetCode); + if (dataSet != null && dataSet.getDataStore().getCode().equals(dataStore)) + { + return dataSet; + } + return null; + } + + @Override + @RolesAllowed(value = { RoleWithHierarchy.SPACE_OBSERVER, RoleWithHierarchy.SPACE_ETL_SERVER }) + public AbstractExternalData tryGetDataSet(String sessionToken, + @AuthorizationGuard(guardClass = DataSetCodePredicate.class) String dataSetCode) throws UserFailureException + { + assert sessionToken != null : "Unspecified session token."; + assert dataSetCode != null : "Unspecified data set code."; + + Session session = getSession(sessionToken); // assert authenticated + + IDataBO dataBO = businessObjectFactory.createDataBO(session); + dataBO.loadByCode(dataSetCode); + dataBO.enrichWithParentsAndExperiment(); + dataBO.enrichWithChildren(); + dataBO.enrichWithProperties(); + dataBO.enrichWithContainedDataSets(); + DataPE dataPE = dataBO.tryGetData(); + if (null == dataPE) + { + return null; + } + Collection<MetaprojectPE> metaprojects = + getDAOFactory().getMetaprojectDAO().listMetaprojectsForEntity( + session.tryGetPerson(), dataPE); + return DataSetTranslator.translate(dataPE, session.getBaseIndexURL(), + MetaprojectTranslator.translate(metaprojects), managedPropertyEvaluatorFactory); + } + + @Override + @RolesAllowed(value = { RoleWithHierarchy.SPACE_OBSERVER, RoleWithHierarchy.SPACE_ETL_SERVER }) + public AbstractExternalData tryGetThinDataSet(String sessionToken, String dataSetCode) throws UserFailureException + { + assert sessionToken != null : "Unspecified session token."; + assert dataSetCode != null : "Unspecified data set code."; + + Session session = getSession(sessionToken); // assert authenticated + + IDataBO dataBO = businessObjectFactory.createDataBO(session); + dataBO.loadByCode(dataSetCode); + DataPE dataPE = dataBO.tryGetData(); + if (null == dataPE) + { + return null; + } + return DataSetTranslator.translate(dataPE, session.getBaseIndexURL(), + Collections.<Metaproject> emptyList(), managedPropertyEvaluatorFactory); + } + + @Override + @RolesAllowed(RoleWithHierarchy.INSTANCE_ADMIN) + public void checkInstanceAdminAuthorization(String sessionToken) throws UserFailureException + { + checkSession(sessionToken); + // do nothing, the access rights specified in method annotations are checked by a proxy + } + + @Override + @RolesAllowed(RoleWithHierarchy.SPACE_POWER_USER) + public void checkSpacePowerUserAuthorization(String sessionToken) throws UserFailureException + { + checkSession(sessionToken); + // do nothing, the access rights specified in method annotations are checked by a proxy + } + + @Override + @RolesAllowed({ RoleWithHierarchy.SPACE_OBSERVER, RoleWithHierarchy.SPACE_ETL_SERVER }) + public void checkDataSetAccess(String sessionToken, + @AuthorizationGuard(guardClass = DataSetCodePredicate.class) String dataSetCode) throws UserFailureException + { + checkSession(sessionToken); + // do nothing, the access rights specified in method annotations are checked by a proxy + } + + @Override + @RolesAllowed({ RoleWithHierarchy.SPACE_OBSERVER, RoleWithHierarchy.SPACE_ETL_SERVER }) + public void checkDataSetCollectionAccess(String sessionToken, + @AuthorizationGuard(guardClass = DataSetCodeCollectionPredicate.class) List<String> dataSetCodes) + { + checkSession(sessionToken); + // do nothing, the access rights specified in method annotations are checked by a proxy + } + + @Override + @RolesAllowed(RoleWithHierarchy.SPACE_USER) + public void checkSpaceAccess(String sessionToken, + @AuthorizationGuard(guardClass = SpaceIdentifierPredicate.class) SpaceIdentifier spaceId) + { + checkSession(sessionToken); + // do nothing, the access rights specified in method annotations are checked by a proxy + } + + @Override + @RolesAllowed({ RoleWithHierarchy.SPACE_OBSERVER, RoleWithHierarchy.SPACE_ETL_SERVER }) + public List<Sample> listSamplesByCriteria(final String sessionToken, + @AuthorizationGuard(guardClass = ListSamplesByPropertyPredicate.class) + final ListSamplesByPropertyCriteria criteria) throws UserFailureException + { + assert sessionToken != null : "Unspecified session token."; + assert criteria != null : "Unspecified criteria."; + + Session session = getSession(sessionToken); + ISampleTable sampleTable = businessObjectFactory.createSampleTable(session); + sampleTable.loadSamplesByCriteria(criteria); + List<SamplePE> samples = sampleTable.getSamples(); + + final Collection<MetaprojectAssignmentPE> assignmentPEs = + getDAOFactory().getMetaprojectDAO().listMetaprojectAssignmentsForEntities( + session.tryGetPerson(), samples, EntityKind.SAMPLE); + Map<Long, Set<Metaproject>> assignments = + MetaprojectTranslator.translateMetaprojectAssignments(assignmentPEs); + + return SampleTranslator + .translate(samples, "", assignments, managedPropertyEvaluatorFactory); + } + + @Override + @RolesAllowed(RoleWithHierarchy.SPACE_ETL_SERVER) + public List<DataSetShareId> listShareIds(final String sessionToken, String dataStoreCode) + throws UserFailureException + { + Session session = getSession(sessionToken); + IDatasetLister datasetLister = businessObjectFactory.createDatasetLister(session); + DataStorePE dataStore = loadDataStore(session, dataStoreCode); + return datasetLister.listAllDataSetShareIdsByDataStore(dataStore.getId()); + } + + @Override + @RolesAllowed(RoleWithHierarchy.SPACE_ETL_SERVER) + public List<SimpleDataSetInformationDTO> listPhysicalDataSets(final String sessionToken, + String dataStoreCode) throws UserFailureException + { + final Session session = getSession(sessionToken); + final DataStorePE dataStore = loadDataStore(session, dataStoreCode); + final IDatasetLister datasetLister = businessObjectFactory.createDatasetLister(session); + final List<AbstractExternalData> dataSets = + datasetLister.listByDataStore(dataStore.getId(), + DATASET_FETCH_OPTIONS_FILE_DATASETS); + return SimpleDataSetHelper.filterAndTranslate(dataSets); + } + + @Override + @RolesAllowed(RoleWithHierarchy.SPACE_ETL_SERVER) + public List<SimpleDataSetInformationDTO> listOldestPhysicalDataSets(String sessionToken, + String dataStoreCode, int limit) throws UserFailureException + { + final Session session = getSession(sessionToken); + final DataStorePE dataStore = loadDataStore(session, dataStoreCode); + final IDatasetLister datasetLister = businessObjectFactory.createDatasetLister(session); + final List<AbstractExternalData> dataSets = + datasetLister.listByDataStore(dataStore.getId(), limit, + DATASET_FETCH_OPTIONS_FILE_DATASETS); + return SimpleDataSetHelper.filterAndTranslate(dataSets); + } + + @Override + @RolesAllowed(RoleWithHierarchy.SPACE_ETL_SERVER) + public List<SimpleDataSetInformationDTO> listOldestPhysicalDataSets(String sessionToken, + String dataStoreCode, Date youngerThan, int limit) throws UserFailureException + { + final Session session = getSession(sessionToken); + final DataStorePE dataStore = loadDataStore(session, dataStoreCode); + final IDatasetLister datasetLister = businessObjectFactory.createDatasetLister(session); + final List<AbstractExternalData> dataSets = + datasetLister.listByDataStore(dataStore.getId(), youngerThan, limit, + DATASET_FETCH_OPTIONS_FILE_DATASETS); + return SimpleDataSetHelper.filterAndTranslate(dataSets); + } + + @Override + @RolesAllowed(RoleWithHierarchy.SPACE_ETL_SERVER) + public List<SimpleDataSetInformationDTO> listPhysicalDataSetsWithUnknownSize(String sessionToken, String dataStoreCode, int chunkSize, + String dataSetCodeLowerLimit) + { + final Session session = getSession(sessionToken); + final DataStorePE dataStore = loadDataStore(session, dataStoreCode); + final IDatasetLister datasetLister = businessObjectFactory.createDatasetLister(session); + final List<AbstractExternalData> dataSets = + datasetLister.listByDataStoreWithUnknownSize(dataStore.getId(), chunkSize, dataSetCodeLowerLimit, + DATASET_FETCH_OPTIONS_FILE_DATASETS); + return SimpleDataSetHelper.filterAndTranslate(dataSets); + } + + @Override + @RolesAllowed(RoleWithHierarchy.SPACE_ETL_SERVER) + public void updatePhysicalDataSetsSize(String sessionToken, Map<String, Long> sizeMap) + { + assert sessionToken != null : "Unspecified session token."; + final Session session = getSession(sessionToken); + final IDataBO dataBO = businessObjectFactory.createDataBO(session); + dataBO.updateSizes(sizeMap); + } + + @Override + @RolesAllowed(RoleWithHierarchy.SPACE_ETL_SERVER) + public List<AbstractExternalData> listAvailableDataSets(String sessionToken, + String dataStoreCode, ArchiverDataSetCriteria criteria) + { + Session session = getSession(sessionToken); + final IDatasetLister datasetLister = createDatasetLister(session); + return datasetLister.listByArchiverCriteria(dataStoreCode, criteria); + } + + @Override + @RolesAllowed(RoleWithHierarchy.SPACE_ETL_SERVER) + public List<AbstractExternalData> listDataSets(String sessionToken, String dataStoreCode, + TrackingDataSetCriteria criteria) + { + Session session = getSession(sessionToken); + DataStorePE dataStore = + getDAOFactory().getDataStoreDAO().tryToFindDataStoreByCode(dataStoreCode); + if (dataStore == null) + { + throw new UserFailureException("Unknown data store: " + dataStoreCode); + } + final IDatasetLister datasetLister = createDatasetLister(session); + List<AbstractExternalData> allDataSets = datasetLister.listByTrackingCriteria(criteria); + List<AbstractExternalData> result = new ArrayList<AbstractExternalData>(); + for (AbstractExternalData externalData : allDataSets) + { + if (dataStoreCode.equals(externalData.getDataStore().getCode())) + { + result.add(externalData); + } + } + return result; + } + + private DataStorePE loadDataStore(Session session, String dataStoreCode) + { + DataStorePE dataStore = + getDAOFactory().getDataStoreDAO().tryToFindDataStoreByCode(dataStoreCode); + if (dataStore == null) + { + throw new UserFailureException(String.format("Unknown data store '%s'", dataStoreCode)); + } + return dataStore; + } + + @Override + @RolesAllowed(RoleWithHierarchy.SPACE_ETL_SERVER) + public List<DeletedDataSet> listDeletedDataSets(String sessionToken, + Long lastSeenDeletionEventIdOrNull, Date maxDeletionDataOrNull) + { + checkSession(sessionToken); + return getDAOFactory().getEventDAO().listDeletedDataSets(lastSeenDeletionEventIdOrNull, + maxDeletionDataOrNull); + } + + @Override + @RolesAllowed(RoleWithHierarchy.SPACE_ETL_SERVER) + public Collection<VocabularyTerm> listVocabularyTerms(String sessionToken, String vocabularyCode) + throws UserFailureException + { + checkSession(sessionToken); + VocabularyPE vocabularyOrNull = + getDAOFactory().getVocabularyDAO().tryFindVocabularyByCode(vocabularyCode); + if (vocabularyOrNull == null) + { + throw new UserFailureException(String.format("Vocabulary '%s' not found", + vocabularyCode)); + } + return VocabularyTermTranslator.translateTerms(vocabularyOrNull.getTerms()); + } + + @Override + @RolesAllowed(RoleWithHierarchy.SPACE_ETL_SERVER) + public Vocabulary tryGetVocabulary(String sessionToken, String vocabularyCode) + { + checkSession(sessionToken); + VocabularyPE vocabularyOrNull = + getDAOFactory().getVocabularyDAO().tryFindVocabularyByCode(vocabularyCode); + + if (vocabularyOrNull == null) + { + return null; + } else + { + return VocabularyTranslator.translate(vocabularyOrNull, true); + } + } + + @Override + @RolesAllowed(RoleWithHierarchy.SPACE_ETL_SERVER) + public List<String> generateCodes(String sessionToken, String prefix, + ch.systemsx.cisd.openbis.generic.shared.basic.dto.EntityKind entityKind, int number) + { + checkSession(sessionToken); + return new EntityCodeGenerator(daoFactory).generateCodes(prefix, entityKind, number); + } + + @Override + @RolesAllowed(RoleWithHierarchy.SPACE_ETL_SERVER) + public List<Person> listAdministrators(String sessionToken) + { + checkSession(sessionToken); + // Get all Persons in the DB + final List<PersonPE> persons = getDAOFactory().getPersonDAO().listPersons(); + + // Filter down to the admins + ArrayList<PersonPE> admins = new ArrayList<PersonPE>(); + for (PersonPE person : persons) + { + for (final RoleAssignmentPE roleAssigment : person.getRoleAssignments()) + { + if (roleAssigment.getSpace() == null + && roleAssigment.getRole().equals(RoleCode.ADMIN)) + { + admins.add(person); + } + } + } + Collections.sort(admins); + return PersonTranslator.translate(admins); + } + + @Override + @RolesAllowed(RoleWithHierarchy.SPACE_ETL_SERVER) + public Person tryPersonWithUserIdOrEmail(String sessionToken, String useridOrEmail) + { + checkSession(sessionToken); + + PersonPE personPE = tryFindPersonForUserIdOrEmail(useridOrEmail); + return (null != personPE) ? PersonTranslator.translate(personPE) : null; + } + + private PersonPE tryFindPersonForUserIdOrEmail(String userIdOrEmail) + { + if (userIdOrEmail == null) + { + return null; + } + + // First search for a userId match + IPersonDAO personDao = getDAOFactory().getPersonDAO(); + PersonPE person = personDao.tryFindPersonByUserId(userIdOrEmail); + if (null != person) + { + return person; + } + // Didn't find one -- try email + return personDao.tryFindPersonByEmail(userIdOrEmail); + } + + @Override + @RolesAllowed(RoleWithHierarchy.SPACE_ETL_SERVER) + public Sample registerSampleAndDataSet(final String sessionToken, + @AuthorizationGuard(guardClass = NewSamplePredicate.class) + final NewSample newSample, final NewExternalData externalData, String userIdOrNull) + throws UserFailureException + { + assert sessionToken != null : "Unspecified session token."; + assert newSample != null : "Unspecified new sample."; + + // Register the Sample + final Session session = getSession(sessionToken); + SamplePE samplePE = registerSampleInternal(session, newSample, userIdOrNull); + + // Register the data set + registerDataSetInternal(getSession(sessionToken), samplePE, externalData, new DataSetRegistrationCache()); + Sample result = + SampleTranslator.translate(samplePE, session.getBaseIndexURL(), null, + managedPropertyEvaluatorFactory); + return result; + } + + @Override + @RolesAllowed(RoleWithHierarchy.SPACE_ETL_SERVER) + public Sample updateSampleAndRegisterDataSet(String sessionToken, + @AuthorizationGuard(guardClass = SampleUpdatesPredicate.class) SampleUpdatesDTO updates, NewExternalData externalData) + { + final Session session = getSession(sessionToken); + + // Update the sample + final ISampleBO sampleBO = updateSampleInternal(updates, session); + + // Register the data set + final SamplePE samplePE = sampleBO.getSample(); + registerDataSetInternal(getSession(sessionToken), samplePE, externalData, new DataSetRegistrationCache()); + + Collection<MetaprojectPE> metaprojectPEs = + getDAOFactory().getMetaprojectDAO().listMetaprojectsForEntity( + session.tryGetPerson(), samplePE); + + Sample result = + SampleTranslator.translate(samplePE, session.getBaseIndexURL(), + MetaprojectTranslator.translate(metaprojectPEs), + managedPropertyEvaluatorFactory); + return result; + } + + private ISampleBO updateSampleInternal(SampleUpdatesDTO updates, final Session session) + { + final ISampleBO sampleBO = businessObjectFactory.createSampleBO(session); + sampleBO.update(updates); + sampleBO.save(); + + return sampleBO; + } + + private SamplePE registerSampleInternal(Session session, NewSample newSample, + String userIdOrNull) + { + final ISampleBO sampleBO = businessObjectFactory.createSampleBO(session); + sampleBO.define(newSample); + if (userIdOrNull != null) + { + sampleBO.getSample().setRegistrator( + getOrCreatePerson(session.getSessionToken(), userIdOrNull)); + } + sampleBO.save(); + SamplePE samplePE = sampleBO.getSample(); + return samplePE; + } + + @Override + @RolesAllowed(value = { RoleWithHierarchy.SPACE_ETL_SERVER }) + public Space tryGetSpace(String sessionToken, + @AuthorizationGuard(guardClass = ExistingSpaceIdentifierPredicate.class) SpaceIdentifier spaceIdentifier) + { + + Session session = getSession(sessionToken); + ISpaceBO spaceBO = businessObjectFactory.createSpaceBO(session); + SpaceIdentifier identifier = + new SpaceIdentifier(spaceIdentifier.getSpaceCode()); + try + { + spaceBO.load(identifier); + return SpaceTranslator.translate(spaceBO.getSpace()); + } catch (UserFailureException ufe) + { + // space does not exist + return null; + } + } + + @Override + @RolesAllowed(value = { RoleWithHierarchy.SPACE_ETL_SERVER }) + public Project tryGetProject(String sessionToken, + @AuthorizationGuard(guardClass = ExistingSpaceIdentifierPredicate.class) ProjectIdentifier projectIdentifier) + { + final Session session = getSession(sessionToken); + final IProjectBO bo = businessObjectFactory.createProjectBO(session); + try + { + bo.loadByProjectIdentifier(projectIdentifier); + final ProjectPE project = bo.getProject(); + return ProjectTranslator.translate(project); + } catch (UserFailureException ufe) + { + // project does not exist + return null; + } + } + + @Override + @RolesAllowed(value = { RoleWithHierarchy.SPACE_ETL_SERVER }) + public Project tryGetProjectByPermId(String sessionToken, @AuthorizationGuard(guardClass = ProjectPermIdPredicate.class) PermId permId) + throws UserFailureException + { + final Session session = getSession(sessionToken); + final IProjectBO bo = businessObjectFactory.createProjectBO(session); + try + { + bo.loadByPermId(permId.getId()); + final ProjectPE project = bo.getProject(); + return ProjectTranslator.translate(project); + } catch (UserFailureException ufe) + { + // project does not exist + return null; + } + } + + @Override + @RolesAllowed(RoleWithHierarchy.SPACE_ETL_SERVER) + public Material tryGetMaterial(String sessionToken, MaterialIdentifier materialIdentifier) + { + final Session session = getSession(sessionToken); + final IMaterialBO bo = businessObjectFactory.createMaterialBO(session); + try + { + bo.loadByMaterialIdentifier(materialIdentifier); + bo.enrichWithProperties(); + MaterialPE materialPE = bo.getMaterial(); + Collection<MetaprojectPE> metaprojectPEs = Collections.emptySet(); + if (materialPE != null) + { + metaprojectPEs = + getDAOFactory().getMetaprojectDAO().listMetaprojectsForEntity( + session.tryGetPerson(), materialPE); + } + return MaterialTranslator.translate(materialPE, + MetaprojectTranslator.translate(metaprojectPEs), + managedPropertyEvaluatorFactory); + } catch (UserFailureException ufe) + { + // material does not exist + return null; + } + } + + @Override + @RolesAllowed(RoleWithHierarchy.SPACE_ETL_SERVER) + public Metaproject tryGetMetaproject(String sessionToken, String name, String ownerId) + { + final Session session = getSession(sessionToken); + final IMetaprojectBO bo = businessObjectFactory.createMetaprojectBO(session); + + MetaprojectPE pe = bo.tryFindByMetaprojectId(new MetaprojectIdentifierId(ownerId, name)); + + if (pe == null) + { + return null; + } else + { + return MetaprojectTranslator.translate(pe); + } + } + + @Override + @RolesAllowed(RoleWithHierarchy.SPACE_ETL_SERVER) + public AtomicEntityOperationResult performEntityOperations(String sessionToken, + @AuthorizationGuard(guardClass = AtomicOperationsPredicate.class) AtomicEntityOperationDetails operationDetails) + { + IServiceConversationProgressListener progressListener = + ServiceConversationsThreadContext.getProgressListener(); + + TechId registrationId = operationDetails.getRegistrationIdOrNull(); + + EntityOperationsInProgress.getInstance().addRegistrationPending(registrationId); + + String sessionTokenForEntityOperation = null; + try + { + final Session session = getSession(sessionToken); + final String userId = operationDetails.tryUserIdOrNull(); + boolean authorize = (userId != null); + Session sessionForEntityOperation = session; + if (authorize) + { + sessionTokenForEntityOperation = + sessionManagerForEntityOperation.tryToOpenSession(userId, "dummy password"); + sessionForEntityOperation = + sessionManagerForEntityOperation.getSession(sessionTokenForEntityOperation); + injectPerson(sessionForEntityOperation, userId); + } + + long spacesCreated = + createSpaces(sessionForEntityOperation, operationDetails, progressListener, + authorize); + + long materialsCreated = + createMaterials(sessionForEntityOperation, operationDetails, progressListener, + authorize); + + long projectsCreated = + createProjects(sessionForEntityOperation, operationDetails, progressListener, + authorize); + + long projectsUpdated = + updateProjects(sessionForEntityOperation, operationDetails, progressListener, + authorize); + + long vocabulariesUpdated = + updateVocabularies(sessionForEntityOperation, operationDetails, + progressListener, authorize); + + long experimentsCreated = + createExperiments(sessionForEntityOperation, operationDetails, + progressListener, authorize); + + long experimentsUpdates = + updateExperiments(sessionForEntityOperation, operationDetails, + progressListener, authorize); + + long samplesCreated = + createSamples(sessionForEntityOperation, operationDetails, progressListener, + authorize); + + long samplesUpdated = + updateSamples(sessionForEntityOperation, operationDetails, progressListener, + authorize); + + long dataSetsCreated = createDataSetsV3(sessionForEntityOperation, operationDetails, progressListener, authorize); + + long dataSetsUpdated = + updateDataSets(sessionForEntityOperation, operationDetails, progressListener, + authorize); + + long materialsUpdates = + updateMaterials(sessionForEntityOperation, operationDetails, progressListener, + authorize); + + long metaprojectsCreated = + createMetaprojects(sessionForEntityOperation, operationDetails, + progressListener, authorize); + + long metaprojectsUpdates = + updateMetaprojects(sessionForEntityOperation, operationDetails, + progressListener, authorize); + + long spaceRolesAssigned = assignSpaceRoles(sessionForEntityOperation, operationDetails, progressListener, authorize); + + long spaceRolesRevoked = revokeSpaceRoles(sessionForEntityOperation, operationDetails, progressListener, authorize); + + // If the id is not null, the caller wants to persist the fact that the operation was + // invoked and completed; + // if the id is null, the caller does not care. + if (null != registrationId) + { + daoFactory.getEntityOperationsLogDAO().addLogEntry(registrationId.getId()); + } + + return new AtomicEntityOperationResult(spacesCreated, projectsCreated, projectsUpdated, + materialsCreated, materialsUpdates, experimentsCreated, experimentsUpdates, + samplesCreated, samplesUpdated, dataSetsCreated, dataSetsUpdated, + metaprojectsCreated, metaprojectsUpdates, vocabulariesUpdated, spaceRolesAssigned, spaceRolesRevoked); + } catch (org.hibernate.StaleObjectStateException e) + { + throw new UserFailureException("The operation has failed due to conflict with simultanous operations."); + } finally + { + EntityOperationsInProgress.getInstance().removeRegistrationPending(registrationId); + if (sessionTokenForEntityOperation != null) + { + sessionManagerForEntityOperation.closeSession(sessionTokenForEntityOperation); + } + try + { + daoFactory.getSessionFactory().getCurrentSession().flush(); + } catch (Exception e) + { + } + } + } + + @Override + @RolesAllowed(RoleWithHierarchy.SPACE_ETL_SERVER) + public EntityOperationsState didEntityOperationsSucceed(String token, TechId registrationId) + { + if (registrationId == null) + { + return EntityOperationsState.NO_OPERATION; + } + + if (EntityOperationsInProgress.getInstance().isRegistrationPending(registrationId)) + { + return EntityOperationsState.IN_PROGRESS; + } + + EntityOperationsLogEntryPE logEntry = + daoFactory.getEntityOperationsLogDAO().tryFindLogEntry(registrationId.getId()); + + if (logEntry != null) + { + return EntityOperationsState.OPERATION_SUCCEEDED; + } else + { + return EntityOperationsState.NO_OPERATION; + } + } + + private long createSpaces(Session session, AtomicEntityOperationDetails operationDetails, + IServiceConversationProgressListener progress, boolean authorize) + { + ArrayList<SpacePE> spacePEsCreated = new ArrayList<SpacePE>(); + List<NewSpace> newSpaces = operationDetails.getSpaceRegistrations(); + if (authorize) + { + checkSpaceCreationAllowed(session, newSpaces); + } + + int index = 0; + for (NewSpace newSpace : newSpaces) + { + SpacePE spacePE = + registerSpaceInternal(session, newSpace, operationDetails.tryUserIdOrNull()); + spacePEsCreated.add(spacePE); + progress.update("createSpaces", newSpaces.size(), ++index); + } + return index; + } + + protected void checkSpaceCreationAllowed(Session session, List<NewSpace> newSpaces) + { + if (newSpaces != null && newSpaces.isEmpty() == false) + { + entityOperationChecker.assertSpaceCreationAllowed(session, newSpaces); + } + } + + protected void checkSpaceRoleAssignmentAllowed(Session session, SpaceIdentifier space) + { + entityOperationChecker.assertSpaceRoleAssignmentAllowed(session, space); + } + + private long updateVocabularies(Session session, AtomicEntityOperationDetails operationDetails, + IServiceConversationProgressListener progress, boolean authorize) + { + + List<VocabularyUpdatesDTO> updates = operationDetails.getVocabularyUpdates(); + + for (VocabularyUpdatesDTO update : updates) + { + updateVocabulary(session, update); + } + + return updates.size(); + } + + private void updateVocabulary(Session session, VocabularyUpdatesDTO updates) + { + final IVocabularyBO vocabularyBO = businessObjectFactory.createVocabularyBO(session); + vocabularyBO.update(updates); + } + + private long createMaterials(Session session, AtomicEntityOperationDetails operationDetails, + IServiceConversationProgressListener progress, boolean authorize) + { + MaterialHelper materialHelper = + new MaterialHelper(session, businessObjectFactory, getDAOFactory(), + getPropertiesBatchManager(), managedPropertyEvaluatorFactory); + Map<String, List<NewMaterial>> materialRegs = operationDetails.getMaterialRegistrations(); + if (authorize) + { + checkMaterialCreationAllowed(session, materialRegs); + } + + List<NewMaterialWithType> materials = materialHelper.convertMaterialRegistrationIntoMaterialsWithType(materialRegs); + + Map<String, Set<String>> materialTypesWithMateiralProperties = materialHelper.getPropertyTypesOfMaterialType(materialRegs.keySet()); + + List<List<NewMaterialWithType>> materialGroups = MaterialGroupingDAG.groupByDepencies(materials, materialTypesWithMateiralProperties); + int index = 0; + + for (List<NewMaterialWithType> materialsGroup : materialGroups) + { + materialHelper.registerMaterials(materialsGroup); + progress.update("createMaterials", materialRegs.size(), ++index); + } + return index; + } + + private long updateMaterials(Session session, AtomicEntityOperationDetails operationDetails, + IServiceConversationProgressListener progress, boolean authorize) + { + MaterialHelper materialHelper = + new MaterialHelper(session, businessObjectFactory, getDAOFactory(), + getPropertiesBatchManager(), managedPropertyEvaluatorFactory); + + List<MaterialUpdateDTO> allMaterialUpdates = operationDetails.getMaterialUpdates(); + + if (authorize) + { + checkMaterialUpdateAllowed(session, allMaterialUpdates); + } + + materialHelper.updateMaterials(allMaterialUpdates); + + // in material helper call the update of materials - but this has to wait fo change of the + // material updates to a map + return allMaterialUpdates.size(); + } + + protected void checkMaterialCreationAllowed(Session session, + Map<String, List<NewMaterial>> materials) + { + if (materials != null && materials.isEmpty() == false) + { + entityOperationChecker.assertMaterialCreationAllowed(session, materials); + } + } + + protected void checkMaterialUpdateAllowed(Session session, + List<MaterialUpdateDTO> materialUpdates) + { + if (materialUpdates != null && materialUpdates.isEmpty() == false) + { + entityOperationChecker.assertMaterialUpdateAllowed(session, materialUpdates); + } + } + + private long updateMetaprojects(Session session, AtomicEntityOperationDetails operationDetails, + IServiceConversationProgressListener progress, boolean authorize) + { + List<MetaprojectUpdatesDTO> updates = operationDetails.getMetaprojectUpdates(); + + for (MetaprojectUpdatesDTO update : updates) + { + updateMetaprojects(session, update); + } + + return updates.size(); + } + + private void updateMetaprojects(Session session, MetaprojectUpdatesDTO update) + { + IMetaprojectBO metaprojectBO = businessObjectFactory.createMetaprojectBO(session); + metaprojectBO.loadDataByTechId(update.getMetaprojectId()); + + Metaproject updates = new Metaproject(); + updates.setName(metaprojectBO.getMetaproject().getName()); + updates.setDescription(update.getDescription()); + metaprojectBO.update(updates); + + metaprojectBO.addSamples(update.getAddedSamples()); + metaprojectBO.removeSamples(update.getRemovedSamples()); + metaprojectBO.addDataSets(update.getAddedDataSets()); + metaprojectBO.removeDataSets(update.getRemovedDataSets()); + metaprojectBO.addExperiments(update.getAddedExperiments()); + metaprojectBO.removeExperiments(update.getRemovedExperiments()); + metaprojectBO.addMaterials(update.getAddedMaterials()); + metaprojectBO.removeMaterials(update.getRemovedMaterials()); + + metaprojectBO.save(); + } + + private long assignSpaceRoles(Session session, AtomicEntityOperationDetails operationDetails, + IServiceConversationProgressListener progressListener, boolean authorize) + { + // see also ch.systemsx.cisd.openbis.generic.server.CommonServer.registerSpaceRole(String, RoleCode, SpaceIdentifier, Grantee) + List<SpaceRoleAssignment> spaceRoleAssignments = operationDetails.getSpaceRoleAssignments(); + int index = 0; + int assignmentCount = 0; + for (SpaceRoleAssignment assignment : spaceRoleAssignments) + { + assignmentCount += assignment.getGrantees().size(); + } + + if (assignmentCount < 1) + { + return assignmentCount; + } + + final IRoleAssignmentTable table = businessObjectFactory.createRoleAssignmentTable(session); + + for (SpaceRoleAssignment assignment : spaceRoleAssignments) + { + RoleCode roleCode = assignment.getRoleCode(); + SpaceIdentifier space = assignment.getSpaceIdentifier(); + if (authorize) + { + checkSpaceRoleAssignmentAllowed(session, space); + } + for (Grantee grantee : assignment.getGrantees()) + { + final NewRoleAssignment newRoleAssignment = new NewRoleAssignment(); + newRoleAssignment.setGrantee(grantee); + newRoleAssignment.setSpaceIdentifier(space); + newRoleAssignment.setRole(roleCode); + + table.add(newRoleAssignment); + progressListener.update("assignSpaceRole", assignmentCount, ++index); + } + } + + table.save(); + return index; + } + + private long revokeSpaceRoles(Session session, AtomicEntityOperationDetails operationDetails, + IServiceConversationProgressListener progressListener, boolean authorize) + { + // see also ch.systemsx.cisd.openbis.generic.server.CommonServer.deleteSpaceRole(String, RoleCode, SpaceIdentifier, Grantee) + // Did not refactor the above method to share code for fear of making merges to the release branch difficult + List<SpaceRoleAssignment> spaceRoleRevocations = operationDetails.getSpaceRoleRevocations(); + int index = 0; + int assignmentCount = 0; + for (SpaceRoleAssignment assignment : spaceRoleRevocations) + { + assignmentCount += assignment.getGrantees().size(); + } + + if (assignmentCount < 1) + { + return assignmentCount; + } + + for (SpaceRoleAssignment assignment : spaceRoleRevocations) + { + RoleCode roleCode = assignment.getRoleCode(); + SpaceIdentifier space = assignment.getSpaceIdentifier(); + for (Grantee grantee : assignment.getGrantees()) + { + final RoleAssignmentPE roleAssignment = + getDAOFactory().getRoleAssignmentDAO().tryFindSpaceRoleAssignment(roleCode, + space.getSpaceCode(), grantee); + if (roleAssignment == null) + { + throw new UserFailureException("Given space role does not exist."); + } + final PersonPE personPE = session.tryGetPerson(); + if (roleAssignment.getPerson() != null && roleAssignment.getPerson().equals(personPE) + && roleAssignment.getRole().equals(RoleCode.ADMIN)) + { + boolean isInstanceAdmin = false; + for (final RoleAssignmentPE roleAssigment : personPE.getRoleAssignments()) + { + if (roleAssigment.getSpace() == null + && roleAssigment.getRole().equals(RoleCode.ADMIN)) + { + isInstanceAdmin = true; + } + } + if (isInstanceAdmin == false) + { + throw new UserFailureException( + "For safety reason you cannot give away your own space admin power. " + + "Ask instance admin to do that for you."); + } + } + getDAOFactory().getRoleAssignmentDAO().deleteRoleAssignment(roleAssignment); + progressListener.update("revokeSpaceRole", assignmentCount, ++index); + } + } + + return index; + } + + private long createMetaprojects(Session session, AtomicEntityOperationDetails operationDetails, + IServiceConversationProgressListener progress, boolean authorize) + { + final List<NewMetaproject> metaprojectRegistrations = + operationDetails.getMetaprojectRegistrations(); + int index = 0; + for (NewMetaproject metaproject : metaprojectRegistrations) + { + registerMetaproject(session, metaproject); + progress.update("createMetaProjects", metaprojectRegistrations.size(), ++index); + } + return index; + } + + private MetaprojectPE registerMetaproject(final Session session, NewMetaproject metaproject) + { + IMetaprojectBO metaprojectBO = businessObjectFactory.createMetaprojectBO(session); + + Metaproject registration = new Metaproject(); + registration.setName(metaproject.getName()); + registration.setDescription(metaproject.getDescription()); + metaprojectBO.define(metaproject.getOwnerId(), registration); + + metaprojectBO.addSamples(metaproject.getSamples()); + metaprojectBO.addExperiments(metaproject.getExperiments()); + metaprojectBO.addMaterials(metaproject.getMaterials()); + metaprojectBO.addDataSets(metaproject.getDatasets()); + metaprojectBO.save(); + return metaprojectBO.getMetaproject(); + } + + private SpacePE registerSpaceInternal(Session session, NewSpace newSpace, + String registratorUserIdOrNull) + { + // create space + ISpaceBO groupBO = businessObjectFactory.createSpaceBO(session); + groupBO.define(newSpace.getCode(), newSpace.getDescription()); + SpacePE space = groupBO.getSpace(); + + if (registratorUserIdOrNull != null) + { + space.setRegistrator( + getOrCreatePerson(session.getSessionToken(), registratorUserIdOrNull)); + } + groupBO.save(); + + // create ADMIN role assignemnt + if (newSpace.getSpaceAdminUserId() != null) + { + IRoleAssignmentTable roleTable = + businessObjectFactory.createRoleAssignmentTable(session); + NewRoleAssignment assignment = new NewRoleAssignment(); + SpaceIdentifier spaceIdentifier = new SpaceIdentifier(space.getCode()); + assignment.setSpaceIdentifier(spaceIdentifier); + assignment.setRole(RoleCode.ADMIN); + Grantee grantee = Grantee.createPerson(newSpace.getSpaceAdminUserId()); + assignment.setGrantee(grantee); + roleTable.add(assignment); + roleTable.save(); + } + return space; + + } + + private long createProjects(Session session, AtomicEntityOperationDetails operationDetails, + IServiceConversationProgressListener progress, boolean authorize) + { + ArrayList<ProjectPE> projectPEsCreated = new ArrayList<ProjectPE>(); + List<NewProject> newProjects = operationDetails.getProjectRegistrations(); + if (authorize) + { + checkProjectCreationAllowed(session, newProjects); + } + int index = 0; + for (NewProject newProject : newProjects) + { + ProjectPE projectPE = + registerProjectInternal(session, newProject, operationDetails.tryUserIdOrNull()); + projectPEsCreated.add(projectPE); + progress.update("createProjects", newProjects.size(), ++index); + } + return index; + } + + protected void checkProjectCreationAllowed(Session session, List<NewProject> newProjects) + { + if (newProjects != null && newProjects.isEmpty() == false) + { + entityOperationChecker.assertProjectCreationAllowed(session, newProjects); + } + } + + private ProjectPE registerProjectInternal(Session session, NewProject newProject, + String registratorUserIdOrNull) + { + IProjectBO projectBO = businessObjectFactory.createProjectBO(session); + ProjectIdentifier identifier = + new ProjectIdentifierFactory(newProject.getIdentifier()).createIdentifier(); + projectBO + .define(identifier, newProject.getDescription(), newProject.getAttachments(), null); + if (registratorUserIdOrNull != null) + { + projectBO.getProject().setRegistrator( + getOrCreatePerson(session.getSessionToken(), registratorUserIdOrNull)); + } + projectBO.save(); + + return projectBO.getProject(); + } + + private long updateProjects(Session session, AtomicEntityOperationDetails operationDetails, + IServiceConversationProgressListener progress, boolean authorize) + { + ArrayList<ProjectPE> projectPEsUpdated = new ArrayList<ProjectPE>(); + List<ProjectUpdatesDTO> projectsToUpdate = operationDetails.getProjectUpdates(); + if (authorize) + { + checkProjectUpdateAllowed(session, projectsToUpdate); + } + int index = 0; + for (ProjectUpdatesDTO project : projectsToUpdate) + { + ProjectPE projectPE = + updateProjectInternal(session, project, operationDetails.tryUserIdOrNull()); + projectPEsUpdated.add(projectPE); + progress.update("updateProjects", projectsToUpdate.size(), ++index); + } + return index; + } + + protected void checkProjectUpdateAllowed(Session session, + List<ProjectUpdatesDTO> projectsToUpdate) + { + if (projectsToUpdate != null && projectsToUpdate.isEmpty() == false) + { + entityOperationChecker.assertProjectUpdateAllowed(session, projectsToUpdate); + } + } + + private ProjectPE updateProjectInternal(Session session, ProjectUpdatesDTO projectToUpdate, + String registratorUserIdOrNull) + { + IProjectBO projectBO = businessObjectFactory.createProjectBO(session); + if (projectToUpdate.getTechId() != null) + { + projectBO.loadDataByTechId(projectToUpdate.getTechId()); + } else if (projectToUpdate.getPermId() != null) + { + projectBO.loadByPermId(projectToUpdate.getPermId()); + } else + { + ProjectIdentifier identifier = + new ProjectIdentifierFactory(projectToUpdate.getIdentifier()).createIdentifier(); + projectBO.loadByProjectIdentifier(identifier); + } + projectBO.update(projectToUpdate); + if (registratorUserIdOrNull != null) + { + projectBO.getProject().setModifier( + getOrCreatePerson(session.getSessionToken(), registratorUserIdOrNull)); + } + projectBO.save(); + + return projectBO.getProject(); + } + + private long createSamples(Session session, AtomicEntityOperationDetails operationDetails, + IServiceConversationProgressListener progress, boolean authorize) + { + List<NewSample> newSamples = operationDetails.getSampleRegistrations(); + + if (authorize) + { + authorizeSampleCreation(session, newSamples); + } + String userIdOrNull = operationDetails.tryUserIdOrNull(); + PersonPE registratorOrNull = tryFindPersonForUserIdOrEmail(userIdOrNull); + final ISampleTable sampleTable = businessObjectFactory.createSampleTable(session); + + List<List<NewSample>> sampleGroups = splitIntoDependencyGroups(newSamples); + + for (List<NewSample> groupOfSamples : sampleGroups) + { + BatchOperationExecutor.executeInBatches(new SampleBatchRegistration(sampleTable, + groupOfSamples, registratorOrNull), getBatchSize(operationDetails), progress, + "createContainerSamples"); + } + return newSamples.size(); + } + + /** + * Splits the samples using the grouping dag into groups, that can be executed in batches one after another, that samples in later batches depend + * only on the samples from earlier batches + */ + private List<List<NewSample>> splitIntoDependencyGroups(List<NewSample> newSamples) + { + return SampleGroupingDAG.groupByDepencies(newSamples); + } + + private void authorizeSampleCreation(Session session, List<NewSample> newSamples) + { + List<NewSample> instanceSamples = new ArrayList<NewSample>(); + List<NewSample> spaceSamples = new ArrayList<NewSample>(); + + for (NewSample newSample : newSamples) + { + SampleIdentifier sampleIdentifier = SampleIdentifierFactory.parse(newSample); + if (sampleIdentifier.isDatabaseInstanceLevel()) + { + instanceSamples.add(newSample); + } else + { + spaceSamples.add(newSample); + } + } + + checkInstanceSampleCreationAllowed(session, instanceSamples); + checkSpaceSampleCreationAllowed(session, spaceSamples); + } + + private void checkInstanceSampleCreationAllowed(Session session, List<NewSample> instanceSamples) + { + if (instanceSamples.isEmpty() == false) + { + entityOperationChecker.assertInstanceSampleCreationAllowed(session, instanceSamples); + } + } + + private void checkSpaceSampleCreationAllowed(Session session, List<NewSample> spaceSamples) + { + if (spaceSamples.isEmpty() == false) + { + entityOperationChecker.assertSpaceSampleCreationAllowed(session, spaceSamples); + } + } + + private long updateSamples(final Session session, + AtomicEntityOperationDetails operationDetails, + IServiceConversationProgressListener progress, boolean authorize) + { + List<SampleUpdatesDTO> sampleUpdates = operationDetails.getSampleUpdates(); + int sampleUpdateCount = sampleUpdates.size(); + if (sampleUpdateCount < 1) + { + return 0; + } + progress.update("authorizingSampleUpdates", sampleUpdateCount, 0); + if (authorize) + { + checkSampleUpdatesAllowed(session, sampleUpdates); + } + progress.update("authorizingSampleUpdates", sampleUpdateCount, sampleUpdateCount); + final ISampleTable sampleTable = businessObjectFactory.createSampleTable(session); + + BatchOperationExecutor.executeInBatches(new SampleCheckBeforeUpdate(sampleTable, + sampleUpdates), getBatchSize(operationDetails), progress, + "checkSamplesBeforeUpdate"); + + BatchOperationExecutor.executeInBatches(new SampleUpdate(sampleTable, sampleUpdates), + getBatchSize(operationDetails), progress, "updateSamples"); + + return sampleUpdateCount; + } + + private void checkSampleUpdatesAllowed(final Session session, + List<SampleUpdatesDTO> sampleUpdates) + { + List<SampleUpdatesDTO> instanceSamples = new ArrayList<SampleUpdatesDTO>(); + List<SampleUpdatesDTO> spaceSamples = new ArrayList<SampleUpdatesDTO>(); + for (SampleUpdatesDTO sampleUpdate : sampleUpdates) + { + SampleIdentifier sampleIdentifier = sampleUpdate.getSampleIdentifier(); + if (sampleIdentifier.isDatabaseInstanceLevel()) + { + instanceSamples.add(sampleUpdate); + } else + { + spaceSamples.add(sampleUpdate); + } + } + checkInstanceSampleUpdateAllowed(session, instanceSamples); + checkSpaceSampleUpdateAllowed(session, spaceSamples); + } + + private void checkInstanceSampleUpdateAllowed(Session session, + List<SampleUpdatesDTO> instanceSamples) + { + if (instanceSamples.isEmpty() == false) + { + entityOperationChecker.assertInstanceSampleUpdateAllowed(session, instanceSamples); + } + } + + private void checkSpaceSampleUpdateAllowed(Session session, List<SampleUpdatesDTO> spaceSamples) + { + if (spaceSamples.isEmpty() == false) + { + entityOperationChecker.assertSpaceSampleUpdateAllowed(session, spaceSamples); + } + } + + private long createDataSetsV3(Session session, AtomicEntityOperationDetails operationDetails, + final IServiceConversationProgressListener conversationProgress, boolean authorize) + { + if (operationDetails.getDataSetRegistrations() == null) + { + return 0; + } + + if (authorize) + { + checkDataSetCreationAllowed(session, operationDetails.getDataSetRegistrations()); + } + + IOperationContext context = new OperationContext(session); + context.setAttribute(ListSampleTechIdByIdentifier.CONTAINER_SHORTCUT_ALLOWED_ATTRIBUTE, true); + context.addProgressListener(new IProgressListener() + { + @Override + public void onProgress(Stack<IProgress> progressStack) + { + if (progressStack.isEmpty() == false) + { + IProgress progress = progressStack.peek(); + int totalItemsToProcess = progress.getTotalItemsToProcess() != null ? progress.getTotalItemsToProcess() : 0; + int numItemsProcessed = progress.getNumItemsProcessed() != null ? progress.getNumItemsProcessed() : 0; + conversationProgress.update(progress.getLabel(), totalItemsToProcess, numItemsProcessed); + } + } + }); + + List<DataSetCreation> creations = new LinkedList<DataSetCreation>(); + + for (NewExternalData newData : operationDetails.getDataSetRegistrations()) + { + // Fields that were in V2 but are intentionally ignored in V3: + // - newData.getUserId() and newData.getUserEMail() fields were used in V2 to find a registrator (see in DataBO.tryToGetRegistrator()), + // but found registrator was anyway overwritten by RelationshipUtils.setExperimentForDataSet() call at the end of DataBO.define() method + // (a user from the session was used as registrator and modifier) + // - newData.getAssociatedSampleCode() field was never used in V2 + // - newData.getRegistrationDate() field was never used in V2 + + DataSetCreation creation = new DataSetCreation(); + creation.setCode(newData.getCode()); + creation.setMeasured(newData.isMeasured()); + creation.setDataProducer(newData.getDataProducerCode()); + creation.setDataProductionDate(newData.getProductionDate()); + + // type + if (newData.getDataSetType() != null) + { + creation.setTypeId(new EntityTypePermId(newData.getDataSetType().getCode())); + } + + // experiment + if (newData.getExperimentIdentifierOrNull() != null) + { + creation.setExperimentId(new ch.ethz.sis.openbis.generic.asapi.v3.dto.experiment.id.ExperimentIdentifier(newData + .getExperimentIdentifierOrNull().toString())); + } + + // sample + injectSampleId(creation, newData); + + // data store + if (newData.getDataStoreCode() != null) + { + creation.setDataStoreId(new DataStorePermId(newData.getDataStoreCode())); + } + + // properties + if (newData.getDataSetProperties() != null) + { + for (NewProperty property : newData.getDataSetProperties()) + { + creation.setProperty(property.getPropertyCode(), property.getValue()); + } + } + + // parents + if (newData.getParentDataSetCodes() != null) + { + List<IDataSetId> parentIds = new LinkedList<IDataSetId>(); + for (String parentCode : newData.getParentDataSetCodes()) + { + parentIds.add(new DataSetPermId(parentCode)); + } + creation.setParentIds(parentIds); + } + + if (newData instanceof NewContainerDataSet) + { + NewContainerDataSet newContainerData = (NewContainerDataSet) newData; + + if (newContainerData.getContainedDataSetCodes() != null) + { + List<IDataSetId> componentIds = new LinkedList<IDataSetId>(); + for (String componentCode : newContainerData.getContainedDataSetCodes()) + { + componentIds.add(new DataSetPermId(componentCode)); + } + creation.setComponentIds(componentIds); + } + } else if (newData instanceof NewLinkDataSet) + { + NewLinkDataSet newLinkData = (NewLinkDataSet) newData; + + LinkedDataCreation linkCreation = new LinkedDataCreation(); + linkCreation.setExternalCode(newLinkData.getExternalCode()); + linkCreation.setExternalDmsId(new ExternalDmsPermId(newLinkData.getExternalDataManagementSystemCode())); + + creation.setLinkedData(linkCreation); + } else + { + // newData is instance of NewExternalData or NewDataSet + + PhysicalDataCreation physicalCreation = new PhysicalDataCreation(); + physicalCreation.setLocation(newData.getLocation()); + physicalCreation.setShareId(newData.getShareId()); + physicalCreation.setSize(newData.getSize()); + physicalCreation.setSpeedHint(newData.getSpeedHint()); + + // complete + if (newData.getComplete() != null) + { + Complete complete = null; + switch (newData.getComplete()) + { + case T: + complete = Complete.YES; + break; + case F: + complete = Complete.NO; + break; + case U: + complete = Complete.UNKNOWN; + break; + default: + throw new IllegalArgumentException("Unsupported complete value: " + newData.getComplete()); + } + physicalCreation.setComplete(complete); + } + + // file format type + if (newData.getFileFormatType() != null) + { + physicalCreation.setFileFormatTypeId(new FileFormatTypePermId(newData.getFileFormatType().getCode())); + } + + // locator type + if (newData.getLocatorType() != null) + { + physicalCreation.setLocatorTypeId(new LocatorTypePermId(newData.getLocatorType().getCode())); + } + + // storage format + if (newData.getStorageFormat() != null) + { + physicalCreation.setStorageFormatId(new StorageFormatPermId(newData.getStorageFormat().getCode())); + } + + creation.setPhysicalData(physicalCreation); + } + + creations.add(creation); + } + + List<DataSetPermId> ids = createDataSetExecutor.create(context, creations); + return ids.size(); + } + + private void injectSampleId(DataSetCreation creation, NewExternalData newData) + { + SampleIdentifier sampleIdentifier = newData.getSampleIdentifierOrNull(); + String permId = newData.getSamplePermIdOrNull(); + if (sampleIdentifier != null) + { + ISampleId sampleId; + if (permId != null) + { + sampleId = new SamplePermId(permId); + } else + { + sampleId = new ch.ethz.sis.openbis.generic.asapi.v3.dto.sample.id.SampleIdentifier( + sampleIdentifier.toString()); + } + creation.setSampleId(sampleId); + } + } + + private void checkDataSetCreationAllowed(Session session, + List<? extends NewExternalData> dataSets) + { + if (dataSets != null && dataSets.isEmpty() == false) + { + entityOperationChecker.assertDataSetCreationAllowed(session, dataSets); + } + } + + private long updateDataSets(final Session session, + AtomicEntityOperationDetails operationDetails, + IServiceConversationProgressListener progress, boolean authorize) + { + final List<DataSetBatchUpdatesDTO> dataSetUpdates = operationDetails.getDataSetUpdates(); + final int dataSetUpdatesCount = dataSetUpdates.size(); + if (dataSetUpdatesCount < 1) + { + return 0; + } + + progress.update("authorizingDataSetUpdates", dataSetUpdatesCount, 0); + if (authorize) + { + checkDataSetUpdateAllowed(session, dataSetUpdates); + } + progress.update("authorizingDataSetUpdates", dataSetUpdatesCount, dataSetUpdatesCount); + final IDataSetTable dataSetTable = businessObjectFactory.createDataSetTable(session); + + BatchOperationExecutor.executeInBatches(new DataSetCheckBeforeBatchUpdate(dataSetTable, + dataSetUpdates), getBatchSize(operationDetails), progress, + "checkDataSetsBeforeUpdate"); + + BatchOperationExecutor.executeInBatches( + new DataSetBatchUpdate(dataSetTable, dataSetUpdates), + getBatchSize(operationDetails), progress, "updateDataSets"); + + return dataSetUpdatesCount; + } + + private void checkDataSetUpdateAllowed(Session session, List<DataSetBatchUpdatesDTO> dataSets) + { + if (dataSets != null && dataSets.isEmpty() == false) + { + entityOperationChecker.assertDataSetUpdateAllowed(session, dataSets); + } + } + + private IDataBO registerDataSetInternal(final Session session, NewExternalData dataSet, DataSetRegistrationCache cache) + { + SampleIdentifier sampleIdentifier = dataSet.getSampleIdentifierOrNull(); + if (sampleIdentifier != null) + { + return registerDataSetInternal(session, sampleIdentifier, dataSet, cache); + } else + { + ExperimentIdentifier experimentIdentifier = dataSet.getExperimentIdentifierOrNull(); + return registerDataSetInternal(session, experimentIdentifier, dataSet, cache); + } + } + + private long createExperiments(Session session, AtomicEntityOperationDetails operationDetails, + IServiceConversationProgressListener progress, boolean authorize) + { + final List<NewExperiment> experimentRegistrations = + operationDetails.getExperimentRegistrations(); + if (authorize) + { + checkExperimentCreationAllowed(session, experimentRegistrations); + } + int index = 0; + for (NewExperiment experiment : experimentRegistrations) + { + registerExperiment(session, experiment); + progress.update("createExperiments", experimentRegistrations.size(), ++index); + } + return index; + } + + protected void checkExperimentCreationAllowed(Session session, + List<NewExperiment> newExperiments) + { + if (newExperiments != null && newExperiments.isEmpty() == false) + { + entityOperationChecker.assertExperimentCreationAllowed(session, newExperiments); + } + } + + private void updateExperiment(Session session, ExperimentUpdatesDTO updates) + { + final IExperimentBO experimentBO = businessObjectFactory.createExperimentBO(session); + experimentBO.update(updates); + experimentBO.save(); + } + + private long updateExperiments(Session session, AtomicEntityOperationDetails operationDetails, + IServiceConversationProgressListener progress, boolean authorize) + { + List<ExperimentUpdatesDTO> updates = operationDetails.getExperimentUpdates(); + + if (authorize) + { + checkExperimentUpdateAllowed(session, updates); + } + + for (ExperimentUpdatesDTO update : updates) + { + updateExperiment(session, update); + } + + return updates.size(); + } + + protected void checkExperimentUpdateAllowed(Session session, + List<ExperimentUpdatesDTO> experimentUpdates) + { + if (experimentUpdates != null && experimentUpdates.isEmpty() == false) + { + entityOperationChecker.assertExperimentUpdateAllowed(session, experimentUpdates); + } + } + + private IDataBO registerDataSetInternal(final Session session, + SampleIdentifier sampleIdentifier, NewExternalData externalData, DataSetRegistrationCache cache) + { + SamplePE sample = cache.getSamples().get(sampleIdentifier); + + if (sample == null) + { + final ISampleBO sampleBO = businessObjectFactory.createSampleBO(session); + sampleBO.loadBySampleIdentifier(sampleIdentifier); + sample = sampleBO.getSample(); + cache.getSamples().put(sampleIdentifier, sample); + } + + return registerDataSetInternal(session, sample, externalData, cache); + } + + private IDataBO registerDataSetInternal(final Session session, SamplePE sample, + NewExternalData externalData, DataSetRegistrationCache cache) + { + final IDataBO dataBO = cache.getDataBO() != null ? cache.getDataBO() : businessObjectFactory.createDataBO(session); + cache.setDataBO(dataBO); + + SourceType sourceType = + externalData.isMeasured() ? SourceType.MEASUREMENT : SourceType.DERIVED; + dataBO.setCache(cache); + dataBO.define(externalData, sample, sourceType); + dataBO.save(); + + boolean isContainer = externalData instanceof NewContainerDataSet; + if (isContainer) + { + dataBO.setContainedDataSets(sample.getExperiment(), sample, (NewContainerDataSet) externalData); + } + + final String dataSetCode = dataBO.getData().getCode(); + assert dataSetCode != null : "Data set code not specified."; + + return dataBO; + } + + private IDataBO registerDataSetInternal(final Session session, + ExperimentIdentifier experimentIdentifier, NewExternalData externalData, DataSetRegistrationCache cache) + { + if (false == cache.getExperiments().containsKey(experimentIdentifier)) + { + cache.getExperiments().put(experimentIdentifier, tryLoadExperimentByIdentifier(session, experimentIdentifier)); + } + ExperimentPE experiment = cache.getExperiments().get(experimentIdentifier); + + if (experiment == null) + { + throw new UserFailureException("Unknown experiment '" + experimentIdentifier + "'."); + } + if (experiment.getDeletion() != null) + { + throw new UserFailureException("Data set can not be registered because experiment '" + + experiment.getIdentifier() + "' is in trash."); + } + final IDataBO externalDataBO = cache.getDataBO() != null ? cache.getDataBO() : businessObjectFactory.createDataBO(session); + cache.setDataBO(externalDataBO); + + SourceType sourceType = + externalData.isMeasured() ? SourceType.MEASUREMENT : SourceType.DERIVED; + externalDataBO.setCache(cache); + externalDataBO.define(externalData, experiment, sourceType); + externalDataBO.save(); + + boolean isContainer = externalData instanceof NewContainerDataSet; + if (isContainer) + { + externalDataBO.setContainedDataSets(experiment, null, (NewContainerDataSet) externalData); + } + + final String dataSetCode = externalDataBO.getData().getCode(); + assert dataSetCode != null : "Data set code not specified."; + + return externalDataBO; + } + + @Override + @RolesAllowed(RoleWithHierarchy.SPACE_ETL_SERVER) + public List<Sample> searchForSamples(String sessionToken, SearchCriteria searchCriteria) + { + Session session = getSession(sessionToken); + DetailedSearchCriteria detailedSearchCriteria = + SearchCriteriaToDetailedSearchCriteriaTranslator.convert(getDAOFactory(), + SearchableEntityKind.SAMPLE, searchCriteria); + SearchHelper searchHelper = + new SearchHelper(session, businessObjectFactory, getDAOFactory()); + return searchHelper.searchForSamples(session.getUserName(), detailedSearchCriteria); + } + + @Override + @RolesAllowed(RoleWithHierarchy.SPACE_ETL_SERVER) + public List<AbstractExternalData> searchForDataSets(String sessionToken, + SearchCriteria searchCriteria) + { + Session session = getSession(sessionToken); + DetailedSearchCriteria detailedSearchCriteria = + SearchCriteriaToDetailedSearchCriteriaTranslator.convert(getDAOFactory(), + SearchableEntityKind.DATA_SET, searchCriteria); + SearchHelper searchHelper = + new SearchHelper(session, businessObjectFactory, getDAOFactory()); + return searchHelper.searchForDataSets(session.getUserName(), detailedSearchCriteria); + } + + @Override + @RolesAllowed(RoleWithHierarchy.SPACE_ETL_SERVER) + public List<Experiment> searchForExperiments(String sessionToken, SearchCriteria searchCriteria) + { + Session session = getSession(sessionToken); + DetailedSearchCriteria detailedSearchCriteria = + SearchCriteriaToDetailedSearchCriteriaTranslator.convert(getDAOFactory(), SearchableEntityKind.EXPERIMENT, searchCriteria); + SearchHelper searchHelper = new SearchHelper(session, businessObjectFactory, getDAOFactory()); + List<ExperimentPE> experiments = searchHelper.searchForExperiments(sessionToken, detailedSearchCriteria); + return translateExperimentsWithMetaprojectAssignments(session, experiments); + } + + @Override + @RolesAllowed(value = + { RoleWithHierarchy.SPACE_OBSERVER, RoleWithHierarchy.SPACE_ETL_SERVER }) + public List<Material> listMaterials(String sessionToken, ListMaterialCriteria criteria, + boolean withProperties) + { + Session session = getSession(sessionToken); + IMaterialLister lister = businessObjectFactory.createMaterialLister(session); + ListMaterialCriteria criteriaWithIds = populateMissingTypeId(criteria); + return lister.list(criteriaWithIds, withProperties); + } + + private ListMaterialCriteria populateMissingTypeId(ListMaterialCriteria criteria) + { + MaterialType materialTypeOrNull = criteria.tryGetMaterialType(); + if (materialTypeOrNull != null && materialTypeOrNull.getId() == null) + { + String materialTypeCode = materialTypeOrNull.getCode(); + EntityTypePE typeWithId = + daoFactory.getEntityTypeDAO(EntityKind.MATERIAL).tryToFindEntityTypeByCode( + materialTypeCode); + if (typeWithId == null) + { + throw UserFailureException.fromTemplate("Invalid material type '%s'", + materialTypeCode); + } else + { + MaterialType materialTypeWithId = new MaterialType(); + materialTypeWithId.setId(typeWithId.getId()); + materialTypeWithId.setCode(materialTypeCode); + return ListMaterialCriteria.createFromMaterialType(materialTypeWithId); + } + } + + return criteria; + + } + + @Override + @SuppressWarnings("deprecation") + @RolesAllowed(RoleWithHierarchy.SPACE_ETL_SERVER) + public void removeDataSetsPermanently(String sessionToken, + @AuthorizationGuard(guardClass = DataSetCodeCollectionPredicate.class) List<String> dataSetCodes, String reason) + { + Session session = getSession(sessionToken); + IDataSetTable dataSetTable = businessObjectFactory.createDataSetTable(session); + permanentlyDeleteDataSets(session, dataSetTable, dataSetCodes, reason, false); + } + + @Override + @RolesAllowed(RoleWithHierarchy.SPACE_ETL_SERVER) + public void updateDataSet(String sessionToken, + @AuthorizationGuard(guardClass = DataSetUpdatesPredicate.class) DataSetUpdatesDTO dataSetUpdates) + { + final Session session = getSession(sessionToken); + final IDataBO dataSetBO = businessObjectFactory.createDataBO(session); + dataSetBO.update(dataSetUpdates); + } + + @Override + @RolesAllowed(RoleWithHierarchy.SPACE_ETL_SERVER) + public List<String> getTrustedCrossOriginDomains(String sessionToken) + { + return trustedOriginDomainProvider.getTrustedDomains(); + } + + @Override + @RolesAllowed(RoleWithHierarchy.SPACE_ETL_SERVER) + public void setStorageConfirmed(String sessionToken, List<String> dataSetCodes) + { + checkSession(sessionToken); + + List<Long> dataSetIds = new LinkedList<Long>(); + for (String dataSetCode : dataSetCodes) + { + + if (daoFactory.getDataDAO().confirmStorage(dataSetCode)) + { + daoFactory.getPostRegistrationDAO().addDataSet(dataSetCode); + } else if (daoFactory.getDataDAO().exists(dataSetCode) == false) + { + throw new UserFailureException("Storage confirmation for a dataset: " + dataSetCode + + " failed because the data set has been already deleted."); + } + + Long id = daoFactory.getDataDAO().tryToFindDataSetIdByCode(dataSetCode).getId(); + dataSetIds.add(id); + } + IFullTextIndexUpdateScheduler indexUpdater = + daoFactory.getPersistencyResources().getIndexUpdateScheduler(); + indexUpdater.scheduleUpdate(IndexUpdateOperation.reindex(DataPE.class, + dataSetIds)); + } + + @Override + @RolesAllowed(RoleWithHierarchy.SPACE_ETL_SERVER) + public void markSuccessfulPostRegistration(String sessionToken, String dataSetCode) + { + checkSession(sessionToken); + + daoFactory.getPostRegistrationDAO().removeDataSet(dataSetCode); + } + + @Override + @RolesAllowed(RoleWithHierarchy.SPACE_ETL_SERVER) + public void notifyDatasetAccess(String sessionToken, String dataSetCode) + { + checkSession(sessionToken); + + daoFactory.getDataDAO().updateAccessTimestamp(dataSetCode); + } + + @Override + @RolesAllowed(RoleWithHierarchy.SPACE_ETL_SERVER) + public List<AbstractExternalData> listDataSetsForPostRegistration(String sessionToken, + String dataStoreCode) + { + Session session = getSession(sessionToken); + + // find all datasets for registration + final IDatasetLister datasetLister = createDatasetLister(session); + Collection<Long> allDataSetIds = + daoFactory.getPostRegistrationDAO().listDataSetsForPostRegistration(); + List<AbstractExternalData> allDataSets = datasetLister.listByDatasetIds(allDataSetIds); + + // find datastore + DataStorePE dataStore = + getDAOFactory().getDataStoreDAO().tryToFindDataStoreByCode(dataStoreCode); + if (dataStore == null) + { + throw new UserFailureException("Unknown data store: " + dataStoreCode); + } + + // filter datasets by datastore + List<AbstractExternalData> result = new ArrayList<AbstractExternalData>(); + for (AbstractExternalData externalData : allDataSets) + { + if (dataStoreCode.equals(externalData.getDataStore().getCode())) + { + result.add(externalData); + } + } + return result; + } + + @Override + @RolesAllowed(RoleWithHierarchy.SPACE_ETL_SERVER) + public void heartbeat(String token) + { + // do nothing + } + + @Override + @RolesAllowed(RoleWithHierarchy.SPACE_ETL_SERVER) + public boolean doesUserHaveRole(String token, String user, String roleCode, String spaceOrNull) + { + return new AuthorizationServiceUtils(daoFactory, user).doesUserHaveRole(roleCode, + spaceOrNull); + } + + @Override + @RolesAllowed(RoleWithHierarchy.SPACE_ETL_SERVER) + public List<String> filterToVisibleDataSets(String token, String user, List<String> dataSetCodes) + { + return new AuthorizationServiceUtils(daoFactory, user).filterDataSetCodes(dataSetCodes); + } + + @Override + @RolesAllowed(RoleWithHierarchy.SPACE_ETL_SERVER) + public List<String> filterToVisibleExperiments(String token, String user, + List<String> experimentIds) + { + return new AuthorizationServiceUtils(daoFactory, user).filterExperimentIds(experimentIds); + } + + @Override + @RolesAllowed(RoleWithHierarchy.SPACE_ETL_SERVER) + public List<String> filterToVisibleSamples(String token, String user, List<String> sampleIds) + { + return new AuthorizationServiceUtils(daoFactory, user).filterSampleIds(sampleIds); + } + + @Override + @RolesAllowed( + { RoleWithHierarchy.SPACE_OBSERVER, RoleWithHierarchy.SPACE_ETL_SERVER }) + public List<? extends EntityTypePropertyType<?>> listPropertyDefinitionsForType( + String sessionToken, String code, EntityKind entityKind) + { + IEntityTypeDAO edao = daoFactory.getEntityTypeDAO(entityKind); + IEntityPropertyTypeDAO dao = daoFactory.getEntityPropertyTypeDAO(entityKind); + + EntityTypePE type = edao.tryToFindEntityTypeByCode(code); + List<EntityTypePropertyTypePE> propertiesPE = dao.listEntityPropertyTypes(type); + + if (entityKind == EntityKind.DATA_SET) + { + Collection<DataSetTypePropertyType> collection = + CollectionUtils.collect(propertiesPE, + DataSetTypePropertyTypeTranslator.TRANSFORMER); + return new LinkedList<DataSetTypePropertyType>(collection); + } else if (entityKind == EntityKind.SAMPLE) + { + Collection<SampleTypePropertyType> collection = + CollectionUtils.collect(propertiesPE, + SampleTypePropertyTypeTranslator.TRANSFORMER); + return new LinkedList<SampleTypePropertyType>(collection); + } else if (entityKind == EntityKind.EXPERIMENT) + { + Collection<ExperimentTypePropertyType> collection = + CollectionUtils.collect(propertiesPE, + ExperimentTypePropertyTypeTranslator.TRANSFORMER); + return new LinkedList<ExperimentTypePropertyType>(collection); + } else if (entityKind == EntityKind.MATERIAL) + { + Collection<MaterialTypePropertyType> collection = + CollectionUtils.collect(propertiesPE, + MaterialTypePropertyTypeTranslator.TRANSFORMER); + return new LinkedList<MaterialTypePropertyType>(collection); + } else + { + throw new IllegalArgumentException("Unsupported entity kind " + entityKind); + } + } + + @Override + @RolesAllowed(RoleWithHierarchy.SPACE_ETL_SERVER) + public ExternalDataManagementSystem tryGetExternalDataManagementSystem(String token, + String externalDataManagementSystemCode) + { + checkSession(token); + + ExternalDataManagementSystemPE externalSystem = + getDAOFactory().getExternalDataManagementSystemDAO() + .tryToFindExternalDataManagementSystemByCode( + externalDataManagementSystemCode); + + if (externalSystem != null) + { + return ExternalDataManagementSystemTranslator.translate(externalSystem); + } else + { + return null; + } + } + + private int getBatchSize(AtomicEntityOperationDetails details) + { + return details == null || details.getBatchSizeOrNull() == null ? BatchOperationExecutor + .getDefaultBatchSize() : details.getBatchSizeOrNull(); + } + + public void setConversationClient(IServiceConversationClientManagerLocal conversationClient) + { + this.conversationClient = conversationClient; + } + + public void setConversationServer(IServiceConversationServerManagerLocal conversationServer) + { + this.conversationServer = conversationServer; + } + + @Override + @RolesAllowed(RoleWithHierarchy.SPACE_ETL_SERVER) + public List<Metaproject> listMetaprojects(String sessionToken, String userId) + { + IMetaprojectDAO metaprojectDAO = daoFactory.getMetaprojectDAO(); + PersonPE owner = daoFactory.getPersonDAO().tryFindPersonByUserId(userId); + + if (owner == null) + { + throw new IllegalArgumentException("User with id " + userId + " doesn't exist."); + } + + List<MetaprojectPE> metaprojectPEs = metaprojectDAO.listMetaprojects(owner); + + return MetaprojectTranslator.translate(metaprojectPEs); + } + + @Override + @RolesAllowed(RoleWithHierarchy.SPACE_ETL_SERVER) + public MetaprojectAssignments getMetaprojectAssignments(String systemSessionToken, String name, + String userName, EnumSet<MetaprojectAssignmentsFetchOption> fetchOptions) + { + Metaproject metaproject = tryGetMetaproject(systemSessionToken, name, userName); + + if (metaproject == null) + { + throw UserFailureException.fromTemplate("Can't find metaproject '%s/%s'", userName, + name); + } + + MetaprojectAssignmentsHelper helper = + new MetaprojectAssignmentsHelper(daoFactory, managedPropertyEvaluatorFactory); + return helper.getMetaprojectAssignments(getSession(systemSessionToken), metaproject, + userName, fetchOptions); + } + + @Override + @RolesAllowed(RoleWithHierarchy.SPACE_ETL_SERVER) + public List<Metaproject> listMetaprojectsForEntity(String systemSessionToken, String userId, + IObjectId entityId) + { + Map<IObjectId, List<Metaproject>> map = listMetaprojectsForEntities(systemSessionToken, userId, Collections.singletonList(entityId)); + return map.get(entityId); + } + + @Override + @RolesAllowed(RoleWithHierarchy.SPACE_ETL_SERVER) + public Map<IObjectId, List<Metaproject>> listMetaprojectsForEntities(String systemSessionToken, String userId, + Collection<? extends IObjectId> entityIds) + { + IMetaprojectDAO metaprojectDAO = daoFactory.getMetaprojectDAO(); + PersonPE owner = daoFactory.getPersonDAO().tryFindPersonByUserId(userId); + + EntityObjectIdHelper helper = new EntityObjectIdHelper(businessObjectFactory); + Map<IObjectId, List<Metaproject>> map = new HashMap<IObjectId, List<Metaproject>>(); + + if (entityIds != null) + { + for (IObjectId entityId : entityIds) + { + if (entityId != null) + { + IEntityInformationHolderDTO entity = + helper.getEntityById(getSession(systemSessionToken), entityId); + + Collection<MetaprojectPE> metaprojectPEs = + metaprojectDAO.listMetaprojectsForEntity(owner, entity); + + map.put(entityId, MetaprojectTranslator.translate(metaprojectPEs)); + } + } + } + + return map; + } + + @Override + @RolesAllowed(RoleWithHierarchy.SPACE_ETL_SERVER) + public List<AuthorizationGroup> listAuthorizationGroups(String sessionToken) + { + // see ch.systemsx.cisd.openbis.generic.server.CommonServer.listAuthorizationGroups(String) + checkSession(sessionToken); + final List<AuthorizationGroupPE> authorizationGroups = + getDAOFactory().getAuthorizationGroupDAO().list(); + Collections.sort(authorizationGroups); + return AuthorizationGroupTranslator.translate(authorizationGroups); + } + + @Override + @RolesAllowed(RoleWithHierarchy.SPACE_ETL_SERVER) + public List<AuthorizationGroup> listAuthorizationGroupsForUser(String sessionToken, String userId) + { + checkSession(sessionToken); + final List<AuthorizationGroupPE> allAuthorizationGroups = + getDAOFactory().getAuthorizationGroupDAO().list(); + ArrayList<AuthorizationGroupPE> authorizationGroups = new ArrayList<AuthorizationGroupPE>(); + for (AuthorizationGroupPE authorizationGroup : allAuthorizationGroups) + { + Set<PersonPE> persons = authorizationGroup.getPersons(); + for (PersonPE person : persons) + { + if (userId.equals(person.getUserId())) + { + authorizationGroups.add(authorizationGroup); + } + } + } + + Collections.sort(authorizationGroups); + return AuthorizationGroupTranslator.translate(authorizationGroups); + } + + @Override + @RolesAllowed(RoleWithHierarchy.SPACE_ETL_SERVER) + public List<Person> listUsersForAuthorizationGroup(String sessionToken, TechId authorizationGroupId) + { + final Session session = getSession(sessionToken); + IAuthorizationGroupBO bo = businessObjectFactory.createAuthorizationGroupBO(session); + bo.loadByTechId(authorizationGroupId); + return PersonTranslator.translate(bo.getAuthorizationGroup().getPersons()); + } + + @Override + @RolesAllowed(RoleWithHierarchy.SPACE_ETL_SERVER) + public List<RoleAssignment> listRoleAssignments(String sessionToken) + { + checkSession(sessionToken); + final List<RoleAssignmentPE> roles = + getDAOFactory().getRoleAssignmentDAO().listRoleAssignments(); + return RoleAssignmentTranslator.translate(roles); + } + + @Override + @RolesAllowed(RoleWithHierarchy.SPACE_ETL_SERVER) + public List<Attachment> listAttachments(String sessionToken, AttachmentHolderKind attachmentHolderKind, Long attachmentHolderId) + { + Session session = getSession(sessionToken); + + AttachmentHolderPE attachmentHolder = null; + + switch (attachmentHolderKind) + { + case PROJECT: + { + IProjectBO projectBO = businessObjectFactory.createProjectBO(session); + projectBO.loadDataByTechId(new TechId(attachmentHolderId)); + attachmentHolder = projectBO.getProject(); + break; + } + case EXPERIMENT: + { + IExperimentBO experimentBO = businessObjectFactory.createExperimentBO(session); + experimentBO.loadDataByTechId(new TechId(attachmentHolderId)); + attachmentHolder = experimentBO.getExperiment(); + break; + } + case SAMPLE: + { + ISampleBO sampleBO = businessObjectFactory.createSampleBO(session); + sampleBO.loadDataByTechId(new TechId(attachmentHolderId)); + attachmentHolder = sampleBO.getSample(); + break; + } + } + + if (attachmentHolder != null) + { + List<AttachmentPE> attachments = getDAOFactory().getAttachmentDAO().listAttachments(attachmentHolder); + return AttachmentTranslator.translate(attachments, session.getBaseIndexURL()); + } else + { + return null; + } + } + + @Override + @RolesAllowed(RoleWithHierarchy.SPACE_ETL_SERVER) + public AttachmentWithContent getAttachment(String sessionToken, AttachmentHolderKind attachmentHolderKind, Long attachmentHolderId, + String fileName, Integer versionOrNull) + { + Session session = getSession(sessionToken); + + AttachmentPE attachment = null; + + switch (attachmentHolderKind) + { + case PROJECT: + { + IProjectBO bo = businessObjectFactory.createProjectBO(session); + bo.loadDataByTechId(new TechId(attachmentHolderId)); + attachment = bo.tryGetProjectFileAttachment(fileName, versionOrNull); + break; + } + case EXPERIMENT: + { + IExperimentBO bo = businessObjectFactory.createExperimentBO(session); + bo.loadDataByTechId(new TechId(attachmentHolderId)); + attachment = bo.tryGetExperimentFileAttachment(fileName, versionOrNull); + break; + } + case SAMPLE: + { + ISampleBO bo = businessObjectFactory.createSampleBO(session); + bo.loadDataByTechId(new TechId(attachmentHolderId)); + attachment = bo.tryGetSampleFileAttachment(fileName, versionOrNull); + break; + } + } + + if (attachment != null) + { + return AttachmentTranslator.translateWithContent(attachment); + } else + { + return null; + } + } + + public void setTimeout(String timeout) + { + try + { + this.timeout = Long.parseLong(timeout); + } catch (Exception e) + { + } + } + + @Override + @RolesAllowed(RoleWithHierarchy.SPACE_ETL_SERVER) + public List<AbstractExternalData> listNotArchivedDatasetsWithMetaproject(String sessionToken, final IMetaprojectId metaprojectId) + { + final Session session = getSession(sessionToken); + final IDatasetLister datasetLister = createDatasetLister(session); + final Metaproject metaproject = CommonServiceProvider.getCommonServer().getMetaprojectWithoutOwnershipChecks(sessionToken, metaprojectId); + return datasetLister.listByMetaprojectIdAndArchivalState(metaproject.getId(), false); + } +} diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/ServiceForDataStoreServerLogger.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/ServiceForDataStoreServerLogger.java index 19166b05b0b..9417ead5194 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/ServiceForDataStoreServerLogger.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/ServiceForDataStoreServerLogger.java @@ -487,7 +487,7 @@ public class ServiceForDataStoreServerLogger extends AbstractServerLogger implem logAccess(Level.DEBUG, sessionToken, "isDataSetOnTrashCanOrDeleted", "DATA_SET_CODE(%s)", dataSetCode); return false; } - + @Override public void updateShareIdAndSize(String sessionToken, String dataSetCode, String shareId, long size) throws UserFailureException diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/TrackingServerLogger.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/TrackingServerLogger.java index c8581b2dfc8..999259c5f83 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/TrackingServerLogger.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/TrackingServerLogger.java @@ -36,9 +36,8 @@ import ch.systemsx.cisd.openbis.generic.shared.dto.Session; final class TrackingServerLogger extends AbstractServerLogger implements ITrackingServer { /** - * Creates an instance for the specified session manager, invocation status and elapsed time. - * The session manager is used to retrieve user information which will be a part of the log - * message. + * Creates an instance for the specified session manager, invocation status and elapsed time. The session manager is used to retrieve user + * information which will be a part of the log message. */ TrackingServerLogger(final ISessionManager<Session> sessionManager, IInvocationLoggerContext context) diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/TrackingServiceServer.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/TrackingServiceServer.java index 67f76a4c7e3..f54dd4874cd 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/TrackingServiceServer.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/TrackingServiceServer.java @@ -48,10 +48,11 @@ public class TrackingServiceServer extends WhiteAndBlackListHttpInvokerServiceEx } @RequestMapping( - { "/rmi-tracking", "/openbis/rmi-tracking" }) + { "/rmi-tracking", "/openbis/rmi-tracking" }) @Override public void handleRequest(HttpServletRequest request, HttpServletResponse response) - throws ServletException, IOException { + throws ServletException, IOException + { super.handleRequest(request, response); } } diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/TrustedCrossOriginDomainsProvider.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/TrustedCrossOriginDomainsProvider.java index 8ea9c44a8e9..ba08f173212 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/TrustedCrossOriginDomainsProvider.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/TrustedCrossOriginDomainsProvider.java @@ -43,8 +43,8 @@ public class TrustedCrossOriginDomainsProvider } /** - * Returns a list of configured trusted domains which can host external shared web resources. - * Typically these are lightweight webapps that integrate with openBIS via JSON-RPC services. + * Returns a list of configured trusted domains which can host external shared web resources. Typically these are lightweight webapps that + * integrate with openBIS via JSON-RPC services. * <p> * Can return empty list. */ diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/WhiteListBasedRemoteHostValidator.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/WhiteListBasedRemoteHostValidator.java index 5944f9a6ba7..cd9c18e04ba 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/WhiteListBasedRemoteHostValidator.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/WhiteListBasedRemoteHostValidator.java @@ -28,8 +28,8 @@ import ch.systemsx.cisd.openbis.generic.shared.IRemoteHostValidator; */ public class WhiteListBasedRemoteHostValidator implements IRemoteHostValidator { - - private final Set<String> allowedRemoteHosts; + + private final Set<String> allowedRemoteHosts; public WhiteListBasedRemoteHostValidator(String commaSeparatedListOfAllowedRemoteHosts) { @@ -43,12 +43,12 @@ public class WhiteListBasedRemoteHostValidator implements IRemoteHostValidator } } } - + public void removeRemoteHost(String remoteHost) { allowedRemoteHosts.remove(remoteHost); } - + public void addRemoteHost(String remoteHost) { allowedRemoteHosts.add(remoteHost); diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/api/v1/ExperimentToDataSetRelatedEntitiesTranslator.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/api/v1/ExperimentToDataSetRelatedEntitiesTranslator.java index dfd2066877c..00034fae63a 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/api/v1/ExperimentToDataSetRelatedEntitiesTranslator.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/api/v1/ExperimentToDataSetRelatedEntitiesTranslator.java @@ -26,11 +26,9 @@ class ExperimentToDataSetRelatedEntitiesTranslator private final ArrayList<BasicEntityInformationHolder> entityInformationHolders; /** - * Creates a translator from public {@Experiment} objects to the internal - * {@link DataSetRelatedEntities} objects. + * Creates a translator from public {@Experiment} objects to the internal {@link DataSetRelatedEntities} objects. * <p> - * A list of experiment types known to the DB must be provided because Experiment knows only the - * code of the ExperimentType. + * A list of experiment types known to the DB must be provided because Experiment knows only the code of the ExperimentType. * * @param experimentTypes A list of ExperimentTypes known to the DB. * @param experiments The experiments to convert. diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/api/v1/GeneralInformationChangingService.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/api/v1/GeneralInformationChangingService.java index 424db69d2df..36aee99039c 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/api/v1/GeneralInformationChangingService.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/api/v1/GeneralInformationChangingService.java @@ -332,18 +332,19 @@ public class GeneralInformationChangingService extends { server.deletePermanentlyForced(sessionToken, TechId.createList(deletionIds)); } - + @Override public void registerPerson(String sessionToken, String userID) { server.registerPerson(sessionToken, userID); } - + @Override - public void registerSpace(String sessionToken, String spaceCode, String spaceDescription) { - server.registerSpace(sessionToken,spaceCode, spaceDescription); + public void registerSpace(String sessionToken, String spaceCode, String spaceDescription) + { + server.registerSpace(sessionToken, spaceCode, spaceDescription); } - + @Override public void registerPersonSpaceRole(String sessionToken, String spaceCode, String userID, String roleCode) { @@ -351,5 +352,5 @@ public class GeneralInformationChangingService extends SpaceIdentifier spaceIdentifier = new SpaceIdentifier(spaceCode); server.registerSpaceRole(sessionToken, RoleCode.valueOf(roleCode), spaceIdentifier, grantee); } - + } diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/api/v1/GeneralInformationChangingServiceJsonServer.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/api/v1/GeneralInformationChangingServiceJsonServer.java index b9ed6c36059..14800f19a87 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/api/v1/GeneralInformationChangingServiceJsonServer.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/api/v1/GeneralInformationChangingServiceJsonServer.java @@ -57,14 +57,14 @@ public class GeneralInformationChangingServiceJsonServer extends AbstractApiJson } @RequestMapping( - { IGeneralInformationChangingService.JSON_SERVICE_URL, - "/openbis" + IGeneralInformationChangingService.JSON_SERVICE_URL }) + { IGeneralInformationChangingService.JSON_SERVICE_URL, + "/openbis" + IGeneralInformationChangingService.JSON_SERVICE_URL }) @Override public void handleRequest(HttpServletRequest request, HttpServletResponse response) throws ServletException, - IOException { + IOException + { super.handleRequest(request, response); } - } diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/api/v1/GeneralInformationChangingServiceLogger.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/api/v1/GeneralInformationChangingServiceLogger.java index 1bf5d91e8bd..7ab105f0323 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/api/v1/GeneralInformationChangingServiceLogger.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/api/v1/GeneralInformationChangingServiceLogger.java @@ -248,5 +248,5 @@ class GeneralInformationChangingServiceLogger extends AbstractServerLogger imple { logAccess(sessionToken, "registerPersonSpaceRole", "spaceCode(%s), userID(%s), roleCode(%s)", spaceCode, userID, roleCode); } - + } diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/api/v1/GeneralInformationService.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/api/v1/GeneralInformationService.java index ee64f5a89de..b9a4da48b86 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/api/v1/GeneralInformationService.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/api/v1/GeneralInformationService.java @@ -407,8 +407,7 @@ public class GeneralInformationService extends AbstractServer<IGeneralInformatio @RolesAllowed(RoleWithHierarchy.SPACE_OBSERVER) @ReturnValueFilter(validatorClass = SampleByIdentiferValidator.class) public List<Sample> listSamplesForExperiment(String sessionToken, - @AuthorizationGuard(guardClass = ExperimentAugmentedCodePredicate.class) - String experimentIdentifierString) + @AuthorizationGuard(guardClass = ExperimentAugmentedCodePredicate.class) String experimentIdentifierString) { checkSession(sessionToken); ExperimentIdentifier experimentId = @@ -429,8 +428,7 @@ public class GeneralInformationService extends AbstractServer<IGeneralInformatio @RolesAllowed(RoleWithHierarchy.INSTANCE_OBSERVER) @Capability("SEARCH_ON_BEHALF_OF_USER") public List<Sample> listSamplesForExperimentOnBehalfOfUser(String sessionToken, - @AuthorizationGuard(guardClass = ExperimentAugmentedCodePredicate.class) - String experimentIdentifierString, String userId) + @AuthorizationGuard(guardClass = ExperimentAugmentedCodePredicate.class) String experimentIdentifierString, String userId) { checkSession(sessionToken); ExperimentIdentifier experimentId = @@ -464,8 +462,7 @@ public class GeneralInformationService extends AbstractServer<IGeneralInformatio @RolesAllowed(RoleWithHierarchy.SPACE_OBSERVER) @ReturnValueFilter(validatorClass = DataSetByExperimentOrSampleIdentifierValidator.class) public List<DataSet> listDataSets(String sessionToken, - @AuthorizationGuard(guardClass = SampleListPredicate.class) - List<Sample> samples) + @AuthorizationGuard(guardClass = SampleListPredicate.class) List<Sample> samples) { return listDataSets(sessionToken, samples, EnumSet.noneOf(Connections.class)); } @@ -475,8 +472,7 @@ public class GeneralInformationService extends AbstractServer<IGeneralInformatio @RolesAllowed(RoleWithHierarchy.SPACE_OBSERVER) @ReturnValueFilter(validatorClass = ExperimentByIdentiferValidator.class) public List<Experiment> listExperiments(String sessionToken, - @AuthorizationGuard(guardClass = ProjectPredicate.class) - List<Project> projects, String experimentTypeString) + @AuthorizationGuard(guardClass = ProjectPredicate.class) List<Project> projects, String experimentTypeString) { return listExperiments(sessionToken, projects, experimentTypeString, false, false); } @@ -486,8 +482,7 @@ public class GeneralInformationService extends AbstractServer<IGeneralInformatio @RolesAllowed(RoleWithHierarchy.SPACE_OBSERVER) @ReturnValueFilter(validatorClass = ExperimentByIdentiferValidator.class) public List<Experiment> listExperimentsHavingDataSets(String sessionToken, - @AuthorizationGuard(guardClass = ProjectPredicate.class) - List<Project> projects, String experimentTypeString) + @AuthorizationGuard(guardClass = ProjectPredicate.class) List<Project> projects, String experimentTypeString) { return listExperiments(sessionToken, projects, experimentTypeString, false, true); } @@ -497,8 +492,7 @@ public class GeneralInformationService extends AbstractServer<IGeneralInformatio @RolesAllowed(RoleWithHierarchy.SPACE_OBSERVER) @ReturnValueFilter(validatorClass = ExperimentByIdentiferValidator.class) public List<Experiment> listExperimentsHavingSamples(String sessionToken, - @AuthorizationGuard(guardClass = ProjectPredicate.class) - List<Project> projects, String experimentTypeString) + @AuthorizationGuard(guardClass = ProjectPredicate.class) List<Project> projects, String experimentTypeString) { return listExperiments(sessionToken, projects, experimentTypeString, true, false); } @@ -602,8 +596,7 @@ public class GeneralInformationService extends AbstractServer<IGeneralInformatio @RolesAllowed(RoleWithHierarchy.SPACE_OBSERVER) @ReturnValueFilter(validatorClass = DataSetByExperimentOrSampleIdentifierValidator.class) public List<DataSet> listDataSetsForSample(String sessionToken, - @AuthorizationGuard(guardClass = SamplePredicate.class) - Sample sample, boolean areOnlyDirectlyConnectedIncluded) + @AuthorizationGuard(guardClass = SamplePredicate.class) Sample sample, boolean areOnlyDirectlyConnectedIncluded) { checkSession(sessionToken); List<AbstractExternalData> externalData = @@ -751,8 +744,7 @@ public class GeneralInformationService extends AbstractServer<IGeneralInformatio @RolesAllowed(RoleWithHierarchy.SPACE_OBSERVER) @ReturnValueFilter(validatorClass = DataSetByExperimentOrSampleIdentifierValidator.class) public List<DataSet> listDataSets(String sessionToken, - @AuthorizationGuard(guardClass = SampleListPredicate.class) - List<Sample> samples, EnumSet<Connections> connections) + @AuthorizationGuard(guardClass = SampleListPredicate.class) List<Sample> samples, EnumSet<Connections> connections) { checkSession(sessionToken); EnumSet<Connections> connectionsToGet = @@ -810,8 +802,7 @@ public class GeneralInformationService extends AbstractServer<IGeneralInformatio @RolesAllowed(RoleWithHierarchy.SPACE_OBSERVER) @ReturnValueFilter(validatorClass = DataSetByExperimentOrSampleIdentifierValidator.class) public List<DataSet> listDataSetsForExperiments(String sessionToken, - @AuthorizationGuard(guardClass = ExperimentListPredicate.class) - List<Experiment> experiments, EnumSet<Connections> connections) + @AuthorizationGuard(guardClass = ExperimentListPredicate.class) List<Experiment> experiments, EnumSet<Connections> connections) { checkSession(sessionToken); EnumSet<Connections> connectionsToGet = @@ -1049,8 +1040,7 @@ public class GeneralInformationService extends AbstractServer<IGeneralInformatio @RolesAllowed(RoleWithHierarchy.SPACE_OBSERVER) @ReturnValueFilter(validatorClass = ExperimentByIdentiferValidator.class) public List<Experiment> listExperiments(String sessionToken, - @AuthorizationGuard(guardClass = ExperimentAugmentedCodePredicate.class) - List<String> experimentIdentifiers) + @AuthorizationGuard(guardClass = ExperimentAugmentedCodePredicate.class) List<String> experimentIdentifiers) { checkSession(sessionToken); @@ -1213,8 +1203,7 @@ public class GeneralInformationService extends AbstractServer<IGeneralInformatio @Transactional(readOnly = true) @RolesAllowed(RoleWithHierarchy.SPACE_OBSERVER) public List<Attachment> listAttachmentsForProject(String sessionToken, - @AuthorizationGuard(guardClass = ProjectIdPredicate.class) - IProjectId projectId, boolean allVersions) + @AuthorizationGuard(guardClass = ProjectIdPredicate.class) IProjectId projectId, boolean allVersions) { Session session = getSession(sessionToken); @@ -1231,8 +1220,7 @@ public class GeneralInformationService extends AbstractServer<IGeneralInformatio @Transactional(readOnly = true) @RolesAllowed(RoleWithHierarchy.SPACE_OBSERVER) public List<Attachment> listAttachmentsForExperiment(String sessionToken, - @AuthorizationGuard(guardClass = ExperimentIdPredicate.class) - IExperimentId experimentId, boolean allVersions) + @AuthorizationGuard(guardClass = ExperimentIdPredicate.class) IExperimentId experimentId, boolean allVersions) { Session session = getSession(sessionToken); @@ -1249,8 +1237,7 @@ public class GeneralInformationService extends AbstractServer<IGeneralInformatio @Transactional(readOnly = true) @RolesAllowed(RoleWithHierarchy.SPACE_OBSERVER) public List<Attachment> listAttachmentsForSample(String sessionToken, - @AuthorizationGuard(guardClass = SampleIdPredicate.class) - ISampleId sampleId, boolean allVersions) + @AuthorizationGuard(guardClass = SampleIdPredicate.class) ISampleId sampleId, boolean allVersions) { Session session = getSession(sessionToken); @@ -1358,7 +1345,7 @@ public class GeneralInformationService extends AbstractServer<IGeneralInformatio { return commonServer.listPersons(sessionToken); } - + @Override @Transactional(readOnly = true) @RolesAllowed(RoleWithHierarchy.SPACE_USER) @@ -1368,11 +1355,11 @@ public class GeneralInformationService extends AbstractServer<IGeneralInformatio SQLQuery querySampleTypeId = currentSession.createSQLQuery("SELECT id from sample_types WHERE code = :sampleTypeCode"); querySampleTypeId.setParameter("sampleTypeCode", sampleTypeCode); int sampleTypeId = ((Number) querySampleTypeId.uniqueResult()).intValue(); - + SQLQuery querySampleCount = currentSession.createSQLQuery("SELECT COUNT(*) FROM samples_all WHERE saty_id = :sampleTypeId"); querySampleCount.setParameter("sampleTypeId", sampleTypeId); long sampleCount = ((Number) querySampleCount.uniqueResult()).longValue(); - + return sampleCount; } } diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/api/v1/GeneralInformationServiceJsonServer.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/api/v1/GeneralInformationServiceJsonServer.java index f80f5428440..d3fa4391796 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/api/v1/GeneralInformationServiceJsonServer.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/api/v1/GeneralInformationServiceJsonServer.java @@ -56,11 +56,12 @@ public class GeneralInformationServiceJsonServer extends AbstractApiJsonServiceE } @RequestMapping( - { IGeneralInformationService.JSON_SERVICE_URL, - "/openbis" + IGeneralInformationService.JSON_SERVICE_URL }) + { IGeneralInformationService.JSON_SERVICE_URL, + "/openbis" + IGeneralInformationService.JSON_SERVICE_URL }) public void handleRequest(HttpServletRequest request, HttpServletResponse response) throws ServletException, - IOException { + IOException + { super.handleRequest(request, response); } } diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/api/v1/GeneralInformationServiceServer.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/api/v1/GeneralInformationServiceServer.java index 7d1d59f5272..6afab5e88bf 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/api/v1/GeneralInformationServiceServer.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/api/v1/GeneralInformationServiceServer.java @@ -30,8 +30,6 @@ import ch.systemsx.cisd.openbis.common.api.server.AbstractApiServiceExporter; import ch.systemsx.cisd.openbis.generic.shared.api.v1.IGeneralInformationService; /** - * - * * @author Franz-Josef Elmer */ @Controller @@ -47,14 +45,15 @@ public class GeneralInformationServiceServer extends AbstractApiServiceExporter IGeneralInformationService.SERVICE_NAME, IGeneralInformationService.SERVICE_URL); super.afterPropertiesSet(); } - @RequestMapping( - { IGeneralInformationService.SERVICE_URL, "/openbis" + IGeneralInformationService.SERVICE_URL, "/openbis/openbis" + IGeneralInformationService.SERVICE_URL }) + { IGeneralInformationService.SERVICE_URL, "/openbis" + IGeneralInformationService.SERVICE_URL, + "/openbis/openbis" + IGeneralInformationService.SERVICE_URL }) @Override public void handleRequest(HttpServletRequest request, HttpServletResponse response) - throws ServletException, IOException { + throws ServletException, IOException + { super.handleRequest(request, response); } - + } diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/api/v1/SampleToDataSetRelatedEntitiesTranslator.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/api/v1/SampleToDataSetRelatedEntitiesTranslator.java index 3a480ed5eb8..382e8ac8b8b 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/api/v1/SampleToDataSetRelatedEntitiesTranslator.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/api/v1/SampleToDataSetRelatedEntitiesTranslator.java @@ -42,11 +42,9 @@ class SampleToDataSetRelatedEntitiesTranslator private final ArrayList<BasicEntityInformationHolder> entityInformationHolders; /** - * Creates a translator from public {@Sample} objects to the internal - * {@link DataSetRelatedEntities} objects. + * Creates a translator from public {@Sample} objects to the internal {@link DataSetRelatedEntities} objects. * <p> - * A list of sample types known to the DB must be provided because Sample knows only the code of - * the SampleType. + * A list of sample types known to the DB must be provided because Sample knows only the code of the SampleType. * * @param sampleTypes A list of SampleTypes known to the DB. * @param samples The samples to convert. diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/api/v1/WebInformationServiceJsonServer.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/api/v1/WebInformationServiceJsonServer.java index 736de594016..e2f5dff6987 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/api/v1/WebInformationServiceJsonServer.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/api/v1/WebInformationServiceJsonServer.java @@ -55,11 +55,12 @@ public class WebInformationServiceJsonServer extends AbstractApiJsonServiceExpor } @RequestMapping( - { IWebInformationService.JSON_SERVICE_URL, "/openbis" + IWebInformationService.JSON_SERVICE_URL }) + { IWebInformationService.JSON_SERVICE_URL, "/openbis" + IWebInformationService.JSON_SERVICE_URL }) @Override public void handleRequest(HttpServletRequest request, HttpServletResponse response) throws ServletException, - IOException { + IOException + { super.handleRequest(request, response); - } + } } diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/authorization/ActiveAuthorization.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/authorization/ActiveAuthorization.java index 2f53ebe55e1..e326c588bee 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/authorization/ActiveAuthorization.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/authorization/ActiveAuthorization.java @@ -19,8 +19,7 @@ package ch.systemsx.cisd.openbis.generic.server.authorization; import ch.systemsx.cisd.openbis.generic.server.dataaccess.IAuthorizationDAOFactory; /** - * A {@link IAuthorizationComponentFactory} implementation which provides components for an active - * authorization. + * A {@link IAuthorizationComponentFactory} implementation which provides components for an active authorization. * * @author Christian Ribeaud */ diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/authorization/Argument.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/authorization/Argument.java index 9f78a080076..f7dabde51a7 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/authorization/Argument.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/authorization/Argument.java @@ -6,8 +6,7 @@ import ch.systemsx.cisd.common.reflection.ModifiedShortPrefixToStringStyle; import ch.systemsx.cisd.openbis.generic.server.authorization.annotation.AuthorizationGuard; /** - * Small class encapsulating a method argument which could have been annotated with - * {@link AuthorizationGuard}. + * Small class encapsulating a method argument which could have been annotated with {@link AuthorizationGuard}. * * @author Christian Ribeaud */ diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/authorization/CapabilityMap.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/authorization/CapabilityMap.java index e6a29a98fb9..952c2cfa85e 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/authorization/CapabilityMap.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/authorization/CapabilityMap.java @@ -89,7 +89,7 @@ class CapabilityMap } String[] terms = StringUtils.split(trimmed, ';'); String firstTerm = terms[0].trim(); - + final String[] firstTermSplitted = StringUtils.split(firstTerm, " \t:", 2); if (firstTermSplitted.length != 2) { @@ -111,7 +111,7 @@ class CapabilityMap } } } - + private void addRolesForParameter(String capabilityName, String parameterTerm, String line, String filePath) { int indexOfEqual = parameterTerm.indexOf('='); @@ -129,7 +129,7 @@ class CapabilityMap String roleNames = parameterTerm.substring(indexOfEqual + 1).trim(); addRoles(capabilityName + ":" + parameterName, roleNames, line, filePath); } - + private void addRoles(String capabilityName, String roleNames, String line, String filePath) { Collection<RoleWithHierarchy> roles = capMap.get(capabilityName); @@ -157,7 +157,7 @@ class CapabilityMap } } } - + private void logWarning(String line, String filePath, String messageOrNull) { String msg = String.format( diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/authorization/DefaultAccessController.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/authorization/DefaultAccessController.java index 7c513392552..18224192b48 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/authorization/DefaultAccessController.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/authorization/DefaultAccessController.java @@ -76,7 +76,7 @@ public final class DefaultAccessController implements IAccessController new HashMap<Method, Set<RoleWithHierarchy>>(); private final Map<Method, Map<String, Set<RoleWithHierarchy>>> argumentRolesCache = new HashMap<>(); - + private final CapabilityMap capabilities = new CapabilityMap(new File("etc/capabilities")); private PredicateExecutor predicateExecutor; @@ -203,7 +203,7 @@ public final class DefaultAccessController implements IAccessController return rootRoles; } - private Set<RoleWithHierarchy> getArgumentRoles(Method method, Argument<?> argument, + private Set<RoleWithHierarchy> getArgumentRoles(Method method, Argument<?> argument, Set<RoleWithHierarchy> defaultRoles) { synchronized (argumentRolesCache) @@ -233,8 +233,8 @@ public final class DefaultAccessController implements IAccessController return roles; } } - - private Collection<RoleWithHierarchy> getRootRoles(Method method, AuthorizationGuard predicateCandidate, + + private Collection<RoleWithHierarchy> getRootRoles(Method method, AuthorizationGuard predicateCandidate, Set<RoleWithHierarchy> defaultRoles) { Collection<RoleWithHierarchy> roles = capabilities.tryGetRoles(method, predicateCandidate.name()); @@ -252,8 +252,7 @@ public final class DefaultAccessController implements IAccessController return roles; } - - private Status checkNotEmpty(List<RoleWithIdentifier> relevantRoles, Set<RoleWithHierarchy> argumentRoles, + private Status checkNotEmpty(List<RoleWithIdentifier> relevantRoles, Set<RoleWithHierarchy> argumentRoles, IAuthSession session) { if (relevantRoles.isEmpty() == false) @@ -263,7 +262,7 @@ public final class DefaultAccessController implements IAccessController final String msg = String.format(MATCHING_ROLE_NOT_FOUND_TEMPLATE, argumentRoles, session.getUserName()); return Status.createError(msg); } - + private List<RoleWithIdentifier> getRelevantRoles( final List<RoleWithIdentifier> userRoles, final Set<RoleWithHierarchy> methodOrParameterRoles) { @@ -279,8 +278,7 @@ public final class DefaultAccessController implements IAccessController } /** - * Retains {@link RoleWithIdentifier}s with {@link RoleWithIdentifier#getRole()} included in the - * set of {@link RoleWithHierarchy}s. + * Retains {@link RoleWithIdentifier}s with {@link RoleWithIdentifier#getRole()} included in the set of {@link RoleWithHierarchy}s. * * @return retained user roles */ diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/authorization/IAccessController.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/authorization/IAccessController.java index c80d6f60e8d..8357bb153cb 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/authorization/IAccessController.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/authorization/IAccessController.java @@ -33,15 +33,12 @@ public interface IAccessController /** * Whether given <code>Session</code> has enough rights to access the calling <var>method</var>. * - * @param arguments the method arguments (minus the first one which is expected to be a - * {@link IAuthSession} object). + * @param arguments the method arguments (minus the first one which is expected to be a {@link IAuthSession} object). * @throws UserFailureException if the authorization could not be checked for some reason. - * @return a {@link Status} with {@link StatusFlag#OK} if given <var>session</var> is - * authorized to access the given <code>Method</code>. In case of - * {@link StatusFlag#ERROR} you might find more information by calling - * {@link Status#tryGetErrorMessage()}. + * @return a {@link Status} with {@link StatusFlag#OK} if given <var>session</var> is authorized to access the given <code>Method</code>. In case + * of {@link StatusFlag#ERROR} you might find more information by calling {@link Status#tryGetErrorMessage()}. */ public Status isAuthorized(final IAuthSession session, final Method method, final Argument<?>[] arguments) throws UserFailureException; - + } diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/authorization/IReturnValueFilter.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/authorization/IReturnValueFilter.java index 4e756475c42..2d32763c39a 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/authorization/IReturnValueFilter.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/authorization/IReturnValueFilter.java @@ -23,8 +23,7 @@ import ch.systemsx.cisd.openbis.generic.shared.dto.IAuthSession; /** * A return value filter. * <p> - * A <code>IReturnValueFilter</code> should never throw an exception but should only take care of - * filtering. + * A <code>IReturnValueFilter</code> should never throw an exception but should only take care of filtering. * </p> * * @author Christian Ribeaud @@ -35,8 +34,8 @@ public interface IReturnValueFilter /** * Applies filtering on given <var>returnValue</var>. * - * @param returnValueOrNull the return value that should be filtered. If the method has a return - * value of type <code>void</code>, this would be <code>null</code>. + * @param returnValueOrNull the return value that should be filtered. If the method has a return value of type <code>void</code>, this would be + * <code>null</code>. */ public Object applyFilter(final IAuthSession session, final Method method, final Object returnValueOrNull); diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/authorization/NoAuthorization.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/authorization/NoAuthorization.java index 14da5d05023..4d1c40286ce 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/authorization/NoAuthorization.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/authorization/NoAuthorization.java @@ -17,8 +17,7 @@ package ch.systemsx.cisd.openbis.generic.server.authorization; /** - * A {@link IAuthorizationComponentFactory} implementation which provides components in case we do - * not want any authorization. + * A {@link IAuthorizationComponentFactory} implementation which provides components in case we do not want any authorization. * * @author Christian Ribeaud */ diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/authorization/NoReturnValueFilter.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/authorization/NoReturnValueFilter.java index 6281b6e4415..d7eeb2b4f06 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/authorization/NoReturnValueFilter.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/authorization/NoReturnValueFilter.java @@ -21,8 +21,7 @@ import java.lang.reflect.Method; import ch.systemsx.cisd.openbis.generic.shared.dto.IAuthSession; /** - * A dummy <code>IReturnValueFilter</code> implementation which does not apply any filter to given - * return value. + * A dummy <code>IReturnValueFilter</code> implementation which does not apply any filter to given return value. * * @author Christian Ribeaud */ diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/authorization/SpaceOwnerKind.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/authorization/SpaceOwnerKind.java index d58b6935374..cb1dc6176a2 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/authorization/SpaceOwnerKind.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/authorization/SpaceOwnerKind.java @@ -19,8 +19,7 @@ package ch.systemsx.cisd.openbis.generic.server.authorization; import ch.systemsx.cisd.openbis.generic.shared.basic.TechId; /** - * Enumeration of the various ways to get the space of an entity knowing its - * {@link TechId}. + * Enumeration of the various ways to get the space of an entity knowing its {@link TechId}. * * @author Piotr Buczek * @author Franz-Josef Elmer diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/authorization/annotation/AuthorizationGuard.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/authorization/annotation/AuthorizationGuard.java index cd6da3a93b9..ee80ff3a663 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/authorization/annotation/AuthorizationGuard.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/authorization/annotation/AuthorizationGuard.java @@ -39,12 +39,12 @@ public @interface AuthorizationGuard * Class responsible for evaluating the method parameter. */ Class<? extends IPredicate<?>> guardClass(); - + /** * List of roles replacing corresponding list of @RolesAllowed annotation. */ RoleWithHierarchy[] rolesAllowed() default {}; - + /** * Name of the guard. Needed for the capabilities file to override allowed roles list. */ diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/authorization/annotation/RolesAllowed.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/authorization/annotation/RolesAllowed.java index dd4efbec566..788bfc0dab5 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/authorization/annotation/RolesAllowed.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/authorization/annotation/RolesAllowed.java @@ -35,8 +35,8 @@ import ch.systemsx.cisd.openbis.generic.shared.basic.dto.RoleWithHierarchy; public @interface RolesAllowed { /** - * The set of roles that are allowed to execute a method. The method will be accessible by all - * users with a role defined in any of {@link RoleWithHierarchy#getRoles()}. + * The set of roles that are allowed to execute a method. The method will be accessible by all users with a role defined in any of + * {@link RoleWithHierarchy#getRoles()}. */ RoleWithHierarchy[] value() default {}; diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/authorization/predicate/AbstractPredicate.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/authorization/predicate/AbstractPredicate.java index cbe5a4651b7..d177444f587 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/authorization/predicate/AbstractPredicate.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/authorization/predicate/AbstractPredicate.java @@ -28,8 +28,7 @@ import ch.systemsx.cisd.openbis.generic.shared.basic.dto.RoleWithHierarchy.RoleL import ch.systemsx.cisd.openbis.generic.shared.dto.PersonPE; /** - * An <i>abstract</i> <code>IPredicate</code> implementation which mainly checks method parameters - * before doing the real work. + * An <i>abstract</i> <code>IPredicate</code> implementation which mainly checks method parameters before doing the real work. * * @author Christian Ribeaud */ @@ -50,8 +49,7 @@ public abstract class AbstractPredicate<T> implements IPredicate<T> final List<RoleWithIdentifier> allowedRoles, final T value); /** - * Is the checked value allowed to be <code>null</code>, <code>false</code> by default. - * Can be overridden in sub-classes. + * Is the checked value allowed to be <code>null</code>, <code>false</code> by default. Can be overridden in sub-classes. */ protected boolean isNullValueAllowed() { @@ -59,8 +57,7 @@ public abstract class AbstractPredicate<T> implements IPredicate<T> } /** - * Returns <code>true</code> if <var>allowedRoles</var> contains a role that allows writing to - * all entities. + * Returns <code>true</code> if <var>allowedRoles</var> contains a role that allows writing to all entities. */ public static Status hasInstanceWritePermissions(PersonPE aPerson, List<RoleWithIdentifier> allowedRoles) @@ -82,8 +79,7 @@ public abstract class AbstractPredicate<T> implements IPredicate<T> } /** - * Returns <code>true</code> if <var>allowedRoles</var> contains a role that allows reading all - * entities. + * Returns <code>true</code> if <var>allowedRoles</var> contains a role that allows reading all entities. */ public static Status hasInstanceReadPermissions(PersonPE aPerson, List<RoleWithIdentifier> allowedRoles) diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/authorization/predicate/AbstractProjectPredicate.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/authorization/predicate/AbstractProjectPredicate.java index b26d73e5295..555184f4215 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/authorization/predicate/AbstractProjectPredicate.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/authorization/predicate/AbstractProjectPredicate.java @@ -20,8 +20,7 @@ import ch.systemsx.cisd.openbis.generic.server.authorization.IAuthorizationDataP import ch.systemsx.cisd.openbis.generic.server.authorization.predicate.AbstractTechIdPredicate.ProjectTechIdPredicate; /** - * An <code>IPredicate</code> implementation that has the tools for authenticating projects based on - * any kind of identifier. + * An <code>IPredicate</code> implementation that has the tools for authenticating projects based on any kind of identifier. * * @author Bernd Rinn */ diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/authorization/predicate/AbstractTechIdPredicate.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/authorization/predicate/AbstractTechIdPredicate.java index 859ad685800..7dfd3dc746a 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/authorization/predicate/AbstractTechIdPredicate.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/authorization/predicate/AbstractTechIdPredicate.java @@ -26,8 +26,7 @@ import ch.systemsx.cisd.openbis.generic.shared.dto.PersonPE; import ch.systemsx.cisd.openbis.generic.shared.dto.SpacePE; /** - * An <code>IPredicate</code> abstract implementation based on {@link TechId} and - * {@link SpaceOwnerKind} + * An <code>IPredicate</code> abstract implementation based on {@link TechId} and {@link SpaceOwnerKind} * * @author Piotr Buczek */ diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/authorization/predicate/AtomicOperationsPredicate.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/authorization/predicate/AtomicOperationsPredicate.java index e49b7ff5709..9e84daed0ea 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/authorization/predicate/AtomicOperationsPredicate.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/authorization/predicate/AtomicOperationsPredicate.java @@ -35,8 +35,7 @@ import ch.systemsx.cisd.openbis.generic.shared.dto.identifier.ExperimentIdentifi import ch.systemsx.cisd.openbis.generic.shared.dto.identifier.SampleIdentifier; /** - * The predicate for the {@link AtomicEntityOperationDetails}. This check is always being performed - * as the user + * The predicate for the {@link AtomicEntityOperationDetails}. This check is always being performed as the user * * @author Chandrasekhar Ramakrishnan */ diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/authorization/predicate/DataSetUpdatesCollectionPredicate.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/authorization/predicate/DataSetUpdatesCollectionPredicate.java index 30e12af3dbf..64358a73edc 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/authorization/predicate/DataSetUpdatesCollectionPredicate.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/authorization/predicate/DataSetUpdatesCollectionPredicate.java @@ -34,9 +34,8 @@ import ch.systemsx.cisd.openbis.generic.shared.dto.identifier.SampleIdentifier; import ch.systemsx.cisd.openbis.generic.shared.dto.identifier.SampleOwnerIdentifier; /** - * Predicate for lists of {@link DataSetUpdatesDTO} instances. Checks that the user has update - * rights for all data sets. In addition for all data sets with changed samples or experiments it is - * check that the user has access rights for those samples and experiments. + * Predicate for lists of {@link DataSetUpdatesDTO} instances. Checks that the user has update rights for all data sets. In addition for all data sets + * with changed samples or experiments it is check that the user has access rights for those samples and experiments. * * @author Franz-Josef Elmer */ diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/authorization/predicate/DataSetUpdatesPredicate.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/authorization/predicate/DataSetUpdatesPredicate.java index 52832ad7cb5..e9d08753619 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/authorization/predicate/DataSetUpdatesPredicate.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/authorization/predicate/DataSetUpdatesPredicate.java @@ -27,9 +27,8 @@ import ch.systemsx.cisd.openbis.generic.shared.dto.PersonPE; import ch.systemsx.cisd.openbis.generic.shared.dto.identifier.SampleIdentifier; /** - * An <code>IPredicate</code> implementation based on {@link DataSetUpdatesDTO}. Checks that: 1) the - * user has rights to update the data set 2) if data set is moved to a different sample the user has - * access to this sample. + * An <code>IPredicate</code> implementation based on {@link DataSetUpdatesDTO}. Checks that: 1) the user has rights to update the data set 2) if data + * set is moved to a different sample the user has access to this sample. * * @author Piotr Buczek */ @@ -59,8 +58,7 @@ public class DataSetUpdatesPredicate extends AbstractPredicate<DataSetUpdatesDTO } @Override - protected - Status doEvaluation(final PersonPE person, final List<RoleWithIdentifier> allowedRoles, + protected Status doEvaluation(final PersonPE person, final List<RoleWithIdentifier> allowedRoles, final DataSetUpdatesDTO updates) { assert dataSetTechIdPredicate.initialized : "Predicate has not been initialized"; diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/authorization/predicate/DelegatedNullableAbstractPredicate.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/authorization/predicate/DelegatedNullableAbstractPredicate.java index 45440e112d2..e9b417336d7 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/authorization/predicate/DelegatedNullableAbstractPredicate.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/authorization/predicate/DelegatedNullableAbstractPredicate.java @@ -24,8 +24,8 @@ import ch.systemsx.cisd.openbis.generic.server.authorization.RoleWithIdentifier; import ch.systemsx.cisd.openbis.generic.shared.dto.PersonPE; /** - * An <code>AbstractPredicate</code> extension which delegates its method calls to the encapsulated - * {@link AbstractPredicate} allowing the value to be null. + * An <code>AbstractPredicate</code> extension which delegates its method calls to the encapsulated {@link AbstractPredicate} allowing the value to be + * null. * * @author Piotr Buczek */ diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/authorization/predicate/DelegatedPredicate.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/authorization/predicate/DelegatedPredicate.java index 58d795dfee1..8ad534db890 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/authorization/predicate/DelegatedPredicate.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/authorization/predicate/DelegatedPredicate.java @@ -24,12 +24,10 @@ import ch.systemsx.cisd.openbis.generic.server.authorization.RoleWithIdentifier; import ch.systemsx.cisd.openbis.generic.shared.dto.PersonPE; /** - * An <code>AbstractPredicate</code> extension which delegates its method calls to the encapsulated - * {@link IPredicate}. + * An <code>AbstractPredicate</code> extension which delegates its method calls to the encapsulated {@link IPredicate}. * <p> - * Each implementation should know how to convert <code>T</code> to <code>P</code> by implementing - * {@link #tryConvert(Object)} method. Note that {@link #doEvaluation(PersonPE, List, Object)} - * delegates its call to {@link IPredicate#evaluate(PersonPE, List, Object)} of the specified + * Each implementation should know how to convert <code>T</code> to <code>P</code> by implementing {@link #tryConvert(Object)} method. Note that + * {@link #doEvaluation(PersonPE, List, Object)} delegates its call to {@link IPredicate#evaluate(PersonPE, List, Object)} of the specified * <code>delegate</code>. * </p> * diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/authorization/predicate/ExistingSpaceIdentifierPredicate.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/authorization/predicate/ExistingSpaceIdentifierPredicate.java index ccdc0e4ddf3..f65d7158210 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/authorization/predicate/ExistingSpaceIdentifierPredicate.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/authorization/predicate/ExistingSpaceIdentifierPredicate.java @@ -16,7 +16,6 @@ package ch.systemsx.cisd.openbis.generic.server.authorization.predicate; - /** * A {@link SpaceIdentifierPredicate} which evaluates to OK if the space does not exist. * diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/authorization/predicate/ExperimentUpdatesPredicate.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/authorization/predicate/ExperimentUpdatesPredicate.java index 7d1cf715f16..8572f787536 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/authorization/predicate/ExperimentUpdatesPredicate.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/authorization/predicate/ExperimentUpdatesPredicate.java @@ -24,9 +24,8 @@ import ch.systemsx.cisd.openbis.generic.shared.dto.ExperimentUpdatesDTO; import ch.systemsx.cisd.openbis.generic.shared.dto.PersonPE; /** - * An <code>IPredicate</code> implementation based on {@link ExperimentUpdatesDTO}. Checks that: 1) - * the user has rights to update the experiment 2) if experiment is moved to a different projects - * the user has access to this project. + * An <code>IPredicate</code> implementation based on {@link ExperimentUpdatesDTO}. Checks that: 1) the user has rights to update the experiment 2) if + * experiment is moved to a different projects the user has access to this project. * * @author Tomasz Pylak */ diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/authorization/predicate/IPredicate.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/authorization/predicate/IPredicate.java index 62851ab331f..af22024b16a 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/authorization/predicate/IPredicate.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/authorization/predicate/IPredicate.java @@ -28,8 +28,8 @@ import ch.systemsx.cisd.openbis.generic.shared.dto.PersonPE; /** * Performs some predicate which returns a {@link Status} based on the input objects. * <p> - * Each implementation is expected to have an empty <code>public</code> constructor and might be - * statefull. So do not try to reuse it. Use a {@link IPredicateFactory} to get an implementation. + * Each implementation is expected to have an empty <code>public</code> constructor and might be statefull. So do not try to reuse it. Use a + * {@link IPredicateFactory} to get an implementation. * </p> * * @author Christian Ribeaud diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/authorization/predicate/ListSamplesByPropertyPredicate.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/authorization/predicate/ListSamplesByPropertyPredicate.java index fab5175ce71..a2218b2ea61 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/authorization/predicate/ListSamplesByPropertyPredicate.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/authorization/predicate/ListSamplesByPropertyPredicate.java @@ -25,9 +25,8 @@ import ch.systemsx.cisd.openbis.generic.shared.dto.ListSamplesByPropertyCriteria import ch.systemsx.cisd.openbis.generic.shared.dto.PersonPE; /** - * An <code>IPredicate</code> implementation based on {@link ListSamplesByPropertyCriteria}. Checks - * that the user has the right to access the group from which samples are referenced. Note that we - * can ignore the experiment, since it belongs to the same group. + * An <code>IPredicate</code> implementation based on {@link ListSamplesByPropertyCriteria}. Checks that the user has the right to access the group + * from which samples are referenced. Note that we can ignore the experiment, since it belongs to the same group. * * @author Tomasz Pylak */ @@ -54,8 +53,7 @@ public class ListSamplesByPropertyPredicate extends } @Override - protected - Status doEvaluation(final PersonPE person, final List<RoleWithIdentifier> allowedRoles, + protected Status doEvaluation(final PersonPE person, final List<RoleWithIdentifier> allowedRoles, final ListSamplesByPropertyCriteria criteria) { assert spacePredicate.initialized : "Predicate has not been initialized"; diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/authorization/predicate/NewDataSetsWithTypePredicate.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/authorization/predicate/NewDataSetsWithTypePredicate.java index 9dd927ac5c7..eb605b83c80 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/authorization/predicate/NewDataSetsWithTypePredicate.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/authorization/predicate/NewDataSetsWithTypePredicate.java @@ -49,8 +49,7 @@ public class NewDataSetsWithTypePredicate extends AbstractPredicate<NewDataSetsW } @Override - protected - Status doEvaluation(PersonPE person, List<RoleWithIdentifier> allowedRoles, + protected Status doEvaluation(PersonPE person, List<RoleWithIdentifier> allowedRoles, NewDataSetsWithTypes dataSets) { List<String> codes = new ArrayList<String>(); diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/authorization/predicate/NullableGroupIdentifierPredicate.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/authorization/predicate/NullableGroupIdentifierPredicate.java index 8fd15faff82..ff4de6715c5 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/authorization/predicate/NullableGroupIdentifierPredicate.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/authorization/predicate/NullableGroupIdentifierPredicate.java @@ -19,8 +19,7 @@ package ch.systemsx.cisd.openbis.generic.server.authorization.predicate; import ch.systemsx.cisd.openbis.generic.shared.dto.identifier.SpaceIdentifier; /** - * An <code>IPredicate</code> implementation based on {@link SpaceIdentifierPredicate} which allows - * the identifier to be null. + * An <code>IPredicate</code> implementation based on {@link SpaceIdentifierPredicate} which allows the identifier to be null. * * @author Tomasz Pylak */ diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/authorization/predicate/RevertDeletionPredicate.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/authorization/predicate/RevertDeletionPredicate.java index 006d3f2bb22..5cb787fea80 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/authorization/predicate/RevertDeletionPredicate.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/authorization/predicate/RevertDeletionPredicate.java @@ -46,8 +46,7 @@ public class RevertDeletionPredicate extends AbstractPredicate<List<TechId>> } @Override - public void init(@SuppressWarnings("hiding") - IAuthorizationDataProvider provider) + public void init(@SuppressWarnings("hiding") IAuthorizationDataProvider provider) { this.provider = provider; deletionTechIdCollectionPredicate.init(provider); diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/authorization/predicate/SamplePredicate.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/authorization/predicate/SamplePredicate.java index 088c03afd8a..222bbaf2b58 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/authorization/predicate/SamplePredicate.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/authorization/predicate/SamplePredicate.java @@ -22,9 +22,8 @@ import java.util.List; import ch.systemsx.cisd.openbis.generic.shared.api.v1.dto.Sample; /** - * Predicate based on {@link ch.systemsx.cisd.openbis.generic.shared.api.v1.dto.Sample}. This - * predicate authorizes for read-only access, i.e. it will allow access to shared samples for all - * users. + * Predicate based on {@link ch.systemsx.cisd.openbis.generic.shared.api.v1.dto.Sample}. This predicate authorizes for read-only access, i.e. it will + * allow access to shared samples for all users. * * @author Bernd Rinn */ diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/authorization/predicate/SampleTechIdPredicate.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/authorization/predicate/SampleTechIdPredicate.java index d961fb39841..6c42f2a30f8 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/authorization/predicate/SampleTechIdPredicate.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/authorization/predicate/SampleTechIdPredicate.java @@ -63,8 +63,7 @@ public class SampleTechIdPredicate extends AbstractDatabaseInstancePredicate<Tec } @Override - protected - final Status doEvaluation(final PersonPE person, final List<RoleWithIdentifier> allowedRoles, + protected final Status doEvaluation(final PersonPE person, final List<RoleWithIdentifier> allowedRoles, final TechId techId) { SamplePE sample = authorizationDataProvider.getSample(techId); diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/authorization/predicate/SampleUpdatesCollectionPredicate.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/authorization/predicate/SampleUpdatesCollectionPredicate.java index ddfc654ce3a..9a79f31e0fe 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/authorization/predicate/SampleUpdatesCollectionPredicate.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/authorization/predicate/SampleUpdatesCollectionPredicate.java @@ -33,8 +33,7 @@ import ch.systemsx.cisd.openbis.generic.shared.dto.identifier.SampleIdentifier; import ch.systemsx.cisd.openbis.generic.shared.dto.identifier.SampleOwnerIdentifier; /** - * Predicate for a list of {@link SampleUpdatesDTO} instances. The logical is similar to - * {@link SampleUpdatesPredicate}. + * Predicate for a list of {@link SampleUpdatesDTO} instances. The logical is similar to {@link SampleUpdatesPredicate}. * * @author Franz-Josef Elmer */ diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/authorization/predicate/SampleUpdatesPredicate.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/authorization/predicate/SampleUpdatesPredicate.java index 3f73b47f444..861696a6d2e 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/authorization/predicate/SampleUpdatesPredicate.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/authorization/predicate/SampleUpdatesPredicate.java @@ -24,9 +24,8 @@ import ch.systemsx.cisd.openbis.generic.shared.dto.PersonPE; import ch.systemsx.cisd.openbis.generic.shared.dto.SampleUpdatesDTO; /** - * An <code>IPredicate</code> implementation based on {@link SampleUpdatesDTO}. Checks that: 1) the - * user has rights to update the sample 2) if sample is moved to a different group the user has - * access to this group 3) if sample is attached to experiment, user has access to this experiment. + * An <code>IPredicate</code> implementation based on {@link SampleUpdatesDTO}. Checks that: 1) the user has rights to update the sample 2) if sample + * is moved to a different group the user has access to this group 3) if sample is attached to experiment, user has access to this experiment. * * @author Izabela Adamczyk */ diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/authorization/validator/AbstractValidator.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/authorization/validator/AbstractValidator.java index 3819e810b54..5c5ee7a10a1 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/authorization/validator/AbstractValidator.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/authorization/validator/AbstractValidator.java @@ -20,8 +20,7 @@ import ch.systemsx.cisd.openbis.generic.server.authorization.IAuthorizationDataP import ch.systemsx.cisd.openbis.generic.shared.dto.PersonPE; /** - * An <i>abstract</i> <code>IValidator</code> implementation which mainly checks method parameters - * before doing the real work. + * An <i>abstract</i> <code>IValidator</code> implementation which mainly checks method parameters before doing the real work. * * @author Christian Ribeaud */ diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/authorization/validator/IValidator.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/authorization/validator/IValidator.java index 0730e1f5df3..1929e02d3d6 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/authorization/validator/IValidator.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/authorization/validator/IValidator.java @@ -21,11 +21,10 @@ import ch.systemsx.cisd.openbis.generic.server.authorization.ValidatorStore; import ch.systemsx.cisd.openbis.generic.shared.dto.PersonPE; /** - * Performs some validation which returns <code>true</code> or <code>false</code> based on the input - * objects. + * Performs some validation which returns <code>true</code> or <code>false</code> based on the input objects. * <p> - * Each implementation is expected to have an empty <code>public</code> constructor and is expected - * to be stateless. Use {@link ValidatorStore} to get an implementation. + * Each implementation is expected to have an empty <code>public</code> constructor and is expected to be stateless. Use {@link ValidatorStore} to get + * an implementation. * </p> * * @author Christian Ribeaud diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/authorization/validator/ProjectValidator.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/authorization/validator/ProjectValidator.java index 0cb71cba4b1..7ba9a737a59 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/authorization/validator/ProjectValidator.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/authorization/validator/ProjectValidator.java @@ -44,5 +44,5 @@ public final class ProjectValidator extends AbstractValidator<Project> final Space space = value.getSpace(); return groupValidator.isValid(person, space); } - + } diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/authorization/validator/SearchDomainSearchResultValidator.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/authorization/validator/SearchDomainSearchResultValidator.java index 9e35e7c1eb9..b5ef1159b91 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/authorization/validator/SearchDomainSearchResultValidator.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/authorization/validator/SearchDomainSearchResultValidator.java @@ -31,7 +31,9 @@ import ch.systemsx.cisd.openbis.generic.shared.dto.PersonPE; public class SearchDomainSearchResultValidator extends AbstractValidator<SearchDomainSearchResultWithFullEntity> { private final ExternalDataValidator dataSetValidator = new ExternalDataValidator(); + private final SampleValidator sampleValidator = new SampleValidator(); + private final ExperimentValidator experimentValidator = new ExperimentValidator(); @Override diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/batch/AbstractBatchOperationDelegate.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/batch/AbstractBatchOperationDelegate.java index 0f5f0193f8e..f6c18553887 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/batch/AbstractBatchOperationDelegate.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/batch/AbstractBatchOperationDelegate.java @@ -17,8 +17,7 @@ package ch.systemsx.cisd.openbis.generic.server.batch; /** - * A shell superclass for batch operation delegates. Subclasses only need to override those methods - * they actually use. + * A shell superclass for batch operation delegates. Subclasses only need to override those methods they actually use. * * @author Chandrasekhar Ramakrishnan */ diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/batch/BatchOperationExecutor.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/batch/BatchOperationExecutor.java index 21e37048135..7bc393f25ea 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/batch/BatchOperationExecutor.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/batch/BatchOperationExecutor.java @@ -29,10 +29,9 @@ public class BatchOperationExecutor * Executes an operation in batches using the default batch size. * * @param strategy The operation to execute - * @param progressListenerOrNull The progress listener to notify of progress. If this is - * non-null, the progressPhaseOrNull must be non-null as well. - * @param progressPhaseOrNull The phase used in updating the progressListenerOrNull. Must be - * non-null if the progressListenerOrNull is + * @param progressListenerOrNull The progress listener to notify of progress. If this is non-null, the progressPhaseOrNull must be non-null as + * well. + * @param progressPhaseOrNull The phase used in updating the progressListenerOrNull. Must be non-null if the progressListenerOrNull is */ public static <S> void executeInBatches(IBatchOperation<S> strategy, IServiceConversationProgressListener progressListenerOrNull, String progressPhaseOrNull) @@ -50,10 +49,9 @@ public class BatchOperationExecutor * * @param strategy The operation to execute * @param batchSize The size of the batches - * @param progressListenerOrNull The progress listener to notify of progress. If this is - * non-null, the progressPhaseOrNull must be non-null as well. - * @param progressPhaseOrNull The phase used in updating the progressListenerOrNull. Must be - * non-null if the progressListenerOrNull is + * @param progressListenerOrNull The progress listener to notify of progress. If this is non-null, the progressPhaseOrNull must be non-null as + * well. + * @param progressPhaseOrNull The phase used in updating the progressListenerOrNull. Must be non-null if the progressListenerOrNull is */ public static <S> void executeInBatches(IBatchOperation<S> strategy, int batchSize, IServiceConversationProgressListener progressListenerOrNull, String progressPhaseOrNull) diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/batch/SampleUpdate.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/batch/SampleUpdate.java index eba771887b2..a17a9b15bc7 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/batch/SampleUpdate.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/batch/SampleUpdate.java @@ -22,12 +22,11 @@ import ch.systemsx.cisd.openbis.generic.server.business.bo.ISampleTable; import ch.systemsx.cisd.openbis.generic.shared.dto.SampleUpdatesDTO; /** - * {@link IBatchOperation} updating samples. It is like {@link SampleBatchUpdate}, but uses - * {@link SampleUpdatesDTO} to specify the updates instead of {@link SampleBatchUpdate} and thus has - * slightly different semantics. + * {@link IBatchOperation} updating samples. It is like {@link SampleBatchUpdate}, but uses {@link SampleUpdatesDTO} to specify the updates instead of + * {@link SampleBatchUpdate} and thus has slightly different semantics. * <p> - * Whereas SampleBatchUpdate only makes changes to the sample that are explicitly specified in it - * the details object of its DTO, SampleUpdate changes the sample to match the DTO. + * Whereas SampleBatchUpdate only makes changes to the sample that are explicitly specified in it the details object of its DTO, SampleUpdate changes + * the sample to match the DTO. * * @author Chandrasekhar Ramakrishnan */ diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/DataStoreServiceFactory.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/DataStoreServiceFactory.java index 704445259ee..4e3d2f2136b 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/DataStoreServiceFactory.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/DataStoreServiceFactory.java @@ -56,10 +56,11 @@ public class DataStoreServiceFactory implements IDataStoreServiceFactory "Monitoring Proxy").corePoolSize(NUMBER_OF_CORE_THREADS).daemonize(); @Override - public IDataStoreService create(String serverURL) { + public IDataStoreService create(String serverURL) + { return create(serverURL, 5 * DateUtils.MILLIS_PER_MINUTE); } - + @Override public IDataStoreService create(String serverURL, long timeout) { @@ -89,7 +90,7 @@ public class DataStoreServiceFactory implements IDataStoreServiceFactory .executorService(executorService) .callAsynchronously( IDataStoreService.class.getMethod("cleanupSession", new Class<?>[] - { String.class })).get(); + { String.class })).get(); } catch (SecurityException ex) { throw CheckedExceptionTunnel.wrapIfNecessary(ex); diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/IDataStoreServiceFactory.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/IDataStoreServiceFactory.java index ef9cf77610d..900d8cfcadd 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/IDataStoreServiceFactory.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/IDataStoreServiceFactory.java @@ -27,10 +27,9 @@ public interface IDataStoreServiceFactory public IDataStoreService create(String serverURL); public IDataStoreService create(String serverURL, long timeout); - + /** - * Creates a monitored version of the service where - * {@link IDataStoreService#cleanupSession(String)} is run asynchronously. + * Creates a monitored version of the service where {@link IDataStoreService#cleanupSession(String)} is run asynchronously. */ public IDataStoreService createMonitored(String serverURL, LogLevel logLevelForNotSuccessfulCalls); } diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/IEntityOperationChecker.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/IEntityOperationChecker.java index 0b0f75063c9..85c0fc2d75e 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/IEntityOperationChecker.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/IEntityOperationChecker.java @@ -34,15 +34,13 @@ public interface IEntityOperationChecker { @RolesAllowed( - { RoleWithHierarchy.INSTANCE_ADMIN, RoleWithHierarchy.INSTANCE_ETL_SERVER }) + { RoleWithHierarchy.INSTANCE_ADMIN, RoleWithHierarchy.INSTANCE_ETL_SERVER }) public void assertInstanceSampleCreationAllowed(IAuthSession session, - @AuthorizationGuard(guardClass = NewSamplePredicate.class) - List<? extends NewSample> instanceSamples); + @AuthorizationGuard(guardClass = NewSamplePredicate.class) List<? extends NewSample> instanceSamples); @RolesAllowed( - { RoleWithHierarchy.INSTANCE_ADMIN, RoleWithHierarchy.INSTANCE_ETL_SERVER }) + { RoleWithHierarchy.INSTANCE_ADMIN, RoleWithHierarchy.INSTANCE_ETL_SERVER }) public void assertInstanceSampleUpdateAllowed(IAuthSession session, - @AuthorizationGuard(guardClass = SampleOwnerIdentifierPredicate.class) - List<? extends SampleOwnerIdentifier> instanceSamples); + @AuthorizationGuard(guardClass = SampleOwnerIdentifierPredicate.class) List<? extends SampleOwnerIdentifier> instanceSamples); } diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/IRelationshipService.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/IRelationshipService.java index cc028262fc7..00af457ed65 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/IRelationshipService.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/IRelationshipService.java @@ -50,27 +50,24 @@ public interface IRelationshipService { RoleWithHierarchy.SPACE_ETL_SERVER, RoleWithHierarchy.SPACE_POWER_USER }) @Capability("ASSIGN_EXPERIMENT_TO_PROJECT") public void assignExperimentToProject(IAuthSession session, - @AuthorizationGuard(guardClass = ExperimentPEPredicate.class) - ExperimentPE experiment, @AuthorizationGuard(guardClass = ProjectPEPredicate.class) - ProjectPE project); + @AuthorizationGuard(guardClass = ExperimentPEPredicate.class) ExperimentPE experiment, + @AuthorizationGuard(guardClass = ProjectPEPredicate.class) ProjectPE project); @Transactional(propagation = Propagation.MANDATORY) @RolesAllowed(value = { RoleWithHierarchy.SPACE_ETL_SERVER, RoleWithHierarchy.SPACE_POWER_USER }) @Capability("ASSIGN_SAMPLE_TO_PROJECT") public void assignSampleToProject(IAuthSession session, - @AuthorizationGuard(guardClass = SamplePEPredicate.class) - SamplePE sample, @AuthorizationGuard(guardClass = ProjectPEPredicate.class) - ProjectPE project); + @AuthorizationGuard(guardClass = SamplePEPredicate.class) SamplePE sample, + @AuthorizationGuard(guardClass = ProjectPEPredicate.class) ProjectPE project); @Transactional(propagation = Propagation.MANDATORY) @RolesAllowed(value = { RoleWithHierarchy.SPACE_ETL_SERVER, RoleWithHierarchy.SPACE_POWER_USER }) @Capability("ASSIGN_PROJECT_TO_SPACE") public void assignProjectToSpace(IAuthSession session, - @AuthorizationGuard(guardClass = ProjectPEPredicate.class) - ProjectPE project, @AuthorizationGuard(guardClass = SpacePEPredicate.class) - SpacePE space); + @AuthorizationGuard(guardClass = ProjectPEPredicate.class) ProjectPE project, + @AuthorizationGuard(guardClass = SpacePEPredicate.class) SpacePE space); @Transactional(propagation = Propagation.MANDATORY) @RolesAllowed(value = @@ -78,149 +75,130 @@ public interface IRelationshipService RoleWithHierarchy.SPACE_USER }) @Capability("ASSIGN_SAMPLE_TO_EXPERIMENT") public void assignSampleToExperiment(IAuthSession session, - @AuthorizationGuard(guardClass = SamplePEPredicate.class) - SamplePE sample, @AuthorizationGuard(guardClass = ExperimentPEPredicate.class) - ExperimentPE experiment); + @AuthorizationGuard(guardClass = SamplePEPredicate.class) SamplePE sample, + @AuthorizationGuard(guardClass = ExperimentPEPredicate.class) ExperimentPE experiment); @Transactional(propagation = Propagation.MANDATORY) @RolesAllowed(value = { RoleWithHierarchy.SPACE_ETL_SERVER, RoleWithHierarchy.SPACE_POWER_USER }) @Capability("UNASSIGN_SAMPLE_FROM_EXPERIMENT") public void checkCanUnassignSampleFromExperiment(IAuthSession session, - @AuthorizationGuard(guardClass = SamplePEPredicate.class) - SamplePE sample); + @AuthorizationGuard(guardClass = SamplePEPredicate.class) SamplePE sample); @Transactional(propagation = Propagation.MANDATORY) @RolesAllowed(value = { RoleWithHierarchy.SPACE_ETL_SERVER, RoleWithHierarchy.SPACE_POWER_USER }) @Capability("UNASSIGN_SAMPLE_FROM_EXPERIMENT") public void unassignSampleFromExperiment(IAuthSession session, - @AuthorizationGuard(guardClass = SamplePEPredicate.class) - SamplePE sample); + @AuthorizationGuard(guardClass = SamplePEPredicate.class) SamplePE sample); @Transactional(propagation = Propagation.MANDATORY) @RolesAllowed(value = { RoleWithHierarchy.SPACE_ETL_SERVER, RoleWithHierarchy.SPACE_POWER_USER }) @Capability("UNASSIGN_SAMPLE_FROM_PROJECT") public void unassignSampleFromProject(IAuthSession session, - @AuthorizationGuard(guardClass = SamplePEPredicate.class) - SamplePE sample); + @AuthorizationGuard(guardClass = SamplePEPredicate.class) SamplePE sample); @Transactional(propagation = Propagation.MANDATORY) @RolesAllowed(value = { RoleWithHierarchy.INSTANCE_ETL_SERVER, RoleWithHierarchy.INSTANCE_ADMIN }) @Capability("UNSHARE_SAMPLE") public void unshareSample(IAuthSession session, - @AuthorizationGuard(guardClass = SamplePEPredicate.class) - SamplePE sample, @AuthorizationGuard(guardClass = SpacePEPredicate.class) - SpacePE space); + @AuthorizationGuard(guardClass = SamplePEPredicate.class) SamplePE sample, + @AuthorizationGuard(guardClass = SpacePEPredicate.class) SpacePE space); @Transactional(propagation = Propagation.MANDATORY) @RolesAllowed(value = { RoleWithHierarchy.SPACE_ETL_SERVER, RoleWithHierarchy.SPACE_POWER_USER }) @Capability("ASSIGN_SAMPLE_TO_SPACE") public void assignSampleToSpace(IAuthSession session, - @AuthorizationGuard(guardClass = SamplePEPredicate.class) - SamplePE sample, @AuthorizationGuard(guardClass = SpacePEPredicate.class) - SpacePE space); + @AuthorizationGuard(guardClass = SamplePEPredicate.class) SamplePE sample, + @AuthorizationGuard(guardClass = SpacePEPredicate.class) SpacePE space); @Transactional(propagation = Propagation.MANDATORY) @RolesAllowed(value = { RoleWithHierarchy.INSTANCE_ETL_SERVER, RoleWithHierarchy.INSTANCE_ADMIN }) @Capability("SHARE_SAMPLE") public void shareSample(IAuthSession session, - @AuthorizationGuard(guardClass = SamplePEPredicate.class) - SamplePE sample); + @AuthorizationGuard(guardClass = SamplePEPredicate.class) SamplePE sample); @Transactional(propagation = Propagation.MANDATORY) @RolesAllowed(value = { RoleWithHierarchy.SPACE_ETL_SERVER, RoleWithHierarchy.SPACE_POWER_USER }) @Capability("ASSIGN_DATASET_TO_EXPERIMENT") public void assignDataSetToExperiment(IAuthSession session, - @AuthorizationGuard(guardClass = DataPEPredicate.class) - DataPE dataSet, @AuthorizationGuard(guardClass = ExperimentPEOrNullPredicate.class) - ExperimentPE experimentOrNull); + @AuthorizationGuard(guardClass = DataPEPredicate.class) DataPE dataSet, + @AuthorizationGuard(guardClass = ExperimentPEOrNullPredicate.class) ExperimentPE experimentOrNull); @Transactional(propagation = Propagation.MANDATORY) @RolesAllowed(value = { RoleWithHierarchy.SPACE_ETL_SERVER, RoleWithHierarchy.SPACE_POWER_USER }) @Capability("ASSIGN_DATASET_TO_SAMPLE") public void assignDataSetToSample(IAuthSession session, - @AuthorizationGuard(guardClass = DataPEPredicate.class) - DataPE dataSet, @AuthorizationGuard(guardClass = SamplePEOrNullPredicate.class) - SamplePE sampleOrNull); + @AuthorizationGuard(guardClass = DataPEPredicate.class) DataPE dataSet, + @AuthorizationGuard(guardClass = SamplePEOrNullPredicate.class) SamplePE sampleOrNull); @Transactional(propagation = Propagation.MANDATORY) @RolesAllowed(value = { RoleWithHierarchy.SPACE_ETL_SERVER, RoleWithHierarchy.SPACE_USER }) @Capability("ADD_PARENT_TO_SAMPLE") public void addParentToSample(IAuthSession session, - @AuthorizationGuard(name = "SAMPLE", guardClass = SamplePEPredicate.class) - SamplePE sample, @AuthorizationGuard(name = "PARENT", guardClass = SamplePEPredicate.class, - rolesAllowed = { RoleWithHierarchy.SPACE_ETL_SERVER, RoleWithHierarchy.SPACE_USER }) - SamplePE parent); + @AuthorizationGuard(name = "SAMPLE", guardClass = SamplePEPredicate.class) SamplePE sample, + @AuthorizationGuard(name = "PARENT", guardClass = SamplePEPredicate.class, + rolesAllowed = { RoleWithHierarchy.SPACE_ETL_SERVER, RoleWithHierarchy.SPACE_USER }) SamplePE parent); @Transactional(propagation = Propagation.MANDATORY) @RolesAllowed(value = { RoleWithHierarchy.SPACE_ETL_SERVER, RoleWithHierarchy.SPACE_POWER_USER }) @Capability("REMOVE_PARENT_FROM_SAMPLE") public void removeParentFromSample(IAuthSession session, - @AuthorizationGuard(name = "SAMPLE", guardClass = SamplePEPredicate.class) - SamplePE sample, @AuthorizationGuard(name = "PARENT", guardClass = SamplePEPredicate.class, - rolesAllowed = { RoleWithHierarchy.SPACE_ETL_SERVER, RoleWithHierarchy.SPACE_USER }) - SamplePE parent); + @AuthorizationGuard(name = "SAMPLE", guardClass = SamplePEPredicate.class) SamplePE sample, + @AuthorizationGuard(name = "PARENT", guardClass = SamplePEPredicate.class, + rolesAllowed = { RoleWithHierarchy.SPACE_ETL_SERVER, RoleWithHierarchy.SPACE_USER }) SamplePE parent); @Transactional(propagation = Propagation.MANDATORY) @RolesAllowed(value = { RoleWithHierarchy.SPACE_ETL_SERVER, RoleWithHierarchy.SPACE_POWER_USER }) @Capability("ADD_CONTAINER_TO_SAMPLE") public void assignSampleToContainer(IAuthSession session, - @AuthorizationGuard(guardClass = SamplePEPredicate.class) - SamplePE sample, @AuthorizationGuard(guardClass = SamplePEPredicate.class) - SamplePE container); + @AuthorizationGuard(guardClass = SamplePEPredicate.class) SamplePE sample, + @AuthorizationGuard(guardClass = SamplePEPredicate.class) SamplePE container); @Transactional(propagation = Propagation.MANDATORY) @RolesAllowed(value = { RoleWithHierarchy.SPACE_ETL_SERVER, RoleWithHierarchy.SPACE_POWER_USER }) @Capability("REMOVE_CONTAINER_FROM_SAMPLE") public void removeSampleFromContainer(IAuthSession session, - @AuthorizationGuard(guardClass = SamplePEPredicate.class) - SamplePE sample); + @AuthorizationGuard(guardClass = SamplePEPredicate.class) SamplePE sample); @Transactional(propagation = Propagation.MANDATORY) @RolesAllowed(value = { RoleWithHierarchy.SPACE_ETL_SERVER, RoleWithHierarchy.SPACE_POWER_USER }) @Capability("ADD_PARENT_TO_DATASET") public void addParentToDataSet(IAuthSession session, - @AuthorizationGuard(guardClass = DataPEPredicate.class) - DataPE data, @AuthorizationGuard(guardClass = DataPEPredicate.class) - DataPE parent); + @AuthorizationGuard(guardClass = DataPEPredicate.class) DataPE data, @AuthorizationGuard(guardClass = DataPEPredicate.class) DataPE parent); @Transactional(propagation = Propagation.MANDATORY) @RolesAllowed(value = { RoleWithHierarchy.SPACE_ETL_SERVER, RoleWithHierarchy.SPACE_POWER_USER }) @Capability("REMOVE_PARENT_FROM_DATASET") public void removeParentFromDataSet(IAuthSession session, - @AuthorizationGuard(guardClass = DataPEPredicate.class) - DataPE data, @AuthorizationGuard(guardClass = DataPEPredicate.class) - DataPE parent); + @AuthorizationGuard(guardClass = DataPEPredicate.class) DataPE data, @AuthorizationGuard(guardClass = DataPEPredicate.class) DataPE parent); @Transactional(propagation = Propagation.MANDATORY) @RolesAllowed(value = { RoleWithHierarchy.SPACE_ETL_SERVER, RoleWithHierarchy.SPACE_POWER_USER }) @Capability("ADD_CONTAINER_TO_DATASET") public void assignDataSetToContainer(IAuthSession session, - @AuthorizationGuard(guardClass = DataPEPredicate.class) - DataPE data, @AuthorizationGuard(guardClass = DataPEPredicate.class) - DataPE container); + @AuthorizationGuard(guardClass = DataPEPredicate.class) DataPE data, + @AuthorizationGuard(guardClass = DataPEPredicate.class) DataPE container); @Transactional(propagation = Propagation.MANDATORY) @RolesAllowed(value = { RoleWithHierarchy.SPACE_ETL_SERVER, RoleWithHierarchy.SPACE_POWER_USER }) @Capability("REMOVE_CONTAINER_FROM_DATASET") public void removeDataSetFromContainer(IAuthSession session, - @AuthorizationGuard(guardClass = DataPEPredicate.class) - DataPE data, @AuthorizationGuard(guardClass = DataPEPredicate.class) - DataPE container); + @AuthorizationGuard(guardClass = DataPEPredicate.class) DataPE data, + @AuthorizationGuard(guardClass = DataPEPredicate.class) DataPE container); } diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/PropertiesBatchEvaluationErrors.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/PropertiesBatchEvaluationErrors.java index 750ab4ead3c..817cb261ba7 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/PropertiesBatchEvaluationErrors.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/PropertiesBatchEvaluationErrors.java @@ -35,8 +35,8 @@ import ch.systemsx.cisd.openbis.generic.shared.dto.ScriptPE; class PropertiesBatchEvaluationErrors { /** - * limitation on the number of ErrorDetails objects kept in memory. This guards us from scripts - * generating unique error messages for excessively large batches. + * limitation on the number of ErrorDetails objects kept in memory. This guards us from scripts generating unique error messages for excessively + * large batches. */ static final int MAX_ERROR_DETAILS_KEPT = 10; diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/AbstractMaterialBusinessObject.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/AbstractMaterialBusinessObject.java index 0279bbee17f..3a088d4a228 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/AbstractMaterialBusinessObject.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/AbstractMaterialBusinessObject.java @@ -35,8 +35,8 @@ import ch.systemsx.cisd.openbis.generic.shared.managed_property.IManagedProperty public class AbstractMaterialBusinessObject extends AbstractBusinessObject { protected AbstractMaterialBusinessObject(final IDAOFactory daoFactory, final Session session, - IManagedPropertyEvaluatorFactory managedPropertyEvaluatorFactory, - DataSetTypeWithoutExperimentChecker dataSetTypeChecker, + IManagedPropertyEvaluatorFactory managedPropertyEvaluatorFactory, + DataSetTypeWithoutExperimentChecker dataSetTypeChecker, IRelationshipService relationshipService) { super(daoFactory, session, EntityKind.MATERIAL, managedPropertyEvaluatorFactory, dataSetTypeChecker, @@ -45,11 +45,11 @@ public class AbstractMaterialBusinessObject extends AbstractBusinessObject protected AbstractMaterialBusinessObject(final IDAOFactory daoFactory, final Session session, final IEntityPropertiesConverter entityPropertiesConverter, - IManagedPropertyEvaluatorFactory managedPropertyEvaluatorFactory, - DataSetTypeWithoutExperimentChecker dataSetTypeChecker, + IManagedPropertyEvaluatorFactory managedPropertyEvaluatorFactory, + DataSetTypeWithoutExperimentChecker dataSetTypeChecker, IRelationshipService relationshipService) { - super(daoFactory, session, entityPropertiesConverter, managedPropertyEvaluatorFactory, + super(daoFactory, session, entityPropertiesConverter, managedPropertyEvaluatorFactory, dataSetTypeChecker, relationshipService); } @@ -59,7 +59,7 @@ public class AbstractMaterialBusinessObject extends AbstractBusinessObject { assert materialId != null : "Material technical id unspecified."; String[] connections = - { PROPERTY_TYPES }; + { PROPERTY_TYPES }; final MaterialPE result = getMaterialDAO().tryGetByTechId(materialId, connections); if (result == null) { diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/AbstractSampleBusinessObject.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/AbstractSampleBusinessObject.java index 23379bfe8b5..ec1bec10939 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/AbstractSampleBusinessObject.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/AbstractSampleBusinessObject.java @@ -80,7 +80,7 @@ abstract class AbstractSampleBusinessObject extends AbstractSampleIdentifierBusi AbstractSampleBusinessObject(final IDAOFactory daoFactory, final Session session, IRelationshipService relationshipService, IEntityOperationChecker entityOperationChecker, - IManagedPropertyEvaluatorFactory managedPropertyEvaluatorFactory, + IManagedPropertyEvaluatorFactory managedPropertyEvaluatorFactory, DataSetTypeWithoutExperimentChecker dataSetTypeChecker) { super(daoFactory, session, EntityKind.SAMPLE, managedPropertyEvaluatorFactory, dataSetTypeChecker, @@ -92,10 +92,10 @@ abstract class AbstractSampleBusinessObject extends AbstractSampleIdentifierBusi final IEntityPropertiesConverter entityPropertiesConverter, IRelationshipService relationshipService, IEntityOperationChecker entityOperationChecker, - IManagedPropertyEvaluatorFactory managedPropertyEvaluatorFactory, + IManagedPropertyEvaluatorFactory managedPropertyEvaluatorFactory, DataSetTypeWithoutExperimentChecker dataSetTypeChecker) { - super(daoFactory, session, entityPropertiesConverter, managedPropertyEvaluatorFactory, + super(daoFactory, session, entityPropertiesConverter, managedPropertyEvaluatorFactory, dataSetTypeChecker, relationshipService); this.entityOperationChecker = entityOperationChecker; } diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/AbstractSampleIdentifierBusinessObject.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/AbstractSampleIdentifierBusinessObject.java index d44a978c181..9b9b7183fc4 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/AbstractSampleIdentifierBusinessObject.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/AbstractSampleIdentifierBusinessObject.java @@ -48,8 +48,8 @@ abstract class AbstractSampleIdentifierBusinessObject extends AbstractBusinessOb private final SampleOwnerFinder sampleOwnerFinder; AbstractSampleIdentifierBusinessObject(final IDAOFactory daoFactory, final Session session, - EntityKind entityKind, IManagedPropertyEvaluatorFactory managedPropertyEvaluatorFactory, - DataSetTypeWithoutExperimentChecker dataSetTypeChecker, + EntityKind entityKind, IManagedPropertyEvaluatorFactory managedPropertyEvaluatorFactory, + DataSetTypeWithoutExperimentChecker dataSetTypeChecker, IRelationshipService relationshipService) { super(daoFactory, session, entityKind, managedPropertyEvaluatorFactory, dataSetTypeChecker, relationshipService); @@ -58,8 +58,8 @@ abstract class AbstractSampleIdentifierBusinessObject extends AbstractBusinessOb public AbstractSampleIdentifierBusinessObject(IDAOFactory daoFactory, Session session, IEntityPropertiesConverter converter, - IManagedPropertyEvaluatorFactory managedPropertyEvaluatorFactory, - DataSetTypeWithoutExperimentChecker dataSetTypeChecker, + IManagedPropertyEvaluatorFactory managedPropertyEvaluatorFactory, + DataSetTypeWithoutExperimentChecker dataSetTypeChecker, IRelationshipService relationshipService) { super(daoFactory, session, converter, managedPropertyEvaluatorFactory, dataSetTypeChecker, relationshipService); diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/AttachmentBO.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/AttachmentBO.java index 47f309101dd..b945eb5bc08 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/AttachmentBO.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/AttachmentBO.java @@ -43,8 +43,8 @@ public final class AttachmentBO extends AbstractBusinessObject implements IAttac private boolean dataChanged; public AttachmentBO(final IDAOFactory daoFactory, final Session session, - IManagedPropertyEvaluatorFactory managedPropertyEvaluatorFactory, - DataSetTypeWithoutExperimentChecker dataSetTypeChecker, + IManagedPropertyEvaluatorFactory managedPropertyEvaluatorFactory, + DataSetTypeWithoutExperimentChecker dataSetTypeChecker, IRelationshipService relationshipService) { super(daoFactory, session, managedPropertyEvaluatorFactory, dataSetTypeChecker, relationshipService); diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/AuthorizationGroupBO.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/AuthorizationGroupBO.java index d4b506f2c72..c4619477454 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/AuthorizationGroupBO.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/AuthorizationGroupBO.java @@ -57,8 +57,8 @@ public class AuthorizationGroupBO extends AbstractBusinessObject implements IAut @Private AuthorizationGroupBO(IDAOFactory daoFactory, Session session, IAuthorizationGroupFactory factory, - IManagedPropertyEvaluatorFactory managedPropertyEvaluatorFactory, - DataSetTypeWithoutExperimentChecker dataSetTypeChecker, + IManagedPropertyEvaluatorFactory managedPropertyEvaluatorFactory, + DataSetTypeWithoutExperimentChecker dataSetTypeChecker, IRelationshipService relationshipService) { super(daoFactory, session, managedPropertyEvaluatorFactory, dataSetTypeChecker, relationshipService); @@ -66,11 +66,11 @@ public class AuthorizationGroupBO extends AbstractBusinessObject implements IAut } public AuthorizationGroupBO(IDAOFactory daoFactory, Session session, - IManagedPropertyEvaluatorFactory managedPropertyEvaluatorFactory, - DataSetTypeWithoutExperimentChecker dataSetTypeChecker, + IManagedPropertyEvaluatorFactory managedPropertyEvaluatorFactory, + DataSetTypeWithoutExperimentChecker dataSetTypeChecker, IRelationshipService relationshipService) { - this(daoFactory, session, new AuthorizationGroupFactory(), managedPropertyEvaluatorFactory, + this(daoFactory, session, new AuthorizationGroupFactory(), managedPropertyEvaluatorFactory, dataSetTypeChecker, relationshipService); } diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/CorePluginTable.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/CorePluginTable.java index ac1ef379b56..90f98997e63 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/CorePluginTable.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/CorePluginTable.java @@ -52,8 +52,8 @@ public final class CorePluginTable extends AbstractBusinessObject implements ICo public CorePluginTable(IDAOFactory daoFactory, Session session, IMasterDataScriptRegistrationRunner masterDataScriptRunner, - IManagedPropertyEvaluatorFactory managedPropertyEvaluatorFactory, - DataSetTypeWithoutExperimentChecker dataSetTypeChecker, + IManagedPropertyEvaluatorFactory managedPropertyEvaluatorFactory, + DataSetTypeWithoutExperimentChecker dataSetTypeChecker, IRelationshipService relationshipService) { super(daoFactory, session, managedPropertyEvaluatorFactory, dataSetTypeChecker, relationshipService); diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/DataAccessExceptionTranslator.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/DataAccessExceptionTranslator.java index 035eff2b4e8..09190c75d14 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/DataAccessExceptionTranslator.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/DataAccessExceptionTranslator.java @@ -26,16 +26,14 @@ import ch.systemsx.cisd.common.exceptions.UserFailureException; import ch.systemsx.cisd.openbis.generic.shared.dto.properties.EntityKind; /** - * This class converts the low-level {@link DataAccessException} into a high-level exception - * {@link UserFailureException}. + * This class converts the low-level {@link DataAccessException} into a high-level exception {@link UserFailureException}. * <p> - * This class can only be used on the business layer side as, only there, we dispose of enough - * information to decide whether or not a <code>DataAccessException</code> should be translated into - * an high-level exception. + * This class can only be used on the business layer side as, only there, we dispose of enough information to decide whether or not a + * <code>DataAccessException</code> should be translated into an high-level exception. * </p> * <p> - * Do not try to put this logic on the <i>DAO</i> level or do not try to automate this conversion as - * we want full control on this translation and we prefer to call it manually. + * Do not try to put this logic on the <i>DAO</i> level or do not try to automate this conversion as we want full control on this translation and we + * prefer to call it manually. * </p> * * @author Tomasz Pylak @@ -61,17 +59,14 @@ public final class DataAccessExceptionTranslator } /** - * Analyzes given <code>DataAccessException</code> and converts it into a - * <code>UserFailureException</code>. + * Analyzes given <code>DataAccessException</code> and converts it into a <code>UserFailureException</code>. * <p> - * This method is typically used by <i>creator</i> methods (methods which inserts a new object - * into the database) and <i>deletion</i> methods. + * This method is typically used by <i>creator</i> methods (methods which inserts a new object into the database) and <i>deletion</i> methods. * </p> * - * @param subject short description of the object that got blessed by the unique/foreign key - * violation constraint. - * @param entityKindOrNull entity kind of the subject object (if specified can make the error - * message more detailed especially for foreign key violation upon deletion) + * @param subject short description of the object that got blessed by the unique/foreign key violation constraint. + * @param entityKindOrNull entity kind of the subject object (if specified can make the error message more detailed especially for foreign key + * violation upon deletion) */ public final static void throwException(final DataAccessException exception, final String subject, final EntityKind entityKindOrNull) throws UserFailureException diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/DataSetTable.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/DataSetTable.java index d7a8f5569a0..ee90b77299d 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/DataSetTable.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/DataSetTable.java @@ -1128,11 +1128,11 @@ public final class DataSetTable extends AbstractDataSetBusinessObject implements updateSample(dataSet, sampleIdentifierOrNull); } else { - updateExperiment(dataSet,dataSetUpdates.getExperimentIdentifierOrNull()); + updateExperiment(dataSet, dataSetUpdates.getExperimentIdentifierOrNull()); } } else if (details.isExperimentUpdateRequested() && dataSetUpdates.getExperimentIdentifierOrNull() != null) { - updateExperiment(dataSet,dataSetUpdates.getExperimentIdentifierOrNull()); + updateExperiment(dataSet, dataSetUpdates.getExperimentIdentifierOrNull()); } if (details.isContainerUpdateRequested()) { diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/DeletionTable.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/DeletionTable.java index 21241e86d28..1ec091f47f2 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/DeletionTable.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/DeletionTable.java @@ -44,8 +44,8 @@ public class DeletionTable extends AbstractBusinessObject implements IDeletionTa private List<Deletion> deletions; public DeletionTable(IDAOFactory daoFactory, Session session, - IManagedPropertyEvaluatorFactory managedPropertyEvaluatorFactory, - DataSetTypeWithoutExperimentChecker dataSetTypeChecker, + IManagedPropertyEvaluatorFactory managedPropertyEvaluatorFactory, + DataSetTypeWithoutExperimentChecker dataSetTypeChecker, IRelationshipService relationshipService) { super(daoFactory, session, managedPropertyEvaluatorFactory, dataSetTypeChecker, relationshipService); diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/EntityCodeGenerator.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/EntityCodeGenerator.java index a1922fffe93..9a206c8ad57 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/EntityCodeGenerator.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/EntityCodeGenerator.java @@ -27,11 +27,9 @@ import ch.systemsx.cisd.openbis.generic.shared.basic.dto.EntityKind; import ch.systemsx.cisd.openbis.generic.shared.dto.TableNames; /** - * Generates unique codes for openBIS entities. It uses database sequences as a base for the code - * generation. Moreover it verifies that the generated codes are in fact unique (i.e. entities with - * such codes do not exist yet). If it finds that the new generated code is already used by an - * existing entity (e.g. the entity code was manually entered by a user) then it regenerates the - * code until it is unique. + * Generates unique codes for openBIS entities. It uses database sequences as a base for the code generation. Moreover it verifies that the generated + * codes are in fact unique (i.e. entities with such codes do not exist yet). If it finds that the new generated code is already used by an existing + * entity (e.g. the entity code was manually entered by a user) then it regenerates the code until it is unique. * * @author pkupczyk */ @@ -74,10 +72,8 @@ public class EntityCodeGenerator /** * Generate unique codes for openBIS entities. * - * @param codePrefix Prefix for the generated codes (e.g. when "ABC-" then codes will be - * "ABC-1", "ABC-2", ...) - * @param entityKind Kind of an entity the codes should be generated for (different kinds of - * entities use different database sequences). + * @param codePrefix Prefix for the generated codes (e.g. when "ABC-" then codes will be "ABC-1", "ABC-2", ...) + * @param entityKind Kind of an entity the codes should be generated for (different kinds of entities use different database sequences). * @param numberOfCodes Number of codes to be generated. */ public List<String> generateCodes(String codePrefix, EntityKind entityKind, int numberOfCodes) diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/EntityTypeBO.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/EntityTypeBO.java index 46f6920bb1f..8cf51ac30e1 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/EntityTypeBO.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/EntityTypeBO.java @@ -69,8 +69,8 @@ public final class EntityTypeBO extends AbstractBusinessObject implements IEntit private EntityKind entityKind; public EntityTypeBO(final IDAOFactory daoFactory, final Session session, - IManagedPropertyEvaluatorFactory managedPropertyEvaluatorFactory, - DataSetTypeWithoutExperimentChecker dataSetTypeChecker, + IManagedPropertyEvaluatorFactory managedPropertyEvaluatorFactory, + DataSetTypeWithoutExperimentChecker dataSetTypeChecker, IRelationshipService relationshipService) { super(daoFactory, session, managedPropertyEvaluatorFactory, dataSetTypeChecker, relationshipService); diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/EntityTypePropertyTypeBO.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/EntityTypePropertyTypeBO.java index f7f6c9b826d..bf9d8b1c03d 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/EntityTypePropertyTypeBO.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/EntityTypePropertyTypeBO.java @@ -65,8 +65,8 @@ public class EntityTypePropertyTypeBO extends AbstractBusinessObject implements @Private EntityTypePropertyTypeBO(IDAOFactory daoFactory, Session session, EntityKind entityKind, IEntityPropertiesConverter converter, - IManagedPropertyEvaluatorFactory managedPropertyEvaluatorFactory, - DataSetTypeWithoutExperimentChecker dataSetTypeChecker, + IManagedPropertyEvaluatorFactory managedPropertyEvaluatorFactory, + DataSetTypeWithoutExperimentChecker dataSetTypeChecker, IRelationshipService relationshipService) { super(daoFactory, session, managedPropertyEvaluatorFactory, dataSetTypeChecker, relationshipService); @@ -75,8 +75,8 @@ public class EntityTypePropertyTypeBO extends AbstractBusinessObject implements } public EntityTypePropertyTypeBO(IDAOFactory daoFactory, Session session, EntityKind entityKind, - IManagedPropertyEvaluatorFactory managedPropertyEvaluatorFactory, - DataSetTypeWithoutExperimentChecker dataSetTypeChecker, + IManagedPropertyEvaluatorFactory managedPropertyEvaluatorFactory, + DataSetTypeWithoutExperimentChecker dataSetTypeChecker, IRelationshipService relationshipService) { super(daoFactory, session, managedPropertyEvaluatorFactory, dataSetTypeChecker, relationshipService); diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/ExperimentBO.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/ExperimentBO.java index fdf638d1d3d..1b2e59b213b 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/ExperimentBO.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/ExperimentBO.java @@ -89,20 +89,20 @@ public final class ExperimentBO extends AbstractBusinessObject implements IExper public ExperimentBO(final IDAOFactory daoFactory, final Session session, IRelationshipService relationshipService, - IManagedPropertyEvaluatorFactory managedPropertyEvaluatorFactory, + IManagedPropertyEvaluatorFactory managedPropertyEvaluatorFactory, DataSetTypeWithoutExperimentChecker dataSetTypeChecker) { - super(daoFactory, session, EntityKind.EXPERIMENT, managedPropertyEvaluatorFactory, + super(daoFactory, session, EntityKind.EXPERIMENT, managedPropertyEvaluatorFactory, dataSetTypeChecker, relationshipService); } ExperimentBO(final IDAOFactory daoFactory, final Session session, final IEntityPropertiesConverter entityPropertiesConverter, - IManagedPropertyEvaluatorFactory managedPropertyEvaluatorFactory, - DataSetTypeWithoutExperimentChecker dataSetTypeChecker, + IManagedPropertyEvaluatorFactory managedPropertyEvaluatorFactory, + DataSetTypeWithoutExperimentChecker dataSetTypeChecker, IRelationshipService relationshipService) { - super(daoFactory, session, entityPropertiesConverter, managedPropertyEvaluatorFactory, + super(daoFactory, session, entityPropertiesConverter, managedPropertyEvaluatorFactory, dataSetTypeChecker, relationshipService); } diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/ExperimentTable.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/ExperimentTable.java index c279e73cb21..2b13d09a881 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/ExperimentTable.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/ExperimentTable.java @@ -70,8 +70,8 @@ public final class ExperimentTable extends AbstractBusinessObject implements IEx ExperimentTable(final IDAOFactory daoFactory, final Session session, IEntityPropertiesConverter converter, - IManagedPropertyEvaluatorFactory managedPropertyEvaluatorFactory, - DataSetTypeWithoutExperimentChecker dataSetTypeChecker, + IManagedPropertyEvaluatorFactory managedPropertyEvaluatorFactory, + DataSetTypeWithoutExperimentChecker dataSetTypeChecker, IRelationshipService relationshipService) { super(daoFactory, session, converter, managedPropertyEvaluatorFactory, dataSetTypeChecker, @@ -80,10 +80,10 @@ public final class ExperimentTable extends AbstractBusinessObject implements IEx public ExperimentTable(final IDAOFactory daoFactory, final Session session, IRelationshipService relationshipService, - IManagedPropertyEvaluatorFactory managedPropertyEvaluatorFactory, + IManagedPropertyEvaluatorFactory managedPropertyEvaluatorFactory, DataSetTypeWithoutExperimentChecker dataSetTypeChecker) { - super(daoFactory, session, EntityKind.EXPERIMENT, managedPropertyEvaluatorFactory, + super(daoFactory, session, EntityKind.EXPERIMENT, managedPropertyEvaluatorFactory, dataSetTypeChecker, relationshipService); } diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/GridCustomColumnBO.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/GridCustomColumnBO.java index 6a6a7fff63a..efb3b99650a 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/GridCustomColumnBO.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/GridCustomColumnBO.java @@ -47,8 +47,8 @@ public class GridCustomColumnBO extends AbstractBusinessObject implements private GridCustomColumnPE column; public GridCustomColumnBO(IDAOFactory daoFactory, Session session, - IManagedPropertyEvaluatorFactory managedPropertyEvaluatorFactory, - DataSetTypeWithoutExperimentChecker dataSetTypeChecker, + IManagedPropertyEvaluatorFactory managedPropertyEvaluatorFactory, + DataSetTypeWithoutExperimentChecker dataSetTypeChecker, IRelationshipService relationshipService) { super(daoFactory, session, managedPropertyEvaluatorFactory, dataSetTypeChecker, relationshipService); diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/GridCustomFilterBO.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/GridCustomFilterBO.java index c33dc966d9b..9198cd8b55c 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/GridCustomFilterBO.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/GridCustomFilterBO.java @@ -41,8 +41,8 @@ public class GridCustomFilterBO extends AbstractBusinessObject implements private GridCustomFilterPE filter; public GridCustomFilterBO(IDAOFactory daoFactory, Session session, - IManagedPropertyEvaluatorFactory managedPropertyEvaluatorFactory, - DataSetTypeWithoutExperimentChecker dataSetTypeChecker, + IManagedPropertyEvaluatorFactory managedPropertyEvaluatorFactory, + DataSetTypeWithoutExperimentChecker dataSetTypeChecker, IRelationshipService relationshipService) { super(daoFactory, session, managedPropertyEvaluatorFactory, dataSetTypeChecker, relationshipService); diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/IAttachmentBO.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/IAttachmentBO.java index bd076e0d624..a9e3fd0c8dd 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/IAttachmentBO.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/IAttachmentBO.java @@ -30,11 +30,10 @@ import ch.systemsx.cisd.openbis.generic.shared.dto.AttachmentHolderPE; public interface IAttachmentBO { /** - * Deletes specified {@link AttachmentHolderPE} attachments (all versions with given file names) - * for specified reason. + * Deletes specified {@link AttachmentHolderPE} attachments (all versions with given file names) for specified reason. * - * @param fileNames list of file names of attachments to be deleted (there will be no error if - * there are no attachments with these file names attached to specified holder) + * @param fileNames list of file names of attachments to be deleted (there will be no error if there are no attachments with these file names + * attached to specified holder) * @throws UserFailureException if holder with given technical identifier is not found. */ void deleteHolderAttachments(final AttachmentHolderPE holder, final List<String> fileNames, diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/IAuthorizationGroupBO.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/IAuthorizationGroupBO.java index 1a857e8b319..a36e6818820 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/IAuthorizationGroupBO.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/IAuthorizationGroupBO.java @@ -32,17 +32,15 @@ import ch.systemsx.cisd.openbis.generic.shared.dto.AuthorizationGroupPE; public interface IAuthorizationGroupBO extends IBusinessObject { /** - * Defines a authorization group. After invocation of this method - * {@link IAuthorizationGroupBO#save()} should be invoked to store the new authorization group - * in the Data Access Layer. + * Defines a authorization group. After invocation of this method {@link IAuthorizationGroupBO#save()} should be invoked to store the new + * authorization group in the Data Access Layer. */ void define(final NewAuthorizationGroup newAuthorizationGroup) throws UserFailureException; /** * Deletes the authorization group. * - * @throws UserFailureException if authorization group with given technical identifier is not - * found. + * @throws UserFailureException if authorization group with given technical identifier is not found. */ public void deleteByTechId(TechId authGroupId, String reason); @@ -57,14 +55,12 @@ public interface IAuthorizationGroupBO extends IBusinessObject public AuthorizationGroupPE getAuthorizationGroup(); /** - * Loads authorization group with given technical id or throws exception if no such group - * exists. + * Loads authorization group with given technical id or throws exception if no such group exists. */ public void loadByTechId(TechId authorizatonGroupId); /** - * Adds persons with given codes to the loaded authorization group. Returns a list of users - * codes not registered in the system. + * Adds persons with given codes to the loaded authorization group. Returns a list of users codes not registered in the system. */ public List<String> addPersons(List<String> personsCodes); diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/IBusinessObject.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/IBusinessObject.java index 4f891dd32ea..d5978062ffa 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/IBusinessObject.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/IBusinessObject.java @@ -21,15 +21,14 @@ import ch.systemsx.cisd.common.exceptions.UserFailureException; /** * Common method(s) all Business Objects and Tables have to implement. * - * @author Franz-Josef Elmer + * @author Franz-Josef Elmer */ public interface IBusinessObject { /** * Writes changed or added data to the Data Access Layers. * - * @throws UnsupportedOperationException if saving isn't supported because it is a read-only - * object. + * @throws UnsupportedOperationException if saving isn't supported because it is a read-only object. */ public void save() throws UserFailureException; diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/ICommonBusinessObjectFactory.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/ICommonBusinessObjectFactory.java index 5d15adaa6fa..d092f65a723 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/ICommonBusinessObjectFactory.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/ICommonBusinessObjectFactory.java @@ -24,8 +24,7 @@ import ch.systemsx.cisd.openbis.generic.shared.dto.Session; import ch.systemsx.cisd.openbis.generic.shared.dto.properties.EntityKind; /** - * The <i>generic</i> specific <i>Business Object</i> factory. Each method creates one kind of a - * business object. + * The <i>generic</i> specific <i>Business Object</i> factory. Each method creates one kind of a business object. * * @author Tomasz Pylak */ @@ -46,7 +45,7 @@ public interface ICommonBusinessObjectFactory extends IAbstractBussinessObjectFa public IDataBO createDataBO(Session session); public IDataSetTable createDataSetTable(final Session session); - + public ISearchDomainSearcher createSearchDomainSearcher(Session session); public IDeletedDataSetTable createDeletedDataSetTable(final Session session); diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/ICorePluginTable.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/ICorePluginTable.java index 7f617539d4d..311e72eb78d 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/ICorePluginTable.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/ICorePluginTable.java @@ -32,8 +32,7 @@ public interface ICorePluginTable List<CorePlugin> listCorePluginsByName(String name); /** - * Registers a core plugin. The operation has no effect if the plugin has already been deployed - * on the openBIS AS. + * Registers a core plugin. The operation has no effect if the plugin has already been deployed on the openBIS AS. */ public void registerPlugin(CorePlugin plugin, ICorePluginResourceLoader resourceLoader); diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/IEntityTypeBO.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/IEntityTypeBO.java index 4d3896e8da5..3830cd17404 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/IEntityTypeBO.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/IEntityTypeBO.java @@ -24,8 +24,7 @@ import ch.systemsx.cisd.openbis.generic.shared.dto.EntityTypePE; import ch.systemsx.cisd.openbis.generic.shared.dto.properties.EntityKind; /** - * Operations on {@link EntityTypePE} extensions. Note that you can use only one <em>define</em> - * method at a time. + * Operations on {@link EntityTypePE} extensions. Note that you can use only one <em>define</em> method at a time. * * @author Tomasz Pylak */ diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/IEntityTypePropertyTypeBO.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/IEntityTypePropertyTypeBO.java index 4be23daee68..2628662fbbc 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/IEntityTypePropertyTypeBO.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/IEntityTypePropertyTypeBO.java @@ -38,8 +38,7 @@ public interface IEntityTypePropertyTypeBO void loadAssignment(String propertyTypeCode, String entityTypeCode); /** - * Returns number of property values used by entities for assignment between specified property - * type and entity type. + * Returns number of property values used by entities for assignment between specified property type and entity type. */ int countAssignmentValues(String propertyTypeCode, String entityTypeCode); diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/IExternalDataTable.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/IExternalDataTable.java index 75f948aa917..9b6884a6062 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/IExternalDataTable.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/IExternalDataTable.java @@ -36,11 +36,9 @@ import ch.systemsx.cisd.openbis.generic.shared.dto.ExternalDataPE; public interface IExternalDataTable { /** - * Loads data sets specified by their codes. Data set codes will be ignored if no - * {@link ExternalDataPE} could be found. Properties will be loaded too depending on - * <var>withProperties</var> value. Optionally if <var>lockForUpdate</var> is <var>true</var> - * all updates to loaded data sets from other transactions will be blocked until current - * transaction is finished. + * Loads data sets specified by their codes. Data set codes will be ignored if no {@link ExternalDataPE} could be found. Properties will be loaded + * too depending on <var>withProperties</var> value. Optionally if <var>lockForUpdate</var> is <var>true</var> all updates to loaded data sets + * from other transactions will be blocked until current transaction is finished. */ void loadByDataSetCodes(List<String> dataSetCodes, boolean withProperties, boolean lockForUpdate); @@ -77,11 +75,10 @@ public interface IExternalDataTable String uploadLoadedDataSetsToCIFEX(DataSetUploadContext uploadContext); /** - * Schedules archiving of loaded data sets. Only available data sets that are not locked will be - * archived. + * Schedules archiving of loaded data sets. Only available data sets that are not locked will be archived. * - * @param removeFromDataStore when set to <code>true</code> the data sets will be removed from - * the data store after a successful archiving operation. + * @param removeFromDataStore when set to <code>true</code> the data sets will be removed from the data store after a successful archiving + * operation. * @return number of data sets scheduled for archiving. */ int archiveDatasets(boolean removeFromDataStore); @@ -112,8 +109,7 @@ public interface IExternalDataTable List<String> datasetCodes); /** - * Schedules processing of specified datasets with specified parameter bindings using the - * specified datastore service. + * Schedules processing of specified datasets with specified parameter bindings using the specified datastore service. * * @param parameterBindings Should be a map where additional entries can be added. */ diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/IGridCustomFilterOrColumnBO.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/IGridCustomFilterOrColumnBO.java index e88c28b9a5c..e1be193dd8e 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/IGridCustomFilterOrColumnBO.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/IGridCustomFilterOrColumnBO.java @@ -31,9 +31,8 @@ public interface IGridCustomFilterOrColumnBO extends IEntityBusinessObject { /** - * Defines a new grid custom filter or column. After invocation of this method - * {@link IBusinessObject#save()} should be invoked to store the new group in the <i>Data Access - * Layer</i>. + * Defines a new grid custom filter or column. After invocation of this method {@link IBusinessObject#save()} should be invoked to store the new + * group in the <i>Data Access Layer</i>. */ public void define(NewColumnOrFilter filterOrColumn) throws UserFailureException; diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/IPropertyTypeBO.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/IPropertyTypeBO.java index 70459793e51..702b1906929 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/IPropertyTypeBO.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/IPropertyTypeBO.java @@ -33,8 +33,8 @@ public interface IPropertyTypeBO extends IBusinessObject /** * Defines a new property type. * <p> - * After invocation of this method {@link IBusinessObject#save()} should be invoked to store the - * new property type in the <i>Data Access Layer</i>. + * After invocation of this method {@link IBusinessObject#save()} should be invoked to store the new property type in the <i>Data Access + * Layer</i>. * </p> * * @throws UserFailureException if <var>propertyType</var> does already exist. diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/ISampleTable.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/ISampleTable.java index dc09b130df0..b3ca6abbebe 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/ISampleTable.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/ISampleTable.java @@ -36,8 +36,7 @@ public interface ISampleTable { /** - * Lists samples filtered by specified criteria, see {@link ListSamplesByPropertyCriteria} to - * see the details. + * Lists samples filtered by specified criteria, see {@link ListSamplesByPropertyCriteria} to see the details. */ void loadSamplesByCriteria(final ListSamplesByPropertyCriteria criteria); @@ -53,9 +52,8 @@ public interface ISampleTable throws UserFailureException; /** - * This method should be invoked before a series of prepareForUpdateXXX() method calls. It - * checks the data before the update can be started. For instance, it verifies versions of - * objects for Optimistic Locking. + * This method should be invoked before a series of prepareForUpdateXXX() method calls. It checks the data before the update can be started. For + * instance, it verifies versions of objects for Optimistic Locking. */ public void checkBeforeUpdate(List<SampleUpdatesDTO> updates) throws UserFailureException; @@ -67,10 +65,9 @@ public interface ISampleTable public void prepareForUpdate(List<SampleBatchUpdatesDTO> updates) throws UserFailureException; /** - * Comparable to {@link #prepareForUpdate(List)} but takes a {@link SampleUpdatesDTO} object - * instead of a {@link SampleBatchUpdatesDTO} object. Whereas prepareForUpdate only changes the - * fields requested in the updates' details object, this method changes the samples to match the - * updates object. + * Comparable to {@link #prepareForUpdate(List)} but takes a {@link SampleUpdatesDTO} object instead of a {@link SampleBatchUpdatesDTO} object. + * Whereas prepareForUpdate only changes the fields requested in the updates' details object, this method changes the samples to match the updates + * object. */ void prepareForUpdateWithSampleUpdates(List<SampleUpdatesDTO> updates) throws UserFailureException; diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/ISearchDomainSearcher.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/ISearchDomainSearcher.java index d880533b630..fd43a14b9a5 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/ISearchDomainSearcher.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/ISearchDomainSearcher.java @@ -39,6 +39,5 @@ public interface ISearchDomainSearcher */ List<SearchDomainSearchResultWithFullEntity> searchForEntitiesWithSequences(String preferredSearchDomainOrNull, String sequenceSnippet, Map<String, String> optionalParametersOrNull); - } diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/ISpaceBO.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/ISpaceBO.java index e7c3957fe0d..a39a4974804 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/ISpaceBO.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/ISpaceBO.java @@ -31,9 +31,8 @@ public interface ISpaceBO extends IEntityBusinessObject { /** - * Defines a new space of specified code for the home database instance. After invocation of - * this method {@link IBusinessObject#save()} should be invoked to store the new group in the - * <i>Data Access Layer</i>. + * Defines a new space of specified code for the home database instance. After invocation of this method {@link IBusinessObject#save()} should be + * invoked to store the new group in the <i>Data Access Layer</i>. * * @throws UserFailureException if <code>group</code> does already exist. */ @@ -42,8 +41,7 @@ public interface ISpaceBO extends IEntityBusinessObject /** * Loads a space described by identifier from Database Layer. * - * @throws UserFailureException if <code>groupIdentifier</code> does not describe existing - * group. + * @throws UserFailureException if <code>groupIdentifier</code> does not describe existing group. */ public void load(SpaceIdentifier spaceIdentifier) throws UserFailureException; diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/MaterialBO.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/MaterialBO.java index d36803d002b..a08e55b94ab 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/MaterialBO.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/MaterialBO.java @@ -178,8 +178,8 @@ public final class MaterialBO extends AbstractMaterialBusinessObject implements { List<Long> idsToDelete = Collections.singletonList(material.getId()); String content = historyCreator.apply(getSessionFactory().getCurrentSession(), idsToDelete, - MaterialDAO.sqlPropertyHistory, null, MaterialDAO.sqlAttributesHistory, null, - null, session.tryGetPerson()); + MaterialDAO.sqlPropertyHistory, null, MaterialDAO.sqlAttributesHistory, null, + null, session.tryGetPerson()); getMaterialDAO().delete(material); getEventDAO().persist(createDeletionEvent(material, session.tryGetPerson(), reason, content)); diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/MaterialTable.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/MaterialTable.java index 4dd9f49fd23..966616efb50 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/MaterialTable.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/MaterialTable.java @@ -59,8 +59,8 @@ public final class MaterialTable extends AbstractMaterialBusinessObject implemen private boolean dataChanged; public MaterialTable(final IDAOFactory daoFactory, final Session session, - IManagedPropertyEvaluatorFactory managedPropertyEvaluatorFactory, - DataSetTypeWithoutExperimentChecker dataSetTypeChecker, + IManagedPropertyEvaluatorFactory managedPropertyEvaluatorFactory, + DataSetTypeWithoutExperimentChecker dataSetTypeChecker, IRelationshipService relationshipService) { super(daoFactory, session, managedPropertyEvaluatorFactory, dataSetTypeChecker, relationshipService); @@ -70,11 +70,11 @@ public final class MaterialTable extends AbstractMaterialBusinessObject implemen // for tests only MaterialTable(final IDAOFactory daoFactory, final Session session, final IEntityPropertiesConverter entityPropertiesConverter, List<MaterialPE> materials, - boolean dataChanged, IManagedPropertyEvaluatorFactory managedPropertyEvaluatorFactory, - DataSetTypeWithoutExperimentChecker dataSetTypeChecker, + boolean dataChanged, IManagedPropertyEvaluatorFactory managedPropertyEvaluatorFactory, + DataSetTypeWithoutExperimentChecker dataSetTypeChecker, IRelationshipService relationshipService) { - super(daoFactory, session, entityPropertiesConverter, managedPropertyEvaluatorFactory, + super(daoFactory, session, entityPropertiesConverter, managedPropertyEvaluatorFactory, dataSetTypeChecker, relationshipService); this.materials = materials; this.dataChanged = dataChanged; diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/MetaprojectBO.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/MetaprojectBO.java index a7da2747e5e..24ef0a5e106 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/MetaprojectBO.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/MetaprojectBO.java @@ -83,8 +83,8 @@ public class MetaprojectBO extends AbstractBusinessObject implements IMetaprojec public MetaprojectBO(final IDAOFactory daoFactory, IExperimentBO experimentBO, ISampleBO sampleBO, IDataBO dataBO, IMaterialBO materialBO, final Session session, - IManagedPropertyEvaluatorFactory managedPropertyEvaluatorFactory, - DataSetTypeWithoutExperimentChecker dataSetTypeChecker, + IManagedPropertyEvaluatorFactory managedPropertyEvaluatorFactory, + DataSetTypeWithoutExperimentChecker dataSetTypeChecker, IRelationshipService relationshipService) { super(daoFactory, session, managedPropertyEvaluatorFactory, dataSetTypeChecker, relationshipService); diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/NextExceptionFallbackExceptionTranslator.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/NextExceptionFallbackExceptionTranslator.java index 55cad85849f..e4eff0faedf 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/NextExceptionFallbackExceptionTranslator.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/NextExceptionFallbackExceptionTranslator.java @@ -21,8 +21,7 @@ import java.sql.SQLException; import org.springframework.jdbc.support.SQLStateSQLExceptionTranslator; /** - * A translator that takes into includes the message from the next exception in the chain as this - * often has the real cause. + * A translator that takes into includes the message from the next exception in the chain as this often has the real cause. * * @author Bernd Rinn */ diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/ProjectBO.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/ProjectBO.java index d8cb2b41e91..183c65a95c9 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/ProjectBO.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/ProjectBO.java @@ -350,7 +350,7 @@ public final class ProjectBO extends AbstractBusinessObject implements IProjectB private static final String propertyHistoryQuery = "SELECT 1 as a, 1 as b, 1 as c, 1 as d, 1 as e, 1 as f, 1 as g, 1 as h, 1 as i FROM materials WHERE id = -1 and id IN (:entityIds)"; - + private static final String ENTITY_TYPE = "case " + "when h.space_id is not null then 'SPACE' " + "when h.expe_id is not null then 'EXPERIMENT' " @@ -408,8 +408,8 @@ public final class ProjectBO extends AbstractBusinessObject implements IProjectB { List<Long> idsToDelete = Collections.singletonList(projectId.getId()); String content = historyCreator.apply(getSessionFactory().getCurrentSession(), idsToDelete, - propertyHistoryQuery, relationshipHistoryQuery, sqlAttributesHistory, - Arrays.asList(project), null, session.tryGetPerson()); + propertyHistoryQuery, relationshipHistoryQuery, sqlAttributesHistory, + Arrays.asList(project), null, session.tryGetPerson()); getProjectDAO().delete(project); getEventDAO().persist(createDeletionEvent(project, session.tryGetPerson(), reason, content)); } else diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/PropertyTypeBO.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/PropertyTypeBO.java index 3ff528e66d8..2aa6d30377c 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/PropertyTypeBO.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/PropertyTypeBO.java @@ -63,8 +63,8 @@ public final class PropertyTypeBO extends VocabularyBO implements IPropertyTypeB private PropertyTypePE propertyTypePE; public PropertyTypeBO(final IDAOFactory daoFactory, final Session session, - IManagedPropertyEvaluatorFactory managedPropertyEvaluatorFactory, - DataSetTypeWithoutExperimentChecker dataSetTypeChecker, + IManagedPropertyEvaluatorFactory managedPropertyEvaluatorFactory, + DataSetTypeWithoutExperimentChecker dataSetTypeChecker, IRelationshipService relationshipService) { super(daoFactory, session, managedPropertyEvaluatorFactory, dataSetTypeChecker, relationshipService); diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/PropertyTypeTable.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/PropertyTypeTable.java index 09116c3ead3..1626d9d4369 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/PropertyTypeTable.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/PropertyTypeTable.java @@ -36,8 +36,8 @@ public final class PropertyTypeTable extends AbstractBusinessObject implements I private List<PropertyTypePE> propertyTypes; public PropertyTypeTable(final IDAOFactory daoFactory, final Session session, - IManagedPropertyEvaluatorFactory managedPropertyEvaluatorFactory, - DataSetTypeWithoutExperimentChecker dataSetTypeChecker, + IManagedPropertyEvaluatorFactory managedPropertyEvaluatorFactory, + DataSetTypeWithoutExperimentChecker dataSetTypeChecker, IRelationshipService relationshipService) { super(daoFactory, session, managedPropertyEvaluatorFactory, dataSetTypeChecker, relationshipService); diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/RootEntitiesFinder.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/RootEntitiesFinder.java index 3ca8ace59cf..cd14721dc50 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/RootEntitiesFinder.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/RootEntitiesFinder.java @@ -32,8 +32,8 @@ import ch.systemsx.cisd.openbis.generic.shared.dto.IDeletablePE; import ch.systemsx.cisd.openbis.generic.shared.translator.DeletedEntityTranslator; /** - * Helper class for finding the root entities of entities belonging to the same deletion event. It - * is assumed that experiments are added before samples which are added before data sets. + * Helper class for finding the root entities of entities belonging to the same deletion event. It is assumed that experiments are added before + * samples which are added before data sets. * * @author Franz-Josef Elmer * @author Kaloyan Enimanev diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/SampleBO.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/SampleBO.java index 812c5889ec2..c008c9b0a64 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/SampleBO.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/SampleBO.java @@ -69,7 +69,7 @@ public final class SampleBO extends AbstractSampleBusinessObject implements ISam public SampleBO(final IDAOFactory daoFactory, final Session session, final IRelationshipService relationshipService, final IEntityOperationChecker entityOperationChecker, - final IManagedPropertyEvaluatorFactory managedPropertyEvaluatorFactory, + final IManagedPropertyEvaluatorFactory managedPropertyEvaluatorFactory, DataSetTypeWithoutExperimentChecker dataSetTypeChecker) { super(daoFactory, session, relationshipService, entityOperationChecker, @@ -80,7 +80,7 @@ public final class SampleBO extends AbstractSampleBusinessObject implements ISam final IEntityPropertiesConverter entityPropertiesConverter, IRelationshipService relationshipService, final IEntityOperationChecker entityOperationChecker, - IManagedPropertyEvaluatorFactory managedPropertyEvaluatorFactory, + IManagedPropertyEvaluatorFactory managedPropertyEvaluatorFactory, DataSetTypeWithoutExperimentChecker dataSetTypeChecker) { super(daoFactory, session, entityPropertiesConverter, relationshipService, diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/SampleCodeGeneratorByType.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/SampleCodeGeneratorByType.java index 5e4b2333b99..405afeae627 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/SampleCodeGeneratorByType.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/SampleCodeGeneratorByType.java @@ -42,7 +42,7 @@ public class SampleCodeGeneratorByType extends EntityCodeGenerator super(daoFactory); this.maxQuery = QueryTool.getManagedQuery(MaxQuery.class); } - + @Override public List<String> generateCodes(String codePrefix, EntityKind entityKind, int numberOfCodes) { diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/ScriptBO.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/ScriptBO.java index 673240c8689..dc638865bf8 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/ScriptBO.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/ScriptBO.java @@ -55,8 +55,8 @@ public final class ScriptBO extends AbstractBusinessObject implements IScriptBO private final IJythonEvaluatorPool jythonEvaluatorPool; public ScriptBO(final IDAOFactory daoFactory, final Session session, - IManagedPropertyEvaluatorFactory managedPropertyEvaluatorFactory, - DataSetTypeWithoutExperimentChecker dataSetTypeChecker, + IManagedPropertyEvaluatorFactory managedPropertyEvaluatorFactory, + DataSetTypeWithoutExperimentChecker dataSetTypeChecker, IRelationshipService relationshipService, IJythonEvaluatorPool jythonEvaluationPool) { @@ -67,8 +67,8 @@ public final class ScriptBO extends AbstractBusinessObject implements IScriptBO @Private // for testing ScriptBO(final IDAOFactory daoFactory, final Session session, IScriptFactory scriptFactory, - IManagedPropertyEvaluatorFactory managedPropertyEvaluatorFactory, - DataSetTypeWithoutExperimentChecker dataSetTypeChecker, + IManagedPropertyEvaluatorFactory managedPropertyEvaluatorFactory, + DataSetTypeWithoutExperimentChecker dataSetTypeChecker, IRelationshipService relationshipService, IJythonEvaluatorPool jythonEvaluationPool) { diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/SearchDomainSearcher.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/SearchDomainSearcher.java index 407d048098e..a3713888f06 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/SearchDomainSearcher.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/SearchDomainSearcher.java @@ -52,13 +52,11 @@ import ch.systemsx.cisd.openbis.generic.shared.translator.ExperimentTranslator; import ch.systemsx.cisd.openbis.generic.shared.translator.SampleTranslator; /** - * - * * @author Franz-Josef Elmer */ public class SearchDomainSearcher extends AbstractBusinessObject implements ISearchDomainSearcher { - private static final Map<Long, Set<Metaproject>> EMPTY_METAPROJECTS = Collections.<Long, Set<Metaproject>>emptyMap(); + private static final Map<Long, Set<Metaproject>> EMPTY_METAPROJECTS = Collections.<Long, Set<Metaproject>> emptyMap(); private static final IKeyExtractor<String, IEntityInformationHolderWithPermId> PERM_ID_EXTRACTOR = new IKeyExtractor<String, IEntityInformationHolderWithPermId>() @@ -72,9 +70,9 @@ public class SearchDomainSearcher extends AbstractBusinessObject implements ISea private final IDataStoreServiceFactory dssFactory; - public SearchDomainSearcher(IDAOFactory daoFactory, Session session, - IManagedPropertyEvaluatorFactory managedPropertyEvaluatorFactory, - DataSetTypeWithoutExperimentChecker dataSetTypeChecker, IRelationshipService relationshipService, + public SearchDomainSearcher(IDAOFactory daoFactory, Session session, + IManagedPropertyEvaluatorFactory managedPropertyEvaluatorFactory, + DataSetTypeWithoutExperimentChecker dataSetTypeChecker, IRelationshipService relationshipService, IDataStoreServiceFactory dssFactory) { super(daoFactory, session, managedPropertyEvaluatorFactory, dataSetTypeChecker, relationshipService); @@ -98,11 +96,10 @@ public class SearchDomainSearcher extends AbstractBusinessObject implements ISea } @Override - public List<SearchDomainSearchResultWithFullEntity> searchForEntitiesWithSequences(String preferredSearchDomainOrNull, + public List<SearchDomainSearchResultWithFullEntity> searchForEntitiesWithSequences(String preferredSearchDomainOrNull, String sequenceSnippet, Map<String, String> optionalParametersOrNull) { - List<SearchDomainSearchResult> searchResults - = askAllDataStoreServers(preferredSearchDomainOrNull, sequenceSnippet, optionalParametersOrNull); + List<SearchDomainSearchResult> searchResults = askAllDataStoreServers(preferredSearchDomainOrNull, sequenceSnippet, optionalParametersOrNull); return enrichWithEntities(searchResults); } @@ -179,8 +176,7 @@ public class SearchDomainSearcher extends AbstractBusinessObject implements ISea { EntityLoader loader = entry.getKey(); List<String> permIds = entry.getValue(); - List<IEntityInformationHolderWithPermId> entities - = loader.loadEntities(this, managedPropertyEvaluatorFactory, permIds); + List<IEntityInformationHolderWithPermId> entities = loader.loadEntities(this, managedPropertyEvaluatorFactory, permIds); result.put(loader, new TableMap<String, IEntityInformationHolderWithPermId>(entities, PERM_ID_EXTRACTOR)); } return result; @@ -273,7 +269,7 @@ public class SearchDomainSearcher extends AbstractBusinessObject implements ISea { return permId; } - + } - + } diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/TrashBO.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/TrashBO.java index fd7ee1c61e9..7e3a0d357d8 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/TrashBO.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/TrashBO.java @@ -79,8 +79,7 @@ import ch.systemsx.cisd.openbis.generic.shared.util.RelationshipUtils; */ public class TrashBO extends AbstractBusinessObject implements ITrashBO { - static final EnumSet<DataSetFetchOption> DATA_SET_FETCH_OPTIONS - = EnumSet.of(DataSetFetchOption.EXPERIMENT, DataSetFetchOption.SAMPLE); + static final EnumSet<DataSetFetchOption> DATA_SET_FETCH_OPTIONS = EnumSet.of(DataSetFetchOption.EXPERIMENT, DataSetFetchOption.SAMPLE); private enum CascadeSampleDependentComponents { @@ -92,8 +91,8 @@ public class TrashBO extends AbstractBusinessObject implements ITrashBO private DeletionPE deletion; public TrashBO(IDAOFactory daoFactory, ICommonBusinessObjectFactory boFactory, Session session, - IManagedPropertyEvaluatorFactory managedPropertyEvaluatorFactory, - DataSetTypeWithoutExperimentChecker dataSetTypeChecker, + IManagedPropertyEvaluatorFactory managedPropertyEvaluatorFactory, + DataSetTypeWithoutExperimentChecker dataSetTypeChecker, IRelationshipService relationshipService) { super(daoFactory, session, managedPropertyEvaluatorFactory, dataSetTypeChecker, relationshipService); @@ -125,7 +124,7 @@ public class TrashBO extends AbstractBusinessObject implements ITrashBO public void trashDataSets(List<TechId> dataSetIds) { assert deletion != null; - + IDatasetLister datasetLister = boFactory.createDatasetLister(session); final Set<TechId> experimentIds = new HashSet<TechId>(); final Set<TechId> sampleIds = new HashSet<TechId>(); @@ -135,7 +134,7 @@ public class TrashBO extends AbstractBusinessObject implements ITrashBO if (sample != null) { sampleIds.add(new TechId(sample)); - } + } if (dataSet.getExperiment() != null) { experimentIds.add(new TechId(dataSet.getExperiment())); @@ -160,7 +159,7 @@ public class TrashBO extends AbstractBusinessObject implements ITrashBO } return filtered; } - + private boolean contains(Set<TechId> ids, IIdAndCodeHolder entity) { return entity != null && ids.contains(new TechId(HibernateUtils.getId(entity))); @@ -187,8 +186,7 @@ public class TrashBO extends AbstractBusinessObject implements ITrashBO assert deletion != null; TrashOperationsManager trashManager = new TrashOperationsManager(session, deletion, this, getTransactionTimeStamp()); - Set<TechId> allSampleIds - = trashSamples(trashManager, sampleIds, CascadeSampleDependentComponents.TRUE, true); + Set<TechId> allSampleIds = trashSamples(trashManager, sampleIds, CascadeSampleDependentComponents.TRUE, true); Set<TechId> experimentsOfSamples = getExperimentsOfSamples(sampleIds); trashSampleDependentDataSets(trashManager, experimentsOfSamples, allSampleIds); trashManager.trash(); @@ -209,8 +207,8 @@ public class TrashBO extends AbstractBusinessObject implements ITrashBO } return experimentIds; } - - private Set<TechId> trashSamples(TrashOperationsManager trashManager, + + private Set<TechId> trashSamples(TrashOperationsManager trashManager, final List<TechId> sampleIds, final CascadeSampleDependentComponents cascadeType, boolean isOriginalDeletion) { assert deletion != null; @@ -229,22 +227,25 @@ public class TrashBO extends AbstractBusinessObject implements ITrashBO { public List<TechId> filter(List<AbstractExternalData> dataSets); } - + private static interface IIdHolderProvider { public IIdHolder getIdHolder(AbstractExternalData dataSet); } - + private static final class DataSetFilter implements IDataSetFilter { private Set<Long> ids; + private IIdHolderProvider idHolderProvider; + DataSetFilter(Collection<TechId> ids, IIdHolderProvider idHolderProvider) { this.ids = new LinkedHashSet<Long>(TechId.asLongs(ids)); this.idHolderProvider = idHolderProvider; - + } + @Override public List<TechId> filter(List<AbstractExternalData> dataSets) { @@ -261,7 +262,7 @@ public class TrashBO extends AbstractBusinessObject implements ITrashBO } } - private void trashDataSets(TrashOperationsManager trashManager, final List<TechId> dataSetIds, + private void trashDataSets(TrashOperationsManager trashManager, final List<TechId> dataSetIds, boolean isOriginalDeletion, IDataSetFilter filterOrNull) { assert deletion != null; @@ -328,7 +329,7 @@ public class TrashBO extends AbstractBusinessObject implements ITrashBO } } - private Set<TechId> trashSampleDependentComponents(TrashOperationsManager trashManager, + private Set<TechId> trashSampleDependentComponents(TrashOperationsManager trashManager, List<TechId> sampleIds) { final ISampleDAO sampleDAO = getSampleDAO(); @@ -349,7 +350,7 @@ public class TrashBO extends AbstractBusinessObject implements ITrashBO return trashSamples(trashManager, batchOperation.getResults(), CascadeSampleDependentComponents.FALSE, false); } - private void trashSampleDependentDataSets(TrashOperationsManager trashManager, + private void trashSampleDependentDataSets(TrashOperationsManager trashManager, Set<TechId> experimentsOfSamples, Set<TechId> sampleIds) { AbstractQueryBatchOperation batchOperation = @@ -367,14 +368,14 @@ public class TrashBO extends AbstractBusinessObject implements ITrashBO List<TechId> dataSetIds = batchOperation.getResults(); assertDataSetDeletionBusinessRules(experimentsOfSamples, sampleIds, dataSetIds); trashDataSets(trashManager, dataSetIds, false, new DataSetFilter(sampleIds, - new IIdHolderProvider() - { - @Override - public IIdHolder getIdHolder(AbstractExternalData dataSet) - { - return dataSet.getSample(); - } - })); + new IIdHolderProvider() + { + @Override + public IIdHolder getIdHolder(AbstractExternalData dataSet) + { + return dataSet.getSample(); + } + })); } private Set<TechId> trashExperimentDependentSamples(TrashOperationsManager trashManager, Set<TechId> experimentIds) @@ -394,7 +395,7 @@ public class TrashBO extends AbstractBusinessObject implements ITrashBO return trashSamples(trashManager, sampleIds, CascadeSampleDependentComponents.TRUE, false); } - private void trashExperimentDependentDataSets(TrashOperationsManager trashManager, Set<TechId> experimentIds, + private void trashExperimentDependentDataSets(TrashOperationsManager trashManager, Set<TechId> experimentIds, Set<TechId> dependentSampleIds) { AbstractQueryBatchOperation batchOperation = @@ -411,17 +412,17 @@ public class TrashBO extends AbstractBusinessObject implements ITrashBO List<TechId> dataSetIds = batchOperation.getResults(); assertDataSetDeletionBusinessRules(experimentIds, dependentSampleIds, dataSetIds); trashDataSets(trashManager, dataSetIds, false, new DataSetFilter(experimentIds, - new IIdHolderProvider() - { - @Override - public IIdHolder getIdHolder(AbstractExternalData dataSet) - { - return dataSet.getExperiment(); - } - })); + new IIdHolderProvider() + { + @Override + public IIdHolder getIdHolder(AbstractExternalData dataSet) + { + return dataSet.getExperiment(); + } + })); } - - private void assertDataSetDeletionBusinessRules(Set<TechId> experimentIds, Set<TechId> sampleIdes, + + private void assertDataSetDeletionBusinessRules(Set<TechId> experimentIds, Set<TechId> sampleIdes, List<TechId> dataSetIds) { IDatasetLister datasetLister = boFactory.createDatasetLister(session); @@ -469,15 +470,15 @@ public class TrashBO extends AbstractBusinessObject implements ITrashBO throw new UserFailureException(builder.toString().trim()); } } - - private void addTo(StringBuilder builder, String entityDescription, AbstractExternalData dataSet, + + private void addTo(StringBuilder builder, String entityDescription, AbstractExternalData dataSet, Map<Long, Set<Long>> containerIds) { String findOriginalDataSet = findOriginalDataSet(containerIds, dataSet); - builder.append("The data set " + findOriginalDataSet + " is a component of the data set " + builder.append("The data set " + findOriginalDataSet + " is a component of the data set " + dataSet.getCode() + " which belongs to the " + entityDescription + " which is outside the deletion set.\n"); } - + private String findOriginalDataSet(Map<Long, Set<Long>> relations, AbstractExternalData dataSet) { Set<Entry<Long, Set<Long>>> entrySet = relations.entrySet(); @@ -503,7 +504,7 @@ public class TrashBO extends AbstractBusinessObject implements ITrashBO { return datasetLister.listByDatasetIds(TechId.asLongs(dataSetIds), DATA_SET_FETCH_OPTIONS); } - + @Override public void revertDeletion(TechId deletionId) { @@ -516,22 +517,31 @@ public class TrashBO extends AbstractBusinessObject implements ITrashBO throwException(ex, "Deletion"); } } - + private static final class TrashOperationsManager { private final Session session; + private final DeletionPE deletion; + private final IDAOFactory daoFactory; - + private final Map<EntityKind, Set<TechId>> entityIdsByKind = new HashMap<EntityKind, Set<TechId>>(); + private final List<TrashBatchOperation> operations = new ArrayList<TrashBatchOperation>(); + private final PersonPE person; + private final List<RoleWithIdentifier> allowedRoles; + private final ExperimentPEPredicate experimentPredicate; + private final SamplePEPredicate samplesPredicate; + private final DataPEPredicate dataSetPredicate; + private final Date modificationTimestamp; - + TrashOperationsManager(Session session, DeletionPE deletion, IDAOFactory daoFactory, Date modificationTimestamp) { this.session = session; @@ -549,7 +559,7 @@ public class TrashBO extends AbstractBusinessObject implements ITrashBO samplesPredicate = new SamplePEPredicate(); dataSetPredicate = new DataPEPredicate(); } - + void addTrashOperation(EntityKind entityKind, List<TechId> entityIds, boolean isOriginalDeletion) { if (entityIds.isEmpty() == false) @@ -575,7 +585,7 @@ public class TrashBO extends AbstractBusinessObject implements ITrashBO } @SuppressWarnings({ "unchecked", "rawtypes" }) - private void assertAuthorization(PersistentEntityPredicate entityPredicate, + private void assertAuthorization(PersistentEntityPredicate entityPredicate, List<? extends IIdentifierHolder> entities, String entityKindName) { List<String> identifiers = new ArrayList<String>(); @@ -591,12 +601,12 @@ public class TrashBO extends AbstractBusinessObject implements ITrashBO } if (identifiers.isEmpty() == false) { - throw new AuthorizationFailureException("Can not delete " + entityKindName + " " - + CollectionUtils.abbreviate(identifiers, 10) + " because user " + throw new AuthorizationFailureException("Can not delete " + entityKindName + " " + + CollectionUtils.abbreviate(identifiers, 10) + " because user " + errorMessage); } } - + void trash() { updateModificationDateAndModifierOfRelatedProjectsOfExperiments(); @@ -607,7 +617,7 @@ public class TrashBO extends AbstractBusinessObject implements ITrashBO BatchOperationExecutor.executeInBatches(operation); } } - + private void updateModificationDateAndModifierOfRelatedProjectsOfExperiments() { List<Long> ids = TechId.asLongs(entityIdsByKind.get(EntityKind.EXPERIMENT)); @@ -618,7 +628,7 @@ public class TrashBO extends AbstractBusinessObject implements ITrashBO experiments, session, modificationTimestamp); } } - + private void updateModificationDateAndModifierOfRelatedEntitiesOfSamples() { List<Long> ids = TechId.asLongs(entityIdsByKind.get(EntityKind.SAMPLE)); @@ -629,7 +639,7 @@ public class TrashBO extends AbstractBusinessObject implements ITrashBO samples, session, modificationTimestamp); } } - + private void updateModificationDateAndModifierOfRelatedEntitiesOfDataSets() { List<Long> ids = TechId.asLongs(entityIdsByKind.get(EntityKind.DATA_SET)); @@ -640,7 +650,7 @@ public class TrashBO extends AbstractBusinessObject implements ITrashBO dataSets, session, modificationTimestamp); } } - + } private static class TrashBatchOperation implements IBatchOperation<TechId> @@ -692,10 +702,10 @@ public class TrashBO extends AbstractBusinessObject implements ITrashBO @Override public String toString() { - return getOperationName() + (isOriginalDeletion ? " original " : " dependent ") + entityKind + return getOperationName() + (isOriginalDeletion ? " original " : " dependent ") + entityKind + " " + getEntityName() + " " + entityIds; } - + } private abstract static class AbstractQueryBatchOperation implements IBatchOperation<TechId> diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/VocabularyTermBO.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/VocabularyTermBO.java index 99ad08e2ead..d09f673d3b6 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/VocabularyTermBO.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/VocabularyTermBO.java @@ -41,8 +41,8 @@ public final class VocabularyTermBO extends AbstractBusinessObject implements IV private VocabularyTermPE vocabularyTermPE; public VocabularyTermBO(final IDAOFactory daoFactory, final Session session, - IManagedPropertyEvaluatorFactory managedPropertyEvaluatorFactory, - DataSetTypeWithoutExperimentChecker dataSetTypeChecker, + IManagedPropertyEvaluatorFactory managedPropertyEvaluatorFactory, + DataSetTypeWithoutExperimentChecker dataSetTypeChecker, IRelationshipService relationshipService) { super(daoFactory, session, managedPropertyEvaluatorFactory, dataSetTypeChecker, relationshipService); diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/common/AbstractBatchIterator.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/common/AbstractBatchIterator.java index 0bbcb4a45f0..f90e99a5863 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/common/AbstractBatchIterator.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/common/AbstractBatchIterator.java @@ -24,18 +24,16 @@ import java.util.Iterator; import ch.systemsx.cisd.common.exceptions.NotImplementedException; /** - * Allows to convert an memory-inefficient iterator into a one which has lower memory consumption. - * Divides the items used to produce iterated elements into batches and calls the original iterator - * on each batch. The outside interface make the division into batches invisible, but the - * inefficient iterator is never used with a big number of items. + * Allows to convert an memory-inefficient iterator into a one which has lower memory consumption. Divides the items used to produce iterated elements + * into batches and calls the original iterator on each batch. The outside interface make the division into batches invisible, but the inefficient + * iterator is never used with a big number of items. * * @author Tomasz Pylak */ abstract public class AbstractBatchIterator<T> implements Iterable<T> { /** - * Creates an iterator which is not very memory efficient and should not be called with too many - * items at the same time. + * Creates an iterator which is not very memory efficient and should not be called with too many items at the same time. */ abstract protected Iterable<T> createUnefficientIterator(LongSet itemsBatch); diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/common/CodeRecord.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/common/CodeRecord.java index 59925bc47aa..5bf540328bc 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/common/CodeRecord.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/common/CodeRecord.java @@ -1,6 +1,5 @@ package ch.systemsx.cisd.openbis.generic.server.business.bo.common; - /** * A record object for id and code. */ diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/common/EntityPropertiesEnricher.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/common/EntityPropertiesEnricher.java index 9c5fada9dda..6fd38ebfd6e 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/common/EntityPropertiesEnricher.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/common/EntityPropertiesEnricher.java @@ -109,8 +109,8 @@ public final class EntityPropertiesEnricher implements IEntityPropertiesEnricher } /** - * Enriches the entities with given <var>entityIDs</var> with its properties. The entities will - * be resolved by the {@link IEntityPropertiesHolderResolver} and will be enriched in place. + * Enriches the entities with given <var>entityIDs</var> with its properties. The entities will be resolved by the + * {@link IEntityPropertiesHolderResolver} and will be enriched in place. */ @Override public void enrich(final LongSet entityIDs, final IEntityPropertiesHolderResolver entities) diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/common/GenericEntityPropertyRecord.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/common/GenericEntityPropertyRecord.java index d1c843d931b..9a0f6973442 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/common/GenericEntityPropertyRecord.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/common/GenericEntityPropertyRecord.java @@ -1,6 +1,5 @@ package ch.systemsx.cisd.openbis.generic.server.business.bo.common; - /** * A record object for a generic entity property. */ diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/common/IEntityPropertiesEnricher.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/common/IEntityPropertiesEnricher.java index d8870fbee1e..cd17994c5d6 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/common/IEntityPropertiesEnricher.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/common/IEntityPropertiesEnricher.java @@ -26,8 +26,8 @@ import it.unimi.dsi.fastutil.longs.LongSet; public interface IEntityPropertiesEnricher { /** - * Enriches the entities specified by its IDs its properties. The entities will be retrieved - * by the {@link IEntityPropertiesHolderResolver} and will be enriched "in place". + * Enriches the entities specified by its IDs its properties. The entities will be retrieved by the {@link IEntityPropertiesHolderResolver} and + * will be enriched "in place". */ public void enrich(final LongSet entityIDs, final IEntityPropertiesHolderResolver entities); } diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/common/IEntityPropertiesHolderResolver.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/common/IEntityPropertiesHolderResolver.java index 19697c0f2ae..8938e555906 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/common/IEntityPropertiesHolderResolver.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/common/IEntityPropertiesHolderResolver.java @@ -21,7 +21,7 @@ import ch.systemsx.cisd.openbis.generic.shared.basic.dto.IEntityPropertiesHolder /** * Resolver of objects holding entity properties. * - * @author Franz-Josef Elmer + * @author Franz-Josef Elmer */ public interface IEntityPropertiesHolderResolver { diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/common/IPropertyListingQuery.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/common/IPropertyListingQuery.java index caaf001e6e2..cfbb6643586 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/common/IPropertyListingQuery.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/common/IPropertyListingQuery.java @@ -28,9 +28,8 @@ import ch.systemsx.cisd.openbis.generic.shared.basic.dto.PropertyType; public interface IPropertyListingQuery { /** - * Returns all property types. Fills only <code>id</code>, <code>code</code>, - * <code>label</var> and <code>DataType</code>. Note that code and label are already HTML - * escaped. + * Returns all property types. Fills only <code>id</code>, <code>code</code>, <code>label</var> and <code>DataType</code>. Note that code and + * label are already HTML escaped. */ @Select(sql = "select pt.id as pt_id, pt.code as pt_code, dt.code as dt_code," + " pt.label as pt_label, pt.is_internal_namespace, pt.schema, pt.transformation" diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/common/MaterialEntityPropertyRecord.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/common/MaterialEntityPropertyRecord.java index 76b8e94e339..cdc45e5ae3a 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/common/MaterialEntityPropertyRecord.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/common/MaterialEntityPropertyRecord.java @@ -1,6 +1,5 @@ package ch.systemsx.cisd.openbis.generic.server.business.bo.common; - /** * A record object for an entity property of type MATERIAL. */ diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/common/entity/ExperimentProjectSpaceCodeRecord.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/common/entity/ExperimentProjectSpaceCodeRecord.java index 581f0c90f69..1a71d998fc5 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/common/entity/ExperimentProjectSpaceCodeRecord.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/common/entity/ExperimentProjectSpaceCodeRecord.java @@ -3,14 +3,13 @@ package ch.systemsx.cisd.openbis.generic.server.business.bo.common.entity; import ch.rinn.restrictions.Private; /** - * A class representing an experiment, project and space code. It contains also deletion id, code of - * experiment type and database instance id. + * A class representing an experiment, project and space code. It contains also deletion id, code of experiment type and database instance id. */ @Private public class ExperimentProjectSpaceCodeRecord { public long id; - + public String e_code; public String e_permid; diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/common/entity/ISecondaryEntityListingQuery.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/common/entity/ISecondaryEntityListingQuery.java index 79bd2678f48..42a7e398cc5 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/common/entity/ISecondaryEntityListingQuery.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/common/entity/ISecondaryEntityListingQuery.java @@ -37,12 +37,12 @@ import ch.systemsx.cisd.openbis.generic.shared.basic.dto.Space; { SampleReferenceRecord.class }) public interface ISecondaryEntityListingQuery extends BaseQuery { - public static final String SELECT_FROM_EXPERIMENTS - = "select e.id as id, e.code as e_code, e.perm_id as e_permid, e.del_id as del_id, et.code as et_code, " - + "p.code as p_code, p.id as p_id, p.perm_id as p_perm_id, g.code as spc_code from experiments e " - + "join experiment_types et on e.exty_id=et.id join projects p on e.proj_id=p.id " - + "join spaces g on p.space_id=g.id"; - + public static final String SELECT_FROM_EXPERIMENTS = + "select e.id as id, e.code as e_code, e.perm_id as e_permid, e.del_id as del_id, et.code as et_code, " + + "p.code as p_code, p.id as p_id, p.perm_id as p_perm_id, g.code as spc_code from experiments e " + + "join experiment_types et on e.exty_id=et.id join projects p on e.proj_id=p.id " + + "join spaces g on p.space_id=g.id"; + public static final int FETCH_SIZE = 1000; // @@ -57,9 +57,9 @@ public interface ISecondaryEntityListingQuery extends BaseQuery @Select(SELECT_FROM_EXPERIMENTS + " where e.id=?{1}") public ExperimentProjectSpaceCodeRecord getExperimentAndProjectAndGroupCodeForId( long experimentId); - + @Select(sql = SELECT_FROM_EXPERIMENTS + " where e.id = any(?{1})", parameterBindings = - { LongSetMapper.class }, fetchSize = FETCH_SIZE) + { LongSetMapper.class }, fetchSize = FETCH_SIZE) public DataIterator<ExperimentProjectSpaceCodeRecord> getExperiments(LongSet experimentIds); // diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/common/entity/SecondaryEntityDAO.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/common/entity/SecondaryEntityDAO.java index 944c8d443f8..a6969d3d4a9 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/common/entity/SecondaryEntityDAO.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/common/entity/SecondaryEntityDAO.java @@ -164,7 +164,7 @@ public class SecondaryEntityDAO } return result; } - + public Long2ObjectMap<Experiment> getExperiments(LongSet experimentIds) { Iterable<ExperimentProjectSpaceCodeRecord> experimentRecords = query.getExperiments(experimentIds); @@ -175,7 +175,7 @@ public class SecondaryEntityDAO } return result; } - + public LongSet getSampleDescendantIdsAndSelf(Long sampleId) { LongSet results = new LongOpenHashSet(); diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/datasetlister/DatasetLister.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/datasetlister/DatasetLister.java index cda4425eff6..1e7aecf647b 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/datasetlister/DatasetLister.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/datasetlister/DatasetLister.java @@ -839,7 +839,7 @@ public class DatasetLister extends AbstractLister implements IDatasetLister } return ids; } - + // assumes that the connection to experiment has been already established and experiment has the // id set. private void enrichWithExperiments(Long2ObjectMap<AbstractExternalData> datasetMap) diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/datasetlister/IDatasetListingQuery.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/datasetlister/IDatasetListingQuery.java index a8d95d7e268..a79251823a9 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/datasetlister/IDatasetListingQuery.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/datasetlister/IDatasetListingQuery.java @@ -54,16 +54,16 @@ public interface IDatasetListingQuery extends BaseQuery, IPropertyListingQuery public final static String SELECT_ALL = "select data.*, external_data.*, link_data.*, " - + "prdq.id IS NULL as is_post_registered " - + "from data left outer join external_data on data.id = external_data.data_id " - + "left outer join link_data on data.id = link_data.data_id " - + "left outer join post_registration_dataset_queue prdq on data.id = prdq.ds_id "; + + "prdq.id IS NULL as is_post_registered " + + "from data left outer join external_data on data.id = external_data.data_id " + + "left outer join link_data on data.id = link_data.data_id " + + "left outer join post_registration_dataset_queue prdq on data.id = prdq.ds_id "; public final static String SELECT_ALL_EXTERNAL_DATAS = "select data.*, external_data.*, prdq.id IS NULL as is_post_registered " - + "from data " - + "join external_data on data.id = external_data.data_id " - + "left outer join post_registration_dataset_queue prdq on data.id = prdq.ds_id "; + + "from data " + + "join external_data on data.id = external_data.data_id " + + "left outer join post_registration_dataset_queue prdq on data.id = prdq.ds_id "; /** * Returns the datasets for the given experiment id. @@ -91,7 +91,7 @@ public interface IDatasetListingQuery extends BaseQuery, IPropertyListingQuery + "left outer join external_data as ed on d.id = ed.data_id " + "left outer join link_data as ld on d.id = ld.data_id " + "left outer join post_registration_dataset_queue prdq on d.id = prdq.ds_id " - + "where expe_id = ?{1} " + + "where expe_id = ?{1} " + " or samp_id in (with recursive connected_samples as " + " (select id from samples where expe_id = ?{1} " + " union select s.id from connected_samples as cs " diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/fetchoptions/datasetlister/IDataSetLister.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/fetchoptions/datasetlister/IDataSetLister.java index 9857dd37a77..cab3dc4d91a 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/fetchoptions/datasetlister/IDataSetLister.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/fetchoptions/datasetlister/IDataSetLister.java @@ -29,8 +29,7 @@ public interface IDataSetLister { /** - * Returns the data set meta data for the given <var>dataSetCodes</var> with the given - * <var>dataSetFetchOptions</var>. + * Returns the data set meta data for the given <var>dataSetCodes</var> with the given <var>dataSetFetchOptions</var>. * * @return One data set meta data object for each entry in <var>dataSetCodes</var>. */ @@ -40,16 +39,14 @@ public interface IDataSetLister /** * Returns the download URLs for a set of <var>dataSetCodes</var>. * - * @return The list of data store download URLs, each with the list of data set codes it has - * stored. + * @return The list of data store download URLs, each with the list of data set codes it has stored. */ public List<DataStoreURLForDataSets> getDataStoreDownloadURLs(List<String> dataSetCodes); /** * Returns the remote URLs for a set of <var>dataSetCodes</var>. * - * @return The list of data store remote URLs, each with the list of data set codes it has - * stored. + * @return The list of data store remote URLs, each with the list of data set codes it has stored. */ public List<DataStoreURLForDataSets> getDataStoreRemoteURLs(List<String> dataSetCodes); } diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/fetchoptions/samplelister/ISampleLister.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/fetchoptions/samplelister/ISampleLister.java index d0fa0d3d445..50bd4a8ca36 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/fetchoptions/samplelister/ISampleLister.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/fetchoptions/samplelister/ISampleLister.java @@ -33,8 +33,7 @@ import ch.systemsx.cisd.openbis.generic.shared.basic.IIdentifierHolder; public interface ISampleLister { /** - * Returns all samples of specified technical ids. Properties and related samples are added in - * accordance to the fetch options. + * Returns all samples of specified technical ids. Properties and related samples are added in accordance to the fetch options. * * @param filter A filter which returns only samples and related samples which pass the filter. */ diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/fetchoptions/samplelister/ISampleListingQuery.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/fetchoptions/samplelister/ISampleListingQuery.java index fe0d1b14baf..9e2631aa756 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/fetchoptions/samplelister/ISampleListingQuery.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/fetchoptions/samplelister/ISampleListingQuery.java @@ -55,17 +55,17 @@ public interface ISampleListingQuery extends BaseQuery + "left join spaces as ps on p.space_id = ps.id " + "left join persons as mod on s.pers_id_modifier = mod.id " + "join persons as pe on s.pers_id_registerer = pe.id where s.id = any(?{1}) ", parameterBindings = - { LongSetMapper.class }, fetchSize = FETCH_SIZE) + { LongSetMapper.class }, fetchSize = FETCH_SIZE) public List<SampleRecord> listSamplesByIds(LongSet sampleIDs); @Select(sql = "Select * from sample_relationships " + "where relationship_id = ?{1} and sample_id_parent = any(?{2})", parameterBindings = - { TypeMapper.class/* default */, LongSetMapper.class }, fetchSize = FETCH_SIZE) + { TypeMapper.class/* default */, LongSetMapper.class }, fetchSize = FETCH_SIZE) public List<SampleRelationshipRecord> getChildren(Long relationshipID, LongSet sampleIDs); @Select(sql = "Select * from sample_relationships " + "where relationship_id = ?{1} and sample_id_child = any(?{2})", parameterBindings = - { TypeMapper.class/* default */, LongSetMapper.class }, fetchSize = FETCH_SIZE) + { TypeMapper.class/* default */, LongSetMapper.class }, fetchSize = FETCH_SIZE) public List<SampleRelationshipRecord> getParents(Long relationshipID, LongSet sampleIDs); @Select(sql = "with recursive connected_relationships as (select * from sample_relationships " @@ -73,7 +73,7 @@ public interface ISampleListingQuery extends BaseQuery + "union select sr.* from connected_relationships as cr " + "join sample_relationships as sr on cr.sample_id_child = sr.sample_id_parent) " + "select * from connected_relationships", parameterBindings = - { TypeMapper.class/* default */, LongSetMapper.class }, fetchSize = FETCH_SIZE) + { TypeMapper.class/* default */, LongSetMapper.class }, fetchSize = FETCH_SIZE) public List<SampleRelationshipRecord> getDescendants(Long relationshipID, LongSet sampleIDs); @Select(sql = "with recursive connected_relationships as (select * from sample_relationships " @@ -81,7 +81,7 @@ public interface ISampleListingQuery extends BaseQuery + "union select sr.* from connected_relationships as cr " + "join sample_relationships as sr on cr.sample_id_parent = sr.sample_id_child) " + "select * from connected_relationships", parameterBindings = - { TypeMapper.class/* default */, LongSetMapper.class }, fetchSize = FETCH_SIZE) + { TypeMapper.class/* default */, LongSetMapper.class }, fetchSize = FETCH_SIZE) public List<SampleRelationshipRecord> getAncestors(Long relationshipID, LongSet sampleIDs); @Select(sql = "select p.samp_id as entity_id, pt.code as code, dt.code as data_type, p.value, " @@ -94,20 +94,20 @@ public interface ISampleListingQuery extends BaseQuery + "left join material_types as mt on m.maty_id = mt.id " + "left join controlled_vocabulary_terms as vt on p.cvte_id = vt.id " + "where p.samp_id = any(?{1})", parameterBindings = - { LongSetMapper.class }, fetchSize = FETCH_SIZE) + { LongSetMapper.class }, fetchSize = FETCH_SIZE) public List<PropertyRecord> getProperties(LongSet entityIDs); @Select(sql = "select ma.mepr_id as metaproject_id, ma.samp_id as entity_id " + " from metaproject_assignments as ma " + " join metaprojects as m on ma.mepr_id = m.id " + "where ma.samp_id = any(?{1}) and m.owner = ?{2}", parameterBindings = - { LongSetMapper.class }, fetchSize = FETCH_SIZE) + { LongSetMapper.class }, fetchSize = FETCH_SIZE) public List<EntityMetaprojectRelationRecord> getMetaprojectAssignments(LongSet sampleIDs, Long ownerId); @Select(sql = "select id as id, name as name, description as description, " + " private as is_private, creation_date as creation_date " + " from metaprojects" + " where id = any(?{1})", parameterBindings = - { LongSetMapper.class }, fetchSize = FETCH_SIZE) + { LongSetMapper.class }, fetchSize = FETCH_SIZE) public List<MetaprojectRecord> getMetaprojects(LongSet metaprojectIDs); } diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/util/DataSetTypeWithoutExperimentChecker.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/util/DataSetTypeWithoutExperimentChecker.java index a104cd35731..301b888b528 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/util/DataSetTypeWithoutExperimentChecker.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/bo/util/DataSetTypeWithoutExperimentChecker.java @@ -34,9 +34,9 @@ import ch.systemsx.cisd.common.exceptions.ConfigurationFailureException; public class DataSetTypeWithoutExperimentChecker { public static final String PROPERTY_KEY = "data-set-types-with-no-experiment-needed"; - + private final String regularExpressions; - + private List<Pattern> patternsForDataSetTypesWithoutExperiment = new ArrayList<Pattern>(); public DataSetTypeWithoutExperimentChecker(Properties properties) @@ -63,7 +63,7 @@ public class DataSetTypeWithoutExperimentChecker } } } - + public String getRegularExpressions() { return regularExpressions; @@ -81,5 +81,4 @@ public class DataSetTypeWithoutExperimentChecker return false; } - } diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/importer/DatabaseInstance.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/importer/DatabaseInstance.java index 5ff095ca980..120bee3bddc 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/importer/DatabaseInstance.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/importer/DatabaseInstance.java @@ -16,7 +16,6 @@ package ch.systemsx.cisd.openbis.generic.server.business.importer; - /** * The database instance for the importer. * diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/importer/DatabaseInstanceImporter.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/importer/DatabaseInstanceImporter.java index a63f0d063ca..070f276f9e8 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/importer/DatabaseInstanceImporter.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/business/importer/DatabaseInstanceImporter.java @@ -54,7 +54,7 @@ import ch.systemsx.cisd.openbis.generic.shared.dto.TableNames; /** * Class which allows to import another database instance. * - * @author Franz-Josef Elmer + * @author Franz-Josef Elmer */ public class DatabaseInstanceImporter { diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/coreplugin/JettyWebAppPluginInjector.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/coreplugin/JettyWebAppPluginInjector.java index bfcb2220b5d..a1a9a26c2ef 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/coreplugin/JettyWebAppPluginInjector.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/coreplugin/JettyWebAppPluginInjector.java @@ -48,7 +48,7 @@ import ch.systemsx.cisd.openbis.generic.shared.coreplugin.CorePluginsUtils; public class JettyWebAppPluginInjector { private static final String WEBAPP_FOLDER = "webapp"; - + private static final String START_PAGE = "start-page"; private static final Logger operationLog = LogFactory.getLogger(LogCategory.OPERATION, @@ -112,7 +112,7 @@ public class JettyWebAppPluginInjector } } } - + public void injectWebApps() { List<String> remainingWebapps = replaceDefaultStartPageByWebApp(); @@ -140,7 +140,7 @@ public class JettyWebAppPluginInjector { try { - if (!folder.getCanonicalPath().equals(link.getCanonicalPath())) //Verifies they are pointing to the same version + if (!folder.getCanonicalPath().equals(link.getCanonicalPath())) // Verifies they are pointing to the same version { link.delete(); } @@ -159,7 +159,7 @@ public class JettyWebAppPluginInjector } return; } - + private List<String> replaceDefaultStartPageByWebApp() { List<String> remainingWebApps = new ArrayList<String>(webapps); diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/IAttachmentDAO.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/IAttachmentDAO.java index d6d5d7593b3..89e0e20f331 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/IAttachmentDAO.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/IAttachmentDAO.java @@ -87,7 +87,7 @@ public interface IAttachmentDAO extends IGenericDAO<AttachmentPE> */ public int deleteByOwnerAndFileName(final AttachmentHolderPE owner, final String fileName) throws DataAccessException; - + public Map<String, AttachmentEntry> deleteAttachments(final AttachmentHolderPE holder, final String reason, final List<String> fileNames, PersonPE registrator); diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/IAuthorizationGroupDAO.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/IAuthorizationGroupDAO.java index 5ed7880d66d..c60437b8fe5 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/IAuthorizationGroupDAO.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/IAuthorizationGroupDAO.java @@ -38,8 +38,7 @@ public interface IAuthorizationGroupDAO extends IGenericDAO<AuthorizationGroupPE public void create(AuthorizationGroupPE authorizationGroup); /** - * Returns the authorization group with given code located in home database or null if no such - * group exists. + * Returns the authorization group with given code located in home database or null if no such group exists. */ public AuthorizationGroupPE tryFindByCode(String code); } diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/IDataSourceProvider.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/IDataSourceProvider.java index 3113ab225ba..c0ce9d888a1 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/IDataSourceProvider.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/IDataSourceProvider.java @@ -21,8 +21,7 @@ import javax.sql.DataSource; import ch.systemsx.cisd.common.exceptions.UserFailureException; /** - * Interface for providing a {@link DataSource} for a technology specific database based on data set - * code or data store server code + * Interface for providing a {@link DataSource} for a technology specific database based on data set code or data store server code * * @author Franz-Josef Elmer */ @@ -31,8 +30,7 @@ public interface IDataSourceProvider /** * Returns an appropriated data source for specified data store server code and technology. * - * @throws IllegalArgumentException if getting data source by data store server code isn't - * supported for the specified technology. + * @throws IllegalArgumentException if getting data source by data store server code isn't supported for the specified technology. * @throws UserFailureException if the specified data store server doesn't exist. */ public DataSource getDataSourceByDataStoreServerCode(String dssCode, String technology); diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/IDataStoreDAO.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/IDataStoreDAO.java index a64072db9e1..69ef07c787d 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/IDataStoreDAO.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/IDataStoreDAO.java @@ -23,7 +23,7 @@ import ch.systemsx.cisd.openbis.generic.shared.dto.DataStorePE; /** * <i>Data Access Object</i> for {@link DataStorePE}. * - * @author Franz-Josef Elmer + * @author Franz-Josef Elmer */ public interface IDataStoreDAO { diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/IDeletionDAO.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/IDeletionDAO.java index 0f9e65818bc..d6c364291a6 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/IDeletionDAO.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/IDeletionDAO.java @@ -37,19 +37,16 @@ public interface IDeletionDAO extends IGenericDAO<DeletionPE> void create(final DeletionPE deletion) throws DataAccessException; /** - * Moves entities with given ids to trash using specified deletion. Ignores ids of entities that - * don't exist or are already in the trash. + * Moves entities with given ids to trash using specified deletion. Ignores ids of entities that don't exist or are already in the trash. * - * @param isOriginalDeletion if true than the specified entities are considered originally - * deleted entities + * @param isOriginalDeletion if true than the specified entities are considered originally deleted entities * @return number of trashed entities */ int trash(EntityKind entityKind, List<TechId> entityIds, DeletionPE deletion, boolean isOriginalDeletion) throws DataAccessException; /** - * Moves entities with given ids to trash using specified deletion. Ignores ids of entities that - * don't exist or are already in the trash. + * Moves entities with given ids to trash using specified deletion. Ignores ids of entities that don't exist or are already in the trash. * <p> * The entites are considered to be originally deleted * @@ -70,14 +67,12 @@ public interface IDeletionDAO extends IGenericDAO<DeletionPE> List<TechId> findTrashedSampleIds(List<TechId> deletionIds); /** - * Returns list of ids of non-comonent samples (having no container) moved to trash in specified - * deletions. + * Returns list of ids of non-comonent samples (having no container) moved to trash in specified deletions. */ List<TechId> findTrashedNonComponentSampleIds(List<TechId> deletionIds); /** - * Returns list of ids of component samples (samples with container) moved to trash in specified - * deletions. + * Returns list of ids of component samples (samples with container) moved to trash in specified deletions. */ List<TechId> findTrashedComponentSampleIds(List<TechId> deletionIds); diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/IDynamicPropertyEvaluationScheduler.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/IDynamicPropertyEvaluationScheduler.java index eb7bcdfb386..48908b2e7f5 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/IDynamicPropertyEvaluationScheduler.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/IDynamicPropertyEvaluationScheduler.java @@ -16,7 +16,6 @@ package ch.systemsx.cisd.openbis.generic.server.dataaccess; - /** * @author Piotr Buczek */ diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/IDynamicPropertyEvaluationSchedulerWithQueue.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/IDynamicPropertyEvaluationSchedulerWithQueue.java index 013b9ae1846..567c2c32857 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/IDynamicPropertyEvaluationSchedulerWithQueue.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/IDynamicPropertyEvaluationSchedulerWithQueue.java @@ -17,8 +17,7 @@ package ch.systemsx.cisd.openbis.generic.server.dataaccess; /** - * {@link IDynamicPropertyEvaluationScheduler} extension with methods for dealing with persistent - * blocking queue. + * {@link IDynamicPropertyEvaluationScheduler} extension with methods for dealing with persistent blocking queue. * * @author Piotr Buczek */ @@ -26,8 +25,7 @@ public interface IDynamicPropertyEvaluationSchedulerWithQueue extends IDynamicPropertyEvaluationScheduler { /** - * Retrieves, but does not remove, an operation from the head of this queue, waiting if no - * elements are present on this queue. + * Retrieves, but does not remove, an operation from the head of this queue, waiting if no elements are present on this queue. * * @return an operation from the head of this queue * @throws InterruptedException if interrupted while waiting. @@ -35,8 +33,7 @@ public interface IDynamicPropertyEvaluationSchedulerWithQueue extends DynamicPropertyEvaluationOperation peekWait() throws InterruptedException; /** - * Retrieves and removes an operation from the head of this queue, waiting if no elements are - * present on this queue. + * Retrieves and removes an operation from the head of this queue, waiting if no elements are present on this queue. * * @return an operation from the head of this queue * @throws InterruptedException if interrupted while waiting. @@ -44,15 +41,13 @@ public interface IDynamicPropertyEvaluationSchedulerWithQueue extends DynamicPropertyEvaluationOperation take() throws InterruptedException; /** - * Synchronizes all operations scheduled in a transaction handled by current thread with this - * queue. Should be called after transaction is successfuly commited (otherwise evaluator can - * work on stale data). + * Synchronizes all operations scheduled in a transaction handled by current thread with this queue. Should be called after transaction is + * successfuly commited (otherwise evaluator can work on stale data). */ void synchronizeThreadQueue(); /** - * Remove all operations scheduled in a transaction handled by current thread with this queue. - * Should be called after transaction is rolled back. + * Remove all operations scheduled in a transaction handled by current thread with this queue. Should be called after transaction is rolled back. */ void clearThreadQueue(); } \ No newline at end of file diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/IEntityPropertiesConverter.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/IEntityPropertiesConverter.java index 1e10d96b5a1..dcb2c5f7f0d 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/IEntityPropertiesConverter.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/IEntityPropertiesConverter.java @@ -38,8 +38,7 @@ public interface IEntityPropertiesConverter { /** - * Converts the set of {@link IEntityProperty} objects obtained from the specified entity to an - * array of {@link EntityPropertyPE} objects. + * Converts the set of {@link IEntityProperty} objects obtained from the specified entity to an array of {@link EntityPropertyPE} objects. * * @param registrator Will appear in the objects of the output. */ @@ -48,8 +47,7 @@ public interface IEntityPropertiesConverter final PersonPE registrator); /** - * Returns given value validated and converted for given property type and entity type. Result - * may be null if given value is null. + * Returns given value validated and converted for given property type and entity type. Result may be null if given value is null. */ public String tryCreateValidatedPropertyValue(PropertyTypePE propertyType, EntityTypePropertyTypePE entityTypPropertyType, String value); @@ -72,8 +70,7 @@ public interface IEntityPropertiesConverter EntityTypePE entityType, List<IEntityProperty> newProperties, PersonPE author); /** - * Updates Set<T> of properties but preserve those old properties which codes are not among - * <var>propertiesToUpdate</var>. + * Updates Set<T> of properties but preserve those old properties which codes are not among <var>propertiesToUpdate</var>. */ public <T extends EntityPropertyPE> Set<T> updateProperties(Collection<T> oldProperties, EntityTypePE entityType, List<IEntityProperty> newProperties, PersonPE author, @@ -86,15 +83,14 @@ public interface IEntityPropertiesConverter EntityTypePE entityTypePE); /** - * Checks whether all mandatory properties are provided. It uses (and fills) the - * <var>cache</var> in order to avoid looking up the assigned properties time and again. + * Checks whether all mandatory properties are provided. It uses (and fills) the <var>cache</var> in order to avoid looking up the assigned + * properties time and again. */ public <T extends EntityPropertyPE> void checkMandatoryProperties(Collection<T> properties, EntityTypePE entityTypePE, Map<EntityTypePE, List<EntityTypePropertyTypePE>> cache); /** - * Update the value of a managed property, assuming the managedProperty already has the updated - * value. + * Update the value of a managed property, assuming the managedProperty already has the updated value. */ public <T extends EntityPropertyPE> Set<T> updateManagedProperty(Collection<T> oldProperties, EntityTypePE entityType, IManagedProperty managedProperty, PersonPE author); diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/IEntityPropertyTypeDAO.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/IEntityPropertyTypeDAO.java index 416f614581f..76e9fdb9b5e 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/IEntityPropertyTypeDAO.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/IEntityPropertyTypeDAO.java @@ -38,8 +38,7 @@ public interface IEntityPropertyTypeDAO { /** - * Returns a list of all entity type - property type assignments connected to given - * {@link EntityTypePE}. + * Returns a list of all entity type - property type assignments connected to given {@link EntityTypePE}. */ public List<EntityTypePropertyTypePE> listEntityPropertyTypes(final EntityTypePE entityType) throws DataAccessException; @@ -50,8 +49,8 @@ public interface IEntityPropertyTypeDAO public List<String> listPropertyTypeCodes() throws DataAccessException; /** - * Returns {@link EntityTypePropertyTypePE} assignment connecting given {@link EntityTypePE} and - * {@link PropertyTypePE} if it exists and null otherwise. + * Returns {@link EntityTypePropertyTypePE} assignment connecting given {@link EntityTypePE} and {@link PropertyTypePE} if it exists and null + * otherwise. */ public EntityTypePropertyTypePE tryFindAssignment(EntityTypePE entityType, PropertyTypePE propertyType); @@ -71,8 +70,8 @@ public interface IEntityPropertyTypeDAO public List<Long> listEntityIds(final EntityTypePE entityType) throws DataAccessException; /** - * Returns a list of ids of all entities of type from specified assignment with that don't have - * any value for property assigned with the assignment. + * Returns a list of ids of all entities of type from specified assignment with that don't have any value for property assigned with the + * assignment. */ public List<Long> listIdsOfEntitiesWithoutPropertyValue( final EntityTypePropertyTypePE assignment) throws DataAccessException; @@ -102,8 +101,7 @@ public interface IEntityPropertyTypeDAO /** * Updates given persistent (already saved) <var>entity</var> after successful validation.<br> * <br> - * Useful especially instead of a save() method (used for making entity persistent) after BO - * update that does not flush. + * Useful especially instead of a save() method (used for making entity persistent) after BO update that does not flush. * * @param entity the entity to be validated and updated */ diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/IEventDAO.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/IEventDAO.java index 8b46374ab61..1d55cce7532 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/IEventDAO.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/IEventDAO.java @@ -33,8 +33,7 @@ public interface IEventDAO extends IGenericDAO<EventPE> { /** - * Tries to find <var>eventType</var> event concerning an object of given <var>entityType</var> - * and <code>identifier</code>. + * Tries to find <var>eventType</var> event concerning an object of given <var>entityType</var> and <code>identifier</code>. */ public EventPE tryFind(final String identifier, final EntityType entityType, final EventType eventType); diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/IFileFormatTypeDAO.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/IFileFormatTypeDAO.java index 6a57c93aaef..fe48f2f0e33 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/IFileFormatTypeDAO.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/IFileFormatTypeDAO.java @@ -23,7 +23,7 @@ import ch.systemsx.cisd.openbis.generic.shared.dto.FileFormatTypePE; /** * Interface to the data access layer for retrieving instances of {@link FileFormatTypePE}. * - * @author Franz-Josef Elmer + * @author Franz-Josef Elmer */ public interface IFileFormatTypeDAO extends IGenericDAO<FileFormatTypePE> { diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/ILocatorTypeDAO.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/ILocatorTypeDAO.java index 31109e6abef..badd415758f 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/ILocatorTypeDAO.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/ILocatorTypeDAO.java @@ -21,7 +21,7 @@ import ch.systemsx.cisd.openbis.generic.shared.dto.LocatorTypePE; /** * Interface to the data access layer for retrieving instances of {@link LocatorTypePE}. * - * @author Franz-Josef Elmer + * @author Franz-Josef Elmer */ public interface ILocatorTypeDAO extends IGenericDAO<LocatorTypePE> { diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/IMetaprojectDAO.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/IMetaprojectDAO.java index b7cb69c6d77..40eb1c4f6e1 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/IMetaprojectDAO.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/IMetaprojectDAO.java @@ -32,8 +32,7 @@ import ch.systemsx.cisd.openbis.generic.shared.dto.properties.EntityKind; public interface IMetaprojectDAO extends IGenericDAO<MetaprojectPE> { /** - * Finds a metaproject by the specified owner id and metaproject name. Returns null if no - * metaproject is found. + * Finds a metaproject by the specified owner id and metaproject name. Returns null if no metaproject is found. */ public MetaprojectPE tryFindByOwnerAndName(String ownerId, String metaprojectName); @@ -72,8 +71,7 @@ public interface IMetaprojectDAO extends IGenericDAO<MetaprojectPE> EntityKind entityKind); /** - * Returns a map with counts of assignments for different entity kinds for the given - * metaproject. + * Returns a map with counts of assignments for different entity kinds for the given metaproject. */ public int getMetaprojectAssignmentsCount(Long metaprojectId, EntityKind entityKind); diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/IPropertyTypeDAO.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/IPropertyTypeDAO.java index 2b04dc33e90..02f562aa638 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/IPropertyTypeDAO.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/IPropertyTypeDAO.java @@ -58,8 +58,7 @@ public interface IPropertyTypeDAO extends IGenericDAO<PropertyTypePE> public List<DataTypePE> listDataTypes() throws DataAccessException; /** - * Returns the {@link DataTypePE} for specified <var>code</var> or <code>null</code> if none - * could be found. + * Returns the {@link DataTypePE} for specified <var>code</var> or <code>null</code> if none could be found. */ public DataTypePE getDataTypeByCode(final DataTypeCode code) throws DataAccessException; diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/IPropertyValueValidator.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/IPropertyValueValidator.java index d1161f6c268..81fba56ee86 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/IPropertyValueValidator.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/IPropertyValueValidator.java @@ -27,8 +27,7 @@ import ch.systemsx.cisd.openbis.generic.shared.dto.PropertyTypePE; public interface IPropertyValueValidator { /** - * Validates given <var>value</var> against given {@link PropertyTypePE} and returns the - * validated value as <code>String</code>. + * Validates given <var>value</var> against given {@link PropertyTypePE} and returns the validated value as <code>String</code>. * * @return the validated value. It does not implicitly equal given <var>value</var> */ diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/ISampleTypeDAO.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/ISampleTypeDAO.java index 082719dee43..af51e5e125f 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/ISampleTypeDAO.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/ISampleTypeDAO.java @@ -30,9 +30,8 @@ import ch.systemsx.cisd.openbis.generic.shared.dto.SampleTypePE; public interface ISampleTypeDAO extends IGenericDAO<SampleTypePE> { /** - * Returns a list of {@link SampleTypePE} which have their property types and corresponding - * vocabulary terms eagerly fetched (overriding default behavior which lazily loads the property - * types). + * Returns a list of {@link SampleTypePE} which have their property types and corresponding vocabulary terms eagerly fetched (overriding default + * behavior which lazily loads the property types). * * @return The list of {@link SampleTypePE}s registered in the database. */ diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/IVocabularyDAO.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/IVocabularyDAO.java index 73a04854311..0e580887d17 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/IVocabularyDAO.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/IVocabularyDAO.java @@ -22,8 +22,7 @@ import ch.systemsx.cisd.openbis.generic.shared.dto.VocabularyPE; import ch.systemsx.cisd.openbis.generic.shared.dto.VocabularyTermPE; /** - * An interface that contains all data access operations on {@link VocabularyTermPE} and - * {@link VocabularyPE}. + * An interface that contains all data access operations on {@link VocabularyTermPE} and {@link VocabularyPE}. * * @author Christian Ribeaud */ @@ -36,11 +35,9 @@ public interface IVocabularyDAO extends IGenericDAO<VocabularyPE> void createOrUpdateVocabulary(final VocabularyPE vocabularyPE); /** - * Returns the {@link VocabularyPE} object for the given <var>vocabularyCode</var>, or - * <code>null</code>, if it doesn't exist.<br> + * Returns the {@link VocabularyPE} object for the given <var>vocabularyCode</var>, or <code>null</code>, if it doesn't exist.<br> * <br> - * NOTE: Only internally managed vocabularies have codes that can be used as business - * identifiers (cannot be edited). + * NOTE: Only internally managed vocabularies have codes that can be used as business identifiers (cannot be edited). */ VocabularyPE tryFindVocabularyByCode(final String vocabularyCode); @@ -50,8 +47,7 @@ public interface IVocabularyDAO extends IGenericDAO<VocabularyPE> List<VocabularyPE> listVocabularies(boolean excludeInternal); /** - * @return {@link VocabularyTermPE} with given <var>code</var> for given {@link VocabularyPE} or - * null if it does not exist. + * @return {@link VocabularyTermPE} with given <var>code</var> for given {@link VocabularyPE} or null if it does not exist. */ VocabularyTermPE tryFindVocabularyTermByCode(VocabularyPE vocabulary, String code); diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/IVocabularyTermDAO.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/IVocabularyTermDAO.java index 33ca358f6b7..f516bacfc6b 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/IVocabularyTermDAO.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/IVocabularyTermDAO.java @@ -31,12 +31,10 @@ public interface IVocabularyTermDAO extends IGenericDAO<VocabularyTermPE> void validate(final VocabularyTermPE term); /** - * All terms in specified vocabulary starting from specified ordinal will have the ordinal - * increased by specified increment. + * All terms in specified vocabulary starting from specified ordinal will have the ordinal increased by specified increment. * <p> - * After this change a collection of terms with size equal to <var>increment</var> can be put - * consecutively starting from <var>fromOrdinal</var> and ordinals in the vocabulary will stay - * unique. + * After this change a collection of terms with size equal to <var>increment</var> can be put consecutively starting from <var>fromOrdinal</var> + * and ordinals in the vocabulary will stay unique. */ void increaseVocabularyTermOrdinals(final VocabularyPE vocabulary, final Long fromOrdinal, final int increment); diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/PlaceholderPropertyCreator.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/PlaceholderPropertyCreator.java index 36b8cc66805..b17997ff1f8 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/PlaceholderPropertyCreator.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/PlaceholderPropertyCreator.java @@ -26,8 +26,7 @@ import ch.systemsx.cisd.openbis.generic.shared.basic.dto.PropertyType; class PlaceholderPropertyCreator implements IPropertyPlaceholderCreator { /** - * Adds placeholders for <var>dynamicProperties</var> to <var>definedProperties</var> if they - * don't exist yet. + * Adds placeholders for <var>dynamicProperties</var> to <var>definedProperties</var> if they don't exist yet. */ @Override public void addDynamicPropertiesPlaceholders(Set<IEntityProperty> definedProperties, @@ -38,8 +37,7 @@ class PlaceholderPropertyCreator implements IPropertyPlaceholderCreator } /** - * Adds placeholders for <var>managedProperties</var> to <var>definedProperties</var> if they - * don't exist yet. + * Adds placeholders for <var>managedProperties</var> to <var>definedProperties</var> if they don't exist yet. */ @Override public void addManagedPropertiesPlaceholders(Set<IEntityProperty> definedProperties, @@ -50,8 +48,7 @@ class PlaceholderPropertyCreator implements IPropertyPlaceholderCreator } /** - * Adds <var>placeholderProperties</var> with specified <var>placeholderValue</var>to - * <var>definedProperties</var> if they don't exist yet. + * Adds <var>placeholderProperties</var> with specified <var>placeholderValue</var>to <var>definedProperties</var> if they don't exist yet. */ private void addPlaceholders(Set<IEntityProperty> definedProperties, Set<String> placeholderProperties, String placeholderValue) diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/PropertyValidator.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/PropertyValidator.java index 32808f02ce8..5355dfa64e7 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/PropertyValidator.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/PropertyValidator.java @@ -144,8 +144,7 @@ public final class PropertyValidator implements IPropertyValueValidator } /** - * @return Details about vocabulary dependent on {@link VocabularyPE#isChosenFromList()} - * value: + * @return Details about vocabulary dependent on {@link VocabularyPE#isChosenFromList()} value: * <ul> * <li>for <var>true</var> - returns a list of first few vocabulary terms from it. * <li>for <var>false</var> - returns a vocabulary description diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/db/AbstractDAO.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/db/AbstractDAO.java index 7e0d324cb15..160f1d82904 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/db/AbstractDAO.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/db/AbstractDAO.java @@ -70,8 +70,9 @@ public abstract class AbstractDAO extends HibernateDaoSupport { private static ValidatorFactory factory = Validation.buildDefaultValidatorFactory(); + private static final int MAX_STRING_ERROR_LENGTH = 500; - + protected AbstractDAO(final SessionFactory sessionFactory) { assert sessionFactory != null : "Unspecified session factory"; @@ -99,8 +100,11 @@ public abstract class AbstractDAO extends HibernateDaoSupport for (ConstraintViolation v : violations) { Object invalidValue = v.getInvalidValue(); - if(invalidValue instanceof String && (((String) invalidValue).length() > MAX_STRING_ERROR_LENGTH)) { - invalidValue = String.format("%s... (complete value was %d characters)", ((String) invalidValue).substring(0, MAX_STRING_ERROR_LENGTH), ((String) invalidValue).length()); + if (invalidValue instanceof String && (((String) invalidValue).length() > MAX_STRING_ERROR_LENGTH)) + { + invalidValue = + String.format("%s... (complete value was %d characters)", ((String) invalidValue).substring(0, MAX_STRING_ERROR_LENGTH), + ((String) invalidValue).length()); } msg += ", " + String.format(v.getMessage(), invalidValue); } @@ -179,7 +183,7 @@ public abstract class AbstractDAO extends HibernateDaoSupport size); } } - + protected Date getTransactionTimeStamp() { return UpdateUtils.getTransactionTimeStamp(getSessionFactory()); diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/db/AbstractGenericEntityWithPropertiesDAO.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/db/AbstractGenericEntityWithPropertiesDAO.java index b713d4d02db..2278e300d46 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/db/AbstractGenericEntityWithPropertiesDAO.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/db/AbstractGenericEntityWithPropertiesDAO.java @@ -125,7 +125,7 @@ public abstract class AbstractGenericEntityWithPropertiesDAO<T extends IEntityIn final List<TechId> entityTechIds, final PersonPE registrator, final String reason, final String sqlSelectPermIds, final String sqlDeleteProperties, final String sqlDeleteAttachments, final String sqlDeleteEntities, - final String sqlInsertEvent, final String sqlSelectPropertyHistory, + final String sqlInsertEvent, final String sqlSelectPropertyHistory, final String sqlSelectRelationshipHistory, final String sqlSelectAttributes, List<? extends AttachmentHolderPE> attachmentHolders, AttachmentHolderKind attachmentHolderKind) @@ -133,7 +133,7 @@ public abstract class AbstractGenericEntityWithPropertiesDAO<T extends IEntityIn List<Long> entityIds = TechId.asLongs(entityTechIds); DeletePermanentlyBatchOperation deleteOperation = new DeletePermanentlyBatchOperation(entityType, entityIds, registrator, reason, - sqlSelectPermIds, sqlDeleteProperties, + sqlSelectPermIds, sqlDeleteProperties, sqlDeleteAttachments, sqlDeleteEntities, sqlInsertEvent, sqlSelectPropertyHistory, sqlSelectRelationshipHistory, sqlSelectAttributes, attachmentHolders, attachmentHolderKind); @@ -179,7 +179,7 @@ public abstract class AbstractGenericEntityWithPropertiesDAO<T extends IEntityIn DeletePermanentlyBatchOperation(EntityType entityType, List<Long> allEntityIds, PersonPE registrator, String reason, String sqlSelectPermIds, String sqlDeleteProperties, String sqlDeleteAttachments, - String sqlDeleteEntities, String sqlInsertEvent, String selectPropertyHistory, + String sqlDeleteEntities, String sqlInsertEvent, String selectPropertyHistory, String selectRelationshipHistory, String sqlSelectAttributes, List<? extends AttachmentHolderPE> attachmentHolders, AttachmentHolderKind attachmentHolderKind) @@ -257,8 +257,8 @@ public abstract class AbstractGenericEntityWithPropertiesDAO<T extends IEntityIn return null; } - String content = historyCreator.apply(session, entityIdsToDelete, sqlSelectPropertyHistory, - sqlSelectRelationshipHistory, sqlSelectAttributes, attachmentHolders, + String content = historyCreator.apply(session, entityIdsToDelete, sqlSelectPropertyHistory, + sqlSelectRelationshipHistory, sqlSelectAttributes, attachmentHolders, attachmentHolderKind, registrator); deleteProperties(sqlQueryDeleteProperties, entityIdsToDelete); diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/db/AttachmentDAO.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/db/AttachmentDAO.java index 03133291f2c..ea4027fcda5 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/db/AttachmentDAO.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/db/AttachmentDAO.java @@ -67,10 +67,9 @@ final class AttachmentDAO extends AbstractGenericEntityDAO<AttachmentPE> impleme private static final Logger operationLog = LogFactory.getLogger(LogCategory.OPERATION, AttachmentDAO.class); - private final IEventDAO eventDAO; - AttachmentDAO(final PersistencyResources persistencyResources, + AttachmentDAO(final PersistencyResources persistencyResources, IEventDAO eventDAO, EntityHistoryCreator historyCreator) { super(persistencyResources.getSessionFactory(), ATTACHMENT_CLASS, historyCreator); @@ -101,7 +100,7 @@ final class AttachmentDAO extends AbstractGenericEntityDAO<AttachmentPE> impleme // @Override - public Map<String, AttachmentEntry> deleteAttachments(final AttachmentHolderPE holder, final String reason, + public Map<String, AttachmentEntry> deleteAttachments(final AttachmentHolderPE holder, final String reason, final List<String> fileNames, PersonPE registrator) { Map<String, AttachmentEntry> attachmentEntries = new TreeMap<>(); @@ -121,7 +120,7 @@ final class AttachmentDAO extends AbstractGenericEntityDAO<AttachmentPE> impleme return attachmentEntries; } - private Map<String, AttachmentEntry> createDeletionEvents(List<AttachmentPE> attachmentsToBeDeleted, + private Map<String, AttachmentEntry> createDeletionEvents(List<AttachmentPE> attachmentsToBeDeleted, PersonPE registrator, String reason) { Map<String, AttachmentEntry> attachmentEntries = new TreeMap<>(); @@ -141,8 +140,7 @@ final class AttachmentDAO extends AbstractGenericEntityDAO<AttachmentPE> impleme event.setReason(reason); event.setRegistrator(registrator); event.setAttachmentContent(attachmentToBeDeleted.getAttachmentContent()); - Map<String, List<? extends EntityModification>> modifications - = new HashMap<String, List<? extends EntityModification>>(); + Map<String, List<? extends EntityModification>> modifications = new HashMap<String, List<? extends EntityModification>>(); AttachmentEntry attachmentEntry = new AttachmentEntry(); attachmentEntry.fileName = fileName; attachmentEntry.version = version; @@ -167,7 +165,7 @@ final class AttachmentDAO extends AbstractGenericEntityDAO<AttachmentPE> impleme { AttachmentHolderPE result = internalCreateAttachment(attachment, ownerParam); getHibernateTemplate().flush(); - + scheduleDynamicPropertiesEvaluation(ownerParam); return result; diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/db/DAOFactory.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/db/DAOFactory.java index caa3ae78c84..2988dc0cc23 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/db/DAOFactory.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/db/DAOFactory.java @@ -355,8 +355,8 @@ public final class DAOFactory extends AuthorizationDAOFactory implements IDAOFac public void afterPropertiesSet() throws Exception { // TODO: project samples -// Properties serviceProperties = configurer.getResolvedProps(); -// boolean projectSamplesEnabled = PropertyUtils.getBoolean(serviceProperties, Constants.PROJECT_SAMPLES_ENABLED_KEY, false); + // Properties serviceProperties = configurer.getResolvedProps(); + // boolean projectSamplesEnabled = PropertyUtils.getBoolean(serviceProperties, Constants.PROJECT_SAMPLES_ENABLED_KEY, false); boolean projectSamplesEnabled = false; Connection connection = null; try diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/db/DataDAO.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/db/DataDAO.java index 71cf4536991..a041cb66d4e 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/db/DataDAO.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/db/DataDAO.java @@ -937,12 +937,12 @@ final class DataDAO extends AbstractGenericEntityWithPropertiesDAO<DataPE> imple private static String createQueryRelationshipHistorySQL() { - return " SELECT d.code, relation_type,entity_perm_id, " + ENTITY_TYPE + ", " + return " SELECT d.code, relation_type,entity_perm_id, " + ENTITY_TYPE + ", " + "p.user_id, valid_from_timestamp, valid_until_timestamp " + "FROM " + TableNames.DATA_ALL_TABLE + " d, " + TableNames.DATA_SET_RELATIONSHIPS_HISTORY_TABLE + " h, " + TableNames.PERSONS_TABLE + " p " - + "WHERE d.id = main_data_id and main_data_id " + SQLBuilder.inEntityIds() - + " and h.pers_id_author = p.id" + + "WHERE d.id = main_data_id and main_data_id " + SQLBuilder.inEntityIds() + + " and h.pers_id_author = p.id" + " order by 1, valid_from_timestamp"; } @@ -1058,7 +1058,7 @@ final class DataDAO extends AbstractGenericEntityWithPropertiesDAO<DataPE> imple final List<DeletedDataSetLocation> locations = selectLocations(selectLocations, entityIdsToDelete); - String content = historyCreator.apply(session, entityIdsToDelete, sqls.selectPropertyHistory, + String content = historyCreator.apply(session, entityIdsToDelete, sqls.selectPropertyHistory, sqls.selectRelationshipHistory, sqls.selectAttributes, null, null, registrator); executeUpdate(deleteProperties, entityIdsToDelete); diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/db/DatabaseAndIndexReplacer.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/db/DatabaseAndIndexReplacer.java index 3994a56fc4f..6c2ae1fbb83 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/db/DatabaseAndIndexReplacer.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/db/DatabaseAndIndexReplacer.java @@ -28,16 +28,14 @@ import ch.systemsx.cisd.common.logging.LogFactory; import ch.systemsx.cisd.common.logging.LogInitializer; /** - * Helper application which replaces a database and its Lucene index by another existing database and - * its index. + * Helper application which replaces a database and its Lucene index by another existing database and its index. * - * @author Franz-Josef Elmer + * @author Franz-Josef Elmer */ public class DatabaseAndIndexReplacer { private static final Logger operationLog = - LogFactory.getLogger(LogCategory.OPERATION, DatabaseAndIndexReplacer.class); - + LogFactory.getLogger(LogCategory.OPERATION, DatabaseAndIndexReplacer.class); public static void main(String[] args) { @@ -53,7 +51,7 @@ public class DatabaseAndIndexReplacer File destinationFolder = new File(args[1]); String sourceDatabase = IndexCreationUtil.DATABASE_NAME_PREFIX + args[2]; File sourceFolder = new File(args[3]); - + boolean ok = IndexCreationUtil.duplicateDatabase(destinationDatabase, sourceDatabase); if (ok == false) { diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/db/DynamicPropertiesInterceptor.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/db/DynamicPropertiesInterceptor.java index 313ab2d3687..cff239c2791 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/db/DynamicPropertiesInterceptor.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/db/DynamicPropertiesInterceptor.java @@ -23,8 +23,7 @@ import ch.systemsx.cisd.openbis.generic.server.dataaccess.IDynamicPropertyEvalua import ch.systemsx.cisd.openbis.generic.shared.basic.dto.ServiceVersionHolder; /** - * Synchronizes all dynamic property evaluations scheduled in a transaction with persistent queue - * after transaction is successfully committed. + * Synchronizes all dynamic property evaluations scheduled in a transaction with persistent queue after transaction is successfully committed. * * @author Piotr Buczek */ diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/db/ExperimentDAO.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/db/ExperimentDAO.java index 91e84c5d734..ad10c25309c 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/db/ExperimentDAO.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/db/ExperimentDAO.java @@ -492,7 +492,7 @@ public class ExperimentDAO extends AbstractGenericEntityWithPropertiesDAO<Experi executePermanentDeleteAction(EntityType.EXPERIMENT, experimentIds, registrator, reason, sqlSelectPermIds, sqlDeleteProperties, sqlDeleteAttachments, sqlDeleteExperiments, - sqlInsertEvent, sqlSelectPropertyHistory, sqlSelectRelationshipHistory, sqlSelectAttributes, + sqlInsertEvent, sqlSelectPropertyHistory, sqlSelectRelationshipHistory, sqlSelectAttributes, null, AttachmentHolderKind.EXPERIMENT); } diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/db/IPermIdDAO.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/db/IPermIdDAO.java index ee9fc390069..96363f25a79 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/db/IPermIdDAO.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/db/IPermIdDAO.java @@ -39,8 +39,7 @@ public interface IPermIdDAO public List<String> createPermIds(int n); /** - * Returns {@link IEntityInformationHolderDTO} for given permId and entityKind or null if - * nothing found; + * Returns {@link IEntityInformationHolderDTO} for given permId and entityKind or null if nothing found; */ public IEntityInformationHolderDTO tryToFindByPermId(String permId, EntityKind entityKind); } diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/db/IndexCreationUtil.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/db/IndexCreationUtil.java index 588f5f4a8a8..134b443194d 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/db/IndexCreationUtil.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/db/IndexCreationUtil.java @@ -73,7 +73,7 @@ public final class IndexCreationUtil if (applicationContext == null) { final AbstractApplicationContext appC = new ClassPathXmlApplicationContext(new String[] - { "applicationContext.xml" }, true); + { "applicationContext.xml" }, true); IndexCreationUtil.applicationContext = appC; } return applicationContext; @@ -119,8 +119,7 @@ public final class IndexCreationUtil } /** - * Creates a freshly new {@link HibernateSearchContext} overriding the one loaded by - * <i>Spring</i>. + * Creates a freshly new {@link HibernateSearchContext} overriding the one loaded by <i>Spring</i>. */ private final static HibernateSearchContext createHibernateSearchContext(String indexFolder) { diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/db/MaterialDAO.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/db/MaterialDAO.java index f60d67499ab..65014315e16 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/db/MaterialDAO.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/db/MaterialDAO.java @@ -308,7 +308,7 @@ public class MaterialDAO extends AbstractGenericEntityWithPropertiesDAO<Material String materialTypeCode = (String) codeAndType[1]; String permId = MaterialPE.createPermId(materialCode, materialTypeCode); - String content = historyCreator.apply(session, Collections.singletonList(techId.getId()), + String content = historyCreator.apply(session, Collections.singletonList(techId.getId()), sqlPropertyHistory, null, sqlAttributesHistory, null, null, registrator); try diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/db/SampleDAO.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/db/SampleDAO.java index 437c006d62e..172437d7cc1 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/db/SampleDAO.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/db/SampleDAO.java @@ -72,8 +72,7 @@ public class SampleDAO extends AbstractGenericEntityWithPropertiesDAO<SamplePE> /** * This logger does not output any SQL statement. If you want to do so, you had better set an appropriate debugging level for class - * {@link JdbcAccessor}. - * </p> + * {@link JdbcAccessor}. </p> */ private static final Logger operationLog = LogFactory.getLogger(LogCategory.OPERATION, SampleDAO.class); @@ -353,7 +352,7 @@ public class SampleDAO extends AbstractGenericEntityWithPropertiesDAO<SamplePE> @Override public final void createOrUpdateSamples(final List<SamplePE> samples, final PersonPE modifier, boolean clearCache) - throws DataAccessException + throws DataAccessException { assert samples != null && samples.size() > 0 : "Unspecified or empty samples."; @@ -457,7 +456,7 @@ public class SampleDAO extends AbstractGenericEntityWithPropertiesDAO<SamplePE> final String sqlSelectAttributes = createQueryAttributesSQL(); executePermanentDeleteAction(EntityType.SAMPLE, sampleIds, registrator, reason, - sqlSelectPermIds, sqlDeleteProperties, + sqlSelectPermIds, sqlDeleteProperties, sqlDeleteAttachments, sqlDeleteSamples, sqlInsertEvent, sqlSelectPropertyHistory, sqlSelectRelationshipHistory, sqlSelectAttributes, null, AttachmentHolderKind.SAMPLE); } @@ -491,7 +490,7 @@ public class SampleDAO extends AbstractGenericEntityWithPropertiesDAO<SamplePE> + ") " + " ORDER BY 1, valid_from_timestamp"; } - + private static String createQueryRelationshipHistorySQL() { return "SELECT s.perm_id, h.relation_type, h.entity_perm_id, " + ENTITY_TYPE + ", " @@ -570,7 +569,7 @@ public class SampleDAO extends AbstractGenericEntityWithPropertiesDAO<SamplePE> String permIds = permIdList.substring(2); String content = historyCreator.apply(session, entityIdsToDelete, createQueryPropertyHistorySQL(), - createQueryRelationshipHistorySQL(), createQueryAttributesSQL(), null, + createQueryRelationshipHistorySQL(), createQueryAttributesSQL(), null, AttachmentHolderKind.SAMPLE, registrator); SQLQuery deleteProperties = session.createSQLQuery(properties); @@ -586,14 +585,14 @@ public class SampleDAO extends AbstractGenericEntityWithPropertiesDAO<SamplePE> deleteAttachments.setParameter("id", deletion.getId()); deleteAttachments.executeUpdate(); -// if (attachmentContentIdList.size() > 0) -// { -// SQLQuery deleteAttachmentContents = -// session.createSQLQuery(attachmentContents); -// deleteAttachmentContents.setParameterList("ids", attachmentContentIdList); -// deleteAttachmentContents.executeUpdate(); -// } -// + // if (attachmentContentIdList.size() > 0) + // { + // SQLQuery deleteAttachmentContents = + // session.createSQLQuery(attachmentContents); + // deleteAttachmentContents.setParameterList("ids", attachmentContentIdList); + // deleteAttachmentContents.executeUpdate(); + // } + // SQLQuery deleteSamples = session.createSQLQuery(samples); deleteSamples.setParameter("id", deletion.getId()); deleteSamples.executeUpdate(); diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/db/deletion/AttachmentEntry.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/db/deletion/AttachmentEntry.java index fae3b327558..4b76b8cc8fa 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/db/deletion/AttachmentEntry.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/db/deletion/AttachmentEntry.java @@ -21,8 +21,6 @@ import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonInclude.Include; /** - * - * * @author Franz-Josef Elmer */ public class AttachmentEntry extends EntityModification @@ -30,22 +28,22 @@ public class AttachmentEntry extends EntityModification public static final String ATTACHMENT = "ATTACHMENT"; public final String type = ATTACHMENT; - + @JsonProperty("key") public String relationType; - + @JsonProperty("value") public String relatedEntity; public String entityType; - + public String fileName; - + public int version; - + @JsonInclude(Include.NON_EMPTY) public String description; - + @JsonInclude(Include.NON_EMPTY) public String title; diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/db/deletion/AttributeEntry.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/db/deletion/AttributeEntry.java index 7d425b61745..3d65dc72722 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/db/deletion/AttributeEntry.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/db/deletion/AttributeEntry.java @@ -19,8 +19,6 @@ package ch.systemsx.cisd.openbis.generic.server.dataaccess.db.deletion; import com.fasterxml.jackson.annotation.JsonProperty; /** - * - * * @author Franz-Josef Elmer */ public class AttributeEntry extends EntityModification @@ -33,7 +31,7 @@ public class AttributeEntry extends EntityModification public String attributeName; public String value; - + @Override public String toString() { diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/db/deletion/EntityHistoryCreator.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/db/deletion/EntityHistoryCreator.java index 5118e9ebae2..d63f9f002a1 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/db/deletion/EntityHistoryCreator.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/db/deletion/EntityHistoryCreator.java @@ -57,7 +57,7 @@ public class EntityHistoryCreator } public String apply(SharedSessionContract session, List<Long> entityIdsToDelete, - String propertyHistoryQuery, String relationshipHistoryQuery, String attributesQuery, + String propertyHistoryQuery, String relationshipHistoryQuery, String attributesQuery, List<? extends AttachmentHolderPE> attachmentHolders, AttachmentHolderKind attachmentHolderKind, PersonPE registrator) { @@ -73,7 +73,7 @@ public class EntityHistoryCreator selectAttributeEntries(session.createSQLQuery(attributesQuery), entityIdsToDelete); addToHistories(histories, attributeEntries); } - + List<PropertyHistoryEntry> propertyHistory = selectHistoryPropertyEntries(session.createSQLQuery(propertyHistoryQuery), entityIdsToDelete); addToHistories(histories, propertyHistory); @@ -85,17 +85,15 @@ public class EntityHistoryCreator entityIdsToDelete); addToHistories(histories, relationshipHistory); } - + if (attachmentHolders != null) { - List<RelationshipHistoryEntry> deletedAttachments - = deleteAttachments(session, registrator, attachmentHolders); + List<RelationshipHistoryEntry> deletedAttachments = deleteAttachments(session, registrator, attachmentHolders); addToHistories(histories, deletedAttachments); } if (attachmentHolderKind != null) { - List<RelationshipHistoryEntry> deletedAttachments - = deleteAttachments(session, registrator, attachmentHolderKind, entityIdsToDelete); + List<RelationshipHistoryEntry> deletedAttachments = deleteAttachments(session, registrator, attachmentHolderKind, entityIdsToDelete); addToHistories(histories, deletedAttachments); } @@ -116,7 +114,7 @@ public class EntityHistoryCreator } return content; } - + private List<RelationshipHistoryEntry> deleteAttachments(SharedSessionContract session, PersonPE registrator, AttachmentHolderKind attachmentHolderKind, List<Long> holderIds) { @@ -150,8 +148,7 @@ public class EntityHistoryCreator insertQuery.setParameter("registerer", registrator.getId()); insertQuery.setParameter("identifiers", identifier); insertQuery.setParameter("attachment", ((Number) row.get("EXAC_ID")).longValue()); - Map<String, List<? extends EntityModification>> modifications - = new HashMap<String, List<? extends EntityModification>>(); + Map<String, List<? extends EntityModification>> modifications = new HashMap<String, List<? extends EntityModification>>(); AttachmentEntry attachmentEntry = new AttachmentEntry(); attachmentEntry.fileName = fileName; attachmentEntry.version = version; @@ -183,35 +180,47 @@ public class EntityHistoryCreator } return result; } - + private String createSelectHolderStatement(AttachmentHolderKind holderKind) { String tableName = ""; switch (holderKind) { - case PROJECT: tableName = "projects"; break; - case EXPERIMENT: tableName = "experiments_all"; break; - case SAMPLE: tableName = "samples_all"; break; + case PROJECT: + tableName = "projects"; + break; + case EXPERIMENT: + tableName = "experiments_all"; + break; + case SAMPLE: + tableName = "samples_all"; + break; } return "SELECT id, perm_id from " + tableName + " WHERE id in (:" + ENTITY_IDS + ")"; } - + private String createSelectAttachmentsStatement(AttachmentHolderKind attachmentHolderKind) { String holderColumn = ""; switch (attachmentHolderKind) { - case PROJECT: holderColumn = "proj_id"; break; - case EXPERIMENT: holderColumn = "expe_id"; break; - case SAMPLE: holderColumn = "samp_id"; break; + case PROJECT: + holderColumn = "proj_id"; + break; + case EXPERIMENT: + holderColumn = "expe_id"; + break; + case SAMPLE: + holderColumn = "samp_id"; + break; } return "SELECT " + holderColumn + " as holder_id, file_name, " + "version, title, description, a.registration_timestamp, r.user_id, exac_id " + "FROM attachments a join persons r on a.pers_id_registerer = r.id " + "WHERE " + holderColumn + " in (:" + ENTITY_IDS + ")"; } - - private List<RelationshipHistoryEntry> deleteAttachments(SharedSessionContract session, + + private List<RelationshipHistoryEntry> deleteAttachments(SharedSessionContract session, PersonPE registrator, List<? extends AttachmentHolderPE> attachmentHolders) { List<RelationshipHistoryEntry> relationshipHistoryEntries = new ArrayList<>(); @@ -224,15 +233,14 @@ public class EntityHistoryCreator { fileNames.add(attachment.getFileName()); } - Map<String, AttachmentEntry> deletedAttachments - = attachmentDAO.deleteAttachments(holder, "", fileNames, registrator); + Map<String, AttachmentEntry> deletedAttachments = attachmentDAO.deleteAttachments(holder, "", fileNames, registrator); Set<Entry<String, AttachmentEntry>> entrySet = deletedAttachments.entrySet(); for (Entry<String, AttachmentEntry> entry : entrySet) { RelationshipHistoryEntry relationshipHistoryEntry = new RelationshipHistoryEntry(); relationshipHistoryEntry.userId = entry.getValue().userId; relationshipHistoryEntry.entityType = "ATTACHMENT"; - relationshipHistoryEntry.permId = holder.getPermId() ; + relationshipHistoryEntry.permId = holder.getPermId(); relationshipHistoryEntry.relatedEntity = entry.getKey(); relationshipHistoryEntry.relationType = "OWNER"; relationshipHistoryEntry.validFrom = entry.getValue().validFrom; @@ -241,7 +249,7 @@ public class EntityHistoryCreator } return relationshipHistoryEntries; } - + private List<AttributeEntry> selectAttributeEntries(SQLQuery sqlQuery, List<Long> entityIdsToDelete) { List<Map<String, Object>> rows = getRows(sqlQuery, entityIdsToDelete); @@ -446,11 +454,12 @@ public class EntityHistoryCreator } } - + private static class AttachmentHolder { long id; + String permId; } - + } diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/db/deletion/EntityModification.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/db/deletion/EntityModification.java index 60d7d36cecd..b3f457e439f 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/db/deletion/EntityModification.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/db/deletion/EntityModification.java @@ -10,7 +10,7 @@ public class EntityModification { @JsonInclude(Include.NON_EMPTY) public String userId; - + @JsonIgnore public String permId; diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/db/deletion/PropertyHistoryEntry.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/db/deletion/PropertyHistoryEntry.java index 49546304a56..189de5d88a5 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/db/deletion/PropertyHistoryEntry.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/db/deletion/PropertyHistoryEntry.java @@ -2,12 +2,10 @@ package ch.systemsx.cisd.openbis.generic.server.dataaccess.db.deletion; import com.fasterxml.jackson.annotation.JsonProperty; - - public class PropertyHistoryEntry extends EntityModification { public final String type = "PROPERTY"; - + @JsonProperty("key") public String propertyCode; @@ -17,7 +15,7 @@ public class PropertyHistoryEntry extends EntityModification public String toString() { return "HistoryPropertyEntry [permId=" + permId + ", propertyCode=" + propertyCode + ", value=" + value - + ", user_id=" + userId + + ", user_id=" + userId + ", valid_from_timestamp=" + validFrom + ", valid_until_timestamp=" + validUntil + "]"; } } diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/db/deletion/RelationshipHistoryEntry.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/db/deletion/RelationshipHistoryEntry.java index 4dfa99e5762..3f3b1438240 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/db/deletion/RelationshipHistoryEntry.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/db/deletion/RelationshipHistoryEntry.java @@ -2,12 +2,10 @@ package ch.systemsx.cisd.openbis.generic.server.dataaccess.db.deletion; import com.fasterxml.jackson.annotation.JsonProperty; - - public class RelationshipHistoryEntry extends EntityModification { public final String type = "RELATIONSHIP"; - + @JsonProperty("key") public String relationType; @@ -20,7 +18,7 @@ public class RelationshipHistoryEntry extends EntityModification public String toString() { return "RelationshipHistoryEntry [permId=" + permId + ", relationType=" + relationType + ", relatedEntity=" - + relatedEntity + ", entityType=" + entityType + ", userId=" + userId + ", validFromTimestamp=" + + relatedEntity + ", entityType=" + entityType + ", userId=" + userId + ", validFromTimestamp=" + validFrom + ", validUntilTimestamp=" + validUntil + "]"; } } \ No newline at end of file diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/db/search/CharacterHelper.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/db/search/CharacterHelper.java index 0c8d82d702a..9a31f8d4619 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/db/search/CharacterHelper.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/db/search/CharacterHelper.java @@ -31,7 +31,7 @@ public class CharacterHelper private static final char ESCAPE_CHARACTER = '\\'; public final static Set<Character> SPECIAL_CHARACTERS = new HashSet<Character>(Arrays.asList( - // Special code characters + // Special code characters '.', ':', '-', '_', // Special word characters diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/db/search/HibernateSearchContext.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/db/search/HibernateSearchContext.java index cd9408794b5..3aa88581c31 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/db/search/HibernateSearchContext.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/db/search/HibernateSearchContext.java @@ -33,8 +33,7 @@ import ch.systemsx.cisd.common.reflection.ModifiedShortPrefixToStringStyle; /** * A bean class that contains properties related to <i>Hibernate Search</i>. * <p> - * This bean must be initialized before <code>hibernate-session-factory</code> bean as it will - * remove the <code>indexBase</code> directory. + * This bean must be initialized before <code>hibernate-session-factory</code> bean as it will remove the <code>indexBase</code> directory. * </p> * * @author Christian Ribeaud diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/db/search/IFullTextIndexUpdateScheduler.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/db/search/IFullTextIndexUpdateScheduler.java index 81ca1bb53ae..fbd5de16b69 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/db/search/IFullTextIndexUpdateScheduler.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/db/search/IFullTextIndexUpdateScheduler.java @@ -17,9 +17,8 @@ package ch.systemsx.cisd.openbis.generic.server.dataaccess.db.search; /** - * Each implementation is able to schedule a <i>full-text</i> index update. Updates are expected to - * be executed asynchronously in the order they had been scheduled. The thread executing updates - * will run with low priority. + * Each implementation is able to schedule a <i>full-text</i> index update. Updates are expected to be executed asynchronously in the order they had + * been scheduled. The thread executing updates will run with low priority. * * @author Piotr Buczek */ diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/db/search/IFullTextIndexUpdater.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/db/search/IFullTextIndexUpdater.java index a158dea6f89..ea7cc234cda 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/db/search/IFullTextIndexUpdater.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/db/search/IFullTextIndexUpdater.java @@ -17,9 +17,8 @@ package ch.systemsx.cisd.openbis.generic.server.dataaccess.db.search; /** - * Each implementation is able to perform a <i>full-text</i> index update. Updates are expected to - * be executed asynchronously in the order they had been scheduled. The thread executing updates - * will run with low priority. + * Each implementation is able to perform a <i>full-text</i> index update. Updates are expected to be executed asynchronously in the order they had + * been scheduled. The thread executing updates will run with low priority. * * @author Piotr Buczek */ diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/db/search/IFullTextIndexer.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/db/search/IFullTextIndexer.java index a0e484f72aa..c065a8a5dd8 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/db/search/IFullTextIndexer.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/db/search/IFullTextIndexer.java @@ -31,22 +31,19 @@ public interface IFullTextIndexer { /** - * Performs a <i>full-text</i> index on entities of given <var>clazz</var> using given - * <i>Hibernate</i> session. + * Performs a <i>full-text</i> index on entities of given <var>clazz</var> using given <i>Hibernate</i> session. */ public <T> void doFullTextIndex(final Session hibernateSession, final Class<T> clazz) throws DataAccessException; /** - * Performs a <i>full-text</i> index update on entities of given <var>clazz</var> with given - * <var>ids</var> using given <i>Hibernate</i> session. + * Performs a <i>full-text</i> index update on entities of given <var>clazz</var> with given <var>ids</var> using given <i>Hibernate</i> session. */ public <T> void doFullTextIndexUpdate(final Session hibernateSession, final Class<T> clazz, final List<Long> ids) throws DataAccessException; /** - * Removes entities of given <var>clazz</var> with given <var>ids</var> from the - * <i>full-text</i> index using given <i>Hibernate</i> session. + * Removes entities of given <var>clazz</var> with given <var>ids</var> from the <i>full-text</i> index using given <i>Hibernate</i> session. */ public <T> void removeFromIndex(final Session hibernateSession, final Class<T> clazz, final List<Long> ids) throws DataAccessException; diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/db/search/IndexMode.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/db/search/IndexMode.java index 36cbae20f5f..872396de1fa 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/db/search/IndexMode.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/db/search/IndexMode.java @@ -20,11 +20,9 @@ package ch.systemsx.cisd.openbis.generic.server.dataaccess.db.search; * The mode in which the indexing is working: * <ul> * <li><b>NO_INDEX</b>: no manual index will be performed.</li> - * <li><b>SKIP_IF_MARKER_FOUND</b>: skips the indexing if - * {@link FullTextIndexerRunnable#FULL_TEXT_INDEX_MARKER_FILENAME} marker file is found (meaning - * that a manual index has already been performed).</li> - * <li><b>INDEX_FROM_SCRATCH</b>: performs a manual index from the scratch, deleting the whole - * <code>index-base</code> directory.</li> + * <li><b>SKIP_IF_MARKER_FOUND</b>: skips the indexing if {@link FullTextIndexerRunnable#FULL_TEXT_INDEX_MARKER_FILENAME} marker file is found + * (meaning that a manual index has already been performed).</li> + * <li><b>INDEX_FROM_SCRATCH</b>: performs a manual index from the scratch, deleting the whole <code>index-base</code> directory.</li> * </ul> * * @author Christian Ribeaud diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/db/search/IndexingQueryOptimizer.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/db/search/IndexingQueryOptimizer.java index 6162d4f3ddb..b6e9af68505 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/db/search/IndexingQueryOptimizer.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/db/search/IndexingQueryOptimizer.java @@ -44,10 +44,9 @@ public class IndexingQueryOptimizer } /** - * Modifies a Criteria instance to optimize database queries that are used to do full text - * indexing. Sets fetch mode to FetchMode.JOIN for all properties of an entity class that are - * either annotated with IndexedEmbedded or they are eagerly fetched associations annotated with - * OneToOne, ManyToOne, OneToMany or ManyToMany. + * Modifies a Criteria instance to optimize database queries that are used to do full text indexing. Sets fetch mode to FetchMode.JOIN for all + * properties of an entity class that are either annotated with IndexedEmbedded or they are eagerly fetched associations annotated with OneToOne, + * ManyToOne, OneToMany or ManyToMany. * * @param clazz Entity class whose instances are to be queried * @param criteria Criteria query to be optimized diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/db/search/LuceneQueryBuilder.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/db/search/LuceneQueryBuilder.java index 795d9787f71..b68b9faf815 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/db/search/LuceneQueryBuilder.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/db/search/LuceneQueryBuilder.java @@ -207,7 +207,7 @@ public class LuceneQueryBuilder String fieldName = fieldNames.get(i); String searchPattern = searchPatterns.get(i); Analyzer analyzer = analyzers.get(i); - + Query query = parseQuery(fieldName, searchPattern, analyzer); Occur occur = occurs.get(i); if (Occur.MUST_NOT.equals(occur)) @@ -244,7 +244,7 @@ public class LuceneQueryBuilder { parser.setAllowLeadingWildcard(true); BooleanQuery.setMaxClauseCount(Integer.MAX_VALUE); - + try { return parser.parse(wholeQuery); diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/db/search/PackageBasedIndexedEntityFinder.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/db/search/PackageBasedIndexedEntityFinder.java index f14b2c4056b..369348686de 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/db/search/PackageBasedIndexedEntityFinder.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/db/search/PackageBasedIndexedEntityFinder.java @@ -26,11 +26,9 @@ import ch.systemsx.cisd.common.reflection.ClassUtils; import ch.systemsx.cisd.common.reflection.IClassFilter; /** - * A {@link IIndexedEntityFinder} based on a package name specified in the constructor. Classes - * ending with <code>Test</code> will be ignored. + * A {@link IIndexedEntityFinder} based on a package name specified in the constructor. Classes ending with <code>Test</code> will be ignored. * <p> - * This does not work recursively and expects to find all the correctly annotated classes in the - * given package. + * This does not work recursively and expects to find all the correctly annotated classes in the given package. * </p> * * @author Christian Ribeaud diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/db/search/detailed/DetailedQueryBuilder.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/db/search/detailed/DetailedQueryBuilder.java index 5271725b369..66072f122a8 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/db/search/detailed/DetailedQueryBuilder.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/db/search/detailed/DetailedQueryBuilder.java @@ -88,7 +88,7 @@ public class DetailedQueryBuilder { this.entityKind = entityKind; } - + private Query createQuery(String userId, DetailedSearchCriteria searchCriteria, List<IAssociationCriteria> associations, Map<String, DocValuesType> fieldTypes) { @@ -121,11 +121,12 @@ public class DetailedQueryBuilder fieldPattern = LuceneQueryBuilder.adaptQuery(fieldUserQuery, useWildcardSearchMode, false); fieldAnalyzer = new IgnoreCaseAnalyzer(); - } else if(isNumeric && criterion.getType() != null) + } else if (isNumeric && criterion.getType() != null) { fieldPattern = getRangeNumberQuery(criterion, fieldPattern); fieldAnalyzer = PassThroughAnalyzer.INSTANCE; - } else { + } else + { fieldPattern = LuceneQueryBuilder.adaptQuery(value, useWildcardSearchMode); fieldAnalyzer = searchAnalyzer; } @@ -135,7 +136,7 @@ public class DetailedQueryBuilder fieldOccur.add(criterion.isNegated() ? Occur.MUST_NOT : Occur.SHOULD); } - Query luceneQuery = LuceneQueryBuilder.parseQuery(criterion.getType(), fieldNames, + Query luceneQuery = LuceneQueryBuilder.parseQuery(criterion.getType(), fieldNames, fieldPatterns, fieldAnalyzers, fieldOccur); resultQuery.add(luceneQuery, occureCondition); } else @@ -164,7 +165,8 @@ public class DetailedQueryBuilder private String getRangeNumberQuery(DetailedSearchCriterion criterion, String fieldPattern) { String parsedNumberValue = SortableNumberBridgeUtils.getNumberForLucene(criterion.getValue()); - switch(criterion.getType()) { + switch (criterion.getType()) + { case LESS_THAN: return "{* TO " + parsedNumberValue + "}"; case LESS_THAN_OR_EQUAL: @@ -178,7 +180,7 @@ public class DetailedQueryBuilder } return fieldPattern; } - + private Occur createOccureCondition(SearchCriteriaConnection connection) { switch (connection) @@ -191,8 +193,9 @@ public class DetailedQueryBuilder throw InternalErr.error("unknown enum " + connection); } } - - public static List<String> getIndexFieldNames(List<DetailedSearchCriterion> criteria, EntityKind entityKind) { + + public static List<String> getIndexFieldNames(List<DetailedSearchCriterion> criteria, EntityKind entityKind) + { List<String> fieldNames = new ArrayList<String>(); for (DetailedSearchCriterion criterion : criteria) { @@ -200,7 +203,7 @@ public class DetailedQueryBuilder } return fieldNames; } - + private static List<String> getIndexFieldNames(DetailedSearchField searchField, EntityKind entityKind) { DetailedSearchFieldKind fieldKind = searchField.getKind(); diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/db/search/detailed/IndexFieldNameHelper.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/db/search/detailed/IndexFieldNameHelper.java index d9a2195afc4..6dac8cd7a6f 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/db/search/detailed/IndexFieldNameHelper.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/db/search/detailed/IndexFieldNameHelper.java @@ -49,7 +49,7 @@ class IndexFieldNameHelper return SearchFieldConstants.EXPERIMENT_ID; } throw createAssociationNotHandledException(entityKind, associationKind); - + case SAMPLE: if (entityKind == EntityKind.DATA_SET) { diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/dynamic_property/DynamicPropertyEvaluator.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/dynamic_property/DynamicPropertyEvaluator.java index c3ff30ec57e..e4584b2fe06 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/dynamic_property/DynamicPropertyEvaluator.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/dynamic_property/DynamicPropertyEvaluator.java @@ -113,14 +113,16 @@ public class DynamicPropertyEvaluator implements IDynamicPropertyEvaluator .setParameter("sample", entity); allPropertyTypes = propertyTypeQuery.list(); - if (allPropertyTypes.size() > 0) { + if (allPropertyTypes.size() > 0) + { propertyQuery = session.createQuery( "SELECT property FROM SamplePropertyPE property WHERE " + "property.entity = :sample AND property.entityTypePropertyType IN (:types)") .setParameter("sample", entity).setParameterList("types", allPropertyTypes); existingProperties = propertyQuery.list(); - } else { + } else + { existingProperties = new ArrayList<EntityPropertyPE>(); } break; @@ -131,14 +133,16 @@ public class DynamicPropertyEvaluator implements IDynamicPropertyEvaluator .setParameter("data", entity); allPropertyTypes = propertyTypeQuery.list(); - if (allPropertyTypes.size() > 0) { + if (allPropertyTypes.size() > 0) + { propertyQuery = session.createQuery( "SELECT property FROM DataSetPropertyPE property WHERE " + "property.entity = :data AND property.entityTypePropertyType IN (:types)") .setParameter("data", entity).setParameterList("types", allPropertyTypes); existingProperties = propertyQuery.list(); - } else { + } else + { existingProperties = new ArrayList<EntityPropertyPE>(); } break; @@ -149,17 +153,19 @@ public class DynamicPropertyEvaluator implements IDynamicPropertyEvaluator .setParameter("experiment", entity); allPropertyTypes = propertyTypeQuery.list(); - if (allPropertyTypes.size() > 0) { + if (allPropertyTypes.size() > 0) + { propertyQuery = session.createQuery( "SELECT property FROM ExperimentPropertyPE property WHERE " + "property.entity = :experiment AND property.entityTypePropertyType IN (:types)") .setParameter("experiment", entity).setParameterList("types", allPropertyTypes); existingProperties = propertyQuery.list(); - } else { + } else + { existingProperties = new ArrayList<EntityPropertyPE>(); } - + break; case MATERIAL: propertyTypeQuery = @@ -168,14 +174,16 @@ public class DynamicPropertyEvaluator implements IDynamicPropertyEvaluator .setParameter("material", entity); allPropertyTypes = propertyTypeQuery.list(); - if (allPropertyTypes.size() > 0) { + if (allPropertyTypes.size() > 0) + { propertyQuery = session.createQuery( "SELECT property FROM MaterialPropertyPE property WHERE " + "property.entity = :material AND property.entityTypePropertyType IN (:types)") .setParameter("material", entity).setParameterList("types", allPropertyTypes); existingProperties = propertyQuery.list(); - } else { + } else + { existingProperties = new ArrayList<EntityPropertyPE>(); } break; diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/dynamic_property/IBatchDynamicPropertyEvaluator.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/dynamic_property/IBatchDynamicPropertyEvaluator.java index 5569bd95d69..6b73cb15dce 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/dynamic_property/IBatchDynamicPropertyEvaluator.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/dynamic_property/IBatchDynamicPropertyEvaluator.java @@ -24,8 +24,8 @@ import org.springframework.dao.DataAccessException; import ch.systemsx.cisd.openbis.generic.shared.dto.IEntityInformationWithPropertiesHolder; /** - * Each implementation is able to evaluate dynamic properties of specified entities in batches. - * After evaluation of properties the entities will be reindexed. + * Each implementation is able to evaluate dynamic properties of specified entities in batches. After evaluation of properties the entities will be + * reindexed. * * @author Piotr Buczek */ @@ -33,8 +33,7 @@ public interface IBatchDynamicPropertyEvaluator { /** - * Evaluates dynamic properties of all entities of given <var>clazz</var> using given - * <i>Hibernate</i> session. + * Evaluates dynamic properties of all entities of given <var>clazz</var> using given <i>Hibernate</i> session. * * @return list of ids of entities with dynamic properties that have been evaluated */ @@ -42,8 +41,7 @@ public interface IBatchDynamicPropertyEvaluator final Session hibernateSession, final Class<T> clazz) throws DataAccessException; /** - * Evaluates dynamic properties of entities of given <var>clazz</var> with given <var>ids</var> - * using given <i>Hibernate</i> session. + * Evaluates dynamic properties of entities of given <var>clazz</var> with given <var>ids</var> using given <i>Hibernate</i> session. * * @return list of ids of entities with dynamic properties that have been evaluated */ diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/dynamic_property/calculator/DynamicPropertyAdaptor.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/dynamic_property/calculator/DynamicPropertyAdaptor.java index 04d136d4ca5..d2c0d8262ed 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/dynamic_property/calculator/DynamicPropertyAdaptor.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/dynamic_property/calculator/DynamicPropertyAdaptor.java @@ -24,8 +24,7 @@ import ch.systemsx.cisd.openbis.generic.shared.hotdeploy_plugins.api.IEntityAdap import ch.systemsx.cisd.openbis.generic.shared.hotdeploy_plugins.api.IEntityPropertyAdaptor; /** - * {@link IEntityPropertyAdaptor} for dynamic property with lazy evaluation and cyclic dependencies - * detection. + * {@link IEntityPropertyAdaptor} for dynamic property with lazy evaluation and cyclic dependencies detection. * * @author Piotr Buczek */ diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/dynamic_property/calculator/DynamicPropertyFunctions.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/dynamic_property/calculator/DynamicPropertyFunctions.java index 298cb7a2fb2..2456b03c5cf 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/dynamic_property/calculator/DynamicPropertyFunctions.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/dynamic_property/calculator/DynamicPropertyFunctions.java @@ -28,8 +28,7 @@ import ch.systemsx.cisd.openbis.generic.shared.basic.dto.MaterialIdentifier; public final class DynamicPropertyFunctions { /** - * @return String representation of material identifier for given material code and material - * type code. + * @return String representation of material identifier for given material code and material type code. */ public static String material(String code, String typeCode) { @@ -37,8 +36,7 @@ public final class DynamicPropertyFunctions } /** - * @return code of material with given identifier or null if the identifier is not a valid - * material identifier + * @return code of material with given identifier or null if the identifier is not a valid material identifier */ public static String materialCode(String materialIdentifier) { @@ -48,8 +46,7 @@ public final class DynamicPropertyFunctions } /** - * @return type of material with given identifier or null if the identifier is not a valid - * material identifier + * @return type of material with given identifier or null if the identifier is not a valid material identifier */ public static String materialTypeCode(String materialIdentifier) { diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/dynamic_property/calculator/ISampleAdaptorRelationsQuery.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/dynamic_property/calculator/ISampleAdaptorRelationsQuery.java index 1630b8ccca9..e098f5fc6bc 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/dynamic_property/calculator/ISampleAdaptorRelationsQuery.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/dynamic_property/calculator/ISampleAdaptorRelationsQuery.java @@ -43,7 +43,7 @@ public interface ISampleAdaptorRelationsQuery extends BaseQuery + " sr.relationship_id = rt.id AND sr.sample_id_parent = s.id AND " + " s.saty_id = st.id AND sr.sample_id_child = ?{1} AND " + " rt.code = '" + BasicConstant.PARENT_CHILD_DB_RELATIONSHIP + "' AND st.id = any(?{2})", parameterBindings = - { TypeMapper.class, LongSetMapper.class }, fetchSize = FETCH_SIZE) + { TypeMapper.class, LongSetMapper.class }, fetchSize = FETCH_SIZE) public List<Long> getParentIdsOfTypes(Long childId, LongSet parentTypeIds); @Select(sql = "SELECT sr.sample_id_child FROM sample_relationships sr, " @@ -51,7 +51,7 @@ public interface ISampleAdaptorRelationsQuery extends BaseQuery + " sr.relationship_id = rt.id AND sr.sample_id_child = s.id AND " + " s.saty_id = st.id AND sr.sample_id_parent = ?{1} AND " + " rt.code = '" + BasicConstant.PARENT_CHILD_DB_RELATIONSHIP + "' AND st.id = any(?{2})", parameterBindings = - { TypeMapper.class, LongSetMapper.class }, fetchSize = FETCH_SIZE) + { TypeMapper.class, LongSetMapper.class }, fetchSize = FETCH_SIZE) public List<Long> getChildIdsOfTypes(Long parentId, LongSet childTypeIds); } diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/dynamic_property/calculator/XmlPropertyAdaptor.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/dynamic_property/calculator/XmlPropertyAdaptor.java index 0d308cc207a..fb81cf717b0 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/dynamic_property/calculator/XmlPropertyAdaptor.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/dynamic_property/calculator/XmlPropertyAdaptor.java @@ -21,8 +21,7 @@ import ch.systemsx.cisd.openbis.generic.shared.hotdeploy_plugins.api.IEntityProp import ch.systemsx.cisd.openbis.generic.shared.util.XmlUtils; /** - * {@link IEntityPropertyAdaptor} implementation for xml property with lazy evaluation of rendered - * value using XSLT script. + * {@link IEntityPropertyAdaptor} implementation for xml property with lazy evaluation of rendered value using XSLT script. * * @author Piotr Buczek */ diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/dynamic_property/calculator/api/ISampleAdaptor.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/dynamic_property/calculator/api/ISampleAdaptor.java index f83cc94c5c2..0d1332c1436 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/dynamic_property/calculator/api/ISampleAdaptor.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/dynamic_property/calculator/api/ISampleAdaptor.java @@ -34,8 +34,7 @@ public interface ISampleAdaptor extends IEntityAdaptor public Iterable<ISampleAdaptor> parents(); /** - * Returns parent samples of this sample. Types of the returned parent samples must match the - * specified regular expression. + * Returns parent samples of this sample. Types of the returned parent samples must match the specified regular expression. */ public Iterable<ISampleAdaptor> parentsOfType(String typeCodeRegexp); @@ -45,8 +44,7 @@ public interface ISampleAdaptor extends IEntityAdaptor public Iterable<ISampleAdaptor> children(); /** - * Returns child samples of this sample. Types of the returned child samples must match the - * specified regular expression. + * Returns child samples of this sample. Types of the returned child samples must match the specified regular expression. */ public Iterable<ISampleAdaptor> childrenOfType(String typeCodeRegexp); @@ -61,8 +59,7 @@ public interface ISampleAdaptor extends IEntityAdaptor public Iterable<ISampleAdaptor> contained(); /** - * Returns contained samples of this sample. Types of the returned contained samples must match - * the specified regular expression. + * Returns contained samples of this sample. Types of the returned contained samples must match the specified regular expression. */ public Iterable<ISampleAdaptor> containedOfType(String typeCodeRegexp); @@ -72,8 +69,7 @@ public interface ISampleAdaptor extends IEntityAdaptor public Iterable<IDataAdaptor> dataSets(); /** - * Returns data sets of this sample. Types of the returned data sets must match the specified - * regular expression. + * Returns data sets of this sample. Types of the returned data sets must match the specified regular expression. */ public Iterable<IDataAdaptor> dataSetsOfType(String typeCodeRegexp); diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/entity_validation/AbstractEntityValidator.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/entity_validation/AbstractEntityValidator.java index 26697ef95b4..426f5b98f20 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/entity_validation/AbstractEntityValidator.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/entity_validation/AbstractEntityValidator.java @@ -28,8 +28,7 @@ public abstract class AbstractEntityValidator implements IEntityValidator protected IValidationRequestDelegate<INonAbstractEntityAdapter> validationRequestedDelegate; @Override - public final void init(@SuppressWarnings("hiding") - IValidationRequestDelegate<INonAbstractEntityAdapter> validationRequestedDelegate) + public final void init(@SuppressWarnings("hiding") IValidationRequestDelegate<INonAbstractEntityAdapter> validationRequestedDelegate) { this.validationRequestedDelegate = validationRequestedDelegate; } diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/entity_validation/api/IEntityValidator.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/entity_validation/api/IEntityValidator.java index c0bd826fea0..ac1526b5f5e 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/entity_validation/api/IEntityValidator.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/entity_validation/api/IEntityValidator.java @@ -30,8 +30,7 @@ public interface IEntityValidator /** * Before the validation is triggered, the validator is initialized by calling this method. * - * @param validationRequestedDelegate object responsible for handling requests for entity - * validation + * @param validationRequestedDelegate object responsible for handling requests for entity validation */ public void init( IValidationRequestDelegate<INonAbstractEntityAdapter> validationRequestedDelegate); @@ -40,8 +39,7 @@ public interface IEntityValidator * Main method, that performs actual validation * * @param entity entity that needs to be validated - * @param isNew <code>true</code> if the entity is freshly created, <code>false</code> if the - * entity was only updated. + * @param isNew <code>true</code> if the entity is freshly created, <code>false</code> if the entity was only updated. */ public String validate(IEntityAdaptor entity, boolean isNew); } diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/migration/MigrationStepFrom022To023.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/migration/MigrationStepFrom022To023.java index 26eb0eb15dc..7b909eb5f48 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/migration/MigrationStepFrom022To023.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/migration/MigrationStepFrom022To023.java @@ -27,11 +27,9 @@ import ch.systemsx.cisd.openbis.generic.shared.dto.TableNames; import ch.systemsx.cisd.openbis.generic.shared.util.UuidUtil; /** - * Finishes migration of the database version 22 to version 23 by setting the <i>UUID</i> code of - * the database instance. + * Finishes migration of the database version 22 to version 23 by setting the <i>UUID</i> code of the database instance. * <p> - * Note that, at that time, the <i>UUID</i> column label was <code>GLOBAL_CODE</code> and not - * <code>UUID</code>. + * Note that, at that time, the <i>UUID</i> column label was <code>GLOBAL_CODE</code> and not <code>UUID</code>. * </p> * * @author Tomasz Pylak diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/migration/MigrationStepFrom023To024.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/migration/MigrationStepFrom023To024.java index e75fd08eb01..625895e71b1 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/migration/MigrationStepFrom023To024.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/migration/MigrationStepFrom023To024.java @@ -38,9 +38,8 @@ import ch.systemsx.cisd.openbis.generic.shared.dto.TableNames; /** * A migration step from database version <code>v23</code> to version <code>v24</code>. * <p> - * This migration step does the following: it migrate the dataset locations in the database ( - * <code>Instance_<instance code></code> renamed Instance_<UUID> when <instance - * code> is the original source). + * This migration step does the following: it migrate the dataset locations in the database ( <code>Instance_<instance code></code> renamed + * Instance_<UUID> when <instance code> is the original source). * </p> * * @author Christian Ribeaud diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/migration/MigrationStepFrom025To026.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/migration/MigrationStepFrom025To026.java index 1d0cba3311c..ef298c42d2b 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/migration/MigrationStepFrom025To026.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/migration/MigrationStepFrom025To026.java @@ -40,8 +40,7 @@ import ch.systemsx.cisd.openbis.generic.shared.dto.TableNames; /** * A migration step from database version <code>v25</code> to version <code>v26</code>. * <p> - * Adapts the data set locations in database after OBSERVABLE_TYPE has been renamed to - * DATA_SET_TYPE. + * Adapts the data set locations in database after OBSERVABLE_TYPE has been renamed to DATA_SET_TYPE. * </p> * * @author Izabela Adamczyk diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/migration/MigrationStepFrom046To047.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/migration/MigrationStepFrom046To047.java index 513587e7f67..c7e70032685 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/migration/MigrationStepFrom046To047.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/migration/MigrationStepFrom046To047.java @@ -41,8 +41,8 @@ import ch.systemsx.cisd.openbis.generic.shared.util.DisplaySettingsSerialization /** * A migration step from database version <code>v46</code> to version <code>v47</code>. * <p> - * Sets wildcard search mode for old users apart from system user. After this migration all users - * will have a serialized display settings object in the DB (before it could be null). + * Sets wildcard search mode for old users apart from system user. After this migration all users will have a serialized display settings object in + * the DB (before it could be null). * </p> * * @author Piotr Buczek diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/util/UpdateUtils.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/util/UpdateUtils.java index dba3e3781d3..5a9ee160369 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/util/UpdateUtils.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/util/UpdateUtils.java @@ -32,8 +32,6 @@ import ch.systemsx.cisd.openbis.generic.server.dataaccess.DynamicPropertyEvaluat import ch.systemsx.cisd.openbis.generic.server.dataaccess.db.search.FullTextIndexUpdater; /** - * - * * @author Franz-Josef Elmer */ public class UpdateUtils @@ -45,14 +43,14 @@ public class UpdateUtils FullTextIndexUpdater indexUpdater = (FullTextIndexUpdater) applicationContext.getBean("full-text-index-updater"); DynamicPropertyEvaluationScheduler dynamicPropertyScheduler = (DynamicPropertyEvaluationScheduler) applicationContext.getBean("dynamic-property-scheduler"); - + if (indexUpdater != null) { while (true) { IExtendedBlockingQueue<DynamicPropertyEvaluationOperation> dynamicPropertiesQueue = dynamicPropertyScheduler.getEvaluatorQueue(); int indexingQueueSize = indexUpdater.getQueueSize(); - + try { if (dynamicPropertiesQueue != null && dynamicPropertiesQueue.size() > 0) @@ -76,7 +74,7 @@ public class UpdateUtils } } } - + public static Date getTransactionTimeStamp(SessionFactory sessionFactory) { Session currentSession = sessionFactory.getCurrentSession(); diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/jython/api/v1/IDataSetType.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/jython/api/v1/IDataSetType.java index d66c54d2d05..5b515c656fa 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/jython/api/v1/IDataSetType.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/jython/api/v1/IDataSetType.java @@ -23,8 +23,7 @@ public interface IDataSetType extends IDataSetTypeImmutable, IEntityTypeMutable { /** - * @deprecated use {@link #setDataSetKind(String)} instead Set to <code>true</code> if the type - * is a container type. + * @deprecated use {@link #setDataSetKind(String)} instead Set to <code>true</code> if the type is a container type. */ @Deprecated public void setContainerType(boolean isContainerType); diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/jython/api/v1/IEntityType.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/jython/api/v1/IEntityType.java index 89771146cda..bcd3486e420 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/jython/api/v1/IEntityType.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/jython/api/v1/IEntityType.java @@ -16,7 +16,6 @@ package ch.systemsx.cisd.openbis.generic.server.jython.api.v1; - /** * The superinterface for all entity types (as opposed to property types). * diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/jython/api/v1/IMasterDataRegistrationTransaction.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/jython/api/v1/IMasterDataRegistrationTransaction.java index 3b0900916bb..ecbe663e4ad 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/jython/api/v1/IMasterDataRegistrationTransaction.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/jython/api/v1/IMasterDataRegistrationTransaction.java @@ -19,8 +19,7 @@ package ch.systemsx.cisd.openbis.generic.server.jython.api.v1; import java.util.List; /** - * API for master data registration. Offers methods for creation and retrieval of openBIS types, - * property assignments, vocabularies etc. + * API for master data registration. Offers methods for creation and retrieval of openBIS types, property assignments, vocabularies etc. * * @author Kaloyan Enimanev */ @@ -35,8 +34,7 @@ public interface IMasterDataRegistrationTransaction IExperimentType createNewExperimentType(String code); /** - * Get an experiment type from the openBIS AS. Returns null if the experiment type does not - * exist. + * Get an experiment type from the openBIS AS. Returns null if the experiment type does not exist. * * @return An experiment type or null */ @@ -45,8 +43,8 @@ public interface IMasterDataRegistrationTransaction /** * Gets or creates experiment type from the openBIS AS. * - * @return the already existing type or a freshly created one if it doesn't exist. Setter - * methods on the returned type are ignored if the type already exists. + * @return the already existing type or a freshly created one if it doesn't exist. Setter methods on the returned type are ignored if the type + * already exists. */ IExperimentType getOrCreateNewExperimentType(String code); @@ -72,8 +70,8 @@ public interface IMasterDataRegistrationTransaction /** * Gets or creates sample type from the openBIS AS. * - * @return the already existing type or a freshly created one if it doesn't exist. Setter - * methods on the returned type are ignored if the type already exists. + * @return the already existing type or a freshly created one if it doesn't exist. Setter methods on the returned type are ignored if the type + * already exists. */ ISampleType getOrCreateNewSampleType(String code); @@ -99,8 +97,8 @@ public interface IMasterDataRegistrationTransaction /** * Gets or creates data set type from the openBIS AS. * - * @return the already existing type or a freshly created one if it doesn't exist. Setter - * methods on the returned type are ignored if the type already exists. + * @return the already existing type or a freshly created one if it doesn't exist. Setter methods on the returned type are ignored if the type + * already exists. */ IDataSetType getOrCreateNewDataSetType(String code); @@ -119,8 +117,8 @@ public interface IMasterDataRegistrationTransaction /** * Gets or creates a script from the openBIS AS. * - * @return the already existing script or a freshly created one if it doesn't exist. Setter - * methods on the returned script are ignored if the script already exists. + * @return the already existing script or a freshly created one if it doesn't exist. Setter methods on the returned script are ignored if the + * script already exists. */ IScript getOrCreateNewScript(String code); @@ -146,8 +144,8 @@ public interface IMasterDataRegistrationTransaction /** * Gets or creates material type from the openBIS AS. * - * @return the already existing type or a freshly created one if it doesn't exist. Setter - * methods on the returned type are ignored if the type already exists. + * @return the already existing type or a freshly created one if it doesn't exist. Setter methods on the returned type are ignored if the type + * already exists. */ IMaterialType getOrCreateNewMaterialType(String code); @@ -175,8 +173,8 @@ public interface IMasterDataRegistrationTransaction * Gets or creates property type from the openBIS AS. * * @param dataType the data type of the property in case it has to be created. - * @return the already existing type or a freshly created one if it doesn't exist. Setter - * methods on the returned type are ignored if the type already exists. + * @return the already existing type or a freshly created one if it doesn't exist. Setter methods on the returned type are ignored if the type + * already exists. */ IPropertyType getOrCreateNewPropertyType(String code, DataType dataType); @@ -186,11 +184,10 @@ public interface IMasterDataRegistrationTransaction List<IPropertyTypeImmutable> listPropertyTypes(); /** - * Assigns a property type to an entity type. If the assignment is already established an object - * is returned where all setter method invocations are silently be ignored. + * Assigns a property type to an entity type. If the assignment is already established an object is returned where all setter method invocations + * are silently be ignored. * - * @param entityType One of IExperimentTypeImmutable, ISampleTypeImmutable, - * IDataSetTypeImmutable, or IMaterialTypeImmutable. + * @param entityType One of IExperimentTypeImmutable, ISampleTypeImmutable, IDataSetTypeImmutable, or IMaterialTypeImmutable. * @param propertyType The property type to assign to the entity type. * @return An object representing the assignment. */ @@ -210,8 +207,7 @@ public interface IMasterDataRegistrationTransaction IFileFormatType createNewFileFormatType(String code); /** - * Get a file format type from the openBIS AS. Returns null if the file format type does not - * exist. + * Get a file format type from the openBIS AS. Returns null if the file format type does not exist. * * @return A file format type or null */ @@ -220,8 +216,8 @@ public interface IMasterDataRegistrationTransaction /** * Gets or creates file format type from the openBIS AS. * - * @return the already existing type or a freshly created one if it doesn't exist. Setter - * methods on the returned type are ignored if the type already exists. + * @return the already existing type or a freshly created one if it doesn't exist. Setter methods on the returned type are ignored if the type + * already exists. */ IFileFormatType getOrCreateNewFileFormatType(String code); @@ -247,8 +243,8 @@ public interface IMasterDataRegistrationTransaction /** * Gets or creates vocabulary type from the openBIS AS. * - * @return the already existing type or a freshly created one if it doesn't exist. Setter - * methods on the returned type are ignored if the type already exists. + * @return the already existing type or a freshly created one if it doesn't exist. Setter methods on the returned type are ignored if the type + * already exists. */ IVocabulary getOrCreateNewVocabulary(String code); @@ -258,8 +254,7 @@ public interface IMasterDataRegistrationTransaction List<IVocabularyImmutable> listVocabularies(); /** - * Create a new vocabulary term. The resulting object can be added to a vocabulary via the - * {@link IVocabulary#addTerm(IVocabularyTerm)} method. + * Create a new vocabulary term. The resulting object can be added to a vocabulary via the {@link IVocabulary#addTerm(IVocabularyTerm)} method. * * @param code the vocabulary term's code */ @@ -285,8 +280,7 @@ public interface IMasterDataRegistrationTransaction IExternalDataManagementSystem createNewExternalDataManagementSystem(String code); /** - * Get an external data management system from the openBIS AS. Returns null if the external data - * management system does not exist. + * Get an external data management system from the openBIS AS. Returns null if the external data management system does not exist. * * @return An external data management system or null */ @@ -295,8 +289,8 @@ public interface IMasterDataRegistrationTransaction /** * Gets or creates external data management system from the openBIS AS. * - * @return the already existing system or a freshly created one if it doesn't exist. Setter - * methods on the returned type are ignored if the type already exists. + * @return the already existing system or a freshly created one if it doesn't exist. Setter methods on the returned type are ignored if the type + * already exists. */ IExternalDataManagementSystem getOrCreateNewExternalDataManagementSystem(String code); diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/jython/api/v1/IPropertyAssignment.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/jython/api/v1/IPropertyAssignment.java index eb24f608707..e881d335d10 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/jython/api/v1/IPropertyAssignment.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/jython/api/v1/IPropertyAssignment.java @@ -28,8 +28,8 @@ public interface IPropertyAssignment extends IPropertyAssignmentImmutable void setMandatory(boolean mandatory); /** - * Set the name of the form section. It will appear when editing objects of the specified entity - * in openBIS. Specifying a section name is optional. + * Set the name of the form section. It will appear when editing objects of the specified entity in openBIS. Specifying a section name is + * optional. */ void setSection(String section); @@ -39,8 +39,7 @@ public interface IPropertyAssignment extends IPropertyAssignmentImmutable void setDefaultValue(String defaultValue); /** - * Sets the position where the property will appear in forms. If not specified the property will - * be displayed at the bottom of the form. + * Sets the position where the property will appear in forms. If not specified the property will be displayed at the bottom of the form. */ void setPositionInForms(Long position); diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/jython/api/v1/IPropertyAssignmentImmutable.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/jython/api/v1/IPropertyAssignmentImmutable.java index 08bb02d3c12..468f9401606 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/jython/api/v1/IPropertyAssignmentImmutable.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/jython/api/v1/IPropertyAssignmentImmutable.java @@ -49,8 +49,7 @@ public interface IPropertyAssignmentImmutable String getSection(); /** - * Return the position at which the property will be rendered when editing/registering objects - * of the specified entity type. + * Return the position at which the property will be rendered when editing/registering objects of the specified entity type. */ Long getPositionInForms(); diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/jython/api/v1/IPropertyType.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/jython/api/v1/IPropertyType.java index bfb637124b5..6939b15c884 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/jython/api/v1/IPropertyType.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/jython/api/v1/IPropertyType.java @@ -22,14 +22,12 @@ package ch.systemsx.cisd.openbis.generic.server.jython.api.v1; public interface IPropertyType extends IPropertyTypeImmutable { /** - * Set the description for this property type. This is a mandatory parameter and must not be - * left emtpy when creating new {@link IPropertyType}-s. + * Set the description for this property type. This is a mandatory parameter and must not be left emtpy when creating new {@link IPropertyType}-s. */ void setDescription(String description); /** - * Set the label for this property type. This is a mandatory parameter and must not be left - * emtpy when creating new {@link IPropertyType}-s. + * Set the label for this property type. This is a mandatory parameter and must not be left emtpy when creating new {@link IPropertyType}-s. */ void setLabel(String label); @@ -49,16 +47,14 @@ public interface IPropertyType extends IPropertyTypeImmutable void setXmlSchema(String schema); /** - * Set an XSLT transformation to be applied to properties of XML {@link DataType} before - * rendering in the UI. + * Set an XSLT transformation to be applied to properties of XML {@link DataType} before rendering in the UI. */ void setTransformation(String xsltTransformation); void setManagedInternally(boolean isManagedInternally); /** - * Property of internal names receive a special prefix to avoid naming conflicts with - * user-defined property types. + * Property of internal names receive a special prefix to avoid naming conflicts with user-defined property types. */ void setInternalNamespace(boolean isInternalNamespace); } diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/jython/api/v1/IPropertyTypeImmutable.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/jython/api/v1/IPropertyTypeImmutable.java index ba733829f29..5fe5d099f71 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/jython/api/v1/IPropertyTypeImmutable.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/jython/api/v1/IPropertyTypeImmutable.java @@ -44,14 +44,14 @@ public interface IPropertyTypeImmutable extends IAbstractType IVocabularyImmutable getVocabulary(); /** - * Return an XSD used to verify the validity of properties with XML {@link DataType}. Return - * <code>null</code> if the DataType is not XML or there is no schema set. + * Return an XSD used to verify the validity of properties with XML {@link DataType}. Return <code>null</code> if the DataType is not XML or there + * is no schema set. */ String getXmlSchema(); /** - * Return an XSLT transformation applied to properties with XML {@link DataType}. Return - * <code>null</code> if the DataType is not XML or there is no transformation set. + * Return an XSLT transformation applied to properties with XML {@link DataType}. Return <code>null</code> if the DataType is not XML or there is + * no transformation set. */ String getTransformation(); diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/jython/api/v1/IVocabulary.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/jython/api/v1/IVocabulary.java index d1341032895..09a9b0eb2c1 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/jython/api/v1/IVocabulary.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/jython/api/v1/IVocabulary.java @@ -40,8 +40,7 @@ public interface IVocabulary extends IVocabularyImmutable void setChosenFromList(boolean isChosenFromList); /** - * Sets a URL template (e.g a search query) that can display additional information for the - * concrete vocabulary terms. + * Sets a URL template (e.g a search query) that can display additional information for the concrete vocabulary terms. */ void setUrlTemplate(String urlTemplate); diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/jython/api/v1/IVocabularyImmutable.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/jython/api/v1/IVocabularyImmutable.java index 619183a337d..d72f1951e85 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/jython/api/v1/IVocabularyImmutable.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/jython/api/v1/IVocabularyImmutable.java @@ -49,8 +49,7 @@ public interface IVocabularyImmutable boolean isChosenFromList(); /** - * Returns a URL template (e.g a search query) that can display additional information for the - * concrete vocabulary terms. Can return null. + * Returns a URL template (e.g a search query) that can display additional information for the concrete vocabulary terms. Can return null. */ String getUrlTemplate(); diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/jython/api/v1/impl/ExternalDataManagementSystemWrapper.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/jython/api/v1/impl/ExternalDataManagementSystemWrapper.java index e9137d86883..27f1d98f75b 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/jython/api/v1/impl/ExternalDataManagementSystemWrapper.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/jython/api/v1/impl/ExternalDataManagementSystemWrapper.java @@ -19,8 +19,7 @@ package ch.systemsx.cisd.openbis.generic.server.jython.api.v1.impl; import ch.systemsx.cisd.openbis.generic.server.jython.api.v1.IExternalDataManagementSystem; /** - * Wrapper of {@link ExternalDataManagementSystemImmutable} as {@link IExternalDataManagementSystem} - * where setters do nothing. + * Wrapper of {@link ExternalDataManagementSystemImmutable} as {@link IExternalDataManagementSystem} where setters do nothing. * * @author Pawel Glyzewski */ diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/jython/api/v1/impl/MasterDataRegistrationScriptRunnerStandalone.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/jython/api/v1/impl/MasterDataRegistrationScriptRunnerStandalone.java index 2a573e80de7..ab7cc01004c 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/jython/api/v1/impl/MasterDataRegistrationScriptRunnerStandalone.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/jython/api/v1/impl/MasterDataRegistrationScriptRunnerStandalone.java @@ -28,8 +28,7 @@ import ch.systemsx.cisd.common.logging.LogLevel; import ch.systemsx.cisd.openbis.generic.shared.cli.OpenBisConsoleClientArguments; /** - * A standalone command line tool allowing the execution of Jython scripts to initialize the master - * data on an openBIS AS. + * A standalone command line tool allowing the execution of Jython scripts to initialize the master data on an openBIS AS. * * @author Kaloyan Enimanev */ diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/jython/api/v1/impl/PropertyAssignmentWrapper.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/jython/api/v1/impl/PropertyAssignmentWrapper.java index d2589dd5dbd..522e43ddca9 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/jython/api/v1/impl/PropertyAssignmentWrapper.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/jython/api/v1/impl/PropertyAssignmentWrapper.java @@ -19,8 +19,7 @@ package ch.systemsx.cisd.openbis.generic.server.jython.api.v1.impl; import ch.systemsx.cisd.openbis.generic.server.jython.api.v1.IPropertyAssignment; /** - * Wrapper of {@link PropertyAssignmentImmutable} as {@link IPropertyAssignment} where setters do - * nothing. + * Wrapper of {@link PropertyAssignmentImmutable} as {@link IPropertyAssignment} where setters do nothing. * * @author Franz-Josef Elmer */ diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/jython/api/v1/impl/Script.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/jython/api/v1/impl/Script.java index e248896cba1..2604ae60d18 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/jython/api/v1/impl/Script.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/jython/api/v1/impl/Script.java @@ -63,7 +63,7 @@ public class Script extends ScriptImmutable implements IScript } else { script.setEntityKind(new EntityKind[] - { EntityKind.valueOf(entityKind) }); + { EntityKind.valueOf(entityKind) }); } } } diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/plugin/AbstractPluginRegistry.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/plugin/AbstractPluginRegistry.java index 84fdd3cf188..8515ff75a89 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/plugin/AbstractPluginRegistry.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/plugin/AbstractPluginRegistry.java @@ -113,8 +113,7 @@ abstract class AbstractPluginRegistry<P extends IServerPlugin> implements BeanFa /** * Returns the appropriate plug-in for the specified entity kind and entity type. * - * @return never <code>null</code> but could return the <i>generic</i> implementation if none - * has been found. + * @return never <code>null</code> but could return the <i>generic</i> implementation if none has been found. */ public final synchronized P getPlugin(EntityKind entityKind, EntityTypePE entityType) { diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/plugin/DataSetServerPluginRegistry.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/plugin/DataSetServerPluginRegistry.java index ef4fd18f7a1..f86a5968fcf 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/plugin/DataSetServerPluginRegistry.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/plugin/DataSetServerPluginRegistry.java @@ -20,7 +20,6 @@ import org.springframework.stereotype.Component; import ch.systemsx.cisd.openbis.generic.shared.ResourceNames; - /** * A registry for data set server plug-ins. */ diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/plugin/IDataSetServerPlugin.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/plugin/IDataSetServerPlugin.java index 8c588cdd9cc..dc11dffdc3b 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/plugin/IDataSetServerPlugin.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/plugin/IDataSetServerPlugin.java @@ -19,7 +19,7 @@ package ch.systemsx.cisd.openbis.generic.server.plugin; /** * Plug-in interface for data sets. * - * @author Franz-Josef Elmer + * @author Franz-Josef Elmer */ public interface IDataSetServerPlugin extends IServerPlugin { diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/plugin/IDataSetTypeSlaveServerPlugin.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/plugin/IDataSetTypeSlaveServerPlugin.java index 37a6ba7a630..42017e86dd2 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/plugin/IDataSetTypeSlaveServerPlugin.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/plugin/IDataSetTypeSlaveServerPlugin.java @@ -26,8 +26,8 @@ import ch.systemsx.cisd.openbis.generic.shared.dto.Session; /** * The slave server plug-in for a Data set type * <p> - * The implementation will give access to {@link DAOFactory} and appropriate business object - * factory. Each method specified here must start with {@link Session} parameter. + * The implementation will give access to {@link DAOFactory} and appropriate business object factory. Each method specified here must start with + * {@link Session} parameter. * </p> * * @author Christian Ribeaud @@ -38,8 +38,7 @@ public interface IDataSetTypeSlaveServerPlugin /** * Permanently deletes the specified data sets for the specified reason. * - * @deprecated this is legacy code and should be removed when we remove the option of disabled - * trash + * @deprecated this is legacy code and should be removed when we remove the option of disabled trash */ @Deprecated public void permanentlyDeleteDataSets(Session session, List<DataPE> dataSets, String reason, diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/plugin/ISampleTypeSlaveServerPlugin.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/plugin/ISampleTypeSlaveServerPlugin.java index 5f6f870cc51..e0aa031fa29 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/plugin/ISampleTypeSlaveServerPlugin.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/plugin/ISampleTypeSlaveServerPlugin.java @@ -30,8 +30,8 @@ import ch.systemsx.cisd.openbis.generic.shared.dto.Session; /** * The slave server plug-in for a <i>Sample Type</i>. * <p> - * The implementation will give access to {@link DAOFactory} and appropriate business object - * factory. Each method specified here must start with {@link Session} parameter. + * The implementation will give access to {@link DAOFactory} and appropriate business object factory. Each method specified here must start with + * {@link Session} parameter. * </p> * * @author Christian Ribeaud diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/plugin/IServerPlugin.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/plugin/IServerPlugin.java index 336b9f10936..5a553de0e9f 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/plugin/IServerPlugin.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/plugin/IServerPlugin.java @@ -21,15 +21,12 @@ import java.util.Set; import ch.systemsx.cisd.openbis.generic.shared.basic.dto.EntityKind; /** - * - * - * @author Franz-Josef Elmer + * @author Franz-Josef Elmer */ public interface IServerPlugin { /** - * Returns all the entity type codes for specified entity kind which are supported by this - * server plugin. + * Returns all the entity type codes for specified entity kind which are supported by this server plugin. */ public Set<String> getEntityTypeCodes(final EntityKind entityKind); diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/plugin/IServerPluginWithWildcards.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/plugin/IServerPluginWithWildcards.java index 091e3f51e80..017d7969262 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/plugin/IServerPluginWithWildcards.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/plugin/IServerPluginWithWildcards.java @@ -21,16 +21,14 @@ import java.util.List; import ch.systemsx.cisd.openbis.generic.shared.basic.dto.EntityKind; /** - * An extension of the @{link IServerPlugin} that supports using regular expression wildcards in the - * codes. + * An extension of the @{link IServerPlugin} that supports using regular expression wildcards in the codes. * * @author Chandrasekhar Ramakrishnan */ public interface IServerPluginWithWildcards extends IServerPlugin { /** - * Returns all the entity type codes for given <var>entityKind</var> supported by this - * implementation. + * Returns all the entity type codes for given <var>entityKind</var> supported by this implementation. */ public List<String> getOrderedEntityTypeCodes(final EntityKind entityKind); } diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/plugin/SampleServerPluginRegistry.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/plugin/SampleServerPluginRegistry.java index 44c68f4b21c..bbfab1bb9aa 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/plugin/SampleServerPluginRegistry.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/plugin/SampleServerPluginRegistry.java @@ -20,14 +20,13 @@ import org.springframework.stereotype.Component; import ch.systemsx.cisd.openbis.generic.shared.ResourceNames; - /** * A registry for sample server plug-ins. */ @Component(ResourceNames.SAMPLE_PLUGIN_REGISTRY) public final class SampleServerPluginRegistry extends AbstractPluginRegistry<ISampleServerPlugin> { - + @Override protected String getBeanNameOfGenericPlugin() { diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/plugin/WildcardSupportingPluginMap.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/plugin/WildcardSupportingPluginMap.java index 8c2808f25da..6dd92412736 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/plugin/WildcardSupportingPluginMap.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/plugin/WildcardSupportingPluginMap.java @@ -20,8 +20,7 @@ import ch.systemsx.cisd.openbis.generic.shared.basic.WildcardSupportingMap; import ch.systemsx.cisd.openbis.generic.shared.basic.dto.EntityKindAndTypeCode; /** - * Utility class that manages mappings from entity types/codes (possibly including wildcards) to - * IServerPlugin objects. + * Utility class that manages mappings from entity types/codes (possibly including wildcards) to IServerPlugin objects. * * @author Chandrasekhar Ramakrishnan */ diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/task/BatchSampleRegistrationTempCodeUpdaterTask.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/task/BatchSampleRegistrationTempCodeUpdaterTask.java index 3e5b3c5af60..0e9bccdff5d 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/task/BatchSampleRegistrationTempCodeUpdaterTask.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/task/BatchSampleRegistrationTempCodeUpdaterTask.java @@ -39,16 +39,16 @@ public class BatchSampleRegistrationTempCodeUpdaterTask implements IMaintenanceT { private static final Logger operationLog = LogFactory.getLogger(LogCategory.OPERATION, BatchSampleRegistrationTempCodeUpdaterTask.class); - + private BatchSampleRegistrationTempCodeUpdaterBean bean; @Override public void setUp(String pluginName, Properties properties) { } - // TODO FJE: Do the update in single queue which is also fed by the - // GenericClientService.updateTemporaryCodes() + // TODO FJE: Do the update in single queue which is also fed by the + // GenericClientService.updateTemporaryCodes() // this bean is programmatically created so that we can use spring managed transactions // in this maintenance task. Otherwise QueryTool needs to set the datasource/connection @@ -143,7 +143,7 @@ public class BatchSampleRegistrationTempCodeUpdaterTask implements IMaintenanceT sampleDAO.createOrUpdateSamples(samplePEs, personPE, true); } } - + @Override public void execute() { diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/task/DataSetRegistrationSummaryTask.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/task/DataSetRegistrationSummaryTask.java index dd656cbec21..5ebb267eb67 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/task/DataSetRegistrationSummaryTask.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/task/DataSetRegistrationSummaryTask.java @@ -57,13 +57,11 @@ import ch.systemsx.cisd.openbis.generic.shared.dto.SessionContextDTO; /** * Maintenance task send e-mails with reports on recently registered data sets. * <p> - * The maintenance task may be run in one of two modes, the normal mode is to report on data sets - * registered in the period specified by the days-of-month or days-of-week. The period goes from the - * current day to the last day the maintenance task was run. + * The maintenance task may be run in one of two modes, the normal mode is to report on data sets registered in the period specified by the + * days-of-month or days-of-week. The period goes from the current day to the last day the maintenance task was run. * <p> - * Sometimes, however, for the first run, the user may want to explicitly specify the date range for - * the maintenance task. This can be done, but the maintenance task should then only be run once, - * because it will always report on the specified date range. + * Sometimes, however, for the first run, the user may want to explicitly specify the date range for the maintenance task. This can be done, but the + * maintenance task should then only be run once, because it will always report on the specified date range. * * @author Franz-Josef Elmer */ @@ -297,8 +295,7 @@ public class DataSetRegistrationSummaryTask implements IMaintenanceTask } /** - * @return True if the data set type should <b>not</b> be included in the report; return false - * if it should be included in the report. + * @return True if the data set type should <b>not</b> be included in the report; return false if it should be included in the report. */ private boolean excludeDataSetType(DataSetType dataSetType) { diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/task/MaterialExternalDBSyncTask.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/task/MaterialExternalDBSyncTask.java index 29e7bc45126..d36d852718c 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/task/MaterialExternalDBSyncTask.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/task/MaterialExternalDBSyncTask.java @@ -672,8 +672,8 @@ public class MaterialExternalDBSyncTask implements IMaintenanceTask { String sql = tryToReadTimestamp() == null ? insertTimestampSql : updateTimestampSql; jdbcTemplate.update(sql, new Object[] - { newTimestamp }, new int[] - { Types.TIMESTAMP }); + { newTimestamp }, new int[] + { Types.TIMESTAMP }); } @Private diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/task/RevokeUserAccessMaintenanceTask.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/task/RevokeUserAccessMaintenanceTask.java index 2386a8b77c8..f6d839aa173 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/task/RevokeUserAccessMaintenanceTask.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/task/RevokeUserAccessMaintenanceTask.java @@ -46,123 +46,130 @@ import ch.systemsx.cisd.openbis.generic.shared.dto.SessionContextDTO; * * @author Juan Fuentes */ -public class RevokeUserAccessMaintenanceTask implements IMaintenanceTask { - private static final Logger operationLog = LogFactory.getLogger(LogCategory.OPERATION, RevokeUserAccessMaintenanceTask.class); - private static final String AUTH_SERVICE_BEAN = "authentication-service"; - private static final IAuthenticationService authService; - - static { - IAuthenticationService authServiceAux = (IAuthenticationService) CommonServiceProvider.tryToGetBean(AUTH_SERVICE_BEAN); - - if (authServiceAux instanceof StackedAuthenticationService && ((StackedAuthenticationService) authServiceAux).allServicesSupportListingByUserId()) - { - authService = authServiceAux; - } else if(authServiceAux.supportsListingByUserId()) - { - authService = authServiceAux; - } - else - { - authService = null; - } - } - - @Override - public void setUp(String pluginName, Properties properties) { - operationLog.info("Task " + pluginName + " initialized."); - } - - @Override - public void execute() - { - operationLog.info("execution started"); - //0. Initial Check - if(authService == null) - { - operationLog.info("This plugin doesn't work with authentication services that don't support listing by user idt."); - return; - } - // 1. Grab all users, user roles and user authorization groups - IPersonDAO personDAO = CommonServiceProvider.getDAOFactory().getPersonDAO(); - IRoleAssignmentDAO rolesDAO = CommonServiceProvider.getDAOFactory().getRoleAssignmentDAO(); - - // Used to manage the authorization groups since the IPersonDAO throw a session exception when accessing this information. - ICommonServerForInternalUse server = CommonServiceProvider.getCommonServer(); - SessionContextDTO contextOrNull = server.tryToAuthenticateAsSystem(); - - List<PersonPE> people = personDAO.listActivePersons(); - - // 2. Users to Revoke - List<PersonPE> peopleToRevoke = new ArrayList<PersonPE>(); - - // 3. Check if the users exists on LDAP currently - personCheck: - for (PersonPE person : people) - { - if (false == person.isSystemUser() && person.isActive() && false == isUserValid(person.getUserId())) - { - List<RoleAssignmentPE> roles = rolesDAO.listRoleAssignmentsByPerson(person); - for (RoleAssignmentPE role : roles) - { - if (role.getRole().name().equals("ETL_SERVER")) - { - continue personCheck; - } - } - peopleToRevoke.add(person); - } - } - - // 4. If is not found on the authentication service, revoke access - for (PersonPE person : peopleToRevoke) - { - String userIdToRevoke = person.getUserId(); - operationLog.info("person " + userIdToRevoke + " is going to be revoked."); - - // Delete person roles - for (RoleAssignmentPE role : rolesDAO.listRoleAssignmentsByPerson(person)) - { - rolesDAO.delete(role); - } - - // Delete person from groups - List<AuthorizationGroup> groups = server.listAuthorizationGroups(contextOrNull.getSessionToken()); - - for (AuthorizationGroup group : groups) - { - List<Person> peopleInGroup = server.listPersonInAuthorizationGroup(contextOrNull.getSessionToken(), new TechId(group.getId())); - for (Person personInGroup : peopleInGroup) - { - if (personInGroup.getUserId().equals(userIdToRevoke)) - { - List<String> toRemoveFromGroup = new ArrayList<String>(); - toRemoveFromGroup.add(person.getUserId()); - server.removePersonsFromAuthorizationGroup(contextOrNull.getSessionToken(), new TechId(group.getId()), toRemoveFromGroup); - } - } - } - - // Change userId and disable - person.setUserId(person.getUserId() + "-" + getTimeStamp()); - person.setActive(false); - personDAO.updatePerson(person); - - operationLog.info("person " + userIdToRevoke + " has been revoked."); - } - - operationLog.info("task executed"); - } - - /* - * We can only delete the users if, the Principals are listable and they are not available. - */ - private boolean isUserValid(String userId) { - return authService.supportsListingByUserId() && false == authService.listPrincipalsByUserId(userId).isEmpty(); - } - - private String getTimeStamp() { - DateFormat dateFormat = new SimpleDateFormat("yyyy.MM.dd"); - return dateFormat.format(new Date()); - } +public class RevokeUserAccessMaintenanceTask implements IMaintenanceTask +{ + private static final Logger operationLog = LogFactory.getLogger(LogCategory.OPERATION, RevokeUserAccessMaintenanceTask.class); + + private static final String AUTH_SERVICE_BEAN = "authentication-service"; + + private static final IAuthenticationService authService; + + static + { + IAuthenticationService authServiceAux = (IAuthenticationService) CommonServiceProvider.tryToGetBean(AUTH_SERVICE_BEAN); + + if (authServiceAux instanceof StackedAuthenticationService + && ((StackedAuthenticationService) authServiceAux).allServicesSupportListingByUserId()) + { + authService = authServiceAux; + } else if (authServiceAux.supportsListingByUserId()) + { + authService = authServiceAux; + } + else + { + authService = null; + } + } + + @Override + public void setUp(String pluginName, Properties properties) + { + operationLog.info("Task " + pluginName + " initialized."); + } + + @Override + public void execute() + { + operationLog.info("execution started"); + // 0. Initial Check + if (authService == null) + { + operationLog.info("This plugin doesn't work with authentication services that don't support listing by user idt."); + return; + } + // 1. Grab all users, user roles and user authorization groups + IPersonDAO personDAO = CommonServiceProvider.getDAOFactory().getPersonDAO(); + IRoleAssignmentDAO rolesDAO = CommonServiceProvider.getDAOFactory().getRoleAssignmentDAO(); + + // Used to manage the authorization groups since the IPersonDAO throw a session exception when accessing this information. + ICommonServerForInternalUse server = CommonServiceProvider.getCommonServer(); + SessionContextDTO contextOrNull = server.tryToAuthenticateAsSystem(); + + List<PersonPE> people = personDAO.listActivePersons(); + + // 2. Users to Revoke + List<PersonPE> peopleToRevoke = new ArrayList<PersonPE>(); + + // 3. Check if the users exists on LDAP currently + personCheck: for (PersonPE person : people) + { + if (false == person.isSystemUser() && person.isActive() && false == isUserValid(person.getUserId())) + { + List<RoleAssignmentPE> roles = rolesDAO.listRoleAssignmentsByPerson(person); + for (RoleAssignmentPE role : roles) + { + if (role.getRole().name().equals("ETL_SERVER")) + { + continue personCheck; + } + } + peopleToRevoke.add(person); + } + } + + // 4. If is not found on the authentication service, revoke access + for (PersonPE person : peopleToRevoke) + { + String userIdToRevoke = person.getUserId(); + operationLog.info("person " + userIdToRevoke + " is going to be revoked."); + + // Delete person roles + for (RoleAssignmentPE role : rolesDAO.listRoleAssignmentsByPerson(person)) + { + rolesDAO.delete(role); + } + + // Delete person from groups + List<AuthorizationGroup> groups = server.listAuthorizationGroups(contextOrNull.getSessionToken()); + + for (AuthorizationGroup group : groups) + { + List<Person> peopleInGroup = server.listPersonInAuthorizationGroup(contextOrNull.getSessionToken(), new TechId(group.getId())); + for (Person personInGroup : peopleInGroup) + { + if (personInGroup.getUserId().equals(userIdToRevoke)) + { + List<String> toRemoveFromGroup = new ArrayList<String>(); + toRemoveFromGroup.add(person.getUserId()); + server.removePersonsFromAuthorizationGroup(contextOrNull.getSessionToken(), new TechId(group.getId()), toRemoveFromGroup); + } + } + } + + // Change userId and disable + person.setUserId(person.getUserId() + "-" + getTimeStamp()); + person.setActive(false); + personDAO.updatePerson(person); + + operationLog.info("person " + userIdToRevoke + " has been revoked."); + } + + operationLog.info("task executed"); + } + + /* + * We can only delete the users if, the Principals are listable and they are not available. + */ + private boolean isUserValid(String userId) + { + return authService.supportsListingByUserId() && false == authService.listPrincipalsByUserId(userId).isEmpty(); + } + + private String getTimeStamp() + { + DateFormat dateFormat = new SimpleDateFormat("yyyy.MM.dd"); + return dateFormat.format(new Date()); + } } diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/util/LifeCycleListener.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/util/LifeCycleListener.java index 749f47e28a6..6a1ab8115cd 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/util/LifeCycleListener.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/util/LifeCycleListener.java @@ -19,8 +19,7 @@ package ch.systemsx.cisd.openbis.generic.server.util; import org.eclipse.jetty.util.component.LifeCycle; /** - * Stops a component (e.g. Web Server) if it goes into state "Failure". Prints messages - * on console in case of success and failure. + * Stops a component (e.g. Web Server) if it goes into state "Failure". Prints messages on console in case of success and failure. * * @author Franz-Josef Elmer */ diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/util/MethodInvocationUtils.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/util/MethodInvocationUtils.java index b21c54b3e7f..19542c1d692 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/util/MethodInvocationUtils.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/util/MethodInvocationUtils.java @@ -43,12 +43,10 @@ public class MethodInvocationUtils } /** - * Returns either the method of the specified {@link MethodInvocation} object or the method of - * the target object. The later is returned if <code>methodInvocation.getMethod()</code> has - * none the specified annotations and the target object class isn't a synthetic proxy class. + * Returns either the method of the specified {@link MethodInvocation} object or the method of the target object. The later is returned if + * <code>methodInvocation.getMethod()</code> has none the specified annotations and the target object class isn't a synthetic proxy class. * <p> - * This function should be used if it isn't known whether the interface of a proxy or the real - * target has the annotation. + * This function should be used if it isn't known whether the interface of a proxy or the real target has the annotation. */ public static Method getMethod(final MethodInvocation methodInvocation, List<Class<? extends Annotation>> annotationClasses) throws NoSuchMethodException diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/AbstractServerLogger.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/AbstractServerLogger.java index 3a8464b2711..b37bc9ba85a 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/AbstractServerLogger.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/AbstractServerLogger.java @@ -198,7 +198,7 @@ public abstract class AbstractServerLogger implements IServer if (parameter instanceof Collection) { unquotedParameter = CollectionUtils.abbreviate((Collection<?>) unquotedParameter, 20); - } + } parameters[i] = "'" + unquotedParameter + "'"; } } diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/DatabaseCreateOrDeleteModification.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/DatabaseCreateOrDeleteModification.java index a449dbab6f8..98815ed8172 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/DatabaseCreateOrDeleteModification.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/DatabaseCreateOrDeleteModification.java @@ -26,8 +26,8 @@ import ch.systemsx.cisd.openbis.generic.shared.basic.dto.DatabaseModificationKin import ch.systemsx.cisd.openbis.generic.shared.basic.dto.LastModificationState; /** - * Annotation used to mark methods which create or delete specified database objects. It can be used - * by a (GUI) client to trigger view updates. For more details see {@link LastModificationState}. + * Annotation used to mark methods which create or delete specified database objects. It can be used by a (GUI) client to trigger view updates. For + * more details see {@link LastModificationState}. * * @author Tomasz Pylak */ diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/DatabaseUpdateModification.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/DatabaseUpdateModification.java index acdc68fbdaa..271759554fb 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/DatabaseUpdateModification.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/DatabaseUpdateModification.java @@ -26,8 +26,8 @@ import ch.systemsx.cisd.openbis.generic.shared.basic.dto.DatabaseModificationKin import ch.systemsx.cisd.openbis.generic.shared.basic.dto.LastModificationState; /** - * Annotation used to mark methods which update specified database objects. It can be used by a - * (GUI) client to trigger view updates. For more details see {@link LastModificationState}. + * Annotation used to mark methods which update specified database objects. It can be used by a (GUI) client to trigger view updates. For more details + * see {@link LastModificationState}. * * @author Tomasz Pylak */ diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/ICommonServer.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/ICommonServer.java index d391dc59d45..ed4a20cf23d 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/ICommonServer.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/ICommonServer.java @@ -663,7 +663,7 @@ public interface ICommonServer extends IServer * Searches on a search domain. The result is sorted by score in descending order. */ @Transactional(readOnly = true) - public List<SearchDomainSearchResultWithFullEntity> searchOnSearchDomain(String sessionToken, + public List<SearchDomainSearchResultWithFullEntity> searchOnSearchDomain(String sessionToken, String preferredSearchDomainOrNull, String searchString, Map<String, String> optionalParametersOrNull); /** @@ -1600,7 +1600,7 @@ public interface ICommonServer extends IServer */ @Transactional(readOnly = true) public List<String> listPredeployedPlugins(String sessionToken, ScriptType scriptType); - + /** * Gets text for front page if the AS is disabled, null otherwise. */ diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/IDataStoreService.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/IDataStoreService.java index fc42bc011b2..0f8aa36a024 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/IDataStoreService.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/IDataStoreService.java @@ -174,8 +174,8 @@ public interface IDataStoreService public void cleanupSession(String userSessionToken); /** - * Searches for the specified sequence snippet. If no preferred search domain is specified the first available one will be used. If the - * preferred search domain doesn't exist or isn't available also the first one will be used. + * Searches for the specified sequence snippet. If no preferred search domain is specified the first available one will be used. If the preferred + * search domain doesn't exist or isn't available also the first one will be used. * * @param preferredSearchDomainOrNull The key of the preferred search domain or <code>null</code>. * @param sequenceSnippet Snippet of nucleotid or aminoacid sequence. diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/IRemoteHostValidator.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/IRemoteHostValidator.java index c6a007b6f04..fbe6e4b252a 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/IRemoteHostValidator.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/IRemoteHostValidator.java @@ -26,5 +26,5 @@ public interface IRemoteHostValidator /** * Returns <code>true</code> if the specified remote host is allowed. */ - public boolean isValidRemoteHost(String remoteHost); + public boolean isValidRemoteHost(String remoteHost); } diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/IServiceForDataStoreServer.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/IServiceForDataStoreServer.java index e4b4e6a1b49..3b244034282 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/IServiceForDataStoreServer.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/IServiceForDataStoreServer.java @@ -521,7 +521,7 @@ public interface IServiceForDataStoreServer extends IServer, ISessionProvider */ @Transactional(readOnly = true) public boolean isDataSetOnTrashCanOrDeleted(String sessionToken, String dataSetCode); - + /** * Updates share id and size of specified data set. */ diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/ISessionProvider.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/ISessionProvider.java index c38e9a0ed13..382067dbae6 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/ISessionProvider.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/ISessionProvider.java @@ -22,7 +22,7 @@ import ch.systemsx.cisd.openbis.generic.shared.dto.IAuthSession; /** * Provider of {@link IAuthSession}. * - * @author Franz-Josef Elmer + * @author Franz-Josef Elmer */ public interface ISessionProvider { diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/ResourceNames.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/ResourceNames.java index 0b7d5e1967e..03492b31207 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/ResourceNames.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/ResourceNames.java @@ -19,9 +19,8 @@ package ch.systemsx.cisd.openbis.generic.shared; /** * Resource name used in <i>generic</i>. * <p> - * Be aware about the uniqueness of the bean names loaded by <i>Spring</i>. Names defined here - * should not conflict with already existing bean names. Look for other <code>ResourceNames</code> - * classes. + * Be aware about the uniqueness of the bean names loaded by <i>Spring</i>. Names defined here should not conflict with already existing bean names. + * Look for other <code>ResourceNames</code> classes. * </p> * * @author Christian Ribeaud diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/api/v1/Translator.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/api/v1/Translator.java index 266e51e07a2..ddec8c194a2 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/api/v1/Translator.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/api/v1/Translator.java @@ -535,7 +535,8 @@ public class Translator } initializer.setStorageConfirmed(externalDatum.isStorageConfirmation()); initializer.setStub(externalDatum.isStub()); - if(externalDatum.isContainer() == false) { + if (externalDatum.isContainer() == false) + { initializer.setPostRegistered(externalDatum.isPostRegistered()); } diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/CodeConverter.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/CodeConverter.java index a09e06214ef..a0f04275425 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/CodeConverter.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/CodeConverter.java @@ -35,9 +35,8 @@ public final class CodeConverter /** * Converts a code from database form to business layer form. * <p> - * If <var>internalNamespace</var> is <code>true</code>, the prefix '$' will be used, because - * internal properties will be represented as 'NAME' in the database and as $NAME in the - * business layer. + * If <var>internalNamespace</var> is <code>true</code>, the prefix '$' will be used, because internal properties will be represented as 'NAME' in + * the database and as $NAME in the business layer. * * @return The code appropriate for the business layer. */ @@ -56,8 +55,8 @@ public final class CodeConverter /** * Converts a property type code from business layer form to database form. * <p> - * The code will be translated to upper case. Internal properties will be represented as 'NAME' - * in the database and as $NAME in the business layer. + * The code will be translated to upper case. Internal properties will be represented as 'NAME' in the database and as $NAME in the business + * layer. * * @return The code appropriate for the database. */ @@ -78,8 +77,7 @@ public final class CodeConverter } /** - * Returns <code>true</code>, if the <var>codeFromBusinessLayerOrNull</var> represents a - * internal property code. + * Returns <code>true</code>, if the <var>codeFromBusinessLayerOrNull</var> represents a internal property code. */ public static boolean isInternalNamespace(final String codeFromBusinessLayerOrNull) { diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/CodeNormalizer.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/CodeNormalizer.java index c8823dda016..f85979a7d0f 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/CodeNormalizer.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/CodeNormalizer.java @@ -29,8 +29,8 @@ public class CodeNormalizer } /** - * Normalizes the specified code. That is lower-case characters are turned to upper case and any - * symbol which isn't from A-Z, 0-9 or '-' is replaced by an underscore character. + * Normalizes the specified code. That is lower-case characters are turned to upper case and any symbol which isn't from A-Z, 0-9 or '-' is + * replaced by an underscore character. */ public static String normalize(String code) { diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/DataSetUploadInfo.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/DataSetUploadInfo.java index 935c19a90e4..66659a214e6 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/DataSetUploadInfo.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/DataSetUploadInfo.java @@ -101,7 +101,6 @@ public class DataSetUploadInfo { this.parents = parents; } - @Override public String toString() @@ -124,7 +123,6 @@ public class DataSetUploadInfo return builder.toString(); } - public static class DataSetUploadInfoHelper { diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/EntityVisitComparatorByTimeStamp.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/EntityVisitComparatorByTimeStamp.java index dc60c0a532f..ff5d5b6d45c 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/EntityVisitComparatorByTimeStamp.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/EntityVisitComparatorByTimeStamp.java @@ -5,7 +5,7 @@ import java.util.Comparator; import ch.systemsx.cisd.openbis.generic.shared.basic.dto.EntityVisit; /** - * Comparator between {@link EntityVisit} instances. Newer visit comes before older visit. + * Comparator between {@link EntityVisit} instances. Newer visit comes before older visit. * * @author Franz-Josef Elmer */ diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/ExpressionUtil.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/ExpressionUtil.java index f59e4c72992..5e829809d8c 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/ExpressionUtil.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/ExpressionUtil.java @@ -27,8 +27,9 @@ import java.util.List; public class ExpressionUtil { public static final String START = "${"; + public static final String END = "}"; - + private static final int START_LENGTH = START.length(); /** @@ -72,7 +73,7 @@ public class ExpressionUtil } return result; } - + private ExpressionUtil() { } diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/GenericSharedConstants.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/GenericSharedConstants.java index d3eba6e3abe..e7c85654cef 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/GenericSharedConstants.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/GenericSharedConstants.java @@ -37,7 +37,7 @@ public final class GenericSharedConstants /** Part of the URL of the DSS service. */ public static final String DATA_STORE_SERVER_SERVICE_NAME = DATA_STORE_SERVER_WEB_APPLICATION_NAME + "/dss"; - + public static final String SESSION_ID_PARAMETER = "sessionID"; } diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/GridRowModel.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/GridRowModel.java index c962f2fbeab..7a97e35bc8b 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/GridRowModel.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/GridRowModel.java @@ -23,8 +23,7 @@ import java.util.Map; import com.google.gwt.user.client.rpc.IsSerializable; /** - * Stores the original object which will be a basis to calculate a grid row together with calculated - * all custom columns values. + * Stores the original object which will be a basis to calculate a grid row together with calculated all custom columns values. * * @author Tomasz Pylak */ diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/IColumnDefinition.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/IColumnDefinition.java index efde92ff914..16809f5f8db 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/IColumnDefinition.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/IColumnDefinition.java @@ -21,8 +21,7 @@ import com.google.gwt.user.client.rpc.IsSerializable; import ch.systemsx.cisd.openbis.generic.shared.basic.dto.DataTypeCode; /** - * Describes table column's metadata. Has the ability to render cell values for the column given the - * row model. + * Describes table column's metadata. Has the ability to render cell values for the column given the row model. * * @author Tomasz Pylak */ diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/IEntityInformationHolderWithIdentifier.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/IEntityInformationHolderWithIdentifier.java index 9f9821ae453..4201df39220 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/IEntityInformationHolderWithIdentifier.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/IEntityInformationHolderWithIdentifier.java @@ -17,8 +17,7 @@ package ch.systemsx.cisd.openbis.generic.shared.basic; /** - * Contains the information stored in both {@link IIdentifierHolder} and - * {@link IEntityInformationHolderWithPermId}. + * Contains the information stored in both {@link IIdentifierHolder} and {@link IEntityInformationHolderWithPermId}. * * @author Izabela Adamczyk */ diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/IEntityInformationHolderWithPermId.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/IEntityInformationHolderWithPermId.java index ed4d798e90f..170736074c2 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/IEntityInformationHolderWithPermId.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/IEntityInformationHolderWithPermId.java @@ -17,8 +17,7 @@ package ch.systemsx.cisd.openbis.generic.shared.basic; /** - * Contains the information stored in both {@link IPermIdHolder} and - * {@link IEntityInformationHolder}. + * Contains the information stored in both {@link IPermIdHolder} and {@link IEntityInformationHolder}. * * @author Tomasz Pylak */ diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/IEntityInformationHolderWithProperties.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/IEntityInformationHolderWithProperties.java index 2b4ed00a3bf..80f5835ada4 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/IEntityInformationHolderWithProperties.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/IEntityInformationHolderWithProperties.java @@ -19,8 +19,7 @@ package ch.systemsx.cisd.openbis.generic.shared.basic; import ch.systemsx.cisd.openbis.generic.shared.basic.dto.IEntityPropertiesHolder; /** - * Contains the information stored in both {@link IEntityInformationHolderWithIdentifier} and - * {@link IEntityPropertiesHolder}. + * Contains the information stored in both {@link IEntityInformationHolderWithIdentifier} and {@link IEntityPropertiesHolder}. * * @author Piotr Buczek */ diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/IManagedPropertyGridInformationProvider.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/IManagedPropertyGridInformationProvider.java index 5e4db7d1ced..ed999373ca4 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/IManagedPropertyGridInformationProvider.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/IManagedPropertyGridInformationProvider.java @@ -22,8 +22,7 @@ package ch.systemsx.cisd.openbis.generic.shared.basic; public interface IManagedPropertyGridInformationProvider { /** - * the key of a grid that can be used when creating ids (unique in the context of an entity, - * doesn't contain spaces) + * the key of a grid that can be used when creating ids (unique in the context of an entity, doesn't contain spaces) */ public String getKey(); diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/MaterialCodeConverter.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/MaterialCodeConverter.java index 83f3f3060e4..184f94fc355 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/MaterialCodeConverter.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/MaterialCodeConverter.java @@ -19,8 +19,7 @@ package ch.systemsx.cisd.openbis.generic.shared.basic; import ch.systemsx.cisd.openbis.generic.shared.util.MaterialConfigurationProvider; /** - * Methods to convert material codes from business layer to database and from database to business - * layer. + * Methods to convert material codes from business layer to database and from database to business layer. * * @author Kaloyan Enimanev */ diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/MetaprojectName.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/MetaprojectName.java index 2cc5ea70658..551172fd6a3 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/MetaprojectName.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/MetaprojectName.java @@ -21,8 +21,7 @@ import java.util.regex.Pattern; import ch.systemsx.cisd.common.exceptions.UserFailureException; /** - * Metaproject name representation. The name cannot be null, empty or contain white spaces, commas, - * slashes or backslashes. + * Metaproject name representation. The name cannot be null, empty or contain white spaces, commas, slashes or backslashes. * * @author pkupczyk */ diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/PermlinkUtilities.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/PermlinkUtilities.java index bdfa260d117..e15a64f85b3 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/PermlinkUtilities.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/PermlinkUtilities.java @@ -34,7 +34,7 @@ public class PermlinkUtilities /** The HTTP URL parameter used to specify the entity kind. */ public static final String ENTITY_KIND_PARAMETER_KEY = "entity"; - /** The optional HTTP URL parameter used to specify the subtab that should be opened. */ + /** The optional HTTP URL parameter used to specify the subtab that should be opened. */ public static final String SUBTAB_PARAMETER_KEY = "ui-subtab"; public final static String createPermlinkURL(final String baseIndexURL, diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/PrimitiveValue.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/PrimitiveValue.java index aafabd47fb1..96c24b87b81 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/PrimitiveValue.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/PrimitiveValue.java @@ -23,11 +23,9 @@ import com.google.gwt.user.client.rpc.IsSerializable; import ch.systemsx.cisd.openbis.generic.shared.basic.dto.DataTypeCode; /** - * Stores one primitive value: Double, Long or String (null is represented as "" - - * {@link PrimitiveValue#NULL}). + * Stores one primitive value: Double, Long or String (null is represented as "" - {@link PrimitiveValue#NULL}). * <p> - * Such a type is needed because GWT does not support serialization fields of Object or Serializable - * type. + * Such a type is needed because GWT does not support serialization fields of Object or Serializable type. * </p> * * @author Tomasz Pylak @@ -89,7 +87,7 @@ public class PrimitiveValue implements IsSerializable, Serializable, Comparable< @Override @SuppressWarnings( - { "unchecked", "rawtypes" }) + { "unchecked", "rawtypes" }) public int compareTo(PrimitiveValue o) { Integer thisTypeOrdinal = getComparableDataTypeOrdinal(); diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/SimpleImageHtmlRenderer.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/SimpleImageHtmlRenderer.java index 6b5ce220694..0fb58d8d0e9 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/SimpleImageHtmlRenderer.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/SimpleImageHtmlRenderer.java @@ -16,7 +16,6 @@ package ch.systemsx.cisd.openbis.generic.shared.basic; - /** * @author Tomasz Pylak */ diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/TableCellUtil.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/TableCellUtil.java index 653b0ec033a..780c9cb1ba5 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/TableCellUtil.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/TableCellUtil.java @@ -35,9 +35,8 @@ public class TableCellUtil public static final String INTERN_PREFIX = "INTERN-"; /** - * Returns an appropriate table cell for the specified string token. If it can be parsed as an - * integer number a {@link IntegerTableCell} is returned. If it can be parsed as a floating - * point number a {@link DoubleTableCell} is returned. Otherwise a {@link StringTableCell} is + * Returns an appropriate table cell for the specified string token. If it can be parsed as an integer number a {@link IntegerTableCell} is + * returned. If it can be parsed as a floating point number a {@link DoubleTableCell} is returned. Otherwise a {@link StringTableCell} is * returned. */ public static ISerializableComparable createTableCell(String token) @@ -63,8 +62,8 @@ public class TableCellUtil } /** - * Returns the code of specified property type with prefix <code>INTERN-</code> or - * <code>USER-</code> depending on whether it is internal name space or not. + * Returns the code of specified property type with prefix <code>INTERN-</code> or <code>USER-</code> depending on whether it is internal name + * space or not. */ public static String getPropertyTypeCode(PropertyType propertyType) { diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/URLMethodWithParameters.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/URLMethodWithParameters.java index 6a5ae4f0a55..6868194fed5 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/URLMethodWithParameters.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/URLMethodWithParameters.java @@ -21,9 +21,8 @@ import com.google.gwt.user.client.rpc.IsSerializable; import ch.systemsx.cisd.common.shared.basic.string.StringUtils; /** - * Helper class to create URL's with parameters. Characters in path, parameter names and values are - * URL encoded except '0'-'9', 'a'-'z', 'A'-'Z', ':', '/', '.', '*', '-', and '_'. Space character - * is replaced by '+'. + * Helper class to create URL's with parameters. Characters in path, parameter names and values are URL encoded except '0'-'9', 'a'-'z', 'A'-'Z', ':', + * '/', '.', '*', '-', and '_'. Space character is replaced by '+'. * * @author Franz-Josef Elmer */ diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/ValidationUtilities.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/ValidationUtilities.java index 61e0d6c4f39..78c16bdb349 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/ValidationUtilities.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/ValidationUtilities.java @@ -36,7 +36,7 @@ public class ValidationUtilities private static final String HYPERLINK_REGEXP = "[^<>()\\[\\]]*"; private static final String[] HYPERLINK_VALID_PROTOCOLS = - { "http://", "https://", "ftp://" }; + { "http://", "https://", "ftp://" }; /** @return does given <var>string</var> start with a valid external hyperlink protocol */ public static final boolean isProtocolValid(String string) diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/ViewMode.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/ViewMode.java index 2acc4442c9c..7f9982e34a2 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/ViewMode.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/ViewMode.java @@ -26,9 +26,8 @@ public enum ViewMode implements IsSerializable SIMPLE, /** - * Embedded mode inherits most of the SIMPLE mode behaviors. But it has less widgets (e.g. top - * toolbar and footer are invisible, grids have only "Export" button) to allow embedding the - * application on other web sites. + * Embedded mode inherits most of the SIMPLE mode behaviors. But it has less widgets (e.g. top toolbar and footer are invisible, grids have only + * "Export" button) to allow embedding the application on other web sites. */ EMBEDDED, diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/WildcardSupportingMap.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/WildcardSupportingMap.java index 1937db13803..727fc5652e8 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/WildcardSupportingMap.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/WildcardSupportingMap.java @@ -21,8 +21,7 @@ import java.util.ArrayList; import ch.systemsx.cisd.openbis.generic.shared.basic.dto.EntityKindAndTypeCode; /** - * Utility class that manages mappings from entity types/codes (possibly including wildcards) to - * IServerPlugin objects. + * Utility class that manages mappings from entity types/codes (possibly including wildcards) to IServerPlugin objects. * * @author Chandrasekhar Ramakrishnan */ @@ -30,8 +29,7 @@ import ch.systemsx.cisd.openbis.generic.shared.basic.dto.EntityKindAndTypeCode; public class WildcardSupportingMap<T> { /** - * Internal class for keeping mappings from entityKind/codes (which may include wildcards) to - * factories. + * Internal class for keeping mappings from entityKind/codes (which may include wildcards) to factories. * * @author Chandrasekhar Ramakrishnan */ diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/annotation/DoNotEscape.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/annotation/DoNotEscape.java index 84573cd7236..3f0cdeec127 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/annotation/DoNotEscape.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/annotation/DoNotEscape.java @@ -23,12 +23,10 @@ import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; /** - * An annotation for marking an object that should not be escaped when returned to the client from - * server. There may be two reasons for this: + * An annotation for marking an object that should not be escaped when returned to the client from server. There may be two reasons for this: * <p> * <ol> - * <li>object contains important information used internally by application that are not shown to - * the user and shouldn't be escaped (like session id) + * <li>object contains important information used internally by application that are not shown to the user and shouldn't be escaped (like session id) * <li>object is escaped in a different place (e.g. in ResultSetTranslator) * </ol> * diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/AbstractEntityProperty.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/AbstractEntityProperty.java index fe2d078ffa0..a8b5ee7d895 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/AbstractEntityProperty.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/AbstractEntityProperty.java @@ -17,11 +17,10 @@ package ch.systemsx.cisd.openbis.generic.shared.basic.dto; /** - * The abstract base implementation of {@link IEntityProperty}, only featuring a - * {@link PropertyType}. + * The abstract base implementation of {@link IEntityProperty}, only featuring a {@link PropertyType}. * <p> - * All getters (except {@link #getPropertyType()} will return <code>null</code>, all setters (except - * {@link #setPropertyType(PropertyType)} will throw an {@link UnsupportedOperationException}. + * All getters (except {@link #getPropertyType()} will return <code>null</code>, all setters (except {@link #setPropertyType(PropertyType)} will throw + * an {@link UnsupportedOperationException}. * * @author Bernd Rinn */ diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/AbstractExternalData.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/AbstractExternalData.java index 29867311fb4..1fbe2a7d9d3 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/AbstractExternalData.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/AbstractExternalData.java @@ -117,7 +117,7 @@ public abstract class AbstractExternalData extends private boolean storageConfirmation; private boolean isStub; - + private boolean isPostRegistered; private Collection<Metaproject> metaprojects; @@ -475,7 +475,7 @@ public abstract class AbstractExternalData extends { return this.isStub; } - + public boolean isPostRegistered() { return isPostRegistered; @@ -495,7 +495,7 @@ public abstract class AbstractExternalData extends { this.accessTimestamp = accessTimestamp; } - + public Space getSpace() { if (experiment != null) diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/AssociatedEntityKind.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/AssociatedEntityKind.java index 51462e3c04d..91fee5efe1a 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/AssociatedEntityKind.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/AssociatedEntityKind.java @@ -23,8 +23,7 @@ import java.util.List; import java.util.Set; /** - * The <i>GWT</i> counterpart to - * ch.systemsx.cisd.openbis.generic.shared.api.v1.SearchableEntityKind. + * The <i>GWT</i> counterpart to ch.systemsx.cisd.openbis.generic.shared.api.v1.SearchableEntityKind. * * @author Piotr Buczek */ @@ -34,7 +33,7 @@ public enum AssociatedEntityKind implements Serializable EXPERIMENT("Experiment", EntityKind.EXPERIMENT, EnumSet.of(EntityKind.SAMPLE, EntityKind.DATA_SET)), - + DATA_SET("Data Set", EntityKind.DATA_SET, EnumSet.noneOf(EntityKind.class)), DATA_SET_PARENT("Parent", EntityKind.DATA_SET, EnumSet.of(EntityKind.DATA_SET)), diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/AttachmentWithContent.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/AttachmentWithContent.java index 53b248a46bc..652ffaf764f 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/AttachmentWithContent.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/AttachmentWithContent.java @@ -17,7 +17,7 @@ package ch.systemsx.cisd.openbis.generic.shared.basic.dto; /** - * An {@link Attachment} which has the actual content. + * An {@link Attachment} which has the actual content. * * @author Bernd Rinn */ @@ -25,9 +25,9 @@ public class AttachmentWithContent extends Attachment { private static final long serialVersionUID = ServiceVersionHolder.VERSION; - + private byte[] content; - + public AttachmentWithContent() { } @@ -42,6 +42,4 @@ public class AttachmentWithContent extends Attachment this.content = content; } - - } diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/BasicProjectIdentifier.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/BasicProjectIdentifier.java index fbf86cffd96..5f716b679fb 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/BasicProjectIdentifier.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/BasicProjectIdentifier.java @@ -19,8 +19,7 @@ package ch.systemsx.cisd.openbis.generic.shared.basic.dto; import java.io.Serializable; /** - * The <i>GWT</i> counterpart to - * {@link ch.systemsx.cisd.openbis.generic.shared.dto.identifier.ProjectIdentifier}. + * The <i>GWT</i> counterpart to {@link ch.systemsx.cisd.openbis.generic.shared.dto.identifier.ProjectIdentifier}. * * @author Piotr Buczek */ diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/BatchRegistrationResult.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/BatchRegistrationResult.java index 86b9da34ede..ccefc091aca 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/BatchRegistrationResult.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/BatchRegistrationResult.java @@ -19,8 +19,8 @@ package ch.systemsx.cisd.openbis.generic.shared.basic.dto; import java.io.Serializable; /** - * Batch registration is based on file input. This class returns to the client a small message after - * each file has been uploaded and handled on the server side. + * Batch registration is based on file input. This class returns to the client a small message after each file has been uploaded and handled on the + * server side. * * @author Christian Ribeaud */ diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/CodeAndLabel.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/CodeAndLabel.java index 8bc977b9e5d..ed299178d84 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/CodeAndLabel.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/CodeAndLabel.java @@ -21,9 +21,8 @@ import java.util.ArrayList; import java.util.List; /** - * Value object which has a label and a normalized code. Normalized means that the original code - * arguments turn to upper case and any symbol which isn't from A-Z or 0-9 is replaced by an - * underscore character. + * Value object which has a label and a normalized code. Normalized means that the original code arguments turn to upper case and any symbol which + * isn't from A-Z or 0-9 is replaced by an underscore character. * * @author Franz-Josef Elmer */ diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/ColumnSetting.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/ColumnSetting.java index 61a1ca3fde5..386532bb246 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/ColumnSetting.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/ColumnSetting.java @@ -21,9 +21,8 @@ import java.io.Serializable; import ch.systemsx.cisd.openbis.generic.shared.basic.dto.SortInfo.SortDir; /** - * Class storing personalised display settings for a table column. This class implements - * {@link Serializable} not only for transferring it's content remotely but also to store it in the - * database. Thus, CHANGES IN THIS CLASS MIGHT LEAD TO A LOST OF PERSONAL SETTINGS. + * Class storing personalised display settings for a table column. This class implements {@link Serializable} not only for transferring it's content + * remotely but also to store it in the database. Thus, CHANGES IN THIS CLASS MIGHT LEAD TO A LOST OF PERSONAL SETTINGS. * * @author Franz-Josef Elmer */ diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/ContainerDataSet.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/ContainerDataSet.java index 2b4ac718064..98f17f4298c 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/ContainerDataSet.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/ContainerDataSet.java @@ -20,8 +20,8 @@ import java.util.ArrayList; import java.util.List; /** - * A virtual data set "containing" other data sets. Container data sets have no physical - * representation. Their sole purpose is to provide a merged view of their contents. + * A virtual data set "containing" other data sets. Container data sets have no physical representation. Their sole purpose is to provide a merged + * view of their contents. * * @author Kaloyan Enimanev */ diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/DateTableCell.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/DateTableCell.java index 57ec6454be6..95dcb099f29 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/DateTableCell.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/DateTableCell.java @@ -26,19 +26,19 @@ import java.util.Date; public class DateTableCell implements ISerializableComparable { private static final long serialVersionUID = ServiceVersionHolder.VERSION; - + private long dateTime; - + public DateTableCell(long dateTime) { this.dateTime = dateTime; } - + public DateTableCell(Date date) { dateTime = date.getTime(); } - + public Date getDateTime() { return new Date(dateTime); @@ -73,6 +73,7 @@ public class DateTableCell implements ISerializableComparable { return new Date(dateTime).toString(); } + // --------------------------- // GWT only diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/Deletion.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/Deletion.java index 04be5dce282..c8e4b0d736d 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/Deletion.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/Deletion.java @@ -77,8 +77,7 @@ public final class Deletion extends AbstractRegistrationHolder implements IIdHol } /* - * The deletion counts are supposed to be used in situations when not all deleted entities are - * fetched into the <code>deletedEntities<?code> + * The deletion counts are supposed to be used in situations when not all deleted entities are fetched into the <code>deletedEntities<?code> */ public int getTotalSamplesCount() { diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/DetailedSearchCriterion.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/DetailedSearchCriterion.java index 76e7d1b6b58..1292e005937 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/DetailedSearchCriterion.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/DetailedSearchCriterion.java @@ -36,7 +36,7 @@ public class DetailedSearchCriterion implements Serializable private String value; private String timezone; - + private boolean negated; public DetailedSearchCriterion() @@ -55,14 +55,14 @@ public class DetailedSearchCriterion implements Serializable { this(field, type, date, SERVER_TIMEZONE); } - + public DetailedSearchCriterion(DetailedSearchField field, CompareType type, Number value) { this.field = field; this.value = value.toString(); this.type = type; } - + public DetailedSearchCriterion(DetailedSearchField field, CompareType type, String value, String timezoneOrNull) { this.field = field; diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/DetailedSearchField.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/DetailedSearchField.java index 342085c9f26..95371a3b231 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/DetailedSearchField.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/DetailedSearchField.java @@ -20,8 +20,7 @@ import java.io.Serializable; import java.util.List; /** - * Full specification of the field connected with an entity which can be used in detailed text - * queries. + * Full specification of the field connected with an entity which can be used in detailed text queries. * * @author Tomasz Pylak * @author Piotr Buczek diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/DoubleTableCell.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/DoubleTableCell.java index 44c2b7d2f99..f71986f9748 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/DoubleTableCell.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/DoubleTableCell.java @@ -24,19 +24,19 @@ package ch.systemsx.cisd.openbis.generic.shared.basic.dto; public class DoubleTableCell implements ISerializableComparable { private static final long serialVersionUID = ServiceVersionHolder.VERSION; - + private double number; - + public DoubleTableCell(double doubleValue) { this.number = doubleValue; } - + public double getNumber() { return number; } - + @Override public int compareTo(ISerializableComparable o) { @@ -68,7 +68,7 @@ public class DoubleTableCell implements ISerializableComparable { return Double.toString(number); } - + // --------------------------- // GWT only diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/EntityReference.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/EntityReference.java index 24896499ae1..3ae7c37ae63 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/EntityReference.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/EntityReference.java @@ -21,8 +21,7 @@ import java.io.Serializable; import ch.systemsx.cisd.openbis.generic.shared.basic.IEntityInformationHolderWithPermId; /** - * Reference to an entity with minimal information to uniquely identify it in the database and to - * choose the right plugin to handle it. + * Reference to an entity with minimal information to uniquely identify it in the database and to choose the right plugin to handle it. * * @author Tomasz Pylak */ diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/EntityType.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/EntityType.java index 11be668e3e7..bdb666a8d27 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/EntityType.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/EntityType.java @@ -73,6 +73,6 @@ abstract public class EntityType extends BasicEntityType * return true if this entity type is of given kind, or if the kind is null */ public abstract boolean isEntityKind(EntityKind kind); - + public abstract EntityKind getEntityKind(); } diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/EntityTypePropertyType.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/EntityTypePropertyType.java index 907b083eda6..914b42a7c3f 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/EntityTypePropertyType.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/EntityTypePropertyType.java @@ -106,12 +106,10 @@ public abstract class EntityTypePropertyType<T extends EntityType> implements Se } /** - * Some properties, managed properties in particular, may or may not need to be available in - * edit and update views. + * Some properties, managed properties in particular, may or may not need to be available in edit and update views. * <p> - * The current behavior is to always return true for non-script-based properties and always - * return false for dynamically computed properties. Only dynamically managed properties take - * this value into account. + * The current behavior is to always return true for non-script-based properties and always return false for dynamically computed properties. Only + * dynamically managed properties take this value into account. * * @return True if the property should be shown in edit and update views. */ @@ -120,18 +118,17 @@ public abstract class EntityTypePropertyType<T extends EntityType> implements Se if (isDynamic()) { return false; - } else { + } else + { return showInEditView; } } /** - * Some properties, managed properties in particular, may or may not need to be available in - * edit and update views. + * Some properties, managed properties in particular, may or may not need to be available in edit and update views. * <p> - * The current behavior is to always use the value true for non-script-based properties and - * always use false for dynamically computed properties. Only dynamically managed properties - * take this value into account. + * The current behavior is to always use the value true for non-script-based properties and always use false for dynamically computed properties. + * Only dynamically managed properties take this value into account. * * @param showInEditView Pass in true if this property should be shown in edit and update views. */ diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/EntityVisit.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/EntityVisit.java index bd1fcdfc270..143c2d1d7e4 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/EntityVisit.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/EntityVisit.java @@ -22,8 +22,7 @@ import java.util.Date; import ch.systemsx.cisd.openbis.generic.shared.basic.IEntityInformationHolderWithIdentifier; /** - * Visit of an entity. Objects of this class are created when the detail view of an entity is opened - * in the GUI. + * Visit of an entity. Objects of this class are created when the detail view of an entity is opened in the GUI. * * @author Franz-Josef Elmer */ diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/ExperimentType.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/ExperimentType.java index 6c58ac1390f..bf62425ba5b 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/ExperimentType.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/ExperimentType.java @@ -46,7 +46,7 @@ public class ExperimentType extends EntityType { return kind == null || kind == EntityKind.EXPERIMENT; } - + @Override public EntityKind getEntityKind() { diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/FileFormatType.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/FileFormatType.java index 1097c0d488c..c2d6dc22762 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/FileFormatType.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/FileFormatType.java @@ -16,7 +16,6 @@ package ch.systemsx.cisd.openbis.generic.shared.basic.dto; - /** * The <i>GWT</i> equivalent to FileFormatTypePE. * diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/GenericEntityProperty.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/GenericEntityProperty.java index 1eec8e21294..39c1ebe5338 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/GenericEntityProperty.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/GenericEntityProperty.java @@ -17,8 +17,7 @@ package ch.systemsx.cisd.openbis.generic.shared.basic.dto; /** - * A {@link IEntityProperty} class that only stores the generic value, but not a vocabulary term - * value or a material value. + * A {@link IEntityProperty} class that only stores the generic value, but not a vocabulary term value or a material value. * * @author Bernd Rinn */ @@ -28,6 +27,7 @@ public class GenericEntityProperty extends AbstractEntityProperty private static final long serialVersionUID = ServiceVersionHolder.VERSION; private String originalValue; + private String value; @Override diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/IDatasetLocationNode.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/IDatasetLocationNode.java index dfe3c184f44..a24524cfeee 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/IDatasetLocationNode.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/IDatasetLocationNode.java @@ -37,8 +37,7 @@ public interface IDatasetLocationNode boolean isContainer(); /** - * Returns a collection of component locations. For a data set that is not a container always - * returns an empty collection. Never returns null. + * Returns a collection of component locations. For a data set that is not a container always returns an empty collection. Never returns null. */ Collection<IDatasetLocationNode> getComponents(); diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/IEntityProperty.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/IEntityProperty.java index 1e202f4a3e5..a82021c0941 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/IEntityProperty.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/IEntityProperty.java @@ -28,8 +28,8 @@ public interface IEntityProperty extends Serializable, Comparable<IEntityPropert public static final IEntityProperty[] EMPTY_ARRAY = new IEntityProperty[0]; /** - * Returns a string representation of whatever value this property represents. Vocabulary terms - * will be represented as their CODE, material values will be represented as "CODE (TYPE_CODE)". + * Returns a string representation of whatever value this property represents. Vocabulary terms will be represented as their CODE, material values + * will be represented as "CODE (TYPE_CODE)". */ public String tryGetAsString(); diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/IExpressionUpdates.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/IExpressionUpdates.java index b6c7917352b..aad406108a6 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/IExpressionUpdates.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/IExpressionUpdates.java @@ -22,8 +22,7 @@ import java.util.Date; import ch.systemsx.cisd.openbis.generic.shared.basic.IIdHolder; /** - * Description of the updates which should be performed on a stored expression (e.g. grid custom - * filter or column expression). + * Description of the updates which should be performed on a stored expression (e.g. grid custom filter or column expression). * * @author Piotr Buczek */ diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/IPropertiesBean.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/IPropertiesBean.java index 8dfb9110404..ee86bc3619b 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/IPropertiesBean.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/IPropertiesBean.java @@ -16,7 +16,6 @@ package ch.systemsx.cisd.openbis.generic.shared.basic.dto; - /** * Interface implemented by beans with properties attribute. * @@ -25,6 +24,6 @@ package ch.systemsx.cisd.openbis.generic.shared.basic.dto; public interface IPropertiesBean { public IEntityProperty[] getProperties(); - + public void setProperties(IEntityProperty[] properties); } diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/ISerializableComparable.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/ISerializableComparable.java index b489934cb6e..7d6286e1406 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/ISerializableComparable.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/ISerializableComparable.java @@ -19,8 +19,8 @@ package ch.systemsx.cisd.openbis.generic.shared.basic.dto; import java.io.Serializable; /** - * Interface for objects which are comparable, java.io.Serializable and GWT serializable. - * Implementations should override {@link Object#equals(Object)} and {@link Object#hashCode()}. + * Interface for objects which are comparable, java.io.Serializable and GWT serializable. Implementations should override + * {@link Object#equals(Object)} and {@link Object#hashCode()}. * * @author Franz-Josef Elmer */ diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/ImageTableCell.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/ImageTableCell.java index 609aede0eb0..c7c8fd20c01 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/ImageTableCell.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/ImageTableCell.java @@ -22,7 +22,7 @@ package ch.systemsx.cisd.openbis.generic.shared.basic.dto; public class ImageTableCell implements ISerializableComparable { private static final long serialVersionUID = ServiceVersionHolder.VERSION; - + private static final String SLASH = "/"; private static String getPath(String dataSetCode, String dataSetLocation, String originalPath) @@ -36,7 +36,7 @@ public class ImageTableCell implements ISerializableComparable String relativePath = originalPath.substring(indexOfLocation + dataSetLocation.length()); return getPath(dataSetCode, relativePath); } - + private static String getPath(String dataSetCode, String relativePath) { String delimiter = ""; @@ -52,16 +52,15 @@ public class ImageTableCell implements ISerializableComparable private int maxThumbnailWidth; private int maxThumbnailHeight; - + public ImageTableCell(String dataSetCode, String dataSetLocation, String originalPath, int maxThumbnailWidth, int maxThumbnailHeight) { this(getPath(dataSetCode, dataSetLocation, originalPath), maxThumbnailWidth, maxThumbnailHeight); } - + /** - * @param relativePathFromDataSetRoot the relative path to this image file starting from the - * data set root. + * @param relativePathFromDataSetRoot the relative path to this image file starting from the data set root. */ public ImageTableCell(String dataSetCode, String relativePathFromDataSetRoot, int maxThumbnailWidth, @@ -77,17 +76,17 @@ public class ImageTableCell implements ISerializableComparable this.maxThumbnailWidth = maxThumbnailWidth; this.maxThumbnailHeight = maxThumbnailHeight; } - + public String getPath() { return path; } - + public int getMaxThumbnailWidth() { return maxThumbnailWidth; } - + public int getMaxThumbnailHeight() { return maxThumbnailHeight; @@ -104,19 +103,19 @@ public class ImageTableCell implements ISerializableComparable { return this == obj || (obj instanceof ImageTableCell && ((ImageTableCell) obj).path.equals(path)); } - + @Override public int hashCode() { return path.hashCode(); } - + @Override public String toString() { return path; } - + // --------------------------- // GWT only @@ -125,4 +124,3 @@ public class ImageTableCell implements ISerializableComparable { } } - diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/LastModificationState.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/LastModificationState.java index 653e6c3acae..3f3522680a2 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/LastModificationState.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/LastModificationState.java @@ -28,31 +28,24 @@ import ch.systemsx.cisd.openbis.generic.shared.ICommonServer; import ch.systemsx.cisd.openbis.generic.shared.basic.annotation.DoNotEscape; /** - * Stores information about the time and {@link DatabaseModificationKind} of the last modification, - * separately for each kind of database object. + * Stores information about the time and {@link DatabaseModificationKind} of the last modification, separately for each kind of database object. * <p> * A {@link DatabaseModificationKind} has two bits of information: * <ul> - * <li>The kind of database object (e.g. Sample, Experiment etc. see - * {@link DatabaseModificationKind.ObjectKind}). - * <li>The kind of operation either update or creation/deletion (see - * {@link DatabaseModificationKind.OperationKind}). + * <li>The kind of database object (e.g. Sample, Experiment etc. see {@link DatabaseModificationKind.ObjectKind}). + * <li>The kind of operation either update or creation/deletion (see {@link DatabaseModificationKind.OperationKind}). * </ul> - * Instances of {@link LastModificationState} store for each combination of object kind and - * operation kind the time stamp of last invocation of a service method annotated with either - * {@link DatabaseCreateOrDeleteModification} or {@link DatabaseUpdateModification}. + * Instances of {@link LastModificationState} store for each combination of object kind and operation kind the time stamp of last invocation of a + * service method annotated with either {@link DatabaseCreateOrDeleteModification} or {@link DatabaseUpdateModification}. * <p> - * The method {@link #getLastModificationTime(DatabaseModificationKind)} allows to retrieve this - * time stamp. + * The method {@link #getLastModificationTime(DatabaseModificationKind)} allows to retrieve this time stamp. * <p> - * The service method {@link ICommonServer#getLastModificationState(String)} provides an instance of - * this class with the latest time stamps. It can be used by a client to update views (see for - * example ch.systemsx + * The service method {@link ICommonServer#getLastModificationState(String)} provides an instance of this class with the latest time stamps. It can be + * used by a client to update views (see for example ch.systemsx * .cisd.openbis.generic.client.web.client.application.framework.LastModificationStateUpdater). * <p> - * Note, that only the kind of object not the actual type or even instance is stored. That means for - * example that the creation of a new sample will lead to an update of any sample detailed view in - * the Web GUI. + * Note, that only the kind of object not the actual type or even instance is stored. That means for example that the creation of a new sample will + * lead to an update of any sample detailed view in the Web GUI. * * @author Tomasz Pylak */ @@ -84,10 +77,9 @@ public class LastModificationState implements Serializable } /** - * To avoid expensive computation of the last modification time at the beginning (which would - * require browsing the whole database) at the beginning we assume that it's equal to the - * initialization time of the whole state. We can do this since all the future modifications - * will happen after this moment. + * To avoid expensive computation of the last modification time at the beginning (which would require browsing the whole database) at the + * beginning we assume that it's equal to the initialization time of the whole state. We can do this since all the future modifications will + * happen after this moment. * * @return The last registered time of the specified kind of database modification. */ diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/LinkDataSet.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/LinkDataSet.java index fdb8d700c2a..730b5bf489a 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/LinkDataSet.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/LinkDataSet.java @@ -17,8 +17,8 @@ package ch.systemsx.cisd.openbis.generic.shared.basic.dto; /** - * A virtual data set storing the reference to the data set in external data management system. Link - * data sets have no physical representation in local dss. + * A virtual data set storing the reference to the data set in external data management system. Link data sets have no physical representation in + * local dss. * * @author Pawel Glyzewski */ diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/LinkModel.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/LinkModel.java index 37ed54a57c1..47eecfdf4e1 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/LinkModel.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/LinkModel.java @@ -23,8 +23,8 @@ import java.util.List; import com.google.gwt.user.client.rpc.IsSerializable; /** - * A model for reporting plug-ins of type DSS_LINK. It keeps the different parts of the URL separate - * so that users can easily use only the parts they need. + * A model for reporting plug-ins of type DSS_LINK. It keeps the different parts of the URL separate so that users can easily use only the parts they + * need. * <p> * The url is broken into schemAndDomain, path, and query parameters. An example: <br> * https://openbis.ethz.ch/datastore_server/2010093083732894?param1=482745¶m2=something @@ -34,8 +34,8 @@ import com.google.gwt.user.client.rpc.IsSerializable; * <li>param1=482745¶m2=something <b>[parameters]</b></li> * </ul> * <p> - * LinkModels returned by the server do not (necessarily) contain a sessionID. The client should - * provide the session Id to the LinkModel before using it. + * LinkModels returned by the server do not (necessarily) contain a sessionID. The client should provide the session Id to the LinkModel before using + * it. * * @author Chandrasekhar Ramakrishnan */ @@ -167,8 +167,8 @@ public class LinkModel implements Serializable } /** - * The session token is a special parameter. It is returned as one of the parameters by - * {@link #getParameters()}, but it can be retrieved directly this way. + * The session token is a special parameter. It is returned as one of the parameters by {@link #getParameters()}, but it can be retrieved directly + * this way. */ public String trySessionId() { diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/ListMaterialCriteria.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/ListMaterialCriteria.java index 3e9d0a2b2ca..0b9dafeeca8 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/ListMaterialCriteria.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/ListMaterialCriteria.java @@ -86,13 +86,14 @@ public final class ListMaterialCriteria implements Serializable { return materialIdentifiersOrNull; } - + @Override - public String toString() { + public String toString() + { return "ListMaterialCriteria [materialTypeOrNull=" + materialTypeOrNull + ", materialIdsOrNull=" + materialIdsOrNull + ", materialIdentifiersOrNull=" + materialIdentifiersOrNull + "]"; - } + } } diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/ListOrSearchSampleCriteria.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/ListOrSearchSampleCriteria.java index e13126f3232..677f52ec2bb 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/ListOrSearchSampleCriteria.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/ListOrSearchSampleCriteria.java @@ -27,8 +27,8 @@ import ch.systemsx.cisd.openbis.generic.shared.basic.TechId; * <li>detailed sample search * <li>tracking new samples of particular type * </ul> - * Additionally one can decide if dependent samples that are loaded (parents and containers) should - * be enriched with properties. By default only 'primary' samples are enriched.<br> + * Additionally one can decide if dependent samples that are loaded (parents and containers) should be enriched with properties. By default only + * 'primary' samples are enriched.<br> * <br> * NOTE: This bean is not serializable. * diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/ManagedHtmlWidgetDescription.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/ManagedHtmlWidgetDescription.java index fb74439e51a..576d5a2298a 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/ManagedHtmlWidgetDescription.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/ManagedHtmlWidgetDescription.java @@ -20,9 +20,8 @@ import ch.systemsx.cisd.openbis.generic.shared.basic.dto.api.IManagedOutputWidge import ch.systemsx.cisd.openbis.generic.shared.basic.dto.api.ManagedOutputWidgetType; /** - * {@link IManagedOutputWidgetDescription} implementation for multi-line text fields. This class - * functions as a simple marker that the UI should use an HTML widget to display the result, and - * offers no configuration options or behavior. + * {@link IManagedOutputWidgetDescription} implementation for multi-line text fields. This class functions as a simple marker that the UI should use + * an HTML widget to display the result, and offers no configuration options or behavior. * * @author Chandrasekhar Ramakrishnan */ diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/ManagedUiActionDescription.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/ManagedUiActionDescription.java index c1a4582f2ff..d11cb5d040e 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/ManagedUiActionDescription.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/ManagedUiActionDescription.java @@ -25,8 +25,7 @@ import ch.systemsx.cisd.openbis.generic.shared.basic.dto.api.IManagedUiAction; import ch.systemsx.cisd.openbis.generic.shared.basic.dto.api.IPerson; /** - * Object that declaratively describes a UI for an action (e.g. describing UI of a dialog that - * should be shown after clicking on a button). + * Object that declaratively describes a UI for an action (e.g. describing UI of a dialog that should be shown after clicking on a button). * * @author Piotr Buczek */ diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/ManagedUiTableActionDescription.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/ManagedUiTableActionDescription.java index 7581366c903..e5e98ad9835 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/ManagedUiTableActionDescription.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/ManagedUiTableActionDescription.java @@ -26,8 +26,8 @@ import ch.systemsx.cisd.openbis.generic.shared.basic.dto.api.IManagedUiTableActi import ch.systemsx.cisd.openbis.generic.shared.basic.dto.api.ManagedTableActionRowSelectionType; /** - * Object that declaratively describes a UI for an action related to a table (e.g. describing UI of - * a dialog that should be shown after clicking on a button when some table rows are selected). + * Object that declaratively describes a UI for an action related to a table (e.g. describing UI of a dialog that should be shown after clicking on a + * button when some table rows are selected). * * @author Piotr Buczek */ diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/MaterialAttributeSearchFieldKind.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/MaterialAttributeSearchFieldKind.java index 96fb5a2b50f..ee2a14b26ab 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/MaterialAttributeSearchFieldKind.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/MaterialAttributeSearchFieldKind.java @@ -28,7 +28,7 @@ public enum MaterialAttributeSearchFieldKind implements Serializable, IAttribute ID("Id"), CODE("Code"), - + PERM_ID("Perm Id"), MATERIAL_TYPE("Material Type"), diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/MaterialEntityProperty.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/MaterialEntityProperty.java index cf37bd85cc4..86ff90f2a62 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/MaterialEntityProperty.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/MaterialEntityProperty.java @@ -17,8 +17,7 @@ package ch.systemsx.cisd.openbis.generic.shared.basic.dto; /** - * A {@link IEntityProperty} class that only stores the material value, but not a generic value or a - * vocabulary term value. + * A {@link IEntityProperty} class that only stores the material value, but not a generic value or a vocabulary term value. * * @author Bernd Rinn */ diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/MaterialIdentifier.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/MaterialIdentifier.java index 1bf36e93fa3..372efb5e22f 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/MaterialIdentifier.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/MaterialIdentifier.java @@ -44,8 +44,7 @@ public final class MaterialIdentifier implements Serializable private String code; /** - * The code of material type of this material: together with code uniquely identifies the - * material. + * The code of material type of this material: together with code uniquely identifies the material. * <p> * Could not be <code>null</code>. * </p> @@ -89,12 +88,10 @@ public final class MaterialIdentifier implements Serializable // ----------- /** - * Creates material identifier from specified identifier or code and material type code if no - * full identifier is specified. + * Creates material identifier from specified identifier or code and material type code if no full identifier is specified. * * @return <code>null</code> if no full identifier specified and material type is unknown. - * @throw {@link IllegalArgumentException} if material type of full identifier doesn't match - * specified material type. + * @throw {@link IllegalArgumentException} if material type of full identifier doesn't match specified material type. */ public static MaterialIdentifier tryCreate(String codeOrIdentifierOrNull, ICodeHolder materialTypeCodeHolderOrNull) @@ -125,8 +122,7 @@ public final class MaterialIdentifier implements Serializable } /** - * Parses the material code and type. Assumes the syntax: "code (type)". Returns the chosen - * material if parsing went ok, null otherwise. + * Parses the material code and type. Assumes the syntax: "code (type)". Returns the chosen material if parsing went ok, null otherwise. */ public static MaterialIdentifier tryParseIdentifier(String value) { diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/NewColumnOrFilter.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/NewColumnOrFilter.java index 1b6c2b9fb36..e84e4ee6078 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/NewColumnOrFilter.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/NewColumnOrFilter.java @@ -16,7 +16,6 @@ package ch.systemsx.cisd.openbis.generic.shared.basic.dto; - /** * A custom grid filter or column to register. * @@ -25,7 +24,7 @@ package ch.systemsx.cisd.openbis.generic.shared.basic.dto; public class NewColumnOrFilter extends NewExpression { private static final long serialVersionUID = ServiceVersionHolder.VERSION; - + private String gridId; public String getGridId() diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/NewPTNewAssigment.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/NewPTNewAssigment.java index 485b37b809f..e39f248f499 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/NewPTNewAssigment.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/NewPTNewAssigment.java @@ -5,32 +5,39 @@ import java.io.Serializable; public class NewPTNewAssigment implements Serializable { private boolean existingPropertyType; + private PropertyType propertyType; + private NewETPTAssignment assignment; - + public boolean isExistingPropertyType() { return existingPropertyType; } + public void setExistingPropertyType(boolean existingPropertyType) { this.existingPropertyType = existingPropertyType; } + public PropertyType getPropertyType() { return propertyType; } + public void setPropertyType(PropertyType propertyType) { this.propertyType = propertyType; } + public NewETPTAssignment getAssignment() { return assignment; } + public void setAssignment(NewETPTAssignment assignment) { this.assignment = assignment; } - + } \ No newline at end of file diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/NewSample.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/NewSample.java index 679fd72d6a8..a982ec05d7b 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/NewSample.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/NewSample.java @@ -59,8 +59,7 @@ public class NewSample extends Identifier<NewSample> implements Comparable<NewSa private SampleType sampleType; /** - * Set of parent sample codes or identifiers. It will be assumed that all the samples belong to - * the same group as the child sample. + * Set of parent sample codes or identifiers. It will be assumed that all the samples belong to the same group as the child sample. */ private String[] parentsOrNull; @@ -70,8 +69,8 @@ public class NewSample extends Identifier<NewSample> implements Comparable<NewSa private String containerIdentifier; /** - * The current container identifier. Used only if the sample identifier does not have the - * container specified. In such a case it will be assumed that the sample is in that container. + * The current container identifier. Used only if the sample identifier does not have the container specified. In such a case it will be assumed + * that the sample is in that container. */ private String currentContainerIdentifier; @@ -194,8 +193,7 @@ public class NewSample extends Identifier<NewSample> implements Comparable<NewSa } /** - * @deprecated kept for backward compatibility and used as a convenience method for tests - use - * {@link #setParents(String)} instead + * @deprecated kept for backward compatibility and used as a convenience method for tests - use {@link #setParents(String)} instead */ @Deprecated @BeanProperty(label = PARENT, optional = true) diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/PortletConfiguration.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/PortletConfiguration.java index 42552d62f48..4412c2dadcc 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/PortletConfiguration.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/PortletConfiguration.java @@ -21,8 +21,8 @@ import java.io.Serializable; /** * Configuration parameters of a portlet. * <p> - * Instances of this class are serialized in the personal {@link DisplaySettings} of a user. Thus, - * CHANGES IN THIS CLASS MIGHT LEAD TO A LOST OF PERSONAL SETTINGS + * Instances of this class are serialized in the personal {@link DisplaySettings} of a user. Thus, CHANGES IN THIS CLASS MIGHT LEAD TO A LOST OF + * PERSONAL SETTINGS * * @author Franz-Josef Elmer */ diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/PropertyType.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/PropertyType.java index ecee128b259..9632d69a740 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/PropertyType.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/PropertyType.java @@ -31,8 +31,8 @@ public class PropertyType extends Code<PropertyType> implements IPropertyTypeUpd private Long id; /** - * Only used for displaying/viewing. With <code>managedInternally</code> is unambiguous (meaning - * that <code>simpleCode</code> alone could be not unique). + * Only used for displaying/viewing. With <code>managedInternally</code> is unambiguous (meaning that <code>simpleCode</code> alone could be not + * unique). * <p> * We have to use it, partly because <i>Javascript</i> handle '.' in an object-oriented way. * </p> diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/RelationshipType.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/RelationshipType.java index 940cf75a3f9..eae92967a96 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/RelationshipType.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/RelationshipType.java @@ -30,8 +30,8 @@ public class RelationshipType extends Code<PropertyType> implements Serializable private Long id; /** - * Only used for displaying/viewing. With <code>managedInternally</code> is unambiguous (meaning - * that <code>simpleCode</code> alone could be not unique). + * Only used for displaying/viewing. With <code>managedInternally</code> is unambiguous (meaning that <code>simpleCode</code> alone could be not + * unique). * <p> * We have to use it, partly because <i>Javascript</i> handle '.' in an object-oriented way. * </p> diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/ReportingPluginType.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/ReportingPluginType.java index 9702dfe2b4c..1368a60829f 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/ReportingPluginType.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/ReportingPluginType.java @@ -19,8 +19,8 @@ package ch.systemsx.cisd.openbis.generic.shared.basic.dto; import java.io.Serializable; /** - * Different kinds of reporting plug-ins that are supported. Also keeps track of which - * IReportingPluginTask methods can be invoked on the different types of plugin types. + * Different kinds of reporting plug-ins that are supported. Also keeps track of which IReportingPluginTask methods can be invoked on the different + * types of plugin types. * * @author Chandrasekhar Ramakrishnan */ @@ -30,13 +30,12 @@ public enum ReportingPluginType implements Serializable TABLE_MODEL(ImplementedPluginMethods.CREATE_REPORT), DSS_LINK(new ImplementedPluginMethods[] - { ImplementedPluginMethods.CREATE_REPORT, ImplementedPluginMethods.CREATE_LINK }), + { ImplementedPluginMethods.CREATE_REPORT, ImplementedPluginMethods.CREATE_LINK }), AGGREGATION_TABLE_MODEL(ImplementedPluginMethods.CREATE_AGGREGATION_REPORT); /** - * An enum representing the methods implemented by the - * ch.systemsx.cisd.openbis.dss.generic.server.plugins.tasks.IReportingPluginTask interface. + * An enum representing the methods implemented by the ch.systemsx.cisd.openbis.dss.generic.server.plugins.tasks.IReportingPluginTask interface. * * @author Chandrasekhar Ramakrishnan */ @@ -50,7 +49,7 @@ public enum ReportingPluginType implements Serializable private ReportingPluginType(ImplementedPluginMethods implementedMethods) { this(new ImplementedPluginMethods[] - { implementedMethods }); + { implementedMethods }); } private ReportingPluginType(ImplementedPluginMethods[] implementedMethods) diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/RoleAssignment.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/RoleAssignment.java index fd4cbb0cefc..f10dbd86da8 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/RoleAssignment.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/RoleAssignment.java @@ -16,7 +16,6 @@ package ch.systemsx.cisd.openbis.generic.shared.basic.dto; - /** * The DTO for authorization role assignments. * diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/RoleWithHierarchy.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/RoleWithHierarchy.java index 5acdb31460b..dc2db87f2ae 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/RoleWithHierarchy.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/RoleWithHierarchy.java @@ -23,25 +23,23 @@ import java.util.Set; import com.google.gwt.user.client.rpc.IsSerializable; /** - * Hierarchical role. Combines {@link RoleCode} with {@link RoleLevel} and a set of - * {@link RoleWithHierarchy}s that are stronger. + * Hierarchical role. Combines {@link RoleCode} with {@link RoleLevel} and a set of {@link RoleWithHierarchy}s that are stronger. * <p> * Available roles can: * <ol> * <li>be presented to the user * <li>be easily mapped to database structure * <li>be used to restrict access to server methods - * <li>define the role hierarchy by specifying which roles are stronger (users that have only the - * "stronger" role will also be able to access given server method) + * <li>define the role hierarchy by specifying which roles are stronger (users that have only the "stronger" role will also be able to access given + * server method) * </ol> * </p> * <h4>Example:</h4>To annotate an interface method with a new role e.g. <code>SECRET_AGENT</code>: * <ol> * <li>Add <code>SECRET_AGENT</code> to {@link RoleCode} enumerator. - * <li>Add <code>SECRET_AGENT</code> to <code>authorization_role</code> domain in the database (and - * prepare migration). - * <li>Add <code>INSTANCE_SECRET_AGENT</code> (or <code>SPACE_SECRET_AGENT</code>) to - * {@link RoleWithHierarchy} enumerator and define the "stronger" roles. + * <li>Add <code>SECRET_AGENT</code> to <code>authorization_role</code> domain in the database (and prepare migration). + * <li>Add <code>INSTANCE_SECRET_AGENT</code> (or <code>SPACE_SECRET_AGENT</code>) to {@link RoleWithHierarchy} enumerator and define the "stronger" + * roles. * <li>Use the new {@link RoleWithHierarchy} to annotate the interface method. * </ol> * diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/Sample.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/Sample.java index 6b4120ee802..c5e3967b4ea 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/Sample.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/Sample.java @@ -275,9 +275,10 @@ public final class Sample extends CodeWithRegistrationAndModificationDate<Sample @Override public final int compareTo(final Sample o) { - if (getIdentifier() == null) { - return o.getIdentifier() == null ? 0 : 1; - } + if (getIdentifier() == null) + { + return o.getIdentifier() == null ? 0 : 1; + } return getIdentifier().compareTo(o.getIdentifier()); } diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/SampleAttributeSearchFieldKind.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/SampleAttributeSearchFieldKind.java index 9cdf9d33d03..1d9f7f7878c 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/SampleAttributeSearchFieldKind.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/SampleAttributeSearchFieldKind.java @@ -38,7 +38,7 @@ public enum SampleAttributeSearchFieldKind implements Serializable, IAttributeSe PROJECT_PERM_ID("Project Perm Id"), PROJECT_SPACE("Project Space"), - + METAPROJECT("Metaproject"), REGISTRATION_DATE(CommonAttributeSearchFieldKindDecsriptions.REGISTRATION_DATE_DESCRIPTION, diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/SampleParentWithDerived.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/SampleParentWithDerived.java index 3a1c17267fc..65a603b2b95 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/SampleParentWithDerived.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/SampleParentWithDerived.java @@ -19,8 +19,7 @@ package ch.systemsx.cisd.openbis.generic.shared.basic.dto; import java.io.Serializable; /** - * A <code>SampleParentWithDerived</code> encapsulates a <code>Sample</code> (the parent) and its - * derived <code>Sample</code>s. + * A <code>SampleParentWithDerived</code> encapsulates a <code>Sample</code> (the parent) and its derived <code>Sample</code>s. * * @author Christian Ribeaud */ diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/SampleTypePropertyType.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/SampleTypePropertyType.java index 09d18dcd8cf..c6ca092718d 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/SampleTypePropertyType.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/SampleTypePropertyType.java @@ -16,7 +16,6 @@ package ch.systemsx.cisd.openbis.generic.shared.basic.dto; - /** * The {@link EntityTypePropertyType} extension for <i>Sample Type</i>. * diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/SearchDomainSearchResultWithFullEntity.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/SearchDomainSearchResultWithFullEntity.java index 4d307809314..603f08be8f7 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/SearchDomainSearchResultWithFullEntity.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/SearchDomainSearchResultWithFullEntity.java @@ -29,7 +29,7 @@ import ch.systemsx.cisd.openbis.generic.shared.basic.IEntityInformationHolderWit public class SearchDomainSearchResultWithFullEntity implements Serializable { private static final long serialVersionUID = ServiceVersionHolder.VERSION; - + private IEntityInformationHolderWithPermId entity; private SearchDomainSearchResult searchResult; diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/SearchFieldBooleanCriterionFactory.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/SearchFieldBooleanCriterionFactory.java index 146f8946d34..427b43be5af 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/SearchFieldBooleanCriterionFactory.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/SearchFieldBooleanCriterionFactory.java @@ -17,8 +17,7 @@ package ch.systemsx.cisd.openbis.generic.shared.basic.dto; /** - * Creates a criterion for a boolean field. Accepts following values: "true", "yes", "false", "no". - * For other values is returns "*". + * Creates a criterion for a boolean field. Accepts following values: "true", "yes", "false", "no". For other values is returns "*". * * @author pkupczyk */ diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/SearchFieldDateCriterionFactory.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/SearchFieldDateCriterionFactory.java index 44281809a4e..cfaf10b5315 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/SearchFieldDateCriterionFactory.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/SearchFieldDateCriterionFactory.java @@ -17,8 +17,7 @@ package ch.systemsx.cisd.openbis.generic.shared.basic.dto; /** - * Creates a criterion for a date field. Supports registration and modification dates with equals, - * from and until versions. + * Creates a criterion for a date field. Supports registration and modification dates with equals, from and until versions. * * @author pkupczyk */ diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/SerializableComparableIDDecorator.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/SerializableComparableIDDecorator.java index 2620f59df3d..d85b7200337 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/SerializableComparableIDDecorator.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/SerializableComparableIDDecorator.java @@ -26,22 +26,23 @@ import ch.systemsx.cisd.openbis.generic.shared.basic.TechId; public class SerializableComparableIDDecorator implements ISerializableComparable { private static final long serialVersionUID = ServiceVersionHolder.VERSION; - + private ISerializableComparable serializableComparable; + private Long id; - + public SerializableComparableIDDecorator(ISerializableComparable serializableComparable, Long idOrNull) { assert serializableComparable != null : "Unspecified ISerializableComparable"; this.serializableComparable = serializableComparable; this.id = idOrNull; } - + public Long getID() { return id; } - + @Override public int compareTo(ISerializableComparable o) { @@ -66,20 +67,20 @@ public class SerializableComparableIDDecorator implements ISerializableComparabl } SerializableComparableIDDecorator decorator = (SerializableComparableIDDecorator) obj; return serializableComparable.equals(decorator.serializableComparable); - } - + } + @Override public int hashCode() { return serializableComparable.hashCode(); } - + @Override public String toString() { return serializableComparable.toString(); } - + // --------------------------- // GWT only diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/SimpleAttributeSearchFieldKind.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/SimpleAttributeSearchFieldKind.java index ff1d172c4b3..7069f5eb620 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/SimpleAttributeSearchFieldKind.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/SimpleAttributeSearchFieldKind.java @@ -24,6 +24,7 @@ package ch.systemsx.cisd.openbis.generic.shared.basic.dto; public class SimpleAttributeSearchFieldKind implements IAttributeSearchFieldKind { private String code; + private String description; public SimpleAttributeSearchFieldKind(String code, String description) @@ -31,7 +32,7 @@ public class SimpleAttributeSearchFieldKind implements IAttributeSearchFieldKind this.code = code; this.description = description; } - + @Override public ISearchFieldAvailability getAvailability() { diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/StandardPortletNames.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/StandardPortletNames.java index 3bca556e674..93628e8b8da 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/StandardPortletNames.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/StandardPortletNames.java @@ -19,14 +19,14 @@ package ch.systemsx.cisd.openbis.generic.shared.basic.dto; /** * Names of standard portlets. * <p> - * Portlet names are part of a {@link PortletConfiguration} instance. Because a portlet - * configuration is stored in the personal {@link DisplaySettings} of a user a CHANGE OF PORTLET - * NAMES MIGHT LEAD TO A LOST OF PERSONAL SETTINGS + * Portlet names are part of a {@link PortletConfiguration} instance. Because a portlet configuration is stored in the personal + * {@link DisplaySettings} of a user a CHANGE OF PORTLET NAMES MIGHT LEAD TO A LOST OF PERSONAL SETTINGS * * @author Franz-Josef Elmer */ public class StandardPortletNames { public static final String WELCOME = "Welcome"; + public static final String HISTORY = "History"; } diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/TrackingDataSetCriteria.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/TrackingDataSetCriteria.java index 23ac5831b70..975a771020b 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/TrackingDataSetCriteria.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/TrackingDataSetCriteria.java @@ -19,11 +19,11 @@ package ch.systemsx.cisd.openbis.generic.shared.basic.dto; import java.io.Serializable; /** - * Criteria for tracking <i>data sets</i> with technical id bigger than the specified one. Optional, - * the search is restricted to data sets connected to samples of a certain type. + * Criteria for tracking <i>data sets</i> with technical id bigger than the specified one. Optional, the search is restricted to data sets connected + * to samples of a certain type. * <p> - * Connected samples should be loaded as well as their parent and container samples according to - * {@link SampleType} hierarchy depths. All referenced samples should have all properties loaded. + * Connected samples should be loaded as well as their parent and container samples according to {@link SampleType} hierarchy depths. All referenced + * samples should have all properties loaded. * * @author Piotr Buczek */ diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/TrackingSampleCriteria.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/TrackingSampleCriteria.java index 67ad6dbf6f5..7d693f6a58e 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/TrackingSampleCriteria.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/TrackingSampleCriteria.java @@ -20,11 +20,10 @@ import java.io.Serializable; import java.util.Collection; /** - * Criteria for tracking <i>samples</i> of particular type with certain property set to specified - * value. + * Criteria for tracking <i>samples</i> of particular type with certain property set to specified value. * <p> - * Parent and Container samples should be loaded according to {@link SampleType} hierarchy depths. - * All referenced samples should have all properties loaded. + * Parent and Container samples should be loaded according to {@link SampleType} hierarchy depths. All referenced samples should have all properties + * loaded. * * @author Piotr Buczek */ diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/TypedTableModel.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/TypedTableModel.java index e83ad98cf6a..23dbb507ad0 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/TypedTableModel.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/TypedTableModel.java @@ -22,9 +22,8 @@ import java.util.List; import ch.systemsx.cisd.openbis.generic.client.web.client.application.ui.TypedTableGrid; /** - * Table model for {@link TypedTableGrid} classes. It contains column meta-data as a list of - * {@link TableModelColumnHeader} instances and the row data as a list of - * {@link TableModelRowWithObject} instances for row objects of type <code>T</code>. + * Table model for {@link TypedTableGrid} classes. It contains column meta-data as a list of {@link TableModelColumnHeader} instances and the row data + * as a list of {@link TableModelRowWithObject} instances for row objects of type <code>T</code>. * * @author Franz-Josef Elmer */ diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/VocabularyTermEntityProperty.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/VocabularyTermEntityProperty.java index b691553545a..9cb2a03aaab 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/VocabularyTermEntityProperty.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/VocabularyTermEntityProperty.java @@ -17,8 +17,7 @@ package ch.systemsx.cisd.openbis.generic.shared.basic.dto; /** - * A {@link IEntityProperty} class that only stores the vocabulary term value, but not a generic - * value or a material value. + * A {@link IEntityProperty} class that only stores the vocabulary term value, but not a generic value or a material value. * * @author Bernd Rinn */ diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/api/IManagedInputWidgetDescriptionFactory.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/api/IManagedInputWidgetDescriptionFactory.java index 3d450480752..bd310f57e94 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/api/IManagedInputWidgetDescriptionFactory.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/api/IManagedInputWidgetDescriptionFactory.java @@ -38,8 +38,7 @@ public interface IManagedInputWidgetDescriptionFactory extends Serializable IManagedInputWidgetDescription createMultilineTextInputField(String label); /** - * @return a combo box input field with given <var>label</var> and specified list of selectable - * <var>values</var>. + * @return a combo box input field with given <var>label</var> and specified list of selectable <var>values</var>. */ IManagedInputWidgetDescription createComboBoxInputField(String labels, String[] values); diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/api/IManagedProperty.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/api/IManagedProperty.java index 901985422ef..cf71d73d712 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/api/IManagedProperty.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/api/IManagedProperty.java @@ -31,8 +31,7 @@ public interface IManagedProperty extends Serializable String getPropertyTypeCode(); /** - * Returns <var>true</var> if the detailed view of the entity owning the property will show the - * managed property in an extra tab. + * Returns <var>true</var> if the detailed view of the entity owning the property will show the managed property in an extra tab. */ boolean isOwnTab(); @@ -40,8 +39,7 @@ public interface IManagedProperty extends Serializable void setOwnTab(boolean ownTab); /** - * Returns <code>true</code> if the value is special, that is either a place-holder value or an - * error message. + * Returns <code>true</code> if the value is special, that is either a place-holder value or an error message. */ boolean isSpecialValue(); @@ -52,8 +50,7 @@ public interface IManagedProperty extends Serializable void setValue(String value); /** - * Return an object which allows to manage data for the user interface (input as well as - * output). + * Return an object which allows to manage data for the user interface (input as well as output). */ IManagedUiDescription getUiDescription(); } diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/api/IManagedUiAction.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/api/IManagedUiAction.java index 0ba850ca044..95cb1952e04 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/api/IManagedUiAction.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/api/IManagedUiAction.java @@ -41,20 +41,17 @@ public interface IManagedUiAction extends Serializable public IManagedUiAction setDescription(String description); /** - * Adds specified input widget descriptions that will be used in user interface for modifcation - * of a managed property. + * Adds specified input widget descriptions that will be used in user interface for modifcation of a managed property. */ public void addInputWidgets(IManagedInputWidgetDescription... widgets); /** - * Returns list of objects describing input widgets that will be used in user interface for - * modification of the managed property. + * Returns list of objects describing input widgets that will be used in user interface for modification of the managed property. */ public List<IManagedInputWidgetDescription> getInputWidgetDescriptions(); /** - * Convenience method returning value of input widget with given label or null if such widget - * doesn't exist. + * Convenience method returning value of input widget with given label or null if such widget doesn't exist. */ public String getInputValue(String inputLabel); diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/api/IManagedUiDescription.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/api/IManagedUiDescription.java index 024e9000cbf..7421b5a050c 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/api/IManagedUiDescription.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/api/IManagedUiDescription.java @@ -28,8 +28,8 @@ import java.util.List; public interface IManagedUiDescription extends Serializable { /** - * Sets the given table model to define an output that will be shown in detail view of the - * entity owning the property. The table will be shown in an extra tab. + * Sets the given table model to define an output that will be shown in detail view of the entity owning the property. The table will be shown in + * an extra tab. */ void useTableOutput(ITableModel tableModel); @@ -39,14 +39,12 @@ public interface IManagedUiDescription extends Serializable void useHtmlOutput(String htmlString); /** - * Adds a table action with given name to actions that can be performed in the user interface - * for modification of the managed property. + * Adds a table action with given name to actions that can be performed in the user interface for modification of the managed property. */ IManagedUiTableAction addTableAction(String name); /** - * Adds an action with given <var>name</var> to actions that can be performed in the user - * interface for modification of the managed property. + * Adds an action with given <var>name</var> to actions that can be performed in the user interface for modification of the managed property. * <p> * NOTE: currently there is only support for table actions */ @@ -58,8 +56,7 @@ public interface IManagedUiDescription extends Serializable List<IManagedUiAction> getActions(); /** - * Returns description of the widget that will be shown in detail view of the entity owning the - * property. + * Returns description of the widget that will be shown in detail view of the entity owning the property. */ IManagedOutputWidgetDescription getOutputWidgetDescription(); diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/api/IManagedUiTableAction.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/api/IManagedUiTableAction.java index e63839c5da8..55270a876c3 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/api/IManagedUiTableAction.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/api/IManagedUiTableAction.java @@ -22,11 +22,11 @@ import java.util.Map; /** * Extension of {@link IManagedUiAction} for actions assigned with a table output. * <p> - * Every table action can specify table selection mode required for the action to be enabled. If an - * action requires table rows to be selected than it will contain list of indices of selected rows. + * Every table action can specify table selection mode required for the action to be enabled. If an action requires table rows to be selected than it + * will contain list of indices of selected rows. * <p> - * For actions that require single row to be selected it is possible to bind values of selected - * row's columns with input fields (e.g. useful in edit actions). + * For actions that require single row to be selected it is possible to bind values of selected row's columns with input fields (e.g. useful in edit + * actions). * * @see ManagedTableActionRowSelectionType * @author Piotr Buczek diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/api/ValidationException.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/api/ValidationException.java index 967c204a21d..c339cb3c569 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/api/ValidationException.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/api/ValidationException.java @@ -16,7 +16,6 @@ package ch.systemsx.cisd.openbis.generic.shared.basic.dto.api; - /** * Exception thrown by jython scripts in case of invalid input. * diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/coreplugin/CorePluginsUtils.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/coreplugin/CorePluginsUtils.java index 6cd59375a4c..407e03181df 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/coreplugin/CorePluginsUtils.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/coreplugin/CorePluginsUtils.java @@ -38,11 +38,9 @@ public class CorePluginsUtils public static final String CORE_PLUGINS_PROPERTIES_FILE = "core-plugins.properties"; /** - * Adds the content of <code>core-plugins.properties</code> file to the specified properties. - * The folder with the core plugins properties file is specified by the property - * <code>core-plugins-folder</code> of the specified properties. If undefined a default value is - * used. Note, that the core plugin properties might overwrite value in the specified properties - * object. + * Adds the content of <code>core-plugins.properties</code> file to the specified properties. The folder with the core plugins properties file is + * specified by the property <code>core-plugins-folder</code> of the specified properties. If undefined a default value is used. Note, that the + * core plugin properties might overwrite value in the specified properties object. */ public static void addCorePluginsProperties(Properties properties, ScannerType scannerType) { diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/coreplugin/IPluginType.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/coreplugin/IPluginType.java index 70365c4de32..99215b2121b 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/coreplugin/IPluginType.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/coreplugin/IPluginType.java @@ -19,8 +19,7 @@ package ch.systemsx.cisd.openbis.generic.shared.coreplugin; import java.util.Properties; /** - * A core plugin type is defined by a name which is used as a folder and an optional property which - * lists all keys of the plugins of this type. + * A core plugin type is defined by a name which is used as a folder and an optional property which lists all keys of the plugins of this type. * * @author Franz-Josef Elmer */ diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/dto/AbstractRegistrationHolder.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/dto/AbstractRegistrationHolder.java index 9db40ae3d16..375363c3e9e 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/dto/AbstractRegistrationHolder.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/dto/AbstractRegistrationHolder.java @@ -21,7 +21,7 @@ import java.util.Date; /** * Super class of DTOs which hold registration data. * - * @author Franz-Josef Elmer + * @author Franz-Josef Elmer */ public abstract class AbstractRegistrationHolder extends Id { @@ -63,8 +63,7 @@ public abstract class AbstractRegistrationHolder extends Id /** * Sets the person who has registered the experiment. * - * @throws AssertionError if <code>registratorID</code> is defined but unequal - * <code>registrator.getId()</code>. + * @throws AssertionError if <code>registratorID</code> is defined but unequal <code>registrator.getId()</code>. */ public final void setRegistrator(final PersonPE registrator) { diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/dto/AttachmentPE.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/dto/AttachmentPE.java index 68b9a4c1c9f..d82aafe7b32 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/dto/AttachmentPE.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/dto/AttachmentPE.java @@ -102,8 +102,8 @@ public class AttachmentPE extends HibernateAbstractRegistrationHolder implements public static class AttachmentSearchBridge implements FieldBridge { @Override - public void set(String name, Object/* AttachmentPE */ value, - Document/* Lucene document */ document, LuceneOptions luceneOptions) + public void set(String name, Object/* AttachmentPE */value, + Document/* Lucene document */document, LuceneOptions luceneOptions) { AttachmentPE attachment = (AttachmentPE) value; String attachmentName = attachment.getFileName(); diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/dto/CorePluginPE.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/dto/CorePluginPE.java index ad064d88b36..1ac165a6327 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/dto/CorePluginPE.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/dto/CorePluginPE.java @@ -38,8 +38,8 @@ import org.hibernate.annotations.GenerationTime; */ @Entity @Table(name = TableNames.CORE_PLUGINS_TABLE, uniqueConstraints = - { @UniqueConstraint(columnNames = - { ColumnNames.NAME_COLUMN, ColumnNames.VERSION_COLUMN }) }) +{ @UniqueConstraint(columnNames = +{ ColumnNames.NAME_COLUMN, ColumnNames.VERSION_COLUMN }) }) public final class CorePluginPE implements Comparable<CorePluginPE> { transient private Long id; diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/dto/DataPE.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/dto/DataPE.java index e6bca2894f8..98a264e9161 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/dto/DataPE.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/dto/DataPE.java @@ -84,11 +84,11 @@ import ch.systemsx.cisd.openbis.generic.shared.util.HibernateUtils; * @author Bernd Rinn */ @Entity -@Table(name = TableNames.DATA_VIEW, uniqueConstraints = @UniqueConstraint(columnNames = ColumnNames.CODE_COLUMN) ) +@Table(name = TableNames.DATA_VIEW, uniqueConstraints = @UniqueConstraint(columnNames = ColumnNames.CODE_COLUMN)) @Inheritance(strategy = InheritanceType.JOINED) @Indexed(index = "DataPE") @ClassBridge(impl = DataGlobalSearchBridge.class) -public class DataPE extends AbstractIdAndCodeHolder<DataPE>implements +public class DataPE extends AbstractIdAndCodeHolder<DataPE> implements IEntityInformationWithPropertiesHolder, IMatchingEntity, IIdentifierHolder, IDeletablePE, IEntityWithMetaprojects, IModifierAndModificationDateBean { diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/dto/DataSetPropertyPE.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/dto/DataSetPropertyPE.java index b7af5aa6a46..07a83ac8b3f 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/dto/DataSetPropertyPE.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/dto/DataSetPropertyPE.java @@ -41,7 +41,7 @@ import ch.systemsx.cisd.openbis.generic.shared.IServer; */ @Entity @Table(name = TableNames.DATA_SET_PROPERTIES_TABLE, uniqueConstraints = @UniqueConstraint(columnNames = - { ColumnNames.DATA_SET_COLUMN, ColumnNames.DATA_SET_TYPE_PROPERTY_TYPE_COLUMN })) +{ ColumnNames.DATA_SET_COLUMN, ColumnNames.DATA_SET_TYPE_PROPERTY_TYPE_COLUMN })) @Cache(usage = CacheConcurrencyStrategy.READ_WRITE) public class DataSetPropertyPE extends EntityPropertyPE { diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/dto/DataSetRelationshipPE.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/dto/DataSetRelationshipPE.java index d5e52cdd323..ded922095ab 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/dto/DataSetRelationshipPE.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/dto/DataSetRelationshipPE.java @@ -49,7 +49,7 @@ import ch.systemsx.cisd.openbis.generic.shared.IServer; @Table(name = TableNames.DATA_SET_RELATIONSHIPS_VIEW, uniqueConstraints = @UniqueConstraint(columnNames = { ColumnNames.DATA_PARENT_COLUMN, ColumnNames.DATA_CHILD_COLUMN, ColumnNames.RELATIONSHIP_COLUMN })) @IdClass(DataSetRelationshipId.class) -@TypeDefs({@TypeDef(name="transactiontimestamp", typeClass=DbTimestampType.class)}) +@TypeDefs({ @TypeDef(name = "transactiontimestamp", typeClass = DbTimestampType.class) }) public class DataSetRelationshipPE implements Serializable { private static final long serialVersionUID = IServer.VERSION; diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/dto/DataSetTypePropertyTypePE.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/dto/DataSetTypePropertyTypePE.java index 11c8ec100ae..1ff7161582d 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/dto/DataSetTypePropertyTypePE.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/dto/DataSetTypePropertyTypePE.java @@ -42,8 +42,8 @@ import ch.systemsx.cisd.openbis.generic.shared.IServer; */ @Entity @Table(name = TableNames.DATA_SET_TYPE_PROPERTY_TYPE_TABLE, uniqueConstraints = - { @UniqueConstraint(columnNames = - { ColumnNames.DATA_SET_TYPE_COLUMN, ColumnNames.PROPERTY_TYPE_COLUMN }) }) +{ @UniqueConstraint(columnNames = +{ ColumnNames.DATA_SET_TYPE_COLUMN, ColumnNames.PROPERTY_TYPE_COLUMN }) }) public class DataSetTypePropertyTypePE extends EntityTypePropertyTypePE { diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/dto/DataSetUploadContext.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/dto/DataSetUploadContext.java index 21d988e9151..aff96c4e50a 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/dto/DataSetUploadContext.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/dto/DataSetUploadContext.java @@ -29,7 +29,7 @@ import ch.systemsx.cisd.openbis.generic.shared.IServer; /** * Context data needed for uploading data sets to a CIFEX server. * - * @author Franz-Josef Elmer + * @author Franz-Josef Elmer */ public class DataSetUploadContext implements Serializable { @@ -46,9 +46,9 @@ public class DataSetUploadContext implements Serializable private String comment; private String email; - + private String sessionUserID; - + public final String getFileName() { return fileName; diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/dto/DataSourceDefinition.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/dto/DataSourceDefinition.java index 23444811ea8..d453cb547f6 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/dto/DataSourceDefinition.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/dto/DataSourceDefinition.java @@ -55,8 +55,7 @@ public class DataSourceDefinition implements Serializable, Cloneable } /** - * Creates a list of definitions from specified string which could be the output of - * {@link #toString(List)}. + * Creates a list of definitions from specified string which could be the output of {@link #toString(List)}. */ public static List<DataSourceDefinition> listFromString(String serializedDefinitions) { @@ -73,8 +72,7 @@ public class DataSourceDefinition implements Serializable, Cloneable } /** - * Creates a string representation of specified definition. It can be used as an input of - * {@link #listFromString(String)}. + * Creates a string representation of specified definition. It can be used as an input of {@link #listFromString(String)}. */ public static String toString(List<DataSourceDefinition> definitions) { @@ -87,8 +85,7 @@ public class DataSourceDefinition implements Serializable, Cloneable } /** - * Creates an instance from the specified string. The input could be the output of - * {@link #toString()}. + * Creates an instance from the specified string. The input could be the output of {@link #toString()}. */ public static DataSourceDefinition fromString(String serializedDefinition) { @@ -241,8 +238,7 @@ public class DataSourceDefinition implements Serializable, Cloneable } /** - * Returns this instance as a string which allows reconstruction by applying - * {@link #fromString(String)}. + * Returns this instance as a string which allows reconstruction by applying {@link #fromString(String)}. */ @Override public String toString() diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/dto/DataSourceWithDefinition.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/dto/DataSourceWithDefinition.java index 5cc522d6897..64f70bc62ee 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/dto/DataSourceWithDefinition.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/dto/DataSourceWithDefinition.java @@ -18,7 +18,6 @@ package ch.systemsx.cisd.openbis.generic.shared.dto; import javax.sql.DataSource; - /** * Bean for a {@link DataSource} together with its {@link DataSourceDefinition}. * @@ -27,6 +26,7 @@ import javax.sql.DataSource; public class DataSourceWithDefinition { private final DataSource dataSource; + private final DataSourceDefinition definition; public DataSourceWithDefinition(DataSource dataSource, DataSourceDefinition definitionOrNull) diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/dto/DataStoreServerInfo.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/dto/DataStoreServerInfo.java index 5f858101c4e..38c1a1135bb 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/dto/DataStoreServerInfo.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/dto/DataStoreServerInfo.java @@ -28,11 +28,9 @@ import ch.systemsx.cisd.openbis.generic.shared.IServer; * <p> * It contains * <ul> - * <li>the port on which the DSS is reachable. Note, that the host can be inferred by the asking - * {@link HttpServletRequest}. + * <li>the port on which the DSS is reachable. Note, that the host can be inferred by the asking {@link HttpServletRequest}. * <li>the DSS session token which has to used when invoking methods on the DSS. - * <li>the download URL which is the URL at which the DSS Web server can be accessed from a Web - * browser. + * <li>the download URL which is the URL at which the DSS Web server can be accessed from a Web browser. * <li>the unique code of the DSS, * <li>information about available services. * </ul> diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/dto/DataTypePE.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/dto/DataTypePE.java index d3451d075dc..84b63111a8a 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/dto/DataTypePE.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/dto/DataTypePE.java @@ -50,8 +50,8 @@ import ch.systemsx.cisd.openbis.generic.shared.basic.dto.DataTypeCode; */ @Entity @Table(name = TableNames.DATA_TYPES_TABLE, uniqueConstraints = - { @UniqueConstraint(columnNames = - { ColumnNames.CODE_COLUMN }) }) +{ @UniqueConstraint(columnNames = +{ ColumnNames.CODE_COLUMN }) }) public final class DataTypePE implements IIdHolder, Serializable, Comparable<DataTypePE> { private static final long serialVersionUID = IServer.VERSION; diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/dto/DeletedExternalDataPE.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/dto/DeletedExternalDataPE.java index 5f9777595bd..82f949bfb64 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/dto/DeletedExternalDataPE.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/dto/DeletedExternalDataPE.java @@ -33,14 +33,13 @@ import ch.systemsx.cisd.openbis.generic.shared.basic.dto.DataSetArchivingStatus; import ch.systemsx.cisd.openbis.generic.shared.dto.hibernate.Location; /** - * {@link ExternalDataPE} counterpart for deleted data sets mapping only those attributes that are - * needed for permanent deletion of data sets. + * {@link ExternalDataPE} counterpart for deleted data sets mapping only those attributes that are needed for permanent deletion of data sets. * * @author Piotr Buczek */ @Entity @Table(name = TableNames.EXTERNAL_DATA_TABLE, uniqueConstraints = @UniqueConstraint(columnNames = - { ColumnNames.LOCATION_COLUMN, ColumnNames.LOCATOR_TYPE_COLUMN })) +{ ColumnNames.LOCATION_COLUMN, ColumnNames.LOCATOR_TYPE_COLUMN })) @PrimaryKeyJoinColumn(name = ColumnNames.DATA_ID_COLUMN) public final class DeletedExternalDataPE extends DeletedDataPE { diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/dto/EntityCollectionForCreationOrUpdate.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/dto/EntityCollectionForCreationOrUpdate.java index 03117d8287c..70fae40719a 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/dto/EntityCollectionForCreationOrUpdate.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/dto/EntityCollectionForCreationOrUpdate.java @@ -24,16 +24,16 @@ import ch.systemsx.cisd.openbis.generic.shared.IServer; import ch.systemsx.cisd.openbis.generic.shared.basic.dto.NewExperiment; /** - * Collections of {@link NewExternalData}, {@link NewExperiment}. + * Collections of {@link NewExternalData}, {@link NewExperiment}. * * @author Franz-Josef Elmer */ public class EntityCollectionForCreationOrUpdate implements Serializable { private static final long serialVersionUID = IServer.VERSION; - + private final List<NewExperiment> newExperiments = new ArrayList<NewExperiment>(); - + private final List<NewExternalData> newDataSets = new ArrayList<NewExternalData>(); public List<NewExperiment> getNewExperiments() diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/dto/EntityOperationsLogEntryPE.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/dto/EntityOperationsLogEntryPE.java index da7f5638e64..53d06506ef8 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/dto/EntityOperationsLogEntryPE.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/dto/EntityOperationsLogEntryPE.java @@ -11,14 +11,12 @@ import javax.persistence.SequenceGenerator; import javax.persistence.Table; import javax.validation.constraints.NotNull; -import ch.systemsx.cisd.openbis.generic.server.ServiceForDataStoreServer; import ch.systemsx.cisd.openbis.generic.shared.IServer; import ch.systemsx.cisd.openbis.generic.shared.basic.IIdHolder; /** - * Persistent entity representing an invocation of the - * {@link ServiceForDataStoreServer#performEntityOperations(String, AtomicEntityOperationDetails)} method. This - * table is used to check if the results of an invocation of this method made it into the database. + * Persistent entity representing an invocation of the {@link ServiceForDataStoreServer#performEntityOperations(String, AtomicEntityOperationDetails)} + * method. This table is used to check if the results of an invocation of this method made it into the database. * * @author Chandrasekhar Ramakrishnan */ diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/dto/EntityPropertyFiller.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/dto/EntityPropertyFiller.java index 86a1ecc8b28..5deb384f89a 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/dto/EntityPropertyFiller.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/dto/EntityPropertyFiller.java @@ -23,8 +23,8 @@ import ch.systemsx.cisd.common.reflection.AbstractHashable; import ch.systemsx.cisd.openbis.generic.shared.IServer; /** - * Used when assigning mandatory property to an entity, which has some instances or when mandatory - * flag is change from optional and properties for some entities are unset. + * Used when assigning mandatory property to an entity, which has some instances or when mandatory flag is change from optional and properties for + * some entities are unset. * * @author Tomasz Pylak */ diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/dto/EntityPropertyPE.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/dto/EntityPropertyPE.java index e0a4d11a95a..cadebaa63f7 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/dto/EntityPropertyPE.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/dto/EntityPropertyPE.java @@ -71,7 +71,7 @@ import ch.systemsx.cisd.openbis.generic.shared.util.SimplePropertyValidator.Supp */ @MappedSuperclass @ClassBridge(index = Index.YES, store = Store.YES, impl = EntityPropertyPE.EntityPropertySearchBridge.class) -@TypeDefs({@TypeDef(name="transactiontimestamp", typeClass=DbTimestampType.class)}) +@TypeDefs({ @TypeDef(name = "transactiontimestamp", typeClass = DbTimestampType.class) }) public abstract class EntityPropertyPE extends HibernateAbstractRegistrationHolder implements IUntypedValueSetter, IEntityPropertyHolder { @@ -114,7 +114,7 @@ public abstract class EntityPropertyPE extends HibernateAbstractRegistrationHold private PersonPE author; private Date modificationDate; - + /** * This bridge allows to save in the search index not only the value of property, but also the corresponding property code. */ @@ -130,9 +130,9 @@ public abstract class EntityPropertyPE extends HibernateAbstractRegistrationHold @Override public void set( - String name, + String name, Object/* EntityPropertyPE */value, - Document/* Lucene document */document, + Document/* Lucene document */document, LuceneOptions luceneOptions) { EntityPropertyPE entityProperty = (EntityPropertyPE) value; @@ -154,29 +154,48 @@ public abstract class EntityPropertyPE extends HibernateAbstractRegistrationHold { // leave the original value } - field = new Field(fieldFullName, fieldValue, luceneOptions.getStore(), indexingStrategy); + field = new Field(fieldFullName, fieldValue, luceneOptions.getStore(), indexingStrategy); } - else if(DataTypeCode.INTEGER.equals(entityProperty.getEntityTypePropertyType().getPropertyType().getType().getCode())) { + else if (DataTypeCode.INTEGER.equals(entityProperty.getEntityTypePropertyType().getPropertyType().getType().getCode())) + { try { String numericTextValue = SortableNumberBridgeUtils.getNumberForLucene(fieldValue); field = new Field(fieldFullName, numericTextValue, luceneOptions.getStore(), Field.Index.NOT_ANALYZED_NO_NORMS); - fieldIsdocTypeSortedNumeric = new SortedNumericDocValuesField(fieldFullName, Long.parseLong(fieldValue)); //Needed to identify the field as number, if not type is not stored + fieldIsdocTypeSortedNumeric = new SortedNumericDocValuesField(fieldFullName, Long.parseLong(fieldValue)); // Needed to identify + // the field as number, + // if not type is not + // stored } catch (Exception e) { // leave the original value } - } else if(DataTypeCode.REAL.equals(entityProperty.getEntityTypePropertyType().getPropertyType().getType().getCode())) { + } else if (DataTypeCode.REAL.equals(entityProperty.getEntityTypePropertyType().getPropertyType().getType().getCode())) + { try { String numericTextValue = SortableNumberBridgeUtils.getNumberForLucene(fieldValue); field = new Field(fieldFullName, numericTextValue, luceneOptions.getStore(), Field.Index.NOT_ANALYZED_NO_NORMS); - fieldIsdocTypeSortedNumeric = new SortedNumericDocValuesField(fieldFullName, NumericUtils.doubleToSortableLong(Double.parseDouble(fieldValue))); //Needed to identify the field as number, if not type is not stored + fieldIsdocTypeSortedNumeric = + new SortedNumericDocValuesField(fieldFullName, NumericUtils.doubleToSortableLong(Double.parseDouble(fieldValue))); // Needed + // to + // identify + // the + // field + // as + // number, + // if + // not + // type + // is + // not + // stored } catch (Exception e) { // leave the original value } - } else if(DataTypeCode.MULTILINE_VARCHAR.equals(entityProperty.getEntityTypePropertyType().getPropertyType().getType().getCode())) { + } else if (DataTypeCode.MULTILINE_VARCHAR.equals(entityProperty.getEntityTypePropertyType().getPropertyType().getType().getCode())) + { try { XMLInputFactory xif = XMLInputFactory.newFactory(); @@ -197,16 +216,19 @@ public abstract class EntityPropertyPE extends HibernateAbstractRegistrationHold fieldValue = valueBuff.toString(); } catch (Exception e) { - //Do Nothing + // Do Nothing } - field = new Field(fieldFullName, fieldValue, luceneOptions.getStore(), indexingStrategy); //Strips out XML tags from text that can be rich text using HTML format - } else { + field = new Field(fieldFullName, fieldValue, luceneOptions.getStore(), indexingStrategy); // Strips out XML tags from text that can be + // rich text using HTML format + } else + { field = new Field(fieldFullName, fieldValue, luceneOptions.getStore(), indexingStrategy); } - + field.setBoost(luceneOptions.getBoost()); document.add(field); - if(fieldIsdocTypeSortedNumeric != null) { + if (fieldIsdocTypeSortedNumeric != null) + { document.add(fieldIsdocTypeSortedNumeric); } } diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/dto/ExperimentPropertyPE.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/dto/ExperimentPropertyPE.java index b2d47b9cdd3..938de7362ae 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/dto/ExperimentPropertyPE.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/dto/ExperimentPropertyPE.java @@ -41,7 +41,7 @@ import ch.systemsx.cisd.openbis.generic.shared.IServer; */ @Entity @Table(name = TableNames.EXPERIMENT_PROPERTIES_TABLE, uniqueConstraints = @UniqueConstraint(columnNames = - { ColumnNames.EXPERIMENT_COLUMN, ColumnNames.EXPERIMENT_TYPE_PROPERTY_TYPE_COLUMN })) +{ ColumnNames.EXPERIMENT_COLUMN, ColumnNames.EXPERIMENT_TYPE_PROPERTY_TYPE_COLUMN })) @Cache(usage = CacheConcurrencyStrategy.READ_WRITE) public class ExperimentPropertyPE extends EntityPropertyPE { diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/dto/ExperimentTypePropertyTypePE.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/dto/ExperimentTypePropertyTypePE.java index 8a4b41637ba..268921ba76f 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/dto/ExperimentTypePropertyTypePE.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/dto/ExperimentTypePropertyTypePE.java @@ -42,8 +42,8 @@ import ch.systemsx.cisd.openbis.generic.shared.IServer; */ @Entity @Table(name = TableNames.EXPERIMENT_TYPE_PROPERTY_TYPE_TABLE, uniqueConstraints = - { @UniqueConstraint(columnNames = - { ColumnNames.EXPERIMENT_TYPE_COLUMN, ColumnNames.PROPERTY_TYPE_COLUMN }) }) +{ @UniqueConstraint(columnNames = +{ ColumnNames.EXPERIMENT_TYPE_COLUMN, ColumnNames.PROPERTY_TYPE_COLUMN }) }) public class ExperimentTypePropertyTypePE extends EntityTypePropertyTypePE { diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/dto/ExternalDataPE.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/dto/ExternalDataPE.java index 304a0e9af10..2ca29505aa8 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/dto/ExternalDataPE.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/dto/ExternalDataPE.java @@ -54,7 +54,7 @@ import ch.systemsx.cisd.openbis.generic.shared.dto.hibernate.SearchFieldConstant */ @Entity @Table(name = TableNames.EXTERNAL_DATA_TABLE, uniqueConstraints = @UniqueConstraint(columnNames = { ColumnNames.LOCATION_COLUMN, - ColumnNames.LOCATOR_TYPE_COLUMN }) ) + ColumnNames.LOCATOR_TYPE_COLUMN })) @PrimaryKeyJoinColumn(name = ColumnNames.DATA_ID_COLUMN) @Indexed(index = "DataPE") @ClassBridge(impl = ExternalDataGlobalSearchBridge.class) diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/dto/ExtractableData.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/dto/ExtractableData.java index 37c78adae8b..838eacbfec0 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/dto/ExtractableData.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/dto/ExtractableData.java @@ -45,8 +45,7 @@ public class ExtractableData extends Code<ExtractableData> private List<NewProperty> dataSetProperties = new ArrayList<NewProperty>(); /** - * Returns the date when the measurement / calculation that produced this external data set has - * been performed. + * Returns the date when the measurement / calculation that produced this external data set has been performed. * <p> * This may not be known in which case this method will return <code>null</code>. */ @@ -56,8 +55,7 @@ public class ExtractableData extends Code<ExtractableData> } /** - * Sets the date when the measurement / calculation that produced this external data set has - * been performed. + * Sets the date when the measurement / calculation that produced this external data set has been performed. */ public void setProductionDate(final Date productionDate) { @@ -65,8 +63,7 @@ public class ExtractableData extends Code<ExtractableData> } /** - * Returns the code identifying the data source (i.e. measurement device or software pipeline) - * that produced this external data set. + * Returns the code identifying the data source (i.e. measurement device or software pipeline) that produced this external data set. * <p> * This may not be known in which case this method will return <code>null</code>. */ @@ -76,8 +73,7 @@ public class ExtractableData extends Code<ExtractableData> } /** - * Sets the code identifying the data source (i.e. measurement device or software pipeline) that - * produced this external data set. + * Sets the code identifying the data source (i.e. measurement device or software pipeline) that produced this external data set. */ public void setDataProducerCode(final String dataProducerCode) { diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/dto/HibernateAbstractRegistrationHolder.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/dto/HibernateAbstractRegistrationHolder.java index 601ff90a1bd..3266db2b79e 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/dto/HibernateAbstractRegistrationHolder.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/dto/HibernateAbstractRegistrationHolder.java @@ -33,8 +33,7 @@ import ch.systemsx.cisd.openbis.generic.shared.IServer; /** * Super class of <i>Persistent Entities</i> which hold registration data. * <p> - * <b>Note:</b> there is no <i>NOT-NULL</i> constraint applied to registrator (by comparison with - * the database where there almost one). + * <b>Note:</b> there is no <i>NOT-NULL</i> constraint applied to registrator (by comparison with the database where there almost one). * </p> * * @author Christian Ribeaud @@ -61,8 +60,7 @@ public abstract class HibernateAbstractRegistrationHolder implements Serializabl private Date registrationDate; /** - * Ensures that given <var>date</var> is a real one (<code>java.util.Date</code>) and not a - * <i>SQL</i> one. + * Ensures that given <var>date</var> is a real one (<code>java.util.Date</code>) and not a <i>SQL</i> one. */ public final static Date getDate(final Date date) { diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/dto/IEntityInformationWithPropertiesHolder.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/dto/IEntityInformationWithPropertiesHolder.java index 0494c6a7a2c..74cdba9ea52 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/dto/IEntityInformationWithPropertiesHolder.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/dto/IEntityInformationWithPropertiesHolder.java @@ -16,7 +16,6 @@ package ch.systemsx.cisd.openbis.generic.shared.dto; - /** * @author Piotr Buczek */ diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/dto/IIdAndCodeHolder.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/dto/IIdAndCodeHolder.java index 4c01667c26d..d4ff71b103f 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/dto/IIdAndCodeHolder.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/dto/IIdAndCodeHolder.java @@ -20,8 +20,7 @@ import ch.systemsx.cisd.openbis.generic.shared.basic.ICodeHolder; import ch.systemsx.cisd.openbis.generic.shared.basic.IIdHolder; /** - * Read-only interface for beans with a (unique) business code as a string and a unique technical - * ID. + * Read-only interface for beans with a (unique) business code as a string and a unique technical ID. * * @author Franz-Josef Elmer */ diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/dto/IMatchingEntity.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/dto/IMatchingEntity.java index 2c5257652e0..5dd8f95c268 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/dto/IMatchingEntity.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/dto/IMatchingEntity.java @@ -16,7 +16,6 @@ package ch.systemsx.cisd.openbis.generic.shared.dto; - /** * A entity that matches the <i>Hibernate Search</i> request. * diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/dto/IUntypedValueSetter.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/dto/IUntypedValueSetter.java index 9b6f071eb42..716ac9270c6 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/dto/IUntypedValueSetter.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/dto/IUntypedValueSetter.java @@ -19,7 +19,7 @@ package ch.systemsx.cisd.openbis.generic.shared.dto; /** * Holds the untyped property value. * - * @author Franz-Josef Elmer + * @author Franz-Josef Elmer */ public interface IUntypedValueSetter { diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/dto/LimitFilter.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/dto/LimitFilter.java index f486545c389..71f99308818 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/dto/LimitFilter.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/dto/LimitFilter.java @@ -24,8 +24,7 @@ import ch.systemsx.cisd.openbis.generic.shared.IServer; /** * A <i>Java Bean</i> that filters a list of results. * <p> - * Typically this filter is applied to results returned by the database before sending them to the - * client. + * Typically this filter is applied to results returned by the database before sending them to the client. * </p> * * @author Christian Ribeaud diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/dto/LocatorTypePE.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/dto/LocatorTypePE.java index 8d6a0086c01..f6d512fb8ca 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/dto/LocatorTypePE.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/dto/LocatorTypePE.java @@ -34,8 +34,8 @@ import ch.systemsx.cisd.openbis.generic.shared.IServer; */ @Entity @Table(name = TableNames.LOCATOR_TYPES_TABLE, uniqueConstraints = - { @UniqueConstraint(columnNames = - { ColumnNames.CODE_COLUMN }) }) +{ @UniqueConstraint(columnNames = +{ ColumnNames.CODE_COLUMN }) }) public final class LocatorTypePE extends AbstractTypePE { private static final long serialVersionUID = IServer.VERSION; diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/dto/MaterialPE.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/dto/MaterialPE.java index f6bbda01ef9..0b25fd44f29 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/dto/MaterialPE.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/dto/MaterialPE.java @@ -75,7 +75,7 @@ import ch.systemsx.cisd.openbis.generic.shared.util.HibernateUtils; */ @Entity @Table(name = TableNames.MATERIALS_TABLE, uniqueConstraints = @UniqueConstraint(columnNames = { ColumnNames.CODE_COLUMN, - ColumnNames.MATERIAL_TYPE_COLUMN }) ) + ColumnNames.MATERIAL_TYPE_COLUMN })) @Indexed(index = "MaterialPE") @ClassBridge(impl = MaterialGlobalSearchBridge.class) public class MaterialPE implements IIdAndCodeHolder, Comparable<MaterialPE>, diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/dto/MaterialPropertyPE.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/dto/MaterialPropertyPE.java index 7a3d932098a..1caed7ac6fe 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/dto/MaterialPropertyPE.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/dto/MaterialPropertyPE.java @@ -41,7 +41,7 @@ import ch.systemsx.cisd.openbis.generic.shared.IServer; */ @Entity @Table(name = TableNames.MATERIAL_PROPERTIES_TABLE, uniqueConstraints = @UniqueConstraint(columnNames = - { ColumnNames.MATERIAL_COLUMN, ColumnNames.MATERIAL_TYPE_PROPERTY_TYPE_COLUMN })) +{ ColumnNames.MATERIAL_COLUMN, ColumnNames.MATERIAL_TYPE_PROPERTY_TYPE_COLUMN })) @Cache(usage = CacheConcurrencyStrategy.READ_WRITE) public class MaterialPropertyPE extends EntityPropertyPE { diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/dto/MaterialTypePropertyTypePE.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/dto/MaterialTypePropertyTypePE.java index d5396161714..bc0a71ec568 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/dto/MaterialTypePropertyTypePE.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/dto/MaterialTypePropertyTypePE.java @@ -43,8 +43,8 @@ import ch.systemsx.cisd.openbis.generic.shared.IServer; */ @Entity @Table(name = TableNames.MATERIAL_TYPE_PROPERTY_TYPE_TABLE, uniqueConstraints = - { @UniqueConstraint(columnNames = - { ColumnNames.MATERIAL_TYPE_COLUMN, ColumnNames.PROPERTY_TYPE_COLUMN }) }) +{ @UniqueConstraint(columnNames = +{ ColumnNames.MATERIAL_TYPE_COLUMN, ColumnNames.PROPERTY_TYPE_COLUMN }) }) public class MaterialTypePropertyTypePE extends EntityTypePropertyTypePE { private static final long serialVersionUID = IServer.VERSION; diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/dto/MetaprojectPE.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/dto/MetaprojectPE.java index dccc0642dd2..ffb9ecead71 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/dto/MetaprojectPE.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/dto/MetaprojectPE.java @@ -62,7 +62,7 @@ import ch.systemsx.cisd.openbis.generic.shared.util.EqualsHashUtils; * @author Pawel Glyzewski */ @Entity -@Table(name = TableNames.METAPROJECTS_TABLE, uniqueConstraints = @UniqueConstraint(columnNames = { ColumnNames.NAME_COLUMN, ColumnNames.OWNER }) ) +@Table(name = TableNames.METAPROJECTS_TABLE, uniqueConstraints = @UniqueConstraint(columnNames = { ColumnNames.NAME_COLUMN, ColumnNames.OWNER })) public class MetaprojectPE implements Serializable, IIdHolder, ICodeHolder { private static final long serialVersionUID = IServer.VERSION; diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/dto/NewContainerDataSet.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/dto/NewContainerDataSet.java index 716f7da383c..e869a1e72d5 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/dto/NewContainerDataSet.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/dto/NewContainerDataSet.java @@ -37,6 +37,5 @@ public class NewContainerDataSet extends NewExternalData { this.containedDataSetCodes = containedDataSetCodes; } - - + } diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/dto/NewExternalData.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/dto/NewExternalData.java index 9f3fd67b3c8..c133c9119e0 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/dto/NewExternalData.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/dto/NewExternalData.java @@ -77,7 +77,7 @@ public class NewExternalData implements Serializable private ExperimentIdentifier experimentIdentifierOrNull; private SampleIdentifier sampleIdentifierOrNull; - + private String samplePermIdOrNull; public ExperimentIdentifier getExperimentIdentifierOrNull() @@ -237,10 +237,9 @@ public class NewExternalData implements Serializable } /** - * Returns {@link BooleanOrUnknown#T}, if the data set is complete in the data store and - * {@link BooleanOrUnknown#F}, if some parts of the data are missing. If the completeness is not - * known (e.g. because the data set is stored in a format that does not allow to assess the - * completeness, {@link BooleanOrUnknown#U} is returned. + * Returns {@link BooleanOrUnknown#T}, if the data set is complete in the data store and {@link BooleanOrUnknown#F}, if some parts of the data are + * missing. If the completeness is not known (e.g. because the data set is stored in a format that does not allow to assess the completeness, + * {@link BooleanOrUnknown#U} is returned. */ public final BooleanOrUnknown getComplete() { @@ -248,9 +247,8 @@ public class NewExternalData implements Serializable } /** - * Sets whether this data set is complete in the data store or not. The default is - * {@link BooleanOrUnknown#U}, which corresponds to the case where the data are stored in a - * format that does not allow to assess completeness. + * Sets whether this data set is complete in the data store or not. The default is {@link BooleanOrUnknown#U}, which corresponds to the case where + * the data are stored in a format that does not allow to assess completeness. */ public final void setComplete(final BooleanOrUnknown complete) { diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/dto/NewLinkDataSet.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/dto/NewLinkDataSet.java index a39104f066d..d0cbdcfe88f 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/dto/NewLinkDataSet.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/dto/NewLinkDataSet.java @@ -16,7 +16,6 @@ package ch.systemsx.cisd.openbis.generic.shared.dto; - /** * @author Jakub Straszewski */ diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/dto/NewProcessingInstruction.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/dto/NewProcessingInstruction.java index d83ba0c6f04..c2835d11bee 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/dto/NewProcessingInstruction.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/dto/NewProcessingInstruction.java @@ -25,7 +25,7 @@ import ch.systemsx.cisd.openbis.generic.shared.IServer; /** * Processing instruction is a specific experiment attachment. * - * @author Franz-Josef Elmer + * @author Franz-Josef Elmer */ public final class NewProcessingInstruction extends AbstractHashable implements Serializable { diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/dto/NewProperty.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/dto/NewProperty.java index 4141127fb1d..420f90e4ed6 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/dto/NewProperty.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/dto/NewProperty.java @@ -99,5 +99,4 @@ public class NewProperty implements Serializable return false; } - } diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/dto/OpenBISSessionHolder.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/dto/OpenBISSessionHolder.java index d858357f611..2b3cf73750f 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/dto/OpenBISSessionHolder.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/dto/OpenBISSessionHolder.java @@ -21,8 +21,7 @@ import java.io.Serializable; import ch.systemsx.cisd.common.server.ISessionTokenProvider; /** - * A class that holds information about the openBIS session. It has the information necessary to - * connect to any of the openBIS APIs. + * A class that holds information about the openBIS session. It has the information necessary to connect to any of the openBIS APIs. * * @author Kaloyan Enimanev */ diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/dto/ProcessingInstructionDTO.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/dto/ProcessingInstructionDTO.java index 3939f00a31e..3aa2f001c7d 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/dto/ProcessingInstructionDTO.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/dto/ProcessingInstructionDTO.java @@ -19,7 +19,7 @@ package ch.systemsx.cisd.openbis.generic.shared.dto; /** * Processing instruction needed to process raw data. * - * @author Franz-Josef Elmer + * @author Franz-Josef Elmer */ public class ProcessingInstructionDTO extends AbstractRegistrationHolder { diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/dto/ProcessingParameters.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/dto/ProcessingParameters.java index cc50c7ba12e..24ecca2459c 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/dto/ProcessingParameters.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/dto/ProcessingParameters.java @@ -21,10 +21,9 @@ import java.io.Serializable; import ch.systemsx.cisd.openbis.generic.shared.IServer; /** - * Processing parameters are a binary byte sequence from a file. It is stored BASE64 encoded in - * order to be marshalling and unmarshalling for SOAP. + * Processing parameters are a binary byte sequence from a file. It is stored BASE64 encoded in order to be marshalling and unmarshalling for SOAP. * - * @author Franz-Josef Elmer + * @author Franz-Josef Elmer */ public class ProcessingParameters implements Serializable { diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/dto/RoleAssignmentPE.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/dto/RoleAssignmentPE.java index c23baf199ba..f26512388b7 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/dto/RoleAssignmentPE.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/dto/RoleAssignmentPE.java @@ -55,136 +55,155 @@ import ch.systemsx.cisd.openbis.generic.shared.util.EqualsHashUtils; @Check(constraints = "((AG_ID_GRANTEE IS NOT NULL AND PERS_ID_GRANTEE IS NULL) OR (AG_ID_GRANTEE IS NULL AND PERS_ID_GRANTEE IS NOT NULL))") @Table(name = TableNames.ROLE_ASSIGNMENTS_TABLE) public final class RoleAssignmentPE extends HibernateAbstractRegistrationHolder - implements IIdHolder, Serializable { - - private static final long serialVersionUID = IServer.VERSION; - - public static final RoleAssignmentPE[] EMPTY_ARRAY = new RoleAssignmentPE[0]; - - private transient Long id; - - // private DatabaseInstancePE databaseInstance; - - private SpacePE space; - - private PersonPE person; - - private AuthorizationGroupPE authorizationGroup; - - private RoleCode role; - - @NotNull(message = ValidationMessages.ROLE_NOT_NULL_MESSAGE) - @Column(name = ColumnNames.ROLE_COLUMN) - @Enumerated(EnumType.STRING) - public final RoleCode getRole() { - return role; - } - - public final void setRole(final RoleCode role) { - this.role = role; - } - - @ManyToOne(fetch = FetchType.EAGER) - @JoinColumn(name = ColumnNames.PERSON_GRANTEE_COLUMN, updatable = false) - @Private - public final PersonPE getPersonInternal() { - return person; - } - - @Private - public final void setPersonInternal(final PersonPE person) { - this.person = person; - } - - @ManyToOne(fetch = FetchType.EAGER) - @JoinColumn(name = ColumnNames.AUTHORIZATION_GROUP_ID_GRANTEE_COLUMN, updatable = false) - @Private - public final AuthorizationGroupPE getAuthorizationGroupInternal() { - return authorizationGroup; - } - - @Private - public final void setAuthorizationGroupInternal( - final AuthorizationGroupPE authorizationGroup) { - this.authorizationGroup = authorizationGroup; - } - - @Transient - public final PersonPE getPerson() { - return getPersonInternal(); - } - - @Transient - public final AuthorizationGroupPE getAuthorizationGroup() { - return getAuthorizationGroupInternal(); - } - - public final void setId(final Long id) { - this.id = id; - } - - @ManyToOne(fetch = FetchType.EAGER) - @JoinColumn(name = ColumnNames.SPACE_COLUMN, updatable = false) - public final SpacePE getSpace() { - return space; - } - - public final void setSpace(final SpacePE space) { - this.space = space; - } - - // - // IIdHolder - // - - @Override - @SequenceGenerator(name = SequenceNames.ROLE_ASSIGNMENT_SEQUENCE, sequenceName = SequenceNames.ROLE_ASSIGNMENT_SEQUENCE, allocationSize = 1) - @Id - @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = SequenceNames.ROLE_ASSIGNMENT_SEQUENCE) - public final Long getId() { - return id; - } - - // - // Object - // - - @Override - public final boolean equals(final Object obj) { - EqualsHashUtils.assertDefined(getRole(), "role"); - if (getPerson() == null) { - EqualsHashUtils.assertDefined(getAuthorizationGroupInternal(), - "authorization group"); - } - - if (obj == this) { - return true; - } - if (obj instanceof RoleAssignmentPE == false) { - return false; - } - final RoleAssignmentPE that = (RoleAssignmentPE) obj; - final EqualsBuilder builder = new EqualsBuilder(); - builder.append(getRole(), that.getRole()); - builder.append(getPerson(), that.getPerson()); - builder.append(getAuthorizationGroup(), that.getAuthorizationGroup()); - builder.append(getSpace(), that.getSpace()); - return builder.isEquals(); - } - - @Override - public final int hashCode() { - final HashCodeBuilder builder = new HashCodeBuilder(); - builder.append(getRole()); - builder.append(getPerson()); - builder.append(getSpace()); - return builder.toHashCode(); - } - - @Override - public final String toString() { - return ToStringBuilder.reflectionToString(this, - ModifiedShortPrefixToStringStyle.MODIFIED_SHORT_PREFIX_STYLE); - } + implements IIdHolder, Serializable +{ + + private static final long serialVersionUID = IServer.VERSION; + + public static final RoleAssignmentPE[] EMPTY_ARRAY = new RoleAssignmentPE[0]; + + private transient Long id; + + // private DatabaseInstancePE databaseInstance; + + private SpacePE space; + + private PersonPE person; + + private AuthorizationGroupPE authorizationGroup; + + private RoleCode role; + + @NotNull(message = ValidationMessages.ROLE_NOT_NULL_MESSAGE) + @Column(name = ColumnNames.ROLE_COLUMN) + @Enumerated(EnumType.STRING) + public final RoleCode getRole() + { + return role; + } + + public final void setRole(final RoleCode role) + { + this.role = role; + } + + @ManyToOne(fetch = FetchType.EAGER) + @JoinColumn(name = ColumnNames.PERSON_GRANTEE_COLUMN, updatable = false) + @Private + public final PersonPE getPersonInternal() + { + return person; + } + + @Private + public final void setPersonInternal(final PersonPE person) + { + this.person = person; + } + + @ManyToOne(fetch = FetchType.EAGER) + @JoinColumn(name = ColumnNames.AUTHORIZATION_GROUP_ID_GRANTEE_COLUMN, updatable = false) + @Private + public final AuthorizationGroupPE getAuthorizationGroupInternal() + { + return authorizationGroup; + } + + @Private + public final void setAuthorizationGroupInternal( + final AuthorizationGroupPE authorizationGroup) + { + this.authorizationGroup = authorizationGroup; + } + + @Transient + public final PersonPE getPerson() + { + return getPersonInternal(); + } + + @Transient + public final AuthorizationGroupPE getAuthorizationGroup() + { + return getAuthorizationGroupInternal(); + } + + public final void setId(final Long id) + { + this.id = id; + } + + @ManyToOne(fetch = FetchType.EAGER) + @JoinColumn(name = ColumnNames.SPACE_COLUMN, updatable = false) + public final SpacePE getSpace() + { + return space; + } + + public final void setSpace(final SpacePE space) + { + this.space = space; + } + + // + // IIdHolder + // + + @Override + @SequenceGenerator(name = SequenceNames.ROLE_ASSIGNMENT_SEQUENCE, sequenceName = SequenceNames.ROLE_ASSIGNMENT_SEQUENCE, allocationSize = 1) + @Id + @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = SequenceNames.ROLE_ASSIGNMENT_SEQUENCE) + public final Long getId() + { + return id; + } + + // + // Object + // + + @Override + public final boolean equals(final Object obj) + { + EqualsHashUtils.assertDefined(getRole(), "role"); + if (getPerson() == null) + { + EqualsHashUtils.assertDefined(getAuthorizationGroupInternal(), + "authorization group"); + } + + if (obj == this) + { + return true; + } + if (obj instanceof RoleAssignmentPE == false) + { + return false; + } + final RoleAssignmentPE that = (RoleAssignmentPE) obj; + final EqualsBuilder builder = new EqualsBuilder(); + builder.append(getRole(), that.getRole()); + builder.append(getPerson(), that.getPerson()); + builder.append(getAuthorizationGroup(), that.getAuthorizationGroup()); + builder.append(getSpace(), that.getSpace()); + return builder.isEquals(); + } + + @Override + public final int hashCode() + { + final HashCodeBuilder builder = new HashCodeBuilder(); + builder.append(getRole()); + builder.append(getPerson()); + builder.append(getSpace()); + return builder.toHashCode(); + } + + @Override + public final String toString() + { + return ToStringBuilder.reflectionToString(this, + ModifiedShortPrefixToStringStyle.MODIFIED_SHORT_PREFIX_STYLE); + } } diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/dto/SampleParentWithDerivedDTO.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/dto/SampleParentWithDerivedDTO.java index ecc88027db6..798f1dcd00d 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/dto/SampleParentWithDerivedDTO.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/dto/SampleParentWithDerivedDTO.java @@ -22,8 +22,7 @@ import java.util.List; import ch.systemsx.cisd.openbis.generic.shared.IServer; /** - * A <code>SampleParentWithDerivedDTO</code> encapsulates a <code>SamplePE</code> (the parent) and - * its derived <code>SamplePE</code>s. + * A <code>SampleParentWithDerivedDTO</code> encapsulates a <code>SamplePE</code> (the parent) and its derived <code>SamplePE</code>s. * * @author Christian Ribeaud */ diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/dto/SamplePropertyPE.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/dto/SamplePropertyPE.java index 31ba368dcbb..59c55b21ffa 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/dto/SamplePropertyPE.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/dto/SamplePropertyPE.java @@ -41,8 +41,8 @@ import ch.systemsx.cisd.openbis.generic.shared.IServer; */ @Entity @Table(name = TableNames.SAMPLE_PROPERTIES_TABLE, uniqueConstraints = - { @UniqueConstraint(columnNames = - { ColumnNames.SAMPLE_COLUMN, ColumnNames.SAMPLE_TYPE_PROPERTY_TYPE_COLUMN }) }) +{ @UniqueConstraint(columnNames = +{ ColumnNames.SAMPLE_COLUMN, ColumnNames.SAMPLE_TYPE_PROPERTY_TYPE_COLUMN }) }) @Cache(usage = CacheConcurrencyStrategy.READ_WRITE) public class SamplePropertyPE extends EntityPropertyPE { diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/dto/SampleRelationshipPE.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/dto/SampleRelationshipPE.java index b8fd693e010..de6a5792736 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/dto/SampleRelationshipPE.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/dto/SampleRelationshipPE.java @@ -53,7 +53,7 @@ import ch.systemsx.cisd.openbis.generic.shared.IServer; @Table(name = TableNames.SAMPLE_RELATIONSHIPS_VIEW, uniqueConstraints = @UniqueConstraint(columnNames = { ColumnNames.PARENT_SAMPLE_COLUMN, ColumnNames.CHILD_SAMPLE_COLUMN, ColumnNames.RELATIONSHIP_COLUMN })) -@TypeDefs({@TypeDef(name="transactiontimestamp", typeClass=DbTimestampType.class)}) +@TypeDefs({ @TypeDef(name = "transactiontimestamp", typeClass = DbTimestampType.class) }) public class SampleRelationshipPE implements Serializable { private static final long serialVersionUID = IServer.VERSION; diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/dto/SampleSkeleton.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/dto/SampleSkeleton.java index 79265eac888..16a57c23052 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/dto/SampleSkeleton.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/dto/SampleSkeleton.java @@ -24,13 +24,13 @@ package ch.systemsx.cisd.openbis.generic.shared.dto; public class SampleSkeleton { private long id; - + private Long databaseInstanceID; - + private Long spaceID; - + private long typeID; - + private Long experimentID; public final long getId() @@ -82,5 +82,5 @@ public class SampleSkeleton { this.experimentID = experimentID; } - + } diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/dto/SampleTypePropertyTypePE.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/dto/SampleTypePropertyTypePE.java index 40878e679f1..b0ce1a8ef02 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/dto/SampleTypePropertyTypePE.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/dto/SampleTypePropertyTypePE.java @@ -43,8 +43,8 @@ import ch.systemsx.cisd.openbis.generic.shared.IServer; */ @Entity @Table(name = TableNames.SAMPLE_TYPE_PROPERTY_TYPE_TABLE, uniqueConstraints = - { @UniqueConstraint(columnNames = - { ColumnNames.SAMPLE_TYPE_COLUMN, ColumnNames.PROPERTY_TYPE_COLUMN }) }) +{ @UniqueConstraint(columnNames = +{ ColumnNames.SAMPLE_TYPE_COLUMN, ColumnNames.PROPERTY_TYPE_COLUMN }) }) public class SampleTypePropertyTypePE extends EntityTypePropertyTypePE { private static final long serialVersionUID = IServer.VERSION; diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/dto/StorageFormat.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/dto/StorageFormat.java index ffc0cec5efd..8109a009890 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/dto/StorageFormat.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/dto/StorageFormat.java @@ -31,8 +31,7 @@ public enum StorageFormat /** The proprietary data format as acquired from the measurement device. */ PROPRIETARY("PROPRIETARY"), /** - * The standardized data according to the Biological Data Standard format, using a directory - * container. + * The standardized data according to the Biological Data Standard format, using a directory container. */ BDS_DIRECTORY("BDS_DIRECTORY"); @@ -67,8 +66,7 @@ public enum StorageFormat } /** - * Returns the appropriate format for the given <var>code</var>, or <code>null</code>, if there - * is no format for this <var>code</var>. + * Returns the appropriate format for the given <var>code</var>, or <code>null</code>, if there is no format for this <var>code</var>. */ public final static StorageFormat tryGetFromCode(final String code) { diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/dto/TimeInterval.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/dto/TimeInterval.java index 872261eb900..baa52962c55 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/dto/TimeInterval.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/dto/TimeInterval.java @@ -32,7 +32,7 @@ import ch.systemsx.cisd.openbis.generic.shared.IServer; * Note that both dates can be <code>null</code>. * </p> * - * @author Franz-Josef Elmer + * @author Franz-Josef Elmer */ public final class TimeInterval implements Serializable { diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/dto/VocabularyTermPE.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/dto/VocabularyTermPE.java index 74b31aad53c..9ed2801e11e 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/dto/VocabularyTermPE.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/dto/VocabularyTermPE.java @@ -55,8 +55,8 @@ import ch.systemsx.cisd.openbis.generic.shared.util.EqualsHashUtils; */ @Entity @Table(name = TableNames.CONTROLLED_VOCABULARY_TERM_TABLE, uniqueConstraints = - { @UniqueConstraint(columnNames = - { ColumnNames.CODE_COLUMN, ColumnNames.CONTROLLED_VOCABULARY_COLUMN }) }) +{ @UniqueConstraint(columnNames = +{ ColumnNames.CODE_COLUMN, ColumnNames.CONTROLLED_VOCABULARY_COLUMN }) }) public class VocabularyTermPE extends HibernateAbstractRegistrationHolder implements IIdAndCodeHolder, Comparable<VocabularyTermPE>, Serializable { diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/dto/hibernate/InternalNamespace.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/dto/hibernate/InternalNamespace.java index 7d59e99a298..38eb95e3a54 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/dto/hibernate/InternalNamespace.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/dto/hibernate/InternalNamespace.java @@ -28,13 +28,12 @@ import javax.validation.Constraint; import javax.validation.Payload; /** - * <code>boolean</code> value has to be <code>false</code> for entities that must not be in the - * internal namespace. + * <code>boolean</code> value has to be <code>false</code> for entities that must not be in the internal namespace. * * @author Christian Ribeaud */ @Target( - { METHOD, FIELD }) +{ METHOD, FIELD }) @Retention(RetentionPolicy.RUNTIME) @Documented @Constraint(validatedBy = InternalNamespaceValidator.class) diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/dto/hibernate/Location.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/dto/hibernate/Location.java index 4e6897cc382..23bf12b0e80 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/dto/hibernate/Location.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/dto/hibernate/Location.java @@ -33,7 +33,7 @@ import javax.validation.Payload; * @author Christian Ribeaud */ @Target( - { METHOD, FIELD }) +{ METHOD, FIELD }) @Retention(RetentionPolicy.RUNTIME) @Documented @Constraint(validatedBy = LocationValidator.class) diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/dto/hibernate/SearchFieldConstants.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/dto/hibernate/SearchFieldConstants.java index b1c5d38a57d..cc113acfe29 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/dto/hibernate/SearchFieldConstants.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/dto/hibernate/SearchFieldConstants.java @@ -56,10 +56,10 @@ public final class SearchFieldConstants public static final String PREFIX_METAPROJECT = "metaproject" + SEPARATOR; public static final String[] PREFIXES = - { PREFIX_PROPERTIES, PREFIX_EXPERIMENT, PREFIX_SAMPLE, PREFIX_ENTITY_TYPE, - PREFIX_FILE_FORMAT_TYPE, PREFIX_FILE_FORMAT_TYPE, PREFIX_PROJECT, PREFIX_SPACE, - PREFIX_REGISTRATOR, PREFIX_ATTACHMENT, PREFIX_PROPERTIES + PREFIX_VOCABULARY_TERM, - PREFIX_METAPROJECT }; + { PREFIX_PROPERTIES, PREFIX_EXPERIMENT, PREFIX_SAMPLE, PREFIX_ENTITY_TYPE, + PREFIX_FILE_FORMAT_TYPE, PREFIX_FILE_FORMAT_TYPE, PREFIX_PROJECT, PREFIX_SPACE, + PREFIX_REGISTRATOR, PREFIX_ATTACHMENT, PREFIX_PROPERTIES + PREFIX_VOCABULARY_TERM, + PREFIX_METAPROJECT }; public static final String ID = "id"; diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/dto/hibernate/SortableNumberBridgeUtils.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/dto/hibernate/SortableNumberBridgeUtils.java index 27b081c1ac0..7ebe53b2e5c 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/dto/hibernate/SortableNumberBridgeUtils.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/dto/hibernate/SortableNumberBridgeUtils.java @@ -5,52 +5,68 @@ public class SortableNumberBridgeUtils // // Util Methods // - private static int LUCENE_INTEGER_PADDING = 19; //On the UI a integer field can't have more than 18 characters, a long can have 19 taking out the minus sign - - public static String getNumberForLucene(String number) { - try { + private static int LUCENE_INTEGER_PADDING = 19; // On the UI a integer field can't have more than 18 characters, a long can have 19 taking out the + // minus sign + + public static String getNumberForLucene(String number) + { + try + { return getNumberForLucene(Long.parseLong(number)); - } catch(Exception ex) { - try { + } catch (Exception ex) + { + try + { return getNumberForLucene(Double.parseDouble(number)); - } catch(Exception ex2) { + } catch (Exception ex2) + { return number; } } } - - private static String getNumberForLucene(Number number) { - if(number instanceof Integer || number instanceof Long) { + + private static String getNumberForLucene(Number number) + { + if (number instanceof Integer || number instanceof Long) + { return getIntegerAsStringForLucene(number) + ".0"; - } if(number instanceof Float || number instanceof Double) { + } + if (number instanceof Float || number instanceof Double) + { String rawReal = number.toString(); int indexOfDot = rawReal.indexOf('.'); return getIntegerAsStringForLucene(Long.parseLong(rawReal.substring(0, indexOfDot))) + rawReal.substring(indexOfDot, rawReal.length()); - } else { + } else + { return number.toString(); } } - - private static String getIntegerAsStringForLucene(Number number) { + + private static String getIntegerAsStringForLucene(Number number) + { String rawInteger = number.toString(); - + StringBuilder paddedInteger = new StringBuilder(); - - if(rawInteger.startsWith("-")) { + + if (rawInteger.startsWith("-")) + { rawInteger = rawInteger.substring(1, rawInteger.length()); paddedInteger.append('-'); - } else { + } else + { paddedInteger.append('+'); } - - if (rawInteger.length() > LUCENE_INTEGER_PADDING) { - throw new IllegalArgumentException( "Try to pad on a number too big" ); + + if (rawInteger.length() > LUCENE_INTEGER_PADDING) + { + throw new IllegalArgumentException("Try to pad on a number too big"); } - - for ( int padIndex = rawInteger.length() ; padIndex < LUCENE_INTEGER_PADDING ; padIndex++ ) { + + for (int padIndex = rawInteger.length(); padIndex < LUCENE_INTEGER_PADDING; padIndex++) + { paddedInteger.append('0'); } - + paddedInteger.append(rawInteger); return paddedInteger.toString(); } diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/dto/identifier/LocalExperimentIdentifier.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/dto/identifier/LocalExperimentIdentifier.java index 2429394a21b..6190df5f620 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/dto/identifier/LocalExperimentIdentifier.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/dto/identifier/LocalExperimentIdentifier.java @@ -21,8 +21,7 @@ import java.io.Serializable; import ch.systemsx.cisd.openbis.generic.shared.IServer; /** - * Identifies the experiment. This identifier points to an experiment if a group and database - * instance is provided in addition. + * Identifies the experiment. This identifier points to an experiment if a group and database instance is provided in addition. * * @author Tomasz Pylak */ diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/dto/types/DataSetTypeCode.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/dto/types/DataSetTypeCode.java index a2cbcc93449..5cb4314baf0 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/dto/types/DataSetTypeCode.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/dto/types/DataSetTypeCode.java @@ -19,8 +19,7 @@ package ch.systemsx.cisd.openbis.generic.shared.dto.types; /** * The current <code>DataSetType</code> codes. * <p> - * This enumeration should reflect the values in the database and is <i>Unit</i> tested to ensure - * this point. + * This enumeration should reflect the values in the database and is <i>Unit</i> tested to ensure this point. * </p> * * @author Christian Ribeaud diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/dto/types/ExperimentTypeCode.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/dto/types/ExperimentTypeCode.java index 1bd6015c4b4..4486b132661 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/dto/types/ExperimentTypeCode.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/dto/types/ExperimentTypeCode.java @@ -19,8 +19,7 @@ package ch.systemsx.cisd.openbis.generic.shared.dto.types; /** * The current <code>ExperimentType</code> codes. * <p> - * This enumeration should reflect the values in the database and is <i>Unit</i> tested to ensure - * this point. + * This enumeration should reflect the values in the database and is <i>Unit</i> tested to ensure this point. * </p> * * @author Christian Ribeaud diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/managed_property/SimpleTableModelBuilderAdaptor.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/managed_property/SimpleTableModelBuilderAdaptor.java index 2e70fd56fa5..d058fb07638 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/managed_property/SimpleTableModelBuilderAdaptor.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/managed_property/SimpleTableModelBuilderAdaptor.java @@ -29,11 +29,10 @@ import ch.systemsx.cisd.openbis.generic.shared.util.IRowBuilder; import ch.systemsx.cisd.openbis.generic.shared.util.SimpleTableModelBuilder; /** - * An {@link ISimpleTableModelBuilderAdaptor} implementation adapting - * {@link SimpleTableModelBuilder}. + * An {@link ISimpleTableModelBuilderAdaptor} implementation adapting {@link SimpleTableModelBuilder}. * <p> - * The intent of the interface and adaptor is not to expose {@link SimpleTableModelBuilder} - * interface in Managed Property API and optionally add convenience methods for scripts. + * The intent of the interface and adaptor is not to expose {@link SimpleTableModelBuilder} interface in Managed Property API and optionally add + * convenience methods for scripts. * * @author Piotr Buczek */ diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/managed_property/api/EntityLinkElementKind.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/managed_property/api/EntityLinkElementKind.java index 1cc88d3e6d7..7aa03d27b32 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/managed_property/api/EntityLinkElementKind.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/managed_property/api/EntityLinkElementKind.java @@ -60,8 +60,7 @@ public enum EntityLinkElementKind } /** - * @return the {@link EntityLinkElementKind} for a given element name or <code>null</code> if no - * matching kind exists. + * @return the {@link EntityLinkElementKind} for a given element name or <code>null</code> if no matching kind exists. */ public static EntityLinkElementKind tryGetForElementName(String elementName) { diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/managed_property/api/IElement.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/managed_property/api/IElement.java index 3fb13c82324..091b1b1d2dc 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/managed_property/api/IElement.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/managed_property/api/IElement.java @@ -20,12 +20,10 @@ import java.util.List; import java.util.Map; /** - * An {@link IElement} is an object that can be transparently converted to {@link String} (see - * {@link IStructuredPropertyConverter}) e.g. when we want to save the value of a structured - * (managed) property. + * An {@link IElement} is an object that can be transparently converted to {@link String} (see {@link IStructuredPropertyConverter}) e.g. when we want + * to save the value of a structured (managed) property. * <p> - * {@link IElement}-s are meant to be used as a convenient, hierarchical property-value persistence - * technique for managed properties. + * {@link IElement}-s are meant to be used as a convenient, hierarchical property-value persistence technique for managed properties. * * @author Piotr Buczek * @author Kaloyan Enimanev @@ -46,14 +44,12 @@ public interface IElement String getAttribute(String key); /** - * @return the value of an attribute or <code>defaultValue</code> if the attribute is not - * defined for this {@link IElement} + * @return the value of an attribute or <code>defaultValue</code> if the attribute is not defined for this {@link IElement} */ String getAttribute(String key, String defaultValue); /** - * The "Data" field is intended for a chunk raw data that can be attached to an element - * instance. This might be useful in scenarios where + * The "Data" field is intended for a chunk raw data that can be attached to an element instance. This might be useful in scenarios where */ String getData(); diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/managed_property/api/IElementFactory.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/managed_property/api/IElementFactory.java index ca1ea3bb521..207e56b7876 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/managed_property/api/IElementFactory.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/managed_property/api/IElementFactory.java @@ -46,15 +46,13 @@ public interface IElementFactory IEntityLinkElement createDataSetLink(String permId); /** - * @return creates an link element pointing towards a material with given code and typeCode - * parameters. + * @return creates an link element pointing towards a material with given code and typeCode parameters. */ IEntityLinkElement createMaterialLink(String code, String typeCode); /** - * @return <code>true</code> if the specified element is a link element, <code>false</code> - * otherwise. This method might come handy in Jython scripts, where it is undesirable to - * hard-code class names or invoke "instanceof". + * @return <code>true</code> if the specified element is a link element, <code>false</code> otherwise. This method might come handy in Jython + * scripts, where it is undesirable to hard-code class names or invoke "instanceof". */ boolean isEntityLink(IElement element); diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/managed_property/api/IEntityInformationProvider.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/managed_property/api/IEntityInformationProvider.java index 829d4b47ca1..161f675ac98 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/managed_property/api/IEntityInformationProvider.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/managed_property/api/IEntityInformationProvider.java @@ -27,20 +27,17 @@ import java.util.List; public interface IEntityInformationProvider { /** - * @return identifier of entity specified by given link, <code>null</code> if such an entity - * doesn't exist + * @return identifier of entity specified by given link, <code>null</code> if such an entity doesn't exist */ String getIdentifier(IEntityLinkElement entityLink); /** - * @return permId of sample specified by given space and code, <code>null</code> if such a - * sample doesn't exist + * @return permId of sample specified by given space and code, <code>null</code> if such a sample doesn't exist */ String getSamplePermId(String spaceCode, String sampleCode); /** - * @return permId of sample specified by given identifier, <code>null</code> if such a sample - * doesn't exist + * @return permId of sample specified by given identifier, <code>null</code> if such a sample doesn't exist */ String getSamplePermId(String sampleIdentifier); @@ -55,8 +52,7 @@ public interface IEntityInformationProvider List<String> getSampleParentPermIds(String permId); /** - * @return value of a property with given code of a sample with given permIds, empty string if - * the property doesn't exist + * @return value of a property with given code of a sample with given permIds, empty string if the property doesn't exist */ String getSamplePropertyValue(String permId, String propertyCode); } diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/managed_property/api/IRowBuilderAdaptor.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/managed_property/api/IRowBuilderAdaptor.java index 19a7d8d3dde..a72f4d0d731 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/managed_property/api/IRowBuilderAdaptor.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/managed_property/api/IRowBuilderAdaptor.java @@ -49,14 +49,12 @@ public interface IRowBuilderAdaptor public void setCell(String headerTitle, Date value); /** - * Sets the value of the column specified by the header title to the specified entity link - * rendered using identifier. + * Sets the value of the column specified by the header title to the specified entity link rendered using identifier. */ public void setCell(String headerTitle, IEntityLinkElement value); /** - * Sets the value of the column specified by the header title to the specified entity link - * rendered using given text. + * Sets the value of the column specified by the header title to the specified entity link rendered using given text. */ public void setCell(String headerTitle, IEntityLinkElement value, String linkText); diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/managed_property/api/ISimpleTableModelBuilderAdaptor.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/managed_property/api/ISimpleTableModelBuilderAdaptor.java index 540fe223c71..a706c58bba8 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/managed_property/api/ISimpleTableModelBuilderAdaptor.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/managed_property/api/ISimpleTableModelBuilderAdaptor.java @@ -60,8 +60,7 @@ public interface ISimpleTableModelBuilderAdaptor void addHeader(String title, String code); /** - * A convenience method for adding complete header with columns with specified titles and - * default column width 150. + * A convenience method for adding complete header with columns with specified titles and default column width 150. * * @throws UserFailureException if header titles are not unique. */ diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/managed_property/api/IStructuredPropertyConverter.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/managed_property/api/IStructuredPropertyConverter.java index 76ef98deebb..227d83a422b 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/managed_property/api/IStructuredPropertyConverter.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/managed_property/api/IStructuredPropertyConverter.java @@ -44,8 +44,7 @@ public interface IStructuredPropertyConverter List<IElement> convertStringToElements(String propertyValue); /** - * @return a {@link String} representation of the specified elements that can be persisted in - * the database. + * @return a {@link String} representation of the specified elements that can be persisted in the database. */ String convertToString(List<IElement> elements); diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/managed_property/structured/ElementFactory.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/managed_property/structured/ElementFactory.java index 120103d700e..9152f11a2e0 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/managed_property/structured/ElementFactory.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/managed_property/structured/ElementFactory.java @@ -23,8 +23,8 @@ import ch.systemsx.cisd.openbis.generic.shared.managed_property.api.IElementFact import ch.systemsx.cisd.openbis.generic.shared.managed_property.api.IEntityLinkElement; /** - * For now we only expose methods for creation of Sample and Material links, but it is quite easy to - * add support for experiment and datasets links in the future. + * For now we only expose methods for creation of Sample and Material links, but it is quite easy to add support for experiment and datasets links in + * the future. * * @author Kaloyan Enimanev */ diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/managed_property/structured/XmlOrJsonStructuredPropertyConverter.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/managed_property/structured/XmlOrJsonStructuredPropertyConverter.java index 8b1680908c9..cdc8bd8a825 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/managed_property/structured/XmlOrJsonStructuredPropertyConverter.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/managed_property/structured/XmlOrJsonStructuredPropertyConverter.java @@ -24,8 +24,8 @@ import ch.systemsx.cisd.openbis.generic.shared.managed_property.api.IElement; import ch.systemsx.cisd.openbis.generic.shared.managed_property.api.IStructuredPropertyConverter; /** - * An implementation of {@link IStructuredPropertyConverter}, that translates elements either to XML - * or to JSON and that can translate back both formats. + * An implementation of {@link IStructuredPropertyConverter}, that translates elements either to XML or to JSON and that can translate back both + * formats. * * @author Bernd Rinn */ diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/parser/BisExcelFileLoader.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/parser/BisExcelFileLoader.java index 56556fce0f7..f0159c65f3b 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/parser/BisExcelFileLoader.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/parser/BisExcelFileLoader.java @@ -30,8 +30,8 @@ import ch.systemsx.cisd.common.parser.ParsingException; import ch.systemsx.cisd.common.parser.TabFileLoader; /** - * A <i>openBIS</i> {@link TabFileLoader} extension which translates a {@link ParsingException} into - * a more user friendly {@link UserFailureException}. + * A <i>openBIS</i> {@link TabFileLoader} extension which translates a {@link ParsingException} into a more user friendly {@link UserFailureException} + * . * <p> * Note that this extension prefers to work with {@link NamedReader}. * </p> diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/parser/BisTabFileLoader.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/parser/BisTabFileLoader.java index 5f80d90cb4f..d67b040411f 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/parser/BisTabFileLoader.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/parser/BisTabFileLoader.java @@ -28,8 +28,8 @@ import ch.systemsx.cisd.common.parser.ParsingException; import ch.systemsx.cisd.common.parser.TabFileLoader; /** - * A <i>openBIS</i> {@link TabFileLoader} extension which translates a {@link ParsingException} into - * a more user friendly {@link UserFailureException}. + * A <i>openBIS</i> {@link TabFileLoader} extension which translates a {@link ParsingException} into a more user friendly {@link UserFailureException} + * . * <p> * Note that this extension prefers to work with {@link NamedReader}. * </p> diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/parser/GlobalProperties.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/parser/GlobalProperties.java index c35035444ab..36e14c0f72f 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/parser/GlobalProperties.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/parser/GlobalProperties.java @@ -32,8 +32,7 @@ public class GlobalProperties } /** - * Adds property with given key and value.Throws {@link IllegalArgumentException} if property - * already defined. + * Adds property with given key and value.Throws {@link IllegalArgumentException} if property already defined. */ public void add(String key, String value) { @@ -45,8 +44,7 @@ public class GlobalProperties } /** - * Returns value of given property. Throws {@link IllegalArgumentException} if property not - * defined. + * Returns value of given property. Throws {@link IllegalArgumentException} if property not defined. */ public String get(String key) { diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/parser/GlobalPropertiesLoader.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/parser/GlobalPropertiesLoader.java index 32497f1cbf5..1648b99ec91 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/parser/GlobalPropertiesLoader.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/parser/GlobalPropertiesLoader.java @@ -28,9 +28,8 @@ import org.apache.commons.lang.StringUtils; /** * Loads global properties. * <p> - * Global properties are defined as comments and start with a line - * <code>#! GLOBAL_PROPERTIES:</code> (followed by a new line character.) Each property is defined - * in a separate line and has the following format: + * Global properties are defined as comments and start with a line <code>#! GLOBAL_PROPERTIES:</code> (followed by a new line character.) Each + * property is defined in a separate line and has the following format: * <p> * #! key = value * </p> diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/parser/UpdatedSampleParserObjectFactory.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/parser/UpdatedSampleParserObjectFactory.java index 553e1857646..8210dca8d28 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/parser/UpdatedSampleParserObjectFactory.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/parser/UpdatedSampleParserObjectFactory.java @@ -47,8 +47,8 @@ final class UpdatedSampleParserObjectFactory extends NewSampleParserObjectFactor } /** - * Prepares details about which values should be updated in general taking into account only the - * information about availability of columns in the file. + * Prepares details about which values should be updated in general taking into account only the information about availability of columns in the + * file. */ private SampleBatchUpdateDetails createBasicBatchUpdateDetails() { @@ -85,8 +85,8 @@ final class UpdatedSampleParserObjectFactory extends NewSampleParserObjectFactor // /** - * Returns details about which values should be updated for the specified sample. If a cell was - * left empty in the file the corresponding value will not be modified. + * Returns details about which values should be updated for the specified sample. If a cell was left empty in the file the corresponding value + * will not be modified. */ private SampleBatchUpdateDetails createBatchUpdateDetails(NewSample newSample) { diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/translator/DeletedEntityTranslator.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/translator/DeletedEntityTranslator.java index bcadfbd6cf8..d6042791c0b 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/translator/DeletedEntityTranslator.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/translator/DeletedEntityTranslator.java @@ -31,8 +31,8 @@ import ch.systemsx.cisd.openbis.generic.shared.dto.PropertyTypePE; import ch.systemsx.cisd.openbis.generic.shared.dto.SampleTypePE; /** - * A generic translator for deleted entities. In the future, if we need to access specific fields of - * a deleted entity in the UI we'll have to create a DTO layer of deleted object. + * A generic translator for deleted entities. In the future, if we need to access specific fields of a deleted entity in the UI we'll have to create a + * DTO layer of deleted object. * <p> * For now, a single DeletedEntity covers all required uses cases of the trash can. * diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/translator/PropertyTranslatorUtils.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/translator/PropertyTranslatorUtils.java index 88358f6ae0f..1cdf9509e8b 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/translator/PropertyTranslatorUtils.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/translator/PropertyTranslatorUtils.java @@ -59,8 +59,7 @@ final class PropertyTranslatorUtils } /** - * Creates an appropriate {@link IEntityProperty} for the given <var>propertyPE</var> based on - * its type. + * Creates an appropriate {@link IEntityProperty} for the given <var>propertyPE</var> based on its type. */ static IEntityProperty createEntityProperty(EntityPropertyPE propertyPE) { diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/util/CacheManager.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/util/CacheManager.java index 8c9f00f26fc..ec689118618 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/util/CacheManager.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/util/CacheManager.java @@ -111,9 +111,9 @@ public class CacheManager implements ICacheManager { timeStamp = new Date(timeProvider.getTimeInMilliseconds()); fileName = new MessageFormat(FILE_NAME_FORMAT).format(new Object[] - { timeStamp, counter++ }); + { timeStamp, counter++ }); } - + @Override public String toString() { @@ -122,28 +122,46 @@ public class CacheManager implements ICacheManager } private static final int DAY = 24 * 60 * 60 * 1000; - @Private public static final String CACHE_FOLDER_KEY = "cache-folder"; + + @Private + public static final String CACHE_FOLDER_KEY = "cache-folder"; + private static final String CACHE_FOLDER_DEFAULT_VALUE = "cache"; - @Private static final String MINIMUM_FREE_DISK_SPACE_KEY = "minimum-free-disk-space-in-MB"; + + @Private + static final String MINIMUM_FREE_DISK_SPACE_KEY = "minimum-free-disk-space-in-MB"; + private static final int MINIMUM_FREE_DISK_SPACE_DEFAULT_VALUE = 1024; - @Private static final String MAXIMUM_RETENTION_TIME_KEY = "maximum-retention-time-in-days"; + + @Private + static final String MAXIMUM_RETENTION_TIME_KEY = "maximum-retention-time-in-days"; + private static final int MAXIMUM_RETENTION_TIME_DEFAULT_VALUE = 7; - - @Private static final String CACHE_VERSION_FILE_NAME = ".cache-version"; - @Private static final String KEY_FILE_TYPE = ".key"; - @Private static final String DATA_FILE_TYPE = ".data"; - + + @Private + static final String CACHE_VERSION_FILE_NAME = ".cache-version"; + + @Private + static final String KEY_FILE_TYPE = ".key"; + + @Private + static final String DATA_FILE_TYPE = ".data"; + private static final Logger operationLog = LogFactory.getLogger(LogCategory.OPERATION, CacheManager.class); - + private final ITimeProvider timeProvider; + private final Map<Key, FileName> keyToFileNameMap; + private final IFreeSpaceProvider freeSpaceProvider; + private final File cacheFolder; + private final long minimumFreeDiskSpaceInKB; + private final long maximumRetentionTimeInMillis; - - + public CacheManager(WebClientConfiguration configuration, String technologyName, ITimeProvider timeProvider, IFreeSpaceProvider freeSpaceProvider, String cacheVersion) { @@ -208,7 +226,7 @@ public class CacheManager implements ICacheManager } return key; } - + private int getIntegerProperty(WebClientConfiguration configuration, String technologyName, String key, int defaultValue) { String value = configuration.getPropertyOrNull(technologyName, key); @@ -232,7 +250,7 @@ public class CacheManager implements ICacheManager String value = configuration.getPropertyOrNull(technologyName, key); return value == null ? defaultValue : value; } - + @Override public Object tryToGetData(Key key) { @@ -299,7 +317,7 @@ public class CacheManager implements ICacheManager } } } - + private void cleanUp() { long currentTime = timeProvider.getTimeInMilliseconds(); @@ -335,7 +353,7 @@ public class CacheManager implements ICacheManager operationLog.warn("Can not obtain available free disk space.", ex); } } - + private void removeFromCache(Key key) { FileName fileName = keyToFileNameMap.remove(key); @@ -361,7 +379,7 @@ public class CacheManager implements ICacheManager operationLog.warn("For key " + key + " removing from cache caused some unknown error: " + file); } } - + private void assertFreeSpaceAvailableFor(int numberOfBytes) throws IOException { long freeSpace = 1024 * freeSpaceProvider.freeSpaceKb(new HostAwareFile(cacheFolder)); diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/util/DataTypeUtils.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/util/DataTypeUtils.java index 51216a6b996..50587180458 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/util/DataTypeUtils.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/util/DataTypeUtils.java @@ -102,7 +102,7 @@ public class DataTypeUtils { String pattern = SupportedDatePattern.CANONICAL_DATE_PATTERN.getPattern(); return DateUtils.parseDate(value, new String[] - { pattern }); + { pattern }); } catch (ParseException ex) { throw new IllegalArgumentException("Is not a date in canonical format: " diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/util/EntityHelper.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/util/EntityHelper.java index 0df7488d769..fff63b2ac78 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/util/EntityHelper.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/util/EntityHelper.java @@ -57,7 +57,7 @@ public class EntityHelper /** * Returns <code>true</code> if both entities are <code>null</code> or have the same id (which could be <code>null</code>). */ - public static <T extends IIdHolder >boolean equalEntities(T entity1OrNull, T entity2OrNull) + public static <T extends IIdHolder> boolean equalEntities(T entity1OrNull, T entity2OrNull) { if (entity1OrNull == null || entity2OrNull == null) { @@ -100,8 +100,7 @@ public class EntityHelper } /** - * @return finds and returns an {@link IEntityProperty} for a specified code. Returns - * <code>null</code> if no matching property is found. + * @return finds and returns an {@link IEntityProperty} for a specified code. Returns <code>null</code> if no matching property is found. */ public static IEntityProperty tryFindProperty(Iterable<IEntityProperty> properties, final String propertyCode) @@ -237,8 +236,7 @@ public class EntityHelper } /** - * Creates a property with specified code and value. An already existing property with same code - * will be removed. + * Creates a property with specified code and value. An already existing property with same code will be removed. */ public static void createOrUpdateProperty(IEntityPropertiesHolder holder, String propertyCode, String propertyValue) diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/util/ICacheManager.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/util/ICacheManager.java index c62204ed00c..365d47a8adb 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/util/ICacheManager.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/util/ICacheManager.java @@ -19,20 +19,19 @@ package ch.systemsx.cisd.openbis.generic.shared.util; /** * Interface of a manager of objects which are stored in a cache using a unique {@link Key}. * - * * @author Franz-Josef Elmer */ public interface ICacheManager { /** - * Tries to retrieve object for specified key. + * Tries to retrieve object for specified key. * * @return <code>null</code> if not found in cache. */ public Object tryToGetData(Key key); /** - * Stores specified object for specified key. + * Stores specified object for specified key. */ public void storeData(Key key, Object object); diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/util/IColumnGroup.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/util/IColumnGroup.java index ed70a747de5..19a84397e4f 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/util/IColumnGroup.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/util/IColumnGroup.java @@ -37,22 +37,19 @@ public interface IColumnGroup public IColumn column(String id); /** - * Intends uneditable property columns for all property columns added by one of the add methods - * after this method has been invoked. + * Intends uneditable property columns for all property columns added by one of the add methods after this method has been invoked. */ public IColumnGroup uneditablePropertyColumns(); /** - * Adds for all assigned property types of the specified entity type a column. The group name is - * used as a prefix which combined with the property type code to determine the column id. The - * property type label is used as column title. + * Adds for all assigned property types of the specified entity type a column. The group name is used as a prefix which combined with the property + * type code to determine the column id. The property type label is used as column title. */ public void addColumnsForAssignedProperties(EntityType entityType); /** - * Adds for all assigned property types of the specified entity type a column. The specified - * identifier prefix is used as a prefix which combined with the property type code to determine - * the column id. The property type label is used as column title. + * Adds for all assigned property types of the specified entity type a column. The specified identifier prefix is used as a prefix which combined + * with the property type code to determine the column id. The property type label is used as column title. */ public void addColumnsForAssignedProperties(String idPrefix, EntityType entityType); @@ -67,30 +64,27 @@ public interface IColumnGroup public void addColumnsForPropertyTypesForUpdate(List<PropertyType> propertyTypes); /** - * Adds a column for all given property types. The specified identifier prefix is used as a - * prefix which combined with the property type code to determine the column id. The property - * type label is used as column title. + * Adds a column for all given property types. The specified identifier prefix is used as a prefix which combined with the property type code to + * determine the column id. The property type label is used as column title. */ public void addColumnsForPropertyTypes(String idPrefix, List<PropertyType> propertyTypes, boolean forUpdate); /** - * Adds all specified properties. The group name is used as a prefix which is combined with the - * property type code to determine the column id. The property type label is used as column - * title. + * Adds all specified properties. The group name is used as a prefix which is combined with the property type code to determine the column id. The + * property type label is used as column title. */ public void addProperties(Collection<IEntityProperty> properties); /** - * Adds all specified properties. The specified identifier prefix is combined with the property - * type code to determine the column id. The property type label is used as column title. + * Adds all specified properties. The specified identifier prefix is combined with the property type code to determine the column id. The property + * type label is used as column title. */ public void addProperties(String idPrefix, Collection<IEntityProperty> properties); /** - * Adds all specified properties such that the table can be used for batch update. The original - * property type code determines the column id. For vocabulary terms only the code is added as - * value. + * Adds all specified properties such that the table can be used for batch update. The original property type code determines the column id. For + * vocabulary terms only the code is added as value. */ public void addPropertiesForUpdate(Collection<IEntityProperty> properties); diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/util/IColumnMetaData.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/util/IColumnMetaData.java index cbdea36525b..b6525994f06 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/util/IColumnMetaData.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/util/IColumnMetaData.java @@ -19,8 +19,7 @@ package ch.systemsx.cisd.openbis.generic.shared.util; import ch.systemsx.cisd.openbis.generic.shared.basic.dto.DataTypeCode; /** - * Interface for setting meta data of columns defined by - * {@link TypedTableModelBuilder#addColumn(String)}. + * Interface for setting meta data of columns defined by {@link TypedTableModelBuilder#addColumn(String)}. * * @author Franz-Josef Elmer */ diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/util/IDataSourceFactory.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/util/IDataSourceFactory.java index 10037320e3e..aaadf5d8b71 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/util/IDataSourceFactory.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/util/IDataSourceFactory.java @@ -27,8 +27,8 @@ import ch.systemsx.cisd.openbis.generic.shared.dto.DataSourceWithDefinition; public interface IDataSourceFactory { /** - * Creates a data source optional definition from specified properties. Note, that if the - * definition is provided its code attribute might be undefined. + * Creates a data source optional definition from specified properties. Note, that if the definition is provided its code attribute might be + * undefined. */ public DataSourceWithDefinition create(Properties dbProps); } \ No newline at end of file diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/util/Key.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/util/Key.java index 02dbe560299..14fbd6c6714 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/util/Key.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/util/Key.java @@ -26,9 +26,9 @@ import java.io.Serializable; public final class Key implements Serializable { private static final long serialVersionUID = 1L; - + private final Object[] objects; - + public Key(Object... objects) { this.objects = objects; @@ -61,7 +61,7 @@ public final class Key implements Serializable } return true; } - + @Override public int hashCode() { diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/util/MaterialConfigurationProvider.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/util/MaterialConfigurationProvider.java index f6bb1bda68e..66da13ffdd3 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/util/MaterialConfigurationProvider.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/util/MaterialConfigurationProvider.java @@ -78,8 +78,7 @@ public class MaterialConfigurationProvider } /** - * Return <code>true</code> if the material codes can contain only alphanumeric characters and - * underscores. + * Return <code>true</code> if the material codes can contain only alphanumeric characters and underscores. */ public boolean isStrictCodeConstraints() { diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/util/RelationshipUtils.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/util/RelationshipUtils.java index c1a2f29dec6..a6f1b86f24b 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/util/RelationshipUtils.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/util/RelationshipUtils.java @@ -49,7 +49,7 @@ public class RelationshipUtils } } - public static void updateModificationDateAndModifierOfRelatedEntitiesOfSamples(List<SamplePE> samples, + public static void updateModificationDateAndModifierOfRelatedEntitiesOfSamples(List<SamplePE> samples, IAuthSession session, Date modificationTimestamp) { for (SamplePE sample : samples) @@ -84,7 +84,7 @@ public class RelationshipUtils } } - public static void updateModificationDateAndModifierOfRelatedEntitiesOfDataSets(List<DataPE> dataSets, + public static void updateModificationDateAndModifierOfRelatedEntitiesOfDataSets(List<DataPE> dataSets, IAuthSession session, Date modificationTimestamp) { for (DataPE dataSet : dataSets) @@ -106,7 +106,7 @@ public class RelationshipUtils } } - private static void updateModificationDateAndModifierOfDataSets(List<DataPE> dataSets, + private static void updateModificationDateAndModifierOfDataSets(List<DataPE> dataSets, IAuthSession session, Date modificationTimestamp) { if (dataSets != null) diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/util/RuntimeCache.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/util/RuntimeCache.java index 9d5df52ada8..141bbea600c 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/util/RuntimeCache.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/util/RuntimeCache.java @@ -36,8 +36,6 @@ import ch.systemsx.cisd.common.parser.MemorySizeFormatter; import ch.systemsx.cisd.common.parser.PercentFormatter; /** - * - * * @author Franz-Josef Elmer */ public class RuntimeCache<K, V> @@ -56,14 +54,14 @@ public class RuntimeCache<K, V> this.name = name; this.cacheSizePropertyName = cacheSizePropertyName; } - + @SuppressWarnings("unchecked") public V get(K key) { Element element = getCache().get(key); return element == null ? null : ((ValueWrapper<V>) element.getObjectValue()).getValue(); } - + public void put(K key, V value) { Element element = getCache().get(key); @@ -82,12 +80,12 @@ public class RuntimeCache<K, V> getCache().recalculateSize(key); } } - + public boolean remove(K key) { return getCache().remove(key); } - + public void initCache() { Cache cache = cacheManager.getCache(name); @@ -115,7 +113,7 @@ public class RuntimeCache<K, V> operationLog.info("The cache " + name + " already exists. It must have been configured in ehcache.xml file."); } } - + protected long getCacheSize() { String propertyValue = getSystemProperty(cacheSizePropertyName); @@ -159,7 +157,7 @@ public class RuntimeCache<K, V> { return System.getProperty(propertyName); } - + private Cache getCache() { return cacheManager.getCache(name); @@ -175,7 +173,7 @@ public class RuntimeCache<K, V> + cacheSizePropertyName + "' system property in openbis.conf file."); return cacheSize; } - + private static final class ValueWrapper<V> { private V value; @@ -200,5 +198,6 @@ public class RuntimeCache<K, V> { return String.valueOf(value); } - - }} + + } +} diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/util/RuntimeCacheEventListener.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/util/RuntimeCacheEventListener.java index 05d26a2511d..5c5a033de4c 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/util/RuntimeCacheEventListener.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/util/RuntimeCacheEventListener.java @@ -86,7 +86,7 @@ public class RuntimeCacheEventListener implements CacheEventListener { StringBuilder sb = new StringBuilder(); sb.append("Cache entry " + entry.hashCode() + " that contains search result with " + entry + " " + operation + "."); - + int cacheSize = cache.getSize(); if (cacheSize == 1) diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/util/ServerUtils.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/util/ServerUtils.java index b878cf0f625..bc2512dc442 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/util/ServerUtils.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/util/ServerUtils.java @@ -64,8 +64,7 @@ public class ServerUtils /** * Extracts from the comma-separated list of strings all distinct strings. * - * @return an empty list if the argument is <code>null</code>, an empty string or starts with - * '$'. + * @return an empty list if the argument is <code>null</code>, an empty string or starts with '$'. */ public static Set<String> extractSet(String commaSeparatedList) { diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/util/SpaceCodeHelper.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/util/SpaceCodeHelper.java index 35086c17f3e..8c234210f23 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/util/SpaceCodeHelper.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/util/SpaceCodeHelper.java @@ -40,8 +40,7 @@ public class SpaceCodeHelper /** * Tries to find out the space. * <p> - * If not specified in given {@link SpaceIdentifier} the real space must be specified as home - * space in given {@link PersonPE}. + * If not specified in given {@link SpaceIdentifier} the real space must be specified as home space in given {@link PersonPE}. * </p> * * @throws UndefinedSpaceException if no space could be found. @@ -55,8 +54,7 @@ public class SpaceCodeHelper /** * Tries to find out the space. * <p> - * If not specified in given {@link SpacePE} the real space must be specified as home space in - * given {@link PersonPE}. + * If not specified in given {@link SpacePE} the real space must be specified as home space in given {@link PersonPE}. * </p> * * @throws UndefinedSpaceException if no space could be found. @@ -70,9 +68,8 @@ public class SpaceCodeHelper /** * Tries to find out the space. * <p> - * If given <var>spaceCode</var> specifies the home space, the home space of the - * {@link PersonPE} is returned. May return <code>null</code>, if no home space is defined for - * the user. + * If given <var>spaceCode</var> specifies the home space, the home space of the {@link PersonPE} is returned. May return <code>null</code>, if no + * home space is defined for the user. * </p> */ public final static String tryGetSpaceCode(final PersonPE person, final String spaceCode) @@ -95,8 +92,7 @@ public class SpaceCodeHelper /** * Tries to find out the space. * <p> - * If given <var>spaceCode</var> is a home space, the real space must be specified as home space - * in given {@link PersonPE}. + * If given <var>spaceCode</var> is a home space, the real space must be specified as home space in given {@link PersonPE}. * </p> * * @throws UndefinedSpaceException if no space could be found. @@ -115,8 +111,7 @@ public class SpaceCodeHelper /** * Tries to find out the space. * <p> - * If given <var>spaceCode</var> is a home space, the real space must be specified as - * <var>homeSpaceCode</var>. + * If given <var>spaceCode</var> is a home space, the real space must be specified as <var>homeSpaceCode</var>. * </p> * * @throws UndefinedSpaceException if no space could be found. diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/util/UuidUtil.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/util/UuidUtil.java index 78a3f511159..005024e9b0c 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/util/UuidUtil.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/util/UuidUtil.java @@ -26,8 +26,8 @@ import ch.systemsx.cisd.openbis.generic.shared.basic.CodeConverter; /** * Some utility methods based on {@link UUID}. * <p> - * In its canonical form, a <i>UUID</i> consists of 32 hexadecimal digits, displayed in 5 groups - * separated by hyphens, in the form 8-4-4-4-12 for a total of 36 characters.<br> + * In its canonical form, a <i>UUID</i> consists of 32 hexadecimal digits, displayed in 5 groups separated by hyphens, in the form 8-4-4-4-12 for a + * total of 36 characters.<br> * For example: * * <pre> diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/util/WebClientFilesUpdater.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/util/WebClientFilesUpdater.java index 86a59e8a1f1..38c9f5618bf 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/util/WebClientFilesUpdater.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/util/WebClientFilesUpdater.java @@ -32,10 +32,8 @@ import ch.systemsx.cisd.openbis.generic.client.web.client.application.plugin.Def /** * Class which updates <code>OpenBIS.gwt.xml</code> and {@link DefaultClientPluginFactoryProvider}. * <p> - * Usage: - * <tt>java {@link WebClientFilesUpdater} [<working directory> [<technology 1> <technology 2> ...]]</tt> - * Without technology arguments all technologies found in the code base are available. If at least - * one technology is specified only the specified technologies will be available. + * Usage: <tt>java {@link WebClientFilesUpdater} [<working directory> [<technology 1> <technology 2> ...]]</tt> Without technology arguments all + * technologies found in the code base are available. If at least one technology is specified only the specified technologies will be available. * * @author Christian Ribeaud */ diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/util/XmlUtils.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/util/XmlUtils.java index 3388155555c..6afa1649118 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/util/XmlUtils.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/shared/util/XmlUtils.java @@ -62,7 +62,7 @@ public class XmlUtils /** indentation to be used when serializing to xml. */ public static final Integer INDENTATION = 2; - + /** * Parse given string as XML {@link Document}. * diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/plugin/AbstractPluginBusinessObjectFactory.java b/openbis/source/java/ch/systemsx/cisd/openbis/plugin/AbstractPluginBusinessObjectFactory.java index 5d2cddf3f5e..ad8d343de94 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/plugin/AbstractPluginBusinessObjectFactory.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/plugin/AbstractPluginBusinessObjectFactory.java @@ -23,8 +23,8 @@ import ch.systemsx.cisd.openbis.generic.server.business.bo.AbstractBusinessObjec import ch.systemsx.cisd.openbis.generic.server.business.bo.ICommonBusinessObjectFactory; /** - * An <i>abstract</i> {@link AbstractBusinessObjectFactory} extension which is able to delegate - * calls to the encapsulated {@link ICommonBusinessObjectFactory}. + * An <i>abstract</i> {@link AbstractBusinessObjectFactory} extension which is able to delegate calls to the encapsulated + * {@link ICommonBusinessObjectFactory}. * * @author Christian Ribeaud */ diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/plugin/AbstractSampleServerPlugin.java b/openbis/source/java/ch/systemsx/cisd/openbis/plugin/AbstractSampleServerPlugin.java index 9326f2d7eb9..31df2e3f656 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/plugin/AbstractSampleServerPlugin.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/plugin/AbstractSampleServerPlugin.java @@ -27,12 +27,10 @@ import ch.systemsx.cisd.openbis.generic.server.plugin.SampleServerPluginRegistry import ch.systemsx.cisd.openbis.generic.shared.ResourceNames; /** - * An abstract {@link ISampleServerPlugin} which registers itself to - * {@link SampleServerPluginRegistry}. + * An abstract {@link ISampleServerPlugin} which registers itself to {@link SampleServerPluginRegistry}. * <p> - * Each subclass should be annotated with {@link Component} so that it automatically gets registered - * to {@link SampleServerPluginRegistry} by <i>Spring</i>. It is a good idea as well to make the - * empty constructor <i>private</i>. + * Each subclass should be annotated with {@link Component} so that it automatically gets registered to {@link SampleServerPluginRegistry} by + * <i>Spring</i>. It is a good idea as well to make the empty constructor <i>private</i>. * </p> * * @author Christian Ribeaud @@ -41,7 +39,7 @@ public abstract class AbstractSampleServerPlugin implements ISampleServerPlugin, { @Resource(name = ResourceNames.SAMPLE_PLUGIN_REGISTRY) private SampleServerPluginRegistry sampleServerPluginRegistry; - + @Resource(name = ResourceNames.GENERIC_SAMPLE_TYPE_SLAVE_SERVER_PLUGIN) private ISampleTypeSlaveServerPlugin genericSampleTypeSlaveServerPlugin; diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/plugin/demo/client/web/client/IDemoClientService.java b/openbis/source/java/ch/systemsx/cisd/openbis/plugin/demo/client/web/client/IDemoClientService.java index 46678255a0d..9755c1e350e 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/plugin/demo/client/web/client/IDemoClientService.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/plugin/demo/client/web/client/IDemoClientService.java @@ -25,9 +25,8 @@ import ch.systemsx.cisd.openbis.generic.shared.basic.dto.SampleParentWithDerived /** * Service interface for the <i>demo</i> <i>GWT</i> client. * <p> - * Each method should declare throwing {@link UserFailureException}. The authorization framework can - * throw it when the user has insufficient privileges. If it is not marked, the GWT client will - * report unexpected exception. + * Each method should declare throwing {@link UserFailureException}. The authorization framework can throw it when the user has insufficient + * privileges. If it is not marked, the GWT client will report unexpected exception. * </p> * * @author Christian Ribeaud diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/plugin/demo/client/web/client/application/Dict.java b/openbis/source/java/ch/systemsx/cisd/openbis/plugin/demo/client/web/client/application/Dict.java index b6fdfc1df84..304ed432c8d 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/plugin/demo/client/web/client/application/Dict.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/plugin/demo/client/web/client/application/Dict.java @@ -17,8 +17,7 @@ package ch.systemsx.cisd.openbis.plugin.demo.client.web.client.application; /** - * An {@link ch.systemsx.cisd.openbis.generic.client.web.client.application.Dict} extension for - * <i>demo</i> specific message keys. + * An {@link ch.systemsx.cisd.openbis.generic.client.web.client.application.Dict} extension for <i>demo</i> specific message keys. * * @author Christian Ribeaud */ diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/plugin/demo/client/web/client/application/module/StatisticsWidget.java b/openbis/source/java/ch/systemsx/cisd/openbis/plugin/demo/client/web/client/application/module/StatisticsWidget.java index 53c98f70956..2480265dcba 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/plugin/demo/client/web/client/application/module/StatisticsWidget.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/plugin/demo/client/web/client/application/module/StatisticsWidget.java @@ -94,7 +94,7 @@ public class StatisticsWidget extends ContentPanel implements IDatabaseModificat public DatabaseModificationKind[] getRelevantModifications() { return new DatabaseModificationKind[] - { DatabaseModificationKind.createOrDelete(ObjectKind.EXPERIMENT) }; + { DatabaseModificationKind.createOrDelete(ObjectKind.EXPERIMENT) }; } @Override diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/plugin/demo/client/web/server/DemoClientServiceServlet.java b/openbis/source/java/ch/systemsx/cisd/openbis/plugin/demo/client/web/server/DemoClientServiceServlet.java index 3b7b912e7c9..e943c4ec48c 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/plugin/demo/client/web/server/DemoClientServiceServlet.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/plugin/demo/client/web/server/DemoClientServiceServlet.java @@ -29,16 +29,15 @@ import ch.systemsx.cisd.openbis.plugin.demo.shared.ResourceNames; /** * The {@link GWTRPCServiceExporter} for the <i>demo</i> service. * <p> - * <i>URL</i> mappings are: <code>/demo</code> and <code>/openbis/demo</code>. The encapsulated - * {@link ICommonClientService} service implementation is expected to be defined as bean with name - * <code>demo-service</code>. + * <i>URL</i> mappings are: <code>/demo</code> and <code>/openbis/demo</code>. The encapsulated {@link ICommonClientService} service implementation is + * expected to be defined as bean with name <code>demo-service</code>. * </p> * * @author Christian Ribeaud */ @Controller @RequestMapping( - { "/demo", "/openbis/demo" }) +{ "/demo", "/openbis/demo" }) public final class DemoClientServiceServlet extends GWTRPCServiceExporter { private static final long serialVersionUID = 1L; diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/plugin/demo/server/DemoSampleServerPlugin.java b/openbis/source/java/ch/systemsx/cisd/openbis/plugin/demo/server/DemoSampleServerPlugin.java index 89cc5663d3d..083cb72b73d 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/plugin/demo/server/DemoSampleServerPlugin.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/plugin/demo/server/DemoSampleServerPlugin.java @@ -31,8 +31,7 @@ import ch.systemsx.cisd.openbis.plugin.demo.shared.ResourceNames; /** * The {@link ISampleServerPlugin} implementation for plates of type <code>DEMO_PLUGIN</code>. * <p> - * This class is annotated with {@link Component} so that it automatically gets registered to - * {@link SampleServerPluginRegistry} by <i>Spring</i>. + * This class is annotated with {@link Component} so that it automatically gets registered to {@link SampleServerPluginRegistry} by <i>Spring</i>. * </p> * * @author Christian Ribeaud diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/plugin/demo/shared/IDemoServer.java b/openbis/source/java/ch/systemsx/cisd/openbis/plugin/demo/shared/IDemoServer.java index c50ee03544a..d4bf8c7ba5a 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/plugin/demo/shared/IDemoServer.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/plugin/demo/shared/IDemoServer.java @@ -47,8 +47,8 @@ public interface IDemoServer extends IServer * For given {@link TechId} returns the {@link Sample} and its derived (child) samples. * * @return never <code>null</code>. - * @throws UserFailureException if given <var>sessionToken</var> is invalid or whether sample - * uniquely identified by given <var>sampleId</var> does not exist. + * @throws UserFailureException if given <var>sessionToken</var> is invalid or whether sample uniquely identified by given <var>sampleId</var> + * does not exist. */ @Transactional(readOnly = true) public SampleParentWithDerived getSampleInfo(final String sessionToken, final TechId sampleId) diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/plugin/demo/shared/ResourceNames.java b/openbis/source/java/ch/systemsx/cisd/openbis/plugin/demo/shared/ResourceNames.java index c98f88e0157..9c050fd6205 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/plugin/demo/shared/ResourceNames.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/plugin/demo/shared/ResourceNames.java @@ -19,9 +19,8 @@ package ch.systemsx.cisd.openbis.plugin.demo.shared; /** * Resource name used in <i>demo</i> plug-in. * <p> - * Be aware about the uniqueness of the bean names loaded by <i>Spring</i>. Names defined here - * should not conflict with already existing bean names. Look for other <code>ResourceNames</code> - * classes. + * Be aware about the uniqueness of the bean names loaded by <i>Spring</i>. Names defined here should not conflict with already existing bean names. + * Look for other <code>ResourceNames</code> classes. * </p> * * @author Christian Ribeaud diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/plugin/generic/client/web/client/application/DelegatedClientPlugin.java b/openbis/source/java/ch/systemsx/cisd/openbis/plugin/generic/client/web/client/application/DelegatedClientPlugin.java index ad865252e5c..051ba0bec79 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/plugin/generic/client/web/client/application/DelegatedClientPlugin.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/plugin/generic/client/web/client/application/DelegatedClientPlugin.java @@ -33,8 +33,7 @@ import ch.systemsx.cisd.openbis.generic.shared.basic.dto.EntityKind; import ch.systemsx.cisd.openbis.generic.shared.basic.dto.api.IManagedInputWidgetDescription; /** - * delegates all operations to generic plugin, should be subclasssed and the needed functionality - * can override the default behaviour + * delegates all operations to generic plugin, should be subclasssed and the needed functionality can override the default behaviour */ public class DelegatedClientPlugin<T extends BasicEntityType> implements IClientPlugin<T, IIdAndCodeHolder> diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/plugin/generic/client/web/client/application/dataset/DataSetRelationshipBrowser.java b/openbis/source/java/ch/systemsx/cisd/openbis/plugin/generic/client/web/client/application/dataset/DataSetRelationshipBrowser.java index 9beea2bbf30..1e25cd40b6f 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/plugin/generic/client/web/client/application/dataset/DataSetRelationshipBrowser.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/plugin/generic/client/web/client/application/dataset/DataSetRelationshipBrowser.java @@ -32,8 +32,8 @@ import ch.systemsx.cisd.openbis.generic.shared.basic.dto.AbstractExternalData; import ch.systemsx.cisd.openbis.generic.shared.basic.dto.TableModelRowWithObject; /** - * {@link AbstractExternalDataGrid} containing data sets directly connected with a specified data - * set being in a specified relationship role (parent/child). + * {@link AbstractExternalDataGrid} containing data sets directly connected with a specified data set being in a specified relationship role + * (parent/child). * * @author Piotr Buczek */ diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/plugin/generic/client/web/client/application/dataset/GenericDataSetViewer.java b/openbis/source/java/ch/systemsx/cisd/openbis/plugin/generic/client/web/client/application/dataset/GenericDataSetViewer.java index 2451756fcbe..28f2552ef69 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/plugin/generic/client/web/client/application/dataset/GenericDataSetViewer.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/plugin/generic/client/web/client/application/dataset/GenericDataSetViewer.java @@ -133,7 +133,7 @@ abstract public class GenericDataSetViewer extends AbstractViewerWithVerticalSpl { Widget spaceBreadcrumb = createSpaceLink(originalData.getSpace()); widgets.add(spaceBreadcrumb); - + Experiment experiment = originalData.getExperiment(); if (experiment != null) { diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/plugin/generic/client/web/client/application/experiment/AbstractGenericExperimentRegisterEditForm.java b/openbis/source/java/ch/systemsx/cisd/openbis/plugin/generic/client/web/client/application/experiment/AbstractGenericExperimentRegisterEditForm.java index 0650a729d45..0721f1ed2ca 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/plugin/generic/client/web/client/application/experiment/AbstractGenericExperimentRegisterEditForm.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/plugin/generic/client/web/client/application/experiment/AbstractGenericExperimentRegisterEditForm.java @@ -65,8 +65,7 @@ import ch.systemsx.cisd.openbis.plugin.generic.client.web.client.IGenericClientS import ch.systemsx.cisd.openbis.plugin.generic.client.web.client.application.AbstractGenericEntityRegistrationForm; /** - * A {@link AbstractGenericEntityRegistrationForm} extension for registering and editing - * experiments. + * A {@link AbstractGenericEntityRegistrationForm} extension for registering and editing experiments. * * @author Izabela Adamczyk */ diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/plugin/generic/client/web/client/application/experiment/ExperimentPropertiesPanel.java b/openbis/source/java/ch/systemsx/cisd/openbis/plugin/generic/client/web/client/application/experiment/ExperimentPropertiesPanel.java index dbd06b0a23d..30611d60617 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/plugin/generic/client/web/client/application/experiment/ExperimentPropertiesPanel.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/plugin/generic/client/web/client/application/experiment/ExperimentPropertiesPanel.java @@ -157,16 +157,16 @@ public class ExperimentPropertiesPanel extends ContentPanel public DatabaseModificationKind[] getRelevantModifications() { return new DatabaseModificationKind[] - { - DatabaseModificationKind.edit(ObjectKind.EXPERIMENT), - DatabaseModificationKind.createOrDelete(ObjectKind.EXPERIMENT), - DatabaseModificationKind - .createOrDelete(ObjectKind.PROPERTY_TYPE_ASSIGNMENT), - DatabaseModificationKind.edit(ObjectKind.PROPERTY_TYPE_ASSIGNMENT), - DatabaseModificationKind.createOrDelete(ObjectKind.VOCABULARY_TERM), - DatabaseModificationKind.edit(ObjectKind.VOCABULARY_TERM), - DatabaseModificationKind.createOrDelete(ObjectKind.METAPROJECT), - DatabaseModificationKind.edit(ObjectKind.METAPROJECT) }; + { + DatabaseModificationKind.edit(ObjectKind.EXPERIMENT), + DatabaseModificationKind.createOrDelete(ObjectKind.EXPERIMENT), + DatabaseModificationKind + .createOrDelete(ObjectKind.PROPERTY_TYPE_ASSIGNMENT), + DatabaseModificationKind.edit(ObjectKind.PROPERTY_TYPE_ASSIGNMENT), + DatabaseModificationKind.createOrDelete(ObjectKind.VOCABULARY_TERM), + DatabaseModificationKind.edit(ObjectKind.VOCABULARY_TERM), + DatabaseModificationKind.createOrDelete(ObjectKind.METAPROJECT), + DatabaseModificationKind.edit(ObjectKind.METAPROJECT) }; } @Override diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/plugin/generic/client/web/client/application/experiment/PropertiesEditor.java b/openbis/source/java/ch/systemsx/cisd/openbis/plugin/generic/client/web/client/application/experiment/PropertiesEditor.java index 0f6e4afd89e..23211a8ef3c 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/plugin/generic/client/web/client/application/experiment/PropertiesEditor.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/plugin/generic/client/web/client/application/experiment/PropertiesEditor.java @@ -227,8 +227,7 @@ abstract public class PropertiesEditor<T extends EntityType, S extends EntityTyp } /** - * Returns a list of fields appropriate for entity type - property type assignments specific to - * given {@link PropertiesEditor}. + * Returns a list of fields appropriate for entity type - property type assignments specific to given {@link PropertiesEditor}. */ public final List<DatabaseModificationAwareField<?>> getPropertyFields() { diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/plugin/generic/client/web/client/application/material/GenericMaterialViewer.java b/openbis/source/java/ch/systemsx/cisd/openbis/plugin/generic/client/web/client/application/material/GenericMaterialViewer.java index 93d238683d0..6872e36e1f5 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/plugin/generic/client/web/client/application/material/GenericMaterialViewer.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/plugin/generic/client/web/client/application/material/GenericMaterialViewer.java @@ -147,8 +147,7 @@ abstract public class GenericMaterialViewer extends AbstractViewerWithVerticalSp } /** - * To be subclassed. Creates additional panels of the viewer in the right side section besides - * components, datasets and attachments + * To be subclassed. Creates additional panels of the viewer in the right side section besides components, datasets and attachments */ protected List<TabContent> createAdditionalSectionPanels(Material material) { @@ -262,15 +261,15 @@ abstract public class GenericMaterialViewer extends AbstractViewerWithVerticalSp public DatabaseModificationKind[] getRelevantModifications() { return new DatabaseModificationKind[] - { - DatabaseModificationKind.edit(ObjectKind.MATERIAL), - DatabaseModificationKind - .createOrDelete(ObjectKind.PROPERTY_TYPE_ASSIGNMENT), - DatabaseModificationKind.edit(ObjectKind.PROPERTY_TYPE_ASSIGNMENT), - DatabaseModificationKind.createOrDelete(ObjectKind.VOCABULARY_TERM), - DatabaseModificationKind.edit(ObjectKind.VOCABULARY_TERM), - DatabaseModificationKind.createOrDelete(ObjectKind.METAPROJECT), - DatabaseModificationKind.edit(ObjectKind.METAPROJECT) }; + { + DatabaseModificationKind.edit(ObjectKind.MATERIAL), + DatabaseModificationKind + .createOrDelete(ObjectKind.PROPERTY_TYPE_ASSIGNMENT), + DatabaseModificationKind.edit(ObjectKind.PROPERTY_TYPE_ASSIGNMENT), + DatabaseModificationKind.createOrDelete(ObjectKind.VOCABULARY_TERM), + DatabaseModificationKind.edit(ObjectKind.VOCABULARY_TERM), + DatabaseModificationKind.createOrDelete(ObjectKind.METAPROJECT), + DatabaseModificationKind.edit(ObjectKind.METAPROJECT) }; } @Override diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/plugin/generic/client/web/client/application/sample/EntityConnectionTypeProvider.java b/openbis/source/java/ch/systemsx/cisd/openbis/plugin/generic/client/web/client/application/sample/EntityConnectionTypeProvider.java index 123c3509e41..f2f674715f8 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/plugin/generic/client/web/client/application/sample/EntityConnectionTypeProvider.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/plugin/generic/client/web/client/application/sample/EntityConnectionTypeProvider.java @@ -25,8 +25,7 @@ import ch.systemsx.cisd.openbis.generic.client.web.client.application.util.IDele import ch.systemsx.cisd.openbis.generic.client.web.client.application.util.IDirectlyConnectedController; /** - * Class capsulating a {@link CheckBox} and delegating check box changes to an associated - * {@link IDelegatedAction}. + * Class capsulating a {@link CheckBox} and delegating check box changes to an associated {@link IDelegatedAction}. * * @author Franz-Josef Elmer */ diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/plugin/generic/client/web/client/application/sample/GenericSampleViewer.java b/openbis/source/java/ch/systemsx/cisd/openbis/plugin/generic/client/web/client/application/sample/GenericSampleViewer.java index 107d6891d91..106b47a9d87 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/plugin/generic/client/web/client/application/sample/GenericSampleViewer.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/plugin/generic/client/web/client/application/sample/GenericSampleViewer.java @@ -184,19 +184,19 @@ abstract public class GenericSampleViewer extends AbstractViewerWithVerticalSpli List<TechId> sampleIds = new ArrayList<TechId>(Arrays.asList(TechId.create(getOriginalData()))); viewContext.getCommonService().getSampleChildrenInfo(sampleIds, true, new AbstractAsyncCallback<List<SampleChildrenInfo>>(viewContext) - { - @Override - protected void process(List<SampleChildrenInfo> info) - { - SampleChildrenInfo sampleInfo = info.get(0); + { + @Override + protected void process(List<SampleChildrenInfo> info) + { + SampleChildrenInfo sampleInfo = info.get(0); - additionalMessage.append(EntityDeletionConfirmationUtils.getMessageForSingleSample(sampleInfo)); + additionalMessage.append(EntityDeletionConfirmationUtils.getMessageForSingleSample(sampleInfo)); - new SampleListDeletionConfirmationDialog(getViewContext() - .getCommonViewContext(), getOriginalDataAsSingleton(), callback, - getOriginalData(), additionalMessage.toString()).show(); - } - }); + new SampleListDeletionConfirmationDialog(getViewContext() + .getCommonViewContext(), getOriginalDataAsSingleton(), callback, + getOriginalData(), additionalMessage.toString()).show(); + } + }); } })); addToolBarButton(createRevertDeletionButton(new IDelegatedAction() diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/plugin/generic/client/web/server/GenericClientService.java b/openbis/source/java/ch/systemsx/cisd/openbis/plugin/generic/client/web/server/GenericClientService.java index e6501d40010..8ccd75f054a 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/plugin/generic/client/web/server/GenericClientService.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/plugin/generic/client/web/server/GenericClientService.java @@ -294,7 +294,7 @@ public class GenericClientService extends AbstractClientService implements IGene private void updateTemporaryCodes(final String sessionToken, BatchSamplesOperation info) { - // TODO FJE: Do the update in single queue which is also fed by the + // TODO FJE: Do the update in single queue which is also fed by the // BatchSampleRegistrationTempCodeUpdaterTask // 1. Fill Structure Map<String, List<String>> sampleTypeCodeToTemporaryIdentifiers = new HashMap<String, List<String>>(); @@ -546,7 +546,7 @@ public class GenericClientService extends AbstractClientService implements IGene { files.add(new NamedInputStream(f.getInputStream(), f.getOriginalFilename())); } - + BatchSamplesOperation batchSamplesOperation = SampleUploadSectionsParser.prepareSamples(sampleType, files, defaultGroupIdentifier, sampleCodeGeneratorOrNull, allowExperiments, diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/plugin/generic/client/web/server/GenericClientServiceServlet.java b/openbis/source/java/ch/systemsx/cisd/openbis/plugin/generic/client/web/server/GenericClientServiceServlet.java index 33610c755e0..0ed383b19bc 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/plugin/generic/client/web/server/GenericClientServiceServlet.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/plugin/generic/client/web/server/GenericClientServiceServlet.java @@ -29,16 +29,15 @@ import ch.systemsx.cisd.openbis.plugin.generic.shared.ResourceNames; /** * The {@link GWTRPCServiceExporter} for the <i>generic</i> service. * <p> - * <i>URL</i> mappings are: <code>/generic</code> and <code>/openbis/generic</code>. The - * encapsulated {@link ICommonClientService} service implementation is expected to be defined as - * bean with name <code>generic-service</code>. + * <i>URL</i> mappings are: <code>/generic</code> and <code>/openbis/generic</code>. The encapsulated {@link ICommonClientService} service + * implementation is expected to be defined as bean with name <code>generic-service</code>. * </p> * * @author Christian Ribeaud */ @Controller @RequestMapping( - { "/generic", "/openbis/generic" }) +{ "/generic", "/openbis/generic" }) public final class GenericClientServiceServlet extends GWTRPCServiceExporter { private static final long serialVersionUID = 1L; diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/plugin/generic/client/web/server/parser/UpdatedDataSetParserObjectFactory.java b/openbis/source/java/ch/systemsx/cisd/openbis/plugin/generic/client/web/server/parser/UpdatedDataSetParserObjectFactory.java index 85c024e16f8..27a5bada53b 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/plugin/generic/client/web/server/parser/UpdatedDataSetParserObjectFactory.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/plugin/generic/client/web/server/parser/UpdatedDataSetParserObjectFactory.java @@ -89,8 +89,8 @@ public final class UpdatedDataSetParserObjectFactory extends } /** - * Prepares details about which values should be updated in general taking into account only the - * information about availability of columns in the file. + * Prepares details about which values should be updated in general taking into account only the information about availability of columns in the + * file. */ private DataSetBatchUpdateDetails createBasicBatchUpdateDetails() { @@ -104,8 +104,8 @@ public final class UpdatedDataSetParserObjectFactory extends } /** - * Returns details about which values should be updated for the specified data set. If a cell - * was left empty in the file the corresponding value will not be modified. + * Returns details about which values should be updated for the specified data set. If a cell was left empty in the file the corresponding value + * will not be modified. */ private DataSetBatchUpdateDetails createBatchUpdateDetails(NewDataSet dataSet) { diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/plugin/generic/server/AbstractGenericServerPlugin.java b/openbis/source/java/ch/systemsx/cisd/openbis/plugin/generic/server/AbstractGenericServerPlugin.java index c0613108bdd..9e234ad1547 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/plugin/generic/server/AbstractGenericServerPlugin.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/plugin/generic/server/AbstractGenericServerPlugin.java @@ -22,9 +22,7 @@ import ch.systemsx.cisd.openbis.generic.server.plugin.IServerPlugin; import ch.systemsx.cisd.openbis.generic.shared.basic.dto.EntityKind; /** - * - * - * @author Franz-Josef Elmer + * @author Franz-Josef Elmer */ abstract class AbstractGenericServerPlugin implements IServerPlugin { diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/plugin/generic/server/GenericDataSetServerPlugin.java b/openbis/source/java/ch/systemsx/cisd/openbis/plugin/generic/server/GenericDataSetServerPlugin.java index e80f3025366..e5a8147729e 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/plugin/generic/server/GenericDataSetServerPlugin.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/plugin/generic/server/GenericDataSetServerPlugin.java @@ -26,7 +26,7 @@ import ch.systemsx.cisd.openbis.generic.server.plugin.IDataSetTypeSlaveServerPlu /** * The default {@link IDataSetServerPlugin} implementation for the <i>generic</i> technology. * - * @author Franz-Josef Elmer + * @author Franz-Josef Elmer */ @Component(ch.systemsx.cisd.openbis.generic.shared.ResourceNames.GENERIC_DATA_SET_SERVER_PLUGIN) public class GenericDataSetServerPlugin extends AbstractGenericServerPlugin implements diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/plugin/generic/server/GenericServer.java b/openbis/source/java/ch/systemsx/cisd/openbis/plugin/generic/server/GenericServer.java index f6810591560..2713cccc6b4 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/plugin/generic/server/GenericServer.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/plugin/generic/server/GenericServer.java @@ -293,8 +293,7 @@ public final class GenericServer extends AbstractServer<IGenericServerInternal> @Override @RolesAllowed(RoleWithHierarchy.SPACE_OBSERVER) public AbstractExternalData getDataSetInfo(String sessionToken, - @AuthorizationGuard(guardClass = DataSetTechIdPredicate.class) - TechId datasetId) + @AuthorizationGuard(guardClass = DataSetTechIdPredicate.class) TechId datasetId) { return commonServer.getDataSetInfo(sessionToken, datasetId); } @@ -302,8 +301,7 @@ public final class GenericServer extends AbstractServer<IGenericServerInternal> @Override @RolesAllowed(RoleWithHierarchy.SPACE_OBSERVER) public AttachmentWithContent getExperimentFileAttachment(String sessionToken, - @AuthorizationGuard(guardClass = ExperimentTechIdPredicate.class) - TechId experimentId, String filename, Integer versionOrNull) + @AuthorizationGuard(guardClass = ExperimentTechIdPredicate.class) TechId experimentId, String filename, Integer versionOrNull) throws UserFailureException { final Session session = getSession(sessionToken); @@ -734,8 +732,7 @@ public final class GenericServer extends AbstractServer<IGenericServerInternal> @Override @RolesAllowed(RoleWithHierarchy.SPACE_OBSERVER) public AttachmentWithContent getProjectFileAttachment(String sessionToken, - @AuthorizationGuard(guardClass = ProjectTechIdPredicate.class) - TechId projectId, String fileName, Integer versionOrNull) + @AuthorizationGuard(guardClass = ProjectTechIdPredicate.class) TechId projectId, String fileName, Integer versionOrNull) { final Session session = getSession(sessionToken); final IProjectBO bo = businessObjectFactory.createProjectBO(session); @@ -747,8 +744,7 @@ public final class GenericServer extends AbstractServer<IGenericServerInternal> @Override @RolesAllowed(RoleWithHierarchy.SPACE_OBSERVER) public AttachmentWithContent getSampleFileAttachment(String sessionToken, - @AuthorizationGuard(guardClass = SampleTechIdPredicate.class) - TechId sampleId, String fileName, Integer versionOrNull) + @AuthorizationGuard(guardClass = SampleTechIdPredicate.class) TechId sampleId, String fileName, Integer versionOrNull) { final Session session = getSession(sessionToken); final ISampleBO bo = businessObjectFactory.createSampleBO(session); @@ -779,8 +775,7 @@ public final class GenericServer extends AbstractServer<IGenericServerInternal> @RolesAllowed(RoleWithHierarchy.SPACE_USER) @Capability("WRITE_EXPERIMENT_SAMPLE") public ExperimentUpdateResult updateExperiment(String sessionToken, - @AuthorizationGuard(guardClass = ExperimentUpdatesPredicate.class) - ExperimentUpdatesDTO updates) + @AuthorizationGuard(guardClass = ExperimentUpdatesPredicate.class) ExperimentUpdatesDTO updates) { final Session session = getSession(sessionToken); if (updates.isRegisterSamples()) @@ -810,8 +805,7 @@ public final class GenericServer extends AbstractServer<IGenericServerInternal> @Override @RolesAllowed(RoleWithHierarchy.SPACE_USER) public SampleUpdateResult updateSample(String sessionToken, - @AuthorizationGuard(guardClass = SampleUpdatesPredicate.class) - SampleUpdatesDTO updates) + @AuthorizationGuard(guardClass = SampleUpdatesPredicate.class) SampleUpdatesDTO updates) { return commonServer.updateSample(sessionToken, updates); } @@ -820,8 +814,7 @@ public final class GenericServer extends AbstractServer<IGenericServerInternal> @RolesAllowed(RoleWithHierarchy.SPACE_POWER_USER) @Capability("WRITE_DATASET") public DataSetUpdateResult updateDataSet(String sessionToken, - @AuthorizationGuard(guardClass = DataSetUpdatesPredicate.class) - DataSetUpdatesDTO updates) + @AuthorizationGuard(guardClass = DataSetUpdatesPredicate.class) DataSetUpdatesDTO updates) { return commonServer.updateDataSet(sessionToken, updates); } @@ -1020,14 +1013,17 @@ public final class GenericServer extends AbstractServer<IGenericServerInternal> Map<String, SpacePE> spaceCache = new HashMap<String, SpacePE>(); Map<String, List<String>> spaceToOldSampleCodes = new HashMap<String, List<String>>(); Map<String, String> identifiersToNewSampleCodes = new HashMap<String, String>(); - + // Generate Updates for each space and build helper maps - for(String sampleTypeCode : sampleTypeCodeToTemporaryIdentifiers.keySet()) { + for (String sampleTypeCode : sampleTypeCodeToTemporaryIdentifiers.keySet()) + { String codePrefix = getGeneratedCodePrefix(sessionToken, sampleTypeCode); List<String> temporaryIdentifiers = sampleTypeCodeToTemporaryIdentifiers.get(sampleTypeCode); int numberOfCodesToGenerate = temporaryIdentifiers.size(); - List<String> newCodes = new SampleCodeGeneratorByType(getDAOFactory()).generateCodes(codePrefix, ch.systemsx.cisd.openbis.generic.shared.basic.dto.EntityKind.SAMPLE, numberOfCodesToGenerate); - for(int tIdx = 0; tIdx < numberOfCodesToGenerate; tIdx++) + List<String> newCodes = + new SampleCodeGeneratorByType(getDAOFactory()).generateCodes(codePrefix, + ch.systemsx.cisd.openbis.generic.shared.basic.dto.EntityKind.SAMPLE, numberOfCodesToGenerate); + for (int tIdx = 0; tIdx < numberOfCodesToGenerate; tIdx++) { String tempIdentifier = temporaryIdentifiers.get(tIdx); String spaceCode = tempIdentifier.split("/")[1]; @@ -1048,7 +1044,7 @@ public final class GenericServer extends AbstractServer<IGenericServerInternal> identifiersToNewSampleCodes.put(tempIdentifier, newCodes.get(tIdx)); } } - + // Retrieve all sample PE objects List<SamplePE> allSamplesPE = new ArrayList<SamplePE>(); for (String spaceCode : spaceToOldSampleCodes.keySet()) diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/plugin/generic/server/GenericServerLogger.java b/openbis/source/java/ch/systemsx/cisd/openbis/plugin/generic/server/GenericServerLogger.java index c736c6567b4..91cad13420e 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/plugin/generic/server/GenericServerLogger.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/plugin/generic/server/GenericServerLogger.java @@ -268,7 +268,7 @@ final class GenericServerLogger extends AbstractServerLogger implements IGeneric logTracking(sessionToken, "update_experiments", "TYPE(%s) EXPERIMENTS(%s)", experiments .getExperimentType().getCode(), experiments.getUpdatedExperiments().size()); } - + @Override public void registerOrUpdateSamplesAndMaterials(final String sessionToken, final List<NewSamplesWithTypes> newSamplesWithType, diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/plugin/generic/server/GenericServiceServer.java b/openbis/source/java/ch/systemsx/cisd/openbis/plugin/generic/server/GenericServiceServer.java index 491e68ad6c2..03e496ba5db 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/plugin/generic/server/GenericServiceServer.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/plugin/generic/server/GenericServiceServer.java @@ -48,10 +48,11 @@ public class GenericServiceServer extends WhiteAndBlackListHttpInvokerServiceExp } @RequestMapping( - { "/rmi-plugin-generic", "/openbis/rmi-plugin-generic" }) + { "/rmi-plugin-generic", "/openbis/rmi-plugin-generic" }) @Override public void handleRequest(HttpServletRequest request, HttpServletResponse response) - throws ServletException, IOException { + throws ServletException, IOException + { super.handleRequest(request, response); } } diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/plugin/generic/shared/IGenericServerInternal.java b/openbis/source/java/ch/systemsx/cisd/openbis/plugin/generic/shared/IGenericServerInternal.java index e7b9d5fb822..28627563be0 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/plugin/generic/shared/IGenericServerInternal.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/plugin/generic/shared/IGenericServerInternal.java @@ -25,8 +25,6 @@ import ch.systemsx.cisd.openbis.generic.shared.DatabaseUpdateModification; import ch.systemsx.cisd.openbis.generic.shared.basic.dto.DatabaseModificationKind.ObjectKind; /** - * - * * @author Franz-Josef Elmer */ public interface IGenericServerInternal extends IGenericServer diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/plugin/generic/shared/ResourceNames.java b/openbis/source/java/ch/systemsx/cisd/openbis/plugin/generic/shared/ResourceNames.java index 51c93e0716e..66a443fc534 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/plugin/generic/shared/ResourceNames.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/plugin/generic/shared/ResourceNames.java @@ -19,9 +19,8 @@ package ch.systemsx.cisd.openbis.plugin.generic.shared; /** * Resource name used in <i>generic</i> plug-in. * <p> - * Be aware about the uniqueness of the bean names loaded by <i>Spring</i>. Names defined here - * should not conflict with already existing bean names. Look for other <code>ResourceNames</code> - * classes. + * Be aware about the uniqueness of the bean names loaded by <i>Spring</i>. Names defined here should not conflict with already existing bean names. + * Look for other <code>ResourceNames</code> classes. * </p> * * @author Christian Ribeaud diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/plugin/query/client/api/v1/IQueryApiFacade.java b/openbis/source/java/ch/systemsx/cisd/openbis/plugin/query/client/api/v1/IQueryApiFacade.java index 079dd9726c4..79c6d5eab87 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/plugin/query/client/api/v1/IQueryApiFacade.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/plugin/query/client/api/v1/IQueryApiFacade.java @@ -58,18 +58,17 @@ public interface IQueryApiFacade public List<ReportDescription> listTableReportDescriptions(); /** - * Creates for the specified data sets and specified report description a report. Available - * report descriptions can be obtained by {@link #listTableReportDescriptions()}. + * Creates for the specified data sets and specified report description a report. Available report descriptions can be obtained by + * {@link #listTableReportDescriptions()}. */ @Retry public QueryTableModel createReportFromDataSets(ReportDescription reportDescription, List<String> dataSetCodes); /** - * Creates for the specified data sets and specified report key a report. It groups the data - * sets by a data store and creates a report for each group of objects on appropriate data store - * server. Results from the data stores are combined and returned as a result of this method. - * Available report keys can be obtained by {@link #listTableReportDescriptions()}. + * Creates for the specified data sets and specified report key a report. It groups the data sets by a data store and creates a report for each + * group of objects on appropriate data store server. Results from the data stores are combined and returned as a result of this method. Available + * report keys can be obtained by {@link #listTableReportDescriptions()}. */ @Retry public QueryTableModel createReportFromDataSets(String reportKey, List<String> dataSetCodes); @@ -87,9 +86,8 @@ public interface IQueryApiFacade public List<AggregationServiceDescription> listAggregationServices(); /** - * Executes the specified aggregation or ingestion service for the specified parameters and - * creates a report. Available service descriptions can be obtained by - * {@link #listAggregationServices()}. + * Executes the specified aggregation or ingestion service for the specified parameters and creates a report. Available service descriptions can + * be obtained by {@link #listAggregationServices()}. */ @Retry public QueryTableModel createReportFromAggregationService( diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/plugin/query/client/web/client/IQueryClientService.java b/openbis/source/java/ch/systemsx/cisd/openbis/plugin/query/client/web/client/IQueryClientService.java index f3c5b547b08..8b2f904cfe3 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/plugin/query/client/web/client/IQueryClientService.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/plugin/query/client/web/client/IQueryClientService.java @@ -38,9 +38,8 @@ import ch.systemsx.cisd.openbis.plugin.query.shared.basic.dto.QueryParameterBind /** * Service interface for the query module GWT client. * <p> - * Each method should declare throwing {@link UserFailureException}. The authorization framework can - * throw it when the user has insufficient privileges. If it is not marked, the GWT client will - * report unexpected exception. + * Each method should declare throwing {@link UserFailureException}. The authorization framework can throw it when the user has insufficient + * privileges. If it is not marked, the GWT client will report unexpected exception. * </p> * * @author Piotr Buczek diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/plugin/query/client/web/client/IQueryClientServiceAsync.java b/openbis/source/java/ch/systemsx/cisd/openbis/plugin/query/client/web/client/IQueryClientServiceAsync.java index 2d6aea7ea64..4817369641a 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/plugin/query/client/web/client/IQueryClientServiceAsync.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/plugin/query/client/web/client/IQueryClientServiceAsync.java @@ -54,8 +54,7 @@ public interface IQueryClientServiceAsync extends IClientServiceAsync AsyncCallback<TableModelReference> callback); /** - * @see IQueryClientService#createQueryResultsReport(QueryDatabase, String, - * QueryParameterBindings) + * @see IQueryClientService#createQueryResultsReport(QueryDatabase, String, QueryParameterBindings) */ public void createQueryResultsReport(QueryDatabase queryDatabase, String sqlQuery, QueryParameterBindings bindingsOrNull, AsyncCallback<TableModelReference> callback); diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/plugin/query/client/web/client/application/Dict.java b/openbis/source/java/ch/systemsx/cisd/openbis/plugin/query/client/web/client/application/Dict.java index 3e5f277debd..a51620ee10b 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/plugin/query/client/web/client/application/Dict.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/plugin/query/client/web/client/application/Dict.java @@ -17,8 +17,7 @@ package ch.systemsx.cisd.openbis.plugin.query.client.web.client.application; /** - * An {@link ch.systemsx.cisd.openbis.generic.client.web.client.application.Dict} extension for - * <i>query</i> specific message keys. + * An {@link ch.systemsx.cisd.openbis.generic.client.web.client.application.Dict} extension for <i>query</i> specific message keys. * * @author Christian Ribeaud */ diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/plugin/query/client/web/client/application/module/QueryDatabaseSelectionWidget.java b/openbis/source/java/ch/systemsx/cisd/openbis/plugin/query/client/web/client/application/module/QueryDatabaseSelectionWidget.java index 3db3d9db74b..d2e35a2cef1 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/plugin/query/client/web/client/application/module/QueryDatabaseSelectionWidget.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/plugin/query/client/web/client/application/module/QueryDatabaseSelectionWidget.java @@ -85,7 +85,7 @@ public final class QueryDatabaseSelectionWidget extends return DatabaseModificationKind.any(ObjectKind.QUERY); } - // + // // initial value support // diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/plugin/query/client/web/client/dto/QueryBrowserGridColumnIDs.java b/openbis/source/java/ch/systemsx/cisd/openbis/plugin/query/client/web/client/dto/QueryBrowserGridColumnIDs.java index 9500051c736..c430925f3c6 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/plugin/query/client/web/client/dto/QueryBrowserGridColumnIDs.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/plugin/query/client/web/client/dto/QueryBrowserGridColumnIDs.java @@ -26,12 +26,20 @@ import ch.systemsx.cisd.openbis.plugin.query.client.web.client.application.modul public class QueryBrowserGridColumnIDs { public static final String NAME = "NAME"; + public static final String DESCRIPTION = "DESCRIPTION"; + public static final String SQL_QUERY = "SQL_QUERY"; + public static final String IS_PUBLIC = "IS_PUBLIC"; + public static final String QUERY_TYPE = "QUERY_TYPE"; + public static final String ENTITY_TYPE = "ENTITY_TYPE"; + public static final String QUERY_DATABASE = "QUERY_DATABASE"; + public static final String REGISTRATOR = "REGISTRATOR"; + public static final String REGISTRATION_DATE = "REGISTRATION_DATE"; } diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/plugin/query/client/web/server/QueryClientServiceServlet.java b/openbis/source/java/ch/systemsx/cisd/openbis/plugin/query/client/web/server/QueryClientServiceServlet.java index 935833b48da..377ee0f755b 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/plugin/query/client/web/server/QueryClientServiceServlet.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/plugin/query/client/web/server/QueryClientServiceServlet.java @@ -29,16 +29,15 @@ import ch.systemsx.cisd.openbis.plugin.query.shared.ResourceNames; /** * The {@link GWTRPCServiceExporter} for the <i>query</i> service. * <p> - * <i>URL</i> mappings are: <code>/query</code> and <code>/openbis/query</code>. The encapsulated - * {@link ICommonClientService} service implementation is expected to be defined as bean with name - * <code>query-plugin-service</code>. + * <i>URL</i> mappings are: <code>/query</code> and <code>/openbis/query</code>. The encapsulated {@link ICommonClientService} service implementation + * is expected to be defined as bean with name <code>query-plugin-service</code>. * </p> * * @author Christian Ribeaud */ @Controller @RequestMapping( - { "/query", "/openbis/query" }) +{ "/query", "/openbis/query" }) public final class QueryClientServiceServlet extends GWTRPCServiceExporter { private static final long serialVersionUID = 1L; diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/plugin/query/server/DAO.java b/openbis/source/java/ch/systemsx/cisd/openbis/plugin/query/server/DAO.java index e537f82a4dc..f2609258191 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/plugin/query/server/DAO.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/plugin/query/server/DAO.java @@ -264,9 +264,8 @@ class DAO extends SimpleJdbcDaoSupport implements IDAO /** * A class for figuring out the parameter type. * <p> - * Note that some JDBC drivers (like the one from Oracle) have - * {@link ParameterMetaData#getParameterType(int)} not implemented and thus requires setting it - * explicitly in the variable metadata. + * Note that some JDBC drivers (like the one from Oracle) have {@link ParameterMetaData#getParameterType(int)} not implemented and thus requires + * setting it explicitly in the variable metadata. */ private static class ParameterTypeProvider { diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/plugin/query/server/api/v1/QueryServiceJsonServer.java b/openbis/source/java/ch/systemsx/cisd/openbis/plugin/query/server/api/v1/QueryServiceJsonServer.java index 222e3fdba2c..b4c79fc81fb 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/plugin/query/server/api/v1/QueryServiceJsonServer.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/plugin/query/server/api/v1/QueryServiceJsonServer.java @@ -56,11 +56,12 @@ public class QueryServiceJsonServer extends AbstractApiJsonServiceExporter } @RequestMapping( - { IQueryApiServer.JSON_SERVICE_URL, "/openbis" + IQueryApiServer.JSON_SERVICE_URL }) + { IQueryApiServer.JSON_SERVICE_URL, "/openbis" + IQueryApiServer.JSON_SERVICE_URL }) @Override public void handleRequest(HttpServletRequest request, HttpServletResponse response) throws ServletException, - IOException { + IOException + { super.handleRequest(request, response); - } + } } diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/plugin/query/server/api/v1/ResourceNames.java b/openbis/source/java/ch/systemsx/cisd/openbis/plugin/query/server/api/v1/ResourceNames.java index aa4c659946a..d41255c5add 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/plugin/query/server/api/v1/ResourceNames.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/plugin/query/server/api/v1/ResourceNames.java @@ -17,8 +17,6 @@ package ch.systemsx.cisd.openbis.plugin.query.server.api.v1; /** - * - * * @author Franz-Josef Elmer */ public class ResourceNames diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/plugin/query/server/authorization/resultfilter/QueryResultFilter.java b/openbis/source/java/ch/systemsx/cisd/openbis/plugin/query/server/authorization/resultfilter/QueryResultFilter.java index 964d38b364f..be4ebf4f9e5 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/plugin/query/server/authorization/resultfilter/QueryResultFilter.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/plugin/query/server/authorization/resultfilter/QueryResultFilter.java @@ -37,8 +37,8 @@ import ch.systemsx.cisd.openbis.plugin.query.server.authorization.AuthorizationC import ch.systemsx.cisd.openbis.plugin.query.server.authorization.IAuthorizationChecker; /** - * Filters the rows of {@link TableModel} on magic columns (experiment, sample or data set - * referenced by 'experiment_key', 'sample_key', 'data_set_key'). + * Filters the rows of {@link TableModel} on magic columns (experiment, sample or data set referenced by 'experiment_key', 'sample_key', + * 'data_set_key'). * * @author Izabela Adamczyk */ @@ -49,7 +49,7 @@ public class QueryResultFilter private final IAuthorizationChecker authorizationChecker; private static final EntityKind[] FILTRABLE_ENTITY_KINDS = - { EntityKind.EXPERIMENT, EntityKind.SAMPLE, EntityKind.DATA_SET }; + { EntityKind.EXPERIMENT, EntityKind.SAMPLE, EntityKind.DATA_SET }; public QueryResultFilter(IDAOFactory daoFactory) { diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/plugin/query/shared/IQueryDatabaseDefinitionProvider.java b/openbis/source/java/ch/systemsx/cisd/openbis/plugin/query/shared/IQueryDatabaseDefinitionProvider.java index 2e01a350053..0720c922eae 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/plugin/query/shared/IQueryDatabaseDefinitionProvider.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/plugin/query/shared/IQueryDatabaseDefinitionProvider.java @@ -33,8 +33,7 @@ public interface IQueryDatabaseDefinitionProvider void initDatabaseDefinitions(); /** - * Returns {@link DatabaseDefinition} configured for given <var>dbKey</var> or null if such a - * definition doesn't exist. + * Returns {@link DatabaseDefinition} configured for given <var>dbKey</var> or null if such a definition doesn't exist. * * @throws UserFailureException if this provider wasn't initialized before */ diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/plugin/query/shared/ResourceNames.java b/openbis/source/java/ch/systemsx/cisd/openbis/plugin/query/shared/ResourceNames.java index a622d2f8da8..3177410c720 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/plugin/query/shared/ResourceNames.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/plugin/query/shared/ResourceNames.java @@ -19,9 +19,8 @@ package ch.systemsx.cisd.openbis.plugin.query.shared; /** * Resource name used in <i>query</i> plug-in. * <p> - * Be aware about the uniqueness of the bean names loaded by <i>Spring</i>. Names defined here - * should not conflict with already existing bean names. Look for other <code>ResourceNames</code> - * classes. + * Be aware about the uniqueness of the bean names loaded by <i>Spring</i>. Names defined here should not conflict with already existing bean names. + * Look for other <code>ResourceNames</code> classes. * </p> * * @author Franz-Josef Elmer diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/plugin/query/shared/api/v1/IQueryApiServer.java b/openbis/source/java/ch/systemsx/cisd/openbis/plugin/query/shared/api/v1/IQueryApiServer.java index d4b3a367532..f2442a13895 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/plugin/query/shared/api/v1/IQueryApiServer.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/plugin/query/shared/api/v1/IQueryApiServer.java @@ -48,8 +48,7 @@ public interface IQueryApiServer extends IRpcService public static final String JSON_SERVICE_URL = QUERY_PLUGIN_SERVER_URL + ".json"; /** - * Tries to authenticate specified user with specified password. Returns session token if - * succeeded otherwise <code>null</code> is returned. + * Tries to authenticate specified user with specified password. Returns session token if succeeded otherwise <code>null</code> is returned. */ @Transactional // this is not a readOnly transaction - it can create new users @@ -83,8 +82,7 @@ public interface IQueryApiServer extends IRpcService public List<ReportDescription> listTableReportDescriptions(String sessionToken); /** - * Creates for the specified data sets a report. Available reports can be obtained by - * {@link #listTableReportDescriptions(String)}. + * Creates for the specified data sets a report. Available reports can be obtained by {@link #listTableReportDescriptions(String)}. * * @param dataStoreCode Code of the data store. * @param serviceKey Key of the data store service. @@ -95,10 +93,9 @@ public interface IQueryApiServer extends IRpcService String serviceKey, List<String> dataSetCodes); /** - * Creates for the specified data sets a report. It groups the data sets by a data store and - * creates a report for each group of objects on appropriate data store server. Results from the - * data stores are combined and returned as a result of this method. Available report keys can - * be obtained by {@link #listTableReportDescriptions(String)}. + * Creates for the specified data sets a report. It groups the data sets by a data store and creates a report for each group of objects on + * appropriate data store server. Results from the data stores are combined and returned as a result of this method. Available report keys can be + * obtained by {@link #listTableReportDescriptions(String)}. * * @param serviceKey Key of the data store service. * @since 1.6 @@ -116,10 +113,8 @@ public interface IQueryApiServer extends IRpcService public List<AggregationServiceDescription> listAggregationServices(String sessionToken); /** - * Executes the specified aggregation or ingestion service for the specified parameters and - * creates a report. Available service descriptions can be obtained by - * {@link #listAggregationServices(String)}. The service resolved to by the serviceKey must be a - * service of type REPORT. + * Executes the specified aggregation or ingestion service for the specified parameters and creates a report. Available service descriptions can + * be obtained by {@link #listAggregationServices(String)}. The service resolved to by the serviceKey must be a service of type REPORT. * * @param sessionToken A valid session token. * @param dataStoreCode Code of the data store. diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/plugin/query/shared/api/v1/dto/QueryDescription.java b/openbis/source/java/ch/systemsx/cisd/openbis/plugin/query/shared/api/v1/dto/QueryDescription.java index bac747fbfe4..3346a88fbfa 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/plugin/query/shared/api/v1/dto/QueryDescription.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/plugin/query/shared/api/v1/dto/QueryDescription.java @@ -26,8 +26,8 @@ import ch.systemsx.cisd.base.annotation.JsonObject; import ch.systemsx.cisd.openbis.generic.shared.api.v1.util.JsonPropertyUtil; /** - * Description of a query. Contains everything needed on client side to show to the user what - * queries are available, to specify parameter bindings, and to identify a query uniquely. + * Description of a query. Contains everything needed on client side to show to the user what queries are available, to specify parameter bindings, + * and to identify a query uniquely. * * @author Franz-Josef Elmer */ @@ -102,8 +102,7 @@ public class QueryDescription implements Serializable } /** - * Returns <code>true</code> if and only if the specified object is of type - * {@link QueryDescription} and has the same ID as this. + * Returns <code>true</code> if and only if the specified object is of type {@link QueryDescription} and has the same ID as this. */ @Override public boolean equals(Object obj) diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/plugin/query/shared/api/v1/dto/QueryTableModel.java b/openbis/source/java/ch/systemsx/cisd/openbis/plugin/query/shared/api/v1/dto/QueryTableModel.java index 077b258f3dc..1876c4f48a8 100644 --- a/openbis/source/java/ch/systemsx/cisd/openbis/plugin/query/shared/api/v1/dto/QueryTableModel.java +++ b/openbis/source/java/ch/systemsx/cisd/openbis/plugin/query/shared/api/v1/dto/QueryTableModel.java @@ -60,8 +60,7 @@ public class QueryTableModel implements Serializable /** * Adds a row of values. * - * @throws IllegalArgumentException if the number of values is not the same as the number of - * columns. + * @throws IllegalArgumentException if the number of values is not the same as the number of columns. */ public void addRow(Serializable[] values) { @@ -99,8 +98,7 @@ public class QueryTableModel implements Serializable } /** - * Jackson cannot deserialize things typed as Serializable because it has no idea what the - * correct type might be. + * Jackson cannot deserialize things typed as Serializable because it has no idea what the correct type might be. * <p> * Thus we convert the values to strings and add type information. */ diff --git a/openbis/sourceTest/java/ch/ethz/sis/openbis/generic/server/asapi/v3/cache/SearchCacheTest.java b/openbis/sourceTest/java/ch/ethz/sis/openbis/generic/server/asapi/v3/cache/SearchCacheTest.java index fd64a8caffb..eeb7bd655b3 100644 --- a/openbis/sourceTest/java/ch/ethz/sis/openbis/generic/server/asapi/v3/cache/SearchCacheTest.java +++ b/openbis/sourceTest/java/ch/ethz/sis/openbis/generic/server/asapi/v3/cache/SearchCacheTest.java @@ -208,7 +208,7 @@ public class SearchCacheTest final CacheManager manager = new CacheManager(new ByteArrayInputStream(managerConfig.getBytes())); SearchCache cache = new SearchCache( - new RuntimeCache<Serializable, Serializable>(manager, SearchCache.CACHE_NAME, + new RuntimeCache<Serializable, Serializable>(manager, SearchCache.CACHE_NAME, SearchCache.CACHE_SIZE_PROPERTY_NAME) { @Override diff --git a/openbis/sourceTest/java/ch/ethz/sis/openbis/generic/server/asapi/v3/executor/method/AbstractSearchMethodExecutorTest.java b/openbis/sourceTest/java/ch/ethz/sis/openbis/generic/server/asapi/v3/executor/method/AbstractSearchMethodExecutorTest.java index 7707b9be848..7945d0996f9 100644 --- a/openbis/sourceTest/java/ch/ethz/sis/openbis/generic/server/asapi/v3/executor/method/AbstractSearchMethodExecutorTest.java +++ b/openbis/sourceTest/java/ch/ethz/sis/openbis/generic/server/asapi/v3/executor/method/AbstractSearchMethodExecutorTest.java @@ -58,7 +58,7 @@ public class AbstractSearchMethodExecutorTest private static final String SESSION_TOKEN2 = "sessionToken2"; private MessageChannel channel; - + private MessageChannel channel2; private TestSearchMethodExecutor executor; @@ -240,7 +240,7 @@ public class AbstractSearchMethodExecutorTest private Map<Thread, SearchCacheEntry<Object>> entries = new HashMap<>(); private IDelegatedAction getAction; - + private IDelegatedAction putAction; private SearchCacheEntry<Object> defaultEntry; @@ -280,7 +280,7 @@ public class AbstractSearchMethodExecutorTest } @Override - protected Collection doSearchAndTranslate(IOperationContext context, AbstractSearchCriteria criteria, + protected Collection doSearchAndTranslate(IOperationContext context, AbstractSearchCriteria criteria, FetchOptions fetchOptions) { return Collections.emptySet(); @@ -300,7 +300,7 @@ public class AbstractSearchMethodExecutorTest { this.getAction = getAction; } - + void setPutAction(IDelegatedAction putAction) { this.putAction = putAction; diff --git a/openbis/sourceTest/java/ch/ethz/sis/openbis/generic/server/asapi/v3/executor/sample/FullSampleIdentifierTest.java b/openbis/sourceTest/java/ch/ethz/sis/openbis/generic/server/asapi/v3/executor/sample/FullSampleIdentifierTest.java index 1706cce1642..c0b0fae72ef 100644 --- a/openbis/sourceTest/java/ch/ethz/sis/openbis/generic/server/asapi/v3/executor/sample/FullSampleIdentifierTest.java +++ b/openbis/sourceTest/java/ch/ethz/sis/openbis/generic/server/asapi/v3/executor/sample/FullSampleIdentifierTest.java @@ -24,8 +24,6 @@ import org.testng.annotations.Test; import ch.ethz.sis.openbis.generic.server.asapi.v3.executor.sample.FullSampleIdentifier; /** - * - * * @author Franz-Josef Elmer */ public class FullSampleIdentifierTest @@ -39,15 +37,15 @@ public class FullSampleIdentifierTest assertSampId("/SPACE1/S2"); assertSampId("/SPACE1/S2:A02"); // TODO: project samples -// assertSampId("/SPACE1/PROJECT1/S1"); -// assertSampId("/SPACE1/PROJECT1/S1:A02"); + // assertSampId("/SPACE1/PROJECT1/S1"); + // assertSampId("/SPACE1/PROJECT1/S1:A02"); assertSampIdWithHomeSpace("/HS/S1", "//s1", "HS"); assertSampIdWithHomeSpace("/HS/C1:S1", "//c1:s1", "HS"); -// assertSampIdWithHomeSpace("/HS/PROJECT1/S1", "//Project1/s1", "HS"); -// assertSampIdWithHomeSpace("/HS/PROJECT1/C1:S1", "//project1/c1:s1", "HS"); -// assertSampIdWithHomeSpace("/SP1/PROJECT1/C1:S1", "/sp1/project1/c1:s1", "HS"); + // assertSampIdWithHomeSpace("/HS/PROJECT1/S1", "//Project1/s1", "HS"); + // assertSampIdWithHomeSpace("/HS/PROJECT1/C1:S1", "//project1/c1:s1", "HS"); + // assertSampIdWithHomeSpace("/SP1/PROJECT1/C1:S1", "/sp1/project1/c1:s1", "HS"); } - + @Test public void testFailingCases() { @@ -56,17 +54,17 @@ public class FullSampleIdentifierTest assertInvalidSampId("Sample identifier has to start with a '/': A/BC", "A/BC"); assertInvalidSampId("Sample identifier can not contain more than three '/': /A/B/C/D", "/A/B/C/D"); assertInvalidSampId("Sample code can not contain more than one ':': /A/B:C:D", "/A/B:C:D"); - + assertInvalidSampId("Sample identifier don't contain any codes: ///", "///"); assertInvalidSampId("Sample identifier don't contain any codes: //", "//"); assertInvalidSampId("Sample identifier don't contain any codes: /", "/"); - + assertInvalidSampId("Space code can not be an empty string.", "//S1"); assertInvalidSampId("Project code can not be an empty string.", "/S//S1"); assertInvalidSampId("Sample code starts or ends with ':': /S/:S1", "/S/:S1"); assertInvalidSampId("Sample code starts or ends with ':': /S/C1:", "/S/C1:"); assertInvalidSampId("Sample code can not contain more than one ':': /S/C1:S1:", "/S/C1:S1:"); - + String prefix = " containing other characters than letters, numbers, '_', '-' and '.': "; assertInvalidSampId("Sample code" + prefix + "S1&*", "/S1&*"); assertInvalidSampId("Space code" + prefix + "SPA&CE1", "/SPA&CE1/S2"); @@ -74,12 +72,12 @@ public class FullSampleIdentifierTest assertInvalidSampId("Project code" + prefix + "PRO<>JECT1", "/SPACE1/PRO<>JECT1/S1"); assertInvalidSampId("Sample subcode" + prefix + "A0(2", "/SPACE1/PROJECT1/S1:A0(2"); } - + private void assertInvalidSampId(String expectedErrorMsg, String identifier) { assertInvalidSampId(expectedErrorMsg, identifier, null); } - + private void assertInvalidSampId(String expectedErrorMsg, String identifier, String homeSpaceOrNull) { try @@ -91,12 +89,12 @@ public class FullSampleIdentifierTest assertEquals(expectedErrorMsg, ex.getMessage()); } } - + private void assertSampId(String identifier) { assertEquals(new FullSampleIdentifier(identifier, null).toString(), identifier); } - + private void assertSampIdWithHomeSpace(String expectedIdentifier, String identifier, String homeSpace) { assertEquals(new FullSampleIdentifier(identifier, homeSpace).toString(), expectedIdentifier); diff --git a/openbis/sourceTest/java/ch/ethz/sis/openbis/systemtest/asapi/v3/AbstractDataSetTest.java b/openbis/sourceTest/java/ch/ethz/sis/openbis/systemtest/asapi/v3/AbstractDataSetTest.java index 82ee7a75e69..85878b3c574 100644 --- a/openbis/sourceTest/java/ch/ethz/sis/openbis/systemtest/asapi/v3/AbstractDataSetTest.java +++ b/openbis/sourceTest/java/ch/ethz/sis/openbis/systemtest/asapi/v3/AbstractDataSetTest.java @@ -12,14 +12,13 @@ import ch.systemsx.cisd.common.collection.SimpleComparator; public class AbstractDataSetTest extends AbstractTest { protected static final SimpleComparator<DataSet, String> DATA_SET_COMPARATOR = new SimpleComparator<DataSet, String>() + { + @Override + public String evaluate(DataSet item) { - @Override - public String evaluate(DataSet item) - { - return item.getCode(); - } - }; - + return item.getCode(); + } + }; protected static void assertIdentifiers(Collection<DataSet> dataSets, String... expectedCodesIdentifiers) { diff --git a/openbis/sourceTest/java/ch/ethz/sis/openbis/systemtest/asapi/v3/CreateExperimentTest.java b/openbis/sourceTest/java/ch/ethz/sis/openbis/systemtest/asapi/v3/CreateExperimentTest.java index 605d5c75d8a..54a5cc23eda 100644 --- a/openbis/sourceTest/java/ch/ethz/sis/openbis/systemtest/asapi/v3/CreateExperimentTest.java +++ b/openbis/sourceTest/java/ch/ethz/sis/openbis/systemtest/asapi/v3/CreateExperimentTest.java @@ -258,7 +258,7 @@ public class CreateExperimentTest extends AbstractExperimentTest public void testCreateWithSystemProperty() { final String sessionToken = v3api.login(TEST_USER, PASSWORD); - + NewETPTAssignment assignment = new NewETPTAssignment(); assignment.setPropertyTypeCode("$PLATE_GEOMETRY"); assignment.setEntityTypeCode("SIRNA_HCS"); diff --git a/openbis/sourceTest/java/ch/ethz/sis/openbis/systemtest/asapi/v3/CreateMaterialTest.java b/openbis/sourceTest/java/ch/ethz/sis/openbis/systemtest/asapi/v3/CreateMaterialTest.java index fbfc7abe00b..2248b25283f 100644 --- a/openbis/sourceTest/java/ch/ethz/sis/openbis/systemtest/asapi/v3/CreateMaterialTest.java +++ b/openbis/sourceTest/java/ch/ethz/sis/openbis/systemtest/asapi/v3/CreateMaterialTest.java @@ -74,7 +74,7 @@ public class CreateMaterialTest extends AbstractSampleTest public void testMaterialCreationWithSystemProperty() { String sessionToken = v3api.login(TEST_USER, PASSWORD); - + NewETPTAssignment assignment = new NewETPTAssignment(); assignment.setPropertyTypeCode("$PLATE_GEOMETRY"); assignment.setEntityTypeCode("GENE"); @@ -95,7 +95,7 @@ public class CreateMaterialTest extends AbstractSampleTest Material material = map.get(new MaterialPermId("1982", "GENE")); assertEquals(material.getCode(), "1982"); assertEquals(material.getPermId().getTypeCode(), "GENE"); - + assertEquals(material.getProperty("$PLATE_GEOMETRY"), "384_WELLS_16X24"); } @@ -109,7 +109,7 @@ public class CreateMaterialTest extends AbstractSampleTest TagCode test123 = new TagCode("TEST_123"); TagCode testMetaprojects = new TagCode("TEST_METAPROJECTS"); m1.setTagIds(Arrays.asList(test123, testMetaprojects)); - + List<MaterialPermId> materialIds = v3api.createMaterials(sessionToken, Arrays.asList(m1)); MaterialFetchOptions fetchOptions = new MaterialFetchOptions(); @@ -236,6 +236,7 @@ public class CreateMaterialTest extends AbstractSampleTest } }, "Property type with code 'CODE_THAT_DOESNT_EXIST' does not exist"); } + private MaterialCreation materialCreation(MaterialPermId permId) { String code = permId.getCode(); diff --git a/openbis/sourceTest/java/ch/ethz/sis/openbis/systemtest/asapi/v3/CreateSampleTest.java b/openbis/sourceTest/java/ch/ethz/sis/openbis/systemtest/asapi/v3/CreateSampleTest.java index d74c97a9f5f..cf51c1d2d0f 100644 --- a/openbis/sourceTest/java/ch/ethz/sis/openbis/systemtest/asapi/v3/CreateSampleTest.java +++ b/openbis/sourceTest/java/ch/ethz/sis/openbis/systemtest/asapi/v3/CreateSampleTest.java @@ -84,7 +84,7 @@ public class CreateSampleTest extends AbstractSampleTest final String sessionToken = v3api.login(TEST_USER, PASSWORD); final SampleCreation sample = sampleCreation("SAMPLE_WITH_USER_GIVEN_CODE"); sample.setAutoGeneratedCode(true); - + assertUserFailureException(new IDelegatedAction() { @Override @@ -103,12 +103,11 @@ public class CreateSampleTest extends AbstractSampleTest sample1.setAutoGeneratedCode(true); final SampleCreation sample2 = sampleCreation(null); sample2.setAutoGeneratedCode(true); - + List<SamplePermId> sampleWithAutogeneratedCode = v3api.createSamples(sessionToken, Arrays.asList(sample1, sample2)); AssertionUtil.assertCollectionSize(sampleWithAutogeneratedCode, 2); } - @Test public void testCreateWithCodeExisting() { diff --git a/openbis/sourceTest/java/ch/ethz/sis/openbis/systemtest/asapi/v3/EntityDeletionTest.java b/openbis/sourceTest/java/ch/ethz/sis/openbis/systemtest/asapi/v3/EntityDeletionTest.java index 6ff28dc476b..d52c6bd5057 100644 --- a/openbis/sourceTest/java/ch/ethz/sis/openbis/systemtest/asapi/v3/EntityDeletionTest.java +++ b/openbis/sourceTest/java/ch/ethz/sis/openbis/systemtest/asapi/v3/EntityDeletionTest.java @@ -33,7 +33,6 @@ import ch.systemsx.cisd.openbis.generic.server.business.bo.entitygraph.EntityNod import ch.systemsx.cisd.openbis.generic.server.business.bo.entitygraph.SampleNode; import ch.systemsx.cisd.openbis.systemtest.AbstractEntityDeletionTestCase; - /** * Implementation of {@link AbstractEntityDeletionTestCase} based on V3 API. * @@ -44,7 +43,7 @@ public class EntityDeletionTest extends AbstractEntityDeletionTestCase { private static final String CONTEXT_DESCRIPTION = " (Context: [])"; - + @Autowired protected IApplicationServerApi v3api; diff --git a/openbis/sourceTest/java/ch/ethz/sis/openbis/systemtest/asapi/v3/GetSampleTest.java b/openbis/sourceTest/java/ch/ethz/sis/openbis/systemtest/asapi/v3/GetSampleTest.java index f92321d6a6f..401b9a9fff2 100644 --- a/openbis/sourceTest/java/ch/ethz/sis/openbis/systemtest/asapi/v3/GetSampleTest.java +++ b/openbis/sourceTest/java/ch/ethz/sis/openbis/systemtest/asapi/v3/GetSampleTest.java @@ -1065,23 +1065,23 @@ public class GetSampleTest extends AbstractSampleTest assertSpaceNotFetched(sample); v3api.logout(sessionToken); } - + @Test public void testGetWithTypeAndPropertyAssignments() { String sessionToken = v3api.login(TEST_USER, PASSWORD); SampleFetchOptions fetchOptions = new SampleFetchOptions(); fetchOptions.withType().withPropertyAssignments().sortBy().label().desc(); - + List<SamplePermId> sampleIds = Collections.singletonList(new SamplePermId("200811050917877-331")); Map<ISampleId, Sample> map = v3api.getSamples(sessionToken, sampleIds, fetchOptions); List<Sample> samples = new ArrayList<Sample>(map.values()); - + assertEquals(samples.size(), 1); - + Sample sample = samples.get(0); assertEquals(sample.getIdentifier().toString(), "/CISD/MP002-1"); - + SampleType type = sample.getType(); assertEquals(type.getCode(), "MASTER_PLATE"); assertEquals(type.getFetchOptions().hasPropertyAssignments(), true); diff --git a/openbis/sourceTest/java/ch/ethz/sis/openbis/systemtest/asapi/v3/ProjectSampleTest.java b/openbis/sourceTest/java/ch/ethz/sis/openbis/systemtest/asapi/v3/ProjectSampleTest.java index b891fb6468a..94db197b491 100644 --- a/openbis/sourceTest/java/ch/ethz/sis/openbis/systemtest/asapi/v3/ProjectSampleTest.java +++ b/openbis/sourceTest/java/ch/ethz/sis/openbis/systemtest/asapi/v3/ProjectSampleTest.java @@ -22,1165 +22,427 @@ import org.testng.annotations.Test; import ch.systemsx.cisd.openbis.systemtest.base.BaseTest; /** - * - * * @author Franz-Josef Elmer */ @TransactionConfiguration(transactionManager = "transaction-manager", defaultRollback = false) @Test(groups = "project-samples") public class ProjectSampleTest extends BaseTest { - /* - private static final String SYSTEM_USER = "system"; - private static final SpacePermId HOME_SPACE_ID = new SpacePermId("DEFAULT"); - private static final Logger operationLog = LogFactory.getLogger(LogCategory.OPERATION, ProjectSampleTest.class); - private static final EntityTypePermId ENTITY_TYPE_UNKNOWN = new EntityTypePermId("UNKNOWN"); - - @Autowired - protected IApplicationServerApi v3api; - - private ISpaceId space1; - private ISpaceId space2; - private ProjectPermId project1inSpace1; - private ProjectPermId project2inSpace1; - private ProjectPermId project1inSpace2; - private ProjectPermId project2inSpace2; - private ProjectPermId project1inHomeSpace; - private String adminSessionToken; - private String adminUser; - @BeforeClass - public void createData() - { - List<SpacePermId> spaces = createSpaces(systemSessionToken, "SPACE1", "SPACE2"); - space1 = spaces.get(0); - space2 = spaces.get(1); - List<ProjectPermId> projects = createProjects(systemSessionToken, space1, "PROJECT1", "PROJECT2"); - project1inSpace1 = projects.get(0); - project2inSpace1 = projects.get(1); - project1inSpace2 = createProjects(systemSessionToken, space2, "PROJECT1").get(0); - project2inSpace2 = createProjects(systemSessionToken, space2, "PROJECT2").get(0); - project1inHomeSpace = createProjects(systemSessionToken, HOME_SPACE_ID, "PROJECT1").get(0); - createSamples(systemSessionToken, null, null, null, "SHARED1", "SHARED2"); - createSamples(systemSessionToken, space1, null, null, "SAMPLE1", "SAMPLE2"); - createSamples(systemSessionToken, space1, project1inSpace1, null, "SAMPLE3", "SAMPLE4"); - createSamples(systemSessionToken, space2, project2inSpace2, null, "SAMPLE5", "SAMPLE6"); - waitAtLeastASecond(); // to allow checks on modification time stamps - UpdateUtils.waitUntilIndexUpdaterIsIdle(applicationContext, operationLog); - SessionBuilder session = aSession().withInstanceRole(RoleCode.ADMIN); - adminUser = session.getUserID(); - adminSessionToken = create(session); - commonServer.changeUserHomeSpace(adminSessionToken, new TechId(1)); // home space = DEFAULT - } - - @Override - @AfterTransaction - @Test(enabled = false) - public void cleanDatabase() - { - // super method deletes samples, experiments and data sets from the database - } - - @Test - public void testCreateASharedSampleWithASharedSampleAsComponent() - { - String sampleCode = createUniqueCode("S"); - SampleCreation s1 = new SampleCreation(); - s1.setCode(sampleCode); - s1.setTypeId(ENTITY_TYPE_UNKNOWN); - SampleCreation s2 = new SampleCreation(); - s2.setCode("A01"); - s2.setTypeId(ENTITY_TYPE_UNKNOWN); - s2.setContainerId(new SampleIdentifier(null, null, sampleCode)); - - List<SamplePermId> sampleIds = v3api.createSamples(systemSessionToken, Arrays.asList(s1, s2)); - - Map<ISampleId, Sample> samples = v3api.mapSamples(systemSessionToken, sampleIds, new SampleFetchOptions()); - assertEquals(samples.get(sampleIds.get(0)).getIdentifier().getIdentifier(), "/" + sampleCode); - assertEquals(samples.get(sampleIds.get(1)).getIdentifier().getIdentifier(), "/" + sampleCode + ":A01"); - } - - @Test - public void testCreateASharedSampleWithASpaceSampleAsComponent() - { - String sampleCode = createUniqueCode("S"); - SampleCreation s1 = new SampleCreation(); - s1.setCode(sampleCode); - s1.setTypeId(ENTITY_TYPE_UNKNOWN); - SampleCreation s2 = new SampleCreation(); - s2.setCode("A01"); - s2.setTypeId(ENTITY_TYPE_UNKNOWN); - s2.setSpaceId(space1); - s2.setContainerId(new SampleIdentifier(null, null, sampleCode)); - - List<SamplePermId> sampleIds = v3api.createSamples(systemSessionToken, Arrays.asList(s1, s2)); - - Map<ISampleId, Sample> samples = v3api.mapSamples(systemSessionToken, sampleIds, new SampleFetchOptions()); - assertEquals(samples.get(sampleIds.get(0)).getIdentifier().getIdentifier(), "/" + sampleCode); - assertEquals(samples.get(sampleIds.get(1)).getIdentifier().getIdentifier(), "/SPACE1/" + sampleCode + ":A01"); - } - - @Test - public void testCreateASharedSampleWithAProjectSampleAsComponent() - { - String projectCode = createUniqueCode("P"); - createProjects(systemSessionToken, space1, projectCode); - String sampleCode = createUniqueCode("S"); - SampleCreation s1 = new SampleCreation(); - s1.setCode(sampleCode); - s1.setTypeId(ENTITY_TYPE_UNKNOWN); - SampleCreation s2 = new SampleCreation(); - s2.setCode("A01"); - s2.setTypeId(ENTITY_TYPE_UNKNOWN); - s2.setSpaceId(space1); - s2.setProjectId(new ProjectIdentifier("SPACE1", projectCode)); - s2.setContainerId(new SampleIdentifier(null, null, sampleCode)); - - List<SamplePermId> sampleIds = v3api.createSamples(systemSessionToken, Arrays.asList(s1, s2)); - - Map<ISampleId, Sample> samples = v3api.mapSamples(systemSessionToken, sampleIds, new SampleFetchOptions()); - assertEquals(samples.get(sampleIds.get(0)).getIdentifier().getIdentifier(), "/" + sampleCode); - assertEquals(samples.get(sampleIds.get(1)).getIdentifier().getIdentifier(), "/SPACE1/" + projectCode + "/" + sampleCode + ":A01"); - } - - @Test - public void testCreateASharedSampleWithAProjectExperimentSampleAsComponent() - { - String projectCode = createUniqueCode("P"); - ProjectPermId project = createProjects(systemSessionToken, space1, projectCode).get(0); - String experimentCode = createUniqueCode("E"); - createExperiments(systemSessionToken, project, experimentCode); - String sampleCode = createUniqueCode("S"); - SampleCreation s1 = new SampleCreation(); - s1.setCode(sampleCode); - s1.setTypeId(ENTITY_TYPE_UNKNOWN); - SampleCreation s2 = new SampleCreation(); - s2.setCode("A01"); - s2.setTypeId(ENTITY_TYPE_UNKNOWN); - s2.setSpaceId(space1); - s2.setProjectId(new ProjectIdentifier("SPACE1", projectCode)); - s2.setExperimentId(new ExperimentIdentifier("SPACE1", projectCode, experimentCode)); - s2.setContainerId(new SampleIdentifier(null, null, sampleCode)); - - List<SamplePermId> sampleIds = v3api.createSamples(systemSessionToken, Arrays.asList(s1, s2)); - - Map<ISampleId, Sample> samples = v3api.mapSamples(systemSessionToken, sampleIds, new SampleFetchOptions()); - assertEquals(samples.get(sampleIds.get(0)).getIdentifier().getIdentifier(), "/" + sampleCode); - assertEquals(samples.get(sampleIds.get(1)).getIdentifier().getIdentifier(), "/SPACE1/" + projectCode + "/" + sampleCode + ":A01"); - } - - @Test - public void testCreateASharedSampleWithAnExperimentSampleAsComponent() - { - String projectCode = createUniqueCode("P"); - ProjectPermId project = createProjects(systemSessionToken, space1, projectCode).get(0); - String experimentCode = createUniqueCode("E"); - createExperiments(systemSessionToken, project, experimentCode); - String sampleCode = createUniqueCode("S"); - SampleCreation s1 = new SampleCreation(); - s1.setCode(sampleCode); - s1.setTypeId(ENTITY_TYPE_UNKNOWN); - SampleCreation s2 = new SampleCreation(); - s2.setCode("A01"); - s2.setTypeId(ENTITY_TYPE_UNKNOWN); - s2.setSpaceId(space1); - s2.setExperimentId(new ExperimentIdentifier("SPACE1", projectCode, experimentCode)); - s2.setContainerId(new SampleIdentifier(null, null, sampleCode)); - - List<SamplePermId> sampleIds = v3api.createSamples(systemSessionToken, Arrays.asList(s1, s2)); - - Map<ISampleId, Sample> samples = v3api.mapSamples(systemSessionToken, sampleIds, new SampleFetchOptions()); - assertEquals(samples.get(sampleIds.get(0)).getIdentifier().getIdentifier(), "/" + sampleCode); - assertEquals(samples.get(sampleIds.get(1)).getIdentifier().getIdentifier(), "/SPACE1/" + sampleCode + ":A01"); - } - - @Test - public void testCreateSampleAndMapSamplesByPermId() - { - String sampleCode = createUniqueCode("S"); - SampleCreation sampleCreation = new SampleCreation(); - sampleCreation.setCode(sampleCode); - sampleCreation.setTypeId(ENTITY_TYPE_UNKNOWN); - sampleCreation.setSpaceId(space1); - sampleCreation.setProjectId(project1inSpace1); - - List<SamplePermId> ids = v3api.createSamples(systemSessionToken, Arrays.asList(sampleCreation)); - - SampleFetchOptions fetchOptions = new SampleFetchOptions(); - fetchOptions.withProject(); - Map<ISampleId, Sample> samples = v3api.mapSamples(systemSessionToken, ids, fetchOptions); - Sample sample = samples.get(ids.get(0)); - assertEquals(sample.getIdentifier().getIdentifier(), "/SPACE1/PROJECT1/" + sampleCode); - assertEquals(sample.getProject().getIdentifier().getIdentifier(), "/SPACE1/PROJECT1"); - } - - @Test - public void testCreateThreeSamplesWithSameCodeInDifferentProjectOfSameSpaceAndMapSamplesByIdentifier() - { - String sampleCode = createUniqueCode("S"); - SampleCreation s1 = new SampleCreation(); - s1.setCode(sampleCode); - s1.setTypeId(ENTITY_TYPE_UNKNOWN); - s1.setSpaceId(space1); - s1.setProjectId(project1inSpace1); - SampleCreation s2 = new SampleCreation(); - s2.setCode(sampleCode); - s2.setTypeId(ENTITY_TYPE_UNKNOWN); - s2.setSpaceId(space1); - s2.setProjectId(project2inSpace1); - SampleCreation s3 = new SampleCreation(); - s3.setCode(sampleCode); - s3.setTypeId(ENTITY_TYPE_UNKNOWN); - s3.setSpaceId(space1); - - v3api.createSamples(systemSessionToken, Arrays.asList(s1, s2, s3)); - - SampleFetchOptions fetchOptions = new SampleFetchOptions(); - fetchOptions.withProject(); - List<ISampleId> ids = new ArrayList<>(); - ids.add(new SampleIdentifier("/SPACE1/PROJECT1/" + sampleCode)); - ids.add(new SampleIdentifier("/SPACE1/PROJECT2/" + sampleCode)); - ids.add(new SampleIdentifier("/SPACE1/" + sampleCode)); - Map<ISampleId, Sample> samples = v3api.mapSamples(systemSessionToken, ids, fetchOptions); - assertEquals(samples.get(ids.get(0)).getProject().getIdentifier().toString(), "/SPACE1/PROJECT1"); - assertEquals(samples.get(ids.get(1)).getProject().getIdentifier().toString(), "/SPACE1/PROJECT2"); - assertEquals(samples.get(ids.get(2)).getProject(), null); - } - - @Test - public void testCreateProjectSampleWithAProjectSampleComponentFromAnotherSpace() - { - String sampleCode = createUniqueCode("S"); - SampleCreation s1 = new SampleCreation(); - s1.setCode(sampleCode); - s1.setTypeId(ENTITY_TYPE_UNKNOWN); - s1.setSpaceId(space1); - s1.setProjectId(project1inSpace1); - SamplePermId s1PermId = v3api.createSamples(systemSessionToken, Arrays.asList(s1)).get(0); - SampleCreation s2 = new SampleCreation(); - s2.setCode("A01"); - s2.setTypeId(ENTITY_TYPE_UNKNOWN); - s2.setSpaceId(space2); - s2.setProjectId(project1inSpace2); - s2.setContainerId(s1PermId); - - v3api.createSamples(systemSessionToken, Arrays.asList(s2)); - - SampleFetchOptions fetchOptions = new SampleFetchOptions(); - fetchOptions.withProject(); - fetchOptions.withContainer(); - List<ISampleId> ids = new ArrayList<>(); - ids.add(new SampleIdentifier("/SPACE1/PROJECT1/" + sampleCode)); - ids.add(new SampleIdentifier("/SPACE2/PROJECT1/" + sampleCode + ":A01")); - Map<ISampleId, Sample> samples = v3api.mapSamples(systemSessionToken, ids, fetchOptions); - assertEquals(samples.get(ids.get(0)).getProject().getIdentifier().toString(), "/SPACE1/PROJECT1"); - assertEquals(samples.get(ids.get(1)).getProject().getIdentifier().toString(), "/SPACE2/PROJECT1"); - } - - @Test - public void testCreateProjectSampleWithComponentInHomeSpace() - { - String sampleCode = createUniqueCode("S"); - SampleCreation s1 = new SampleCreation(); - s1.setCode(sampleCode); - s1.setTypeId(ENTITY_TYPE_UNKNOWN); - s1.setSpaceId(HOME_SPACE_ID); - s1.setProjectId(project1inHomeSpace); - SamplePermId s1PermId = v3api.createSamples(systemSessionToken, Arrays.asList(s1)).get(0); - SampleCreation s2 = new SampleCreation(); - s2.setCode("A01"); - s2.setTypeId(ENTITY_TYPE_UNKNOWN); - s2.setSpaceId(HOME_SPACE_ID); - s2.setProjectId(project1inHomeSpace); - s2.setContainerId(s1PermId); - - v3api.createSamples(systemSessionToken, Arrays.asList(s2)); - - SampleFetchOptions fetchOptions = new SampleFetchOptions(); - fetchOptions.withProject(); - fetchOptions.withContainer(); - List<ISampleId> ids = new ArrayList<>(); - ids.add(new SampleIdentifier("//PROJECT1/" + sampleCode)); - ids.add(new SampleIdentifier("//PROJECT1/" + sampleCode + ":A01")); - Map<ISampleId, Sample> samples = v3api.mapSamples(adminSessionToken, ids, fetchOptions); - assertEquals(samples.get(ids.get(0)).getProject().getIdentifier().toString(), "/DEFAULT/PROJECT1"); - assertEquals(samples.get(ids.get(1)).getProject().getIdentifier().toString(), "/DEFAULT/PROJECT1"); - } - - @Test - public void testAssignSpaceSampleToAProject() - { - String sampleCode = createUniqueCode("S"); - createSamples(systemSessionToken, space1, null, null, sampleCode); - String projectCode = createUniqueCode("P"); - ProjectPermId project = createProjects(systemSessionToken, space1, projectCode).get(0); - SampleUpdate sampleUpdate = new SampleUpdate(); - sampleUpdate.setSampleId(new SampleIdentifier("/SPACE1/" + sampleCode)); - sampleUpdate.setProjectId(project); - Date now = sleep(); - - v3api.updateSamples(adminSessionToken, Arrays.asList(sampleUpdate)); - - SampleFetchOptions fetchOptions = new SampleFetchOptions(); - fetchOptions.withModifier(); - fetchOptions.withSpace(); - fetchOptions.withProject().withModifier(); - SampleIdentifier newSampleIdentifier = new SampleIdentifier("/SPACE1/" + projectCode + "/" + sampleCode); - Map<ISampleId, Sample> samples = v3api.mapSamples(systemSessionToken, Arrays.asList(newSampleIdentifier), fetchOptions); - Sample sample = samples.get(newSampleIdentifier); - assertModification(sample, sample, now, adminUser); - assertEquals(sample.getIdentifier().getIdentifier(), "/SPACE1/" + projectCode + "/" + sampleCode); - Project sampleProject = sample.getProject(); - assertEquals(sampleProject.getIdentifier().getIdentifier(), "/SPACE1/" + projectCode); - assertModification(sampleProject, sampleProject, now, adminUser); - } - - @Test - public void testAssignHomeSpaceSampleToAProjectInHomeSpace() - { - String sampleCode = createUniqueCode("S"); - createSamples(systemSessionToken, HOME_SPACE_ID, null, null, sampleCode); - String projectCode = createUniqueCode("P"); - ProjectPermId project = createProjects(systemSessionToken, HOME_SPACE_ID, projectCode).get(0); - SampleUpdate sampleUpdate = new SampleUpdate(); - sampleUpdate.setSampleId(new SampleIdentifier("//" + sampleCode)); - sampleUpdate.setProjectId(project); - Date now = sleep(); - - v3api.updateSamples(adminSessionToken, Arrays.asList(sampleUpdate)); - - SampleFetchOptions fetchOptions = new SampleFetchOptions(); - fetchOptions.withModifier(); - fetchOptions.withSpace(); - fetchOptions.withProject().withModifier(); - SampleIdentifier newSampleIdentifier = new SampleIdentifier("//" + projectCode + "/" + sampleCode); - Map<ISampleId, Sample> samples = v3api.mapSamples(adminSessionToken, Arrays.asList(newSampleIdentifier), fetchOptions); - Sample sample = samples.get(newSampleIdentifier); - assertModification(sample, sample, now, adminUser); - assertEquals(sample.getIdentifier().getIdentifier(), "/DEFAULT/" + projectCode + "/" + sampleCode); - Project sampleProject = sample.getProject(); - assertEquals(sampleProject.getIdentifier().getIdentifier(), "/DEFAULT/" + projectCode); - assertModification(sampleProject, sampleProject, now, adminUser); - } - - @Test - public void testAssignProjectSampleToADifferentProjectInTheSameSpace() - { - String projectCode1 = createUniqueCode("P"); - ProjectPermId project1 = createProjects(systemSessionToken, space1, projectCode1).get(0); - String sampleCode = createUniqueCode("S"); - SamplePermId spaceSample = createSamples(systemSessionToken, space1, project1, null, sampleCode).get(0); - String projectCode2 = createUniqueCode("P"); - ProjectPermId project2 = createProjects(systemSessionToken, space1, projectCode2).get(0); - SampleUpdate sampleUpdate = new SampleUpdate(); - sampleUpdate.setSampleId(new SampleIdentifier("/SPACE1/" + projectCode1 + "/" + sampleCode)); - sampleUpdate.setProjectId(project2); - Date now = sleep(); - - v3api.updateSamples(adminSessionToken, Arrays.asList(sampleUpdate)); - - SampleFetchOptions fetchOptions = new SampleFetchOptions(); - fetchOptions.withModifier(); - fetchOptions.withSpace(); - fetchOptions.withProject().withModifier(); - Map<ISampleId, Sample> samples = v3api.mapSamples(systemSessionToken, Arrays.asList(spaceSample), fetchOptions); - Sample sample = samples.get(spaceSample); - assertModification(sample, sample, now, adminUser); - assertEquals(sample.getIdentifier().getIdentifier(), "/SPACE1/" + projectCode2 + "/" + sampleCode); - Project sampleProject = sample.getProject(); - assertEquals(sampleProject.getIdentifier().getIdentifier(), "/SPACE1/" + projectCode2); - assertModification(sampleProject, sampleProject, now, adminUser); - ProjectFetchOptions projectFetchOptions = new ProjectFetchOptions(); - projectFetchOptions.withModifier(); - Map<IProjectId, Project> projects = v3api.mapProjects(systemSessionToken, - Arrays.asList(project1), projectFetchOptions); - assertModification(projects.get(project1), projects.get(project1), now, adminUser); - } - - @Test - public void testAssignProjectSampleWithComponentToAProjectInADifferentSpace() - { - String projectCode = createUniqueCode("P"); - ProjectPermId project1 = createProjects(systemSessionToken, space1, projectCode).get(0); - String sampleCode = createUniqueCode("S"); - SampleCreation s1 = new SampleCreation(); - s1.setCode(sampleCode); - s1.setTypeId(ENTITY_TYPE_UNKNOWN); - s1.setSpaceId(space1); - s1.setProjectId(project1); - SampleCreation s2 = new SampleCreation(); - s2.setCode("A01"); - s2.setTypeId(ENTITY_TYPE_UNKNOWN); - s2.setSpaceId(space1); - s2.setProjectId(project1); - s2.setContainerId(new SampleIdentifier("/SPACE1/" + projectCode + "/" + sampleCode)); - v3api.createSamples(systemSessionToken, Arrays.asList(s1, s2)); - ProjectPermId project2 = createProjects(systemSessionToken, space2, projectCode).get(0); - SampleUpdate sampleUpdate = new SampleUpdate(); - sampleUpdate.setSampleId(new SampleIdentifier("/SPACE1/" + projectCode + "/" + sampleCode)); - sampleUpdate.setSpaceId(space2); - sampleUpdate.setProjectId(project2); - Date now = sleep(); - - v3api.updateSamples(adminSessionToken, Arrays.asList(sampleUpdate)); - - SampleFetchOptions fetchOptions = new SampleFetchOptions(); - fetchOptions.withModifier(); - fetchOptions.withSpace(); - fetchOptions.withProject().withModifier(); - SampleIdentifier containerID = new SampleIdentifier("/SPACE2/" + projectCode + "/" + sampleCode); - SampleIdentifier componentID = new SampleIdentifier("/SPACE1/" + projectCode + "/" + sampleCode + ":A01"); - Map<ISampleId, Sample> samples = v3api.mapSamples(systemSessionToken, Arrays.asList(containerID, componentID), fetchOptions); - Sample sample = samples.get(containerID); - assertModification(sample, sample, now, adminUser); - assertEquals(sample.getIdentifier().getIdentifier(), "/SPACE2/" + projectCode + "/" + sampleCode); - Project project = sample.getProject(); - assertEquals(project.getIdentifier().getIdentifier(), "/SPACE2/" + projectCode); - assertModification(project, project, now, adminUser); - Sample component = samples.get(componentID); - assertEquals(component.getModifier().getUserId(), SYSTEM_USER); - assertEquals(component.getIdentifier().getIdentifier(), "/SPACE1/" + projectCode + "/" + sampleCode + ":A01"); - Project componentProject = component.getProject(); - assertEquals(componentProject.getIdentifier().getIdentifier(), "/SPACE1/" + projectCode); - assertModification(componentProject, componentProject, now, adminUser); - } - - @Test - public void testAssignProjectSampleToAProjectInADifferentSpace() - { - String projectCode = createUniqueCode("P"); - ProjectPermId project1 = createProjects(systemSessionToken, space1, projectCode).get(0); - String sampleCode = createUniqueCode("S"); - SamplePermId spaceSample = createSamples(systemSessionToken, space1, project1, null, sampleCode).get(0); - ProjectPermId project2 = createProjects(systemSessionToken, space2, projectCode).get(0); - SampleUpdate sampleUpdate = new SampleUpdate(); - sampleUpdate.setSampleId(spaceSample); - sampleUpdate.setSpaceId(space2); - sampleUpdate.setProjectId(project2); - Date now = sleep(); - - v3api.updateSamples(adminSessionToken, Arrays.asList(sampleUpdate)); - - SampleFetchOptions fetchOptions = new SampleFetchOptions(); - fetchOptions.withModifier(); - fetchOptions.withSpace(); - fetchOptions.withProject().withModifier(); - Map<ISampleId, Sample> samples = v3api.mapSamples(systemSessionToken, Arrays.asList(spaceSample), fetchOptions); - Sample sample = samples.get(spaceSample); - assertModification(sample, sample, now, adminUser); - assertEquals(sample.getIdentifier().getIdentifier(), "/SPACE2/" + projectCode + "/" + sampleCode); - Project project = sample.getProject(); - assertEquals(project.getIdentifier().getIdentifier(), "/SPACE2/" + projectCode); - assertModification(project, project, now, adminUser); - } - - @Test - public void testAssignExperimentWithProjectSamplesToADifferentProject() - { - String projectCode1 = createUniqueCode("P"); - String projectCode2 = projectCode1 + "A"; - createProjects(systemSessionToken, space1, projectCode1, projectCode2); - String experimentCode = createUniqueCode("E"); - ProjectIdentifier project1 = new ProjectIdentifier("SPACE1", projectCode1); - ExperimentPermId experiment = createExperiments(systemSessionToken, project1, experimentCode).get(0); - String sampleCode = createUniqueCode("S"); - SamplePermId sample = createSamples(systemSessionToken, space1, project1, experiment, sampleCode).get(0); - ExperimentUpdate experimentUpdate = new ExperimentUpdate(); - experimentUpdate.setExperimentId(experiment); - experimentUpdate.setProjectId(new ProjectIdentifier("SPACE1", projectCode2)); - Date now = sleep(); - - v3api.updateExperiments(adminSessionToken, Arrays.asList(experimentUpdate)); - - SampleFetchOptions fetchOptions = new SampleFetchOptions(); - fetchOptions.withModifier(); - fetchOptions.withSpace(); - fetchOptions.withProject().withModifier(); - Sample experimentSample = v3api.mapSamples(systemSessionToken, Arrays.asList(sample), fetchOptions).values().iterator().next(); - assertModification(experimentSample, experimentSample, now, adminUser); - assertEquals(experimentSample.getIdentifier().getIdentifier(), "/SPACE1/" + projectCode2 + "/" + sampleCode); - Project project = experimentSample.getProject(); - assertEquals(project.getIdentifier().getIdentifier(), "/SPACE1/" + projectCode2); - assertModification(project, project, now, adminUser); - ExperimentFetchOptions experimentFetchOptions = new ExperimentFetchOptions(); - experimentFetchOptions.withModifier(); - Experiment sampleExperiment = v3api.mapExperiments(systemSessionToken, Arrays.asList(experiment), - experimentFetchOptions).values().iterator().next(); - assertModification(sampleExperiment, sampleExperiment, now, adminUser); - } - - @Test - public void testDeleteExperimentWithProjectSamples() - { - String projectCode = createUniqueCode("P"); - createProjects(systemSessionToken, space1, projectCode); - String experimentCode = createUniqueCode("E"); - ProjectIdentifier project = new ProjectIdentifier("SPACE1", projectCode); - ExperimentPermId experiment = createExperiments(systemSessionToken, project, experimentCode).get(0); - String sampleCode = createUniqueCode("S"); - SamplePermId sample = createSamples(systemSessionToken, space1, project, experiment, sampleCode).get(0); - ExperimentDeletionOptions deletionOptions = new ExperimentDeletionOptions(); - deletionOptions.setReason("a test"); - - v3api.deleteExperiments(adminSessionToken, Arrays.asList(experiment), deletionOptions); - - assertEquals(v3api.mapSamples(systemSessionToken, Arrays.asList(sample), new SampleFetchOptions()).size(), 0); - ExperimentFetchOptions experimentFetchOptions = new ExperimentFetchOptions(); - experimentFetchOptions.withModifier(); - assertEquals(v3api.mapExperiments(systemSessionToken, Arrays.asList(experiment), - experimentFetchOptions).size(), 0); - } - - @Test - public void testUnassignProjectSampleFromProject() - { - String projectCode = createUniqueCode("P"); - ProjectPermId project = createProjects(systemSessionToken, space1, projectCode).get(0); - String sampleCode = createUniqueCode("S"); - SamplePermId projectSample = createSamples(systemSessionToken, space1, project, null, sampleCode).get(0); - SampleUpdate sampleUpdate = new SampleUpdate(); - sampleUpdate.setSampleId(projectSample); - sampleUpdate.setProjectId(null); - Date now = sleep(); - - v3api.updateSamples(adminSessionToken, Arrays.asList(sampleUpdate)); - - SampleFetchOptions fetchOptions = new SampleFetchOptions(); - fetchOptions.withModifier(); - fetchOptions.withSpace(); - fetchOptions.withProject().withModifier(); - Map<ISampleId, Sample> samples = v3api.mapSamples(systemSessionToken, Arrays.asList(projectSample), fetchOptions); - Sample sample = samples.get(projectSample); - assertModification(sample, sample, now, adminUser); - assertEquals(sample.getIdentifier().getIdentifier(), "/SPACE1/" + sampleCode); - assertEquals(sample.getProject(), null); - ProjectFetchOptions projectFetchOptions = new ProjectFetchOptions(); - projectFetchOptions.withModifier(); - Map<IProjectId, Project> projects = v3api.mapProjects(systemSessionToken, - Arrays.asList(project), projectFetchOptions); - Project previousProject = projects.values().iterator().next(); - assertModification(previousProject, previousProject, now, adminUser); - } - - @Test - public void testUnassignProjectSampleFromProjectAndSpace() - { - String projectCode = createUniqueCode("P"); - ProjectPermId project = createProjects(systemSessionToken, space1, projectCode).get(0); - String sampleCode = createUniqueCode("S"); - SamplePermId projectSample = createSamples(systemSessionToken, space1, project, null, sampleCode).get(0); - SampleUpdate sampleUpdate = new SampleUpdate(); - sampleUpdate.setSampleId(projectSample); - sampleUpdate.setProjectId(null); - sampleUpdate.setSpaceId(null); - Date now = sleep(); - - v3api.updateSamples(adminSessionToken, Arrays.asList(sampleUpdate)); - - SampleFetchOptions fetchOptions = new SampleFetchOptions(); - fetchOptions.withModifier(); - fetchOptions.withSpace(); - fetchOptions.withProject().withModifier(); - Map<ISampleId, Sample> samples = v3api.mapSamples(systemSessionToken, Arrays.asList(projectSample), fetchOptions); - Sample sample = samples.get(projectSample); - assertModification(sample, sample, now, adminUser); - assertEquals(sample.getIdentifier().getIdentifier(), "/" + sampleCode); - assertEquals(sample.getProject(), null); - ProjectFetchOptions projectFetchOptions = new ProjectFetchOptions(); - projectFetchOptions.withModifier(); - Map<IProjectId, Project> projects = v3api.mapProjects(systemSessionToken, - Arrays.asList(project), projectFetchOptions); - Project previousProject = projects.values().iterator().next(); - assertModification(previousProject, previousProject, now, adminUser); - } - - @Test - public void testUnassignProjectExperimentSampleFromExperiment() - { - String projectCode = createUniqueCode("P"); - ProjectPermId project = createProjects(systemSessionToken, space1, projectCode).get(0); - String experimentCode = createUniqueCode("E"); - ExperimentPermId experiment = createExperiments(systemSessionToken, project, experimentCode).get(0); - String sampleCode = createUniqueCode("S"); - SamplePermId projectSample = createSamples(systemSessionToken, space1, project, experiment, sampleCode).get(0); - SampleUpdate sampleUpdate = new SampleUpdate(); - sampleUpdate.setSampleId(projectSample); - sampleUpdate.setExperimentId(null); - Date now = sleep(); - - v3api.updateSamples(adminSessionToken, Arrays.asList(sampleUpdate)); - - SampleFetchOptions fetchOptions = new SampleFetchOptions(); - fetchOptions.withModifier(); - fetchOptions.withSpace(); - fetchOptions.withProject().withModifier(); - Map<ISampleId, Sample> samples = v3api.mapSamples(systemSessionToken, Arrays.asList(projectSample), fetchOptions); - Sample sample = samples.get(projectSample); - assertModification(sample, sample, now, adminUser); - assertEquals(sample.getIdentifier().getIdentifier(), "/SPACE1/" + projectCode + "/" + sampleCode); - Project sampleProject = sample.getProject(); - assertEquals(sampleProject.getIdentifier().getIdentifier(), "/SPACE1/" + projectCode); - assertEquals(sampleProject.getModifier().getUserId(), SYSTEM_USER); - ExperimentFetchOptions experimentFetchOptions = new ExperimentFetchOptions(); - experimentFetchOptions.withModifier(); - Experiment previousExperiment = v3api.mapExperiments(systemSessionToken, Arrays.asList(experiment), - experimentFetchOptions).values().iterator().next(); - assertModification(previousExperiment, previousExperiment, now, adminUser); - } - - @Test - public void testUpdateProjectSample() - { - String projectCode = createUniqueCode("P"); - ProjectPermId project = createProjects(systemSessionToken, space1, projectCode).get(0); - String sampleCode = createUniqueCode("S"); - SamplePermId projectSample = createSamples(systemSessionToken, space1, project, null, sampleCode).get(0); - SampleUpdate sampleUpdate = new SampleUpdate(); - sampleUpdate.setSampleId(projectSample); - Date now = sleep(); - - v3api.updateSamples(adminSessionToken, Arrays.asList(sampleUpdate)); - - SampleFetchOptions fetchOptions = new SampleFetchOptions(); - fetchOptions.withModifier(); - fetchOptions.withSpace(); - fetchOptions.withProject().withModifier(); - Map<ISampleId, Sample> samples = v3api.mapSamples(systemSessionToken, Arrays.asList(projectSample), fetchOptions); - Sample sample = samples.get(projectSample); - assertModification(sample, sample, now, adminUser); - assertEquals(sample.getIdentifier().getIdentifier(), "/SPACE1/" + projectCode + "/" + sampleCode); - assertEquals(sample.getProject().getIdentifier().getIdentifier(), "/SPACE1/" + projectCode); - ProjectFetchOptions projectFetchOptions = new ProjectFetchOptions(); - projectFetchOptions.withModifier(); - Map<IProjectId, Project> projects = v3api.mapProjects(systemSessionToken, - Arrays.asList(project), projectFetchOptions); - Project sampleProject = projects.values().iterator().next(); - assertEquals(sampleProject.getModifier().getUserId(), SYSTEM_USER); - } - - @Test - public void testAssignSpaceSampleToAnExperimentInTheSameSpace() - { - String projectCode = createUniqueCode("P"); - ProjectPermId project = createProjects(systemSessionToken, space1, projectCode).get(0); - String sampleCode = createUniqueCode("S"); - SamplePermId projectSample = createSamples(systemSessionToken, space1, null, null, sampleCode).get(0); - String experimentCode = createUniqueCode("E"); - createExperiments(systemSessionToken, project, experimentCode); - SampleUpdate sampleUpdate = new SampleUpdate(); - sampleUpdate.setSampleId(projectSample); - sampleUpdate.setExperimentId(new ExperimentIdentifier("SPACE1", projectCode, experimentCode)); - Date now = sleep(); - - v3api.updateSamples(adminSessionToken, Arrays.asList(sampleUpdate)); - - SampleFetchOptions fetchOptions = new SampleFetchOptions(); - fetchOptions.withModifier(); - fetchOptions.withSpace(); - fetchOptions.withProject().withModifier(); - fetchOptions.withExperiment().withModifier(); - Map<ISampleId, Sample> samples = v3api.mapSamples(systemSessionToken, Arrays.asList(projectSample), fetchOptions); - Sample sample = samples.get(projectSample); - assertEquals(sample.getIdentifier().getIdentifier(), "/SPACE1/" + sampleCode); - assertModification(sample, sample, now, adminUser); - assertEquals(sample.getProject(), null); - Experiment experiment = sample.getExperiment(); - assertEquals(experiment.getIdentifier().getIdentifier(), "/SPACE1/" + projectCode + "/" + experimentCode); - assertModification(experiment, experiment, now, adminUser); - } - - @Test - public void testAssignProjectSampleToAnExperimentInTheSameProject() - { - String projectCode = createUniqueCode("P"); - ProjectPermId project = createProjects(systemSessionToken, space1, projectCode).get(0); - String sampleCode = createUniqueCode("S"); - SamplePermId projectSample = createSamples(systemSessionToken, space1, project, null, sampleCode).get(0); - String experimentCode = createUniqueCode("E"); - createExperiments(systemSessionToken, project, experimentCode); - SampleUpdate sampleUpdate = new SampleUpdate(); - sampleUpdate.setSampleId(projectSample); - sampleUpdate.setExperimentId(new ExperimentIdentifier("SPACE1", projectCode, experimentCode)); - Date now = sleep(); - - v3api.updateSamples(adminSessionToken, Arrays.asList(sampleUpdate)); - - SampleFetchOptions fetchOptions = new SampleFetchOptions(); - fetchOptions.withModifier(); - fetchOptions.withSpace(); - fetchOptions.withProject().withModifier(); - fetchOptions.withExperiment().withModifier(); - Map<ISampleId, Sample> samples = v3api.mapSamples(systemSessionToken, Arrays.asList(projectSample), fetchOptions); - Sample sample = samples.get(projectSample); - assertEquals(sample.getIdentifier().getIdentifier(), "/SPACE1/" + projectCode + "/" + sampleCode); - assertModification(sample, sample, now, adminUser); - assertEquals(sample.getProject().getModifier().getUserId(), SYSTEM_USER); - Experiment experiment = sample.getExperiment(); - assertEquals(experiment.getIdentifier().getIdentifier(), "/SPACE1/" + projectCode + "/" + experimentCode); - assertModification(experiment, experiment, now, adminUser); - } - - @Test - public void testAssignProjectSampleWithExperimentToAnotherExperimentInTheSameProject() - { - String projectCode = createUniqueCode("P"); - ProjectPermId project = createProjects(systemSessionToken, space1, projectCode).get(0); - String experimentCode1 = createUniqueCode("E"); - String experimentCode2 = experimentCode1 + "A"; - createExperiments(systemSessionToken, project, experimentCode1, experimentCode2); - String sampleCode = createUniqueCode("S"); - SamplePermId projectSample = createSamples(systemSessionToken, space1, project, - new ExperimentIdentifier("SPACE1", projectCode, experimentCode1), sampleCode).get(0); - SampleUpdate sampleUpdate = new SampleUpdate(); - sampleUpdate.setSampleId(projectSample); - sampleUpdate.setExperimentId(new ExperimentIdentifier("SPACE1", projectCode, experimentCode2)); - Date now = sleep(); - - v3api.updateSamples(adminSessionToken, Arrays.asList(sampleUpdate)); - - SampleFetchOptions fetchOptions = new SampleFetchOptions(); - fetchOptions.withModifier(); - fetchOptions.withSpace(); - fetchOptions.withProject().withModifier(); - fetchOptions.withExperiment().withModifier(); - Map<ISampleId, Sample> samples = v3api.mapSamples(systemSessionToken, Arrays.asList(projectSample), fetchOptions); - Sample sample = samples.get(projectSample); - assertEquals(sample.getIdentifier().getIdentifier(), "/SPACE1/" + projectCode + "/" + sampleCode); - assertModification(sample, sample, now, adminUser); - assertEquals(sample.getProject().getModifier().getUserId(), SYSTEM_USER); - Experiment experiment = sample.getExperiment(); - assertEquals(experiment.getIdentifier().getIdentifier(), "/SPACE1/" + projectCode + "/" + experimentCode2); - assertModification(experiment, experiment, now, adminUser); - ExperimentFetchOptions experimentFetchOptions = new ExperimentFetchOptions(); - experimentFetchOptions.withModifier(); - Experiment previousExperiment = v3api.mapExperiments(systemSessionToken, - Arrays.asList(new ExperimentIdentifier("SPACE1", projectCode, experimentCode1)), - experimentFetchOptions).values().iterator().next(); - assertModification(previousExperiment, previousExperiment, now, adminUser); - } - - @Test - public void testAssignProjectSampleToAnExperimentInADifferentProjectOfTheSameSpace() - { - String projectCode1 = createUniqueCode("P"); - ProjectPermId project1 = createProjects(systemSessionToken, space1, projectCode1).get(0); - String sampleCode = createUniqueCode("S"); - SamplePermId projectSample = createSamples(systemSessionToken, space1, project1, null, sampleCode).get(0); - String experimentCode = createUniqueCode("E"); - String projectCode2 = createUniqueCode("P"); - ProjectPermId project2 = createProjects(systemSessionToken, space1, projectCode2).get(0); - createExperiments(systemSessionToken, project2, experimentCode); - SampleUpdate sampleUpdate = new SampleUpdate(); - sampleUpdate.setSampleId(projectSample); - sampleUpdate.setProjectId(new ProjectIdentifier("SPACE1", projectCode2)); - sampleUpdate.setExperimentId(new ExperimentIdentifier("SPACE1", projectCode2, experimentCode)); - Date now = sleep(); - - v3api.updateSamples(adminSessionToken, Arrays.asList(sampleUpdate)); - - SampleFetchOptions fetchOptions = new SampleFetchOptions(); - fetchOptions.withModifier(); - fetchOptions.withSpace(); - fetchOptions.withProject().withModifier(); - fetchOptions.withExperiment().withModifier(); - Map<ISampleId, Sample> samples = v3api.mapSamples(systemSessionToken, Arrays.asList(projectSample), fetchOptions); - Sample sample = samples.get(projectSample); - assertEquals(sample.getIdentifier().getIdentifier(), "/SPACE1/" + projectCode2 + "/" + sampleCode); - assertModification(sample, sample, now, adminUser); - assertModification(sample.getProject(), sample.getProject(), now, adminUser); - Experiment experiment = sample.getExperiment(); - assertEquals(experiment.getIdentifier().getIdentifier(), "/SPACE1/" + projectCode2 + "/" + experimentCode); - assertModification(experiment, experiment, now, adminUser); - } - - @Test - public void testDeleteProjectSample() - { - String projectCode = createUniqueCode("P"); - ProjectPermId project = createProjects(systemSessionToken, space1, projectCode).get(0); - String sampleCode = createUniqueCode("S"); - createSamples(systemSessionToken, space1, project, null, sampleCode); - SampleDeletionOptions deletionOptions = new SampleDeletionOptions(); - deletionOptions.setReason("test"); - List<SampleIdentifier> sampleIds = Arrays.asList(new SampleIdentifier("/SPACE1/" + projectCode + "/" + sampleCode)); - Date now = sleep(); - - v3api.deleteSamples(adminSessionToken, sampleIds, deletionOptions); - - assertEquals(v3api.mapSamples(systemSessionToken, sampleIds, new SampleFetchOptions()).size(), 0); - ProjectFetchOptions projectFetchOptions = new ProjectFetchOptions(); - projectFetchOptions.withModifier(); - Project sampleProject = v3api.mapProjects(systemSessionToken, Arrays.asList(project), - projectFetchOptions).values().iterator().next(); - assertModification(sampleProject, sampleProject, now, adminUser); - } - - @Test - public void testDeleteProjectExperimentSample() - { - String projectCode = createUniqueCode("P"); - ProjectPermId project = createProjects(systemSessionToken, space1, projectCode).get(0); - String sampleCode = createUniqueCode("S"); - String experimentCode = createUniqueCode("E"); - ExperimentPermId experiment = createExperiments(systemSessionToken, project, experimentCode).get(0); - SamplePermId sample = createSamples(systemSessionToken, space1, project, experiment, sampleCode).get(0); - SampleDeletionOptions deletionOptions = new SampleDeletionOptions(); - deletionOptions.setReason("test"); - List<SamplePermId> sampleIds = Arrays.asList(sample); - Date now = sleep(); - - v3api.deleteSamples(adminSessionToken, sampleIds, deletionOptions); - - assertEquals(v3api.mapSamples(systemSessionToken, sampleIds, new SampleFetchOptions()).size(), 0); - ProjectFetchOptions projectFetchOptions = new ProjectFetchOptions(); - projectFetchOptions.withModifier(); - Project sampleProject = v3api.mapProjects(systemSessionToken, Arrays.asList(project), - projectFetchOptions).values().iterator().next(); - assertModification(sampleProject, sampleProject, now, adminUser); - ExperimentFetchOptions experimentFetchOptions = new ExperimentFetchOptions(); - experimentFetchOptions.withModifier(); - Experiment sampleExperiment = v3api.mapExperiments(systemSessionToken, Arrays.asList(experiment), - experimentFetchOptions).values().iterator().next(); - assertModification(sampleExperiment, sampleExperiment, now, adminUser); - } - - @Test - @Transactional(propagation = Propagation.NEVER) - public void testCreateWithProjectAndSpaceInconsistent() - { - final SampleCreation creation = new SampleCreation(); - creation.setCode("SAMPLE_WITH_INCONSISTENT_PROJECT_AND_SPACE"); - creation.setTypeId(ENTITY_TYPE_UNKNOWN); - creation.setSpaceId(space1); - creation.setProjectId(project1inSpace2); - - assertUserFailureException(new IDelegatedAction() - { - @Override - public void execute() - { - v3api.createSamples(systemSessionToken, Collections.singletonList(creation)); - } - }, "Sample space must be the same as project space. " - + "Sample: /SPACE1/SAMPLE_WITH_INCONSISTENT_PROJECT_AND_SPACE, " - + "Project: /SPACE2/PROJECT1 " - + "(Context: [verify project for sample SAMPLE_WITH_INCONSISTENT_PROJECT_AND_SPACE])"); - } - - @Test - @Transactional(propagation = Propagation.NEVER) - public void testCreateWithProjectAndNoSpaceInconsistent() - { - final SampleCreation creation = new SampleCreation(); - creation.setCode("SAMPLE_WITH_INCONSISTENT_PROJECT_AND_NOSPACE"); - creation.setTypeId(ENTITY_TYPE_UNKNOWN); - creation.setProjectId(project1inSpace1); - - assertUserFailureException(new IDelegatedAction() - { - @Override - public void execute() - { - v3api.createSamples(systemSessionToken, Collections.singletonList(creation)); - } - }, "Shared samples cannot be attached to projects. " - + "Sample: /SAMPLE_WITH_INCONSISTENT_PROJECT_AND_NOSPACE, " - + "Project: /SPACE1/PROJECT1 " - + "(Context: [verify project for sample SAMPLE_WITH_INCONSISTENT_PROJECT_AND_NOSPACE])"); - } - - @Test - @Transactional(propagation = Propagation.NEVER) - public void testCreateWithProjectAndExperimentInconsistent() - { - final SampleCreation creation = new SampleCreation(); - creation.setCode("SAMPLE_WITH_INCONSISTENT_PROJECT_AND_EXPERIMENT"); - creation.setTypeId(ENTITY_TYPE_UNKNOWN); - creation.setSpaceId(space1); - creation.setProjectId(project2inSpace1); - String expCode = createUniqueCode("E"); - creation.setExperimentId(createExperiments(systemSessionToken, project1inSpace1, expCode).get(0)); - - assertUserFailureException(new IDelegatedAction() - { - @Override - public void execute() - { - v3api.createSamples(systemSessionToken, Collections.singletonList(creation)); - } - }, "Sample project must be the same as experiment project. " - + "Sample: /SPACE1/SAMPLE_WITH_INCONSISTENT_PROJECT_AND_EXPERIMENT, " - + "Project: /SPACE1/PROJECT2, " - + "Experiment: /SPACE1/PROJECT1/" + expCode + " " - + "(Context: [verify experiment for sample SAMPLE_WITH_INCONSISTENT_PROJECT_AND_EXPERIMENT])"); - } - - @Test - @Transactional(propagation = Propagation.NEVER) - public void testAssignSpaceSampleToProjectInDifferentSpace() - { - String code = createUniqueCode("S"); - ISampleId sampleId = createSamples(systemSessionToken, space1, null, null, code).get(0); - final SampleUpdate sampleUpdate = new SampleUpdate(); - sampleUpdate.setSampleId(sampleId); - sampleUpdate.setProjectId(project2inSpace2); - - assertUserFailureException(new IDelegatedAction() - { - @Override - public void execute() - { - v3api.updateSamples(systemSessionToken, Collections.singletonList(sampleUpdate)); - } - }, "Sample space must be the same as project space. " - + "Sample: /SPACE1/" + code + ", " - + "Project: /SPACE2/PROJECT2 " - + "(Context: [verify project for sample " + code + "])"); - } - - @Test - @Transactional(propagation = Propagation.NEVER) - public void testAssignSampleOfAnExperimentToProjectDifferentToTheExperimentProject() - { - String sampleCode = createUniqueCode("S"); - String expCode = createUniqueCode("E"); - IExperimentId experiment = createExperiments(systemSessionToken, project1inSpace1, expCode).get(0); - SamplePermId sample = createSamples(systemSessionToken, space1, null, experiment, sampleCode).get(0); - final SampleUpdate sampleUpdate = new SampleUpdate(); - sampleUpdate.setSampleId(sample); - sampleUpdate.setProjectId(project2inSpace1); - - assertUserFailureException(new IDelegatedAction() - { - @Override - public void execute() - { - v3api.updateSamples(systemSessionToken, Collections.singletonList(sampleUpdate)); - } - }, "Sample project must be the same as experiment project. " - + "Sample: /SPACE1/" + sampleCode + ", " - + "Project: /SPACE1/PROJECT2, " - + "Experiment: /SPACE1/PROJECT1/" + expCode + " " - + "(Context: [verify experiment for sample " + sampleCode + "])"); - - } - - @Test - @Transactional(propagation = Propagation.NEVER) - public void testAssignSharedSampleToProject() - { - String code = createUniqueCode("S"); - ISampleId sharedSample = createSamples(systemSessionToken, null, null, null, code).get(0); - final SampleUpdate sampleUpdate = new SampleUpdate(); - sampleUpdate.setSampleId(sharedSample); - sampleUpdate.setProjectId(project1inSpace1); - - assertUserFailureException(new IDelegatedAction() - { - @Override - public void execute() - { - v3api.updateSamples(systemSessionToken, Collections.singletonList(sampleUpdate)); - } - }, "Shared samples cannot be attached to projects. " - + "Sample: /" + code + ", " - + "Project: /SPACE1/PROJECT1 " - + "(Context: [verify project for sample " + code + "])"); - } - - @Test(priority = -1) - public void testSearchForSamplesWithProject() throws InterruptedException - { - - SampleSearchCriteria searchCriteria = new SampleSearchCriteria(); - searchCriteria.withProject(); - SampleFetchOptions fetchOptions = new SampleFetchOptions(); - fetchOptions.withProject(); - - SearchResult<Sample> result = v3api.searchSamples(systemSessionToken, searchCriteria, fetchOptions); - - assertEquals(result.getObjects().get(0).getIdentifier().getIdentifier(), "/SPACE1/PROJECT1/SAMPLE3"); - assertEquals(result.getObjects().get(0).getProject().getIdentifier().getIdentifier(), "/SPACE1/PROJECT1"); - assertEquals(result.getObjects().get(1).getIdentifier().getIdentifier(), "/SPACE1/PROJECT1/SAMPLE4"); - assertEquals(result.getObjects().get(1).getProject().getIdentifier().getIdentifier(), "/SPACE1/PROJECT1"); - assertEquals(result.getObjects().get(2).getIdentifier().getIdentifier(), "/SPACE2/PROJECT2/SAMPLE5"); - assertEquals(result.getObjects().get(2).getProject().getIdentifier().getIdentifier(), "/SPACE2/PROJECT2"); - assertEquals(result.getObjects().get(3).getIdentifier().getIdentifier(), "/SPACE2/PROJECT2/SAMPLE6"); - assertEquals(result.getObjects().get(3).getProject().getIdentifier().getIdentifier(), "/SPACE2/PROJECT2"); - assertEquals(result.getTotalCount(), 4); - } - - @Test(priority = -1) - public void testSearchForSamplesWithCodeAndWithProject() - { - SampleSearchCriteria searchCriteria = new SampleSearchCriteria(); - searchCriteria.withCode().thatEndsWith("3"); - searchCriteria.withProject(); - SampleFetchOptions fetchOptions = new SampleFetchOptions(); - fetchOptions.withProject(); - - SearchResult<Sample> result = v3api.searchSamples(systemSessionToken, searchCriteria, fetchOptions); - - assertEquals(result.getObjects().get(0).getIdentifier().getIdentifier(), "/SPACE1/PROJECT1/SAMPLE3"); - assertEquals(result.getObjects().get(0).getProject().getIdentifier().getIdentifier(), "/SPACE1/PROJECT1"); - assertEquals(result.getTotalCount(), 1); - } - - @Test(priority = -1) - public void testSearchForSamplesWithProjectWithSpaceWithCode() - { - SampleSearchCriteria searchCriteria = new SampleSearchCriteria(); - searchCriteria.withProject().withSpace().withCode().thatEquals("SPACE1"); - SampleFetchOptions fetchOptions = new SampleFetchOptions(); - fetchOptions.withProject(); - - SearchResult<Sample> result = v3api.searchSamples(systemSessionToken, searchCriteria, fetchOptions); - - assertEquals(result.getObjects().get(0).getIdentifier().getIdentifier(), "/SPACE1/PROJECT1/SAMPLE3"); - assertEquals(result.getObjects().get(0).getProject().getIdentifier().getIdentifier(), "/SPACE1/PROJECT1"); - assertEquals(result.getObjects().get(1).getIdentifier().getIdentifier(), "/SPACE1/PROJECT1/SAMPLE4"); - assertEquals(result.getObjects().get(1).getProject().getIdentifier().getIdentifier(), "/SPACE1/PROJECT1"); - assertEquals(result.getTotalCount(), 2); - } - - @Test(priority = -1) - public void testSearchForSamplesWithProjectWithPermId() - { - SampleSearchCriteria searchCriteria = new SampleSearchCriteria(); - searchCriteria.withProject().withPermId().thatEquals(project2inSpace2.getPermId()); - SampleFetchOptions fetchOptions = new SampleFetchOptions(); - fetchOptions.withProject(); - - SearchResult<Sample> result = v3api.searchSamples(systemSessionToken, searchCriteria, fetchOptions); - - assertEquals(result.getObjects().get(0).getIdentifier().getIdentifier(), "/SPACE2/PROJECT2/SAMPLE5"); - assertEquals(result.getObjects().get(0).getProject().getIdentifier().getIdentifier(), "/SPACE2/PROJECT2"); - assertEquals(result.getObjects().get(1).getIdentifier().getIdentifier(), "/SPACE2/PROJECT2/SAMPLE6"); - assertEquals(result.getObjects().get(1).getProject().getIdentifier().getIdentifier(), "/SPACE2/PROJECT2"); - assertEquals(result.getTotalCount(), 2); - } - - @Test(priority = -1) - public void testSearchForSamplesWithoutProjects() - { - SampleSearchCriteria searchCriteria = new SampleSearchCriteria(); - searchCriteria.withCode().thatStartsWith("SAMP"); - searchCriteria.withoutProject(); - SampleFetchOptions fetchOptions = new SampleFetchOptions(); - fetchOptions.withProject(); - - SearchResult<Sample> result = v3api.searchSamples(systemSessionToken, searchCriteria, fetchOptions); - - assertEquals(result.getObjects().get(0).getIdentifier().getIdentifier(), "/SPACE1/SAMPLE1"); - assertEquals(result.getObjects().get(0).getProject(), null); - assertEquals(result.getObjects().get(1).getIdentifier().getIdentifier(), "/SPACE1/SAMPLE2"); - assertEquals(result.getObjects().get(1).getProject(), null); - assertEquals(result.getTotalCount(), 2); - } - - private void assertUserFailureException(IDelegatedAction action, String expectedExceptionMessage) - { - try - { - action.execute(); - fail("UserFailureException expected"); - } catch (UserFailureException ex) - { - assertEquals(ex.getMessage(), expectedExceptionMessage); - } - } - - private void assertModification(IModificationDateHolder modificationDateHolder, IModifierHolder modifierHolder, - Date date, String modifier) - { - assertNotOlder(modificationDateHolder.getModificationDate(), date); - assertEquals(modifierHolder.getModifier().getUserId(), modifier); - } - - private void assertNotOlder(Date actualDate, Date referenceDate) - { - SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS"); - String renderedReferenceDate = format.format(referenceDate.getTime()); - String renderedActualDate = format.format(actualDate); - assertEquals(renderedReferenceDate.compareTo(renderedActualDate) <= 0, true, - renderedActualDate + " > " + renderedReferenceDate); - } - - private Date sleep() - { - Date now = daoFactory.getTransactionTimestamp(); - return now; - } - - private List<SpacePermId> createSpaces(String sessionToken, String...spaceCodes) - { - List<SpaceCreation> newSpaces = new ArrayList<SpaceCreation>(); - for (String spaceCode : spaceCodes) - { - SpaceCreation space = new SpaceCreation(); - space.setCode(spaceCode); - newSpaces.add(space); - } - return v3api.createSpaces(sessionToken, newSpaces); - } - - private List<ProjectPermId> createProjects(String sessionToken, ISpaceId spaceId, String...projectCodes) - { - List<ProjectCreation> newProjects = new ArrayList<ProjectCreation>(); - for (String projectCode : projectCodes) - { - ProjectCreation project = new ProjectCreation(); - project.setSpaceId(spaceId); - project.setCode(projectCode); - newProjects.add(project); - } - return v3api.createProjects(sessionToken, newProjects); - } - - private List<SamplePermId> createSamples(String sessionToken, ISpaceId spaceOrNull, - IProjectId projectOrNull, IExperimentId experimentOrNull, String...codes) - { - List<SampleCreation> newSamples = new ArrayList<SampleCreation>(); - for (String code : codes) - { - SampleCreation sample = new SampleCreation(); - sample.setTypeId(ENTITY_TYPE_UNKNOWN); - sample.setSpaceId(spaceOrNull); - sample.setProjectId(projectOrNull); - sample.setExperimentId(experimentOrNull); - sample.setCode(code); - newSamples.add(sample); - } - return v3api.createSamples(sessionToken, newSamples); - } - - private List<ExperimentPermId> createExperiments(String sessionToken, IProjectId project, String...codes) - { - List<ExperimentCreation> newExperiments = new ArrayList<ExperimentCreation>(); - for (String code : codes) - { - ExperimentCreation experiment = new ExperimentCreation(); - experiment.setCode(code); - experiment.setTypeId(ENTITY_TYPE_UNKNOWN); - experiment.setProjectId(project); - newExperiments.add(experiment); - } - return v3api.createExperiments(sessionToken, newExperiments); - } - - private String createUniqueCode(String prefix) - { - return prefix + "-" + System.currentTimeMillis(); - } - - private void waitAtLeastASecond() - { - try - { - Thread.sleep(1100); - } catch (InterruptedException ex) - { - // silently ignored - } - } -*/ + /* + * private static final String SYSTEM_USER = "system"; private static final SpacePermId HOME_SPACE_ID = new SpacePermId("DEFAULT"); private static + * final Logger operationLog = LogFactory.getLogger(LogCategory.OPERATION, ProjectSampleTest.class); private static final EntityTypePermId + * ENTITY_TYPE_UNKNOWN = new EntityTypePermId("UNKNOWN"); + * @Autowired protected IApplicationServerApi v3api; private ISpaceId space1; private ISpaceId space2; private ProjectPermId project1inSpace1; + * private ProjectPermId project2inSpace1; private ProjectPermId project1inSpace2; private ProjectPermId project2inSpace2; private ProjectPermId + * project1inHomeSpace; private String adminSessionToken; private String adminUser; + * @BeforeClass public void createData() { List<SpacePermId> spaces = createSpaces(systemSessionToken, "SPACE1", "SPACE2"); space1 = + * spaces.get(0); space2 = spaces.get(1); List<ProjectPermId> projects = createProjects(systemSessionToken, space1, "PROJECT1", "PROJECT2"); + * project1inSpace1 = projects.get(0); project2inSpace1 = projects.get(1); project1inSpace2 = createProjects(systemSessionToken, space2, + * "PROJECT1").get(0); project2inSpace2 = createProjects(systemSessionToken, space2, "PROJECT2").get(0); project1inHomeSpace = + * createProjects(systemSessionToken, HOME_SPACE_ID, "PROJECT1").get(0); createSamples(systemSessionToken, null, null, null, "SHARED1", + * "SHARED2"); createSamples(systemSessionToken, space1, null, null, "SAMPLE1", "SAMPLE2"); createSamples(systemSessionToken, space1, + * project1inSpace1, null, "SAMPLE3", "SAMPLE4"); createSamples(systemSessionToken, space2, project2inSpace2, null, "SAMPLE5", "SAMPLE6"); + * waitAtLeastASecond(); // to allow checks on modification time stamps UpdateUtils.waitUntilIndexUpdaterIsIdle(applicationContext, operationLog); + * SessionBuilder session = aSession().withInstanceRole(RoleCode.ADMIN); adminUser = session.getUserID(); adminSessionToken = create(session); + * commonServer.changeUserHomeSpace(adminSessionToken, new TechId(1)); // home space = DEFAULT } + * @Override + * @AfterTransaction + * @Test(enabled = false) public void cleanDatabase() { // super method deletes samples, experiments and data sets from the database } + * @Test public void testCreateASharedSampleWithASharedSampleAsComponent() { String sampleCode = createUniqueCode("S"); SampleCreation s1 = new + * SampleCreation(); s1.setCode(sampleCode); s1.setTypeId(ENTITY_TYPE_UNKNOWN); SampleCreation s2 = new SampleCreation(); s2.setCode("A01"); + * s2.setTypeId(ENTITY_TYPE_UNKNOWN); s2.setContainerId(new SampleIdentifier(null, null, sampleCode)); List<SamplePermId> sampleIds = + * v3api.createSamples(systemSessionToken, Arrays.asList(s1, s2)); Map<ISampleId, Sample> samples = v3api.mapSamples(systemSessionToken, + * sampleIds, new SampleFetchOptions()); assertEquals(samples.get(sampleIds.get(0)).getIdentifier().getIdentifier(), "/" + sampleCode); + * assertEquals(samples.get(sampleIds.get(1)).getIdentifier().getIdentifier(), "/" + sampleCode + ":A01"); } + * @Test public void testCreateASharedSampleWithASpaceSampleAsComponent() { String sampleCode = createUniqueCode("S"); SampleCreation s1 = new + * SampleCreation(); s1.setCode(sampleCode); s1.setTypeId(ENTITY_TYPE_UNKNOWN); SampleCreation s2 = new SampleCreation(); s2.setCode("A01"); + * s2.setTypeId(ENTITY_TYPE_UNKNOWN); s2.setSpaceId(space1); s2.setContainerId(new SampleIdentifier(null, null, sampleCode)); List<SamplePermId> + * sampleIds = v3api.createSamples(systemSessionToken, Arrays.asList(s1, s2)); Map<ISampleId, Sample> samples = + * v3api.mapSamples(systemSessionToken, sampleIds, new SampleFetchOptions()); + * assertEquals(samples.get(sampleIds.get(0)).getIdentifier().getIdentifier(), "/" + sampleCode); + * assertEquals(samples.get(sampleIds.get(1)).getIdentifier().getIdentifier(), "/SPACE1/" + sampleCode + ":A01"); } + * @Test public void testCreateASharedSampleWithAProjectSampleAsComponent() { String projectCode = createUniqueCode("P"); + * createProjects(systemSessionToken, space1, projectCode); String sampleCode = createUniqueCode("S"); SampleCreation s1 = new SampleCreation(); + * s1.setCode(sampleCode); s1.setTypeId(ENTITY_TYPE_UNKNOWN); SampleCreation s2 = new SampleCreation(); s2.setCode("A01"); + * s2.setTypeId(ENTITY_TYPE_UNKNOWN); s2.setSpaceId(space1); s2.setProjectId(new ProjectIdentifier("SPACE1", projectCode)); s2.setContainerId(new + * SampleIdentifier(null, null, sampleCode)); List<SamplePermId> sampleIds = v3api.createSamples(systemSessionToken, Arrays.asList(s1, s2)); + * Map<ISampleId, Sample> samples = v3api.mapSamples(systemSessionToken, sampleIds, new SampleFetchOptions()); + * assertEquals(samples.get(sampleIds.get(0)).getIdentifier().getIdentifier(), "/" + sampleCode); + * assertEquals(samples.get(sampleIds.get(1)).getIdentifier().getIdentifier(), "/SPACE1/" + projectCode + "/" + sampleCode + ":A01"); } + * @Test public void testCreateASharedSampleWithAProjectExperimentSampleAsComponent() { String projectCode = createUniqueCode("P"); ProjectPermId + * project = createProjects(systemSessionToken, space1, projectCode).get(0); String experimentCode = createUniqueCode("E"); + * createExperiments(systemSessionToken, project, experimentCode); String sampleCode = createUniqueCode("S"); SampleCreation s1 = new + * SampleCreation(); s1.setCode(sampleCode); s1.setTypeId(ENTITY_TYPE_UNKNOWN); SampleCreation s2 = new SampleCreation(); s2.setCode("A01"); + * s2.setTypeId(ENTITY_TYPE_UNKNOWN); s2.setSpaceId(space1); s2.setProjectId(new ProjectIdentifier("SPACE1", projectCode)); s2.setExperimentId(new + * ExperimentIdentifier("SPACE1", projectCode, experimentCode)); s2.setContainerId(new SampleIdentifier(null, null, sampleCode)); + * List<SamplePermId> sampleIds = v3api.createSamples(systemSessionToken, Arrays.asList(s1, s2)); Map<ISampleId, Sample> samples = + * v3api.mapSamples(systemSessionToken, sampleIds, new SampleFetchOptions()); + * assertEquals(samples.get(sampleIds.get(0)).getIdentifier().getIdentifier(), "/" + sampleCode); + * assertEquals(samples.get(sampleIds.get(1)).getIdentifier().getIdentifier(), "/SPACE1/" + projectCode + "/" + sampleCode + ":A01"); } + * @Test public void testCreateASharedSampleWithAnExperimentSampleAsComponent() { String projectCode = createUniqueCode("P"); ProjectPermId + * project = createProjects(systemSessionToken, space1, projectCode).get(0); String experimentCode = createUniqueCode("E"); + * createExperiments(systemSessionToken, project, experimentCode); String sampleCode = createUniqueCode("S"); SampleCreation s1 = new + * SampleCreation(); s1.setCode(sampleCode); s1.setTypeId(ENTITY_TYPE_UNKNOWN); SampleCreation s2 = new SampleCreation(); s2.setCode("A01"); + * s2.setTypeId(ENTITY_TYPE_UNKNOWN); s2.setSpaceId(space1); s2.setExperimentId(new ExperimentIdentifier("SPACE1", projectCode, experimentCode)); + * s2.setContainerId(new SampleIdentifier(null, null, sampleCode)); List<SamplePermId> sampleIds = v3api.createSamples(systemSessionToken, + * Arrays.asList(s1, s2)); Map<ISampleId, Sample> samples = v3api.mapSamples(systemSessionToken, sampleIds, new SampleFetchOptions()); + * assertEquals(samples.get(sampleIds.get(0)).getIdentifier().getIdentifier(), "/" + sampleCode); + * assertEquals(samples.get(sampleIds.get(1)).getIdentifier().getIdentifier(), "/SPACE1/" + sampleCode + ":A01"); } + * @Test public void testCreateSampleAndMapSamplesByPermId() { String sampleCode = createUniqueCode("S"); SampleCreation sampleCreation = new + * SampleCreation(); sampleCreation.setCode(sampleCode); sampleCreation.setTypeId(ENTITY_TYPE_UNKNOWN); sampleCreation.setSpaceId(space1); + * sampleCreation.setProjectId(project1inSpace1); List<SamplePermId> ids = v3api.createSamples(systemSessionToken, Arrays.asList(sampleCreation)); + * SampleFetchOptions fetchOptions = new SampleFetchOptions(); fetchOptions.withProject(); Map<ISampleId, Sample> samples = + * v3api.mapSamples(systemSessionToken, ids, fetchOptions); Sample sample = samples.get(ids.get(0)); + * assertEquals(sample.getIdentifier().getIdentifier(), "/SPACE1/PROJECT1/" + sampleCode); + * assertEquals(sample.getProject().getIdentifier().getIdentifier(), "/SPACE1/PROJECT1"); } + * @Test public void testCreateThreeSamplesWithSameCodeInDifferentProjectOfSameSpaceAndMapSamplesByIdentifier() { String sampleCode = + * createUniqueCode("S"); SampleCreation s1 = new SampleCreation(); s1.setCode(sampleCode); s1.setTypeId(ENTITY_TYPE_UNKNOWN); + * s1.setSpaceId(space1); s1.setProjectId(project1inSpace1); SampleCreation s2 = new SampleCreation(); s2.setCode(sampleCode); + * s2.setTypeId(ENTITY_TYPE_UNKNOWN); s2.setSpaceId(space1); s2.setProjectId(project2inSpace1); SampleCreation s3 = new SampleCreation(); + * s3.setCode(sampleCode); s3.setTypeId(ENTITY_TYPE_UNKNOWN); s3.setSpaceId(space1); v3api.createSamples(systemSessionToken, Arrays.asList(s1, s2, + * s3)); SampleFetchOptions fetchOptions = new SampleFetchOptions(); fetchOptions.withProject(); List<ISampleId> ids = new ArrayList<>(); + * ids.add(new SampleIdentifier("/SPACE1/PROJECT1/" + sampleCode)); ids.add(new SampleIdentifier("/SPACE1/PROJECT2/" + sampleCode)); ids.add(new + * SampleIdentifier("/SPACE1/" + sampleCode)); Map<ISampleId, Sample> samples = v3api.mapSamples(systemSessionToken, ids, fetchOptions); + * assertEquals(samples.get(ids.get(0)).getProject().getIdentifier().toString(), "/SPACE1/PROJECT1"); + * assertEquals(samples.get(ids.get(1)).getProject().getIdentifier().toString(), "/SPACE1/PROJECT2"); + * assertEquals(samples.get(ids.get(2)).getProject(), null); } + * @Test public void testCreateProjectSampleWithAProjectSampleComponentFromAnotherSpace() { String sampleCode = createUniqueCode("S"); + * SampleCreation s1 = new SampleCreation(); s1.setCode(sampleCode); s1.setTypeId(ENTITY_TYPE_UNKNOWN); s1.setSpaceId(space1); + * s1.setProjectId(project1inSpace1); SamplePermId s1PermId = v3api.createSamples(systemSessionToken, Arrays.asList(s1)).get(0); SampleCreation s2 + * = new SampleCreation(); s2.setCode("A01"); s2.setTypeId(ENTITY_TYPE_UNKNOWN); s2.setSpaceId(space2); s2.setProjectId(project1inSpace2); + * s2.setContainerId(s1PermId); v3api.createSamples(systemSessionToken, Arrays.asList(s2)); SampleFetchOptions fetchOptions = new + * SampleFetchOptions(); fetchOptions.withProject(); fetchOptions.withContainer(); List<ISampleId> ids = new ArrayList<>(); ids.add(new + * SampleIdentifier("/SPACE1/PROJECT1/" + sampleCode)); ids.add(new SampleIdentifier("/SPACE2/PROJECT1/" + sampleCode + ":A01")); Map<ISampleId, + * Sample> samples = v3api.mapSamples(systemSessionToken, ids, fetchOptions); + * assertEquals(samples.get(ids.get(0)).getProject().getIdentifier().toString(), "/SPACE1/PROJECT1"); + * assertEquals(samples.get(ids.get(1)).getProject().getIdentifier().toString(), "/SPACE2/PROJECT1"); } + * @Test public void testCreateProjectSampleWithComponentInHomeSpace() { String sampleCode = createUniqueCode("S"); SampleCreation s1 = new + * SampleCreation(); s1.setCode(sampleCode); s1.setTypeId(ENTITY_TYPE_UNKNOWN); s1.setSpaceId(HOME_SPACE_ID); + * s1.setProjectId(project1inHomeSpace); SamplePermId s1PermId = v3api.createSamples(systemSessionToken, Arrays.asList(s1)).get(0); SampleCreation + * s2 = new SampleCreation(); s2.setCode("A01"); s2.setTypeId(ENTITY_TYPE_UNKNOWN); s2.setSpaceId(HOME_SPACE_ID); + * s2.setProjectId(project1inHomeSpace); s2.setContainerId(s1PermId); v3api.createSamples(systemSessionToken, Arrays.asList(s2)); + * SampleFetchOptions fetchOptions = new SampleFetchOptions(); fetchOptions.withProject(); fetchOptions.withContainer(); List<ISampleId> ids = new + * ArrayList<>(); ids.add(new SampleIdentifier("//PROJECT1/" + sampleCode)); ids.add(new SampleIdentifier("//PROJECT1/" + sampleCode + ":A01")); + * Map<ISampleId, Sample> samples = v3api.mapSamples(adminSessionToken, ids, fetchOptions); + * assertEquals(samples.get(ids.get(0)).getProject().getIdentifier().toString(), "/DEFAULT/PROJECT1"); + * assertEquals(samples.get(ids.get(1)).getProject().getIdentifier().toString(), "/DEFAULT/PROJECT1"); } + * @Test public void testAssignSpaceSampleToAProject() { String sampleCode = createUniqueCode("S"); createSamples(systemSessionToken, space1, + * null, null, sampleCode); String projectCode = createUniqueCode("P"); ProjectPermId project = createProjects(systemSessionToken, space1, + * projectCode).get(0); SampleUpdate sampleUpdate = new SampleUpdate(); sampleUpdate.setSampleId(new SampleIdentifier("/SPACE1/" + sampleCode)); + * sampleUpdate.setProjectId(project); Date now = sleep(); v3api.updateSamples(adminSessionToken, Arrays.asList(sampleUpdate)); SampleFetchOptions + * fetchOptions = new SampleFetchOptions(); fetchOptions.withModifier(); fetchOptions.withSpace(); fetchOptions.withProject().withModifier(); + * SampleIdentifier newSampleIdentifier = new SampleIdentifier("/SPACE1/" + projectCode + "/" + sampleCode); Map<ISampleId, Sample> samples = + * v3api.mapSamples(systemSessionToken, Arrays.asList(newSampleIdentifier), fetchOptions); Sample sample = samples.get(newSampleIdentifier); + * assertModification(sample, sample, now, adminUser); assertEquals(sample.getIdentifier().getIdentifier(), "/SPACE1/" + projectCode + "/" + + * sampleCode); Project sampleProject = sample.getProject(); assertEquals(sampleProject.getIdentifier().getIdentifier(), "/SPACE1/" + + * projectCode); assertModification(sampleProject, sampleProject, now, adminUser); } + * @Test public void testAssignHomeSpaceSampleToAProjectInHomeSpace() { String sampleCode = createUniqueCode("S"); + * createSamples(systemSessionToken, HOME_SPACE_ID, null, null, sampleCode); String projectCode = createUniqueCode("P"); ProjectPermId project = + * createProjects(systemSessionToken, HOME_SPACE_ID, projectCode).get(0); SampleUpdate sampleUpdate = new SampleUpdate(); + * sampleUpdate.setSampleId(new SampleIdentifier("//" + sampleCode)); sampleUpdate.setProjectId(project); Date now = sleep(); + * v3api.updateSamples(adminSessionToken, Arrays.asList(sampleUpdate)); SampleFetchOptions fetchOptions = new SampleFetchOptions(); + * fetchOptions.withModifier(); fetchOptions.withSpace(); fetchOptions.withProject().withModifier(); SampleIdentifier newSampleIdentifier = new + * SampleIdentifier("//" + projectCode + "/" + sampleCode); Map<ISampleId, Sample> samples = v3api.mapSamples(adminSessionToken, + * Arrays.asList(newSampleIdentifier), fetchOptions); Sample sample = samples.get(newSampleIdentifier); assertModification(sample, sample, now, + * adminUser); assertEquals(sample.getIdentifier().getIdentifier(), "/DEFAULT/" + projectCode + "/" + sampleCode); Project sampleProject = + * sample.getProject(); assertEquals(sampleProject.getIdentifier().getIdentifier(), "/DEFAULT/" + projectCode); assertModification(sampleProject, + * sampleProject, now, adminUser); } + * @Test public void testAssignProjectSampleToADifferentProjectInTheSameSpace() { String projectCode1 = createUniqueCode("P"); ProjectPermId + * project1 = createProjects(systemSessionToken, space1, projectCode1).get(0); String sampleCode = createUniqueCode("S"); SamplePermId spaceSample + * = createSamples(systemSessionToken, space1, project1, null, sampleCode).get(0); String projectCode2 = createUniqueCode("P"); ProjectPermId + * project2 = createProjects(systemSessionToken, space1, projectCode2).get(0); SampleUpdate sampleUpdate = new SampleUpdate(); + * sampleUpdate.setSampleId(new SampleIdentifier("/SPACE1/" + projectCode1 + "/" + sampleCode)); sampleUpdate.setProjectId(project2); Date now = + * sleep(); v3api.updateSamples(adminSessionToken, Arrays.asList(sampleUpdate)); SampleFetchOptions fetchOptions = new SampleFetchOptions(); + * fetchOptions.withModifier(); fetchOptions.withSpace(); fetchOptions.withProject().withModifier(); Map<ISampleId, Sample> samples = + * v3api.mapSamples(systemSessionToken, Arrays.asList(spaceSample), fetchOptions); Sample sample = samples.get(spaceSample); + * assertModification(sample, sample, now, adminUser); assertEquals(sample.getIdentifier().getIdentifier(), "/SPACE1/" + projectCode2 + "/" + + * sampleCode); Project sampleProject = sample.getProject(); assertEquals(sampleProject.getIdentifier().getIdentifier(), "/SPACE1/" + + * projectCode2); assertModification(sampleProject, sampleProject, now, adminUser); ProjectFetchOptions projectFetchOptions = new + * ProjectFetchOptions(); projectFetchOptions.withModifier(); Map<IProjectId, Project> projects = v3api.mapProjects(systemSessionToken, + * Arrays.asList(project1), projectFetchOptions); assertModification(projects.get(project1), projects.get(project1), now, adminUser); } + * @Test public void testAssignProjectSampleWithComponentToAProjectInADifferentSpace() { String projectCode = createUniqueCode("P"); ProjectPermId + * project1 = createProjects(systemSessionToken, space1, projectCode).get(0); String sampleCode = createUniqueCode("S"); SampleCreation s1 = new + * SampleCreation(); s1.setCode(sampleCode); s1.setTypeId(ENTITY_TYPE_UNKNOWN); s1.setSpaceId(space1); s1.setProjectId(project1); SampleCreation + * s2 = new SampleCreation(); s2.setCode("A01"); s2.setTypeId(ENTITY_TYPE_UNKNOWN); s2.setSpaceId(space1); s2.setProjectId(project1); + * s2.setContainerId(new SampleIdentifier("/SPACE1/" + projectCode + "/" + sampleCode)); v3api.createSamples(systemSessionToken, Arrays.asList(s1, + * s2)); ProjectPermId project2 = createProjects(systemSessionToken, space2, projectCode).get(0); SampleUpdate sampleUpdate = new SampleUpdate(); + * sampleUpdate.setSampleId(new SampleIdentifier("/SPACE1/" + projectCode + "/" + sampleCode)); sampleUpdate.setSpaceId(space2); + * sampleUpdate.setProjectId(project2); Date now = sleep(); v3api.updateSamples(adminSessionToken, Arrays.asList(sampleUpdate)); + * SampleFetchOptions fetchOptions = new SampleFetchOptions(); fetchOptions.withModifier(); fetchOptions.withSpace(); + * fetchOptions.withProject().withModifier(); SampleIdentifier containerID = new SampleIdentifier("/SPACE2/" + projectCode + "/" + sampleCode); + * SampleIdentifier componentID = new SampleIdentifier("/SPACE1/" + projectCode + "/" + sampleCode + ":A01"); Map<ISampleId, Sample> samples = + * v3api.mapSamples(systemSessionToken, Arrays.asList(containerID, componentID), fetchOptions); Sample sample = samples.get(containerID); + * assertModification(sample, sample, now, adminUser); assertEquals(sample.getIdentifier().getIdentifier(), "/SPACE2/" + projectCode + "/" + + * sampleCode); Project project = sample.getProject(); assertEquals(project.getIdentifier().getIdentifier(), "/SPACE2/" + projectCode); + * assertModification(project, project, now, adminUser); Sample component = samples.get(componentID); + * assertEquals(component.getModifier().getUserId(), SYSTEM_USER); assertEquals(component.getIdentifier().getIdentifier(), "/SPACE1/" + + * projectCode + "/" + sampleCode + ":A01"); Project componentProject = component.getProject(); + * assertEquals(componentProject.getIdentifier().getIdentifier(), "/SPACE1/" + projectCode); assertModification(componentProject, + * componentProject, now, adminUser); } + * @Test public void testAssignProjectSampleToAProjectInADifferentSpace() { String projectCode = createUniqueCode("P"); ProjectPermId project1 = + * createProjects(systemSessionToken, space1, projectCode).get(0); String sampleCode = createUniqueCode("S"); SamplePermId spaceSample = + * createSamples(systemSessionToken, space1, project1, null, sampleCode).get(0); ProjectPermId project2 = createProjects(systemSessionToken, + * space2, projectCode).get(0); SampleUpdate sampleUpdate = new SampleUpdate(); sampleUpdate.setSampleId(spaceSample); + * sampleUpdate.setSpaceId(space2); sampleUpdate.setProjectId(project2); Date now = sleep(); v3api.updateSamples(adminSessionToken, + * Arrays.asList(sampleUpdate)); SampleFetchOptions fetchOptions = new SampleFetchOptions(); fetchOptions.withModifier(); + * fetchOptions.withSpace(); fetchOptions.withProject().withModifier(); Map<ISampleId, Sample> samples = v3api.mapSamples(systemSessionToken, + * Arrays.asList(spaceSample), fetchOptions); Sample sample = samples.get(spaceSample); assertModification(sample, sample, now, adminUser); + * assertEquals(sample.getIdentifier().getIdentifier(), "/SPACE2/" + projectCode + "/" + sampleCode); Project project = sample.getProject(); + * assertEquals(project.getIdentifier().getIdentifier(), "/SPACE2/" + projectCode); assertModification(project, project, now, adminUser); } + * @Test public void testAssignExperimentWithProjectSamplesToADifferentProject() { String projectCode1 = createUniqueCode("P"); String + * projectCode2 = projectCode1 + "A"; createProjects(systemSessionToken, space1, projectCode1, projectCode2); String experimentCode = + * createUniqueCode("E"); ProjectIdentifier project1 = new ProjectIdentifier("SPACE1", projectCode1); ExperimentPermId experiment = + * createExperiments(systemSessionToken, project1, experimentCode).get(0); String sampleCode = createUniqueCode("S"); SamplePermId sample = + * createSamples(systemSessionToken, space1, project1, experiment, sampleCode).get(0); ExperimentUpdate experimentUpdate = new ExperimentUpdate(); + * experimentUpdate.setExperimentId(experiment); experimentUpdate.setProjectId(new ProjectIdentifier("SPACE1", projectCode2)); Date now = sleep(); + * v3api.updateExperiments(adminSessionToken, Arrays.asList(experimentUpdate)); SampleFetchOptions fetchOptions = new SampleFetchOptions(); + * fetchOptions.withModifier(); fetchOptions.withSpace(); fetchOptions.withProject().withModifier(); Sample experimentSample = + * v3api.mapSamples(systemSessionToken, Arrays.asList(sample), fetchOptions).values().iterator().next(); assertModification(experimentSample, + * experimentSample, now, adminUser); assertEquals(experimentSample.getIdentifier().getIdentifier(), "/SPACE1/" + projectCode2 + "/" + + * sampleCode); Project project = experimentSample.getProject(); assertEquals(project.getIdentifier().getIdentifier(), "/SPACE1/" + projectCode2); + * assertModification(project, project, now, adminUser); ExperimentFetchOptions experimentFetchOptions = new ExperimentFetchOptions(); + * experimentFetchOptions.withModifier(); Experiment sampleExperiment = v3api.mapExperiments(systemSessionToken, Arrays.asList(experiment), + * experimentFetchOptions).values().iterator().next(); assertModification(sampleExperiment, sampleExperiment, now, adminUser); } + * @Test public void testDeleteExperimentWithProjectSamples() { String projectCode = createUniqueCode("P"); createProjects(systemSessionToken, + * space1, projectCode); String experimentCode = createUniqueCode("E"); ProjectIdentifier project = new ProjectIdentifier("SPACE1", projectCode); + * ExperimentPermId experiment = createExperiments(systemSessionToken, project, experimentCode).get(0); String sampleCode = createUniqueCode("S"); + * SamplePermId sample = createSamples(systemSessionToken, space1, project, experiment, sampleCode).get(0); ExperimentDeletionOptions + * deletionOptions = new ExperimentDeletionOptions(); deletionOptions.setReason("a test"); v3api.deleteExperiments(adminSessionToken, + * Arrays.asList(experiment), deletionOptions); assertEquals(v3api.mapSamples(systemSessionToken, Arrays.asList(sample), new + * SampleFetchOptions()).size(), 0); ExperimentFetchOptions experimentFetchOptions = new ExperimentFetchOptions(); + * experimentFetchOptions.withModifier(); assertEquals(v3api.mapExperiments(systemSessionToken, Arrays.asList(experiment), + * experimentFetchOptions).size(), 0); } + * @Test public void testUnassignProjectSampleFromProject() { String projectCode = createUniqueCode("P"); ProjectPermId project = + * createProjects(systemSessionToken, space1, projectCode).get(0); String sampleCode = createUniqueCode("S"); SamplePermId projectSample = + * createSamples(systemSessionToken, space1, project, null, sampleCode).get(0); SampleUpdate sampleUpdate = new SampleUpdate(); + * sampleUpdate.setSampleId(projectSample); sampleUpdate.setProjectId(null); Date now = sleep(); v3api.updateSamples(adminSessionToken, + * Arrays.asList(sampleUpdate)); SampleFetchOptions fetchOptions = new SampleFetchOptions(); fetchOptions.withModifier(); + * fetchOptions.withSpace(); fetchOptions.withProject().withModifier(); Map<ISampleId, Sample> samples = v3api.mapSamples(systemSessionToken, + * Arrays.asList(projectSample), fetchOptions); Sample sample = samples.get(projectSample); assertModification(sample, sample, now, adminUser); + * assertEquals(sample.getIdentifier().getIdentifier(), "/SPACE1/" + sampleCode); assertEquals(sample.getProject(), null); ProjectFetchOptions + * projectFetchOptions = new ProjectFetchOptions(); projectFetchOptions.withModifier(); Map<IProjectId, Project> projects = + * v3api.mapProjects(systemSessionToken, Arrays.asList(project), projectFetchOptions); Project previousProject = + * projects.values().iterator().next(); assertModification(previousProject, previousProject, now, adminUser); } + * @Test public void testUnassignProjectSampleFromProjectAndSpace() { String projectCode = createUniqueCode("P"); ProjectPermId project = + * createProjects(systemSessionToken, space1, projectCode).get(0); String sampleCode = createUniqueCode("S"); SamplePermId projectSample = + * createSamples(systemSessionToken, space1, project, null, sampleCode).get(0); SampleUpdate sampleUpdate = new SampleUpdate(); + * sampleUpdate.setSampleId(projectSample); sampleUpdate.setProjectId(null); sampleUpdate.setSpaceId(null); Date now = sleep(); + * v3api.updateSamples(adminSessionToken, Arrays.asList(sampleUpdate)); SampleFetchOptions fetchOptions = new SampleFetchOptions(); + * fetchOptions.withModifier(); fetchOptions.withSpace(); fetchOptions.withProject().withModifier(); Map<ISampleId, Sample> samples = + * v3api.mapSamples(systemSessionToken, Arrays.asList(projectSample), fetchOptions); Sample sample = samples.get(projectSample); + * assertModification(sample, sample, now, adminUser); assertEquals(sample.getIdentifier().getIdentifier(), "/" + sampleCode); + * assertEquals(sample.getProject(), null); ProjectFetchOptions projectFetchOptions = new ProjectFetchOptions(); + * projectFetchOptions.withModifier(); Map<IProjectId, Project> projects = v3api.mapProjects(systemSessionToken, Arrays.asList(project), + * projectFetchOptions); Project previousProject = projects.values().iterator().next(); assertModification(previousProject, previousProject, now, + * adminUser); } + * @Test public void testUnassignProjectExperimentSampleFromExperiment() { String projectCode = createUniqueCode("P"); ProjectPermId project = + * createProjects(systemSessionToken, space1, projectCode).get(0); String experimentCode = createUniqueCode("E"); ExperimentPermId experiment = + * createExperiments(systemSessionToken, project, experimentCode).get(0); String sampleCode = createUniqueCode("S"); SamplePermId projectSample = + * createSamples(systemSessionToken, space1, project, experiment, sampleCode).get(0); SampleUpdate sampleUpdate = new SampleUpdate(); + * sampleUpdate.setSampleId(projectSample); sampleUpdate.setExperimentId(null); Date now = sleep(); v3api.updateSamples(adminSessionToken, + * Arrays.asList(sampleUpdate)); SampleFetchOptions fetchOptions = new SampleFetchOptions(); fetchOptions.withModifier(); + * fetchOptions.withSpace(); fetchOptions.withProject().withModifier(); Map<ISampleId, Sample> samples = v3api.mapSamples(systemSessionToken, + * Arrays.asList(projectSample), fetchOptions); Sample sample = samples.get(projectSample); assertModification(sample, sample, now, adminUser); + * assertEquals(sample.getIdentifier().getIdentifier(), "/SPACE1/" + projectCode + "/" + sampleCode); Project sampleProject = sample.getProject(); + * assertEquals(sampleProject.getIdentifier().getIdentifier(), "/SPACE1/" + projectCode); assertEquals(sampleProject.getModifier().getUserId(), + * SYSTEM_USER); ExperimentFetchOptions experimentFetchOptions = new ExperimentFetchOptions(); experimentFetchOptions.withModifier(); Experiment + * previousExperiment = v3api.mapExperiments(systemSessionToken, Arrays.asList(experiment), experimentFetchOptions).values().iterator().next(); + * assertModification(previousExperiment, previousExperiment, now, adminUser); } + * @Test public void testUpdateProjectSample() { String projectCode = createUniqueCode("P"); ProjectPermId project = + * createProjects(systemSessionToken, space1, projectCode).get(0); String sampleCode = createUniqueCode("S"); SamplePermId projectSample = + * createSamples(systemSessionToken, space1, project, null, sampleCode).get(0); SampleUpdate sampleUpdate = new SampleUpdate(); + * sampleUpdate.setSampleId(projectSample); Date now = sleep(); v3api.updateSamples(adminSessionToken, Arrays.asList(sampleUpdate)); + * SampleFetchOptions fetchOptions = new SampleFetchOptions(); fetchOptions.withModifier(); fetchOptions.withSpace(); + * fetchOptions.withProject().withModifier(); Map<ISampleId, Sample> samples = v3api.mapSamples(systemSessionToken, Arrays.asList(projectSample), + * fetchOptions); Sample sample = samples.get(projectSample); assertModification(sample, sample, now, adminUser); + * assertEquals(sample.getIdentifier().getIdentifier(), "/SPACE1/" + projectCode + "/" + sampleCode); + * assertEquals(sample.getProject().getIdentifier().getIdentifier(), "/SPACE1/" + projectCode); ProjectFetchOptions projectFetchOptions = new + * ProjectFetchOptions(); projectFetchOptions.withModifier(); Map<IProjectId, Project> projects = v3api.mapProjects(systemSessionToken, + * Arrays.asList(project), projectFetchOptions); Project sampleProject = projects.values().iterator().next(); + * assertEquals(sampleProject.getModifier().getUserId(), SYSTEM_USER); } + * @Test public void testAssignSpaceSampleToAnExperimentInTheSameSpace() { String projectCode = createUniqueCode("P"); ProjectPermId project = + * createProjects(systemSessionToken, space1, projectCode).get(0); String sampleCode = createUniqueCode("S"); SamplePermId projectSample = + * createSamples(systemSessionToken, space1, null, null, sampleCode).get(0); String experimentCode = createUniqueCode("E"); + * createExperiments(systemSessionToken, project, experimentCode); SampleUpdate sampleUpdate = new SampleUpdate(); + * sampleUpdate.setSampleId(projectSample); sampleUpdate.setExperimentId(new ExperimentIdentifier("SPACE1", projectCode, experimentCode)); Date + * now = sleep(); v3api.updateSamples(adminSessionToken, Arrays.asList(sampleUpdate)); SampleFetchOptions fetchOptions = new SampleFetchOptions(); + * fetchOptions.withModifier(); fetchOptions.withSpace(); fetchOptions.withProject().withModifier(); fetchOptions.withExperiment().withModifier(); + * Map<ISampleId, Sample> samples = v3api.mapSamples(systemSessionToken, Arrays.asList(projectSample), fetchOptions); Sample sample = + * samples.get(projectSample); assertEquals(sample.getIdentifier().getIdentifier(), "/SPACE1/" + sampleCode); assertModification(sample, sample, + * now, adminUser); assertEquals(sample.getProject(), null); Experiment experiment = sample.getExperiment(); + * assertEquals(experiment.getIdentifier().getIdentifier(), "/SPACE1/" + projectCode + "/" + experimentCode); assertModification(experiment, + * experiment, now, adminUser); } + * @Test public void testAssignProjectSampleToAnExperimentInTheSameProject() { String projectCode = createUniqueCode("P"); ProjectPermId project = + * createProjects(systemSessionToken, space1, projectCode).get(0); String sampleCode = createUniqueCode("S"); SamplePermId projectSample = + * createSamples(systemSessionToken, space1, project, null, sampleCode).get(0); String experimentCode = createUniqueCode("E"); + * createExperiments(systemSessionToken, project, experimentCode); SampleUpdate sampleUpdate = new SampleUpdate(); + * sampleUpdate.setSampleId(projectSample); sampleUpdate.setExperimentId(new ExperimentIdentifier("SPACE1", projectCode, experimentCode)); Date + * now = sleep(); v3api.updateSamples(adminSessionToken, Arrays.asList(sampleUpdate)); SampleFetchOptions fetchOptions = new SampleFetchOptions(); + * fetchOptions.withModifier(); fetchOptions.withSpace(); fetchOptions.withProject().withModifier(); fetchOptions.withExperiment().withModifier(); + * Map<ISampleId, Sample> samples = v3api.mapSamples(systemSessionToken, Arrays.asList(projectSample), fetchOptions); Sample sample = + * samples.get(projectSample); assertEquals(sample.getIdentifier().getIdentifier(), "/SPACE1/" + projectCode + "/" + sampleCode); + * assertModification(sample, sample, now, adminUser); assertEquals(sample.getProject().getModifier().getUserId(), SYSTEM_USER); Experiment + * experiment = sample.getExperiment(); assertEquals(experiment.getIdentifier().getIdentifier(), "/SPACE1/" + projectCode + "/" + experimentCode); + * assertModification(experiment, experiment, now, adminUser); } + * @Test public void testAssignProjectSampleWithExperimentToAnotherExperimentInTheSameProject() { String projectCode = createUniqueCode("P"); + * ProjectPermId project = createProjects(systemSessionToken, space1, projectCode).get(0); String experimentCode1 = createUniqueCode("E"); String + * experimentCode2 = experimentCode1 + "A"; createExperiments(systemSessionToken, project, experimentCode1, experimentCode2); String sampleCode = + * createUniqueCode("S"); SamplePermId projectSample = createSamples(systemSessionToken, space1, project, new ExperimentIdentifier("SPACE1", + * projectCode, experimentCode1), sampleCode).get(0); SampleUpdate sampleUpdate = new SampleUpdate(); sampleUpdate.setSampleId(projectSample); + * sampleUpdate.setExperimentId(new ExperimentIdentifier("SPACE1", projectCode, experimentCode2)); Date now = sleep(); + * v3api.updateSamples(adminSessionToken, Arrays.asList(sampleUpdate)); SampleFetchOptions fetchOptions = new SampleFetchOptions(); + * fetchOptions.withModifier(); fetchOptions.withSpace(); fetchOptions.withProject().withModifier(); fetchOptions.withExperiment().withModifier(); + * Map<ISampleId, Sample> samples = v3api.mapSamples(systemSessionToken, Arrays.asList(projectSample), fetchOptions); Sample sample = + * samples.get(projectSample); assertEquals(sample.getIdentifier().getIdentifier(), "/SPACE1/" + projectCode + "/" + sampleCode); + * assertModification(sample, sample, now, adminUser); assertEquals(sample.getProject().getModifier().getUserId(), SYSTEM_USER); Experiment + * experiment = sample.getExperiment(); assertEquals(experiment.getIdentifier().getIdentifier(), "/SPACE1/" + projectCode + "/" + + * experimentCode2); assertModification(experiment, experiment, now, adminUser); ExperimentFetchOptions experimentFetchOptions = new + * ExperimentFetchOptions(); experimentFetchOptions.withModifier(); Experiment previousExperiment = v3api.mapExperiments(systemSessionToken, + * Arrays.asList(new ExperimentIdentifier("SPACE1", projectCode, experimentCode1)), experimentFetchOptions).values().iterator().next(); + * assertModification(previousExperiment, previousExperiment, now, adminUser); } + * @Test public void testAssignProjectSampleToAnExperimentInADifferentProjectOfTheSameSpace() { String projectCode1 = createUniqueCode("P"); + * ProjectPermId project1 = createProjects(systemSessionToken, space1, projectCode1).get(0); String sampleCode = createUniqueCode("S"); + * SamplePermId projectSample = createSamples(systemSessionToken, space1, project1, null, sampleCode).get(0); String experimentCode = + * createUniqueCode("E"); String projectCode2 = createUniqueCode("P"); ProjectPermId project2 = createProjects(systemSessionToken, space1, + * projectCode2).get(0); createExperiments(systemSessionToken, project2, experimentCode); SampleUpdate sampleUpdate = new SampleUpdate(); + * sampleUpdate.setSampleId(projectSample); sampleUpdate.setProjectId(new ProjectIdentifier("SPACE1", projectCode2)); + * sampleUpdate.setExperimentId(new ExperimentIdentifier("SPACE1", projectCode2, experimentCode)); Date now = sleep(); + * v3api.updateSamples(adminSessionToken, Arrays.asList(sampleUpdate)); SampleFetchOptions fetchOptions = new SampleFetchOptions(); + * fetchOptions.withModifier(); fetchOptions.withSpace(); fetchOptions.withProject().withModifier(); fetchOptions.withExperiment().withModifier(); + * Map<ISampleId, Sample> samples = v3api.mapSamples(systemSessionToken, Arrays.asList(projectSample), fetchOptions); Sample sample = + * samples.get(projectSample); assertEquals(sample.getIdentifier().getIdentifier(), "/SPACE1/" + projectCode2 + "/" + sampleCode); + * assertModification(sample, sample, now, adminUser); assertModification(sample.getProject(), sample.getProject(), now, adminUser); Experiment + * experiment = sample.getExperiment(); assertEquals(experiment.getIdentifier().getIdentifier(), "/SPACE1/" + projectCode2 + "/" + + * experimentCode); assertModification(experiment, experiment, now, adminUser); } + * @Test public void testDeleteProjectSample() { String projectCode = createUniqueCode("P"); ProjectPermId project = + * createProjects(systemSessionToken, space1, projectCode).get(0); String sampleCode = createUniqueCode("S"); createSamples(systemSessionToken, + * space1, project, null, sampleCode); SampleDeletionOptions deletionOptions = new SampleDeletionOptions(); deletionOptions.setReason("test"); + * List<SampleIdentifier> sampleIds = Arrays.asList(new SampleIdentifier("/SPACE1/" + projectCode + "/" + sampleCode)); Date now = sleep(); + * v3api.deleteSamples(adminSessionToken, sampleIds, deletionOptions); assertEquals(v3api.mapSamples(systemSessionToken, sampleIds, new + * SampleFetchOptions()).size(), 0); ProjectFetchOptions projectFetchOptions = new ProjectFetchOptions(); projectFetchOptions.withModifier(); + * Project sampleProject = v3api.mapProjects(systemSessionToken, Arrays.asList(project), projectFetchOptions).values().iterator().next(); + * assertModification(sampleProject, sampleProject, now, adminUser); } + * @Test public void testDeleteProjectExperimentSample() { String projectCode = createUniqueCode("P"); ProjectPermId project = + * createProjects(systemSessionToken, space1, projectCode).get(0); String sampleCode = createUniqueCode("S"); String experimentCode = + * createUniqueCode("E"); ExperimentPermId experiment = createExperiments(systemSessionToken, project, experimentCode).get(0); SamplePermId sample + * = createSamples(systemSessionToken, space1, project, experiment, sampleCode).get(0); SampleDeletionOptions deletionOptions = new + * SampleDeletionOptions(); deletionOptions.setReason("test"); List<SamplePermId> sampleIds = Arrays.asList(sample); Date now = sleep(); + * v3api.deleteSamples(adminSessionToken, sampleIds, deletionOptions); assertEquals(v3api.mapSamples(systemSessionToken, sampleIds, new + * SampleFetchOptions()).size(), 0); ProjectFetchOptions projectFetchOptions = new ProjectFetchOptions(); projectFetchOptions.withModifier(); + * Project sampleProject = v3api.mapProjects(systemSessionToken, Arrays.asList(project), projectFetchOptions).values().iterator().next(); + * assertModification(sampleProject, sampleProject, now, adminUser); ExperimentFetchOptions experimentFetchOptions = new ExperimentFetchOptions(); + * experimentFetchOptions.withModifier(); Experiment sampleExperiment = v3api.mapExperiments(systemSessionToken, Arrays.asList(experiment), + * experimentFetchOptions).values().iterator().next(); assertModification(sampleExperiment, sampleExperiment, now, adminUser); } + * @Test + * @Transactional(propagation = Propagation.NEVER) public void testCreateWithProjectAndSpaceInconsistent() { final SampleCreation creation = new + * SampleCreation(); creation.setCode("SAMPLE_WITH_INCONSISTENT_PROJECT_AND_SPACE"); creation.setTypeId(ENTITY_TYPE_UNKNOWN); + * creation.setSpaceId(space1); creation.setProjectId(project1inSpace2); assertUserFailureException(new IDelegatedAction() { + * @Override public void execute() { v3api.createSamples(systemSessionToken, Collections.singletonList(creation)); } }, + * "Sample space must be the same as project space. " + "Sample: /SPACE1/SAMPLE_WITH_INCONSISTENT_PROJECT_AND_SPACE, " + + * "Project: /SPACE2/PROJECT1 " + "(Context: [verify project for sample SAMPLE_WITH_INCONSISTENT_PROJECT_AND_SPACE])"); } + * @Test + * @Transactional(propagation = Propagation.NEVER) public void testCreateWithProjectAndNoSpaceInconsistent() { final SampleCreation creation = new + * SampleCreation(); creation.setCode("SAMPLE_WITH_INCONSISTENT_PROJECT_AND_NOSPACE"); creation.setTypeId(ENTITY_TYPE_UNKNOWN); + * creation.setProjectId(project1inSpace1); assertUserFailureException(new IDelegatedAction() { + * @Override public void execute() { v3api.createSamples(systemSessionToken, Collections.singletonList(creation)); } }, + * "Shared samples cannot be attached to projects. " + "Sample: /SAMPLE_WITH_INCONSISTENT_PROJECT_AND_NOSPACE, " + "Project: /SPACE1/PROJECT1 " + + * "(Context: [verify project for sample SAMPLE_WITH_INCONSISTENT_PROJECT_AND_NOSPACE])"); } + * @Test + * @Transactional(propagation = Propagation.NEVER) public void testCreateWithProjectAndExperimentInconsistent() { final SampleCreation creation = + * new SampleCreation(); creation.setCode("SAMPLE_WITH_INCONSISTENT_PROJECT_AND_EXPERIMENT"); creation.setTypeId(ENTITY_TYPE_UNKNOWN); + * creation.setSpaceId(space1); creation.setProjectId(project2inSpace1); String expCode = createUniqueCode("E"); + * creation.setExperimentId(createExperiments(systemSessionToken, project1inSpace1, expCode).get(0)); assertUserFailureException(new + * IDelegatedAction() { + * @Override public void execute() { v3api.createSamples(systemSessionToken, Collections.singletonList(creation)); } }, + * "Sample project must be the same as experiment project. " + "Sample: /SPACE1/SAMPLE_WITH_INCONSISTENT_PROJECT_AND_EXPERIMENT, " + + * "Project: /SPACE1/PROJECT2, " + "Experiment: /SPACE1/PROJECT1/" + expCode + " " + + * "(Context: [verify experiment for sample SAMPLE_WITH_INCONSISTENT_PROJECT_AND_EXPERIMENT])"); } + * @Test + * @Transactional(propagation = Propagation.NEVER) public void testAssignSpaceSampleToProjectInDifferentSpace() { String code = + * createUniqueCode("S"); ISampleId sampleId = createSamples(systemSessionToken, space1, null, null, code).get(0); final SampleUpdate sampleUpdate + * = new SampleUpdate(); sampleUpdate.setSampleId(sampleId); sampleUpdate.setProjectId(project2inSpace2); assertUserFailureException(new + * IDelegatedAction() { + * @Override public void execute() { v3api.updateSamples(systemSessionToken, Collections.singletonList(sampleUpdate)); } }, + * "Sample space must be the same as project space. " + "Sample: /SPACE1/" + code + ", " + "Project: /SPACE2/PROJECT2 " + + * "(Context: [verify project for sample " + code + "])"); } + * @Test + * @Transactional(propagation = Propagation.NEVER) public void testAssignSampleOfAnExperimentToProjectDifferentToTheExperimentProject() { String + * sampleCode = createUniqueCode("S"); String expCode = createUniqueCode("E"); IExperimentId experiment = createExperiments(systemSessionToken, + * project1inSpace1, expCode).get(0); SamplePermId sample = createSamples(systemSessionToken, space1, null, experiment, sampleCode).get(0); final + * SampleUpdate sampleUpdate = new SampleUpdate(); sampleUpdate.setSampleId(sample); sampleUpdate.setProjectId(project2inSpace1); + * assertUserFailureException(new IDelegatedAction() { + * @Override public void execute() { v3api.updateSamples(systemSessionToken, Collections.singletonList(sampleUpdate)); } }, + * "Sample project must be the same as experiment project. " + "Sample: /SPACE1/" + sampleCode + ", " + "Project: /SPACE1/PROJECT2, " + + * "Experiment: /SPACE1/PROJECT1/" + expCode + " " + "(Context: [verify experiment for sample " + sampleCode + "])"); } + * @Test + * @Transactional(propagation = Propagation.NEVER) public void testAssignSharedSampleToProject() { String code = createUniqueCode("S"); ISampleId + * sharedSample = createSamples(systemSessionToken, null, null, null, code).get(0); final SampleUpdate sampleUpdate = new SampleUpdate(); + * sampleUpdate.setSampleId(sharedSample); sampleUpdate.setProjectId(project1inSpace1); assertUserFailureException(new IDelegatedAction() { + * @Override public void execute() { v3api.updateSamples(systemSessionToken, Collections.singletonList(sampleUpdate)); } }, + * "Shared samples cannot be attached to projects. " + "Sample: /" + code + ", " + "Project: /SPACE1/PROJECT1 " + + * "(Context: [verify project for sample " + code + "])"); } + * @Test(priority = -1) public void testSearchForSamplesWithProject() throws InterruptedException { SampleSearchCriteria searchCriteria = new + * SampleSearchCriteria(); searchCriteria.withProject(); SampleFetchOptions fetchOptions = new SampleFetchOptions(); fetchOptions.withProject(); + * SearchResult<Sample> result = v3api.searchSamples(systemSessionToken, searchCriteria, fetchOptions); + * assertEquals(result.getObjects().get(0).getIdentifier().getIdentifier(), "/SPACE1/PROJECT1/SAMPLE3"); + * assertEquals(result.getObjects().get(0).getProject().getIdentifier().getIdentifier(), "/SPACE1/PROJECT1"); + * assertEquals(result.getObjects().get(1).getIdentifier().getIdentifier(), "/SPACE1/PROJECT1/SAMPLE4"); + * assertEquals(result.getObjects().get(1).getProject().getIdentifier().getIdentifier(), "/SPACE1/PROJECT1"); + * assertEquals(result.getObjects().get(2).getIdentifier().getIdentifier(), "/SPACE2/PROJECT2/SAMPLE5"); + * assertEquals(result.getObjects().get(2).getProject().getIdentifier().getIdentifier(), "/SPACE2/PROJECT2"); + * assertEquals(result.getObjects().get(3).getIdentifier().getIdentifier(), "/SPACE2/PROJECT2/SAMPLE6"); + * assertEquals(result.getObjects().get(3).getProject().getIdentifier().getIdentifier(), "/SPACE2/PROJECT2"); assertEquals(result.getTotalCount(), + * 4); } + * @Test(priority = -1) public void testSearchForSamplesWithCodeAndWithProject() { SampleSearchCriteria searchCriteria = new + * SampleSearchCriteria(); searchCriteria.withCode().thatEndsWith("3"); searchCriteria.withProject(); SampleFetchOptions fetchOptions = new + * SampleFetchOptions(); fetchOptions.withProject(); SearchResult<Sample> result = v3api.searchSamples(systemSessionToken, searchCriteria, + * fetchOptions); assertEquals(result.getObjects().get(0).getIdentifier().getIdentifier(), "/SPACE1/PROJECT1/SAMPLE3"); + * assertEquals(result.getObjects().get(0).getProject().getIdentifier().getIdentifier(), "/SPACE1/PROJECT1"); assertEquals(result.getTotalCount(), + * 1); } + * @Test(priority = -1) public void testSearchForSamplesWithProjectWithSpaceWithCode() { SampleSearchCriteria searchCriteria = new + * SampleSearchCriteria(); searchCriteria.withProject().withSpace().withCode().thatEquals("SPACE1"); SampleFetchOptions fetchOptions = new + * SampleFetchOptions(); fetchOptions.withProject(); SearchResult<Sample> result = v3api.searchSamples(systemSessionToken, searchCriteria, + * fetchOptions); assertEquals(result.getObjects().get(0).getIdentifier().getIdentifier(), "/SPACE1/PROJECT1/SAMPLE3"); + * assertEquals(result.getObjects().get(0).getProject().getIdentifier().getIdentifier(), "/SPACE1/PROJECT1"); + * assertEquals(result.getObjects().get(1).getIdentifier().getIdentifier(), "/SPACE1/PROJECT1/SAMPLE4"); + * assertEquals(result.getObjects().get(1).getProject().getIdentifier().getIdentifier(), "/SPACE1/PROJECT1"); assertEquals(result.getTotalCount(), + * 2); } + * @Test(priority = -1) public void testSearchForSamplesWithProjectWithPermId() { SampleSearchCriteria searchCriteria = new + * SampleSearchCriteria(); searchCriteria.withProject().withPermId().thatEquals(project2inSpace2.getPermId()); SampleFetchOptions fetchOptions = + * new SampleFetchOptions(); fetchOptions.withProject(); SearchResult<Sample> result = v3api.searchSamples(systemSessionToken, searchCriteria, + * fetchOptions); assertEquals(result.getObjects().get(0).getIdentifier().getIdentifier(), "/SPACE2/PROJECT2/SAMPLE5"); + * assertEquals(result.getObjects().get(0).getProject().getIdentifier().getIdentifier(), "/SPACE2/PROJECT2"); + * assertEquals(result.getObjects().get(1).getIdentifier().getIdentifier(), "/SPACE2/PROJECT2/SAMPLE6"); + * assertEquals(result.getObjects().get(1).getProject().getIdentifier().getIdentifier(), "/SPACE2/PROJECT2"); assertEquals(result.getTotalCount(), + * 2); } + * @Test(priority = -1) public void testSearchForSamplesWithoutProjects() { SampleSearchCriteria searchCriteria = new SampleSearchCriteria(); + * searchCriteria.withCode().thatStartsWith("SAMP"); searchCriteria.withoutProject(); SampleFetchOptions fetchOptions = new SampleFetchOptions(); + * fetchOptions.withProject(); SearchResult<Sample> result = v3api.searchSamples(systemSessionToken, searchCriteria, fetchOptions); + * assertEquals(result.getObjects().get(0).getIdentifier().getIdentifier(), "/SPACE1/SAMPLE1"); + * assertEquals(result.getObjects().get(0).getProject(), null); assertEquals(result.getObjects().get(1).getIdentifier().getIdentifier(), + * "/SPACE1/SAMPLE2"); assertEquals(result.getObjects().get(1).getProject(), null); assertEquals(result.getTotalCount(), 2); } private void + * assertUserFailureException(IDelegatedAction action, String expectedExceptionMessage) { try { action.execute(); + * fail("UserFailureException expected"); } catch (UserFailureException ex) { assertEquals(ex.getMessage(), expectedExceptionMessage); } } private + * void assertModification(IModificationDateHolder modificationDateHolder, IModifierHolder modifierHolder, Date date, String modifier) { + * assertNotOlder(modificationDateHolder.getModificationDate(), date); assertEquals(modifierHolder.getModifier().getUserId(), modifier); } private + * void assertNotOlder(Date actualDate, Date referenceDate) { SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS"); String + * renderedReferenceDate = format.format(referenceDate.getTime()); String renderedActualDate = format.format(actualDate); + * assertEquals(renderedReferenceDate.compareTo(renderedActualDate) <= 0, true, renderedActualDate + " > " + renderedReferenceDate); } private + * Date sleep() { Date now = daoFactory.getTransactionTimestamp(); return now; } private List<SpacePermId> createSpaces(String sessionToken, + * String...spaceCodes) { List<SpaceCreation> newSpaces = new ArrayList<SpaceCreation>(); for (String spaceCode : spaceCodes) { SpaceCreation + * space = new SpaceCreation(); space.setCode(spaceCode); newSpaces.add(space); } return v3api.createSpaces(sessionToken, newSpaces); } private + * List<ProjectPermId> createProjects(String sessionToken, ISpaceId spaceId, String...projectCodes) { List<ProjectCreation> newProjects = new + * ArrayList<ProjectCreation>(); for (String projectCode : projectCodes) { ProjectCreation project = new ProjectCreation(); + * project.setSpaceId(spaceId); project.setCode(projectCode); newProjects.add(project); } return v3api.createProjects(sessionToken, newProjects); + * } private List<SamplePermId> createSamples(String sessionToken, ISpaceId spaceOrNull, IProjectId projectOrNull, IExperimentId experimentOrNull, + * String...codes) { List<SampleCreation> newSamples = new ArrayList<SampleCreation>(); for (String code : codes) { SampleCreation sample = new + * SampleCreation(); sample.setTypeId(ENTITY_TYPE_UNKNOWN); sample.setSpaceId(spaceOrNull); sample.setProjectId(projectOrNull); + * sample.setExperimentId(experimentOrNull); sample.setCode(code); newSamples.add(sample); } return v3api.createSamples(sessionToken, newSamples); + * } private List<ExperimentPermId> createExperiments(String sessionToken, IProjectId project, String...codes) { List<ExperimentCreation> + * newExperiments = new ArrayList<ExperimentCreation>(); for (String code : codes) { ExperimentCreation experiment = new ExperimentCreation(); + * experiment.setCode(code); experiment.setTypeId(ENTITY_TYPE_UNKNOWN); experiment.setProjectId(project); newExperiments.add(experiment); } return + * v3api.createExperiments(sessionToken, newExperiments); } private String createUniqueCode(String prefix) { return prefix + "-" + + * System.currentTimeMillis(); } private void waitAtLeastASecond() { try { Thread.sleep(1100); } catch (InterruptedException ex) { // silently + * ignored } } + */ } diff --git a/openbis/sourceTest/java/ch/ethz/sis/openbis/systemtest/asapi/v3/SearchDataSetTypeTest.java b/openbis/sourceTest/java/ch/ethz/sis/openbis/systemtest/asapi/v3/SearchDataSetTypeTest.java index aed5fe80f7f..cb526708b2d 100644 --- a/openbis/sourceTest/java/ch/ethz/sis/openbis/systemtest/asapi/v3/SearchDataSetTypeTest.java +++ b/openbis/sourceTest/java/ch/ethz/sis/openbis/systemtest/asapi/v3/SearchDataSetTypeTest.java @@ -31,8 +31,6 @@ import ch.ethz.sis.openbis.generic.asapi.v3.dto.property.PropertyAssignment; import ch.ethz.sis.openbis.generic.server.asapi.v3.helper.sort.CodeComparator; /** - * - * * @author Franz-Josef Elmer */ public class SearchDataSetTypeTest extends AbstractTest @@ -45,15 +43,17 @@ public class SearchDataSetTypeTest extends AbstractTest DataSetTypeFetchOptions fetchOptions = new DataSetTypeFetchOptions(); fetchOptions.withPropertyAssignments(); SearchResult<DataSetType> searchResult = v3api.searchDataSetTypes(sessionToken, searchCriteria, fetchOptions); - + List<DataSetType> types = searchResult.getObjects(); List<String> codes = extractCodes(types); Collections.sort(codes); - assertEquals(codes.toString(), "[CONTAINER_TYPE, DELETION_TEST, DELETION_TEST_CONTAINER, HCS_IMAGE, HCS_IMAGE_ANALYSIS_DATA, LINK_TYPE, REQUIRES_EXPERIMENT, UNKNOWN, VALIDATED_CONTAINER_TYPE, VALIDATED_IMPOSSIBLE_TO_UPDATE_TYPE, VALIDATED_NORMAL_TYPE]"); + assertEquals( + codes.toString(), + "[CONTAINER_TYPE, DELETION_TEST, DELETION_TEST_CONTAINER, HCS_IMAGE, HCS_IMAGE_ANALYSIS_DATA, LINK_TYPE, REQUIRES_EXPERIMENT, UNKNOWN, VALIDATED_CONTAINER_TYPE, VALIDATED_IMPOSSIBLE_TO_UPDATE_TYPE, VALIDATED_NORMAL_TYPE]"); assertEquals(types.get(0).getFetchOptions().hasPropertyAssignments(), true); v3api.logout(sessionToken); } - + @Test public void testSearchExactCode() { @@ -63,7 +63,7 @@ public class SearchDataSetTypeTest extends AbstractTest DataSetTypeFetchOptions fetchOptions = new DataSetTypeFetchOptions(); fetchOptions.withPropertyAssignments(); SearchResult<DataSetType> searchResult = v3api.searchDataSetTypes(sessionToken, searchCriteria, fetchOptions); - + List<DataSetType> types = searchResult.getObjects(); List<String> codes = extractCodes(types); Collections.sort(codes); @@ -71,7 +71,7 @@ public class SearchDataSetTypeTest extends AbstractTest assertEquals(types.get(0).getFetchOptions().hasPropertyAssignments(), true); v3api.logout(sessionToken); } - + @Test public void testSearchWithCodeThatStartsWithD() { @@ -79,9 +79,9 @@ public class SearchDataSetTypeTest extends AbstractTest EntityTypeSearchCriteria searchCriteria = new EntityTypeSearchCriteria(); searchCriteria.withCode().thatStartsWith("D"); DataSetTypeFetchOptions fetchOptions = new DataSetTypeFetchOptions(); - + SearchResult<DataSetType> searchResult = v3api.searchDataSetTypes(sessionToken, searchCriteria, fetchOptions); - + List<DataSetType> types = searchResult.getObjects(); List<String> codes = extractCodes(types); Collections.sort(codes); @@ -98,9 +98,9 @@ public class SearchDataSetTypeTest extends AbstractTest searchCriteria.withCode().thatStartsWith("D"); DataSetTypeFetchOptions fetchOptions = new DataSetTypeFetchOptions(); fetchOptions.withPropertyAssignments().sortBy().code().desc(); - + SearchResult<DataSetType> searchResult = v3api.searchDataSetTypes(sessionToken, searchCriteria, fetchOptions); - + List<DataSetType> types = searchResult.getObjects(); Collections.sort(types, new CodeComparator<DataSetType>()); List<String> codes = extractCodes(types); @@ -110,5 +110,5 @@ public class SearchDataSetTypeTest extends AbstractTest assertOrder(propertyAssignments, "ORGANISM", "DESCRIPTION", "BACTERIUM"); v3api.logout(sessionToken); } - + } diff --git a/openbis/sourceTest/java/ch/ethz/sis/openbis/systemtest/asapi/v3/SearchExperimentTypeTest.java b/openbis/sourceTest/java/ch/ethz/sis/openbis/systemtest/asapi/v3/SearchExperimentTypeTest.java index 6d2fe244a1f..9891d122583 100644 --- a/openbis/sourceTest/java/ch/ethz/sis/openbis/systemtest/asapi/v3/SearchExperimentTypeTest.java +++ b/openbis/sourceTest/java/ch/ethz/sis/openbis/systemtest/asapi/v3/SearchExperimentTypeTest.java @@ -31,8 +31,6 @@ import ch.ethz.sis.openbis.generic.asapi.v3.dto.property.PropertyAssignment; import ch.ethz.sis.openbis.generic.server.asapi.v3.helper.sort.CodeComparator; /** - * - * * @author Franz-Josef Elmer */ public class SearchExperimentTypeTest extends AbstractTest @@ -45,7 +43,7 @@ public class SearchExperimentTypeTest extends AbstractTest ExperimentTypeFetchOptions fetchOptions = new ExperimentTypeFetchOptions(); fetchOptions.withPropertyAssignments(); SearchResult<ExperimentType> searchResult = v3api.searchExperimentTypes(sessionToken, searchCriteria, fetchOptions); - + List<ExperimentType> types = searchResult.getObjects(); List<String> codes = extractCodes(types); Collections.sort(codes); @@ -53,7 +51,7 @@ public class SearchExperimentTypeTest extends AbstractTest assertEquals(types.get(0).getFetchOptions().hasPropertyAssignments(), true); v3api.logout(sessionToken); } - + @Test public void testSearchExactCode() { @@ -63,7 +61,7 @@ public class SearchExperimentTypeTest extends AbstractTest ExperimentTypeFetchOptions fetchOptions = new ExperimentTypeFetchOptions(); fetchOptions.withPropertyAssignments(); SearchResult<ExperimentType> searchResult = v3api.searchExperimentTypes(sessionToken, searchCriteria, fetchOptions); - + List<ExperimentType> types = searchResult.getObjects(); List<String> codes = extractCodes(types); Collections.sort(codes); @@ -71,7 +69,7 @@ public class SearchExperimentTypeTest extends AbstractTest assertEquals(types.get(0).getFetchOptions().hasPropertyAssignments(), true); v3api.logout(sessionToken); } - + @Test public void testSearchWithCodeThatStartsWithD() { @@ -79,9 +77,9 @@ public class SearchExperimentTypeTest extends AbstractTest EntityTypeSearchCriteria searchCriteria = new EntityTypeSearchCriteria(); searchCriteria.withCode().thatStartsWith("D"); ExperimentTypeFetchOptions fetchOptions = new ExperimentTypeFetchOptions(); - + SearchResult<ExperimentType> searchResult = v3api.searchExperimentTypes(sessionToken, searchCriteria, fetchOptions); - + List<ExperimentType> types = searchResult.getObjects(); List<String> codes = extractCodes(types); Collections.sort(codes); @@ -98,9 +96,9 @@ public class SearchExperimentTypeTest extends AbstractTest searchCriteria.withCode().thatStartsWith("D"); ExperimentTypeFetchOptions fetchOptions = new ExperimentTypeFetchOptions(); fetchOptions.withPropertyAssignments().sortBy().code().desc(); - + SearchResult<ExperimentType> searchResult = v3api.searchExperimentTypes(sessionToken, searchCriteria, fetchOptions); - + List<ExperimentType> types = searchResult.getObjects(); Collections.sort(types, new CodeComparator<ExperimentType>()); List<String> codes = extractCodes(types); @@ -110,5 +108,5 @@ public class SearchExperimentTypeTest extends AbstractTest assertOrder(propertyAssignments, "ORGANISM", "DESCRIPTION", "BACTERIUM"); v3api.logout(sessionToken); } - + } diff --git a/openbis/sourceTest/java/ch/ethz/sis/openbis/systemtest/asapi/v3/SearchMaterialTypeTest.java b/openbis/sourceTest/java/ch/ethz/sis/openbis/systemtest/asapi/v3/SearchMaterialTypeTest.java index 1124a4e54d6..1a47898e493 100644 --- a/openbis/sourceTest/java/ch/ethz/sis/openbis/systemtest/asapi/v3/SearchMaterialTypeTest.java +++ b/openbis/sourceTest/java/ch/ethz/sis/openbis/systemtest/asapi/v3/SearchMaterialTypeTest.java @@ -31,8 +31,6 @@ import ch.ethz.sis.openbis.generic.asapi.v3.dto.property.PropertyAssignment; import ch.ethz.sis.openbis.generic.server.asapi.v3.helper.sort.CodeComparator; /** - * - * * @author Franz-Josef Elmer */ public class SearchMaterialTypeTest extends AbstractTest @@ -45,7 +43,7 @@ public class SearchMaterialTypeTest extends AbstractTest MaterialTypeFetchOptions fetchOptions = new MaterialTypeFetchOptions(); fetchOptions.withPropertyAssignments(); SearchResult<MaterialType> searchResult = v3api.searchMaterialTypes(sessionToken, searchCriteria, fetchOptions); - + List<MaterialType> types = searchResult.getObjects(); List<String> codes = extractCodes(types); Collections.sort(codes); @@ -53,7 +51,7 @@ public class SearchMaterialTypeTest extends AbstractTest assertEquals(types.get(0).getFetchOptions().hasPropertyAssignments(), true); v3api.logout(sessionToken); } - + @Test public void testSearchExactCode() { @@ -63,7 +61,7 @@ public class SearchMaterialTypeTest extends AbstractTest MaterialTypeFetchOptions fetchOptions = new MaterialTypeFetchOptions(); fetchOptions.withPropertyAssignments(); SearchResult<MaterialType> searchResult = v3api.searchMaterialTypes(sessionToken, searchCriteria, fetchOptions); - + List<MaterialType> types = searchResult.getObjects(); List<String> codes = extractCodes(types); Collections.sort(codes); @@ -71,7 +69,7 @@ public class SearchMaterialTypeTest extends AbstractTest assertEquals(types.get(0).getFetchOptions().hasPropertyAssignments(), true); v3api.logout(sessionToken); } - + @Test public void testSearchWithCodeThatStartsWithB() { @@ -79,9 +77,9 @@ public class SearchMaterialTypeTest extends AbstractTest EntityTypeSearchCriteria searchCriteria = new EntityTypeSearchCriteria(); searchCriteria.withCode().thatStartsWith("B"); MaterialTypeFetchOptions fetchOptions = new MaterialTypeFetchOptions(); - + SearchResult<MaterialType> searchResult = v3api.searchMaterialTypes(sessionToken, searchCriteria, fetchOptions); - + List<MaterialType> types = searchResult.getObjects(); List<String> codes = extractCodes(types); Collections.sort(codes); @@ -98,9 +96,9 @@ public class SearchMaterialTypeTest extends AbstractTest searchCriteria.withCode().thatStartsWith("B"); MaterialTypeFetchOptions fetchOptions = new MaterialTypeFetchOptions(); fetchOptions.withPropertyAssignments().sortBy().label().desc(); - + SearchResult<MaterialType> searchResult = v3api.searchMaterialTypes(sessionToken, searchCriteria, fetchOptions); - + List<MaterialType> types = searchResult.getObjects(); Collections.sort(types, new CodeComparator<MaterialType>()); List<String> codes = extractCodes(types); @@ -110,5 +108,5 @@ public class SearchMaterialTypeTest extends AbstractTest assertOrder(propertyAssignments, "ORGANISM", "DESCRIPTION"); v3api.logout(sessionToken); } - + } diff --git a/openbis/sourceTest/java/ch/ethz/sis/openbis/systemtest/asapi/v3/SearchSampleTest.java b/openbis/sourceTest/java/ch/ethz/sis/openbis/systemtest/asapi/v3/SearchSampleTest.java index ab5655e9d31..293b4ed9996 100644 --- a/openbis/sourceTest/java/ch/ethz/sis/openbis/systemtest/asapi/v3/SearchSampleTest.java +++ b/openbis/sourceTest/java/ch/ethz/sis/openbis/systemtest/asapi/v3/SearchSampleTest.java @@ -969,6 +969,7 @@ public class SearchSampleTest extends AbstractSampleTest } final String LISTED_ID = "/CISD/C1"; + final String UNLISTED_ID = "/CISD/CL1:A01"; @Test @@ -980,12 +981,11 @@ public class SearchSampleTest extends AbstractSampleTest SampleSearchCriteria criteria = new SampleSearchCriteria(); criteria.withId().thatEquals(new SampleIdentifier(UNLISTED_ID)); - - + List<Sample> samples = search(sessionToken, criteria, fo); - + assertEquals(samples.size(), 1); - + assertSampleIdentifiersInOrder(samples, UNLISTED_ID); final SampleTypeSearchCriteria withType = criteria.withType(); @@ -1008,9 +1008,9 @@ public class SearchSampleTest extends AbstractSampleTest final SampleTypeSearchCriteria withType = criteria.withType(); List<Sample> samples = search(sessionToken, criteria, fo); - + assertEquals(samples.size(), 1); - + assertEquals(samples.get(0).getIdentifier().getIdentifier(), LISTED_ID); withType.withListable().thatEquals(true); diff --git a/openbis/sourceTest/java/ch/ethz/sis/openbis/systemtest/asapi/v3/SearchSampleTypeTest.java b/openbis/sourceTest/java/ch/ethz/sis/openbis/systemtest/asapi/v3/SearchSampleTypeTest.java index 80c1276e5c2..e41d7f5307c 100644 --- a/openbis/sourceTest/java/ch/ethz/sis/openbis/systemtest/asapi/v3/SearchSampleTypeTest.java +++ b/openbis/sourceTest/java/ch/ethz/sis/openbis/systemtest/asapi/v3/SearchSampleTypeTest.java @@ -31,8 +31,6 @@ import ch.ethz.sis.openbis.generic.asapi.v3.dto.sample.fetchoptions.SampleTypeFe import ch.ethz.sis.openbis.generic.server.asapi.v3.helper.sort.CodeComparator; /** - * - * * @author Franz-Josef Elmer */ public class SearchSampleTypeTest extends AbstractTest @@ -45,15 +43,17 @@ public class SearchSampleTypeTest extends AbstractTest SampleTypeFetchOptions fetchOptions = new SampleTypeFetchOptions(); fetchOptions.withPropertyAssignments(); SearchResult<SampleType> searchResult = v3api.searchSampleTypes(sessionToken, searchCriteria, fetchOptions); - + List<SampleType> types = searchResult.getObjects(); List<String> codes = extractCodes(types); Collections.sort(codes); - assertEquals(codes.toString(), "[CELL_PLATE, CONTROL_LAYOUT, DELETION_TEST, DILUTION_PLATE, DYNAMIC_PLATE, IMPOSSIBLE, IMPOSSIBLE_TO_UPDATE, MASTER_PLATE, NORMAL, REINFECT_PLATE, VALIDATE_CHILDREN, WELL]"); + assertEquals( + codes.toString(), + "[CELL_PLATE, CONTROL_LAYOUT, DELETION_TEST, DILUTION_PLATE, DYNAMIC_PLATE, IMPOSSIBLE, IMPOSSIBLE_TO_UPDATE, MASTER_PLATE, NORMAL, REINFECT_PLATE, VALIDATE_CHILDREN, WELL]"); assertEquals(types.get(0).getFetchOptions().hasPropertyAssignments(), true); v3api.logout(sessionToken); } - + @Test public void testSearchExactCode() { @@ -63,7 +63,7 @@ public class SearchSampleTypeTest extends AbstractTest SampleTypeFetchOptions fetchOptions = new SampleTypeFetchOptions(); fetchOptions.withPropertyAssignments(); SearchResult<SampleType> searchResult = v3api.searchSampleTypes(sessionToken, searchCriteria, fetchOptions); - + List<SampleType> types = searchResult.getObjects(); List<String> codes = extractCodes(types); Collections.sort(codes); @@ -71,7 +71,7 @@ public class SearchSampleTypeTest extends AbstractTest assertEquals(types.get(0).getFetchOptions().hasPropertyAssignments(), true); v3api.logout(sessionToken); } - + @Test public void testSearchWithCodeThatStartsWithD() { @@ -79,9 +79,9 @@ public class SearchSampleTypeTest extends AbstractTest EntityTypeSearchCriteria searchCriteria = new EntityTypeSearchCriteria(); searchCriteria.withCode().thatStartsWith("D"); SampleTypeFetchOptions fetchOptions = new SampleTypeFetchOptions(); - + SearchResult<SampleType> searchResult = v3api.searchSampleTypes(sessionToken, searchCriteria, fetchOptions); - + List<SampleType> types = searchResult.getObjects(); List<String> codes = extractCodes(types); Collections.sort(codes); @@ -98,9 +98,9 @@ public class SearchSampleTypeTest extends AbstractTest searchCriteria.withCode().thatStartsWith("D"); SampleTypeFetchOptions fetchOptions = new SampleTypeFetchOptions(); fetchOptions.withPropertyAssignments().sortBy().label().desc(); - + SearchResult<SampleType> searchResult = v3api.searchSampleTypes(sessionToken, searchCriteria, fetchOptions); - + List<SampleType> types = searchResult.getObjects(); Collections.sort(types, new CodeComparator<SampleType>()); List<String> codes = extractCodes(types); @@ -110,5 +110,5 @@ public class SearchSampleTypeTest extends AbstractTest assertOrder(propertyAssignments, "BACTERIUM", "ORGANISM", "DESCRIPTION"); v3api.logout(sessionToken); } - + } diff --git a/openbis/sourceTest/java/ch/ethz/sis/openbis/systemtest/asapi/v3/SearchServiceTest.java b/openbis/sourceTest/java/ch/ethz/sis/openbis/systemtest/asapi/v3/SearchServiceTest.java index c35e60fec7a..846778e5ad0 100644 --- a/openbis/sourceTest/java/ch/ethz/sis/openbis/systemtest/asapi/v3/SearchServiceTest.java +++ b/openbis/sourceTest/java/ch/ethz/sis/openbis/systemtest/asapi/v3/SearchServiceTest.java @@ -38,37 +38,37 @@ public class SearchServiceTest extends AbstractTest CustomASServiceSearchCriteria searchCriteria = new CustomASServiceSearchCriteria(); searchCriteria.withCode().thatEquals("simple-service"); - SearchResult<CustomASService> result = v3api.searchCustomASServices(sessionToken, searchCriteria, + SearchResult<CustomASService> result = v3api.searchCustomASServices(sessionToken, searchCriteria, new CustomASServiceFetchOptions()); assertEquals(result.getTotalCount(), 1); } - + @Test public void testSearchAllServicesSortedPage2() { CustomASServiceFetchOptions fetchOptions = new CustomASServiceFetchOptions(); fetchOptions.from(2).count(1).sortBy(); - SearchResult<CustomASService> result = v3api.searchCustomASServices(systemSessionToken, - new CustomASServiceSearchCriteria(), + SearchResult<CustomASService> result = v3api.searchCustomASServices(systemSessionToken, + new CustomASServiceSearchCriteria(), fetchOptions); - + assertEquals(result.getObjects().toString(), "[CustomASService code: service3]"); assertEquals(result.getTotalCount(), 4); } - + @Test public void testSearchServiceByCode() { String sessionToken = v3api.login(TEST_USER, PASSWORD); CustomASServiceSearchCriteria searchCriteria = new CustomASServiceSearchCriteria(); searchCriteria.withCode().thatStartsWith("simple"); - - SearchResult<CustomASService> result = v3api.searchCustomASServices(sessionToken, searchCriteria, new + + SearchResult<CustomASService> result = v3api.searchCustomASServices(sessionToken, searchCriteria, new CustomASServiceFetchOptions()); - + assertEquals(result.getObjects().toString(), "[CustomASService code: simple-service]"); assertEquals(result.getTotalCount(), 1); } - + } \ No newline at end of file diff --git a/openbis/sourceTest/java/ch/ethz/sis/openbis/systemtest/asapi/v3/UpdateExperimentTest.java b/openbis/sourceTest/java/ch/ethz/sis/openbis/systemtest/asapi/v3/UpdateExperimentTest.java index d383409b6af..da0eb6eff2b 100644 --- a/openbis/sourceTest/java/ch/ethz/sis/openbis/systemtest/asapi/v3/UpdateExperimentTest.java +++ b/openbis/sourceTest/java/ch/ethz/sis/openbis/systemtest/asapi/v3/UpdateExperimentTest.java @@ -123,41 +123,22 @@ public class UpdateExperimentTest extends AbstractExperimentTest Experiment experiment = experiments.get(0); assertEquals(experiment.getIdentifier().getIdentifier(), "/CISD/NOE/TEST_EXPERIMENT"); } - - /* - @Test(groups = "project-samples") - public void testMovingExperimentWithProjectSamplesToADifferentProject() - { - String sessionToken = v3api.login(TEST_USER, PASSWORD); - SampleCreation sampleCreation = new SampleCreation(); - sampleCreation.setCode("PROJECT-SAMPLE-IN-EXPERIMENT"); - ExperimentIdentifier experimentId = new ExperimentIdentifier("CISD", "NEMO", "EXP1"); - sampleCreation.setExperimentId(experimentId); - sampleCreation.setSpaceId(new SpacePermId("CISD")); - sampleCreation.setProjectId(new ProjectIdentifier("/CISD/NEMO")); - sampleCreation.setTypeId(new EntityTypePermId("CELL_PLATE")); - v3api.createSamples(sessionToken, Arrays.asList(sampleCreation)); - ExperimentUpdate experimentUpdate = new ExperimentUpdate(); - experimentUpdate.setExperimentId(experimentId); - ProjectIdentifier projectId = new ProjectIdentifier("/CISD/NOE"); - experimentUpdate.setProjectId(projectId); - - v3api.updateExperiments(sessionToken, Arrays.asList(experimentUpdate)); - - ExperimentFetchOptions fetchOptions = new ExperimentFetchOptions(); - fetchOptions.withProject(); - fetchOptions.withSamples().withProject(); - Map<IExperimentId, Experiment> map = v3api.mapExperiments(sessionToken, - Arrays.asList(new ExperimentIdentifier("CISD", "NOE", "EXP1")), fetchOptions); - List<Experiment> experiments = new ArrayList<Experiment>(map.values()); - List<Sample> samples = experiments.get(0).getSamples(); - assertEquals(experiments.get(0).getProject().getCode(), "NOE"); - assertEquals(samples.get(0).getProject().getCode(), "NOE"); - AssertionUtil.assertCollectionSize(samples, 1); - AssertionUtil.assertCollectionSize(experiments, 1); - } -*/ + /* + * @Test(groups = "project-samples") public void testMovingExperimentWithProjectSamplesToADifferentProject() { String sessionToken = + * v3api.login(TEST_USER, PASSWORD); SampleCreation sampleCreation = new SampleCreation(); sampleCreation.setCode("PROJECT-SAMPLE-IN-EXPERIMENT"); + * ExperimentIdentifier experimentId = new ExperimentIdentifier("CISD", "NEMO", "EXP1"); sampleCreation.setExperimentId(experimentId); + * sampleCreation.setSpaceId(new SpacePermId("CISD")); sampleCreation.setProjectId(new ProjectIdentifier("/CISD/NEMO")); + * sampleCreation.setTypeId(new EntityTypePermId("CELL_PLATE")); v3api.createSamples(sessionToken, Arrays.asList(sampleCreation)); + * ExperimentUpdate experimentUpdate = new ExperimentUpdate(); experimentUpdate.setExperimentId(experimentId); ProjectIdentifier projectId = new + * ProjectIdentifier("/CISD/NOE"); experimentUpdate.setProjectId(projectId); v3api.updateExperiments(sessionToken, + * Arrays.asList(experimentUpdate)); ExperimentFetchOptions fetchOptions = new ExperimentFetchOptions(); fetchOptions.withProject(); + * fetchOptions.withSamples().withProject(); Map<IExperimentId, Experiment> map = v3api.mapExperiments(sessionToken, Arrays.asList(new + * ExperimentIdentifier("CISD", "NOE", "EXP1")), fetchOptions); List<Experiment> experiments = new ArrayList<Experiment>(map.values()); + * List<Sample> samples = experiments.get(0).getSamples(); assertEquals(experiments.get(0).getProject().getCode(), "NOE"); + * assertEquals(samples.get(0).getProject().getCode(), "NOE"); AssertionUtil.assertCollectionSize(samples, 1); + * AssertionUtil.assertCollectionSize(experiments, 1); } + */ @Test public void testUpdateWithProjectNull() { diff --git a/openbis/sourceTest/java/ch/ethz/sis/openbis/systemtest/deletion/Change.java b/openbis/sourceTest/java/ch/ethz/sis/openbis/systemtest/deletion/Change.java index 1d4bb18b8cd..861ee7bca22 100644 --- a/openbis/sourceTest/java/ch/ethz/sis/openbis/systemtest/deletion/Change.java +++ b/openbis/sourceTest/java/ch/ethz/sis/openbis/systemtest/deletion/Change.java @@ -7,7 +7,7 @@ class Change implements Comparable<Change> public final Date time; public final String userId; - + public final String value; public final boolean isRemoval; @@ -25,7 +25,7 @@ class Change implements Comparable<Change> this.attachmentContent = attachmentContent; this.isRemoval = isRemoval; } - + @Override public int compareTo(Change other) { diff --git a/openbis/sourceTest/java/ch/ethz/sis/openbis/systemtest/deletion/DataSetDeletionTest.java b/openbis/sourceTest/java/ch/ethz/sis/openbis/systemtest/deletion/DataSetDeletionTest.java index 74969716b7d..6be95567bcb 100644 --- a/openbis/sourceTest/java/ch/ethz/sis/openbis/systemtest/deletion/DataSetDeletionTest.java +++ b/openbis/sourceTest/java/ch/ethz/sis/openbis/systemtest/deletion/DataSetDeletionTest.java @@ -103,8 +103,8 @@ public class DataSetDeletionTest extends DeletionTest delete(project); delete(space); - assertHistory(dataset.getPermId(), "OWNED", experimentSet(experiment.getPermId()), - sampleSet(spaceSample.getPermId()), + assertHistory(dataset.getPermId(), "OWNED", experimentSet(experiment.getPermId()), + sampleSet(spaceSample.getPermId()), sampleSet(experimentSample.getPermId()), experimentSet(experiment.getPermId())); } diff --git a/openbis/sourceTest/java/ch/ethz/sis/openbis/systemtest/deletion/DeletionTest.java b/openbis/sourceTest/java/ch/ethz/sis/openbis/systemtest/deletion/DeletionTest.java index da6d96f0c1d..e0edca48262 100644 --- a/openbis/sourceTest/java/ch/ethz/sis/openbis/systemtest/deletion/DeletionTest.java +++ b/openbis/sourceTest/java/ch/ethz/sis/openbis/systemtest/deletion/DeletionTest.java @@ -100,86 +100,86 @@ public abstract class DeletionTest extends AbstractTest private static SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS"); - public Set<String> attachmentSet(String...values) + public Set<String> attachmentSet(String... values) { return attachmentSetFor(TEST_USER, values); } - - public Set<String> attachmentSetFor(String userId, String...values) + + public Set<String> attachmentSetFor(String userId, String... values) { return entitySet("ATTACHMENT", userId, values); } - - public Set<String> unknownSet(String...values) + + public Set<String> unknownSet(String... values) { return unknownSetFor(TEST_USER, values); } - - public Set<String> unknownSetFor(String userId, String...values) + + public Set<String> unknownSetFor(String userId, String... values) { return entitySet("UNKNOWN", userId, values); } - - public Set<String> spaceSet(String...values) + + public Set<String> spaceSet(String... values) { return spaceSetFor(TEST_USER, values); } - - public Set<String> spaceSetFor(String userId, String...values) + + public Set<String> spaceSetFor(String userId, String... values) { return entitySet("SPACE", userId, values); } - - public Set<String> projectSet(String...values) + + public Set<String> projectSet(String... values) { return projectSetFor(TEST_USER, values); } - - public Set<String> projectSetFor(String userId, String...values) + + public Set<String> projectSetFor(String userId, String... values) { return entitySet("PROJECT", userId, values); } - - public Set<String> experimentSet(String...values) + + public Set<String> experimentSet(String... values) { return experimentSetFor(TEST_USER, values); } - - public Set<String> experimentSetFor(String userId, String...values) + + public Set<String> experimentSetFor(String userId, String... values) { return entitySet("EXPERIMENT", userId, values); } - public Set<String> sampleSet(String...values) + public Set<String> sampleSet(String... values) { return sampleSetFor(TEST_USER, values); } - - public Set<String> sampleSetFor(String userId, String...values) + + public Set<String> sampleSetFor(String userId, String... values) { return entitySet("SAMPLE", userId, values); } - - public Set<String> dataSetSet(String...values) + + public Set<String> dataSetSet(String... values) { return dataSetSetFor(TEST_USER, values); } - - public Set<String> dataSetSetFor(String userId, String...values) + + public Set<String> dataSetSetFor(String userId, String... values) { return entitySet("DATA_SET", userId, values); } - - public Set<String> propertiesSet(String...values) + + public Set<String> propertiesSet(String... values) { return set("PROPERTY", null, TEST_USER, values); } - + private Set<String> entitySet(String entityType, String userId, String... values) { return set("RELATIONSHIP", entityType, userId, values); } - + private Set<String> set(String type, String entityTypeOrNull, String userId, String... values) { Set<String> result = new HashSet<>(); @@ -189,7 +189,7 @@ public abstract class DeletionTest extends AbstractTest } return result; } - + public Set<String> set(String... values) { return new HashSet<String>(Arrays.asList(values)); @@ -320,7 +320,7 @@ public abstract class DeletionTest extends AbstractTest return false; } } - + public void assertAttachment(String permId, Set<String> attachments) throws Exception { IModificationFilter filter = new IModificationFilter() @@ -355,7 +355,7 @@ public abstract class DeletionTest extends AbstractTest @Override public boolean accept(Modification modification) { - return modification.type.equals(AttributeEntry.ATTRIBUTE) + return modification.type.equals(AttributeEntry.ATTRIBUTE) && modification.key.equals("REGISTRATION_TIMESTAMP") == false; } @@ -451,14 +451,14 @@ public abstract class DeletionTest extends AbstractTest if (expectedList.equals(actualValues) == false) { - + Assert.assertEquals(render(actualValues), render(expectedList), - filter.getDescription() + " of entity " + permId + " has wrong value history. Expected <" - + render(expectedList) + ">, actual <" + render(actualValues) + ">. Raw changes: " + filter.getDescription() + " of entity " + permId + " has wrong value history. Expected <" + + render(expectedList) + ">, actual <" + render(actualValues) + ">. Raw changes: " + builder); } } - + private String render(List<Set<String>> values) { StringBuilder builder = new StringBuilder(); @@ -483,14 +483,15 @@ public abstract class DeletionTest extends AbstractTest { return currentTime == null ? change.time == null : currentTime.equals(change.time); } - + private static interface IModificationFilter { public String getDescription(); + public boolean accept(Modification modification); - + } - + private static interface IChangeRenderer { public String render(Change change); @@ -502,12 +503,12 @@ public abstract class DeletionTest extends AbstractTest Query query = session.createQuery("SELECT e FROM EventPE e WHERE :permId IN e.identifiersInternal").setParameter("permId", permId); EventPE event = (EventPE) query.uniqueResult(); String attachmentContent = getAttachmentContent(event); - + JsonNode tree = new ObjectMapper().reader().readTree(event.getContent()); - + List<Modification> allMods = IteratorUtils.toList(IteratorUtils.transformedIterator(tree.get(permId).elements(), new JsonNodeToModificationTransformer())); - + List<Modification> mods = new ArrayList<>(); for (Modification mod : allMods) { @@ -516,7 +517,7 @@ public abstract class DeletionTest extends AbstractTest mods.add(mod); } } - + List<Change> changes = new ArrayList<>(); for (Modification mod : mods) { @@ -527,7 +528,7 @@ public abstract class DeletionTest extends AbstractTest changes.add(new Change(mod.validUntil, mod.key, mod.userId, value, attachmentContent, true)); } } - + Collections.sort(changes); return changes; @@ -573,7 +574,7 @@ public abstract class DeletionTest extends AbstractTest m.validUntil = asDate(node.get("validUntil")); return m; } - + private Date asDate(JsonNode node) { String textValue = asString(node); @@ -585,7 +586,7 @@ public abstract class DeletionTest extends AbstractTest throw CheckedExceptionTunnel.wrapIfNecessary(ex); } } - + private String asString(JsonNode node) { if (node == null) @@ -599,13 +600,13 @@ public abstract class DeletionTest extends AbstractTest private static class Modification { public String userId; - + public String type; - + public String key; public String value; - + public String entityType; public Date validFrom; diff --git a/openbis/sourceTest/java/ch/ethz/sis/openbis/systemtest/deletion/ExperimentDeletionTest.java b/openbis/sourceTest/java/ch/ethz/sis/openbis/systemtest/deletion/ExperimentDeletionTest.java index 711fd5e2e3c..907fa7edadd 100644 --- a/openbis/sourceTest/java/ch/ethz/sis/openbis/systemtest/deletion/ExperimentDeletionTest.java +++ b/openbis/sourceTest/java/ch/ethz/sis/openbis/systemtest/deletion/ExperimentDeletionTest.java @@ -25,7 +25,7 @@ public class ExperimentDeletionTest extends DeletionTest SpacePermId space = createSpace("SPACE"); ProjectPermId project = createProject(space, "PROJECT1"); ExperimentPermId exp = createExperiment(project, "EXPERIMENT"); - + AttachmentCreation attachment1 = new AttachmentCreation(); attachment1.setTitle("A1"); attachment1.setDescription("hello A"); @@ -35,21 +35,21 @@ public class ExperimentDeletionTest extends DeletionTest attachment2.setFileName("hi.txt"); attachment2.setContent("hi world!".getBytes()); addAttachment(exp, attachment1, attachment2); - + newTx(); - + delete(exp); delete(project); delete(space); - assertAttachment("experiment/" + exp.getPermId() + "/hello.txt(1)", + assertAttachment("experiment/" + exp.getPermId() + "/hello.txt(1)", set("OWNED = ATTACHMENT:" + exp + "[EXPERIMENT](user:test) <hello world!>")); - assertAttachment("experiment/" + exp.getPermId() + "/hi.txt(1)", + assertAttachment("experiment/" + exp.getPermId() + "/hi.txt(1)", set("OWNED = ATTACHMENT:" + exp + "[EXPERIMENT](user:test) <hi world!>")); assertHistory(exp.getPermId(), "OWNER", attachmentSet("experiment/" + exp.getPermId() + "/hello.txt(1)", "experiment/" + exp.getPermId() + "/hi.txt(1)")); } - + @Test @Rollback(false) public void testAttributes() throws Exception @@ -87,7 +87,7 @@ public class ExperimentDeletionTest extends DeletionTest ProjectPermId project2 = createProject(space2, "PROJECT2"); ExperimentPermId experiment = createExperiment(project1, "EXPERIMENT"); - + newTx(); ExperimentUpdate update = new ExperimentUpdate(); @@ -101,7 +101,7 @@ public class ExperimentDeletionTest extends DeletionTest delete(space1); delete(space2); - assertHistory(experiment.getPermId(), "OWNED", projectSet(project1.getPermId()), + assertHistory(experiment.getPermId(), "OWNED", projectSet(project1.getPermId()), projectSet(project2.getPermId())); } @@ -151,7 +151,7 @@ public class ExperimentDeletionTest extends DeletionTest delete(project); delete(space); - assertHistory(experiment.getPermId(), "OWNER", + assertHistory(experiment.getPermId(), "OWNER", unknownSet(dataset1.getPermId(), dataset2.getPermId()), unknownSet(dataset2.getPermId()), set()); diff --git a/openbis/sourceTest/java/ch/ethz/sis/openbis/systemtest/deletion/ProjectDeletionTest.java b/openbis/sourceTest/java/ch/ethz/sis/openbis/systemtest/deletion/ProjectDeletionTest.java index 5bd50f794b7..f6241c7b174 100644 --- a/openbis/sourceTest/java/ch/ethz/sis/openbis/systemtest/deletion/ProjectDeletionTest.java +++ b/openbis/sourceTest/java/ch/ethz/sis/openbis/systemtest/deletion/ProjectDeletionTest.java @@ -23,7 +23,7 @@ public class ProjectDeletionTest extends DeletionTest { SpacePermId space = createSpace("SPACE"); ProjectPermId project = createProject(space, "PROJECT3"); - + AttachmentCreation attachment1 = new AttachmentCreation(); attachment1.setTitle("A1"); attachment1.setDescription("hello A"); @@ -41,15 +41,15 @@ public class ProjectDeletionTest extends DeletionTest projectUpdate.getAttachments().remove(new AttachmentFileName("hello.txt")); v3api.updateProjects(sessionToken, Arrays.asList(projectUpdate)); - assertAttachment("project/" + project.getPermId() + "/hello.txt(1)", + assertAttachment("project/" + project.getPermId() + "/hello.txt(1)", set("OWNED = ATTACHMENT:" + project + "[PROJECT](user:test) <hello world!>")); - + newTx(); - + delete(project); delete(space); } - + @Test @Rollback(false) public void deleteProjectWithAttachments() throws Exception @@ -66,20 +66,20 @@ public class ProjectDeletionTest extends DeletionTest attachment2.setFileName("hi.txt"); attachment2.setContent("hi world!".getBytes()); addAttachment(project, attachment1, attachment2); - + newTx(); - + delete(project); delete(space); - assertAttachment("project/" + project.getPermId() + "/hello.txt(1)", + assertAttachment("project/" + project.getPermId() + "/hello.txt(1)", set("OWNED = ATTACHMENT:" + project + "[PROJECT](user:test) <hello world!>")); - assertAttachment("project/" + project.getPermId() + "/hi.txt(1)", + assertAttachment("project/" + project.getPermId() + "/hi.txt(1)", set("OWNED = ATTACHMENT:" + project + "[PROJECT](user:test) <hi world!>")); assertHistory(project.getPermId(), "OWNER", attachmentSet("project/" + project.getPermId() + "/hello.txt(1)", "project/" + project.getPermId() + "/hi.txt(1)")); } - + @Test @Rollback(false) public void testAttributes() throws Exception @@ -152,7 +152,7 @@ public class ProjectDeletionTest extends DeletionTest delete(project2); delete(space); - assertHistory(project1.getPermId(), "OWNER", + assertHistory(project1.getPermId(), "OWNER", experimentSet(experiment1.getPermId(), experiment2.getPermId()), set()); } } diff --git a/openbis/sourceTest/java/ch/ethz/sis/openbis/systemtest/deletion/SampleDeletionTest.java b/openbis/sourceTest/java/ch/ethz/sis/openbis/systemtest/deletion/SampleDeletionTest.java index ee13327312f..83fe7e333a8 100644 --- a/openbis/sourceTest/java/ch/ethz/sis/openbis/systemtest/deletion/SampleDeletionTest.java +++ b/openbis/sourceTest/java/ch/ethz/sis/openbis/systemtest/deletion/SampleDeletionTest.java @@ -22,7 +22,7 @@ public class SampleDeletionTest extends DeletionTest { SpacePermId space = createSpace("SPACE"); SamplePermId sample = createSample(null, space, "SAMPLE"); - + AttachmentCreation attachment1 = new AttachmentCreation(); attachment1.setTitle("A1"); attachment1.setDescription("hello A"); @@ -32,15 +32,15 @@ public class SampleDeletionTest extends DeletionTest attachment2.setFileName("hi.txt"); attachment2.setContent("hi world!".getBytes()); addAttachment(sample, attachment1, attachment2); - + newTx(); - + delete(sample); delete(space); - assertAttachment("sample/" + sample.getPermId() + "/hello.txt(1)", + assertAttachment("sample/" + sample.getPermId() + "/hello.txt(1)", set("OWNED = ATTACHMENT:" + sample + "[SAMPLE](user:test) <hello world!>")); - assertAttachment("sample/" + sample.getPermId() + "/hi.txt(1)", + assertAttachment("sample/" + sample.getPermId() + "/hi.txt(1)", set("OWNED = ATTACHMENT:" + sample + "[SAMPLE](user:test) <hi world!>")); assertHistory(sample.getPermId(), "OWNER", attachmentSet("sample/" + sample.getPermId() + "/hello.txt(1)", "sample/" + sample.getPermId() + "/hi.txt(1)")); @@ -51,7 +51,7 @@ public class SampleDeletionTest extends DeletionTest public void deleteSharedSampleWithAttachments() throws Exception { SamplePermId sample = createSample(null, null, "SAMPLE"); - + AttachmentCreation attachment1 = new AttachmentCreation(); attachment1.setTitle("A1"); attachment1.setDescription("hello A"); @@ -61,19 +61,19 @@ public class SampleDeletionTest extends DeletionTest attachment2.setFileName("hi.txt"); attachment2.setContent("hi world!".getBytes()); addAttachment(sample, attachment1, attachment2); - + newTx(); - + delete(sample); - - assertAttachment("sample/" + sample.getPermId() + "/hello.txt(1)", + + assertAttachment("sample/" + sample.getPermId() + "/hello.txt(1)", set("OWNED = ATTACHMENT:" + sample + "[SAMPLE](user:test) <hello world!>")); - assertAttachment("sample/" + sample.getPermId() + "/hi.txt(1)", + assertAttachment("sample/" + sample.getPermId() + "/hi.txt(1)", set("OWNED = ATTACHMENT:" + sample + "[SAMPLE](user:test) <hi world!>")); assertHistory(sample.getPermId(), "OWNER", attachmentSet("sample/" + sample.getPermId() + "/hello.txt(1)", "sample/" + sample.getPermId() + "/hi.txt(1)")); } - + @Test @Rollback(false) public void testAttributes() throws Exception @@ -84,10 +84,10 @@ public class SampleDeletionTest extends DeletionTest newTx(); Date before = new Date(); - + delete(sample); delete(space); - + HashMap<String, String> expectations = new HashMap<String, String>(); expectations.put("CODE", "SPACE_SAMPLE"); expectations.put("ENTITY_TYPE", "DELETION_TEST"); @@ -96,7 +96,6 @@ public class SampleDeletionTest extends DeletionTest assertRegistrationTimestampAttribute(sample.getPermId(), after, before); } - @Test @Rollback(false) public void changeSpace() throws Exception @@ -118,7 +117,7 @@ public class SampleDeletionTest extends DeletionTest delete(sample); delete(space1, space2); - assertHistory(sample.getPermId(), "OWNED", spaceSet(space1.getPermId()), + assertHistory(sample.getPermId(), "OWNED", spaceSet(space1.getPermId()), spaceSetFor(SYSTEM_USER, space2.getPermId())); } @@ -150,7 +149,7 @@ public class SampleDeletionTest extends DeletionTest delete(project1, project2); delete(space1, space2); - assertHistory(sample.getPermId(), "OWNED", experimentSet(experiment1.getPermId()), + assertHistory(sample.getPermId(), "OWNED", experimentSet(experiment1.getPermId()), experimentSet(experiment2.getPermId())); } diff --git a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/OpenbisClientTest.java b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/OpenbisClientTest.java index e470a2746a3..0a799deee02 100644 --- a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/OpenbisClientTest.java +++ b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/OpenbisClientTest.java @@ -123,7 +123,7 @@ public class OpenbisClientTest final String propertyTypeCode = "IS_VALID"; final String propertyValue = "true"; final Collection<Long> alreadyTracked = Arrays.asList(new Long[] - { 986L, 987L }); + { 986L, 987L }); final TrackingSampleCriteria newSampleCriteria = new TrackingSampleCriteria(sampleTypeCode, propertyTypeCode, propertyValue, @@ -135,8 +135,7 @@ public class OpenbisClientTest } /** - * Helper class encapsulating methods used for producing readable information about entities - * returned by {@link ITrackingServer} methods. + * Helper class encapsulating methods used for producing readable information about entities returned by {@link ITrackingServer} methods. * * @author Piotr Buczek */ diff --git a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/client/console/LexerTest.java b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/client/console/LexerTest.java index a97d765ffe6..e60ec667940 100644 --- a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/client/console/LexerTest.java +++ b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/client/console/LexerTest.java @@ -20,8 +20,6 @@ import org.testng.AssertJUnit; import org.testng.annotations.Test; /** - * - * * @author Franz-Josef Elmer */ public class LexerTest extends AssertJUnit @@ -41,7 +39,7 @@ public class LexerTest extends AssertJUnit check("[a, b, hello 'world']", "a b \"hello 'world'\""); check("[a=hello world]", "a=\"hello world\""); } - + private void check(String expectedTokens, String input) { assertEquals(expectedTokens, Lexer.extractTokens(input).toString()); diff --git a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/DummyAuthenticationTest.java b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/DummyAuthenticationTest.java index bf584aaa536..0cc2f44e5bf 100644 --- a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/DummyAuthenticationTest.java +++ b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/DummyAuthenticationTest.java @@ -21,10 +21,8 @@ import ch.systemsx.cisd.openbis.generic.client.web.client.testframework.Abstract import ch.systemsx.cisd.openbis.generic.client.web.client.testframework.WaitForAllActiveCallbacksFinish; /** - * A shorter version of {@link AuthenticationTest} that just logins to the application. It is - * supposed to be run at the beginning of each suite (except the first one that should start with - * full {@link AuthenticationTest}) to do all the GWT initialization and make the next test work - * faster. + * A shorter version of {@link AuthenticationTest} that just logins to the application. It is supposed to be run at the beginning of each suite + * (except the first one that should start with full {@link AuthenticationTest}) to do all the GWT initialization and make the next test work faster. * * @author Piotr Buczek */ diff --git a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/SearchCommand.java b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/SearchCommand.java index 6dbeba3f113..10e3996b698 100644 --- a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/SearchCommand.java +++ b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/SearchCommand.java @@ -26,8 +26,7 @@ import ch.systemsx.cisd.openbis.generic.client.web.client.testframework.Abstract import ch.systemsx.cisd.openbis.generic.client.web.client.testframework.GWTTestUtil; /** - * A {@link AbstractDefaultTestCommand} extension which triggers a search just after a login has - * been performed with specified parameters. + * A {@link AbstractDefaultTestCommand} extension which triggers a search just after a login has been performed with specified parameters. * * @author Christian Ribeaud */ diff --git a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/VocabularyRegistrationTest.java b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/VocabularyRegistrationTest.java index 22f7c6fd628..8ceec7f9ab5 100644 --- a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/VocabularyRegistrationTest.java +++ b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/VocabularyRegistrationTest.java @@ -36,7 +36,7 @@ public class VocabularyRegistrationTest extends AbstractGWTTestCase private static final String DESCRIPTION = "Color"; private static final String[] TERMS = - { "RED:01", "BLACK", "Y.E.L.L.O.W" }; + { "RED:01", "BLACK", "Y.E.L.L.O.W" }; public final void testRegisterVocabulary() { diff --git a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/locator/OpenViewCommand.java b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/locator/OpenViewCommand.java index e2f26b58333..1e852bf628d 100644 --- a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/locator/OpenViewCommand.java +++ b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/locator/OpenViewCommand.java @@ -20,8 +20,8 @@ import ch.systemsx.cisd.openbis.generic.client.web.client.application.Client; import ch.systemsx.cisd.openbis.generic.client.web.client.testframework.AbstractDefaultTestCommand; /** - * {@link AbstractDefaultTestCommand} extension that does nothing. It should be used if we want to - * make sure that all callbacks will finish without failure. + * {@link AbstractDefaultTestCommand} extension that does nothing. It should be used if we want to make sure that all callbacks will finish without + * failure. * * @author Piotr Buczek */ diff --git a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/ui/InvokeActionMenu.java b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/ui/InvokeActionMenu.java index 95587392bd6..236dd53fc99 100644 --- a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/ui/InvokeActionMenu.java +++ b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/ui/InvokeActionMenu.java @@ -22,8 +22,7 @@ import ch.systemsx.cisd.openbis.generic.client.web.client.testframework.Abstract import ch.systemsx.cisd.openbis.generic.client.web.client.testframework.GWTTestUtil; /** - * A {@link AbstractDefaultTestCommand} extension for invoking an action attached to - * {@link ActionMenu} (e.g. opening a tab). + * A {@link AbstractDefaultTestCommand} extension for invoking an action attached to {@link ActionMenu} (e.g. opening a tab). * * @author Izabela Adamczyk * @author Piotr Buczek diff --git a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/ui/amc/CheckAuthorizationGroupTable.java b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/ui/amc/CheckAuthorizationGroupTable.java index 9e473dcabc4..7702869a51a 100644 --- a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/ui/amc/CheckAuthorizationGroupTable.java +++ b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/ui/amc/CheckAuthorizationGroupTable.java @@ -21,8 +21,7 @@ import ch.systemsx.cisd.openbis.generic.client.web.client.testframework.Abstract import ch.systemsx.cisd.openbis.generic.client.web.client.testframework.CheckTableCommand; /** - * A {@link AbstractDefaultTestCommand} extension to check whether a list of authorization groups - * has been loaded. + * A {@link AbstractDefaultTestCommand} extension to check whether a list of authorization groups has been loaded. * * @author Izabela Adamczyk */ diff --git a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/ui/amc/CheckPersonTable.java b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/ui/amc/CheckPersonTable.java index cd09f7f71ab..9e7a35e86a4 100644 --- a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/ui/amc/CheckPersonTable.java +++ b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/ui/amc/CheckPersonTable.java @@ -22,8 +22,7 @@ import ch.systemsx.cisd.openbis.generic.client.web.client.testframework.CheckTab import ch.systemsx.cisd.openbis.generic.shared.basic.dto.AuthorizationGroup; /** - * A {@link AbstractDefaultTestCommand} extension to check whether a list of persons has been - * loaded. + * A {@link AbstractDefaultTestCommand} extension to check whether a list of persons has been loaded. * * @author Piotr Buczek */ diff --git a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/ui/amc/CheckRoleAssignmentTable.java b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/ui/amc/CheckRoleAssignmentTable.java index 5a73404ad21..49cb456eb4c 100644 --- a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/ui/amc/CheckRoleAssignmentTable.java +++ b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/ui/amc/CheckRoleAssignmentTable.java @@ -21,8 +21,7 @@ import ch.systemsx.cisd.openbis.generic.client.web.client.testframework.Abstract import ch.systemsx.cisd.openbis.generic.client.web.client.testframework.CheckTableCommand; /** - * A {@link AbstractDefaultTestCommand} extension to check whether a list of persons has been - * loaded. + * A {@link AbstractDefaultTestCommand} extension to check whether a list of persons has been loaded. * * @author Piotr Buczek */ diff --git a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/ui/amc/OpenAddPersonDialog.java b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/ui/amc/OpenAddPersonDialog.java index cb5a3030075..28e8f940290 100644 --- a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/ui/amc/OpenAddPersonDialog.java +++ b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/ui/amc/OpenAddPersonDialog.java @@ -24,8 +24,7 @@ import ch.systemsx.cisd.openbis.generic.client.web.client.testframework.GWTTestU import ch.systemsx.cisd.openbis.generic.shared.basic.dto.AuthorizationGroup; /** - * A {@link AbstractDefaultTestCommand} extension opening a dialog allowing to add a person to the - * authorization group. + * A {@link AbstractDefaultTestCommand} extension opening a dialog allowing to add a person to the authorization group. * * @author Izabela Adamczyk */ diff --git a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/ui/amc/RemovePerson.java b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/ui/amc/RemovePerson.java index 724ab61ec6a..92488bfba3c 100644 --- a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/ui/amc/RemovePerson.java +++ b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/ui/amc/RemovePerson.java @@ -29,8 +29,7 @@ import ch.systemsx.cisd.openbis.generic.shared.basic.dto.AuthorizationGroup; import ch.systemsx.cisd.openbis.generic.shared.basic.dto.Person; /** - * A {@link AbstractDefaultTestCommand} extension for deleting an authorization group with given - * code. + * A {@link AbstractDefaultTestCommand} extension for deleting an authorization group with given code. * * @author Izabela Adamczyk */ diff --git a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/ui/amc/ShowAuthorizationGroup.java b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/ui/amc/ShowAuthorizationGroup.java index de5ff57f520..107a382ca6b 100644 --- a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/ui/amc/ShowAuthorizationGroup.java +++ b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/ui/amc/ShowAuthorizationGroup.java @@ -28,8 +28,7 @@ import ch.systemsx.cisd.openbis.generic.client.web.client.testframework.GWTTestU import ch.systemsx.cisd.openbis.generic.shared.basic.dto.AuthorizationGroup; /** - * A {@link AbstractDefaultTestCommand} extension for showing an authorization group with given - * code. + * A {@link AbstractDefaultTestCommand} extension for showing an authorization group with given code. * * @author Izabela Adamczyk */ diff --git a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/ui/data/ShowDataSet.java b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/ui/data/ShowDataSet.java index 5d374468faa..57c22145490 100644 --- a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/ui/data/ShowDataSet.java +++ b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/ui/data/ShowDataSet.java @@ -27,9 +27,8 @@ import ch.systemsx.cisd.openbis.generic.client.web.client.testframework.GWTTestU import ch.systemsx.cisd.openbis.generic.shared.basic.dto.AbstractExternalData; /** - * A {@link AbstractDefaultTestCommand} extension for showing detail view of a data set with given - * code. View is displayed because of simulation of a click on show details button in a toolbar of a - * data set search results browser. + * A {@link AbstractDefaultTestCommand} extension for showing detail view of a data set with given code. View is displayed because of simulation of a + * click on show details button in a toolbar of a data set search results browser. * * @author Piotr Buczek */ diff --git a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/ui/data/ShowDataSetEditor.java b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/ui/data/ShowDataSetEditor.java index 0c1686ec68e..8270c4dff77 100644 --- a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/ui/data/ShowDataSetEditor.java +++ b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/ui/data/ShowDataSetEditor.java @@ -27,8 +27,7 @@ import ch.systemsx.cisd.openbis.plugin.generic.client.web.client.application.dat */ /** - * A {@link AbstractDefaultTestCommand} extension for showing edit view of a data set that assuming - * that opening its detail view was triggered before. + * A {@link AbstractDefaultTestCommand} extension for showing edit view of a data set that assuming that opening its detail view was triggered before. * * @author Piotr Buczek */ diff --git a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/ui/experiment/CheckExperimentTable.java b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/ui/experiment/CheckExperimentTable.java index 21c6a9d9c7f..61bc4313570 100644 --- a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/ui/experiment/CheckExperimentTable.java +++ b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/ui/experiment/CheckExperimentTable.java @@ -20,8 +20,7 @@ import ch.systemsx.cisd.openbis.generic.client.web.client.testframework.Abstract import ch.systemsx.cisd.openbis.generic.client.web.client.testframework.CheckTableCommand; /** - * A {@link AbstractDefaultTestCommand} extension to check whether a list of experiments has been - * loaded. + * A {@link AbstractDefaultTestCommand} extension to check whether a list of experiments has been loaded. * * @author Izabela Adamczyk */ diff --git a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/ui/experiment/ShowExperiment.java b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/ui/experiment/ShowExperiment.java index 74f3bf37420..8a1d4aaa458 100644 --- a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/ui/experiment/ShowExperiment.java +++ b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/ui/experiment/ShowExperiment.java @@ -27,8 +27,7 @@ import ch.systemsx.cisd.openbis.generic.client.web.client.testframework.GWTTestU import ch.systemsx.cisd.openbis.generic.shared.basic.dto.Experiment; /** - * A {@link AbstractDefaultTestCommand} extension for showing details view of an experiment with - * given code. + * A {@link AbstractDefaultTestCommand} extension for showing details view of an experiment with given code. * * @author Franz-Josef Elmer */ diff --git a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/ui/grid/expressions/filter/OpenFilterSettingsCommand.java b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/ui/grid/expressions/filter/OpenFilterSettingsCommand.java index 3104346dd9a..d2e910bc96e 100644 --- a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/ui/grid/expressions/filter/OpenFilterSettingsCommand.java +++ b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/ui/grid/expressions/filter/OpenFilterSettingsCommand.java @@ -22,9 +22,8 @@ import ch.systemsx.cisd.openbis.generic.client.web.client.testframework.CheckTab import ch.systemsx.cisd.openbis.generic.client.web.client.testframework.GWTTestUtil; /** - * After the data from table with given id are loaded, the settings dialog is opened and filters tab - * selected. The command activates loading data with callback id: - * <code> FilterGrid.createGridId(gridDisplayId)</code>. + * After the data from table with given id are loaded, the settings dialog is opened and filters tab selected. The command activates loading data with + * callback id: <code> FilterGrid.createGridId(gridDisplayId)</code>. * * @author Izabela Adamczyk */ diff --git a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/ui/material/CheckMaterialTable.java b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/ui/material/CheckMaterialTable.java index dc31ca8d301..66e91cfe6bd 100644 --- a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/ui/material/CheckMaterialTable.java +++ b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/ui/material/CheckMaterialTable.java @@ -20,8 +20,7 @@ import ch.systemsx.cisd.openbis.generic.client.web.client.testframework.Abstract import ch.systemsx.cisd.openbis.generic.client.web.client.testframework.CheckTableCommand; /** - * A {@link AbstractDefaultTestCommand} extension to check whether a list of materials has been - * loaded. + * A {@link AbstractDefaultTestCommand} extension to check whether a list of materials has been loaded. * * @author Izabela Adamczyk */ diff --git a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/ui/project/CheckProjectTable.java b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/ui/project/CheckProjectTable.java index 123c19d685d..648026ec418 100644 --- a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/ui/project/CheckProjectTable.java +++ b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/ui/project/CheckProjectTable.java @@ -20,8 +20,7 @@ import ch.systemsx.cisd.openbis.generic.client.web.client.testframework.Abstract import ch.systemsx.cisd.openbis.generic.client.web.client.testframework.CheckTableCommand; /** - * A {@link AbstractDefaultTestCommand} extension to check whether a list of projects has been - * loaded. + * A {@link AbstractDefaultTestCommand} extension to check whether a list of projects has been loaded. * * @author Izabela Adamczyk */ diff --git a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/ui/project/FillProjectRegistrationForm.java b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/ui/project/FillProjectRegistrationForm.java index f21685a22f3..208ea5d7840 100644 --- a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/ui/project/FillProjectRegistrationForm.java +++ b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/ui/project/FillProjectRegistrationForm.java @@ -25,8 +25,7 @@ import ch.systemsx.cisd.openbis.generic.client.web.client.testframework.Abstract import ch.systemsx.cisd.openbis.generic.client.web.client.testframework.GWTTestUtil; /** - * A {@link AbstractDefaultTestCommand} extension for filling - * {@link AbstractProjectEditRegisterForm}. + * A {@link AbstractDefaultTestCommand} extension for filling {@link AbstractProjectEditRegisterForm}. * * @author Izabela Adamczyk */ diff --git a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/ui/property_type/CheckPropertyTypeAssignmentTable.java b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/ui/property_type/CheckPropertyTypeAssignmentTable.java index e72bf9a396b..b09b061ef76 100644 --- a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/ui/property_type/CheckPropertyTypeAssignmentTable.java +++ b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/ui/property_type/CheckPropertyTypeAssignmentTable.java @@ -20,8 +20,7 @@ import ch.systemsx.cisd.openbis.generic.client.web.client.testframework.Abstract import ch.systemsx.cisd.openbis.generic.client.web.client.testframework.CheckTableCommand; /** - * A {@link AbstractDefaultTestCommand} extension to check whether a list of property type - * assignments has been loaded. + * A {@link AbstractDefaultTestCommand} extension to check whether a list of property type assignments has been loaded. * * @author Izabela Adamczyk */ diff --git a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/ui/property_type/CheckPropertyTypeTable.java b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/ui/property_type/CheckPropertyTypeTable.java index 389c87cac04..7737bb34d89 100644 --- a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/ui/property_type/CheckPropertyTypeTable.java +++ b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/ui/property_type/CheckPropertyTypeTable.java @@ -20,8 +20,7 @@ import ch.systemsx.cisd.openbis.generic.client.web.client.testframework.Abstract import ch.systemsx.cisd.openbis.generic.client.web.client.testframework.CheckTableCommand; /** - * A {@link AbstractDefaultTestCommand} extension to check whether a list of property types has been - * loaded. + * A {@link AbstractDefaultTestCommand} extension to check whether a list of property types has been loaded. * * @author Izabela Adamczyk */ diff --git a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/ui/sample/ExportSamplesTestCommand.java b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/ui/sample/ExportSamplesTestCommand.java index d3b4e6a7d69..64d0f4dcecd 100644 --- a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/ui/sample/ExportSamplesTestCommand.java +++ b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/ui/sample/ExportSamplesTestCommand.java @@ -31,10 +31,10 @@ import ch.systemsx.cisd.openbis.generic.shared.basic.dto.Sample; /** * System tests for the server side of sample export.<BR> - * We wait for the listing operation to complete and then initiate 2 subsequent server calls to get - * the exported table (when preparation is finished it triggers getting the content).<BR> - * It's hard to have complete tests of the client side due to the fact, that the final response is - * received from the servlet and is opened in a new browser window which is hard to access. + * We wait for the listing operation to complete and then initiate 2 subsequent server calls to get the exported table (when preparation is finished + * it triggers getting the content).<BR> + * It's hard to have complete tests of the client side due to the fact, that the final response is received from the servlet and is opened in a new + * browser window which is hard to access. * * @author Tomasz Pylak */ @@ -105,8 +105,8 @@ public class ExportSamplesTestCommand extends AbstractDefaultTestCommand } /** - * A command is executed when export preparation operation and saving the result operation have - * successfully completed. The result is compared with the specified expected content. + * A command is executed when export preparation operation and saving the result operation have successfully completed. The result is compared + * with the specified expected content. */ public ITestCommand createCheckExportCommand(String expectedHeader, String expectedFirstLineOrNull, int expectedTotalLines) diff --git a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/ui/sample/ShowSample.java b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/ui/sample/ShowSample.java index 056405aff1b..29789db15af 100644 --- a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/ui/sample/ShowSample.java +++ b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/ui/sample/ShowSample.java @@ -27,8 +27,7 @@ import ch.systemsx.cisd.openbis.generic.client.web.client.testframework.GWTTestU import ch.systemsx.cisd.openbis.generic.shared.basic.dto.Sample; /** - * A {@link AbstractDefaultTestCommand} extension for showing details view of a sample with given - * code. + * A {@link AbstractDefaultTestCommand} extension for showing details view of a sample with given code. * * @author Franz-Josef Elmer */ diff --git a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/ui/util/GridTestUtils.java b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/ui/util/GridTestUtils.java index 5cfa781126e..f7e6d959716 100644 --- a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/ui/util/GridTestUtils.java +++ b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/ui/util/GridTestUtils.java @@ -49,8 +49,7 @@ public class GridTestUtils } /** - * Fires a double click event on a first row which contains given value in a column with a - * specified id. + * Fires a double click event on a first row which contains given value in a column with a specified id. */ public static <T extends ModelData> void fireDoubleClick(final Grid<T> table, String columnId, String columnValue) @@ -60,8 +59,7 @@ public class GridTestUtils } /** - * Fires a single click event on a first row which contains given value in a column with a - * specified id. + * Fires a single click event on a first row which contains given value in a column with a specified id. */ public static <T extends ModelData> void fireSingleClick(final Grid<T> table, String columnId, String columnValue) @@ -71,8 +69,7 @@ public class GridTestUtils } /** - * Fires a selection of a first row in given table which contains given value in a column with a - * specified id. + * Fires a selection of a first row in given table which contains given value in a column with a specified id. */ public static <T extends ModelData> void fireSelectRow(final Grid<T> table, String columnId, String columnValue) diff --git a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/client/web/client/testframework/AbstractDefaultTestCommand.java b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/client/web/client/testframework/AbstractDefaultTestCommand.java index 83ce5dbb333..95aa9d90462 100644 --- a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/client/web/client/testframework/AbstractDefaultTestCommand.java +++ b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/client/web/client/testframework/AbstractDefaultTestCommand.java @@ -21,8 +21,8 @@ import junit.framework.Assert; import ch.systemsx.cisd.openbis.generic.client.web.client.application.AbstractAsyncCallback; /** - * Abstract super class of all test commands which are executed if there are no active callbacks - * (all callbacks were detected by {@link RemoteConsole}). + * Abstract super class of all test commands which are executed if there are no active callbacks (all callbacks were detected by {@link RemoteConsole} + * ). * * @author Franz-Josef Elmer * @author Piotr Buczek diff --git a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/client/web/client/testframework/AbstractGWTTestCase.java b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/client/web/client/testframework/AbstractGWTTestCase.java index 492d46f0ea8..5d443e942d7 100644 --- a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/client/web/client/testframework/AbstractGWTTestCase.java +++ b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/client/web/client/testframework/AbstractGWTTestCase.java @@ -59,8 +59,8 @@ public abstract class AbstractGWTTestCase extends GWTTestCase } /** - * Delays test termination until the specified timeout (in milliseconds). Wrapper of - * {@link #delayTestFinish(int)}. Will be used in {@link RemoteConsole}. + * Delays test termination until the specified timeout (in milliseconds). Wrapper of {@link #delayTestFinish(int)}. Will be used in + * {@link RemoteConsole}. */ void delayTestTermination(final int timeoutMillis) { @@ -111,8 +111,7 @@ public abstract class AbstractGWTTestCase extends GWTTestCase } /** - * Starts the tests. Sets the timeout after which the test is terminated to - * {@value #DEFAULT_TIMEOUT}. + * Starts the tests. Sets the timeout after which the test is terminated to {@value #DEFAULT_TIMEOUT}. */ protected void launchTest() { @@ -189,8 +188,7 @@ public abstract class AbstractGWTTestCase extends GWTTestCase } /** - * Returns a command that executes specified <var>preprocessingAction</var> before preparing the - * specified <var>command</var>. + * Returns a command that executes specified <var>preprocessingAction</var> before preparing the specified <var>command</var>. */ protected ITestCommand createCommandWrapper(final ITestCommand command, final IDelegatedAction preprocessingAction) diff --git a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/client/web/client/testframework/AbstractProperty.java b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/client/web/client/testframework/AbstractProperty.java index cff00732d79..a969e843599 100644 --- a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/client/web/client/testframework/AbstractProperty.java +++ b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/client/web/client/testframework/AbstractProperty.java @@ -25,8 +25,8 @@ import ch.systemsx.cisd.openbis.generic.shared.basic.dto.EntityProperty; import ch.systemsx.cisd.openbis.generic.shared.basic.dto.IEntityProperty; /** - * Abstract superclass of a generic {@link IProperty} which implements convenient property value - * expectations. It uses a fluent API approach for its methods to prepare expectations. + * Abstract superclass of a generic {@link IProperty} which implements convenient property value expectations. It uses a fluent API approach for its + * methods to prepare expectations. * * @author Franz-Josef Elmer */ @@ -106,8 +106,7 @@ public abstract class AbstractProperty<C extends IPropertyChecker<?>> implements } /** - * Sets assertion that the property value is of type {@link ICodeHolder} with a code equals the - * specified code. + * Sets assertion that the property value is of type {@link ICodeHolder} with a code equals the specified code. */ public C asCode(final String expectedCode) { @@ -122,8 +121,7 @@ public abstract class AbstractProperty<C extends IPropertyChecker<?>> implements } /** - * Sets assertion that the property value is of type {@link IDeletionProvider} with no - * {@link Deletion} object. + * Sets assertion that the property value is of type {@link IDeletionProvider} with no {@link Deletion} object. */ public C asValidEntity() { @@ -139,8 +137,7 @@ public abstract class AbstractProperty<C extends IPropertyChecker<?>> implements } /** - * Sets assertion that the property value is of type {@link IDeletionProvider} with an - * {@link Deletion} object. + * Sets assertion that the property value is of type {@link IDeletionProvider} with an {@link Deletion} object. */ public C asDeletedEntity() { @@ -156,8 +153,7 @@ public abstract class AbstractProperty<C extends IPropertyChecker<?>> implements } /** - * Sets assertion that the property value is of type {@link EntityProperty} with a value equals - * the specified string. + * Sets assertion that the property value is of type {@link EntityProperty} with a value equals the specified string. */ public C asProperty(final String expectedValue) { diff --git a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/client/web/client/testframework/CheckTableCommand.java b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/client/web/client/testframework/CheckTableCommand.java index 0bb7b5547c3..8a7bfbeac05 100644 --- a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/client/web/client/testframework/CheckTableCommand.java +++ b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/client/web/client/testframework/CheckTableCommand.java @@ -29,8 +29,8 @@ import com.extjs.gxt.ui.client.widget.grid.Grid; import ch.systemsx.cisd.openbis.generic.shared.basic.Row; /** - * Command for checking the content (i.e. <code>ListStore</code>) of a table (i.e. <code>Grid</code> - * ). It uses a fluent API approach for its methods to prepare expectations. + * Command for checking the content (i.e. <code>ListStore</code>) of a table (i.e. <code>Grid</code> ). It uses a fluent API approach for its methods + * to prepare expectations. * * @author Franz-Josef Elmer */ @@ -140,8 +140,7 @@ public class CheckTableCommand extends AbstractDefaultTestCommand } /** - * Prepares this with the expectation upon the number of table columns, including hidden - * columns. + * Prepares this with the expectation upon the number of table columns, including hidden columns. */ public CheckTableCommand expectedColumnsNumber(final int expectedNumberOfColumns) { diff --git a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/client/web/client/testframework/GWTTestUtil.java b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/client/web/client/testframework/GWTTestUtil.java index 4d72ff0bc44..3fc5260c96c 100644 --- a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/client/web/client/testframework/GWTTestUtil.java +++ b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/client/web/client/testframework/GWTTestUtil.java @@ -116,8 +116,7 @@ public final class GWTTestUtil } /** - * Simulates click on the {@link CheckBox} with specified id (modifies check box value and fires - * {@link Events#Change} event). + * Simulates click on the {@link CheckBox} with specified id (modifies check box value and fires {@link Events#Change} event). * * @throws AssertionError if not found, isn't a CheckBox or is not enabled. */ @@ -148,8 +147,7 @@ public final class GWTTestUtil } /** - * sets value of a property field with id specified by given {@link PropertyField} (handles both - * simple and comboBox fields) + * sets value of a property field with id specified by given {@link PropertyField} (handles both simple and comboBox fields) */ public final static void setPropertyFieldValue(PropertyField property) { @@ -157,8 +155,8 @@ public final class GWTTestUtil } /** - * sets value of a property field with id specified by given {@link PropertyField} and - * <var>formIdPrefix</var> (handles both simple and comboBox fields) + * sets value of a property field with id specified by given {@link PropertyField} and <var>formIdPrefix</var> (handles both simple and comboBox + * fields) */ public final static void setPropertyFieldValue(String formIdPrefix, PropertyField property) { @@ -383,8 +381,7 @@ public final class GWTTestUtil /** * Tries to find the widget with id that matches given <var>id</var>. * - * @param id a regular expression of an id (usually exactly an id string but it may contain some - * regular expression wildcards inside) + * @param id a regular expression of an id (usually exactly an id string but it may contain some regular expression wildcards inside) * @return <code>null</code> if not found. */ public static Widget tryToFindByID(final String id) @@ -395,8 +392,8 @@ public final class GWTTestUtil } /** - * Traverses root panel tree with the specified widget handler. Traversal is stopped when - * {@link IWidgetHandler#handle(Widget)} returns <code>true</code>. + * Traverses root panel tree with the specified widget handler. Traversal is stopped when {@link IWidgetHandler#handle(Widget)} returns + * <code>true</code>. */ public static void traverseRootPanel(final IWidgetHandler<Widget> handler) { diff --git a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/client/web/client/testframework/IMessageValidator.java b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/client/web/client/testframework/IMessageValidator.java index 178a593c35f..033addcd7a5 100644 --- a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/client/web/client/testframework/IMessageValidator.java +++ b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/client/web/client/testframework/IMessageValidator.java @@ -17,8 +17,6 @@ package ch.systemsx.cisd.openbis.generic.client.web.client.testframework; /** - * - * * @author Franz-Josef Elmer */ public interface IMessageValidator diff --git a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/client/web/client/testframework/IProperty.java b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/client/web/client/testframework/IProperty.java index ff6b1404e79..f8ccfe4b7fa 100644 --- a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/client/web/client/testframework/IProperty.java +++ b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/client/web/client/testframework/IProperty.java @@ -16,11 +16,9 @@ package ch.systemsx.cisd.openbis.generic.client.web.client.testframework; - /** - * Interface of an assertion preparation for a property checked by a - * {@link IPropertyChecker} of type <code>C</code>. - * It uses a fluent API approach for its methods to prepare expectations. + * Interface of an assertion preparation for a property checked by a {@link IPropertyChecker} of type <code>C</code>. It uses a fluent API approach + * for its methods to prepare expectations. * * @author Franz-Josef Elmer */ diff --git a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/client/web/client/testframework/IPropertyChecker.java b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/client/web/client/testframework/IPropertyChecker.java index 0b8f3d806e7..b214dd5d549 100644 --- a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/client/web/client/testframework/IPropertyChecker.java +++ b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/client/web/client/testframework/IPropertyChecker.java @@ -17,8 +17,7 @@ package ch.systemsx.cisd.openbis.generic.client.web.client.testframework; /** - * Interface for preparing expectation on a property checking class. - * It uses a fluent API approach for its methods to prepare expectations. + * Interface for preparing expectation on a property checking class. It uses a fluent API approach for its methods to prepare expectations. * * @author Franz-Josef Elmer */ @@ -28,10 +27,9 @@ public interface IPropertyChecker<C extends IPropertyChecker<?>> * Creates an expectation for the property of specified name. */ public IProperty<C> property(String name); - + /** - * Adds an expectation of a property with specified name and specified - * assertion object which checks the property value. + * Adds an expectation of a property with specified name and specified assertion object which checks the property value. * * @return this checker. */ diff --git a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/client/web/client/testframework/ITestCommand.java b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/client/web/client/testframework/ITestCommand.java index 01c8d0eb3fb..3d2cbabcb85 100644 --- a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/client/web/client/testframework/ITestCommand.java +++ b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/client/web/client/testframework/ITestCommand.java @@ -21,8 +21,7 @@ import com.google.gwt.user.client.rpc.AsyncCallback; import ch.systemsx.cisd.openbis.generic.client.web.client.application.AbstractAsyncCallback; /** - * A command which will be executed after a successful invocation of - * {@link AsyncCallback#onSuccess(Object)}. + * A command which will be executed after a successful invocation of {@link AsyncCallback#onSuccess(Object)}. * * @author Franz-Josef Elmer * @author Piotr Buczek @@ -35,16 +34,14 @@ public interface ITestCommand public void execute(); /** - * @return <tt>true</tt> if the specified result should trigger this command in case of an - * invocation of {@link AsyncCallback#onSuccess(Object)}, otherwise <tt>false</tt> + * @return <tt>true</tt> if the specified result should trigger this command in case of an invocation of {@link AsyncCallback#onSuccess(Object)}, + * otherwise <tt>false</tt> */ public boolean isValidOnSucess(Object result); /** - * @return <tt>true</tt> if the specified <var>failureMessage</var> and <var>throwable</var> - * should trigger this command in case of an invocation of - * {@link AsyncCallback#onFailure(Throwable)} of specified <var>callback</var>, - * otherwise <tt>false</tt> + * @return <tt>true</tt> if the specified <var>failureMessage</var> and <var>throwable</var> should trigger this command in case of an invocation + * of {@link AsyncCallback#onFailure(Throwable)} of specified <var>callback</var>, otherwise <tt>false</tt> */ public boolean isValidOnFailure(AbstractAsyncCallback<?> callback, String failureMessage, Throwable throwable); diff --git a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/client/web/client/testframework/PropertyCheckingManager.java b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/client/web/client/testframework/PropertyCheckingManager.java index 19a8768661b..ed05009ec0c 100644 --- a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/client/web/client/testframework/PropertyCheckingManager.java +++ b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/client/web/client/testframework/PropertyCheckingManager.java @@ -59,7 +59,7 @@ public class PropertyCheckingManager extends Assert * Checks the assertion for the specified properties. */ @SuppressWarnings( - { "unchecked", "rawtypes" }) + { "unchecked", "rawtypes" }) public void assertProperties(final Map<String, ?> actualProperties) { for (final Map.Entry<String, IValueAssertion> expectedProperty : expectedProperties diff --git a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/client/web/client/testframework/RemoteConsole.java b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/client/web/client/testframework/RemoteConsole.java index c11783c7595..41e8553385d 100644 --- a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/client/web/client/testframework/RemoteConsole.java +++ b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/client/web/client/testframework/RemoteConsole.java @@ -29,11 +29,10 @@ import ch.systemsx.cisd.openbis.generic.client.web.client.application.ICallbackL import ch.systemsx.cisd.openbis.generic.client.web.client.application.util.IMessageProvider; /** - * A class which allows to execute a sequence of {@link ITestCommand} instances. The commands are - * executed in the order they have been added by {@link #prepare(ITestCommand)}. In order to be - * executed a command has to be valid for the kind of {@link AsyncCallback} invocation. With the - * method {@link #finish(int)} a timeout will be specified after which the test will be terminated - * independent whether all commands have been executed or not. In the later case the test fails. + * A class which allows to execute a sequence of {@link ITestCommand} instances. The commands are executed in the order they have been added by + * {@link #prepare(ITestCommand)}. In order to be executed a command has to be valid for the kind of {@link AsyncCallback} invocation. With the method + * {@link #finish(int)} a timeout will be specified after which the test will be terminated independent whether all commands have been executed or + * not. In the later case the test fails. * * @author Franz-Josef Elmer * @author Piotr Buczek @@ -69,8 +68,7 @@ public class RemoteConsole } /** - * Prepares the console with the specified command which will be executed if the specified - * condition is fulfilled. + * Prepares the console with the specified command which will be executed if the specified condition is fulfilled. */ public RemoteConsole prepare(final ITestCommand command) { @@ -154,10 +152,8 @@ public class RemoteConsole /** * Does necessary cleanup after the test has completed. * - * @param delayInMillisecondsOrZero The max duration the test was allowed to run. This is only - * used to construct an error message if the duration ran out before the test - * completed. In cases where it is known that the test completed properly, this can - * be set to 0. + * @param delayInMillisecondsOrZero The max duration the test was allowed to run. This is only used to construct an error message if the duration + * ran out before the test completed. In cases where it is known that the test completed properly, this can be set to 0. */ private void cleanupAfterTests(final int delayInMillisecondsOrZero) { diff --git a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/client/web/client/testframework/TestUtil.java b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/client/web/client/testframework/TestUtil.java index a097809b3fc..1d4c471e900 100644 --- a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/client/web/client/testframework/TestUtil.java +++ b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/client/web/client/testframework/TestUtil.java @@ -46,9 +46,8 @@ public class TestUtil } /** - * Returns the specified object as a normalised string. Normalization includes trimming, - * conversion to lower case, stripping off <code><div></code> and <code><a></code> - * wrappers. + * Returns the specified object as a normalised string. Normalization includes trimming, conversion to lower case, stripping off + * <code><div></code> and <code><a></code> wrappers. * * @return {@link #NULL} if <code>objectOrNull == null</code> */ diff --git a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/client/web/client/testframework/WaitForAllActiveCallbacksFinish.java b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/client/web/client/testframework/WaitForAllActiveCallbacksFinish.java index 5547d1f1759..aa284853847 100644 --- a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/client/web/client/testframework/WaitForAllActiveCallbacksFinish.java +++ b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/client/web/client/testframework/WaitForAllActiveCallbacksFinish.java @@ -17,8 +17,8 @@ package ch.systemsx.cisd.openbis.generic.client.web.client.testframework; /** - * {@link AbstractDefaultTestCommand} extension that does nothing. It should be used if we want to - * make sure that all callbacks will finish without failure. + * {@link AbstractDefaultTestCommand} extension that does nothing. It should be used if we want to make sure that all callbacks will finish without + * failure. * * @author Piotr Buczek */ diff --git a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/client/web/client/testframework/WidgetPicker.java b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/client/web/client/testframework/WidgetPicker.java index 3b76f349213..16423e61955 100644 --- a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/client/web/client/testframework/WidgetPicker.java +++ b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/client/web/client/testframework/WidgetPicker.java @@ -19,8 +19,7 @@ package ch.systemsx.cisd.openbis.generic.client.web.client.testframework; import com.google.gwt.user.client.ui.Widget; /** - * Widget handler which picks the first widget having a specified ID. Allows to use regular - * expression wildcards. + * Widget handler which picks the first widget having a specified ID. Allows to use regular expression wildcards. * * @author Franz-Josef Elmer * @author Piotr Buczek @@ -32,8 +31,7 @@ public class WidgetPicker implements IWidgetHandler<Widget> private Widget pickedWidget; /** - * Creates an instance for the specified widget ID. Given <var>id</var> may contain regular - * expression wildcards. + * Creates an instance for the specified widget ID. Given <var>id</var> may contain regular expression wildcards. */ public WidgetPicker(final String id) { diff --git a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/client/web/clientnonjs/HelpPageIdentifierTest.java b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/client/web/clientnonjs/HelpPageIdentifierTest.java index 0e2e57a45bc..bc33aed36e4 100644 --- a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/client/web/clientnonjs/HelpPageIdentifierTest.java +++ b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/client/web/clientnonjs/HelpPageIdentifierTest.java @@ -33,7 +33,7 @@ import ch.systemsx.cisd.openbis.generic.client.web.client.application.help.HelpP * @author Piotr Buczek */ @Friend(toClasses = - { HelpPageIdentifier.class }) +{ HelpPageIdentifier.class }) public class HelpPageIdentifierTest extends AssertJUnit { @@ -43,7 +43,7 @@ public class HelpPageIdentifierTest extends AssertJUnit final HelpPageDomain baseDomain = HelpPageDomain.CHANGE_USER_SETTINGS; assertNull(baseDomain.getSuperDomainOrNull()); assertDomainPathsEquals(new HelpPageDomain[] - { HelpPageDomain.CHANGE_USER_SETTINGS }, baseDomain.getDomainPath()); + { HelpPageDomain.CHANGE_USER_SETTINGS }, baseDomain.getDomainPath()); } @Test @@ -52,7 +52,7 @@ public class HelpPageIdentifierTest extends AssertJUnit final HelpPageDomain subDomain = HelpPageDomain.USERS; assertNotNull(subDomain.getSuperDomainOrNull()); assertDomainPathsEquals(new HelpPageDomain[] - { HelpPageDomain.ADMINISTRATION, HelpPageDomain.AUTHORIZATION, HelpPageDomain.USERS }, + { HelpPageDomain.ADMINISTRATION, HelpPageDomain.AUTHORIZATION, HelpPageDomain.USERS }, subDomain.getDomainPath()); } @@ -73,13 +73,13 @@ public class HelpPageIdentifierTest extends AssertJUnit protected Object[][] getPageTitlesToTest() { return new Object[][] - { - { HelpPageDomain.CHANGE_USER_SETTINGS, HelpPageAction.ACTION, - "HELP__CHANGE_USER_SETTINGS__ACTION" }, - { HelpPageDomain.USERS, HelpPageAction.BROWSE, - "HELP__ADMINISTRATION__AUTHORIZATION__USERS__BROWSE" }, + { + { HelpPageDomain.CHANGE_USER_SETTINGS, HelpPageAction.ACTION, + "HELP__CHANGE_USER_SETTINGS__ACTION" }, + { HelpPageDomain.USERS, HelpPageAction.BROWSE, + "HELP__ADMINISTRATION__AUTHORIZATION__USERS__BROWSE" }, - }; + }; } @SuppressWarnings("deprecation") diff --git a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/client/web/clientnonjs/URLListEncoderTest.java b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/client/web/clientnonjs/URLListEncoderTest.java index 6af1c65b6b3..5f0aed1016f 100644 --- a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/client/web/clientnonjs/URLListEncoderTest.java +++ b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/client/web/clientnonjs/URLListEncoderTest.java @@ -31,15 +31,15 @@ public class URLListEncoderTest extends AssertJUnit protected Object[][] getLists() { return new Object[][] - { + { { new String[] - { "a +:\"\\b", "bobo" } }, + { "a +:\"\\b", "bobo" } }, { new String[] - { "a ,,", ",, b" } }, + { "a ,,", ",, b" } }, { new String[] - { "a,,b ", " ", " c,d,e" } }, + { "a,,b ", " ", " c,d,e" } }, - }; + }; } @Test(dataProvider = "lists") diff --git a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/client/web/clientnonjs/ViewLocatorResolverRegistryTest.java b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/client/web/clientnonjs/ViewLocatorResolverRegistryTest.java index a6113809824..e6197beaec3 100644 --- a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/client/web/clientnonjs/ViewLocatorResolverRegistryTest.java +++ b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/client/web/clientnonjs/ViewLocatorResolverRegistryTest.java @@ -42,10 +42,8 @@ import ch.systemsx.cisd.openbis.generic.shared.basic.dto.EntityKind; import ch.systemsx.cisd.openbis.generic.shared.basic.dto.MaterialIdentifier; /** - * A test of the ViewLocatorHandlerRegistry functionality from the Java side. The JavaScript side is - * tested by - * {@link ch.systemsx.cisd.openbis.generic.client.web.client.application.locator.ViewLocatorResolverRegistryTest} - * . + * A test of the ViewLocatorHandlerRegistry functionality from the Java side. The JavaScript side is tested by + * {@link ch.systemsx.cisd.openbis.generic.client.web.client.application.locator.ViewLocatorResolverRegistryTest} . * * @author Chandrasekhar Ramakrishnan */ diff --git a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/client/web/server/CommonClientServiceTest.java b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/client/web/server/CommonClientServiceTest.java index d2bd0d7d98e..ea55ce95833 100644 --- a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/client/web/server/CommonClientServiceTest.java +++ b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/client/web/server/CommonClientServiceTest.java @@ -520,7 +520,7 @@ public final class CommonClientServiceTest extends AbstractClientServiceTest { prepareGetSessionToken(this); allowing(httpSession).getAttribute(SessionConstants.OPENBIS_RESULT_SET_MANAGER); - will(returnValue(new CachedResultSetManager<String>(tableDataCache, + will(returnValue(new CachedResultSetManager<String>(tableDataCache, new TokenBasedResultSetKeyGenerator(), new ICustomColumnsProvider() { @Override @@ -534,7 +534,7 @@ public final class CommonClientServiceTest extends AbstractClientServiceTest one(commonServer).listExperimentExternalData(SESSION_TOKEN, experimentId, true); will(returnValue(Collections.singletonList(ds))); - + one(commonServer).listDataSetTypes(SESSION_TOKEN); will(returnValue(Arrays.asList(ds.getDataSetType()))); } diff --git a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/client/web/server/WebClientConfigurationProviderTest.java b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/client/web/server/WebClientConfigurationProviderTest.java index 8201dcf642b..4657a6add1f 100644 --- a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/client/web/server/WebClientConfigurationProviderTest.java +++ b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/client/web/server/WebClientConfigurationProviderTest.java @@ -25,8 +25,6 @@ import ch.systemsx.cisd.openbis.generic.shared.WebClientConfigurationProvider; import ch.systemsx.cisd.openbis.generic.shared.basic.dto.WebClientConfiguration; /** - * - * * @author Franz-Josef Elmer */ public class WebClientConfigurationProviderTest extends AssertJUnit @@ -37,21 +35,20 @@ public class WebClientConfigurationProviderTest extends AssertJUnit WebClientConfigurationProvider provider = new WebClientConfigurationProvider(new Properties()); assertEquals(null, provider.getWebClientConfiguration().getPropertyOrNull("hello", "world")); } - + @Test public void testTechnologyProperties() { Properties properties = new Properties(); properties.setProperty(WebClientConfigurationProvider.TECHNOLOGIES, "t1, t2"); - properties.setProperty("t1.a" , "alpha1"); - properties.setProperty("t2.b" , "beta1"); - + properties.setProperty("t1.a", "alpha1"); + properties.setProperty("t2.b", "beta1"); + WebClientConfigurationProvider provider = new WebClientConfigurationProvider(properties); WebClientConfiguration webClientConfiguration = provider.getWebClientConfiguration(); - + assertEquals("alpha1", webClientConfiguration.getPropertyOrNull("t1", "a")); assertEquals(null, provider.getWebClientConfiguration().getPropertyOrNull("t2", "a")); } - - + } diff --git a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/client/web/server/calculator/RowTest.java b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/client/web/server/calculator/RowTest.java index 972ba950711..d7cf8ef687a 100644 --- a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/client/web/server/calculator/RowTest.java +++ b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/client/web/server/calculator/RowTest.java @@ -31,19 +31,18 @@ import org.testng.annotations.Test; */ public class RowTest extends AssertJUnit { - private static final List<Comparable<?>> EXAMPLE_ROW = Arrays.<Comparable<?>>asList("hello", new Double(42.5)); + private static final List<Comparable<?>> EXAMPLE_ROW = Arrays.<Comparable<?>> asList("hello", new Double(42.5)); private static final String COL1 = "col1"; private static final String COL2 = "col2"; - + private static final String PROPERTY_KEY = "key"; private static final String PROPERTY_VALUE = "value"; private static final String PROPERTY_VALUE2 = "value2"; - private Mockery context; private Row row; @@ -56,15 +55,15 @@ public class RowTest extends AssertJUnit context = new Mockery(); dataProvider = context.mock(ITableDataProvider.class); context.checking(new Expectations() - { { - allowing(dataProvider).getValue(COL1, EXAMPLE_ROW); - will(returnValue(EXAMPLE_ROW.get(0))); + { + allowing(dataProvider).getValue(COL1, EXAMPLE_ROW); + will(returnValue(EXAMPLE_ROW.get(0))); - allowing(dataProvider).getValue(COL2, EXAMPLE_ROW); - will(returnValue(EXAMPLE_ROW.get(1))); - } - }); + allowing(dataProvider).getValue(COL2, EXAMPLE_ROW); + will(returnValue(EXAMPLE_ROW.get(1))); + } + }); row = new Row(dataProvider); row.setRowData(EXAMPLE_ROW); @@ -117,7 +116,7 @@ public class RowTest extends AssertJUnit public void testColDefsWithNullArgument() { prepareColDefs(PROPERTY_VALUE, PROPERTY_VALUE2, 0); - + List<ColumnDefinition> defs = row.colDefs(null); assertEquals(2, defs.size()); @@ -198,7 +197,7 @@ public class RowTest extends AssertJUnit public void testColsGroupedByWithOneGroup() { prepareColDefs(PROPERTY_VALUE, PROPERTY_VALUE, 2); - + List<ColumnGroup> groups = row.colsGroupedBy(PROPERTY_KEY); assertEquals(1, groups.size()); @@ -235,7 +234,7 @@ public class RowTest extends AssertJUnit { prepareColDefs(propertyValueOfFirstDefinition, propertyValueOfSecondDefinition, 1); } - + private void prepareColDefs(final String propertyValueOfFirstDefinition, final String propertyValueOfSecondDefinition, final int numberOfTryToGetPropertyInvocations) { @@ -244,10 +243,10 @@ public class RowTest extends AssertJUnit { one(dataProvider).getAllColumnIDs(); will(returnValue(Arrays.asList(COL1, COL2))); - + exactly(numberOfTryToGetPropertyInvocations).of(dataProvider).tryToGetProperty(COL1, PROPERTY_KEY); will(returnValue(propertyValueOfFirstDefinition)); - + exactly(numberOfTryToGetPropertyInvocations).of(dataProvider).tryToGetProperty(COL2, PROPERTY_KEY); will(returnValue(propertyValueOfSecondDefinition)); } diff --git a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/client/web/server/resultset/ScriptProviderTest.java b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/client/web/server/resultset/ScriptProviderTest.java index bed3ca927c5..82018af27cc 100644 --- a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/client/web/server/resultset/ScriptProviderTest.java +++ b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/client/web/server/resultset/ScriptProviderTest.java @@ -85,7 +85,7 @@ public class ScriptProviderTest extends AbstractProviderTest script.setName("my-" + kind + "-script"); script.setDescription("A script for " + kind); script.setEntityKind(kind == null ? null : new EntityKind[] - { kind }); + { kind }); script.setScript("do something with " + kind); script.setScriptType(ScriptType.DYNAMIC_PROPERTY); script.setPluginType(PluginType.JYTHON); diff --git a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/client/web/server/util/FilterUtilsTest.java b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/client/web/server/util/FilterUtilsTest.java index 2b1fe000e4e..88d24e27edf 100644 --- a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/client/web/server/util/FilterUtilsTest.java +++ b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/client/web/server/util/FilterUtilsTest.java @@ -38,6 +38,7 @@ public class FilterUtilsTest extends AssertJUnit private static final class MockDataProvider implements ITableDataProvider { private final String expectedColumnID; + private final List<List<? extends Comparable<?>>> rows; MockDataProvider(String expectedColumnID, List<? extends Comparable<?>>... rows) @@ -71,14 +72,14 @@ public class FilterUtilsTest extends AssertJUnit { return null; } - + @Override public String tryToGetProperty(String columnID, String key) { return null; } } - + private ITableDataProvider dataProvider; @SuppressWarnings("unchecked") diff --git a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/client/web/server/util/TSVRendererTest.java b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/client/web/server/util/TSVRendererTest.java index 70523e18874..d4f2365a143 100644 --- a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/client/web/server/util/TSVRendererTest.java +++ b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/client/web/server/util/TSVRendererTest.java @@ -69,13 +69,13 @@ public class TSVRendererTest extends AssertJUnit will(returnValue(entities)); } }); - + String content = TSVRenderer.createTable(dataProvider, "#"); - + assertEquals("h0\th1#x\ty#a\tb#", content); context.assertIsSatisfied(); } - + @Test public void testRendererNoRows() { @@ -88,9 +88,9 @@ public class TSVRendererTest extends AssertJUnit will(returnValue(entities)); } }); - + String content = TSVRenderer.createTable(dataProvider, "\n"); - + assertEquals("h0\th1\n", content); context.assertIsSatisfied(); } @@ -98,13 +98,13 @@ public class TSVRendererTest extends AssertJUnit private void prepareGetAllColumnTitles(final String... titles) { context.checking(new Expectations() - { { - one(dataProvider).getAllColumnTitles(); - will(returnValue(Arrays.asList(titles))); - } - }); - + { + one(dataProvider).getAllColumnTitles(); + will(returnValue(Arrays.asList(titles))); + } + }); + } } diff --git a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/client/web/server/util/XMLPropertyTransformerTest.java b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/client/web/server/util/XMLPropertyTransformerTest.java index 256df40f251..ed6dc6ffd63 100644 --- a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/client/web/server/util/XMLPropertyTransformerTest.java +++ b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/client/web/server/util/XMLPropertyTransformerTest.java @@ -48,7 +48,7 @@ public class XMLPropertyTransformerTest extends AssertJUnit sample.setProperties(Arrays.<IEntityProperty> asList(p1, p2, p3)); new XMLPropertyTransformer().transformXMLProperties(Arrays.asList(sample)); - + IEntityProperty transformed1 = sample.getProperties().get(0); assertEquals("<?xml version=\"1.0\" encoding=\"UTF-8\"?><b>hello world</b>", transformed1.tryGetAsString()); diff --git a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/server/CommonServerTest.java b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/server/CommonServerTest.java index 33e4662eac8..41d4a2848db 100644 --- a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/server/CommonServerTest.java +++ b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/server/CommonServerTest.java @@ -1729,7 +1729,7 @@ public final class CommonServerTest extends AbstractServerTestCase { one(commonBusinessObjectFactory).createDataSetTable(session); will(returnValue(dataSetTable)); - + one(daoFactory).getTransactionTimestamp(); will(returnValue(new Date())); diff --git a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/server/DataStoreServiceRegistratorTest.java b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/server/DataStoreServiceRegistratorTest.java index 9da6c07c2e6..61d320afc6c 100644 --- a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/server/DataStoreServiceRegistratorTest.java +++ b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/server/DataStoreServiceRegistratorTest.java @@ -108,10 +108,10 @@ public class DataStoreServiceRegistratorTest extends AssertJUnit dataStore.setCode(DATASTORE_CODE); DatastoreServiceDescription r1 = DatastoreServiceDescription.reporting("R1", "r1", new String[] - { "A.*", "B" }, DATASTORE_CODE, ReportingPluginType.TABLE_MODEL); + { "A.*", "B" }, DATASTORE_CODE, ReportingPluginType.TABLE_MODEL); DatastoreServiceDescription p1 = DatastoreServiceDescription.processing("P1", "p1", new String[] - { "A.*", "C.*", "D" }, DATASTORE_CODE); + { "A.*", "C.*", "D" }, DATASTORE_CODE); context.checking(new Expectations() { { @@ -154,10 +154,10 @@ public class DataStoreServiceRegistratorTest extends AssertJUnit dataStore.setCode(DATASTORE_CODE); DatastoreServiceDescription r1 = DatastoreServiceDescription.reporting("R1", "r1", new String[] - { "A.*", "B" }, DATASTORE_CODE, ReportingPluginType.TABLE_MODEL); + { "A.*", "B" }, DATASTORE_CODE, ReportingPluginType.TABLE_MODEL); DatastoreServiceDescription p1 = DatastoreServiceDescription.processing("P1", "p1", new String[] - { "A.*", "C.*", "D" }, DATASTORE_CODE); + { "A.*", "C.*", "D" }, DATASTORE_CODE); context.checking(new Expectations() { { diff --git a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/server/DatabaseLastModificationAdvisorTest.java b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/server/DatabaseLastModificationAdvisorTest.java index e20fff2e824..90a151996ce 100644 --- a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/server/DatabaseLastModificationAdvisorTest.java +++ b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/server/DatabaseLastModificationAdvisorTest.java @@ -107,13 +107,13 @@ public class DatabaseLastModificationAdvisorTest extends AssertJUnit private Method getCreateMethod() throws Exception { return ICommonServer.class.getMethod("registerDataSetType", new Class[] - { String.class, DataSetType.class }); + { String.class, DataSetType.class }); } private Method getUpdateMethod() throws Exception { return ICommonServer.class.getMethod("updateDataSet", new Class[] - { String.class, DataSetUpdatesDTO.class }); + { String.class, DataSetUpdatesDTO.class }); } private void waitForClockChange() diff --git a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/server/ETLServiceDatabaseTest.java b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/server/ETLServiceDatabaseTest.java index bac6f852838..216efad596b 100644 --- a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/server/ETLServiceDatabaseTest.java +++ b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/server/ETLServiceDatabaseTest.java @@ -285,7 +285,7 @@ public class ETLServiceDatabaseTest extends AbstractDAOTest for (AbstractExternalData dataSetWithNewValue : dataSetsWithNewValue) { Date modificationDate = dataSetWithNewValue.getModificationDate(); - assertTrue("The modification date (" + modificationDate + ") should be current (" + now + ")", + assertTrue("The modification date (" + modificationDate + ") should be current (" + now + ")", modificationDate.compareTo(now) >= 0); String savedComment = EntityHelper.tryFindPropertyValue(dataSetWithNewValue, "COMMENT"); diff --git a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/server/JythonEvaluatorPoolTest.java b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/server/JythonEvaluatorPoolTest.java index 9f74240f4a2..1bf0a4fbbf0 100644 --- a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/server/JythonEvaluatorPoolTest.java +++ b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/server/JythonEvaluatorPoolTest.java @@ -213,13 +213,13 @@ public class JythonEvaluatorPoolTest { return pool.getManagedPropertiesRunner(script).evaluate( new IAtomicEvaluation<IJythonEvaluator>() - { - @Override - public IJythonEvaluator evaluate(IJythonEvaluator evaluator) - { - return evaluator; - } - }); + { + @Override + public IJythonEvaluator evaluate(IJythonEvaluator evaluator) + { + return evaluator; + } + }); } }; } @@ -235,17 +235,17 @@ public class JythonEvaluatorPoolTest { return pool.getManagedPropertiesRunner(script).evaluate( new IAtomicEvaluation<Integer>() - { - @Override - public Integer evaluate(IJythonEvaluator evaluator) - { - Integer x = - (Integer) evaluator - .evalFunction("return_x_if_defined_else_0"); - evaluator.evalFunction("set_x", 3); - return x; - } - }); + { + @Override + public Integer evaluate(IJythonEvaluator evaluator) + { + Integer x = + (Integer) evaluator + .evalFunction("return_x_if_defined_else_0"); + evaluator.evalFunction("set_x", 3); + return x; + } + }); } }; } diff --git a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/server/ServerInterfaceRegressionTest.java b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/server/ServerInterfaceRegressionTest.java index f9b18bbae72..53424e5cf4e 100644 --- a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/server/ServerInterfaceRegressionTest.java +++ b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/server/ServerInterfaceRegressionTest.java @@ -37,7 +37,7 @@ public class ServerInterfaceRegressionTest extends AnnotationAppliedTestCase { List<String> exemptMethods = new ArrayList<String>(); exemptMethods.add("getDisabledText"); - + assertMandatoryMethodAnnotations(ICommonServer.class, CommonServer.class, "getLastModificationState: Transactional\n", exemptMethods); } diff --git a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/server/authorization/DefaultAccessControllerTest.java b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/server/authorization/DefaultAccessControllerTest.java index 6d8b4b13c5d..e4d24abc7a8 100644 --- a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/server/authorization/DefaultAccessControllerTest.java +++ b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/server/authorization/DefaultAccessControllerTest.java @@ -90,7 +90,7 @@ public final class DefaultAccessControllerTest try { FileUtils.writeLines(capFile, - Arrays.asList("# Test overriding annotation", + Arrays.asList("# Test overriding annotation", "MY_CAP: SPACE_OBSERVER; ARG1 = SPACE_USER", "my_cap2: arg1 = space_user")); } catch (IOException ex) @@ -114,7 +114,7 @@ public final class DefaultAccessControllerTest { allowing(daoFactory).getProjectDAO(); will(returnValue(projectDAO)); - + allowing(projectDAO).tryGetByPermID("42"); will(returnValue(project)); } @@ -272,7 +272,7 @@ public final class DefaultAccessControllerTest { final IAuthSession session = AuthorizationTestUtil.createSession(); session.tryGetPerson().setRoleAssignments(createRoleAssignments()); - final Method method = MyInterface.class.getMethod("myMethodWithGardedArgument", + final Method method = MyInterface.class.getMethod("myMethodWithGardedArgument", String.class, String.class, String.class); assertNotNull(method); Argument<?>[] arguments = createArguments(method); @@ -290,19 +290,19 @@ public final class DefaultAccessControllerTest { final IAuthSession session = AuthorizationTestUtil.createSession(); session.tryGetPerson().setRoleAssignments(createRoleAssignments()); - final Method method = MyInterface.class.getMethod("myMethodWithGardedArgument", + final Method method = MyInterface.class.getMethod("myMethodWithGardedArgument", String.class, String.class, String.class); assertNotNull(method); Argument<?>[] arguments = createArguments(method); project.setId(1L); - + final Status authorized = accessController.isAuthorized(session, method, arguments); - + assertEquals("ERROR", authorized.toString()); assertEquals("person: john_doe, roles: [INSTANCE_OBSERVER, SPACE_USER], value: arg0", project.getDescription()); context.assertIsSatisfied(); } - + @Test public void testIsNotAuthorizedWithGardedArgumentWithDifferentRoles() throws Exception { @@ -320,7 +320,7 @@ public final class DefaultAccessControllerTest assertEquals(null, project.getDescription()); context.assertIsSatisfied(); } - + @Test public void testIsAuthorizedWithGardedArgumentWithRolesOverridden() throws Exception { @@ -330,9 +330,9 @@ public final class DefaultAccessControllerTest String.class, String.class); assertNotNull(method); Argument<?>[] arguments = createArguments(method); - + final Status authorized = accessController.isAuthorized(session, method, arguments); - + assertEquals("OK", authorized.toString()); assertEquals("person: john_doe, roles: [SPACE_USER], value: arg0", project.getDescription()); context.assertIsSatisfied(); @@ -347,14 +347,14 @@ public final class DefaultAccessControllerTest String.class, String.class); assertNotNull(method); Argument<?>[] arguments = createArguments(method); - + final Status authorized = accessController.isAuthorized(session, method, arguments); - + assertEquals("OK", authorized.toString()); assertEquals("person: john_doe, roles: [SPACE_USER], value: arg0", project.getDescription()); context.assertIsSatisfied(); } - + @Test public void testIsAuthorizedWithGardedArgumentWithRolesOverridden3() throws Exception { @@ -364,15 +364,15 @@ public final class DefaultAccessControllerTest String.class, String.class, String.class); assertNotNull(method); Argument<?>[] arguments = createArguments(method); - + final Status authorized = accessController.isAuthorized(session, method, arguments); - + assertEquals("ERROR: \"None of method roles '[SPACE_POWER_USER, SPACE_ADMIN, INSTANCE_ADMIN]' " + "could be found in roles of user 'John Doe'.\"", authorized.toString()); assertEquals(null, project.getDescription()); context.assertIsSatisfied(); } - + private Argument<?>[] createArguments(final Method method) { List<Argument<?>> arguments = new ArrayList<>(); @@ -414,38 +414,33 @@ public final class DefaultAccessControllerTest public void myMethodWithUngardedArgument(String sessionToken, String argument1); @RolesAllowed(RoleWithHierarchy.SPACE_OBSERVER) - public void myMethodWithGardedArgument(String sessionToken, + public void myMethodWithGardedArgument(String sessionToken, @AuthorizationGuard(guardClass = MockPredicate.class) String argument1, @AuthorizationGuard(guardClass = MockPredicate.class) String argument2); @RolesAllowed(RoleWithHierarchy.SPACE_OBSERVER) public void myMethodWithGardedArgumentWithDifferentRoles(String sessionToken, @AuthorizationGuard(guardClass = MockPredicate.class, - rolesAllowed = { RoleWithHierarchy.SPACE_ETL_SERVER }) - String argument1); - + rolesAllowed = { RoleWithHierarchy.SPACE_ETL_SERVER }) String argument1); + @RolesAllowed(RoleWithHierarchy.SPACE_OBSERVER) @Capability("MY_CAP") public void myMethodWithGardedArgumentWithRolesOverridden(String sessionToken, @AuthorizationGuard(name = "ARG1", guardClass = MockPredicate.class, - rolesAllowed = { RoleWithHierarchy.SPACE_ETL_SERVER }) - String argument1); + rolesAllowed = { RoleWithHierarchy.SPACE_ETL_SERVER }) String argument1); @RolesAllowed(RoleWithHierarchy.SPACE_OBSERVER) @Capability("MY_CAP2") public void myMethodWithGardedArgumentWithRolesOverridden2(String sessionToken, @AuthorizationGuard(name = "ARG1", guardClass = MockPredicate.class, - rolesAllowed = { RoleWithHierarchy.SPACE_ETL_SERVER }) - String argument1); + rolesAllowed = { RoleWithHierarchy.SPACE_ETL_SERVER }) String argument1); @RolesAllowed(RoleWithHierarchy.SPACE_OBSERVER) public void myMethodWithGardedArgumentWithRolesOverridden3(String sessionToken, @AuthorizationGuard(name = "ARG1", guardClass = MockPredicate.class, - rolesAllowed = { RoleWithHierarchy.SPACE_POWER_USER }) - String argument1, + rolesAllowed = { RoleWithHierarchy.SPACE_POWER_USER }) String argument1, @AuthorizationGuard(name = "ARG2", guardClass = MockPredicate.class, - rolesAllowed = { RoleWithHierarchy.SPACE_USER }) - String argument2); + rolesAllowed = { RoleWithHierarchy.SPACE_USER }) String argument2); } /** @@ -464,7 +459,7 @@ public final class DefaultAccessControllerTest roles.add(roleWithIdentifier.getRole()); } Collections.sort(roles); - + String description = "person: " + person.getUserId() + ", roles: " + roles + ", value: " + valueOrNull; if (project.getDescription() != null) { diff --git a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/server/authorization/predicate/CollectionPredicateTest.java b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/server/authorization/predicate/CollectionPredicateTest.java index dbe50eaddb0..e80f23ad8a2 100644 --- a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/server/authorization/predicate/CollectionPredicateTest.java +++ b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/server/authorization/predicate/CollectionPredicateTest.java @@ -32,8 +32,6 @@ import ch.systemsx.cisd.openbis.generic.server.authorization.predicate.IPredicat import ch.systemsx.cisd.openbis.generic.shared.dto.PersonPE; /** - * - * * @author Franz-Josef Elmer */ public class CollectionPredicateTest extends AuthorizationTestCase @@ -60,14 +58,14 @@ public class CollectionPredicateTest extends AuthorizationTestCase { CollectionPredicate<String> arrayPredicate = new CollectionPredicate<String>(predicate); arrayPredicate.init(provider); - + List<String> emptyList = Collections.<String> emptyList(); Status status = arrayPredicate.evaluate(createPerson(), createRoles(true), emptyList); - + assertEquals(false, status.isError()); context.assertIsSatisfied(); } - + @Test public void testWithTwoElements() { @@ -85,13 +83,13 @@ public class CollectionPredicateTest extends AuthorizationTestCase will(returnValue(Status.OK)); } }); - + Status status = arrayPredicate.evaluate(person, roles, Arrays.asList("a", "b")); - + assertEquals(false, status.isError()); context.assertIsSatisfied(); } - + @Test public void testWithTwoElementsOneFailing() { @@ -109,9 +107,9 @@ public class CollectionPredicateTest extends AuthorizationTestCase will(returnValue(Status.createError())); } }); - + Status status = arrayPredicate.evaluate(person, roles, Arrays.asList("a", "b")); - + assertEquals(true, status.isError()); context.assertIsSatisfied(); } diff --git a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/server/authorization/validator/ExternalDataValidatorTest.java b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/server/authorization/validator/ExternalDataValidatorTest.java index 671579db982..a6ba1920aba 100644 --- a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/server/authorization/validator/ExternalDataValidatorTest.java +++ b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/server/authorization/validator/ExternalDataValidatorTest.java @@ -39,7 +39,7 @@ public class ExternalDataValidatorTest extends AuthorizationTestCase "http://someURL", null, new ManagedPropertyEvaluatorFactory(null, new TestJythonEvaluatorPool()))); return data; } - + private PhysicalDataSet createDataForSample(SpacePE space) { PhysicalDataSet data = new PhysicalDataSet(); @@ -63,7 +63,7 @@ public class ExternalDataValidatorTest extends AuthorizationTestCase PersonPE person = createPersonWithRoleAssignments(); assertEquals(true, validator.isValid(person, createDataForSample(createAnotherSpace()))); } - + @Test public void testIsValidWithDataInTheRightDatabaseInstance() { diff --git a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/server/authorization/validator/GroupValidatorTest.java b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/server/authorization/validator/GroupValidatorTest.java index 9094c157d8d..d04561f8db5 100644 --- a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/server/authorization/validator/GroupValidatorTest.java +++ b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/server/authorization/validator/GroupValidatorTest.java @@ -16,7 +16,6 @@ package ch.systemsx.cisd.openbis.generic.server.authorization.validator; - import org.testng.annotations.Test; import ch.systemsx.cisd.openbis.generic.server.authorization.AuthorizationTestCase; @@ -44,7 +43,7 @@ public final class GroupValidatorTest extends AuthorizationTestCase { assertEquals("Unspecified person", e.getMessage()); } - + context.assertIsSatisfied(); } @@ -55,7 +54,7 @@ public final class GroupValidatorTest extends AuthorizationTestCase final PersonPE personPE = createPerson(); final SpacePE groupPE = createSpace(); final Space space = SpaceTranslator.translate(groupPE); - + assertFalse(groupValidator.isValid(personPE, space)); context.assertIsSatisfied(); @@ -71,7 +70,7 @@ public final class GroupValidatorTest extends AuthorizationTestCase assertTrue(groupValidator.isValid(personPE, space)); context.assertIsSatisfied(); } - + @Test public final void testIsValidWithMatchingRoleAssignmentOnDatabaseinstanceLevel() { @@ -82,5 +81,5 @@ public final class GroupValidatorTest extends AuthorizationTestCase assertTrue(groupValidator.isValid(personPE, space)); context.assertIsSatisfied(); } - + } diff --git a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/server/business/PropertiesBatchEvaluationErrorsTest.java b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/server/business/PropertiesBatchEvaluationErrorsTest.java index 0a8b061937c..edefe6c7362 100644 --- a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/server/business/PropertiesBatchEvaluationErrorsTest.java +++ b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/server/business/PropertiesBatchEvaluationErrorsTest.java @@ -45,7 +45,6 @@ public class PropertiesBatchEvaluationErrorsTest extends AssertJUnit private ScriptPE script; - @BeforeMethod public void setUp() { diff --git a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/server/business/bo/DataBOTest.java b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/server/business/bo/DataBOTest.java index e2fb8a95ede..70ea85e901a 100644 --- a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/server/business/bo/DataBOTest.java +++ b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/server/business/bo/DataBOTest.java @@ -472,12 +472,12 @@ public class DataBOTest extends AbstractBOTest { assertEquals("Unknown data set code '" + COMPONENT_CODE + "'", e.getMessage()); } - DataPE data = dataBO.getData(); - - assertSame(experiment, data.getExperiment()); - assertEquals(null, data.tryGetSample()); - assertSame(true, data.isMeasured()); - assertSame(dataStore, data.getDataStore()); + DataPE data = dataBO.getData(); + + assertSame(experiment, data.getExperiment()); + assertEquals(null, data.tryGetSample()); + assertSame(true, data.isMeasured()); + assertSame(dataStore, data.getDataStore()); context.assertIsSatisfied(); } diff --git a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/server/business/bo/ExperimentBOTest.java b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/server/business/bo/ExperimentBOTest.java index e83c9101c8b..fa6731952df 100644 --- a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/server/business/bo/ExperimentBOTest.java +++ b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/server/business/bo/ExperimentBOTest.java @@ -229,8 +229,7 @@ public final class ExperimentBOTest extends AbstractBOTest final ProjectPE project = createProject(groupCode, projectCode); final ExperimentTypePE type = createExperimentType(expTypeCode); final ExperimentPE experiment = createExperiment(project, expCode, type); - TimeIntervalChecker timeIntervalChecker - = new TimeIntervalChecker(daoFactory.getTransactionTimestamp()); + TimeIntervalChecker timeIntervalChecker = new TimeIntervalChecker(daoFactory.getTransactionTimestamp()); prepareAnyDaoCreation(); context.checking(new Expectations() diff --git a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/server/business/bo/PropertyValidatorTest.java b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/server/business/bo/PropertyValidatorTest.java index c556f96dd63..111c513b96f 100644 --- a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/server/business/bo/PropertyValidatorTest.java +++ b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/server/business/bo/PropertyValidatorTest.java @@ -108,35 +108,35 @@ public final class PropertyValidatorTest extends AbstractBOTest private final static Object[][] getNonWorkingValues() { return new Object[][] - { - { createTimestampPropertyType(), DateFormatUtils.format(new Date(), "yyyy") }, - { createIntegerPropertyType(), "a" }, - { createIntegerPropertyType(), "1.1" }, - { createRealPropertyType(), "b" }, - { createBooleanPropertyType(), "BOB" }, }; + { + { createTimestampPropertyType(), DateFormatUtils.format(new Date(), "yyyy") }, + { createIntegerPropertyType(), "a" }, + { createIntegerPropertyType(), "1.1" }, + { createRealPropertyType(), "b" }, + { createBooleanPropertyType(), "BOB" }, }; } @DataProvider private final static Object[][] getWorkingValues() { return new Object[][] - { - { createVarcharPropertyType(), "" }, - { createVarcharPropertyType(), "varchar" }, - { - createTimestampPropertyType(), - DateFormatUtils.format(new Date(), - SupportedDatePattern.CANONICAL_DATE_PATTERN.getPattern()) }, - { - createTimestampPropertyType(), - DateFormatUtils.format(new Date(), - SupportedDatePattern.US_DATE_TIME_24_PATTERN.getPattern()) }, - { createIntegerPropertyType(), "1" }, - { createRealPropertyType(), "1" }, - { createRealPropertyType(), "1.1" }, - { createBooleanPropertyType(), "yes" }, - { createBooleanPropertyType(), "1" }, - { createBooleanPropertyType(), "true" } }; + { + { createVarcharPropertyType(), "" }, + { createVarcharPropertyType(), "varchar" }, + { + createTimestampPropertyType(), + DateFormatUtils.format(new Date(), + SupportedDatePattern.CANONICAL_DATE_PATTERN.getPattern()) }, + { + createTimestampPropertyType(), + DateFormatUtils.format(new Date(), + SupportedDatePattern.US_DATE_TIME_24_PATTERN.getPattern()) }, + { createIntegerPropertyType(), "1" }, + { createRealPropertyType(), "1" }, + { createRealPropertyType(), "1.1" }, + { createBooleanPropertyType(), "yes" }, + { createBooleanPropertyType(), "1" }, + { createBooleanPropertyType(), "true" } }; } @Test diff --git a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/server/business/bo/SampleBOTest.java b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/server/business/bo/SampleBOTest.java index f8e6d4aa923..4c640c4560e 100644 --- a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/server/business/bo/SampleBOTest.java +++ b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/server/business/bo/SampleBOTest.java @@ -432,7 +432,6 @@ public final class SampleBOTest extends AbstractBOTest allowing(dataDAO).hasDataSet(with(sample)); will(returnValue(false)); - one(relationshipService).shareSample(with(any(IAuthSession.class)), with(any(SamplePE.class))); } diff --git a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/server/business/bo/SearchDomainSearcherTest.java b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/server/business/bo/SearchDomainSearcherTest.java index 6e80885bc51..c101a2f0856 100644 --- a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/server/business/bo/SearchDomainSearcherTest.java +++ b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/server/business/bo/SearchDomainSearcherTest.java @@ -143,27 +143,27 @@ public class SearchDomainSearcherTest extends AbstractBOTest assertEquals("E1", results.get(0).getEntity().getPermId()); assertEquals("Search Domain: test-db, Score: [Score: 11.5, bit score: 5.75, evalue: 12.5], Result location: " + "[Experiment type: UNKNOWN-E, perm id: E1, code: CODE-E1, property type: S, alignment in sequence: [42-45], " - + "alignment in query: [7-10], number of mismatches: 0, total number of gaps: 0]", + + "alignment in query: [7-10], number of mismatches: 0, total number of gaps: 0]", results.get(0).getSearchResult().toString()); assertEquals("S2", results.get(1).getEntity().getPermId()); assertEquals("Search Domain: test-db, Score: [Score: 10.5, bit score: 5.25, evalue: 11.5], Result location: " + "[Sample type: TYPE, perm id: S2, code: CODE-S2, property type: OLIGO, alignment in sequence: [42-45], " - + "alignment in query: [7-10], number of mismatches: 0, total number of gaps: 0]", + + "alignment in query: [7-10], number of mismatches: 0, total number of gaps: 0]", results.get(1).getSearchResult().toString()); assertEquals("S1", results.get(2).getEntity().getPermId()); assertEquals("Search Domain: test-db, Score: [Score: 9.5, bit score: 4.75, evalue: 10.5], Result location: " + "[Sample type: TYPE, perm id: S1, code: CODE-S1, property type: OLIGO, alignment in sequence: [42-45], " - + "alignment in query: [7-10], number of mismatches: 0, total number of gaps: 0]", + + "alignment in query: [7-10], number of mismatches: 0, total number of gaps: 0]", results.get(2).getSearchResult().toString()); assertEquals("DS1", results.get(3).getEntity().getPermId()); assertEquals("Search Domain: test-db, Score: [Score: 0.5, bit score: 0.25, evalue: 1.5], Result location: " + "[Data set type: UNKNOWN, perm id: DS1, code: DS1, property type: SEQ, alignment in sequence: [42-45], " - + "alignment in query: [7-10], number of mismatches: 0, total number of gaps: 0]", + + "alignment in query: [7-10], number of mismatches: 0, total number of gaps: 0]", results.get(3).getSearchResult().toString()); assertEquals(4, results.size()); context.assertIsSatisfied(); } - + @Test public void testSearchForDataSetsWithSequences() { @@ -259,7 +259,7 @@ public class SearchDomainSearcherTest extends AbstractBOTest } }); } - + private void prepareSearchForEntityPropertiesWithSequences(final DataStorePE dataStore, final IDataStoreService service, final double initialScore, final String... foundLocations) { @@ -355,7 +355,7 @@ public class SearchDomainSearcherTest extends AbstractBOTest data.setFileFormatType(fileFormatType); return data; } - + private SamplePE createSample(String permID) { SamplePE sample = new SamplePE(); @@ -372,7 +372,7 @@ public class SearchDomainSearcherTest extends AbstractBOTest sample.setSampleType(sampleType); return sample; } - + private ExperimentPE createExperiment(String permID) { ExperimentPE experiment = new ExperimentPE(); @@ -402,7 +402,7 @@ public class SearchDomainSearcherTest extends AbstractBOTest } return permIds; } - + private ISearchDomainResultScore createScore(double score) { BlastScore blastScore = new BlastScore(); diff --git a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/server/business/bo/TrashBOTest.java b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/server/business/bo/TrashBOTest.java index 1f45068e04f..9b731df54ff 100644 --- a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/server/business/bo/TrashBOTest.java +++ b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/server/business/bo/TrashBOTest.java @@ -74,6 +74,7 @@ public final class TrashBOTest extends AbstractBOTest private static String EXAMPLE_REASON = "example reason"; private static Long COMPONENT_CONTAINER_RELATIONSHIP_ID = 1001L; + private static Long CHILDREN_PARENT_RELATIONSHIP_ID = 1002L; private static TechId EXAMPLE_ID = new TechId(1L); @@ -117,10 +118,10 @@ public final class TrashBOTest extends AbstractBOTest type = new RelationshipTypePE(); type.setId(CHILDREN_PARENT_RELATIONSHIP_ID); will(returnValue(type)); - + allowing(boFactory).createSampleLister(session); will(returnValue(sampleLister)); - + allowing(boFactory).createDatasetLister(session); will(returnValue(datasetLister)); } @@ -238,7 +239,7 @@ public final class TrashBOTest extends AbstractBOTest context.assertIsSatisfied(); } - + private void prepareEntityGraph(EntityGraphGenerator g) { g.assertConsistency(); @@ -297,7 +298,7 @@ public final class TrashBOTest extends AbstractBOTest } }); } - + private void prepareListDataSetIdsByExperimentIds(final EntityGraphGenerator g) { final AbstractMockHandler<List<TechId>> handler = new AbstractMockHandler<List<TechId>>() @@ -318,7 +319,7 @@ public final class TrashBOTest extends AbstractBOTest } }); } - + private void prepareListDataSetIdsBySampleIds(final EntityGraphGenerator g) { final AbstractMockHandler<Collection<TechId>> handler = new AbstractMockHandler<Collection<TechId>>() @@ -339,29 +340,29 @@ public final class TrashBOTest extends AbstractBOTest } }); } - + private void prepareGetByTechId(final EntityGraphGenerator g) { final AbstractMockHandler<TechId> handler = new AbstractMockHandler<TechId>() + { + @Override + public Object invoke(Invocation invocation) throws Throwable { - @Override - public Object invoke(Invocation invocation) throws Throwable + DataSetNode dataSetNode = g.getDataSets().get(argument.getId()); + ExternalDataPE dataSet = Utils.createData(dataSetNode); + print("getByTechId(" + argument + ") = " + dataSet); + return dataSet; + } + }; + context.checking(new Expectations() { - DataSetNode dataSetNode = g.getDataSets().get(argument.getId()); - ExternalDataPE dataSet = Utils.createData(dataSetNode); - print("getByTechId(" + argument + ") = " + dataSet); - return dataSet; - } - }; - context.checking(new Expectations() { - { - allowing(dataDAO).getByTechId(with(handler)); - will(handler); - } - }); + allowing(dataDAO).getByTechId(with(handler)); + will(handler); + } + }); } - + private void prepareFindChildrenOrComponentIds(final EntityGraphGenerator g) { class FindChildrenIdsMockHandler @@ -478,84 +479,84 @@ public final class TrashBOTest extends AbstractBOTest } }); } - + private void prepareListExperimentsByIds(final EntityGraphGenerator g) { final AbstractMockHandler<Collection<Long>> handler = new AbstractMockHandler<Collection<Long>>() - { - @Override - public Object invoke(Invocation invocation) throws Throwable { - List<ExperimentPE> experiments = new ArrayList<ExperimentPE>(); - Map<Long, ExperimentNode> experimentNodes = g.getExperiments(); - for (Long id : argument) - { - ExperimentNode experimentNode = experimentNodes.get(id); - experiments.add(Utils.createExperimentPE(experimentNode)); - } - print("listByExperimentIds(" + argument + ") = " + experiments); - return experiments; - } - }; - context.checking(new Expectations() + @Override + public Object invoke(Invocation invocation) throws Throwable { + List<ExperimentPE> experiments = new ArrayList<ExperimentPE>(); + Map<Long, ExperimentNode> experimentNodes = g.getExperiments(); + for (Long id : argument) { - allowing(experimentDAO).listByIDs(with(handler)); - will(handler); + ExperimentNode experimentNode = experimentNodes.get(id); + experiments.add(Utils.createExperimentPE(experimentNode)); } - }); + print("listByExperimentIds(" + argument + ") = " + experiments); + return experiments; + } + }; + context.checking(new Expectations() + { + { + allowing(experimentDAO).listByIDs(with(handler)); + will(handler); + } + }); } - + private void prepareListByDataSetIds(final EntityGraphGenerator g) { final AbstractMockHandler<Collection<Long>> handler = new AbstractMockHandler<Collection<Long>>() - { - @Override - public Object invoke(Invocation invocation) throws Throwable { - List<AbstractExternalData> dataSets = new ArrayList<AbstractExternalData>(); - Map<Long, DataSetNode> dataSetNodes = g.getDataSets(); - for (Long id : argument) - { - DataSetNode dataSetNode = dataSetNodes.get(id); - dataSets.add(Utils.createExternalData(dataSetNode)); - } - print("listByDataSetIds(" + argument + ") = " + dataSets); - return dataSets; - } - }; - context.checking(new Expectations() + @Override + public Object invoke(Invocation invocation) throws Throwable { + List<AbstractExternalData> dataSets = new ArrayList<AbstractExternalData>(); + Map<Long, DataSetNode> dataSetNodes = g.getDataSets(); + for (Long id : argument) { - allowing(datasetLister).listByDatasetIds(with(handler), with(TrashBO.DATA_SET_FETCH_OPTIONS)); - will(handler); + DataSetNode dataSetNode = dataSetNodes.get(id); + dataSets.add(Utils.createExternalData(dataSetNode)); } - }); + print("listByDataSetIds(" + argument + ") = " + dataSets); + return dataSets; + } + }; + context.checking(new Expectations() + { + { + allowing(datasetLister).listByDatasetIds(with(handler), with(TrashBO.DATA_SET_FETCH_OPTIONS)); + will(handler); + } + }); } private void prepareListDataSetContainerIds(final EntityGraphGenerator g) { final AbstractMockHandler<Collection<Long>> handler = new AbstractMockHandler<Collection<Long>>() + { + @Override + public Object invoke(Invocation invocation) throws Throwable { - @Override - public Object invoke(Invocation invocation) throws Throwable + Map<Long, Set<Long>> idsMap = g.getContainerDataSetIdsMap( + TechId.createList(new ArrayList<Long>(argument))); + print("listContainerIds(" + argument + ") = " + idsMap); + return idsMap; + } + }; + context.checking(new Expectations() { - Map<Long, Set<Long>> idsMap = g.getContainerDataSetIdsMap( - TechId.createList(new ArrayList<Long>(argument))); - print("listContainerIds(" + argument + ") = " + idsMap); - return idsMap; - } - }; - context.checking(new Expectations() { - { - allowing(datasetLister).listContainerIds(with(handler)); - will(handler); - } - }); + allowing(datasetLister).listContainerIds(with(handler)); + will(handler); + } + }); } - + private void prepareListDataSetComponentIds(final EntityGraphGenerator g) { final AbstractMockHandler<Collection<Long>> handler = new AbstractMockHandler<Collection<Long>>() @@ -577,12 +578,13 @@ public final class TrashBOTest extends AbstractBOTest } }); } - + private void prepareGetDataSetsAndNonDeletableDataSets(final EntityGraphGenerator g) { class DataSetTableMockHandler extends BaseMatcher<List<TechId>> { private List<DataPE> dataSets = new ArrayList<DataPE>(); + private List<ExternalDataPE> nonDeletableDataSets = new ArrayList<ExternalDataPE>(); @Override @@ -614,7 +616,7 @@ public final class TrashBOTest extends AbstractBOTest } return true; } - + } final DataSetTableMockHandler handler = new DataSetTableMockHandler(); @@ -635,7 +637,7 @@ public final class TrashBOTest extends AbstractBOTest } }); } - + private static abstract class AbstractMockHandler<T> extends BaseMatcher<T> implements Action { protected T argument; @@ -654,12 +656,12 @@ public final class TrashBOTest extends AbstractBOTest return true; } } - - private List<TechId> asIds(IIdHolder...entities) + + private List<TechId> asIds(IIdHolder... entities) { return TechId.createList(Arrays.asList(entities)); } - + private static final void print(Object message) { String methodName = null; @@ -673,5 +675,5 @@ public final class TrashBOTest extends AbstractBOTest } System.out.println(methodName + ": " + message); } - + } \ No newline at end of file diff --git a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/server/business/bo/common/EntityPropertiesEnricherTest.java b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/server/business/bo/common/EntityPropertiesEnricherTest.java index 804a4d9ab38..3d051bc351e 100644 --- a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/server/business/bo/common/EntityPropertiesEnricherTest.java +++ b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/server/business/bo/common/EntityPropertiesEnricherTest.java @@ -79,7 +79,7 @@ public class EntityPropertiesEnricherTest extends AssertJUnit propertyType.setId(PROPERTY_TYPE_ID); propertyType.setDataType(new DataType(DataTypeCode.CONTROLLEDVOCABULARY)); will(returnValue(new PropertyType[] - { propertyType })); + { propertyType })); allowing(resolver).get(ENTITY_ID); will(returnValue(holder)); @@ -114,7 +114,7 @@ public class EntityPropertiesEnricherTest extends AssertJUnit codeRecord.id = VOCABULARY_ID; codeRecord.code = "http://my.url.org/?q=${term}"; will(returnValue(new CodeRecord[] - { codeRecord })); + { codeRecord })); one(setQuery).getEntityPropertyVocabularyTermValues(entityIDs); VocabularyTermRecord termRecord = new VocabularyTermRecord(); @@ -152,7 +152,7 @@ public class EntityPropertiesEnricherTest extends AssertJUnit codeRecord.id = VOCABULARY_ID; codeRecord.code = "http://my.url.org/?q=$term$"; will(returnValue(new CodeRecord[] - { codeRecord })); + { codeRecord })); one(setQuery).getEntityPropertyVocabularyTermValues(entityIDs); VocabularyTermRecord termRecord = new VocabularyTermRecord(); diff --git a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/server/business/bo/common/entity/SecondaryEntityListingQueryTest.java b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/server/business/bo/common/entity/SecondaryEntityListingQueryTest.java index d7aa311ad98..79f5b55ca59 100644 --- a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/server/business/bo/common/entity/SecondaryEntityListingQueryTest.java +++ b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/server/business/bo/common/entity/SecondaryEntityListingQueryTest.java @@ -47,10 +47,10 @@ import ch.systemsx.cisd.openbis.generic.shared.dto.SampleRelationshipPE; * @author Tomasz Pylak */ @Friend(toClasses = - { ExperimentProjectSpaceCodeRecord.class, ISecondaryEntityListingQuery.class, - SecondaryEntityDAO.class }) +{ ExperimentProjectSpaceCodeRecord.class, ISecondaryEntityListingQuery.class, + SecondaryEntityDAO.class }) @Test(groups = - { "db", "misc" }) +{ "db", "misc" }) public class SecondaryEntityListingQueryTest extends AbstractDAOTest { diff --git a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/server/business/bo/datasetlister/DatasetListingQueryTest.java b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/server/business/bo/datasetlister/DatasetListingQueryTest.java index 90b9ee8a9ff..bbb2ab1d257 100644 --- a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/server/business/bo/datasetlister/DatasetListingQueryTest.java +++ b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/server/business/bo/datasetlister/DatasetListingQueryTest.java @@ -149,11 +149,11 @@ public class DatasetListingQueryTest extends AbstractDAOTest { ExperimentPE experiment1 = getExperiment(dbInstance.getCode(), "CISD", "NEMO", "EXP-TEST-1", daoFactory); - + Long relationshipTypeId = RelationshipUtils.getParentChildRelationshipType(daoFactory.getRelationshipTypeDAO()).getId(); List<DatasetRecord> datasets = asList(query.getDataSetsForExperimentAndDescendents(experiment1.getId(), relationshipTypeId)); - + for (DatasetRecord record : datasets) { assertTrue(record.is_post_registered != null); @@ -171,7 +171,7 @@ public class DatasetListingQueryTest extends AbstractDAOTest { assertTrue(record.is_post_registered != null); } - } + } @Test public void testQueryUsingSelectAllExternalDatasReturnsNotNullPostRegistered() @@ -181,7 +181,7 @@ public class DatasetListingQueryTest extends AbstractDAOTest { assertTrue(record.is_post_registered != null); } - } + } @Test public void testQueryUsingSelectAllExternalDatasReturnsCorrectPostRegistered() @@ -189,14 +189,16 @@ public class DatasetListingQueryTest extends AbstractDAOTest List<DatasetRecord> datasets = asList(query.getDatasetsByDataStoreId(1)); for (DatasetRecord record : datasets) { - if(record.code.equals("COMPONENT_1A")) { + if (record.code.equals("COMPONENT_1A")) + { assertTrue(record.is_post_registered == false); } - else { + else + { assertTrue(record.is_post_registered == true); } } - } + } @Test public void testDatasetsForSample() diff --git a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/server/business/bo/entitygraph/DataSetNode.java b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/server/business/bo/entitygraph/DataSetNode.java index 51a7311d118..f21517c0e33 100644 --- a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/server/business/bo/entitygraph/DataSetNode.java +++ b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/server/business/bo/entitygraph/DataSetNode.java @@ -19,11 +19,10 @@ package ch.systemsx.cisd.openbis.generic.server.business.bo.entitygraph; import java.util.ArrayList; import java.util.List; - public final class DataSetNode extends EntityNode { private boolean deletable = true; - + ExperimentNode experiment; SampleNode sample; @@ -40,7 +39,7 @@ public final class DataSetNode extends EntityNode { super("DS", id); } - + public boolean isDeletable() { return deletable; @@ -50,12 +49,12 @@ public final class DataSetNode extends EntityNode { return experiment; } - + public SampleNode getSample() { return sample; } - + public List<DataSetNode> getChildren() { return children; @@ -65,23 +64,23 @@ public final class DataSetNode extends EntityNode { return parents; } - + public List<DataSetNode> getComponents() { return components; } - + public List<DataSetNode> getContainers() { return containers; } - + public DataSetNode nonDeletable() { deletable = false; return this; } - + void hasComponents(DataSetNode... someComponentDataSets) { for (DataSetNode componentDataSet : someComponentDataSets) @@ -99,8 +98,8 @@ public final class DataSetNode extends EntityNode childDataSet.parents.add(this); } } - - void hasParents(DataSetNode...someParentDataSets) + + void hasParents(DataSetNode... someParentDataSets) { for (DataSetNode parentDataSet : someParentDataSets) { @@ -108,7 +107,7 @@ public final class DataSetNode extends EntityNode parentDataSet.children.add(this); } } - + @Override public String toString() { diff --git a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/server/business/bo/entitygraph/EntityGraphGenerator.java b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/server/business/bo/entitygraph/EntityGraphGenerator.java index 7419487dcc0..c15f73725d7 100644 --- a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/server/business/bo/entitygraph/EntityGraphGenerator.java +++ b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/server/business/bo/entitygraph/EntityGraphGenerator.java @@ -31,19 +31,31 @@ import ch.systemsx.cisd.openbis.generic.shared.basic.TechId; public final class EntityGraphGenerator { - private static enum Kind { E, S, DS} - + private static enum Kind + { + E, S, DS + } + private static final class EntityDescription { private static final Pattern EXPERIMENT_PATTERN = Pattern.compile("(/S\\d+/P\\d+/)?E\\d+"); + private static final Pattern SAMPLE_PATTERN = Pattern.compile("(/(S\\d+/(P\\d+/)?)?)?S\\d+"); + private static final Pattern DATA_SET_PATTERN = Pattern.compile("DS\\d+"); + Kind kind; + boolean shared; + String space; + String project; + int id; + String type; + EntityDescription(String description) { int indexOfBracket = description.indexOf('['); @@ -58,7 +70,7 @@ public final class EntityGraphGenerator throw new IllegalArgumentException("Missing ']' at the end of " + description); } identifier = description.substring(0, indexOfBracket); - type = description.substring(indexOfBracket + 1, description.length() - 1); + type = description.substring(indexOfBracket + 1, description.length() - 1); } String[] elements = identifier.split("/"); if (EXPERIMENT_PATTERN.matcher(identifier).matches()) @@ -91,12 +103,12 @@ public final class EntityGraphGenerator id = Integer.parseInt(elements[elements.length - 1].substring(kind.name().length())); } } - + private static interface IEntitiesProvider<T extends EntityNode> { public Collection<? extends EntityNode> getEntities(T entityNode); } - + private class Parser { private void parse(List<String> parts) @@ -116,7 +128,7 @@ public final class EntityGraphGenerator handle(ds, rest); } } - + private void handle(ExperimentNode experiment, List<String> parts) { experiment.has(getSamples("samples", parts)); @@ -136,7 +148,7 @@ public final class EntityGraphGenerator dataSet.hasParents(getDataSets("parents", parts)); dataSet.hasComponents(getDataSets("components", parts)); } - + private SampleNode[] getSamples(String name, List<String> parts) { List<SampleNode> sampleNodes = new ArrayList<SampleNode>(); @@ -147,7 +159,7 @@ public final class EntityGraphGenerator } return sampleNodes.toArray(new SampleNode[descriptions.size()]); } - + private DataSetNode[] getDataSets(String name, List<String> parts) { List<DataSetNode> dataSetNodes = new ArrayList<DataSetNode>(); @@ -160,7 +172,7 @@ public final class EntityGraphGenerator } return dataSetNodes.toArray(new DataSetNode[descriptions.size()]); } - + private List<EntityDescription> getDescriptions(String name, Kind kind, List<String> parts) { String descriptionsConcatenated = getValue(name, parts); @@ -181,7 +193,7 @@ public final class EntityGraphGenerator } return result; } - + private String getValue(String name, List<String> parts) { for (String part : parts) @@ -195,13 +207,13 @@ public final class EntityGraphGenerator return null; } } - + private final Map<Long, ExperimentNode> experiments = new TreeMap<Long, ExperimentNode>(); private final Map<Long, SampleNode> samples = new TreeMap<Long, SampleNode>(); private final Map<Long, DataSetNode> dataSets = new TreeMap<Long, DataSetNode>(); - + public void parse(String definition) { Parser parser = new Parser(); @@ -239,12 +251,12 @@ public final class EntityGraphGenerator SampleNode sample = dataSetNode.getSample(); if (experiment == null && sample == null) { - throw new IllegalStateException("Data set " + dataSetNode.getCode() + throw new IllegalStateException("Data set " + dataSetNode.getCode() + " should belong to an experiment or a sample."); } if (sample != null && sample.getExperiment() != experiment) { - throw new IllegalStateException("Data set " + dataSetNode.getCode() + throw new IllegalStateException("Data set " + dataSetNode.getCode() + " should belong to the same experiment as the sample."); } } @@ -260,7 +272,7 @@ public final class EntityGraphGenerator } return experimentNode; } - + private ExperimentNode createExperiment(EntityDescription entityDescription) { ExperimentNode experimentNode = e(entityDescription.id); @@ -279,7 +291,7 @@ public final class EntityGraphGenerator } return sampleNode; } - + private SampleNode createSample(EntityDescription entityDescription) { SampleNode sampleNode = s(entityDescription.id); @@ -314,7 +326,7 @@ public final class EntityGraphGenerator { return dataSets; } - + public List<TechId> getSampleIdsByExperimentIds(Collection<TechId> experimentIds) { return getRelatedIds(experimentIds, experiments, new EntityGraphGenerator.IEntitiesProvider<ExperimentNode>() @@ -342,13 +354,13 @@ public final class EntityGraphGenerator public List<TechId> getDataSetIdsByExperimentIds(Collection<TechId> experimentIds) { return getRelatedIds(experimentIds, experiments, new EntityGraphGenerator.IEntitiesProvider<ExperimentNode>() + { + @Override + public Collection<? extends EntityNode> getEntities(ExperimentNode experiment) { - @Override - public Collection<? extends EntityNode> getEntities(ExperimentNode experiment) - { - return experiment.getDataSets(); - } - }); + return experiment.getDataSets(); + } + }); } public List<TechId> getDataSetIdsBySampleIds(Collection<TechId> experimentIds) @@ -386,7 +398,7 @@ public final class EntityGraphGenerator } }); } - + public Map<Long, Set<Long>> getContainerDataSetIdsMap(Collection<TechId> dataSetIds) { return getRelatedIdsMap(dataSetIds, dataSets, new EntityGraphGenerator.IEntitiesProvider<DataSetNode>() @@ -402,15 +414,15 @@ public final class EntityGraphGenerator public Map<Long, Set<Long>> getComponentDataSetIdsMap(Collection<TechId> dataSetIds) { return getRelatedIdsMap(dataSetIds, dataSets, new EntityGraphGenerator.IEntitiesProvider<DataSetNode>() - { - @Override - public Collection<? extends EntityNode> getEntities(DataSetNode dataSet) { - return dataSet.getComponents(); - } - }); + @Override + public Collection<? extends EntityNode> getEntities(DataSetNode dataSet) + { + return dataSet.getComponents(); + } + }); } - + public Map<Long, Set<Long>> getParentsDataSetIdsMap(Collection<TechId> dataSetIds) { return getRelatedIdsMap(dataSetIds, dataSets, new EntityGraphGenerator.IEntitiesProvider<DataSetNode>() @@ -432,7 +444,7 @@ public final class EntityGraphGenerator appendTo(builder, "#Data Sets", dataSets); return builder.toString(); } - + private void appendTo(StringBuilder builder, String name, Map<Long, ? extends EntityNode> nodes) { if (nodes.isEmpty()) @@ -446,7 +458,7 @@ public final class EntityGraphGenerator } } - private <T extends EntityNode> List<TechId> getRelatedIds(Collection<TechId> entityIds, Map<Long, T> entities, + private <T extends EntityNode> List<TechId> getRelatedIds(Collection<TechId> entityIds, Map<Long, T> entities, EntityGraphGenerator.IEntitiesProvider<T> provider) { List<TechId> ids = new ArrayList<TechId>(); @@ -460,8 +472,8 @@ public final class EntityGraphGenerator } return ids; } - - private <T extends EntityNode> Map<Long, Set<Long>> getRelatedIdsMap(Collection<TechId> entityIds, Map<Long, T> entities, + + private <T extends EntityNode> Map<Long, Set<Long>> getRelatedIdsMap(Collection<TechId> entityIds, Map<Long, T> entities, EntityGraphGenerator.IEntitiesProvider<T> provider) { Map<Long, Set<Long>> idsMap = new LinkedHashMap<Long, Set<Long>>(); diff --git a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/server/business/bo/entitygraph/EntityNode.java b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/server/business/bo/entitygraph/EntityNode.java index a90b4922dc5..490cc8338f5 100644 --- a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/server/business/bo/entitygraph/EntityNode.java +++ b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/server/business/bo/entitygraph/EntityNode.java @@ -23,7 +23,7 @@ public class EntityNode implements IIdHolder, Comparable<EntityNode> private final long id; private final String code; - + private String type; EntityNode(String codePrefix, long id) @@ -42,7 +42,7 @@ public class EntityNode implements IIdHolder, Comparable<EntityNode> { return code; } - + public String getIdentifier() { return getCode(); @@ -52,7 +52,7 @@ public class EntityNode implements IIdHolder, Comparable<EntityNode> { return type; } - + public String getIdentifierAndType() { return getCodeAndType(); @@ -78,11 +78,11 @@ public class EntityNode implements IIdHolder, Comparable<EntityNode> { return this.getCode().compareTo(that.getCode()); } - + @Override public String toString() { return getIdentifierAndType(); } - + } \ No newline at end of file diff --git a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/server/business/bo/entitygraph/ExperimentNode.java b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/server/business/bo/entitygraph/ExperimentNode.java index 573e3d096c1..59daae0d664 100644 --- a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/server/business/bo/entitygraph/ExperimentNode.java +++ b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/server/business/bo/entitygraph/ExperimentNode.java @@ -24,16 +24,16 @@ public final class ExperimentNode extends EntityNode private final List<SampleNode> samples = new ArrayList<SampleNode>(); private final List<DataSetNode> dataSets = new ArrayList<DataSetNode>(); - + private String space; - + private String project; ExperimentNode(long id) { super("E", id); } - + public String getSpace() { return space; @@ -58,12 +58,12 @@ public final class ExperimentNode extends EntityNode { return samples; } - + public List<DataSetNode> getDataSets() { return dataSets; } - + void has(SampleNode... someSamples) { for (SampleNode sample : someSamples) @@ -81,7 +81,7 @@ public final class ExperimentNode extends EntityNode dataSets.add(dataSet); } } - + @Override public String getIdentifier() { diff --git a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/server/business/bo/entitygraph/SampleNode.java b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/server/business/bo/entitygraph/SampleNode.java index d08074b82b7..0ed3034275d 100644 --- a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/server/business/bo/entitygraph/SampleNode.java +++ b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/server/business/bo/entitygraph/SampleNode.java @@ -22,21 +22,28 @@ import java.util.List; public final class SampleNode extends EntityNode { private final List<SampleNode> components = new ArrayList<SampleNode>(); + private final List<SampleNode> parents = new ArrayList<SampleNode>(); + private final List<SampleNode> children = new ArrayList<SampleNode>(); + private final List<DataSetNode> dataSets = new ArrayList<DataSetNode>(); private boolean shared; + private String space; + private String project; + private ExperimentNode experiment; + private SampleNode container; SampleNode(long id) { super("S", id); } - + public boolean isShared() { return shared; @@ -76,7 +83,7 @@ public final class SampleNode extends EntityNode { this.experiment = experiment; } - + public SampleNode getContainer() { return container; @@ -86,7 +93,7 @@ public final class SampleNode extends EntityNode { this.container = container; } - + public List<SampleNode> getComponents() { return components; @@ -96,17 +103,17 @@ public final class SampleNode extends EntityNode { return parents; } - + public List<SampleNode> getChildren() { return children; } - + public List<DataSetNode> getDataSets() { return dataSets; } - + void hasComponents(SampleNode... someComponentSamples) { for (SampleNode componentSample : someComponentSamples) @@ -115,7 +122,7 @@ public final class SampleNode extends EntityNode componentSample.container = this; } } - + void hasChildren(SampleNode... someChildSamples) { for (SampleNode childSample : someChildSamples) @@ -124,7 +131,7 @@ public final class SampleNode extends EntityNode childSample.parents.add(this); } } - + void has(DataSetNode... someDataSets) { for (DataSetNode dataSet : someDataSets) @@ -137,7 +144,7 @@ public final class SampleNode extends EntityNode dataSets.add(dataSet); } } - + @Override public String getIdentifier() { diff --git a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/server/business/bo/entitygraph/Utils.java b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/server/business/bo/entitygraph/Utils.java index 525abd23f8d..228906a3527 100644 --- a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/server/business/bo/entitygraph/Utils.java +++ b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/server/business/bo/entitygraph/Utils.java @@ -32,8 +32,6 @@ import ch.systemsx.cisd.openbis.generic.shared.dto.identifier.ExperimentIdentifi import ch.systemsx.cisd.openbis.generic.shared.dto.identifier.ExperimentIdentifierFactory; /** - * - * * @author Franz-Josef Elmer */ public class Utils @@ -52,7 +50,7 @@ public class Utils sample.setContainer(createSample(sampleNode.getContainer())); return sample; } - + public static ExternalDataPE createData(DataSetNode dataSetNode) { ExternalDataPE data = new ExternalDataPE(); @@ -135,7 +133,7 @@ public class Utils experiment.setIdentifier(experimentNode.getCode()); return experiment; } - + public static ExperimentPE createExperimentPE(ExperimentNode experimentNode) { if (experimentNode == null) @@ -159,7 +157,7 @@ public class Utils experiment.setProject(project); return experiment; } - + static final void appendTo(StringBuilder builder, String label, List<? extends EntityNode> entityNodes) { if (entityNodes.isEmpty()) diff --git a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/server/business/bo/fetchoptions/samplelister/SampleListerTest.java b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/server/business/bo/fetchoptions/samplelister/SampleListerTest.java index 4441778e1de..f4c38598a47 100644 --- a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/server/business/bo/fetchoptions/samplelister/SampleListerTest.java +++ b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/server/business/bo/fetchoptions/samplelister/SampleListerTest.java @@ -112,7 +112,7 @@ public class SampleListerTest extends AssertJUnit SampleRecord r101 = record(101); SampleRecord r102 = record(102); LongOpenHashSet sampleIdSet = new LongOpenHashSet(new long[] - { r101.s_id, r102.s_id }); + { r101.s_id, r102.s_id }); one(query).listSamplesByIds(sampleIdSet); will(returnValue(Arrays.asList(r101, r102))); @@ -123,7 +123,7 @@ public class SampleListerTest extends AssertJUnit will(returnValue(Arrays.asList(sampleMetaproject(102, 42)))); one(query).getMetaprojects(new LongOpenHashSet(new long[] - { 42 })); + { 42 })); will(returnValue(Arrays.asList(metaproject(42, "answer")))); atLeast(1).of(filter).isValid(user, sample(r101)); @@ -162,7 +162,7 @@ public class SampleListerTest extends AssertJUnit SampleRecord r101 = record(101); SampleRecord r102 = record(102); one(query).listSamplesByIds(new LongOpenHashSet(new long[] - { r1.s_id, r2.s_id, r3.s_id, r101.s_id, r102.s_id })); + { r1.s_id, r2.s_id, r3.s_id, r101.s_id, r102.s_id })); will(returnValue(Arrays.asList(r1, r2, r3, r101, r102))); atLeast(1).of(filter).isValid(user, sample(r1)); @@ -220,8 +220,8 @@ public class SampleListerTest extends AssertJUnit SampleRecord r401 = record(401); one(query).listSamplesByIds( new LongOpenHashSet(new long[] - { r1.s_id, r2.s_id, r3.s_id, r101.s_id, r102.s_id, r201.s_id, - r202.s_id, r301.s_id, r302.s_id, r401.s_id })); + { r1.s_id, r2.s_id, r3.s_id, r101.s_id, r102.s_id, r201.s_id, + r202.s_id, r301.s_id, r302.s_id, r401.s_id })); will(returnValue(Arrays.asList(r1, r2, r3, r101, r102, r201, r202, r301, r302, r401))); diff --git a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/server/business/bo/samplelister/SampleSetListingQueryTest.java b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/server/business/bo/samplelister/SampleSetListingQueryTest.java index 0b8a7db3956..f6b78c353c7 100644 --- a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/server/business/bo/samplelister/SampleSetListingQueryTest.java +++ b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/server/business/bo/samplelister/SampleSetListingQueryTest.java @@ -46,9 +46,9 @@ import ch.systemsx.cisd.openbis.generic.shared.basic.dto.PropertyType; * @author Bernd Rinn */ @Friend(toClasses = - { SampleRecord.class, ISampleListingQuery.class }) +{ SampleRecord.class, ISampleListingQuery.class }) @Test(groups = - { "db", "sample" }) +{ "db", "sample" }) public class SampleSetListingQueryTest extends AbstractDAOTest { diff --git a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/db/AttachmentDAOTest.java b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/db/AttachmentDAOTest.java index e231e9fbb28..0895df858b2 100644 --- a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/db/AttachmentDAOTest.java +++ b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/db/AttachmentDAOTest.java @@ -33,7 +33,7 @@ import ch.systemsx.cisd.openbis.generic.shared.dto.ExperimentPE; * @author Kaloyan Enimanev */ @Test(groups = - { "db" }) +{ "db" }) public final class AttachmentDAOTest extends AbstractDAOTest { diff --git a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/db/AuthorizationGroupDAOTest.java b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/db/AuthorizationGroupDAOTest.java index 7aa2f0d89d8..d9af20c386b 100644 --- a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/db/AuthorizationGroupDAOTest.java +++ b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/db/AuthorizationGroupDAOTest.java @@ -30,7 +30,7 @@ import ch.systemsx.cisd.openbis.generic.shared.dto.AuthorizationGroupPE; * @author Izabela Adamczyk */ @Test(groups = - { "db", "authorization_group" }) +{ "db", "authorization_group" }) public class AuthorizationGroupDAOTest extends AbstractDAOTest { diff --git a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/db/CorePluginDAOTest.java b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/db/CorePluginDAOTest.java index 19279af825f..a77c427b2a7 100644 --- a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/db/CorePluginDAOTest.java +++ b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/db/CorePluginDAOTest.java @@ -32,7 +32,7 @@ import ch.systemsx.cisd.openbis.generic.shared.dto.CorePluginPE; * @author Kaloyan Enimanev */ @Test(groups = - { "db", "slow" }) +{ "db", "slow" }) public final class CorePluginDAOTest extends AbstractDAOTest { @Test diff --git a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/db/DataDAOTest.java b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/db/DataDAOTest.java index 5c3ab7b36fe..9315a229534 100644 --- a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/db/DataDAOTest.java +++ b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/db/DataDAOTest.java @@ -303,14 +303,14 @@ public final class DataDAOTest extends AbstractDAOTest data.setStorageFormatVocabularyTerm(pickAStorageFormatVocabularyTerm()); data.setStatus(DataSetArchivingStatus.AVAILABLE); dataDAO.createDataSet(data, getSystemPerson()); - + ExternalDataPE externalData = dataDAO.tryToFindDataSetByCode(dataSetCode).tryAsExternalData(); int version = externalData.getVersion(); externalData.setShareId("share-43"); externalData.setSize(size); - + dataDAO.updateDataSet(externalData, getTestPerson()); - + ExternalDataPE dataSet = dataDAO.tryToFindDataSetByCode(dataSetCode).tryAsExternalData(); assertEquals(externalData.getCode(), dataSet.getCode()); assertEquals(externalData.getDataSetType(), dataSet.getDataSetType()); diff --git a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/db/DatabaseCreationUtil.java b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/db/DatabaseCreationUtil.java index 961a9febf40..5a39142741e 100644 --- a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/db/DatabaseCreationUtil.java +++ b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/db/DatabaseCreationUtil.java @@ -55,15 +55,15 @@ public final class DatabaseCreationUtil { final AbstractApplicationContext applicationContext = new ClassPathXmlApplicationContext(new String[] - { "dbConfigurationContext.xml" }, true); + { "dbConfigurationContext.xml" }, true); DatabaseCreationUtil.beanFactory = applicationContext; } return beanFactory; } /** - * Creates all files in <code>sourceTest/sql/postgresql</code> necessary to set up a database of - * the current version by dumping a database migrated from the specified version. + * Creates all files in <code>sourceTest/sql/postgresql</code> necessary to set up a database of the current version by dumping a database + * migrated from the specified version. */ private final static void createFilesFromADumpOfAMigratedDatabase(final String databaseVersion) throws Exception @@ -85,8 +85,7 @@ public final class DatabaseCreationUtil } /** - * Creates all files in <var>destinationDir</var> necessary to set up the database - * <var>databaseKind</var> in its current state. + * Creates all files in <var>destinationDir</var> necessary to set up the database <var>databaseKind</var> in its current state. */ private static final void createDumpForJava(final String databaseKind, final File destinationDir) throws IOException diff --git a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/db/DeletionDAOTest.java b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/db/DeletionDAOTest.java index aa411ecab57..67c3a99770b 100644 --- a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/db/DeletionDAOTest.java +++ b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/db/DeletionDAOTest.java @@ -49,7 +49,7 @@ import ch.systemsx.cisd.openbis.generic.shared.dto.properties.EntityKind; * @author Piotr Buczek */ @Test(groups = - { "db" }) +{ "db" }) public class DeletionDAOTest extends AbstractDAOTest { diff --git a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/db/EntityOperationsLogDAOTest.java b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/db/EntityOperationsLogDAOTest.java index 8d6b36d3262..63bb6de6980 100644 --- a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/db/EntityOperationsLogDAOTest.java +++ b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/db/EntityOperationsLogDAOTest.java @@ -33,7 +33,7 @@ import ch.systemsx.cisd.openbis.generic.shared.dto.EntityOperationsLogEntryPE; * @author Chandrasekhar Ramakrishnan */ @Test(groups = - { "db" }) +{ "db" }) public final class EntityOperationsLogDAOTest extends AbstractDAOTest { diff --git a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/db/EntityPropertyTypeDAOTest.java b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/db/EntityPropertyTypeDAOTest.java index 8139a043765..22f6bfd3abc 100644 --- a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/db/EntityPropertyTypeDAOTest.java +++ b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/db/EntityPropertyTypeDAOTest.java @@ -44,7 +44,7 @@ import ch.systemsx.cisd.openbis.generic.shared.dto.properties.EntityKind; * @author Izabela Adamczyk */ @Test(groups = - { "db", "property" }) +{ "db", "property" }) public class EntityPropertyTypeDAOTest extends AbstractDAOTest { @@ -172,19 +172,19 @@ public class EntityPropertyTypeDAOTest extends AbstractDAOTest private final static Object[][] entityKindsWithEntityTypeAndPropertyTypeMandatory() { return new Object[][] - { - { EntityKind.EXPERIMENT, "SIRNA_HCS", "DESCRIPTION" }, - { EntityKind.SAMPLE, "CONTROL_LAYOUT", "$PLATE_GEOMETRY" }, - { EntityKind.MATERIAL, "BACTERIUM", "DESCRIPTION" } }; + { + { EntityKind.EXPERIMENT, "SIRNA_HCS", "DESCRIPTION" }, + { EntityKind.SAMPLE, "CONTROL_LAYOUT", "$PLATE_GEOMETRY" }, + { EntityKind.MATERIAL, "BACTERIUM", "DESCRIPTION" } }; } @DataProvider private final static Object[][] entityKindsWithEntityTypeAndPropertyTypeNotAssigned() { return new Object[][] - { - { EntityKind.EXPERIMENT, "SIRNA_HCS", "IS_VALID" }, - { EntityKind.SAMPLE, "CONTROL_LAYOUT", "IS_VALID" }, - { EntityKind.MATERIAL, "BACTERIUM", "IS_VALID" }, }; + { + { EntityKind.EXPERIMENT, "SIRNA_HCS", "IS_VALID" }, + { EntityKind.SAMPLE, "CONTROL_LAYOUT", "IS_VALID" }, + { EntityKind.MATERIAL, "BACTERIUM", "IS_VALID" }, }; } } diff --git a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/db/EntityResolverQueryTest.java b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/db/EntityResolverQueryTest.java index b2d645617b7..e99beecdd12 100644 --- a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/db/EntityResolverQueryTest.java +++ b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/db/EntityResolverQueryTest.java @@ -30,7 +30,7 @@ import org.testng.annotations.Test; * @author Bernd Rinn */ @Test(groups = - { "db" }) +{ "db" }) public class EntityResolverQueryTest extends AbstractDAOTest { private IEntityResolverQuery query; diff --git a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/db/EventDAOTest.java b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/db/EventDAOTest.java index 555db6c4402..3f7e9f7ebb1 100644 --- a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/db/EventDAOTest.java +++ b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/db/EventDAOTest.java @@ -40,7 +40,7 @@ import ch.systemsx.cisd.openbis.generic.shared.util.HibernateUtils; * @author Izabela Adamczyk */ @Test(groups = - { "db", "event" }) +{ "db", "event" }) public class EventDAOTest extends AbstractDAOTest { diff --git a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/db/GridCustomColumnDAOTest.java b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/db/GridCustomColumnDAOTest.java index 3054b3ae0f6..15a1fd43266 100644 --- a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/db/GridCustomColumnDAOTest.java +++ b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/db/GridCustomColumnDAOTest.java @@ -31,7 +31,7 @@ import ch.systemsx.cisd.openbis.generic.shared.dto.PersonPE; * @author Tomasz Pylak */ @Test(groups = - { "db", "column" }) +{ "db", "column" }) public final class GridCustomColumnDAOTest extends AbstractDAOTest { public void testCreateAndListColumn() throws Exception diff --git a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/db/GridCustomFilterDAOTest.java b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/db/GridCustomFilterDAOTest.java index 6ec4cf8ccea..d9eca3340e5 100644 --- a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/db/GridCustomFilterDAOTest.java +++ b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/db/GridCustomFilterDAOTest.java @@ -30,7 +30,7 @@ import ch.systemsx.cisd.openbis.generic.shared.dto.PersonPE; * @author Izabela Adamczyk */ @Test(groups = - { "db", "filter" }) +{ "db", "filter" }) public final class GridCustomFilterDAOTest extends AbstractDAOTest { private static final boolean PUBLIC = true; diff --git a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/db/MetaprojectDAOTest.java b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/db/MetaprojectDAOTest.java index 1da3f963328..abafc69cf8e 100644 --- a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/db/MetaprojectDAOTest.java +++ b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/db/MetaprojectDAOTest.java @@ -195,7 +195,7 @@ public class MetaprojectDAOTest extends AbstractDAOTest Collection<MetaprojectAssignmentPE> assignments = daoFactory.getMetaprojectDAO().listMetaprojectAssignmentsForEntities( getTestPerson(), Arrays.asList(new IEntityInformationWithPropertiesHolder[] - { experiment1, experiment2 }), EntityKind.EXPERIMENT); + { experiment1, experiment2 }), EntityKind.EXPERIMENT); assertEquals(3, assignments.size()); for (MetaprojectAssignmentPE assignment : assignments) diff --git a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/db/PermIdDAOTest.java b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/db/PermIdDAOTest.java index d88eea5dc91..1f7dbab25ba 100644 --- a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/db/PermIdDAOTest.java +++ b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/db/PermIdDAOTest.java @@ -28,7 +28,7 @@ import org.testng.annotations.Test; * @author Izabela Adamczyk */ @Test(groups = - { "db" }) +{ "db" }) public final class PermIdDAOTest extends AbstractDAOTest { diff --git a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/db/SqlDataMigrationTest.java b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/db/SqlDataMigrationTest.java index efa34fbc2e5..39c659d098d 100644 --- a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/db/SqlDataMigrationTest.java +++ b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/db/SqlDataMigrationTest.java @@ -59,7 +59,7 @@ public final class SqlDataMigrationTest } @Test(groups = - { "slow" }) + { "slow" }) /* runs unit tests written in SQL. The tests should check if the migration went fine. */ public final void testMigration() throws Exception { diff --git a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/db/SqlMigrationTest.java b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/db/SqlMigrationTest.java index a24684bafe1..d4008aeaf26 100644 --- a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/db/SqlMigrationTest.java +++ b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/db/SqlMigrationTest.java @@ -29,7 +29,7 @@ public class SqlMigrationTest extends SqlMigrationTestAbstract { @Test(groups = - { "slow" }) + { "slow" }) public void test_migration() throws Exception { testMigration(DatabaseVersionHolder.getDatabaseVersion()); diff --git a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/db/search/LuceneQueryBuilderTest.java b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/db/search/LuceneQueryBuilderTest.java index 38539257373..a0bb9a4b513 100644 --- a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/db/search/LuceneQueryBuilderTest.java +++ b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/db/search/LuceneQueryBuilderTest.java @@ -32,7 +32,7 @@ public class LuceneQueryBuilderTest extends AssertJUnit protected Object[][] getQueriesToTestInBasicMode() { return new Object[][] - { + { { "abc", "(*abc*)" }, { "code:CP registrator:Joe", "(*code\\:CP*) (*registrator\\:Joe*)" }, { "ab#c OR d", "(*ab* AND *c*) OR (*d*)" } }; @@ -42,7 +42,7 @@ public class LuceneQueryBuilderTest extends AssertJUnit protected Object[][] getQueriesToTestInWildcardMode() { return new Object[][] - { + { { "abc", "abc" }, { "code:CP registrator:Joe", "code\\:CP registrator\\:Joe" }, { "*ab#c OR d", "*ab#c OR d" } }; diff --git a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/server/task/DataSetRegistrationSummaryTaskTest.java b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/server/task/DataSetRegistrationSummaryTaskTest.java index ec45da86a93..722e7198599 100644 --- a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/server/task/DataSetRegistrationSummaryTaskTest.java +++ b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/server/task/DataSetRegistrationSummaryTaskTest.java @@ -347,7 +347,7 @@ public class DataSetRegistrationSummaryTaskTest extends AssertJUnit one(mailClient).sendEmailMessage(with(checker.getSubjectMatcher()), with(checker.getReportMatcher()), with((EMailAddress) null), with((EMailAddress) null), with(new EMailAddress[] - { new EMailAddress(address) })); + { new EMailAddress(address) })); } } }); diff --git a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/server/task/MaterialExternalDBSyncTaskTest.java b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/server/task/MaterialExternalDBSyncTaskTest.java index a6336961efb..a2e7f986de6 100644 --- a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/server/task/MaterialExternalDBSyncTaskTest.java +++ b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/server/task/MaterialExternalDBSyncTaskTest.java @@ -67,7 +67,7 @@ import ch.systemsx.cisd.openbis.generic.shared.dto.SessionContextDTO; * @author Franz-Josef Elmer */ @Friend(toClasses = - { MaterialExternalDBSyncTask.class, MappingInfo.class }) +{ MaterialExternalDBSyncTask.class, MappingInfo.class }) public class MaterialExternalDBSyncTaskTest extends AbstractFileSystemTestCase { private static final String SESSION_TOKEN = "session-token"; diff --git a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/server/util/AnnotationAppliedTestCase.java b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/server/util/AnnotationAppliedTestCase.java index b78b7b0f56e..6d7f34d49d8 100644 --- a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/server/util/AnnotationAppliedTestCase.java +++ b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/server/util/AnnotationAppliedTestCase.java @@ -30,16 +30,14 @@ import org.testng.AssertJUnit; import ch.systemsx.cisd.openbis.generic.server.authorization.annotation.RolesAllowed; /** - * Test case for test classes testing whether an interface and/or its implementation have all - * mandatory annotations. + * Test case for test classes testing whether an interface and/or its implementation have all mandatory annotations. * * @author Franz-Josef Elmer */ public class AnnotationAppliedTestCase extends AssertJUnit { /** - * Asserts that the specified class is an interface and all its methods have the annotations - * {@link RolesAllowed} and {@link Transactional}. + * Asserts that the specified class is an interface and all its methods have the annotations {@link RolesAllowed} and {@link Transactional}. */ protected void assertMandatoryMethodAnnotations(Class<?> interfaceClass, List<String> exemptMethods) { @@ -47,9 +45,8 @@ public class AnnotationAppliedTestCase extends AssertJUnit } /** - * Asserts that the specified interface class is an interface, the implementing class really - * implements that interface, and all interface methods or their implementations have the - * annotations {@link RolesAllowed} and {@link Transactional}. + * Asserts that the specified interface class is an interface, the implementing class really implements that interface, and all interface methods + * or their implementations have the annotations {@link RolesAllowed} and {@link Transactional}. */ protected void assertMandatoryMethodAnnotations(Class<?> interfaceClass, Class<?> implementingClass, List<String> exemptMethods) @@ -58,10 +55,8 @@ public class AnnotationAppliedTestCase extends AssertJUnit } /** - * Asserts that the specified interface class is an interface, the implementing class really - * implements that interface, and all interface methods or their implementations have the - * annotations {@link RolesAllowed} and {@link Transactional}. The specified exceptions are - * allowed. + * Asserts that the specified interface class is an interface, the implementing class really implements that interface, and all interface methods + * or their implementations have the annotations {@link RolesAllowed} and {@link Transactional}. The specified exceptions are allowed. */ protected void assertMandatoryMethodAnnotations(Class<?> interfaceClass, Class<?> implementingClass, String exceptions, List<String> exemptMethods) @@ -76,9 +71,8 @@ public class AnnotationAppliedTestCase extends AssertJUnit } /** - * Asserts that the specified interface class is an interface, the implementing class really - * implements that interface, and all interface methods or their implementations have the - * specified annotations. The specified exceptions are allowed. + * Asserts that the specified interface class is an interface, the implementing class really implements that interface, and all interface methods + * or their implementations have the specified annotations. The specified exceptions are allowed. */ protected void assertMandatoryMethodAnnotations( List<Class<? extends Annotation>> mandatoryAnnotations, Class<?> interfaceClass, @@ -103,10 +97,11 @@ public class AnnotationAppliedTestCase extends AssertJUnit }); for (Method interfaceMethod : declaredMethods) { - if(exemptMethods != null && exemptMethods.contains(interfaceMethod.getName())) { + if (exemptMethods != null && exemptMethods.contains(interfaceMethod.getName())) + { continue; } - + List<String> missingAnnotations = new ArrayList<String>(); for (Class<? extends Annotation> annotationClass : mandatoryAnnotations) { diff --git a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/server/util/SimpleDateRendererTest.java b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/server/util/SimpleDateRendererTest.java index 50e4856adbe..100caf9537a 100644 --- a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/server/util/SimpleDateRendererTest.java +++ b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/server/util/SimpleDateRendererTest.java @@ -27,8 +27,8 @@ import org.testng.annotations.Test; import ch.systemsx.cisd.openbis.generic.shared.basic.SimpleDateRenderer; /** - * Tests of {@link SimpleDateRenderer}. The test is in the different package than the tested class - * to have access to TimeZone class (GWT does not support it). + * Tests of {@link SimpleDateRenderer}. The test is in the different package than the tested class to have access to TimeZone class (GWT does not + * support it). * * @author Tomasz Pylak */ @@ -38,10 +38,10 @@ public class SimpleDateRendererTest extends AssertJUnit private Object[][] getDates() { return new Object[][] - { - { toDate(1991, 12, 3, 3, 13, 59, "CET"), "1991-12-03 03:13:59 GMT+01:00" }, - { toDate(2008, 12, 6, 15, 35, 17, "CET"), "2008-12-06 15:35:17 GMT+01:00" }, - { toDate(2008, 7, 31, 1, 2, 3, "CET"), "2008-07-31 01:02:03 GMT+02:00" } }; + { + { toDate(1991, 12, 3, 3, 13, 59, "CET"), "1991-12-03 03:13:59 GMT+01:00" }, + { toDate(2008, 12, 6, 15, 35, 17, "CET"), "2008-12-06 15:35:17 GMT+01:00" }, + { toDate(2008, 7, 31, 1, 2, 3, "CET"), "2008-07-31 01:02:03 GMT+02:00" } }; } @Test(dataProvider = "dates") diff --git a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/server/util/TimeIntervalChecker.java b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/server/util/TimeIntervalChecker.java index 03b93da8d5b..1096191efd5 100644 --- a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/server/util/TimeIntervalChecker.java +++ b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/server/util/TimeIntervalChecker.java @@ -22,11 +22,9 @@ import java.util.Date; import org.testng.AssertJUnit; /** - * Helper class to check that a time stamp is between now and a time in the past when an instance of - * this class has been created. + * Helper class to check that a time stamp is between now and a time in the past when an instance of this class has been created. * <p> - * This class is useful in tests where some productive code creates a time stamp which should be - * checked. + * This class is useful in tests where some productive code creates a time stamp which should be checked. * * @author Franz-Josef Elmer */ @@ -49,7 +47,7 @@ public class TimeIntervalChecker extends AssertJUnit { this(new Timestamp(System.currentTimeMillis() - shiftInMillisecond)); } - + /** * Creates an instance for the specified date object. */ @@ -59,8 +57,7 @@ public class TimeIntervalChecker extends AssertJUnit } /** - * Asserts that the specified date is after the time stamp of creation of this instance and - * before now. + * Asserts that the specified date is after the time stamp of creation of this instance and before now. */ public void assertDateInInterval(Date date) { @@ -71,7 +68,7 @@ public class TimeIntervalChecker extends AssertJUnit assertFalse("Actual date [" + date + "] is after now [" + now + "].", now.before(timestamp)); } - + private Timestamp asTimestamp(Date date) { return date instanceof Timestamp ? (Timestamp) date : new Timestamp(date.getTime()); diff --git a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/shared/DataSetInfoHelperTest.java b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/shared/DataSetInfoHelperTest.java index 4866c47dc09..407777d67cc 100644 --- a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/shared/DataSetInfoHelperTest.java +++ b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/shared/DataSetInfoHelperTest.java @@ -51,7 +51,7 @@ public class DataSetInfoHelperTest extends AssertJUnit String dataSetType = "dataSetTypeC"; String fileType = "fileTypeD"; String[] parents = - { "p1", "p2", "p3" }; + { "p1", "p2", "p3" }; DataSetUploadInfo info = new DataSetUploadInfo(sample, experiment, parents, dataSetType, fileType); checkInfo(info, sample, experiment, parents, dataSetType, fileType); @@ -110,7 +110,7 @@ public class DataSetInfoHelperTest extends AssertJUnit String sample = null; String experiment = "eB"; String[] parents = - { "p1", "p2", "p3" }; + { "p1", "p2", "p3" }; String dataSetType = "dsC"; String fileType = "ftD"; DataSetUploadInfo info = diff --git a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/shared/INormalizer.java b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/shared/INormalizer.java index 8da91428930..4edcd1c2fd0 100644 --- a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/shared/INormalizer.java +++ b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/shared/INormalizer.java @@ -17,8 +17,6 @@ package ch.systemsx.cisd.openbis.generic.shared; /** - * - * * @author Franz-Josef Elmer */ public interface INormalizer diff --git a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/shared/ServletParamsParsingTestUtils.java b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/shared/ServletParamsParsingTestUtils.java index acb3c05e0d1..58573e023aa 100644 --- a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/shared/ServletParamsParsingTestUtils.java +++ b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/shared/ServletParamsParsingTestUtils.java @@ -85,7 +85,7 @@ public class ServletParamsParsingTestUtils extends AssertJUnit for (int i = 0; i < keyValuePairs.length / 2; i++) { paramsMap.put(keyValuePairs[i * 2], new String[] - { keyValuePairs[i * 2 + 1] }); + { keyValuePairs[i * 2 + 1] }); } } } diff --git a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/shared/api/v1/TranslatorTest.java b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/shared/api/v1/TranslatorTest.java index 5c1f1eca44b..8b573fcb72b 100644 --- a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/shared/api/v1/TranslatorTest.java +++ b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/shared/api/v1/TranslatorTest.java @@ -67,14 +67,14 @@ import ch.systemsx.cisd.openbis.generic.shared.dto.PersonPE; public class TranslatorTest extends AssertJUnit { private static final IKeyExtractor<String, DataSet> KEY_EXTRACTOR = new IKeyExtractor<String, DataSet>() + { + @Override + public String getKey(DataSet e) { - @Override - public String getKey(DataSet e) - { - return e.getCode(); - } - }; - + return e.getCode(); + } + }; + private DataSetBuilder ds1; private DataSetBuilder ds2; @@ -133,13 +133,13 @@ public class TranslatorTest extends AssertJUnit new LinkDataSetBuilder(4).code("lds").type("L1").experiment(experiment) .sample(sample).registrationDate(new Date(123456789L)) .modificationDate(new Date(123459999L)).externalCode("EX_CODE").edms(edms); - + dsp1 = new DataSetBuilder(10).code("ds-p1").type("T2").experiment(experiment).getDataSet(); dsp2 = new DataSetBuilder(11).code("ds-p2").type("T2").experiment(experiment).getDataSet(); dsc1 = new ContainerDataSetBuilder(12).code("ds-c1").type("T3") - .experiment(experiment).component(dsp1).component(dsp2).getContainerDataSet(); + .experiment(experiment).component(dsp1).component(dsp2).getContainerDataSet(); dsc2 = new ContainerDataSetBuilder(13).code("ds-c2").type("T3") - .experiment(experiment).component(dsp1).component(dsp2).getContainerDataSet(); + .experiment(experiment).component(dsp1).component(dsp2).getContainerDataSet(); dsp1.addContainer(dsc1, 0); dsp1.addContainer(dsc2, 1); dsp2.addContainer(dsc1, 0); @@ -406,12 +406,12 @@ public class TranslatorTest extends AssertJUnit assertEquals("[ds2]", translated.getChildrenCodes().toString()); assertEquals("[ds1]", translated.getParentCodes().toString()); } - + @Test public void testTranslateCyclicGraphOfDataSets() { - List<DataSet> translatedDatasets = Translator.translate(Arrays.<AbstractExternalData>asList(dsc1, dsc2), EnumSet.noneOf(Connections.class)); - + List<DataSet> translatedDatasets = Translator.translate(Arrays.<AbstractExternalData> asList(dsc1, dsc2), EnumSet.noneOf(Connections.class)); + DataSet dsc1t = translatedDatasets.get(0); TableMap<String, DataSet> dsc1tc = new TableMap<String, DataSet>(dsc1t.getContainedDataSets(), KEY_EXTRACTOR); assertEquals(2, dsc1tc.keySet().size()); @@ -431,7 +431,7 @@ public class TranslatorTest extends AssertJUnit TableMap<String, DataSet> dsp2tc = new TableMap<String, DataSet>(dsp2t.getContainerDataSets(), KEY_EXTRACTOR); assertSame(dsc1t2, dsp2tc.getOrDie("ds-c1")); assertSame(dsc2t2, dsp2tc.getOrDie("ds-c2")); - + assertEquals(2, translatedDatasets.size()); } diff --git a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/shared/api/v1/dto/DataSetBuilder.java b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/shared/api/v1/dto/DataSetBuilder.java index 9763184ee1f..3b6e8ab1476 100644 --- a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/shared/api/v1/dto/DataSetBuilder.java +++ b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/shared/api/v1/dto/DataSetBuilder.java @@ -35,40 +35,40 @@ public class DataSetBuilder new EntityRegistrationDetails(new EntityRegistrationDetailsInitializer()); initializer.setRegistrationDetails(registrationDetails); } - + public DataSet getDataSet() { return new DataSet(initializer); } - + public DataSetBuilder code(String code) { initializer.setCode(code); return this; } - + public DataSetBuilder type(String type) { initializer.setDataSetTypeCode(type); return this; } - + public DataSetBuilder experiment(String experimentIdentifier) { initializer.setExperimentIdentifier(experimentIdentifier); return this; } - + public DataSetBuilder sample(String sampleIdentifier) { initializer.setSampleIdentifierOrNull(sampleIdentifier); return this; } - + public DataSetBuilder property(String key, String value) { initializer.getProperties().put(key, value); return this; } - + } diff --git a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/shared/api/v1/dto/DataSetTest.java b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/shared/api/v1/dto/DataSetTest.java index eb6a1393d5b..d7013b1700e 100644 --- a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/shared/api/v1/dto/DataSetTest.java +++ b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/shared/api/v1/dto/DataSetTest.java @@ -51,7 +51,7 @@ public class DataSetTest extends AssertJUnit } @Test(expectedExceptions = - { IllegalArgumentException.class }) + { IllegalArgumentException.class }) public void testInitialization() { DataSetInitializer initializer = new DataSetInitializer(); diff --git a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/shared/api/v1/dto/DataSetTypeTest.java b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/shared/api/v1/dto/DataSetTypeTest.java index 6c92ced8b53..92b3c7732a4 100644 --- a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/shared/api/v1/dto/DataSetTypeTest.java +++ b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/shared/api/v1/dto/DataSetTypeTest.java @@ -63,7 +63,7 @@ public class DataSetTypeTest extends AssertJUnit } @Test(expectedExceptions = - { IllegalArgumentException.class }) + { IllegalArgumentException.class }) public void testInitialization() { DataSetTypeInitializer initializer = new DataSetTypeInitializer(); diff --git a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/shared/api/v1/dto/SampleBuilder.java b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/shared/api/v1/dto/SampleBuilder.java index 20bb31e289c..fa9f964ddc5 100644 --- a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/shared/api/v1/dto/SampleBuilder.java +++ b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/shared/api/v1/dto/SampleBuilder.java @@ -20,14 +20,12 @@ import ch.systemsx.cisd.openbis.generic.shared.api.v1.dto.EntityRegistrationDeta import ch.systemsx.cisd.openbis.generic.shared.api.v1.dto.Sample.SampleInitializer; /** - * - * * @author Franz-Josef Elmer */ public class SampleBuilder { private SampleInitializer initializer = new SampleInitializer(); - + public SampleBuilder(long id) { initializer.setId(id); @@ -35,46 +33,46 @@ public class SampleBuilder new EntityRegistrationDetailsInitializer(); initializer.setRegistrationDetails(new EntityRegistrationDetails(entityRegInitializer)); } - + public Sample getSample() { return new Sample(initializer); } - + public SampleBuilder code(String code) { initializer.setCode(code); return this; } - + public SampleBuilder type(String type) { initializer.setSampleTypeCode(type); return this; } - + public SampleBuilder typeID(long typeId) { initializer.setSampleTypeId(typeId); return this; } - + public SampleBuilder identifier(String identifier) { initializer.setIdentifier(identifier); return this; } - + public SampleBuilder permID(String permId) { initializer.setPermId(permId); return this; } - + public SampleBuilder experiment(String experimentIdentifier) { initializer.setExperimentIdentifierOrNull(experimentIdentifier); return this; } - + } diff --git a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/shared/api/v1/dto/SampleTest.java b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/shared/api/v1/dto/SampleTest.java index e3625fb932a..e026ce4c863 100644 --- a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/shared/api/v1/dto/SampleTest.java +++ b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/shared/api/v1/dto/SampleTest.java @@ -64,7 +64,7 @@ public class SampleTest extends AssertJUnit } @Test(expectedExceptions = - { IllegalArgumentException.class }) + { IllegalArgumentException.class }) public void testInitialization() { SampleInitializer initializer = new SampleInitializer(); diff --git a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/shared/api/v1/filter/PropertiesBasedDataSetFilterTest.java b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/shared/api/v1/filter/PropertiesBasedDataSetFilterTest.java index d4a0ee46a4e..b44306b3bc3 100644 --- a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/shared/api/v1/filter/PropertiesBasedDataSetFilterTest.java +++ b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/shared/api/v1/filter/PropertiesBasedDataSetFilterTest.java @@ -24,8 +24,6 @@ import org.testng.annotations.Test; import ch.systemsx.cisd.openbis.generic.shared.api.v1.dto.DataSetBuilder; /** - * - * * @author Franz-Josef Elmer */ public class PropertiesBasedDataSetFilterTest extends AssertJUnit @@ -34,19 +32,19 @@ public class PropertiesBasedDataSetFilterTest extends AssertJUnit public void testNoProperties() { IDataSetFilter filter = new PropertiesBasedDataSetFilter(new HashMap<String, String>()); - + DataSetBuilder builder = new DataSetBuilder().code("A").type("A").experiment("E"); assertEquals(true, filter.pass(builder.getDataSet())); assertEquals(true, filter.pass(builder.property("a", "alpha").getDataSet())); } - + @Test public void testWithProperties() { HashMap<String, String> properties = new HashMap<String, String>(); properties.put("a", "alpha"); PropertiesBasedDataSetFilter filter = new PropertiesBasedDataSetFilter(properties); - + DataSetBuilder builder = new DataSetBuilder().code("A").type("A").experiment("E"); assertEquals(false, filter.pass(builder.getDataSet())); assertEquals(true, filter.pass(builder.property("a", "alpha").getDataSet())); diff --git a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/shared/api/v1/filter/TypeBasedDataSetFilterTest.java b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/shared/api/v1/filter/TypeBasedDataSetFilterTest.java index 6013c718040..e9f5fb8d7b1 100644 --- a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/shared/api/v1/filter/TypeBasedDataSetFilterTest.java +++ b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/shared/api/v1/filter/TypeBasedDataSetFilterTest.java @@ -22,8 +22,6 @@ import org.testng.annotations.Test; import ch.systemsx.cisd.openbis.generic.shared.api.v1.dto.DataSetBuilder; /** - * - * * @author Franz-Josef Elmer */ public class TypeBasedDataSetFilterTest extends AssertJUnit diff --git a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/shared/basic/BasicURLEncoderTest.java b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/shared/basic/BasicURLEncoderTest.java index e2b2a514924..0b5172fa665 100644 --- a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/shared/basic/BasicURLEncoderTest.java +++ b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/shared/basic/BasicURLEncoderTest.java @@ -29,7 +29,7 @@ public class BasicURLEncoderTest extends AssertJUnit protected Object[][] getChars() { return new Object[][] - { + { /* original char, encoded */ { ' ', "+" }, /* Reserved characters: */ @@ -59,7 +59,7 @@ public class BasicURLEncoderTest extends AssertJUnit { ']', "%5D" }, { '`', "%60" }, - }; + }; } @Test(dataProvider = "chars") diff --git a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/shared/basic/ExpressionUtilTest.java b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/shared/basic/ExpressionUtilTest.java index 422aaa24aef..61a4412faff 100644 --- a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/shared/basic/ExpressionUtilTest.java +++ b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/shared/basic/ExpressionUtilTest.java @@ -58,14 +58,14 @@ public class ExpressionUtilTest extends AssertJUnit String expression = "${abc} ${def} ${abc} ${ghi}."; assertEquals("[abc, def, abc, ghi]", extractParameters(expression).toString()); } - + @Test public void testCreateDistinctParametersList() { assertEquals("[a, b, c]", createDistinctList("a", "b", "a", "c", "b").toString()); } - - private Collection<String> createDistinctList(String...strings) + + private Collection<String> createDistinctList(String... strings) { return ExpressionUtil.createDistinctParametersList(Arrays.asList(strings)); } diff --git a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/shared/basic/Row.java b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/shared/basic/Row.java index caa444ddb01..591bd52e2d4 100644 --- a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/shared/basic/Row.java +++ b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/shared/basic/Row.java @@ -23,8 +23,8 @@ import java.util.Map; import ch.systemsx.cisd.openbis.generic.client.web.client.testframework.CheckTableCommand; /** - * Class which contains all expected cell values to be checked by {@link CheckTableCommand}. It uses - * a fluent API approach for its methods to prepare expectations. + * Class which contains all expected cell values to be checked by {@link CheckTableCommand}. It uses a fluent API approach for its methods to prepare + * expectations. * * @author Franz-Josef Elmer */ diff --git a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/shared/basic/WebAppsPropertiesTest.java b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/shared/basic/WebAppsPropertiesTest.java index 2032666f6ec..aa9c5ff6174 100644 --- a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/shared/basic/WebAppsPropertiesTest.java +++ b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/shared/basic/WebAppsPropertiesTest.java @@ -63,11 +63,11 @@ public class WebAppsPropertiesTest Assert.assertEquals("Web app 1", webApp.getLabel()); Assert.assertEquals(Integer.valueOf(100), webApp.getSorting()); Assert.assertTrue(Arrays.equals(new String[] - { "queries-menu", "experiment-details-view" }, webApp.getContexts())); + { "queries-menu", "experiment-details-view" }, webApp.getContexts())); Assert.assertTrue(Arrays.equals(new String[] - { "EXP1", "EXP2" }, webApp.getEntityTypes().get(EntityKind.EXPERIMENT))); + { "EXP1", "EXP2" }, webApp.getEntityTypes().get(EntityKind.EXPERIMENT))); Assert.assertTrue(Arrays.equals(new String[] - { "SAM1" }, webApp.getEntityTypes().get(EntityKind.SAMPLE))); + { "SAM1" }, webApp.getEntityTypes().get(EntityKind.SAMPLE))); Assert.assertTrue(Arrays.equals(new String[] {}, webApp.getEntityTypes().get(EntityKind.DATA_SET))); Assert.assertTrue(Arrays.equals(new String[] {}, diff --git a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/PrimitiveValueTest.java b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/PrimitiveValueTest.java index 188c295ce38..c3d212a35ec 100644 --- a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/PrimitiveValueTest.java +++ b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/PrimitiveValueTest.java @@ -20,7 +20,7 @@ public class PrimitiveValueTest extends AssertJUnit protected Object[][] getValues() { return new Object[][] - { + { /* NULL == NULL == "" */ { PrimitiveValue.NULL, PrimitiveValue.NULL, ExpectedResult.EQUAL }, { PrimitiveValue.NULL, new PrimitiveValue(""), ExpectedResult.EQUAL }, @@ -74,7 +74,7 @@ public class PrimitiveValueTest extends AssertJUnit { new PrimitiveValue(-10L), new PrimitiveValue(-5.0), ExpectedResult.LOWER }, { new PrimitiveValue(9.9), new PrimitiveValue(10L), ExpectedResult.LOWER }, - }; + }; } @Test(dataProvider = "values") diff --git a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/WebAppTest.java b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/WebAppTest.java index b27786c8709..7c2c27765aa 100644 --- a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/WebAppTest.java +++ b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/WebAppTest.java @@ -55,7 +55,7 @@ public class WebAppTest public void testMatchesContextWithExactMatchInContextsList() { WebApp webApp = new WebApp("webapp", null, null, new String[] - { "experiment-details-view" }, null); + { "experiment-details-view" }, null); for (WebAppContext context : WebAppContext.values()) { @@ -73,7 +73,7 @@ public class WebAppTest public void testMatchesContextWithRegexpMatchInContextsList() { WebApp webApp = new WebApp("webapp", null, null, new String[] - { ".*-details-view" }, null); + { ".*-details-view" }, null); for (WebAppContext context : WebAppContext.values()) { @@ -118,7 +118,7 @@ public class WebAppTest { Map<EntityKind, String[]> entityTypes = new HashMap<EntityKind, String[]>(); entityTypes.put(EntityKind.EXPERIMENT, new String[] - { "EXP0", "EXP1" }); + { "EXP0", "EXP1" }); WebApp webApp = new WebApp("webapp", null, null, null, entityTypes); for (EntityKind kind : EntityKind.values()) @@ -143,7 +143,7 @@ public class WebAppTest { Map<EntityKind, String[]> entityTypes = new HashMap<EntityKind, String[]>(); entityTypes.put(EntityKind.EXPERIMENT, new String[] - { "EXP0", "EXP.*" }); + { "EXP0", "EXP.*" }); WebApp webApp = new WebApp("webapp", null, null, null, entityTypes); for (EntityKind kind : EntityKind.values()) diff --git a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/builders/DataStoreBuilder.java b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/builders/DataStoreBuilder.java index 4c0c9eb24a2..b3b4049b213 100644 --- a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/builders/DataStoreBuilder.java +++ b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/builders/DataStoreBuilder.java @@ -26,12 +26,12 @@ import ch.systemsx.cisd.openbis.generic.shared.basic.dto.DataStore; public class DataStoreBuilder { private DataStore store = new DataStore(); - + public DataStoreBuilder(String dataStoreCode) { store.setCode(dataStoreCode); } - + public DataStoreBuilder hostUrl(String hostUrl) { store.setHostUrl(hostUrl); @@ -43,10 +43,10 @@ public class DataStoreBuilder store.setDownloadUrl(downloadUrl); return this; } - + public DataStore getStore() { return store; } - + } diff --git a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/builders/PropertyBuilder.java b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/builders/PropertyBuilder.java index 3360ea6cbbc..ec4bd3660d0 100644 --- a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/builders/PropertyBuilder.java +++ b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/shared/basic/dto/builders/PropertyBuilder.java @@ -58,8 +58,7 @@ public class PropertyBuilder private final ExtendedEntityProperty property = new ExtendedEntityProperty(); /** - * Creates an instance for specified property type code which also the simple code. Data type is - * {@link DataTypeCode#VARCHAR}. + * Creates an instance for specified property type code which also the simple code. Data type is {@link DataTypeCode#VARCHAR}. */ public PropertyBuilder(String key) { diff --git a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/shared/basic/utils/GroupByMapTest.java b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/shared/basic/utils/GroupByMapTest.java index 47d51e7b841..29fdbe6b264 100644 --- a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/shared/basic/utils/GroupByMapTest.java +++ b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/shared/basic/utils/GroupByMapTest.java @@ -45,7 +45,7 @@ public class GroupByMapTest extends AssertJUnit public void test() { List<Integer> list = Arrays.asList(new Integer[] - { 1, 100, 1, 5, 100, 100 }); + { 1, 100, 1, 5, 100, 100 }); GroupByMap<Integer, Integer> map = GroupByMap.create(list, createKeyExtractor()); assertNull(map.tryGet(9)); diff --git a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/shared/coreplugin/CorePluginsInjectorTest.java b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/shared/coreplugin/CorePluginsInjectorTest.java index 28ffc66e0c5..06b49312679 100644 --- a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/shared/coreplugin/CorePluginsInjectorTest.java +++ b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/shared/coreplugin/CorePluginsInjectorTest.java @@ -104,7 +104,7 @@ public class CorePluginsInjectorTest extends AbstractFileSystemTestCase }; PluginType typeWebapps = new PluginType("webapps", "webapps"); injector = new CorePluginsInjector(ScannerType.DSS, new IPluginType[] - { type1, type2, type3, type4, type5, type6, typeWebapps }, logger); + { type1, type2, type3, type4, type5, type6, typeWebapps }, logger); corePluginsFolder = new File(workingDirectory, "core-plugins"); corePluginsFolder.mkdirs(); corePluginsFolderProperty = diff --git a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/shared/dto/builders/AbstractEntityTypePEBuilder.java b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/shared/dto/builders/AbstractEntityTypePEBuilder.java index 7b8f2e8112e..422849db805 100644 --- a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/shared/dto/builders/AbstractEntityTypePEBuilder.java +++ b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/shared/dto/builders/AbstractEntityTypePEBuilder.java @@ -32,6 +32,6 @@ abstract class AbstractEntityTypePEBuilder propertyType.setCode(propertyTypeCode); return assign(propertyType); } - + public abstract EntityTypePropertyTypePEBuilder assign(PropertyTypePE propertyType); } diff --git a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/shared/dto/builders/SamplePEBuilder.java b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/shared/dto/builders/SamplePEBuilder.java index d90fa34f6c6..f1c8dce02af 100644 --- a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/shared/dto/builders/SamplePEBuilder.java +++ b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/shared/dto/builders/SamplePEBuilder.java @@ -33,51 +33,51 @@ import ch.systemsx.cisd.openbis.generic.shared.dto.SpacePE; public class SamplePEBuilder { private final SamplePE sample = new SamplePE(); - + public SamplePEBuilder() { } - + public SamplePEBuilder(long id) { sample.setId(id); } - + public SamplePE getSample() { return sample; } - + public SamplePEBuilder id(long id) { sample.setId(id); return this; } - + public SamplePEBuilder code(String code) { sample.setCode(code); return this; } - + public SamplePEBuilder space(SpacePE space) { sample.setSpace(space); return this; } - + public SamplePEBuilder permID(String permID) { sample.setPermId(permID); return this; } - + public SamplePEBuilder type(SampleTypePE type) { sample.setSampleType(type); return this; } - + public SamplePEBuilder property(String code, DataTypeCode dataType, String value) { SampleTypePEBuilder sampleTypeBuilder = new SampleTypePEBuilder().code("my-type"); @@ -87,7 +87,7 @@ public class SamplePEBuilder sampleTypeBuilder.assign(propertyType).getEntityTypePropertyType(); return property(etpt, value); } - + public SamplePEBuilder property(EntityTypePropertyTypePE etpt, String value) { SamplePropertyPE property = new SamplePropertyPE(); @@ -95,14 +95,11 @@ public class SamplePEBuilder property.setValue(value); return property(property); } - + public SamplePEBuilder property(SamplePropertyPE property) { sample.addProperty(property); return this; } - - - - + } diff --git a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/shared/managed_property/JythonManagedPropertyEvaluatorTest.java b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/shared/managed_property/JythonManagedPropertyEvaluatorTest.java index 9bc6e4b70e0..fb5b95fa596 100644 --- a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/shared/managed_property/JythonManagedPropertyEvaluatorTest.java +++ b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/shared/managed_property/JythonManagedPropertyEvaluatorTest.java @@ -234,7 +234,7 @@ public class JythonManagedPropertyEvaluatorTest extends AssertJUnit widgetFactory.createMultilineTextInputField("multi").setValue("multi\nline\ninput"); IManagedInputWidgetDescription action1w4 = widgetFactory.createComboBoxInputField("combo", new String[] - { "cv1", "cv2", "cv3" }).setValue("cv1"); + { "cv1", "cv2", "cv3" }).setValue("cv1"); action1.addInputWidgets(action1w1, action1w2, action1w3, action1w4); assertEquals(null, action1.getInputValue("t1")); assertEquals("v2", action1.getInputValue("t2")); diff --git a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/shared/parser/NewSampleParserObjectFactoryTest.java b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/shared/parser/NewSampleParserObjectFactoryTest.java index bd98454124a..dbb82fc0f57 100644 --- a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/shared/parser/NewSampleParserObjectFactoryTest.java +++ b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/shared/parser/NewSampleParserObjectFactoryTest.java @@ -55,7 +55,7 @@ public final class NewSampleParserObjectFactoryTest private final static IPropertyMapper createPropertyMapper() { final String[] properties = new String[] - { "!toBeIgnored", "identifier", "container", "parent", "prop1", "prop2" }; + { "!toBeIgnored", "identifier", "container", "parent", "prop1", "prop2" }; final DefaultPropertyMapper propertyMapper = new DefaultPropertyMapper(properties, null); return propertyMapper; } @@ -63,7 +63,7 @@ public final class NewSampleParserObjectFactoryTest private final static IPropertyMapper createPropertyMapperWithoutIdentifier() { final String[] properties = new String[] - { "prop1", "prop2" }; + { "prop1", "prop2" }; final DefaultPropertyMapper propertyMapper = new DefaultPropertyMapper(properties, null); return propertyMapper; } @@ -97,29 +97,29 @@ public final class NewSampleParserObjectFactoryTest private final static Object[][] getLineTokensForAutoGeneratedCodes() { return new Object[][] - { - { new String[] - { "", "" }, 0 }, - { new String[] - { null, null }, 0 }, - { new String[] - { "1", "hello" }, 2 }, + { + { new String[] + { "", "" }, 0 }, + { new String[] + { null, null }, 0 }, + { new String[] + { "1", "hello" }, 2 }, }; -} + } @DataProvider private final static Object[][] getLineTokens() { return new Object[][] - { - { new String[] - { "", "", "", "", "", "" }, 0 }, - { new String[] - { "ignoreMe", "id1", "cont1", "par1", "1", "hello" }, 2 }, + { + { new String[] + { "", "", "", "", "", "" }, 0 }, + { new String[] + { "ignoreMe", "id1", "cont1", "par1", "1", "hello" }, 2 }, }; -} + } @Test(dataProvider = "getLineTokens") public final void testFailCreateObjectForAutoGeneratedCodesWithIdentifierSpecified( diff --git a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/shared/parser/UpdatedSampleParserObjectFactoryTest.java b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/shared/parser/UpdatedSampleParserObjectFactoryTest.java index f15efeb94e4..c12f4f08b9c 100644 --- a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/shared/parser/UpdatedSampleParserObjectFactoryTest.java +++ b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/shared/parser/UpdatedSampleParserObjectFactoryTest.java @@ -60,7 +60,7 @@ public final class UpdatedSampleParserObjectFactoryTest private final static IPropertyMapper createPropertyMapper() { final String[] properties = new String[] - { Identifier.IDENTIFIER_COLUMN, NewSample.CONTAINER, PROPERTY_1, PROPERTY_2 }; + { Identifier.IDENTIFIER_COLUMN, NewSample.CONTAINER, PROPERTY_1, PROPERTY_2 }; final DefaultPropertyMapper propertyMapper = new DefaultPropertyMapper(properties, null); return propertyMapper; } @@ -69,19 +69,19 @@ public final class UpdatedSampleParserObjectFactoryTest private final static Object[][] getLineTokens() { return new Object[][] - { - { new String[] - { "", "", "", "" }, 0, 0 }, - { new String[] - { "id1", "cont1", "1", "hello" }, 2, 2 }, - { new String[] - { "id1", "", "1", "" }, 1, 1 }, - { new String[] - { "", "cont1", "", "hello" }, 1, 1 }, - { new String[] - { "id1", "cont1", "--DELETE--", "__DELETE__" }, 0, 2 }, - { new String[] - { "__DELETE__", "--DELETE--", "--DELETE--", "hello" }, 1, 2 } }; + { + { new String[] + { "", "", "", "" }, 0, 0 }, + { new String[] + { "id1", "cont1", "1", "hello" }, 2, 2 }, + { new String[] + { "id1", "", "1", "" }, 1, 1 }, + { new String[] + { "", "cont1", "", "hello" }, 1, 1 }, + { new String[] + { "id1", "cont1", "--DELETE--", "__DELETE__" }, 0, 2 }, + { new String[] + { "__DELETE__", "--DELETE--", "--DELETE--", "hello" }, 1, 2 } }; } @Test(dataProvider = "getLineTokens") diff --git a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/shared/util/CacheManagerTest.java b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/shared/util/CacheManagerTest.java index f58fb553850..766a8041fd2 100644 --- a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/shared/util/CacheManagerTest.java +++ b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/shared/util/CacheManagerTest.java @@ -43,23 +43,27 @@ import ch.systemsx.cisd.common.utilities.ITimeProvider; import ch.systemsx.cisd.openbis.generic.shared.basic.dto.WebClientConfiguration; /** - * - * * @author Franz-Josef Elmer */ -@Friend(toClasses=CacheManager.class) +@Friend(toClasses = CacheManager.class) public class CacheManagerTest extends AbstractFileSystemTestCase { private static final String TECHNOLOGY = "test-technology"; + private static final String CACHE_VERSION = "42"; + private static final long DAY = 24 * 60 * 60 * 1000; - + private Mockery context; + private IFreeSpaceProvider freeSpaceProvider; + private WebClientConfiguration webClientConfiguration; + private File cacheFolder; + private ITimeProvider timeProvider; - + @BeforeMethod public void beforeMethod() { @@ -83,29 +87,29 @@ public class CacheManagerTest extends AbstractFileSystemTestCase // Otherwise one do not known which test failed. context.assertIsSatisfied(); } - + @Test public void testEmptyCache() { CacheManager cacheManager = createCacheManager(); - + Object data = cacheManager.tryToGetData(new Key("a")); - + assertEquals(null, data); checkCacheFolder(CACHE_VERSION); context.assertIsSatisfied(); } - + @Test public void testStoreDataButNotEnoughMemory() { prepareTimeProvider(1L, 2L, 3L); prepareFreeSpaceProvider(0L); CacheManager cacheManager = createCacheManager(); - + String data = "hello"; cacheManager.storeData(new Key("a"), data); - + assertEquals(null, cacheManager.tryToGetData(new Key("a"))); checkCacheFolder(CACHE_VERSION); context.assertIsSatisfied(); @@ -117,10 +121,10 @@ public class CacheManagerTest extends AbstractFileSystemTestCase prepareTimeProvider(1L, 2L, 3L, 4L, 5L, 6L, 7L, 8L, 9L, 10L); prepareFreeSpaceProvider(2048L, 2048L); CacheManager cacheManager = createCacheManager(); - + String data = "hello"; cacheManager.storeData(new Key("a"), data); - + assertEquals(data, cacheManager.tryToGetData(new Key("a"))); checkCacheFolder(CACHE_VERSION, "19700101010000007-1"); assertEquals(data, cacheManager.tryToGetData(new Key("a"))); @@ -128,76 +132,76 @@ public class CacheManagerTest extends AbstractFileSystemTestCase checkCacheFolder(CACHE_VERSION, "19700101010000010-2"); context.assertIsSatisfied(); } - + @Test public void testStoreShutdownAndRetrieveFromCache() { prepareTimeProvider(1L, 2L, 3L, 4L, 5L, 6L, 7L); prepareFreeSpaceProvider(2048L, 2048L); CacheManager cacheManager = createCacheManager(); - + String data = "hello"; cacheManager.storeData(new Key("a"), data); - + cacheManager = createCacheManager(); assertEquals(data, cacheManager.tryToGetData(new Key("a"))); assertEquals(null, cacheManager.tryToGetData(new Key("b"))); checkCacheFolder(CACHE_VERSION, "19700101010000007-0"); context.assertIsSatisfied(); } - + @Test public void testStoreShutdownAndTryToRetrieveFromCacheWithChangedCacheVersion() { prepareTimeProvider(1L, 2L, 3L, 4L); prepareFreeSpaceProvider(2048L, 2048L); CacheManager cacheManager = createCacheManager("1"); - + String data = "hello"; cacheManager.storeData(new Key("a"), data); - + cacheManager = createCacheManager("2"); assertEquals(null, cacheManager.tryToGetData(new Key("a"))); checkCacheFolder("2"); context.assertIsSatisfied(); } - + @Test public void testCleanUpForLargeFiles() { prepareTimeProvider(1L, 2L, 3L, 4L, 5L, 6L, 7L, 8L, 9L, 10L, 11L); prepareFreeSpaceProvider(2048L, 2048L, 0L, 2048L, 2048L); CacheManager cacheManager = createCacheManager(); - + String data1 = "hello"; cacheManager.storeData(new Key("a"), data1); String data2 = "hi"; cacheManager.storeData(new Key("b"), data2); - + assertEquals(null, cacheManager.tryToGetData(new Key("a"))); assertEquals(data2, cacheManager.tryToGetData(new Key("b"))); checkCacheFolder(CACHE_VERSION, "19700101010000011-1"); context.assertIsSatisfied(); } - + @Test public void testCleanUpForOldFiles() { prepareTimeProvider(1L, 2L, 3L, 4L, DAY + 5L, DAY + 6L, DAY + 7L, DAY + 8L, DAY + 9L, DAY + 10L, DAY + 11L); prepareFreeSpaceProvider(2048L, 2048L, 2048L, 2048L); CacheManager cacheManager = createCacheManager(); - + String data1 = "hello"; cacheManager.storeData(new Key("a"), data1); String data2 = "hi"; cacheManager.storeData(new Key("b"), data2); - + assertEquals(null, cacheManager.tryToGetData(new Key("a"))); assertEquals(data2, cacheManager.tryToGetData(new Key("b"))); checkCacheFolder(CACHE_VERSION, "19700102010000011-1"); context.assertIsSatisfied(); } - + private void checkCacheFolder(String cacheVersion, String... fileNames) { File versionFile = new File(cacheFolder, CacheManager.CACHE_VERSION_FILE_NAME); @@ -259,7 +263,7 @@ public class CacheManagerTest extends AbstractFileSystemTestCase } }); } - + private CacheManager createCacheManager() { return createCacheManager(CACHE_VERSION); diff --git a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/shared/util/EntityHelperTest.java b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/shared/util/EntityHelperTest.java index b9ac343c65d..0c5d9942da4 100644 --- a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/shared/util/EntityHelperTest.java +++ b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/shared/util/EntityHelperTest.java @@ -42,7 +42,7 @@ public class EntityHelperTest extends AssertJUnit assertEquals(1, properties.size()); assertEquals("A", properties.get(0).getPropertyCode()); } - + @Test public void testEqualEntities() { diff --git a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/plugin/generic/client/web/client/application/dataset/CheckDataSet.java b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/plugin/generic/client/web/client/application/dataset/CheckDataSet.java index e41a350862f..e54a0f5da6d 100644 --- a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/plugin/generic/client/web/client/application/dataset/CheckDataSet.java +++ b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/plugin/generic/client/web/client/application/dataset/CheckDataSet.java @@ -25,8 +25,7 @@ import ch.systemsx.cisd.openbis.generic.shared.basic.TechId; import ch.systemsx.cisd.openbis.generic.shared.basic.dto.DataSetRelationshipRole; /** - * * {@link AbstractDefaultTestCommand} extension checking e.g. properties displayed in data set - * detail view. + * * {@link AbstractDefaultTestCommand} extension checking e.g. properties displayed in data set detail view. * * @author Piotr Buczek */ diff --git a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/plugin/generic/client/web/client/application/dataset/GenericDataSetViewerTest.java b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/plugin/generic/client/web/client/application/dataset/GenericDataSetViewerTest.java index ce7bb7e795f..1f2867552da 100644 --- a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/plugin/generic/client/web/client/application/dataset/GenericDataSetViewerTest.java +++ b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/plugin/generic/client/web/client/application/dataset/GenericDataSetViewerTest.java @@ -70,7 +70,7 @@ public class GenericDataSetViewerTest extends AbstractGWTTestCase { final String parentCodes[] = {}; final String childCodes[] = - { "20081105092259000-9" }; + { "20081105092259000-9" }; prepareShowDataSet(PARENT_DATASET_CODE_WITH_SAMPLE); @@ -103,10 +103,10 @@ public class GenericDataSetViewerTest extends AbstractGWTTestCase public final void testShowExperimentDataSetWithParents() { final String parentCodes[] = - { "20081105092158673-1", "20081105092159111-1", "20081105092159222-2", - "20081105092159333-3" }; + { "20081105092158673-1", "20081105092159111-1", "20081105092159222-2", + "20081105092159333-3" }; final String childCodes[] = - { "20081105092259900-0", "20081105092259900-1" }; + { "20081105092259900-0", "20081105092259900-1" }; prepareShowDataSet(CHILD_DATASET_CODE); diff --git a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/plugin/generic/client/web/client/application/experiment/GenericExperimentRegistrationTest.java b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/plugin/generic/client/web/client/application/experiment/GenericExperimentRegistrationTest.java index 47c5779edd6..ccd00a4074a 100644 --- a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/plugin/generic/client/web/client/application/experiment/GenericExperimentRegistrationTest.java +++ b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/plugin/generic/client/web/client/application/experiment/GenericExperimentRegistrationTest.java @@ -36,7 +36,6 @@ import ch.systemsx.cisd.openbis.systemtest.plugin.generic.ExperimentRegistration /** * A {@link AbstractGWTTestCase} extension to test {@link GenericExperimentRegistrationForm}. * - * * @author Izabela Adamczyk * @see ExperimentRegistrationTest */ diff --git a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/plugin/generic/client/web/client/application/experiment/GenericExperimentViewerTest.java b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/plugin/generic/client/web/client/application/experiment/GenericExperimentViewerTest.java index c54f062bb2d..bd05e4e3089 100644 --- a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/plugin/generic/client/web/client/application/experiment/GenericExperimentViewerTest.java +++ b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/plugin/generic/client/web/client/application/experiment/GenericExperimentViewerTest.java @@ -125,9 +125,8 @@ public class GenericExperimentViewerTest extends AbstractGWTTestCase /** * Tests that authorization annotations of - * {@link ICommonServer#getExperimentInfo(String, ch.systemsx.cisd.openbis.generic.shared.dto.identifier.ExperimentIdentifier)} - * are obeyed. This is done by a direct invocation of - * {@link ICommonClientServiceAsync#getExperimentInfo(String,com.google.gwt.user.client.rpc.AsyncCallback)} + * {@link ICommonServer#getExperimentInfo(String, ch.systemsx.cisd.openbis.generic.shared.dto.identifier.ExperimentIdentifier)} are obeyed. This + * is done by a direct invocation of {@link ICommonClientServiceAsync#getExperimentInfo(String,com.google.gwt.user.client.rpc.AsyncCallback)} * because the normal GUI only list experiments which are accessible by the user. */ public final void testDirectInvocationOfGetExperimentInfoByAnUnauthorizedUser() diff --git a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/plugin/generic/client/web/client/application/sample/GenericSampleRegistrationTest.java b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/plugin/generic/client/web/client/application/sample/GenericSampleRegistrationTest.java index 7475245ee0e..5f917575d33 100644 --- a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/plugin/generic/client/web/client/application/sample/GenericSampleRegistrationTest.java +++ b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/plugin/generic/client/web/client/application/sample/GenericSampleRegistrationTest.java @@ -90,8 +90,7 @@ public class GenericSampleRegistrationTest extends AbstractGWTTestCase } /** - * Tests that authorization annotations of {@link IGenericClientService#registerSample} are - * obeyed. + * Tests that authorization annotations of {@link IGenericClientService#registerSample} are obeyed. */ public final void testRegisterSampleByAnUnauthorizedUser() { diff --git a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/plugin/generic/client/web/client/application/sample/GenericSampleViewerTest.java b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/plugin/generic/client/web/client/application/sample/GenericSampleViewerTest.java index 3d0b2cd1f8a..6397aef9a23 100644 --- a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/plugin/generic/client/web/client/application/sample/GenericSampleViewerTest.java +++ b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/plugin/generic/client/web/client/application/sample/GenericSampleViewerTest.java @@ -219,7 +219,7 @@ public class GenericSampleViewerTest extends AbstractGWTTestCase final String differentExperimentIdentifier = "/CISD/DEFAULT/EXP-REUSE"; assert differentExperimentIdentifier.equals(CELL_PLATE_EXAMPLE_EXPERIMENT_ID) == false; final String[] indirectlyConnectedDataSetLocations = - { "xml/result-9", "xml/result-10", "xml/result-11", "xml/result-12" }; + { "xml/result-9", "xml/result-10", "xml/result-11", "xml/result-12" }; for (String location : indirectlyConnectedDataSetLocations) { checkIndirectlyConnectedDataTable.expectedRow(new DataSetRow().valid().withSample("") diff --git a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/plugin/generic/client/web/client/application/sample/Property.java b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/plugin/generic/client/web/client/application/sample/Property.java index 268b2dc2b0e..2c0bb379f24 100644 --- a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/plugin/generic/client/web/client/application/sample/Property.java +++ b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/plugin/generic/client/web/client/application/sample/Property.java @@ -24,18 +24,17 @@ import ch.systemsx.cisd.openbis.generic.shared.basic.dto.Person; import ch.systemsx.cisd.openbis.generic.shared.basic.dto.Sample; /** - * Extends {@link AbstractProperty} with methods for {@link Person} and arrays of generated - * {@link Sample}. + * Extends {@link AbstractProperty} with methods for {@link Person} and arrays of generated {@link Sample}. * * @author Franz-Josef Elmer */ -public class Property extends AbstractProperty<CheckSample> +public class Property extends AbstractProperty<CheckSample> { public Property(String key, CheckSample checker) { super(key, checker); } - + public CheckSample asPerson(final String personAsString) { return by(new IValueAssertion<Person>() @@ -48,7 +47,7 @@ public class Property extends AbstractProperty<CheckSample> } }); } - + public CheckSample asGeneratedSamples(final String... samples) { return by(new IValueAssertion<Sample[]>() @@ -67,5 +66,5 @@ public class Property extends AbstractProperty<CheckSample> } }); } - + } diff --git a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/remoteapitest/RemoteApiTestCase.java b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/remoteapitest/RemoteApiTestCase.java index df7fad3bb85..c95ce5c86a6 100644 --- a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/remoteapitest/RemoteApiTestCase.java +++ b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/remoteapitest/RemoteApiTestCase.java @@ -37,9 +37,8 @@ import ch.systemsx.cisd.openbis.generic.server.util.TestInitializer; import ch.systemsx.cisd.openbis.generic.shared.util.TestInstanceHostUtils; /** - * Test cases which have access to the public API services of a running, fully-fledged openBIS - * server. The tests do not see the server internals and thus they must employ black-box testing - * strategies. + * Test cases which have access to the public API services of a running, fully-fledged openBIS server. The tests do not see the server internals and + * thus they must employ black-box testing strategies. * * @author Kaloyan Enimanev */ diff --git a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/systemtest/AbstractDataSetAssignmentTestCase.java b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/systemtest/AbstractDataSetAssignmentTestCase.java index d20b983fa63..4d04313cc8c 100644 --- a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/systemtest/AbstractDataSetAssignmentTestCase.java +++ b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/systemtest/AbstractDataSetAssignmentTestCase.java @@ -131,6 +131,7 @@ public abstract class AbstractDataSetAssignmentTestCase extends BaseTest return RolePermutator.getAcceptedPermutations(assignDataSetToExperimentRule, source, destination, instance); } + @DataProvider public Object[][] rolesNotAllowedToAssignDataSetToExperiment() { diff --git a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/systemtest/AbstractEntityDeletionTestCase.java b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/systemtest/AbstractEntityDeletionTestCase.java index f97bda93c2f..847f9e2ebac 100644 --- a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/systemtest/AbstractEntityDeletionTestCase.java +++ b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/systemtest/AbstractEntityDeletionTestCase.java @@ -51,10 +51,10 @@ public abstract class AbstractEntityDeletionTestCase extends BaseTest { EntityGraphGenerator g = parseAndCreateGraph( "E1, samples: S50, data sets: DS60 DS61\n" - + "E2, samples: S51\n" - + "E3\n" + + "E2, samples: S51\n" + + "E3\n" ); - + deleteExperiments(g.e(1), g.e(2), g.e(3)); assertEquals("", renderGraph(g)); @@ -63,7 +63,7 @@ public abstract class AbstractEntityDeletionTestCase extends BaseTest assertDeleted(g.ds(60), g.ds(61)); assertUnmodifiedAndUndeleted(g); } - + @Test public final void testTrashExperimentsWithDeepDependencies() { @@ -82,22 +82,22 @@ public abstract class AbstractEntityDeletionTestCase extends BaseTest assertDeleted(g.ds(60), g.ds(61), g.ds(70), g.ds(71)); assertUnmodifiedAndUndeleted(g); } - + @Test public final void testTrashExperimentWithSampleWhichIsAComponentOfASpaceSample() { EntityGraphGenerator g = parseAndCreateGraph("E1, samples: S2\n" + "S1, components: S2\n"); - + deleteExperiments(g.e(1)); - + assertEquals("", renderGraph(g)); assertModified(g.s(1)); assertDeleted(g.e(1)); assertDeleted(g.s(2)); assertUnmodifiedAndUndeleted(g); } - + @Test public void testTrashExperimentWithSampleWhichHasAChild() { @@ -105,14 +105,14 @@ public abstract class AbstractEntityDeletionTestCase extends BaseTest + "S1, children: S3\n"); deleteExperiments(g.e(1)); - + assertEquals("", renderGraph(g)); assertDeleted(g.e(1)); assertDeleted(g.s(1)); assertModified(g.s(3)); assertUnmodifiedAndUndeleted(g); } - + @Test @Rollback(false) public final void testTrashExperimentWithSampleAndDataSet() @@ -121,14 +121,14 @@ public abstract class AbstractEntityDeletionTestCase extends BaseTest + "S1, data sets: DS1\n", false); deleteExperiments(g.e(1)); - + assertEquals("", renderGraph(g)); assertDeleted(g.e(1)); assertDeleted(g.s(1)); assertDeleted(g.ds(1)); assertUnmodifiedAndUndeleted(g); } - + @Test public final void testTrashExperimentsWithSampleAndDataSetsAndNoExternalLinks() { @@ -136,16 +136,16 @@ public abstract class AbstractEntityDeletionTestCase extends BaseTest + "E2, data sets: DS2\n" + "S1, data sets: DS1\n" + "DS1, components: DS2\n"); - + deleteExperiments(g.e(1), g.e(2)); - + assertEquals("", renderGraph(g)); assertDeleted(g.e(1), g.e(2)); assertDeleted(g.s(1)); assertDeleted(g.ds(1), g.ds(2)); assertUnmodifiedAndUndeleted(g); } - + @Test public final void testTrashExperimentWithARelatedDataSetComponentWhichBelongsToAnExternalExperiment() { @@ -153,16 +153,16 @@ public abstract class AbstractEntityDeletionTestCase extends BaseTest + "E2, data sets: DS2\n" + "S1, data sets: DS1\n" + "DS1, components: DS2\n"); - + deleteExperiments(g.e(1)); - + assertEquals("E2, data sets: DS2\n", renderGraph(g)); assertDeleted(g.e(1)); assertDeleted(g.s(1)); assertDeleted(g.ds(1)); assertUnmodifiedAndUndeleted(g); } - + @Test @Rollback(true) public final void testTrashExperimentWithARelatedDataSetInAnExternalContainer() @@ -171,16 +171,16 @@ public abstract class AbstractEntityDeletionTestCase extends BaseTest + "E2, data sets: DS2\n" + "S1, data sets: DS1\n" + "DS1, components: DS2\n", false); - + failTrashExperiment(g.e(2), createExpectedErrorMessage(g.ds(2), g.ds(1), g.s(1))); - + assertEquals("E1, samples: S1, data sets: DS1\n" + "E2, data sets: DS2\n" + "S1, data sets: DS1\n" + "DS1, components: DS2\n", renderGraph(g)); assertUnmodifiedAndUndeleted(g); } - + @Test public void testTrashPublishedExperiment() { @@ -190,9 +190,9 @@ public abstract class AbstractEntityDeletionTestCase extends BaseTest + "DS2, components: DS6\n" + "DS3, components: DS4\n" + "DS5, parents: DS6\n"); - + deleteExperiments(g.e(2)); - + assertEquals("E1, data sets: DS3 DS4 DS5 DS6\n" + "DS3, components: DS4\n" + "DS5, parents: DS6\n", renderGraph(g)); @@ -200,7 +200,7 @@ public abstract class AbstractEntityDeletionTestCase extends BaseTest assertDeleted(g.ds(1), g.ds(2)); assertUnmodifiedAndUndeleted(g); } - + @Test public final void testTrashPublishedExperimentWithOrginalExperimentWithSamples() { @@ -210,9 +210,9 @@ public abstract class AbstractEntityDeletionTestCase extends BaseTest + "DS1, components: DS2\n" + "DS2, components: DS3\n" ); - + deleteExperiments(g.e(2)); - + assertEquals("E1, samples: S1, data sets: DS2 DS3\n" + "S1, data sets: DS2 DS3\n" + "DS2, components: DS3\n", renderGraph(g)); @@ -220,7 +220,7 @@ public abstract class AbstractEntityDeletionTestCase extends BaseTest assertDeleted(g.ds(1)); assertUnmodifiedAndUndeleted(g); } - + @Test @Rollback(true) public final void testTrashOrginalExperimentWithSample() @@ -230,9 +230,9 @@ public abstract class AbstractEntityDeletionTestCase extends BaseTest + "S1, data sets: DS2 DS3\n" + "DS1, components: DS2\n" + "DS2, components: DS3\n", false); - + failTrashExperiment(g.e(1), createExpectedErrorMessage(g.ds(2), g.ds(1), g.e(2))); - + assertEquals("E1, samples: S1, data sets: DS2 DS3\n" + "E2, data sets: DS1\n" + "S1, data sets: DS2 DS3\n" @@ -240,28 +240,27 @@ public abstract class AbstractEntityDeletionTestCase extends BaseTest + "DS2, components: DS3\n", renderGraph(g)); assertUnmodifiedAndUndeleted(g); } - + @Test public final void testTrashExperimentsWithContainerDataSetWithPhysicalDataSetFromAnotherExperiment() { EntityGraphGenerator g = parseAndCreateGraph("E1, data sets: DS1\n" + "E2, data sets: DS2\n" + "DS1, components: DS2\n"); - + deleteExperiments(g.e(1)); - + assertEquals("E2, data sets: DS2\n", renderGraph(g)); assertDeleted(g.e(1)); assertDeleted(g.ds(1)); assertUnmodifiedAndUndeleted(g); } - + @Test public final void testTrashSamplesAlreadyTrashed() { EntityGraphGenerator g = parseAndCreateGraph("S1\nS2\n"); - - + assertEquals("", renderGraph(g)); assertUnmodifiedAndUndeleted(g); } @@ -272,135 +271,135 @@ public abstract class AbstractEntityDeletionTestCase extends BaseTest EntityGraphGenerator g = parseAndCreateGraph("S1, components: S20\n" + "S3, data sets: DS60[NET]\n" + "S20, data sets: DS61[NET]\n"); - + deleteSamples(g.s(1), g.s(3)); - + assertEquals("", renderGraph(g)); assertDeleted(g.s(1), g.s(3), g.s(20)); assertDeleted(g.ds(60), g.ds(61)); assertUnmodifiedAndUndeleted(g); } - + @Test public final void testTrashSampleWithTwoLevelOfDependencies() { EntityGraphGenerator g = parseAndCreateGraph("S1, components: S2 S3, data sets: DS1[NET]\n" + "S2, data sets: DS2[NET]\n" + "S3, data sets: DS3[NET]\n"); - + deleteSamples(g.s(1)); - + assertEquals("", renderGraph(g)); assertDeleted(g.s(1), g.s(2), g.s(3)); assertDeleted(g.ds(1), g.ds(2), g.ds(3)); assertUnmodifiedAndUndeleted(g); } - + @Test public final void testTrashComponentSample() { EntityGraphGenerator g = parseAndCreateGraph("E1, samples: S2\n" + "S1, components: S2\n"); - + deleteSamples(g.s(2)); - + assertEquals("", renderGraph(g)); assertDeleted(g.s(2)); assertModified(g.e(1)); assertModified(g.s(1)); assertUnmodifiedAndUndeleted(g); } - + @Test public final void testTrashSampleWithAComponentWithAContainerDataSetWithAComponentDataSetOfFirstSample() { EntityGraphGenerator g = parseAndCreateGraph("S1, components: S2, data sets: DS2[NET]\n" + "S2, data sets: DS1[NECT]\n" + "DS1[NECT], components: DS2[NET]\n"); - + deleteSamples(g.s(1)); - + assertEquals("", renderGraph(g)); assertDeleted(g.s(1), g.s(2)); assertDeleted(g.ds(1), g.ds(2)); assertUnmodifiedAndUndeleted(g); } - + @Test public final void testTrashSampleWithAComponentWithAComponentDataSetOfAContainerDataSetOfFirstSample() { EntityGraphGenerator g = parseAndCreateGraph("S1, components: S2, data sets: DS1[NECT]\n" + "S2, data sets: DS2[NET]\n" + "DS1[NECT], components: DS2[NET]\n"); - + deleteSamples(g.s(1)); - + assertEquals("", renderGraph(g)); assertDeleted(g.s(1), g.s(2)); assertDeleted(g.ds(1), g.ds(2)); assertUnmodifiedAndUndeleted(g); } - + @Test public final void testTrashSampleWithAnExperimentSample() { EntityGraphGenerator g = parseAndCreateGraph("E1, samples: S2\n" + "S1, components: S2\n"); - + deleteSamples(g.s(1)); - + assertEquals("", renderGraph(g)); assertDeleted(g.s(1), g.s(2)); assertModified(g.e(1)); assertUnmodifiedAndUndeleted(g); } - + @Test public final void testTrashSampleWithAnExperimentSampleWithADataSet() { EntityGraphGenerator g = parseAndCreateGraph("E1, samples: S2, data sets: DS1\n" + "S1, components: S2\n" + "S2, data sets: DS1\n"); - + deleteSamples(g.s(1)); - + assertEquals("", renderGraph(g)); assertDeleted(g.s(1), g.s(2)); assertDeleted(g.ds(1)); assertModified(g.e(1)); assertUnmodifiedAndUndeleted(g); } - + @Test public final void testTrashExperimentSampleWithADataSet() { EntityGraphGenerator g = parseAndCreateGraph("E1, samples: S1, data sets: DS1\n" + "S1, data sets: DS1\n"); - + deleteSamples(g.s(1)); - + assertEquals("", renderGraph(g)); assertModified(g.e(1)); assertDeleted(g.s(1)); assertDeleted(g.ds(1)); assertUnmodifiedAndUndeleted(g); } - + @Test public final void testTrashExperimentSampleWhichIsAComponentOfASpaceSample() { EntityGraphGenerator g = parseAndCreateGraph("E1, samples: S2\n" + "S1, components: S2\n"); - + deleteSamples(g.s(2)); - + assertEquals("", renderGraph(g)); assertModified(g.e(1)); assertModified(g.s(1)); assertDeleted(g.s(2)); assertUnmodifiedAndUndeleted(g); } - + @Test @Rollback(true) public final void testTrashSampleWithComponentWithDataSetWithComponentOfAnotherSample() @@ -409,16 +408,16 @@ public abstract class AbstractEntityDeletionTestCase extends BaseTest + "S2, data sets: DS2[NET]\n" + "S3, data sets: DS1[NECT]\n" + "DS1[NECT], components: DS2[NET]\n", false); - + failTrashSample(g.s(1), createExpectedErrorMessage(g.ds(2), g.ds(1), g.s(3))); - + assertEquals("S1, components: S2\n" + "S2, data sets: DS2[NET]\n" + "S3, data sets: DS1[NECT]\n" + "DS1[NECT], components: DS2[NET]\n", renderGraph(g)); assertUnmodifiedAndUndeleted(g); } - + @Test @Rollback(true) public final void testTrashSampleWithComponentWithDataSetWithComponentOfAnotherExperiment() @@ -427,16 +426,16 @@ public abstract class AbstractEntityDeletionTestCase extends BaseTest + "S1, components: S2\n" + "S2, data sets: DS2[NET]\n" + "DS1, components: DS2[NET]\n", false); - + failTrashSample(g.s(1), createExpectedErrorMessage(g.ds(2), g.ds(1), g.e(1))); - + assertEquals("E1, data sets: DS1\n" + "S1, components: S2\n" + "S2, data sets: DS2[NET]\n" + "DS1, components: DS2[NET]\n", renderGraph(g)); assertUnmodifiedAndUndeleted(g); } - + @Test @Rollback(true) public void testTrashSampleWithDataSetWithDataSetComponentIndirectlyDependentOnOutsideContainer() @@ -446,9 +445,9 @@ public abstract class AbstractEntityDeletionTestCase extends BaseTest + "DS1[NECT], components: DS3[NET] DS4[NECT] DS5[NET]\n" + "DS2[NECT], components: DS4[NECT]\n" + "DS4[NECT], components: DS5[NET] DS6[NET]\n", false); - + failTrashSample(g.s(1), createExpectedErrorMessage(g.ds(4), g.ds(2), g.s(2))); - + assertEquals("S1, data sets: DS1[NECT] DS3[NET] DS4[NECT] DS5[NET] DS6[NET]\n" + "S2, data sets: DS2[NECT]\n" + "DS1[NECT], components: DS3[NET] DS4[NECT] DS5[NET]\n" @@ -456,20 +455,20 @@ public abstract class AbstractEntityDeletionTestCase extends BaseTest + "DS4[NECT], components: DS5[NET] DS6[NET]\n", renderGraph(g)); assertUnmodifiedAndUndeleted(g); } - + @Test @Rollback(true) public void testTrashSampleWithComponentsFromAnInvisibleSpace() { EntityGraphGenerator g = parseAndCreateGraph("/S1/S1, components: /S2/S2\n", false); - SessionBuilder sessionBuilder = aSession().withSpaceRole(RoleWithHierarchy.SPACE_ADMIN, + SessionBuilder sessionBuilder = aSession().withSpaceRole(RoleWithHierarchy.SPACE_ADMIN, entityGraphManager.getSample(g.s(1)).getSpace()); String userSessionToken = create(sessionBuilder); - + String userID = sessionBuilder.getUserID(); String sample = entityGraphManager.getSample(g.s(2)).getIdentifier(); failTrashSample(userSessionToken, g.s(1), createExpectedErrorMessage(userID, sample)); - + assertEquals("/S1/S1, components: /S2/S2\n", renderGraph(g)); assertUnmodifiedAndUndeleted(g); } @@ -480,54 +479,54 @@ public abstract class AbstractEntityDeletionTestCase extends BaseTest EntityGraphGenerator g = parseAndCreateGraph("S1, data sets: DS1[NECT] DS2[NECT] DS3[NET] DS4[NET] DS5[NET] DS6[NET]\n" + "DS1[NECT], components: DS5[NET]\n" + "DS2[NECT], components: DS6[NET]\n"); - + deleteDataSets(g.ds(1), g.ds(2), g.ds(3)); - + assertEquals("S1, data sets: DS4[NET]\n", renderGraph(g)); assertModified(g.s(1)); assertDeleted(g.ds(1), g.ds(2), g.ds(3), g.ds(5), g.ds(6)); assertUnmodifiedAndUndeleted(g); } - + @Test public final void testTrashDataSetAndComponentsBelongingToSameExperiment() { EntityGraphGenerator g = parseAndCreateGraph("E1, data sets: DS1 DS2\n" + "E2, data sets: DS3\n" + "DS1, components: DS2 DS3\n"); - + deleteDataSets(g.ds(1)); - + assertEquals("E2, data sets: DS3\n", renderGraph(g)); assertModified(g.e(1)); assertDeleted(g.ds(1), g.ds(2)); assertUnmodifiedAndUndeleted(g); } - + @Test public final void testTrashDataSetOfAContainerWhichBelongingToSameExperiment() { EntityGraphGenerator g = parseAndCreateGraph("E1, data sets: DS1 DS2\n" + "DS1, components: DS2\n"); - + deleteDataSets(g.ds(2)); - + assertEquals("E1, data sets: DS1\n", renderGraph(g)); assertModified(g.e(1)); assertModified(g.ds(1)); assertDeleted(g.ds(2)); assertUnmodifiedAndUndeleted(g); } - + @Test public final void testTrashDataSetOfAContainerWhichBelongingToSameExperimentButDifferentSample() { EntityGraphGenerator g = parseAndCreateGraph("E1, samples: S1, data sets: DS1 DS2\n" + "S1, data sets: DS2\n" + "DS1, components: DS2\n"); - + deleteDataSets(g.ds(2)); - + assertEquals("E1, samples: S1, data sets: DS1\n", renderGraph(g)); assertModified(g.e(1)); assertModified(g.s(1)); @@ -535,23 +534,23 @@ public abstract class AbstractEntityDeletionTestCase extends BaseTest assertDeleted(g.ds(2)); assertUnmodifiedAndUndeleted(g); } - + @Test public void testTrashDataSetsWithDataSetInAContainer() { EntityGraphGenerator g = parseAndCreateGraph("S1, data sets: DS1[NECT] DS2[NECT] DS3[NET]\n" + "DS1[NECT], components: DS2[NECT]\n" + "DS2[NECT], components: DS3[NET]\n"); - + deleteDataSets(g.ds(2)); - + assertEquals("S1, data sets: DS1[NECT]\n", renderGraph(g)); assertModified(g.s(1)); assertModified(g.ds(1)); assertDeleted(g.ds(2), g.ds(3)); assertUnmodifiedAndUndeleted(g); } - + @Test public void testTrashDataSetsWithDataSetComponentIndirectlyDependentOnOutsideContainer() { @@ -569,7 +568,7 @@ public abstract class AbstractEntityDeletionTestCase extends BaseTest assertDeleted(g.ds(1), g.ds(3)); assertUnmodifiedAndUndeleted(g); } - + private void failTrashExperiment(ExperimentNode experimentNode, String expectedErrorMessage) { try @@ -578,11 +577,11 @@ public abstract class AbstractEntityDeletionTestCase extends BaseTest fail("UserFailureException expected"); } catch (UserFailureException ex) { - assertEquals(expectedErrorMessage, - ex.getMessage()); + assertEquals(expectedErrorMessage, + ex.getMessage()); } } - + private void failTrashSample(SampleNode sampleNode, String expectedErrorMessage) { String userSessionToken = createAdminUser(); @@ -600,27 +599,26 @@ public abstract class AbstractEntityDeletionTestCase extends BaseTest assertEquals(expectedErrorMessage, ex.getMessage()); } } - + protected String createExpectedErrorMessage(SampleNode relatedSample, EntityNode outsiderNode) { String relation = outsiderNode instanceof ExperimentNode ? "belongs to" : "is a component of"; - return "The sample " + entityGraphManager.getSample(relatedSample).getIdentifier() + return "The sample " + entityGraphManager.getSample(relatedSample).getIdentifier() + " " + relation + " the " + render(outsiderNode) + " which is outside the deletion set."; } protected String createExpectedErrorMessage(EntityNode originalNode, EntityNode relatedEntity, EntityNode outsiderNode) { - return "The " + render(originalNode) - + " is a component of the " + render(relatedEntity) + return "The " + render(originalNode) + + " is a component of the " + render(relatedEntity) + " which belongs to the " + render(outsiderNode) + " which is outside the deletion set."; } - + protected String createExpectedErrorMessage(String userID, String... samples) { - return "Authorization failure: Can not delete samples " + Arrays.asList(samples) + return "Authorization failure: Can not delete samples " + Arrays.asList(samples) + " because user " + userID + " does not have enough privileges."; } - private String render(EntityNode entityNode) { @@ -641,8 +639,8 @@ public abstract class AbstractEntityDeletionTestCase extends BaseTest } return type + " " + identifier; } - - private void deleteExperiments(ExperimentNode...experimentNodes) + + private void deleteExperiments(ExperimentNode... experimentNodes) { List<String> experimentIdentifiers = new ArrayList<String>(); for (ExperimentNode experimentNode : experimentNodes) @@ -653,7 +651,7 @@ public abstract class AbstractEntityDeletionTestCase extends BaseTest flushAndClearHibernateSession(); } - private void deleteSamples(SampleNode...sampleNodes) + private void deleteSamples(SampleNode... sampleNodes) { deleteSamples(createAdminUser(), sampleNodes); } @@ -668,8 +666,8 @@ public abstract class AbstractEntityDeletionTestCase extends BaseTest deleteSamples(samplePermIds, userSessionToken); flushAndClearHibernateSession(); } - - private void deleteDataSets(DataSetNode...dataSetNodes) + + private void deleteDataSets(DataSetNode... dataSetNodes) { List<String> dataSetCodes = new ArrayList<String>(); for (DataSetNode dataSetNode : dataSetNodes) @@ -679,17 +677,17 @@ public abstract class AbstractEntityDeletionTestCase extends BaseTest deleteDataSets(dataSetCodes, createAdminUser()); flushAndClearHibernateSession(); } - + private String createAdminUser() { return create(aSession().withInstanceRole(RoleCode.ADMIN)); } - + /** * Trashes specified experiments for specified user session token. */ protected abstract void deleteExperiments(List<String> experimentIdentifiers, String userSessionToken); - + /** * Trashes specified samples for specified user session token. */ diff --git a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/systemtest/AssignDataSetToExperimentAndSampleTest.java b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/systemtest/AssignDataSetToExperimentAndSampleTest.java index f744a378d26..3d8e731af4b 100644 --- a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/systemtest/AssignDataSetToExperimentAndSampleTest.java +++ b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/systemtest/AssignDataSetToExperimentAndSampleTest.java @@ -38,7 +38,7 @@ public class AssignDataSetToExperimentAndSampleTest extends AbstractDataSetAssig AbstractExternalData dataSet = etlService.tryGetDataSet(systemSessionToken, dataSetCode); if (experimentIdentifierOrNull != null) { - Experiment experiment = etlService.tryGetExperiment(systemSessionToken, + Experiment experiment = etlService.tryGetExperiment(systemSessionToken, ExperimentIdentifierFactory.parse(experimentIdentifierOrNull)); perform(anUpdateOf(dataSet).toExperiment(experiment).as(userSessionToken)); } else diff --git a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/systemtest/AssignDataSetToExperimentAndSampleViaDropBoxAPITest.java b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/systemtest/AssignDataSetToExperimentAndSampleViaDropBoxAPITest.java index be6a49b5689..0bc07232b46 100644 --- a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/systemtest/AssignDataSetToExperimentAndSampleViaDropBoxAPITest.java +++ b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/systemtest/AssignDataSetToExperimentAndSampleViaDropBoxAPITest.java @@ -36,8 +36,8 @@ import ch.systemsx.cisd.openbis.generic.shared.dto.identifier.SampleIdentifier; import ch.systemsx.cisd.openbis.generic.shared.dto.identifier.SampleIdentifierFactory; /** - * Data set assignment tests for Drop Box API V1/V2 (that is, via {@link IServiceForDataStoreServer#performEntityOperations(String, - * ch.systemsx.cisd.openbis.generic.shared.dto.AtomicEntityOperationDetails)}). + * Data set assignment tests for Drop Box API V1/V2 (that is, via + * {@link IServiceForDataStoreServer#performEntityOperations(String, ch.systemsx.cisd.openbis.generic.shared.dto.AtomicEntityOperationDetails)}). * * @author Franz-Josef Elmer */ @@ -73,7 +73,7 @@ public class AssignDataSetToExperimentAndSampleViaDropBoxAPITest extends Abstrac AtomicEntityOperationDetailsBuilder builder = new AtomicEntityOperationDetailsBuilder(); etlService.performEntityOperations(userSessionToken, builder.dataSetUpdate(dataSetUpdate).getDetails()); } - + private DataSetBatchUpdatesDTO createUpdatesObject(String dataSetCode) { AbstractExternalData dataSet = etlService.tryGetDataSet(systemSessionToken, dataSetCode); @@ -93,7 +93,7 @@ public class AssignDataSetToExperimentAndSampleViaDropBoxAPITest extends Abstrac { dataSetUpdate.setSampleIdentifierOrNull(SampleIdentifierFactory.parse(sample)); } - dataSetUpdate.setProperties(Collections.<IEntityProperty>emptyList()); + dataSetUpdate.setProperties(Collections.<IEntityProperty> emptyList()); updateDetails.setPropertiesToUpdate(new HashSet<String>()); return dataSetUpdate; } diff --git a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/systemtest/AssignExperimentToProjectTest.java b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/systemtest/AssignExperimentToProjectTest.java index 3f6f98ae2d2..77fe313cab2 100644 --- a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/systemtest/AssignExperimentToProjectTest.java +++ b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/systemtest/AssignExperimentToProjectTest.java @@ -94,7 +94,7 @@ public class AssignExperimentToProjectTest extends BaseTest } @Test(dataProvider = "rolesNotAllowedToAssignExperimentToProject", expectedExceptions = - { AuthorizationFailureException.class }, groups = "authorization") + { AuthorizationFailureException.class }, groups = "authorization") public void assigningExperimentToProjectIsNotAllowedFor(RoleWithHierarchy sourceSpaceRole, RoleWithHierarchy destinationSpaceRole, RoleWithHierarchy instanceRole) throws Exception diff --git a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/systemtest/AssignProjectToSpaceTest.java b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/systemtest/AssignProjectToSpaceTest.java index e2b8cac271d..dcb03701d6b 100644 --- a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/systemtest/AssignProjectToSpaceTest.java +++ b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/systemtest/AssignProjectToSpaceTest.java @@ -90,7 +90,7 @@ public class AssignProjectToSpaceTest extends BaseTest } @Test(dataProvider = "rolesNotAllowedToAssignProjectToSpace", expectedExceptions = - { AuthorizationFailureException.class }, groups = "authorization") + { AuthorizationFailureException.class }, groups = "authorization") public void assigningProjectToSpaceIsNotAllowedFor(RoleWithHierarchy sourceSpaceRole, RoleWithHierarchy destinationSpaceRole, RoleWithHierarchy instanceRole) throws Exception diff --git a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/systemtest/AssignSampleToExperimentTest.java b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/systemtest/AssignSampleToExperimentTest.java index 5d00d24e0f6..93be25ef514 100644 --- a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/systemtest/AssignSampleToExperimentTest.java +++ b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/systemtest/AssignSampleToExperimentTest.java @@ -32,24 +32,24 @@ import ch.systemsx.cisd.openbis.generic.shared.dto.identifier.SampleIdentifier; public class AssignSampleToExperimentTest extends AbstractAssignmentSampleToExperimentTestCase { @Override - protected void updateExperimentChangeSamples(String experimentIdentifier, List<String> samplePermIds, + protected void updateExperimentChangeSamples(String experimentIdentifier, List<String> samplePermIds, String userSessionToken) { - Experiment experiment = etlService.tryGetExperiment(systemSessionToken, + Experiment experiment = etlService.tryGetExperiment(systemSessionToken, ExperimentIdentifierFactory.parse(experimentIdentifier)); perform(anUpdateOf(experiment).withSamples(loadSamples(samplePermIds)).as(userSessionToken)); - + } - + @Override - protected void updateSampleChangeExperiment(String samplePermId, String experimentIdentifierOrNull, + protected void updateSampleChangeExperiment(String samplePermId, String experimentIdentifierOrNull, String userSessionToken) { SampleIdentifier sampleIdentifier = etlService.tryGetSampleIdentifier(systemSessionToken, samplePermId); Sample sample = etlService.tryGetSampleWithExperiment(systemSessionToken, sampleIdentifier); if (experimentIdentifierOrNull != null) { - Experiment experiment = etlService.tryGetExperiment(systemSessionToken, + Experiment experiment = etlService.tryGetExperiment(systemSessionToken, ExperimentIdentifierFactory.parse(experimentIdentifierOrNull)); perform(anUpdateOf(sample).toExperiment(experiment).as(userSessionToken)); } else diff --git a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/systemtest/AssignSampleToExperimentViaDropBoxAPITest.java b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/systemtest/AssignSampleToExperimentViaDropBoxAPITest.java index b1f80d94828..fbb0bb23ec6 100644 --- a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/systemtest/AssignSampleToExperimentViaDropBoxAPITest.java +++ b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/systemtest/AssignSampleToExperimentViaDropBoxAPITest.java @@ -42,7 +42,7 @@ import ch.systemsx.cisd.openbis.generic.shared.dto.identifier.SampleIdentifier; public class AssignSampleToExperimentViaDropBoxAPITest extends AbstractAssignmentSampleToExperimentTestCase { @Override - protected void updateExperimentChangeSamples(String experimentIdentifier, List<String> samplePermIds, + protected void updateExperimentChangeSamples(String experimentIdentifier, List<String> samplePermIds, String userSessionToken) { ExperimentIdentifier identifier = ExperimentIdentifierFactory.parse(experimentIdentifier); @@ -51,16 +51,16 @@ public class AssignSampleToExperimentViaDropBoxAPITest extends AbstractAssignmen experimentUpdate.setExperimentId(new TechId(experiment)); experimentUpdate.setProjectIdentifier(identifier); experimentUpdate.setVersion(experiment.getVersion()); - experimentUpdate.setProperties(Collections.<IEntityProperty>emptyList()); - experimentUpdate.setAttachments(Collections.<NewAttachment>emptyList()); + experimentUpdate.setProperties(Collections.<IEntityProperty> emptyList()); + experimentUpdate.setAttachments(Collections.<NewAttachment> emptyList()); Sample[] samples = loadSamples(samplePermIds); experimentUpdate.setSampleCodes(Code.extractCodesToArray(Arrays.asList(samples))); AtomicEntityOperationDetailsBuilder builder = new AtomicEntityOperationDetailsBuilder(); etlService.performEntityOperations(userSessionToken, builder.experimentUpdate(experimentUpdate).getDetails()); } - + @Override - protected void updateSampleChangeExperiment(String samplePermId, String experimentIdentifierOrNull, + protected void updateSampleChangeExperiment(String samplePermId, String experimentIdentifierOrNull, String userSessionToken) { SampleIdentifier sampleIdentifier = etlService.tryGetSampleIdentifier(systemSessionToken, samplePermId); @@ -82,5 +82,5 @@ public class AssignSampleToExperimentViaDropBoxAPITest extends AbstractAssignmen sampleIdentifier, containerIdentifier, null)); etlService.performEntityOperations(userSessionToken, builder.getDetails()); } - + } diff --git a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/systemtest/AssignSampleToSpaceTest.java b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/systemtest/AssignSampleToSpaceTest.java index 7a3f1a1eb27..0a3dc66e6dd 100644 --- a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/systemtest/AssignSampleToSpaceTest.java +++ b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/systemtest/AssignSampleToSpaceTest.java @@ -204,7 +204,7 @@ public class AssignSampleToSpaceTest extends BaseTest } @Test(dataProvider = "rolesNotAllowedToAssignSampleToSpace", expectedExceptions = - { AuthorizationFailureException.class }, groups = "authorization") + { AuthorizationFailureException.class }, groups = "authorization") public void assigningSampleToAnotherSpaceIsNotAllowedFor(RoleWithHierarchy sourceSpaceRole, RoleWithHierarchy destinationSpaceRole, RoleWithHierarchy instanceRole) throws Exception @@ -235,7 +235,7 @@ public class AssignSampleToSpaceTest extends BaseTest } @Test(dataProvider = "rolesNotAllowedToAssignSharedSampleToSpace", expectedExceptions = - { AuthorizationFailureException.class }, groups = "authorization") + { AuthorizationFailureException.class }, groups = "authorization") public void assigningSharedSampleToSpaceIsNotAllowedFor(RoleWithHierarchy destinationSpaceRole, RoleWithHierarchy instanceRole) throws Exception { diff --git a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/systemtest/AttachmentUploadTest.java b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/systemtest/AttachmentUploadTest.java index 1ee5e6358fa..a6520506bad 100644 --- a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/systemtest/AttachmentUploadTest.java +++ b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/systemtest/AttachmentUploadTest.java @@ -36,14 +36,13 @@ import ch.systemsx.cisd.openbis.generic.shared.basic.dto.Project; import ch.systemsx.cisd.openbis.generic.shared.basic.dto.TableModelRowWithObject; /** - * - * * @author Franz-Josef Elmer */ @Test(groups = "system test") public class AttachmentUploadTest extends SystemTestCase { private static final String FILE_CONTENT = "hello world"; + private static final String FILE_NAME = "hello.txt"; @Test @@ -70,33 +69,33 @@ public class AttachmentUploadTest extends SystemTestCase { SessionContext sessionContext = logIntoCommonClientService(); TechId experimentID = new TechId(2); - + uploadFile(FILE_NAME, FILE_CONTENT); commonClientService.addAttachment(experimentID, SESSION_KEY, AttachmentHolderKind.EXPERIMENT, new NewAttachment(FILE_NAME, "my file", "example file")); - + AttachmentWithContent attachmentWithContent = - genericServer.getExperimentFileAttachment(sessionContext.getSessionID(), experimentID, - FILE_NAME, 1); + genericServer.getExperimentFileAttachment(sessionContext.getSessionID(), experimentID, + FILE_NAME, 1); checkUploadedAttachment(experimentID, AttachmentHolderKind.EXPERIMENT, attachmentWithContent); } - + @Test public void testUploadSampleAttachment() { SessionContext sessionContext = logIntoCommonClientService(); TechId sampleID = new TechId(1); - + uploadFile(FILE_NAME, FILE_CONTENT); commonClientService.addAttachment(sampleID, SESSION_KEY, AttachmentHolderKind.SAMPLE, new NewAttachment(FILE_NAME, "my file", "example file")); - + AttachmentWithContent attachmentWithContent = - genericServer.getSampleFileAttachment(sessionContext.getSessionID(), sampleID, - FILE_NAME, 1); + genericServer.getSampleFileAttachment(sessionContext.getSessionID(), sampleID, + FILE_NAME, 1); checkUploadedAttachment(sampleID, AttachmentHolderKind.SAMPLE, attachmentWithContent); } - + private void checkUploadedAttachment(TechId holderID, AttachmentHolderKind holderKind, AttachmentWithContent attachmentWithContent) { @@ -108,17 +107,19 @@ public class AttachmentUploadTest extends SystemTestCase new DefaultResultSetConfig<String, TableModelRowWithObject<AttachmentVersions>>()); GridRowModels<TableModelRowWithObject<AttachmentVersions>> list = attachmentVersions.getResultSet().getList(); - for (GridRowModel<TableModelRowWithObject<AttachmentVersions>> tmrl : list) { - Attachment attachment = tmrl.getOriginalObject().getObjectOrNull().getVersions().get(0); - if (attachment.getFileName().equals(FILE_NAME)) { + for (GridRowModel<TableModelRowWithObject<AttachmentVersions>> tmrl : list) + { + Attachment attachment = tmrl.getOriginalObject().getObjectOrNull().getVersions().get(0); + if (attachment.getFileName().equals(FILE_NAME)) + { assertEquals("my file", attachment.getTitle()); assertEquals("example file", attachment.getDescription()); assertEquals(1, attachment.getVersion()); assertEquals(FILE_CONTENT, new String(attachmentWithContent.getContent())); - return; - } + return; + } } - - fail("Attachment with file name "+FILE_NAME+" was not found"); + + fail("Attachment with file name " + FILE_NAME + " was not found"); } } diff --git a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/systemtest/AuthenticationSystemTest.java b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/systemtest/AuthenticationSystemTest.java index 9c8f5c9c2cd..81c2065e8b0 100644 --- a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/systemtest/AuthenticationSystemTest.java +++ b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/systemtest/AuthenticationSystemTest.java @@ -28,8 +28,6 @@ import ch.systemsx.cisd.openbis.generic.shared.dto.RoleAssignmentPE; import ch.systemsx.cisd.openbis.generic.shared.dto.SessionContextDTO; /** - * - * * @author Franz-Josef Elmer */ @Test(groups = "system test") @@ -47,7 +45,7 @@ public class AuthenticationSystemTest extends SystemTestCase assertEquals("No 'password' specified.", ex.getMessage()); } } - + @Test public void testTryToAuthenticateAsSystem() { diff --git a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/systemtest/EntityDeletionTest.java b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/systemtest/EntityDeletionTest.java index 467002aa4a3..52ad4b53fd6 100644 --- a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/systemtest/EntityDeletionTest.java +++ b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/systemtest/EntityDeletionTest.java @@ -50,7 +50,7 @@ public class EntityDeletionTest extends AbstractEntityDeletionTestCase List<TechId> experimentIds = TechId.createList(commonServer.listExperiments(userSessionToken, identifiers)); commonServer.deleteExperiments(userSessionToken, experimentIds, "test", DeletionType.TRASH); } - + /** * Trashes specified samples for specified user session token. */ @@ -69,5 +69,5 @@ public class EntityDeletionTest extends AbstractEntityDeletionTestCase { commonServer.deleteDataSets(userSessionToken, dataSetCodes, "test", DeletionType.TRASH, true); } - + } diff --git a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/systemtest/EntityOperationTest.java b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/systemtest/EntityOperationTest.java index 75299eb069e..d09fbe594fc 100644 --- a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/systemtest/EntityOperationTest.java +++ b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/systemtest/EntityOperationTest.java @@ -660,7 +660,7 @@ public class EntityOperationTest extends SystemTestCase assertEquals("[COMMENT: my data]", dataSet.getProperties().toString()); assertEquals("/CISD/PLATE_WELLSEARCH:WELL-A01", dataSet.getSampleIdentifier()); } - + @Test public void testCreateDataSetForUnknownSample() { @@ -669,11 +669,11 @@ public class EntityOperationTest extends SystemTestCase AtomicEntityOperationDetails eo = new EntityOperationBuilder().dataSet( new DataSetBuilder().code(dataSetCode).type("HCS_IMAGE") - .store(new DataStoreBuilder("STANDARD").getStore()) - .fileFormat("XML").location("a/b/c").property("COMMENT", "my data") - .sample(new SampleBuilder().identifier("/CISD/A01").getSample()) - .getDataSet()).create(); - + .store(new DataStoreBuilder("STANDARD").getStore()) + .fileFormat("XML").location("a/b/c").property("COMMENT", "my data") + .sample(new SampleBuilder().identifier("/CISD/A01").getSample()) + .getDataSet()).create(); + try { etlService.performEntityOperations(sessionToken, eo); diff --git a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/systemtest/FilterSystemTest.java b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/systemtest/FilterSystemTest.java index cffa26c2a65..154322c6880 100644 --- a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/systemtest/FilterSystemTest.java +++ b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/systemtest/FilterSystemTest.java @@ -143,8 +143,8 @@ public class FilterSystemTest extends SystemTestCase new HashSet<IColumnDefinition<TableModelRowWithObject<GridCustomFilter>>>(); String[] headerIds = - { "NAME", "DESCRIPTION", "EXPRESSION", "IS_PUBLIC", "REGISTRATOR", - "REGISTRATION_DATE", "MODIFICATION_DATE" }; + { "NAME", "DESCRIPTION", "EXPRESSION", "IS_PUBLIC", "REGISTRATOR", + "REGISTRATION_DATE", "MODIFICATION_DATE" }; for (int i = 0; i < headerIds.length; i++) { diff --git a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/systemtest/RegisterDataSetTest.java b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/systemtest/RegisterDataSetTest.java index dbcbc075788..53826844bae 100644 --- a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/systemtest/RegisterDataSetTest.java +++ b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/systemtest/RegisterDataSetTest.java @@ -44,14 +44,12 @@ import ch.systemsx.cisd.openbis.systemtest.base.BaseTest; import ch.systemsx.cisd.openbis.systemtest.base.builder.ExternalDataBuilder; /** - * - * * @author Franz-Josef Elmer */ public class RegisterDataSetTest extends BaseTest { private Sample sampleWithExperiment; - + private Sample spaceSampleWithoutExperiment; private Sample sharedSample; @@ -74,10 +72,10 @@ public class RegisterDataSetTest extends BaseTest public void testRegisterDataSetForAnExperiment() throws Exception { AbstractExternalData dataSet = create(aDataSet().inExperiment(experiment)); - + assertThat(dataSet, is(inExperiment(experiment))); } - + @Test public void testRegisterContainerWithNonExistingDataSetForAnExperimentFails() throws Exception { @@ -100,10 +98,10 @@ public class RegisterDataSetTest extends BaseTest List<String> componentDSCodes = new ArrayList<String>(); componentDSCodes.add(component1.getCode()); componentDSCodes.add(component2.getCode()); - + AbstractExternalData dataSet = create(aDataSet().asContainer().withComponents(component1.getCode(), component2.getCode()) .inExperiment(experiment)); - + assertThat(dataSet, is(inExperiment(experiment))); List<AbstractExternalData> components = dataSet.tryGetAsContainerDataSet().getContainedDataSets(); List<String> codes = Code.extractCodes(components); @@ -114,16 +112,16 @@ public class RegisterDataSetTest extends BaseTest assertThat(components.get(1), is(inExperiment(experiment))); assertThat(components.size(), equalTo(2)); } - + @Test public void testRegisterDataSetForADeletedExperiment() throws Exception { - commonServer.deleteExperiments(systemSessionToken, Arrays.asList(new TechId(experiment)), + commonServer.deleteExperiments(systemSessionToken, Arrays.asList(new TechId(experiment)), "t", DeletionType.TRASH); createWithExpectedError(aDataSet().inExperiment(experiment), "Unknown experiment '" + experiment.getIdentifier() + "'."); } - + @Test public void testRegisterDataSetAsContainerForADeletedDataSetFails() throws Exception { @@ -133,7 +131,8 @@ public class RegisterDataSetTest extends BaseTest commonServer.deleteDataSets(systemSessionToken, Arrays.asList(componentDataSet.getCode()), "t", DeletionType.TRASH, true); - try { + try + { create(aDataSet().asContainer().withComponents(componentDataSet.getCode()).inExperiment(experiment)); fail("UserFailureExcpetion expected"); } catch (UserFailureException ex) @@ -146,11 +145,11 @@ public class RegisterDataSetTest extends BaseTest public void testRegisterDataSetForASampleWithExperiment() throws Exception { AbstractExternalData dataSet = create(aDataSet().inSample(sampleWithExperiment)); - + assertThat(dataSet, is(inSample(sampleWithExperiment))); assertThat(dataSet, is(inExperiment(experiment))); } - + @Test public void testRegisterContainerDataSetForASampleWithExperiment() throws Exception { @@ -162,7 +161,7 @@ public class RegisterDataSetTest extends BaseTest AbstractExternalData dataSet = create(aDataSet().asContainer().withComponents(component1.getCode(), component2.getCode()) .inSample(sampleWithExperiment)); - + assertThat(dataSet, is(inSample(sampleWithExperiment))); assertThat(dataSet, is(inExperiment(experiment))); List<AbstractExternalData> components = dataSet.tryGetAsContainerDataSet().getContainedDataSets(); @@ -175,33 +174,33 @@ public class RegisterDataSetTest extends BaseTest assertThat(components.get(1), is(inExperiment(experiment))); assertThat(components.size(), equalTo(2)); } - + @Test public void testRegisterDataSetForADeletedSampleWithExperiment() throws Exception { - commonServer.deleteSamples(systemSessionToken, Arrays.asList(new TechId(sampleWithExperiment)), + commonServer.deleteSamples(systemSessionToken, Arrays.asList(new TechId(sampleWithExperiment)), "t", DeletionType.TRASH); - createWithExpectedError(aDataSet().inSample(sampleWithExperiment), + createWithExpectedError(aDataSet().inSample(sampleWithExperiment), "No sample could be found with given identifier '" + sampleWithExperiment.getIdentifier() + "'."); } @Test public void testRegisterDataSetForASampleWithDeletedExperiment() throws Exception { - commonServer.deleteExperiments(systemSessionToken, Arrays.asList(new TechId(experiment)), + commonServer.deleteExperiments(systemSessionToken, Arrays.asList(new TechId(experiment)), "t", DeletionType.TRASH); - createWithExpectedError(aDataSet().inSample(sampleWithExperiment), + createWithExpectedError(aDataSet().inSample(sampleWithExperiment), "No sample could be found with given identifier '" + sampleWithExperiment.getIdentifier() + "'."); } - + @Test public void testRegisterDataSetForASampleWithoutExperiment() throws Exception { AbstractExternalData dataSet = create(aDataSet().withType("NO-EXP-TYPE").inSample(spaceSampleWithoutExperiment)); - + assertThat(dataSet, is(inSample(spaceSampleWithoutExperiment))); } - + @Test public void testRegisterContainerDataSetAndItsComponentsForASampleWithoutExperiment() throws Exception { @@ -230,7 +229,7 @@ public class RegisterDataSetTest extends BaseTest AbstractExternalData componentDataSet = create(aDataSet().inSample(sampleWithExperiment)); AbstractExternalData dataSet = create(aDataSet().withType("NEXP-CONTAINER-TYPE") .asContainer().withComponent(componentDataSet).inSample(spaceSampleWithoutExperiment)); - + assertThat(dataSet, is(inSample(spaceSampleWithoutExperiment))); List<AbstractExternalData> components = dataSet.tryGetAsContainerDataSet().getContainedDataSets(); List<String> codes = Code.extractCodes(components); @@ -240,37 +239,37 @@ public class RegisterDataSetTest extends BaseTest assertThat(components.get(0), is(inExperiment(experiment))); assertThat(components.size(), equalTo(1)); } - + @Test public void testRegisterDataSetForASampleWithoutExperimentButWrongDataSetType() throws Exception { - createWithExpectedError(aDataSet().inSample(spaceSampleWithoutExperiment), - "Data set can not be registered because no experiment found for sample '" - + spaceSampleWithoutExperiment.getIdentifier() + "'."); + createWithExpectedError(aDataSet().inSample(spaceSampleWithoutExperiment), + "Data set can not be registered because no experiment found for sample '" + + spaceSampleWithoutExperiment.getIdentifier() + "'."); } @Test public void testRegisterDataSetForASharedSample() throws Exception { - createWithExpectedError(aDataSet().withType("NEXP-TYPE").inSample(sharedSample), - "Data set can not be registered because sample '" + sharedSample.getIdentifier() - + "' is a shared sample."); + createWithExpectedError(aDataSet().withType("NEXP-TYPE").inSample(sharedSample), + "Data set can not be registered because sample '" + sharedSample.getIdentifier() + + "' is a shared sample."); } - + @Test public void testRegisterDataSetForSampleWithoutExperimentViaPerformEntityOperation() throws Exception { NewExternalData newDataSet = aDataSet().withType("NO-EXP-TYPE2") .inSample(spaceSampleWithoutExperiment).get(); AtomicEntityOperationDetails operationDetails = new EntityOperationBuilder().dataSet(newDataSet).create(); - + AtomicEntityOperationResult operationResult = etlService.performEntityOperations(systemSessionToken, operationDetails); - + assertThat((int) operationResult.getDataSetsCreatedCount(), equalTo(1)); AbstractExternalData dataSet = etlService.tryGetDataSet(systemSessionToken, newDataSet.getCode()); assertThat(dataSet, is(inSample(spaceSampleWithoutExperiment))); } - + private void createWithExpectedError(ExternalDataBuilder dataSetBuilder, String expectedErrorMessage) { try @@ -282,6 +281,5 @@ public class RegisterDataSetTest extends BaseTest assertEquals(expectedErrorMessage, ex.getMessage()); } } - } diff --git a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/systemtest/SystemTestCase.java b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/systemtest/SystemTestCase.java index 9c2f9407b49..67d98c2f940 100644 --- a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/systemtest/SystemTestCase.java +++ b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/systemtest/SystemTestCase.java @@ -82,7 +82,7 @@ import ch.systemsx.cisd.openbis.plugin.generic.shared.IGenericServer; public abstract class SystemTestCase extends AbstractTransactionalTestNGSpringContextTests { private static final String SOURCE_TEST_CORE_PLUGINS = "sourceTest/core-plugins"; - + protected static final String SESSION_KEY = "session-key"; protected ICommonServerForInternalUse commonServer; diff --git a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/systemtest/TypedTableAssertions.java b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/systemtest/TypedTableAssertions.java index 6f126b9c427..a97234a1343 100644 --- a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/systemtest/TypedTableAssertions.java +++ b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/systemtest/TypedTableAssertions.java @@ -20,8 +20,7 @@ import ch.systemsx.cisd.openbis.generic.shared.basic.dto.TableModelColumnHeader; import ch.systemsx.cisd.openbis.generic.shared.basic.dto.TableModelRowWithObject; /** - * A utility class that can be used to simplify assertions in {@link TypedTableGrid}-related - * headless system tests. + * A utility class that can be used to simplify assertions in {@link TypedTableGrid}-related headless system tests. * * @author Kaloyan Enimanev */ @@ -29,8 +28,7 @@ public class TypedTableAssertions<T extends Serializable> extends AssertJUnit { /** - * a convenience method, that can be used as a static import to achieve a fluent-API like - * programming style. + * a convenience method, that can be used as a static import to achieve a fluent-API like programming style. */ public static <S extends Serializable> TypedTableAssertions<S> assertTable( TypedTableResultSet<S> tableResultSet) @@ -39,8 +37,7 @@ public class TypedTableAssertions<T extends Serializable> extends AssertJUnit } /** - * a convenience method, that can be used as a static import to achieve a fluent-API like - * programming style. + * a convenience method, that can be used as a static import to achieve a fluent-API like programming style. */ public static <S extends Serializable> TypedTableAssertions<S>.ColumnAssertions assertColumn( TypedTableResultSet<S> tableResultSet, String columnName) @@ -53,8 +50,7 @@ public class TypedTableAssertions<T extends Serializable> extends AssertJUnit private Map<String, TableModelColumnHeader> headers; /** - * the constructor is tentatively marked as "private" for now. We could make it public in the - * future if we decide it will suite our tests better. + * the constructor is tentatively marked as "private" for now. We could make it public in the future if we decide it will suite our tests better. * * @param tableResultSet the typed-table result set */ @@ -208,8 +204,7 @@ public class TypedTableAssertions<T extends Serializable> extends AssertJUnit } /** - * just a convenience method redirecting to the {@link #containsValue(String)} with a single - * parameter. + * just a convenience method redirecting to the {@link #containsValue(String)} with a single parameter. */ public void containsValues(String... values) { diff --git a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/systemtest/UnassignSampleFromExperimentTest.java b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/systemtest/UnassignSampleFromExperimentTest.java index 827f840af89..866b235fd84 100644 --- a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/systemtest/UnassignSampleFromExperimentTest.java +++ b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/systemtest/UnassignSampleFromExperimentTest.java @@ -67,7 +67,7 @@ public class UnassignSampleFromExperimentTest extends BaseTest } @Test(expectedExceptions = - { UserFailureException.class }) + { UserFailureException.class }) public void unassigningFailsIfTheSampleHasDataSets() throws Exception { Sample sample = create(aSample().inExperiment(experiment)); @@ -199,7 +199,7 @@ public class UnassignSampleFromExperimentTest extends BaseTest } @Test(dataProvider = "rolesNotAllowedToUnassignSampleFromExperiment", expectedExceptions = - { AuthorizationFailureException.class }, groups = "authorization") + { AuthorizationFailureException.class }, groups = "authorization") public void unassigningIsNotAllowedFor(RoleWithHierarchy spaceRole, RoleWithHierarchy instanceRole) throws Exception { diff --git a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/systemtest/UnassignSampleFromSpaceTest.java b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/systemtest/UnassignSampleFromSpaceTest.java index 03aef15ee9d..14175113471 100644 --- a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/systemtest/UnassignSampleFromSpaceTest.java +++ b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/systemtest/UnassignSampleFromSpaceTest.java @@ -78,7 +78,7 @@ public class UnassignSampleFromSpaceTest extends BaseTest } @Test(expectedExceptions = - { UserFailureException.class }) + { UserFailureException.class }) public void sampleWithDataSetCannotBeUnassignedFromSpace() throws Exception { Sample sample = create(aSample().inExperiment(experiment)); @@ -88,7 +88,7 @@ public class UnassignSampleFromSpaceTest extends BaseTest } @Test(expectedExceptions = - { UserFailureException.class }) + { UserFailureException.class }) public void childSampleCantBeUnassignedFromSpace() throws Exception { Sample parent = create(aSample().inExperiment(experiment)); @@ -122,7 +122,7 @@ public class UnassignSampleFromSpaceTest extends BaseTest } @Test(expectedExceptions = - { UserFailureException.class }) + { UserFailureException.class }) public void componentOfSpaceLevelSampleCantBeUnassignedFromSpace() throws Exception { Sample container = create(aSample().inExperiment(experiment)); @@ -174,7 +174,7 @@ public class UnassignSampleFromSpaceTest extends BaseTest } @Test(dataProvider = "rolesNotAllowedToUnassignSampleFromSpace", expectedExceptions = - { AuthorizationFailureException.class }, groups = "authorization") + { AuthorizationFailureException.class }, groups = "authorization") public void unassigningIsNotAllowedFor(RoleWithHierarchy spaceRole, RoleWithHierarchy instanceRole) throws Exception { diff --git a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/systemtest/UpdateDataSetParentsTest.java b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/systemtest/UpdateDataSetParentsTest.java index 21868af0a5c..bb0b70cdd88 100644 --- a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/systemtest/UpdateDataSetParentsTest.java +++ b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/systemtest/UpdateDataSetParentsTest.java @@ -111,7 +111,7 @@ public class UpdateDataSetParentsTest extends BaseTest } @Test(expectedExceptions = - { UserFailureException.class }) + { UserFailureException.class }) public void dataSetCannotBeItsOwnParent() throws Exception { AbstractExternalData data = create(aDataSet().inSample(sample)); @@ -120,7 +120,7 @@ public class UpdateDataSetParentsTest extends BaseTest } @Test(expectedExceptions = - { UserFailureException.class }) + { UserFailureException.class }) public void dataSetCannotBeItsOwnGrandParent() throws Exception { AbstractExternalData parent = create(aDataSet().inSample(sample)); @@ -170,7 +170,7 @@ public class UpdateDataSetParentsTest extends BaseTest } @Test(dataProvider = "rolesNotAllowedToAddParentToDataSet", expectedExceptions = - { AuthorizationFailureException.class }, groups = "authorization") + { AuthorizationFailureException.class }, groups = "authorization") public void addingParentToDataSetNotIsAllowedFor(RoleWithHierarchy childSpaceRole, RoleWithHierarchy parentSpaceRole, RoleWithHierarchy instanceRole) throws Exception { @@ -203,7 +203,7 @@ public class UpdateDataSetParentsTest extends BaseTest } @Test(dataProvider = "rolesNotAllowedToRemoveParentFromDataSet", expectedExceptions = - { AuthorizationFailureException.class }, groups = "authorization") + { AuthorizationFailureException.class }, groups = "authorization") public void removingParentFromDataSetNotIsAllowedFor(RoleWithHierarchy childSpaceRole, RoleWithHierarchy parentSpaceRole, RoleWithHierarchy instanceRole) throws Exception { diff --git a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/systemtest/UpdateDataSetTest.java b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/systemtest/UpdateDataSetTest.java index bf0a117e4dd..dbf31561d7a 100644 --- a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/systemtest/UpdateDataSetTest.java +++ b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/systemtest/UpdateDataSetTest.java @@ -19,35 +19,36 @@ import ch.systemsx.cisd.openbis.generic.shared.dto.identifier.ExperimentIdentifi import ch.systemsx.cisd.openbis.generic.shared.dto.identifier.SampleIdentifierFactory; import ch.systemsx.cisd.openbis.systemtest.base.BaseTest; -public class UpdateDataSetTest extends BaseTest{ - +public class UpdateDataSetTest extends BaseTest +{ + Sample sample; - - @BeforeMethod - void createFixture() throws Exception - { - Space space = create(aSpace()); - Project project = create(aProject().inSpace(space)); - Experiment experiment = create(anExperiment().inProject(project)); - sample = create(aSample().inExperiment(experiment)); - } - - @Test - public void dataSetUpdateDoesntSetSampleToNull() { - AbstractExternalData dataSet = create(aDataSet().inSample(sample)); - DataSetBatchUpdatesDTO update = new DataSetBatchUpdatesDTO(); - update.setDatasetId(new TechId(dataSet)); - update.setDatasetCode(dataSet.getCode()); - update.setVersion(dataSet.getVersion()); - update.setDetails(new DataSetBatchUpdateDetails()); - update.setProperties(Collections.<IEntityProperty>emptyList()); - update.setSampleIdentifierOrNull(SampleIdentifierFactory.parse(dataSet.getSample())); - update.setExperimentIdentifierOrNull(ExperimentIdentifierFactory.parse(dataSet.getExperiment().getIdentifier())); - - etlService.performEntityOperations(systemSessionToken, new AtomicEntityOperationDetailsBuilder().dataSetUpdate(update).getDetails()); - - assertThat(dataSet, inSample(sample)); - assertThat(dataSet, inExperiment(sample.getExperiment())); - } + @BeforeMethod + void createFixture() throws Exception + { + Space space = create(aSpace()); + Project project = create(aProject().inSpace(space)); + Experiment experiment = create(anExperiment().inProject(project)); + sample = create(aSample().inExperiment(experiment)); + } + + @Test + public void dataSetUpdateDoesntSetSampleToNull() + { + AbstractExternalData dataSet = create(aDataSet().inSample(sample)); + DataSetBatchUpdatesDTO update = new DataSetBatchUpdatesDTO(); + update.setDatasetId(new TechId(dataSet)); + update.setDatasetCode(dataSet.getCode()); + update.setVersion(dataSet.getVersion()); + update.setDetails(new DataSetBatchUpdateDetails()); + update.setProperties(Collections.<IEntityProperty> emptyList()); + update.setSampleIdentifierOrNull(SampleIdentifierFactory.parse(dataSet.getSample())); + update.setExperimentIdentifierOrNull(ExperimentIdentifierFactory.parse(dataSet.getExperiment().getIdentifier())); + + etlService.performEntityOperations(systemSessionToken, new AtomicEntityOperationDetailsBuilder().dataSetUpdate(update).getDetails()); + + assertThat(dataSet, inSample(sample)); + assertThat(dataSet, inExperiment(sample.getExperiment())); + } } diff --git a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/systemtest/UpdateSampleContainmentTest.java b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/systemtest/UpdateSampleContainmentTest.java index c45ee31b559..b9044fe163e 100644 --- a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/systemtest/UpdateSampleContainmentTest.java +++ b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/systemtest/UpdateSampleContainmentTest.java @@ -75,7 +75,7 @@ public class UpdateSampleContainmentTest extends BaseTest } @Test(expectedExceptions = - { UserFailureException.class }) + { UserFailureException.class }) public void componentCantBeSharedSample() throws Exception { Sample container = create(aSample().inSpace(space)); @@ -109,7 +109,7 @@ public class UpdateSampleContainmentTest extends BaseTest } @Test(expectedExceptions = - { UserFailureException.class }) + { UserFailureException.class }) public void sampleCannotBeUpdatedToBeComponentOfComponentSample() throws Exception { Sample container = create(aSample().inSpace(space)); @@ -120,7 +120,7 @@ public class UpdateSampleContainmentTest extends BaseTest } @Test(expectedExceptions = - { UserFailureException.class }) + { UserFailureException.class }) public void sampleCanContainItself() throws Exception { Sample sample = create(aSample().inSpace(space)); @@ -155,7 +155,7 @@ public class UpdateSampleContainmentTest extends BaseTest } @Test(dataProvider = "rolesNotAllowedToSetContainerToSample", expectedExceptions = - { AuthorizationFailureException.class }, groups = "authorization") + { AuthorizationFailureException.class }, groups = "authorization") public void settingContainerToSampleIsNotAllowedFor(RoleWithHierarchy containerSpaceRole, RoleWithHierarchy componentSpaceRole, RoleWithHierarchy instanceRole) throws Exception { @@ -188,7 +188,7 @@ public class UpdateSampleContainmentTest extends BaseTest } @Test(dataProvider = "rolesNotAllowedToRemoveContainerFromSample", expectedExceptions = - { AuthorizationFailureException.class }, groups = "authorization") + { AuthorizationFailureException.class }, groups = "authorization") public void removingContainerFromSampleIsNotAllowedFor(RoleWithHierarchy containerSpaceRole, RoleWithHierarchy componentSpaceRole, RoleWithHierarchy instanceRole) throws Exception { @@ -237,7 +237,7 @@ public class UpdateSampleContainmentTest extends BaseTest rule(containerDomain, RoleWithHierarchy.SPACE_ETL_SERVER)), rule(componentDomain, RoleWithHierarchy.SPACE_POWER_USER) - ), + ), and(rule(componentDomain, RoleWithHierarchy.SPACE_USER), rule(instance, RoleWithHierarchy.INSTANCE_ETL_SERVER))); diff --git a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/systemtest/UpdateSampleParentsTest.java b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/systemtest/UpdateSampleParentsTest.java index f06dedd2735..228e9f069f5 100644 --- a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/systemtest/UpdateSampleParentsTest.java +++ b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/systemtest/UpdateSampleParentsTest.java @@ -102,7 +102,7 @@ public class UpdateSampleParentsTest extends BaseTest } @Test(expectedExceptions = - { UserFailureException.class }) + { UserFailureException.class }) public void sampleCantBeItsOwnParent() throws Exception { Sample sample = create(aSample().inSpace(space)); @@ -111,7 +111,7 @@ public class UpdateSampleParentsTest extends BaseTest } @Test(expectedExceptions = - { UserFailureException.class }) + { UserFailureException.class }) public void sampleCantBeItsOwnGrandParent() throws Exception { Sample parent = create(aSample().inSpace(space)); @@ -133,7 +133,7 @@ public class UpdateSampleParentsTest extends BaseTest } @Test(expectedExceptions = - { UserFailureException.class }) + { UserFailureException.class }) public void childCannotBeShared() throws Exception { Sample parent = create(aSample().inSpace(space)); @@ -163,7 +163,7 @@ public class UpdateSampleParentsTest extends BaseTest } @Test(dataProvider = "rolesNotAllowedToAddParentToSample", expectedExceptions = - { AuthorizationFailureException.class }, groups = "authorization") + { AuthorizationFailureException.class }, groups = "authorization") public void addingParentToSampleIsNotAllowedFor(RoleWithHierarchy spaceRole, RoleWithHierarchy instanceRole) throws Exception { @@ -193,7 +193,7 @@ public class UpdateSampleParentsTest extends BaseTest } @Test(dataProvider = "rolesNotAllowedToAddParentToSample", expectedExceptions = - { AuthorizationFailureException.class }, groups = "authorization") + { AuthorizationFailureException.class }, groups = "authorization") public void addingParentToSampleInDifferentSpaceIsNotAllowedFor(RoleWithHierarchy spaceRole, RoleWithHierarchy instanceRole) throws Exception { @@ -224,7 +224,7 @@ public class UpdateSampleParentsTest extends BaseTest } @Test(dataProvider = "rolesNotAllowedToAddParentToSample", expectedExceptions = - { AuthorizationFailureException.class }, groups = "authorization") + { AuthorizationFailureException.class }, groups = "authorization") public void removingParentToSampleIsNotAllowedFor(RoleWithHierarchy spaceRole, RoleWithHierarchy instanceRole) throws Exception { diff --git a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/systemtest/api/common/json/JsonApiClient.java b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/systemtest/api/common/json/JsonApiClient.java index be76ee7a6ce..5dd2530d3c4 100644 --- a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/systemtest/api/common/json/JsonApiClient.java +++ b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/systemtest/api/common/json/JsonApiClient.java @@ -36,37 +36,15 @@ public class JsonApiClient public JsonNode sendRequest(String json, Object... params) throws Exception { /* - String jsonWithParams = String.format(json, params); - - HttpClient client = new DefaultHttpClient(); - HttpPost post = new HttpPost(apiUrl); - - // add header - post.setHeader("User-Agent", USER_AGENT); - - post.setEntity(new StringEntity(jsonWithParams)); - - HttpResponse response = client.execute(post); - System.out.println(">>>>>"); - System.out.println("Sending 'POST' request to URL : " + apiUrl); - System.out.println("Post parameters : " + jsonWithParams.trim()); - System.out.println("Response Code : " + - response.getStatusLine().getStatusCode()); - - BufferedReader rd = new BufferedReader( - new InputStreamReader(response.getEntity().getContent())); - - StringBuffer result = new StringBuffer(); - String line = ""; - while ((line = rd.readLine()) != null) - { - result.append(line); - } - - System.out.println("Response : " + result.toString()); - System.out.println("<<<<<"); - return new ObjectMapper().readTree(result.toString()); - */ + * String jsonWithParams = String.format(json, params); HttpClient client = new DefaultHttpClient(); HttpPost post = new HttpPost(apiUrl); // + * add header post.setHeader("User-Agent", USER_AGENT); post.setEntity(new StringEntity(jsonWithParams)); HttpResponse response = + * client.execute(post); System.out.println(">>>>>"); System.out.println("Sending 'POST' request to URL : " + apiUrl); + * System.out.println("Post parameters : " + jsonWithParams.trim()); System.out.println("Response Code : " + + * response.getStatusLine().getStatusCode()); BufferedReader rd = new BufferedReader( new + * InputStreamReader(response.getEntity().getContent())); StringBuffer result = new StringBuffer(); String line = ""; while ((line = + * rd.readLine()) != null) { result.append(line); } System.out.println("Response : " + result.toString()); System.out.println("<<<<<"); return + * new ObjectMapper().readTree(result.toString()); + */ return null; } diff --git a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/systemtest/api/v1/GeneralInformationServiceTest.java b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/systemtest/api/v1/GeneralInformationServiceTest.java index b9b790d1a5f..e6ef8d91fdb 100644 --- a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/systemtest/api/v1/GeneralInformationServiceTest.java +++ b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/systemtest/api/v1/GeneralInformationServiceTest.java @@ -2077,7 +2077,7 @@ public class GeneralInformationServiceTest extends SystemTestCase new MetaprojectTechIdId(metaProjects.get(1).getId()), "test"); assertEquals("[MaterialIdentifier [materialCode=AD3, " + "materialTypeIdentifier=MaterialTypeIdentifier [materialTypeCode=VIRUS]]]", mas - .getMaterials().toString()); + .getMaterials().toString()); assertEntities("[/CISD/NEMO/EXP11, /TEST-SPACE/TEST-PROJECT/EXP-SPACE-TEST]", mas.getExperiments()); assertEquals("[Sample[/TEST-SPACE/EV-TEST,VALIDATE_CHILDREN,{},parents=?,children=?]]", mas diff --git a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/systemtest/authorization/CommonServerAuthorizationTest.java b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/systemtest/authorization/CommonServerAuthorizationTest.java index a13810cd58d..91be8ea0ac7 100644 --- a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/systemtest/authorization/CommonServerAuthorizationTest.java +++ b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/systemtest/authorization/CommonServerAuthorizationTest.java @@ -59,8 +59,8 @@ public class CommonServerAuthorizationTest extends BaseTest assertEquals("S2", space.getCode()); TechId ds3Id = new TechId(ds3.getId()); String user = create(aSession().withSpaceRole(RoleCode.ADMIN, space)); - - List<AbstractExternalData> children = commonServer.listDataSetRelationships(user, ds3Id,DataSetRelationshipRole.PARENT); + + List<AbstractExternalData> children = commonServer.listDataSetRelationships(user, ds3Id, DataSetRelationshipRole.PARENT); assertEquals("[" + ds2.getCode() + "]", Code.extractCodes(children).toString()); List<AbstractExternalData> parents = commonServer.listDataSetRelationships(user, ds3Id, DataSetRelationshipRole.CHILD); assertEquals("[" + ds5.getCode() + "]", Code.extractCodes(parents).toString()); diff --git a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/systemtest/authorization/ETLServiceAuthorizationTest.java b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/systemtest/authorization/ETLServiceAuthorizationTest.java index a5c09442550..adea353f539 100644 --- a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/systemtest/authorization/ETLServiceAuthorizationTest.java +++ b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/systemtest/authorization/ETLServiceAuthorizationTest.java @@ -96,7 +96,7 @@ public class ETLServiceAuthorizationTest extends BaseTest } @Test(expectedExceptions = - { AuthorizationFailureException.class }) + { AuthorizationFailureException.class }) public void testListSamplesForObserverForAnotherSpace() { String sessionToken = @@ -129,7 +129,7 @@ public class ETLServiceAuthorizationTest extends BaseTest } @Test(expectedExceptions = - { AuthorizationFailureException.class }) + { AuthorizationFailureException.class }) public void testRegistrationOfSamplesForUnauthorizedUser() { String sessionToken = create(aSession().withInstanceRole(RoleWithHierarchy.INSTANCE_ADMIN)); diff --git a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/systemtest/authorization/PersonManagementTest.java b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/systemtest/authorization/PersonManagementTest.java index ea6528c23c6..b48e9255ac4 100644 --- a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/systemtest/authorization/PersonManagementTest.java +++ b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/systemtest/authorization/PersonManagementTest.java @@ -50,6 +50,7 @@ import ch.systemsx.cisd.openbis.util.LogRecordingUtils; public class PersonManagementTest extends BaseTest { private BufferedAppender logRecorder; + private int initialNumberOfActivePersons; @BeforeMethod diff --git a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/systemtest/base/BaseTest.java b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/systemtest/base/BaseTest.java index 60d27e7006a..7d0e6914943 100644 --- a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/systemtest/base/BaseTest.java +++ b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/systemtest/base/BaseTest.java @@ -510,7 +510,7 @@ public abstract class BaseTest extends AbstractTransactionalTestNGSpringContextT { return parseAndCreateGraph(graphDefinition, true); } - + protected EntityGraphGenerator parseAndCreateGraph(String graphDefinition, boolean startNewTransaction) { EntityGraphGenerator graphGenerator = entityGraphManager.parseAndCreateGraph(graphDefinition); diff --git a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/systemtest/base/RelationshipServiceStub.java b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/systemtest/base/RelationshipServiceStub.java index f9d9ed13b30..1eeb0e0e26f 100644 --- a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/systemtest/base/RelationshipServiceStub.java +++ b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/systemtest/base/RelationshipServiceStub.java @@ -130,13 +130,13 @@ public class RelationshipServiceStub implements IRelationshipService public void assignSampleToProject(IAuthSession session, SamplePE sample, ProjectPE project) { // TODO Auto-generated method stub - + } @Override public void unassignSampleFromProject(IAuthSession session, SamplePE sample) { // TODO Auto-generated method stub - + } } diff --git a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/systemtest/base/builder/Builder.java b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/systemtest/base/builder/Builder.java index c58b8ce407b..d6f1991a870 100644 --- a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/systemtest/base/builder/Builder.java +++ b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/systemtest/base/builder/Builder.java @@ -42,6 +42,6 @@ public abstract class Builder<T> this.sessionToken = token; return this; } - + public abstract T create(); } diff --git a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/systemtest/base/builder/DataSetUpdateBuilder.java b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/systemtest/base/builder/DataSetUpdateBuilder.java index 05562e991d1..cc16956e0b2 100644 --- a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/systemtest/base/builder/DataSetUpdateBuilder.java +++ b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/systemtest/base/builder/DataSetUpdateBuilder.java @@ -115,7 +115,7 @@ public class DataSetUpdateBuilder extends UpdateBuilder<DataSetUpdatesDTO> this.sampleIdentifier = null; return this; } - + public DataSetUpdateBuilder withContainer(AbstractExternalData dataSet) { this.containerCode = dataSet.getCode(); diff --git a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/systemtest/base/builder/ExternalDataBuilder.java b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/systemtest/base/builder/ExternalDataBuilder.java index accaffc8ddb..6015bd0bc83 100644 --- a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/systemtest/base/builder/ExternalDataBuilder.java +++ b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/systemtest/base/builder/ExternalDataBuilder.java @@ -63,11 +63,11 @@ public class ExternalDataBuilder extends Builder<AbstractExternalData> private List<String> parentCodes; private List<String> componentCodes; - + private Map<String, String> properties; private String code; - + private String dataSetTypeCode; private boolean container; @@ -99,7 +99,7 @@ public class ExternalDataBuilder extends Builder<AbstractExternalData> } return this; } - + public ExternalDataBuilder inExperiment(Experiment experiment) { this.experimentIdentifier = new ExperimentIdentifier(experiment); @@ -131,7 +131,7 @@ public class ExternalDataBuilder extends Builder<AbstractExternalData> componentCodes.addAll(Arrays.asList(dataSetCodes)); return this; } - + public ExternalDataBuilder withComponent(AbstractExternalData data) { return this.withComponents(data.getCode()); @@ -142,7 +142,7 @@ public class ExternalDataBuilder extends Builder<AbstractExternalData> properties.put(propertyTypeCode, value); return this; } - + @Override public AbstractExternalData create() { @@ -216,7 +216,7 @@ public class ExternalDataBuilder extends Builder<AbstractExternalData> { if (properties.isEmpty() == false) { - Set<String> knownPropertyTypes = new HashSet<String>(); + Set<String> knownPropertyTypes = new HashSet<String>(); List<DataSetTypePropertyType> assignedPropertyTypes = type.getAssignedPropertyTypes(); for (DataSetTypePropertyType dtpt : assignedPropertyTypes) { diff --git a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/systemtest/base/builder/UpdateBuilder.java b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/systemtest/base/builder/UpdateBuilder.java index 54cd93c58f3..987bc4797c6 100644 --- a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/systemtest/base/builder/UpdateBuilder.java +++ b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/systemtest/base/builder/UpdateBuilder.java @@ -35,6 +35,6 @@ public abstract class UpdateBuilder<T> extends Builder<T> this.sessionToken = token; return this; } - + public abstract void perform(); } diff --git a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/systemtest/entitygraph/EntityGraphManager.java b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/systemtest/entitygraph/EntityGraphManager.java index aa784dd92f0..44334e3ef05 100644 --- a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/systemtest/entitygraph/EntityGraphManager.java +++ b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/systemtest/entitygraph/EntityGraphManager.java @@ -75,50 +75,54 @@ import ch.systemsx.cisd.openbis.generic.shared.dto.identifier.SampleIdentifierFa import ch.systemsx.cisd.openbis.generic.shared.dto.identifier.SpaceIdentifier; /** - * Helper class which creates a graph of entities of kind experiment, sample, and data set based on a - * textual description. A simple language defines the entities (experiments, samples, and data sets) and its relations. - * From the textual definition of the graph real entities are created in the database. The actual graph of - * entities as stored in the data base can be rendered in the same language used for parsing. This allows to - * checked expected changes after some (re-)assignment between the entities has been performed. It is also - * possible to checked whether the entities have been modified (i.e. modifier and modification date have been changed) - * or not. Here is an example: + * Helper class which creates a graph of entities of kind experiment, sample, and data set based on a textual description. A simple language defines + * the entities (experiments, samples, and data sets) and its relations. From the textual definition of the graph real entities are created in the + * database. The actual graph of entities as stored in the data base can be rendered in the same language used for parsing. This allows to checked + * expected changes after some (re-)assignment between the entities has been performed. It is also possible to checked whether the entities have been + * modified (i.e. modifier and modification date have been changed) or not. Here is an example: + * * <pre> - * EntityGraphGenerator g = entityGraphManager.parseAndCreateGraph("E1, data sets: DS4\n" - + "S1, data sets: DS1[NECT] DS2[NECT]\n" - + "S2\n" - + "S3, data sets: DS3[NET]\n" - + "DS1[NECT], components: DS2[NECT] DS3[NET]\n" - + "DS2[NECT], components: DS4"); - - reassignToSample(g.ds(1), g.s(2)); - - assertEquals("E1, data sets: DS4\n" - + "S2, data sets: DS1[NECT] DS2[NECT]\n" - + "S3, data sets: DS3[NET]\n" - + "DS1[NECT], components: DS2[NECT] DS3[NET]\n" - + "DS2[NECT], components: DS4\n", entityGraphManager.renderGraph(g)); - entityGraphManager.assertModified(g.s(1), g.s(2)); - entityGraphManager.assertModified(g.ds(1), g.ds(2)); - entityGraphManager.assertUnmodified(g); + * EntityGraphGenerator g = entityGraphManager.parseAndCreateGraph("E1, data sets: DS4\n" + * + "S1, data sets: DS1[NECT] DS2[NECT]\n" + * + "S2\n" + * + "S3, data sets: DS3[NET]\n" + * + "DS1[NECT], components: DS2[NECT] DS3[NET]\n" + * + "DS2[NECT], components: DS4"); + * + * reassignToSample(g.ds(1), g.s(2)); + * + * assertEquals("E1, data sets: DS4\n" + * + "S2, data sets: DS1[NECT] DS2[NECT]\n" + * + "S3, data sets: DS3[NET]\n" + * + "DS1[NECT], components: DS2[NECT] DS3[NET]\n" + * + "DS2[NECT], components: DS4\n", entityGraphManager.renderGraph(g)); + * entityGraphManager.assertModified(g.s(1), g.s(2)); + * entityGraphManager.assertModified(g.ds(1), g.ds(2)); + * entityGraphManager.assertUnmodified(g); * </pre> * - * * @author Franz-Josef Elmer */ public class EntityGraphManager { private final IServiceForDataStoreServer service; + private final ICommonServerForInternalUse commonService; + private final SessionFactory sessionFactory; + private final String sessionToken; - + private Space defaultSpace; + private Project defaultProject; + private ExperimentType defaultExperimentType; + private SampleType defaultSampleType; - + private EntityRepository repository; - + public EntityGraphManager(IServiceForDataStoreServer service, ICommonServerForInternalUse commonService, SessionFactory sessionFactory, String sessionToken) { @@ -127,7 +131,7 @@ public class EntityGraphManager this.sessionFactory = sessionFactory; this.sessionToken = sessionToken; } - + public EntityGraphGenerator parseAndCreateGraph(String graphDefinition) { EntityGraphGenerator g = new EntityGraphGenerator(); @@ -137,7 +141,7 @@ public class EntityGraphManager repository.gatherModifictaionInfos(); return g; } - + public void addToRepository(ExperimentNode experimentNode, Experiment experiment) { repository.put(experimentNode, experiment); @@ -152,7 +156,7 @@ public class EntityGraphManager { repository.assertDeleted(experimentNodes); } - + public void assertModified(SampleNode[] sampleNodes) { repository.assertModified(sampleNodes); @@ -162,7 +166,7 @@ public class EntityGraphManager { repository.assertDeleted(sampleNodes); } - + public void assertModified(DataSetNode[] dataSetNodes) { repository.assertModified(dataSetNodes); @@ -172,7 +176,7 @@ public class EntityGraphManager { repository.assertDeleted(dataSetNodes); } - + public void assertUnmodified(EntityGraphGenerator g) { repository.assertUnmodified(g); @@ -182,7 +186,7 @@ public class EntityGraphManager { repository.assertUndeleted(g); } - + public String getIdentifierOfDefaultProject() { return defaultProject.getIdentifier(); @@ -192,12 +196,12 @@ public class EntityGraphManager { return repository.getExperimentIdentifierOrNull(experimentNodeOrNull); } - + public Sample getSample(SampleNode sampleNode) { return repository.getSample(sampleNode); } - + public Sample tryGetSample(SampleNode sampleNode) { return repository.tryGetSample(sampleNode); @@ -207,12 +211,12 @@ public class EntityGraphManager { return repository.getSamplePermIdOrNull(sampleNodeOrNull); } - + public AbstractExternalData getDataSet(DataSetNode dataSetNode) { return repository.getDataSet(dataSetNode); } - + public AbstractExternalData tryGetDataSet(DataSetNode dataSetNode) { return repository.tryGetDataSet(dataSetNode); @@ -222,12 +226,12 @@ public class EntityGraphManager { return repository.getDataSetCodeOrNull(dataSetNodeOrNull); } - + public String renderGraph(EntityGraphGenerator g) { return renderGraph(g, false); } - + public String renderGraph(EntityGraphGenerator g, boolean showWhereIAm) { repository.refreshGraph(showWhereIAm); @@ -293,7 +297,7 @@ public class EntityGraphManager } return sampleNode.getIdentifierAndType(); } - + private String removeSolitaryNodes(String graphDefinition) { StringBuilder builder = new StringBuilder(); @@ -307,7 +311,7 @@ public class EntityGraphManager } return builder.toString(); } - + private void appendNodeTo(StringBuilder builder, String identifierAndType, StringBuilder builder2) { if (builder2.length() > 0) @@ -316,12 +320,12 @@ public class EntityGraphManager builder.append(builder2).append("\n"); } } - + private void render(StringBuilder builder, String name, Collection<? extends EntityNode> nodes) { render(builder, name, getIdentifiers(nodes)); } - + private List<String> getIdentifiers(Collection<? extends EntityNode> nodes) { List<String> identifiers = new ArrayList<String>(); @@ -336,7 +340,7 @@ public class EntityGraphManager } return identifiers; } - + private void render(StringBuilder builder, String name, List<String> identifiers) { if (identifiers.isEmpty()) @@ -349,7 +353,7 @@ public class EntityGraphManager builder.append(' ').append(identifier); } } - + private Space createSpace(String spaceCode) { SpaceIdentifier spaceIdentifier = new SpaceIdentifier(spaceCode); @@ -361,7 +365,7 @@ public class EntityGraphManager commonService.registerSpace(sessionToken, spaceCode, null); return service.tryGetSpace(sessionToken, spaceIdentifier); } - + private Project createProject(Space space, String projectCode) { ProjectIdentifier projectIdentifier = new ProjectIdentifier(space.getCode(), projectCode); @@ -370,11 +374,11 @@ public class EntityGraphManager { return project; } - commonService.registerProject(sessionToken, projectIdentifier, null, null, - Collections.<NewAttachment>emptyList()); + commonService.registerProject(sessionToken, projectIdentifier, null, null, + Collections.<NewAttachment> emptyList()); return commonService.getProjectInfo(sessionToken, projectIdentifier); } - + private ExperimentType createExperimentType(String typeCode) { for (ExperimentType experimentType : commonService.listExperimentTypes(sessionToken)) @@ -389,7 +393,7 @@ public class EntityGraphManager commonService.registerExperimentType(sessionToken, experimentType); return service.getExperimentType(sessionToken, typeCode); } - + private SampleType createSampleType(String typeCode) { for (SampleType sampleType : commonService.listSampleTypes(sessionToken)) @@ -405,7 +409,7 @@ public class EntityGraphManager commonService.registerSampleType(sessionToken, sampleType); return service.getSampleType(sessionToken, typeCode); } - + private DataSetType createDataSetType(String typeCode, DataSetKind dataSetKind) { for (DataSetType dataSetType : commonService.listDataSetTypes(sessionToken)) @@ -422,7 +426,7 @@ public class EntityGraphManager dataSetType = service.getDataSetType(sessionToken, typeCode).getDataSetType(); return dataSetType; } - + private Experiment createExperiment(ExperimentNode experimentNode, Project project) { try @@ -438,7 +442,7 @@ public class EntityGraphManager return service.tryGetExperiment(sessionToken, ExperimentIdentifierFactory.parse(identifier)); } catch (Exception ex) { - throw new RuntimeException("Error while creating experiment for node " + experimentNode.getCode() + throw new RuntimeException("Error while creating experiment for node " + experimentNode.getCode() + ": " + ex.getMessage(), ex); } } @@ -463,19 +467,19 @@ public class EntityGraphManager Sample containerSample = repository.tryGetSample(container); if (containerSample == null) { - throw new IllegalStateException("Sample " + container.getCode() - + " is specified as container of " + sampleNode.getCode() + throw new IllegalStateException("Sample " + container.getCode() + + " is specified as container of " + sampleNode.getCode() + " but hasn't yet created."); } sample.setContainerIdentifier(containerSample.getIdentifier()); } sample.setProperties(new IEntityProperty[0]); - sample.setAttachments(Collections.<NewAttachment>emptyList()); + sample.setAttachments(Collections.<NewAttachment> emptyList()); service.registerSample(sessionToken, sample, null); return service.tryGetSampleWithExperiment(sessionToken, SampleIdentifierFactory.parse(sample)); } catch (Exception ex) { - throw new RuntimeException("Error while creating sample for node " + sampleNode.getCode() + throw new RuntimeException("Error while creating sample for node " + sampleNode.getCode() + ": " + ex.getMessage(), ex); } } @@ -488,8 +492,8 @@ public class EntityGraphManager Sample parentSample = repository.tryGetSample(parent); if (parentSample == null) { - throw new IllegalStateException("Sample " + parent.getCode() - + " is specified as parent of " + sampleNode.getCode() + throw new IllegalStateException("Sample " + parent.getCode() + + " is specified as parent of " + sampleNode.getCode() + " but hasn't yet created."); } parentIdentifiers.add(parentSample.getIdentifier()); @@ -509,7 +513,7 @@ public class EntityGraphManager } return prefix + sampleNode.getCode() + generateUniqueId(); } - + private AbstractExternalData createDataSet(DataSetNode dataSetNode) { try @@ -548,7 +552,7 @@ public class EntityGraphManager return service.tryGetDataSet(sessionToken, dataSet.getCode()); } catch (Exception ex) { - throw new RuntimeException("Error while creating data set for node " + dataSetNode.getIdentifierAndType() + throw new RuntimeException("Error while creating data set for node " + dataSetNode.getIdentifierAndType() + ": " + ex.getMessage(), ex); } } @@ -574,8 +578,8 @@ public class EntityGraphManager AbstractExternalData parentDataSet = repository.tryGetDataSet(parent); if (parentDataSet == null) { - throw new IllegalStateException("Data set " + parent.getCode() - + " is specified as " + relationType + " of " + dataSetNode.getCode() + throw new IllegalStateException("Data set " + parent.getCode() + + " is specified as " + relationType + " of " + dataSetNode.getCode() + " but hasn't yet created."); } parentCodes.add(parentDataSet.getCode()); @@ -592,7 +596,7 @@ public class EntityGraphManager { return "-" + service.createPermId(sessionToken); } - + private void createGraph(EntityGraphGenerator g) { repository = new EntityRepository(); @@ -621,13 +625,13 @@ public class EntityGraphManager private void createSamples(Space space, EntityGraphGenerator g) { ArrayList<SampleNode> sampleNodes = new ArrayList<SampleNode>(g.getSamples().values()); -// Collections.reverse(sampleNodes); + // Collections.reverse(sampleNodes); for (SampleNode sampleNode : sampleNodes) { repository.put(sampleNode, createSample(sampleNode, space)); } } - + private void createExperiments(Project project, EntityGraphGenerator g) { for (ExperimentNode experimentNode : g.getExperiments().values()) @@ -635,34 +639,51 @@ public class EntityGraphManager repository.put(experimentNode, createExperiment(experimentNode, project)); } } - + private final class EntityRepository { private Map<Long, Experiment> experimentsNodeToDtoMap = new TreeMap<Long, Experiment>(); + private Map<Long, ModificationInfo> experimentModificationInfoByNodeId = new HashMap<Long, ModificationInfo>(); + private Set<ExperimentNode> modifiedExperimentNodes = new HashSet<ExperimentNode>(); + private Set<ExperimentNode> deletedExperimentNodes = new HashSet<ExperimentNode>(); - + private Map<Long, Sample> samplesNodeToDtoMap = new TreeMap<Long, Sample>(); + private Map<Long, SampleNode> samplesDtoToNodeMap = new TreeMap<Long, SampleNode>(); + private Map<Long, ModificationInfo> sampleModificationInfoByNodeId = new HashMap<Long, ModificationInfo>(); + private Set<SampleNode> modifiedSampleNodes = new HashSet<SampleNode>(); + private Set<SampleNode> deletedSampleNodes = new HashSet<SampleNode>(); private Map<Long, AbstractExternalData> dataSetsNodeToDtoMap = new TreeMap<Long, AbstractExternalData>(); + private Map<Long, DataSetNode> dataSetsDtoToNodeMap = new TreeMap<Long, DataSetNode>(); + private Map<Long, ModificationInfo> dataSetModificationInfoByNodeId = new HashMap<Long, ModificationInfo>(); + private Set<DataSetNode> modifiedDataSetNodes = new HashSet<DataSetNode>(); + private Set<DataSetNode> deletedDataSetNodes = new HashSet<DataSetNode>(); private Map<Long, Set<Long>> experimentSamplesMap = new HashMap<Long, Set<Long>>(); + private Map<Long, Set<Long>> childrenSamplesMap = new HashMap<Long, Set<Long>>(); + private Map<Long, Set<Long>> componentSamplesMap = new HashMap<Long, Set<Long>>(); + private Map<Long, Set<Long>> experimentDataSetsMap = new HashMap<Long, Set<Long>>(); + private Map<Long, Set<Long>> sampleDataSetsMap = new HashMap<Long, Set<Long>>(); + private Map<Long, Set<Long>> componentDataSetsMap = new HashMap<Long, Set<Long>>(); + private Map<Long, Set<Long>> parentDataSetsMap = new HashMap<Long, Set<Long>>(); - + public String renderNodeToDtoMapping() { StringBuilder builder = new StringBuilder(); @@ -680,8 +701,8 @@ public class EntityGraphManager } return builder.toString(); } - - private void render(StringBuilder builder, String prefix, Long id, + + private void render(StringBuilder builder, String prefix, Long id, CodeWithRegistrationAndModificationDate<?> entity) { builder.append(prefix).append(id).append(" -> ").append(entity.getCode()).append(" ("); @@ -693,12 +714,12 @@ public class EntityGraphManager builder.append(entity.getModifier().getUserId()).append(", "); builder.append(entity.getModificationDate()).append(")\n"); } - + public String getExperimentIdentifierOrNull(ExperimentNode experimentNodeOrNull) { return experimentNodeOrNull == null ? null : getExperiment(experimentNodeOrNull).getIdentifier(); } - + public Experiment getExperiment(ExperimentNode experimentNode) { Experiment experiment = tryGetExperiment(experimentNode); @@ -708,17 +729,17 @@ public class EntityGraphManager } return experiment; } - + public Experiment tryGetExperiment(ExperimentNode experimentNode) { return experimentsNodeToDtoMap.get(experimentNode.getId()); } - + public String getSamplePermIdOrNull(SampleNode sampleNodeOrNull) { return sampleNodeOrNull == null ? null : getSample(sampleNodeOrNull).getPermId(); } - + public Sample getSample(SampleNode sampleNode) { Sample sample = tryGetSample(sampleNode); @@ -728,17 +749,17 @@ public class EntityGraphManager } return sample; } - + public Sample tryGetSample(SampleNode sampleNode) { return samplesNodeToDtoMap.get(sampleNode.getId()); } - + public String getDataSetCodeOrNull(DataSetNode dataSetNodeOrNull) { return dataSetNodeOrNull == null ? null : getDataSet(dataSetNodeOrNull).getCode(); } - + public AbstractExternalData getDataSet(DataSetNode dataSetNode) { AbstractExternalData dataSet = tryGetDataSet(dataSetNode); @@ -748,12 +769,12 @@ public class EntityGraphManager } return dataSet; } - + public AbstractExternalData tryGetDataSet(DataSetNode dataSetNode) { return dataSetsNodeToDtoMap.get(dataSetNode.getId()); } - + void refreshGraph(boolean showWhereIAm) { refreshExperimentDtos(); @@ -770,8 +791,8 @@ public class EntityGraphManager private void refreshDataSetDtos() { - List<Entry<Long, AbstractExternalData>> nodeToDtoMapping - = new ArrayList<Entry<Long, AbstractExternalData>>(dataSetsNodeToDtoMap.entrySet()); + List<Entry<Long, AbstractExternalData>> nodeToDtoMapping = + new ArrayList<Entry<Long, AbstractExternalData>>(dataSetsNodeToDtoMap.entrySet()); dataSetsNodeToDtoMap.clear(); for (Entry<Long, AbstractExternalData> entry : nodeToDtoMapping) { @@ -904,7 +925,7 @@ public class EntityGraphManager } System.out.println("..."); } - + private void addToEntitiesMap(Map<Long, Set<Long>> entityToEntitiesMap, IIdHolder keyEntity, IIdHolder valueEntity) { if (keyEntity != null) @@ -919,7 +940,7 @@ public class EntityGraphManager entityIds.add(valueEntity.getId()); } } - + void gatherModifictaionInfos() { for (Entry<Long, Experiment> entry : experimentsNodeToDtoMap.entrySet()) @@ -935,63 +956,63 @@ public class EntityGraphManager dataSetModificationInfoByNodeId.put(entry.getKey(), new ModificationInfo(entry.getValue())); } } - + void put(ExperimentNode experimentNode, Experiment experiment) { experimentsNodeToDtoMap.put(experimentNode.getId(), experiment); } - - public void assertModified(ExperimentNode...experimentNodes) + + public void assertModified(ExperimentNode... experimentNodes) { - assertModificationInfo(true, experimentModificationInfoByNodeId, experimentsNodeToDtoMap, - Arrays.<EntityNode>asList(experimentNodes)); + assertModificationInfo(true, experimentModificationInfoByNodeId, experimentsNodeToDtoMap, + Arrays.<EntityNode> asList(experimentNodes)); modifiedExperimentNodes.addAll(Arrays.asList(experimentNodes)); } - - public void assertDeleted(ExperimentNode...experimentNodes) + + public void assertDeleted(ExperimentNode... experimentNodes) { - assertDeleted(experimentsNodeToDtoMap, Arrays.<EntityNode>asList(experimentNodes)); + assertDeleted(experimentsNodeToDtoMap, Arrays.<EntityNode> asList(experimentNodes)); deletedExperimentNodes.addAll(Arrays.asList(experimentNodes)); } - + void put(SampleNode sampleNode, Sample sample) { samplesNodeToDtoMap.put(sampleNode.getId(), sample); samplesDtoToNodeMap.put(sample.getId(), sampleNode); } - public void assertModified(SampleNode...sampleNodes) + public void assertModified(SampleNode... sampleNodes) { - assertModificationInfo(true, sampleModificationInfoByNodeId, samplesNodeToDtoMap, - Arrays.<EntityNode>asList(sampleNodes)); + assertModificationInfo(true, sampleModificationInfoByNodeId, samplesNodeToDtoMap, + Arrays.<EntityNode> asList(sampleNodes)); modifiedSampleNodes.addAll(Arrays.asList(sampleNodes)); } - - public void assertDeleted(SampleNode...sampleNodes) + + public void assertDeleted(SampleNode... sampleNodes) { - assertDeleted(samplesNodeToDtoMap, Arrays.<EntityNode>asList(sampleNodes)); + assertDeleted(samplesNodeToDtoMap, Arrays.<EntityNode> asList(sampleNodes)); deletedSampleNodes.addAll(Arrays.asList(sampleNodes)); } - + void put(DataSetNode dataSetNode, AbstractExternalData dataSet) { dataSetsNodeToDtoMap.put(dataSetNode.getId(), dataSet); dataSetsDtoToNodeMap.put(dataSet.getId(), dataSetNode); } - - public void assertModified(DataSetNode...dataSetNodes) + + public void assertModified(DataSetNode... dataSetNodes) { - assertModificationInfo(true, dataSetModificationInfoByNodeId, dataSetsNodeToDtoMap, - Arrays.<EntityNode>asList(dataSetNodes)); + assertModificationInfo(true, dataSetModificationInfoByNodeId, dataSetsNodeToDtoMap, + Arrays.<EntityNode> asList(dataSetNodes)); modifiedDataSetNodes.addAll(Arrays.asList(dataSetNodes)); } - - public void assertDeleted(DataSetNode...dataSetNodes) + + public void assertDeleted(DataSetNode... dataSetNodes) { - assertDeleted(dataSetsNodeToDtoMap, Arrays.<EntityNode>asList(dataSetNodes)); + assertDeleted(dataSetsNodeToDtoMap, Arrays.<EntityNode> asList(dataSetNodes)); deletedDataSetNodes.addAll(Arrays.asList(dataSetNodes)); } - + public void assertUnmodified(EntityGraphGenerator g) { Set<EntityNode> unmodifiedExperimentNodes = new HashSet<EntityNode>(g.getExperiments().values()); @@ -1004,7 +1025,7 @@ public class EntityGraphManager unmodifiedDataSetNodes.removeAll(modifiedDataSetNodes); assertModificationInfo(false, dataSetModificationInfoByNodeId, dataSetsNodeToDtoMap, unmodifiedDataSetNodes); } - + private void assertModificationInfo(boolean modified, Map<Long, ModificationInfo> previousInfos, Map<Long, ? extends CodeWithRegistrationAndModificationDate<?>> nodeToDtoMap, Collection<EntityNode> entityNodes) @@ -1029,22 +1050,22 @@ public class EntityGraphManager ModificationInfo current = new ModificationInfo(entity); if (modified) { - assertEquals(node.getCode() + " has unexpectedly still the old modifier: " + current.modifier, + assertEquals(node.getCode() + " has unexpectedly still the old modifier: " + current.modifier, false, current.modifier.equals(previous.modifier)); - assertEquals(node.getCode() + " has unexpectedly still the old modification date: " - + current.modificationDate + " > " + previous.modificationDate, + assertEquals(node.getCode() + " has unexpectedly still the old modification date: " + + current.modificationDate + " > " + previous.modificationDate, true, current.modificationDate.getTime() > previous.modificationDate.getTime()); } else { assertEquals(node.getCode() + " has unexpectedly a new modifier: ", previous.modifier, current.modifier); - assertEquals(node.getCode() + " has unexpectedly a new modification date:", + assertEquals(node.getCode() + " has unexpectedly a new modification date:", previous.modificationDate, current.modificationDate); } } } } - + private void assertDeleted(Map<Long, ? extends CodeWithRegistrationAndModificationDate<?>> nodeToDtoMap, Collection<EntityNode> entityNodes) { @@ -1056,7 +1077,7 @@ public class EntityGraphManager } } } - + public void assertUndeleted(EntityGraphGenerator g) { Set<EntityNode> undeletedExperimentNodes = new HashSet<EntityNode>(g.getExperiments().values()); @@ -1069,7 +1090,7 @@ public class EntityGraphManager undeletedDataSetNodes.removeAll(deletedDataSetNodes); assertUndeleted(dataSetsNodeToDtoMap, undeletedDataSetNodes); } - + private void assertUndeleted(Map<Long, ? extends CodeWithRegistrationAndModificationDate<?>> nodeToDtoMap, Collection<EntityNode> entityNodes) { @@ -1087,26 +1108,25 @@ public class EntityGraphManager fail("The following nodes have been deleted: " + deletedNodes); } } - Set<SampleNode> getSampleNodes(ExperimentNode experimentNode) { - return getEntityNodes(experimentSamplesMap, experimentsNodeToDtoMap.get(experimentNode.getId()), + return getEntityNodes(experimentSamplesMap, experimentsNodeToDtoMap.get(experimentNode.getId()), samplesDtoToNodeMap); } - + Set<SampleNode> getChildrenSampleNodes(SampleNode sampleNode) { - return getEntityNodes(childrenSamplesMap, samplesNodeToDtoMap.get(sampleNode.getId()), + return getEntityNodes(childrenSamplesMap, samplesNodeToDtoMap.get(sampleNode.getId()), samplesDtoToNodeMap); } - + Set<SampleNode> getComponentSampleNodes(SampleNode sampleNode) { - return getEntityNodes(componentSamplesMap, samplesNodeToDtoMap.get(sampleNode.getId()), + return getEntityNodes(componentSamplesMap, samplesNodeToDtoMap.get(sampleNode.getId()), samplesDtoToNodeMap); } - + Set<DataSetNode> getDataSetNodes(ExperimentNode experimentNode) { return getDataSetNodes(experimentDataSetsMap, experimentsNodeToDtoMap.get(experimentNode.getId())); @@ -1116,23 +1136,23 @@ public class EntityGraphManager { return getDataSetNodes(sampleDataSetsMap, samplesNodeToDtoMap.get(sampleNode.getId())); } - + Set<DataSetNode> getComponentDataSetNodes(DataSetNode containerDataSetNode) { return getDataSetNodes(componentDataSetsMap, dataSetsNodeToDtoMap.get(containerDataSetNode.getId())); } - + Set<DataSetNode> getParentDataSetNodes(DataSetNode childDataSetNode) { return getDataSetNodes(parentDataSetsMap, dataSetsNodeToDtoMap.get(childDataSetNode.getId())); } - + private Set<DataSetNode> getDataSetNodes(Map<Long, Set<Long>> idHolderDataSetsMap, IIdHolder idHolder) { return getEntityNodes(idHolderDataSetsMap, idHolder, dataSetsDtoToNodeMap); } - private <T extends EntityNode> Set<T> getEntityNodes(Map<Long, Set<Long>> idHolderEntitiesMap, IIdHolder idHolder, + private <T extends EntityNode> Set<T> getEntityNodes(Map<Long, Set<Long>> idHolderEntitiesMap, IIdHolder idHolder, Map<Long, T> dtoToNodeMap) { Set<T> result = new TreeSet<T>(); @@ -1150,10 +1170,11 @@ public class EntityGraphManager return result; } } - + private static final class ModificationInfo { private final String modifier; + private final Date modificationDate; ModificationInfo(CodeWithRegistrationAndModificationDate<?> entity) diff --git a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/systemtest/optimistic_locking/MultiThreadOptimisticLockingTestCase.java b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/systemtest/optimistic_locking/MultiThreadOptimisticLockingTestCase.java index be70605def9..05fdf33cd27 100644 --- a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/systemtest/optimistic_locking/MultiThreadOptimisticLockingTestCase.java +++ b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/systemtest/optimistic_locking/MultiThreadOptimisticLockingTestCase.java @@ -33,6 +33,7 @@ import ch.systemsx.cisd.openbis.systemtest.PersistentSystemTestCase; public class MultiThreadOptimisticLockingTestCase extends PersistentSystemTestCase { static final String CREATING_ENTITIES = "creating entities"; + protected ToolBox toolBox; @BeforeMethod @@ -53,5 +54,5 @@ public class MultiThreadOptimisticLockingTestCase extends PersistentSystemTestCa throw new Error(m.getName() + "() : ", t); } } - + } diff --git a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/systemtest/optimistic_locking/MultiThreadProjectOptimisticLockingTest.java b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/systemtest/optimistic_locking/MultiThreadProjectOptimisticLockingTest.java index b4539cd66b8..090d2686d0d 100644 --- a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/systemtest/optimistic_locking/MultiThreadProjectOptimisticLockingTest.java +++ b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/systemtest/optimistic_locking/MultiThreadProjectOptimisticLockingTest.java @@ -49,11 +49,9 @@ public class MultiThreadProjectOptimisticLockingTest extends MultiThreadOptimist private static final String CREATE_EXPERIMENTS_PHASE = "createExperiments"; /* - * This test registers three experiments for the same project. Two of them are registered by the - * main thread using performEntityOperations(). A second thread registers an experiment between - * the registration of the two other experiments. This is done by using a - * IServiceConversationProgressListener together with two message channels to coordinate the - * order of actions in both threads. + * This test registers three experiments for the same project. Two of them are registered by the main thread using performEntityOperations(). A + * second thread registers an experiment between the registration of the two other experiments. This is done by using a + * IServiceConversationProgressListener together with two message channels to coordinate the order of actions in both threads. */ @Test public void testRegisterExperimentsInTwoThreads() diff --git a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/systemtest/optimistic_locking/MultiThreadSampleOptimisticLockingTest.java b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/systemtest/optimistic_locking/MultiThreadSampleOptimisticLockingTest.java index d8bcd226f13..774fb1c6ecf 100644 --- a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/systemtest/optimistic_locking/MultiThreadSampleOptimisticLockingTest.java +++ b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/systemtest/optimistic_locking/MultiThreadSampleOptimisticLockingTest.java @@ -164,12 +164,8 @@ public class MultiThreadSampleOptimisticLockingTest extends MultiThreadOptimisti } /** - * This test is flaky. - * - * If the transaction of performEntityOperations() call in the new thread ends before - * the transaction of performEntityOperations() call in the main thread, the modifier of - * the sample will be "optimist" and the test fails. - * + * This test is flaky. If the transaction of performEntityOperations() call in the new thread ends before the transaction of + * performEntityOperations() call in the main thread, the modifier of the sample will be "optimist" and the test fails. */ @Test public void testRegisterDataSetsForSameSampleInTwoThreads() diff --git a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/systemtest/optimistic_locking/ToolBox.java b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/systemtest/optimistic_locking/ToolBox.java index 3f20d81a796..4ca0b6b323c 100644 --- a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/systemtest/optimistic_locking/ToolBox.java +++ b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/systemtest/optimistic_locking/ToolBox.java @@ -117,7 +117,7 @@ public class ToolBox private final IServiceForDataStoreServer etlService; private final IDAOFactory daoFactory; - + private final String systemSessionToken; public Space space1; @@ -129,7 +129,7 @@ public class ToolBox public Project project2; public ToolBox(ICommonServer commonServer, IGenericServer genericServer, - IServiceForDataStoreServer etlService, String systemSessionToken, + IServiceForDataStoreServer etlService, String systemSessionToken, ApplicationContext applicationContext) { this.commonServer = commonServer; @@ -138,7 +138,7 @@ public class ToolBox this.systemSessionToken = systemSessionToken; daoFactory = applicationContext.getBean(IDAOFactory.class); } - + TimeIntervalChecker createTimeIntervalChecker() { return new TimeIntervalChecker(daoFactory.getTransactionTimestamp()); @@ -226,14 +226,14 @@ public class ToolBox List<String> dataSetCodes = new ArrayList<String>(codes); commonServer.deleteDataSets(systemSessionToken, dataSetCodes, "cleanup", DeletionType.TRASH, true); } - + private List<TechId> listExperimentIds(Space space) { ExperimentType experimentType = new ExperimentTypeBuilder().code(EXPERIMENT_TYPE_CODE).getExperimentType(); SpaceIdentifier spaceIdentifier = new SpaceIdentifierFactory(space.getIdentifier()).createIdentifier(); return TechId.createList(commonServer.listExperiments(systemSessionToken, experimentType, spaceIdentifier)); } - + private List<TechId> listSampleIds(Space space) { ListSampleCriteria criteria = new ListSampleCriteria(); diff --git a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/systemtest/plugin/generic/EntityValidationTest.java b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/systemtest/plugin/generic/EntityValidationTest.java index f519624bc5e..6252997980e 100644 --- a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/systemtest/plugin/generic/EntityValidationTest.java +++ b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/systemtest/plugin/generic/EntityValidationTest.java @@ -77,7 +77,7 @@ public class EntityValidationTest extends GenericSystemTestCase private static final String IMPOSSIBLE_TO_UPDATE_TYPE = "IMPOSSIBLE_TO_UPDATE"; private static final int TEST_SCRIPT_ID = 8; - + @Autowired private IDAOFactory daoFactory; @@ -340,7 +340,7 @@ public class EntityValidationTest extends GenericSystemTestCase AbstractExternalData dataset = commonServer.getDataSetInfo(systemSessionToken, new TechId(26l)); - + DataSetUpdatesDTO updates = new DataSetUpdatesDTO(); updates.setDatasetId(new TechId(26)); updates.setVersion(dataset.getVersion()); diff --git a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/systemtest/plugin/generic/FileFormatTypeHeadlessTest.java b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/systemtest/plugin/generic/FileFormatTypeHeadlessTest.java index ee26c6b5419..daed4cd77c3 100644 --- a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/systemtest/plugin/generic/FileFormatTypeHeadlessTest.java +++ b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/systemtest/plugin/generic/FileFormatTypeHeadlessTest.java @@ -73,7 +73,6 @@ public class FileFormatTypeHeadlessTest extends SystemTestCase TypedTableResultSet<FileFormatType> tableResultSet = commonClientService.listFileTypes(criteria); - Row expectedRow = new Row().withCell("CODE", fft.getCode()).withCell("DESCRIPTION", fft.getDescription()); diff --git a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/systemtest/plugin/query/QuerySystemTestCase.java b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/systemtest/plugin/query/QuerySystemTestCase.java index b666241c975..9829f4fd886 100644 --- a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/systemtest/plugin/query/QuerySystemTestCase.java +++ b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/systemtest/plugin/query/QuerySystemTestCase.java @@ -22,19 +22,16 @@ import ch.systemsx.cisd.openbis.plugin.query.client.web.client.IQueryClientServi import ch.systemsx.cisd.openbis.systemtest.SystemTestCase; /** - * - * * @author Franz-Josef Elmer */ public class QuerySystemTestCase extends SystemTestCase { protected IQueryClientService queryClientService; - + @Autowired public final void setQueryClientService(IQueryClientService queryClientService) { this.queryClientService = queryClientService; } - } diff --git a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/systemtest/relationshipshistory/SampleToSampleRelationshipsHistoryTest.java b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/systemtest/relationshipshistory/SampleToSampleRelationshipsHistoryTest.java index bcb03445a51..661bb8bd9bc 100644 --- a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/systemtest/relationshipshistory/SampleToSampleRelationshipsHistoryTest.java +++ b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/systemtest/relationshipshistory/SampleToSampleRelationshipsHistoryTest.java @@ -156,7 +156,7 @@ public class SampleToSampleRelationshipsHistoryTest extends AbstractRelationship updates.setExperimentIdentifierOrNull(child.getExperiment() == null ? null : ExperimentIdentifier.createIdentifier(child.getExperiment())); updates.setModifiedParentCodesOrNull(new String[] - { parent.getIdentifier() }); + { parent.getIdentifier() }); genericClientService.updateSample(updates); diff --git a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/util/LogRecordingUtils.java b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/util/LogRecordingUtils.java index 60330dd40d4..04b73dcbb04 100644 --- a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/util/LogRecordingUtils.java +++ b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/util/LogRecordingUtils.java @@ -21,8 +21,7 @@ import org.apache.log4j.Level; import ch.systemsx.cisd.common.logging.BufferedAppender; /** - * Helper methods to create a log recorder which suppresses log entries from MonitoringPoolingDataSource - * and full text indexer. + * Helper methods to create a log recorder which suppresses log entries from MonitoringPoolingDataSource and full text indexer. * * @author Franz-Josef Elmer */ @@ -32,22 +31,22 @@ public class LogRecordingUtils { return suppress(new BufferedAppender()); } - + public static BufferedAppender createRecorder(Level logLevel) { return suppress(new BufferedAppender(logLevel)); } - + public static BufferedAppender createRecorder(String pattern, Level logLevel) { return suppress(new BufferedAppender(pattern, logLevel)); } - + public static BufferedAppender createRecorder(String pattern, Level logLevel, String loggerNameRegex) { return suppress(new BufferedAppender(pattern, logLevel, loggerNameRegex)); } - + private static BufferedAppender suppress(BufferedAppender logRecorder) { logRecorder.addRegexForLoggingEventsToBeDropped("OPERATION.*FullTextIndex.*"); -- GitLab