Skip to content

Commit

Permalink
Merge pull request #3124 from dzhw/#2989-attachment-doi
Browse files Browse the repository at this point in the history
closes #2989
  • Loading branch information
ekrgr committed Sep 15, 2022
2 parents 2c7a1b0 + ea952c0 commit 7ef4fa9
Show file tree
Hide file tree
Showing 9 changed files with 80 additions and 13 deletions.
2 changes: 1 addition & 1 deletion buildconfig/google_checks.xml
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
<property name="allowNonPrintableEscapes" value="true"/>
</module>
<module name="LineLength">
<property name="max" value="100"/>
<property name="max" value="120"/>
<property name="ignorePattern" value="^package.*|^import.*|a href|href|http://|https://|ftp://"/>
</module>
<module name="AvoidStarImport"/>
Expand Down
2 changes: 1 addition & 1 deletion eclipseconfig/eclipse-java-google-style.xml
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_parameters" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_block_comment" value="false"/>
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_in_empty_type_declaration" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.lineSplit" value="100"/>
<setting id="org.eclipse.jdt.core.formatter.lineSplit" value="120"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_if" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_selector_in_method_invocation.count_dependent" value="16|4|48"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_between_brackets_in_array_type_reference" value="do not insert"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,23 @@

/**
* Interface holding regexp for domain validation.
*
*
* @author René Reitmann
* @author Daniel Katzberg
*/
public interface Patterns {
String ALPHANUMERIC = "^[a-zA-Z0-9]+$";
String ALPHANUMERIC_WITH_UNDERSCORE_NO_NUMBER_AS_FIRST_SIGN = "^[_a-zA-Z][_a-zA-Z0-9]*$";
String GERMAN_ALPHANUMERIC_WITH_UNDERSCORE_AND_MINUS = "^[_A-Za-z0-9äöüÄÖÜß\\-]*$";
String GERMAN_ALPHANUMERIC_WITH_UNDERSCORE_AND_MINUS_AND_DOLLAR =
String GERMAN_ALPHANUMERIC_WITH_UNDERSCORE_AND_MINUS_AND_DOLLAR =
"^[_A-Za-z0-9äöüÄÖÜß\\-\\$]*$";
String GERMAN_ALPHANUMERIC_WITH_UNDERSCORE_AND_MINUS_AND_DOT = "^[_A-Za-z0-9äöüÄÖÜß\\-\\.]*$";

String DOI = "^https:\\/\\/doi.org\\/([_A-Za-z0-9äöüÄÖÜß\\-\\/\\:.]{1,}$)";
String GERMAN_ALPHANUMERIC_WITH_UNDERSCORE_AND_MINUS_AND_DOT_AND_DOLLAR =
"^[_A-Za-z0-9äöüÄÖÜß\\-\\.\\$]*$";
String NO_WHITESPACE = "^[^\\s]*$";

String SEMVER = "^(0|[1-9]\\d*)\\.(0|[1-9]\\d*)\\.(0|[1-9]\\d*)"
+ "(-(0|[1-9]\\d*|\\d*[a-zA-Z-][0-9a-zA-Z-]*)"
+ "(\\.(0|[1-9]\\d*|\\d*[a-zA-Z-][0-9a-zA-Z-]*))*)?(\\+[0-9a-zA-Z-]+(\\.[0-9a-zA-Z-]+)*)?$";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ public class DataPackageAttachmentMetadata extends AbstractShadowableRdcDomainOb

/**
* Additional details required to generate a citation hint for Method Reports.
*
*
* Can be null for other attachment types than method reports. Can also be null for legacy method
* reports.
*/
Expand Down Expand Up @@ -157,6 +157,19 @@ public class DataPackageAttachmentMetadata extends AbstractShadowableRdcDomainOb
+ "not-supported")
private String language;

/**
* The doi of the attachment.
*
* Must not contain more than 512 characters.
*
* Must match the pattern of a doi-url https://doi.org/{id}
*/
@Size(max = StringLengths.MEDIUM, message = "attachment.error.doi.size")
@Pattern(
message = "data-package-management.error.data-package-attachment-metadata.filename.not-valid",
regexp = Patterns.DOI)
private String doi;

/**
* Generate the id of this attachment from the dataPackageId and the fileName.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@
</md-input-container>
</div>
<div layout-gt-sm="row" layout="column">
<md-input-container flex="50" class="ms-flex mr8" md-is-error="!attachmentForm.descriptionDe.$valid && (attachmentForm.descriptionDe.$dirty || attachmentForm.descriptionDe.$touched)">
<md-input-container flex="50" class="ms-flex" md-is-error="!attachmentForm.descriptionDe.$valid && (attachmentForm.descriptionDe.$dirty || attachmentForm.descriptionDe.$touched)">
<label class="fdz-input-required">{{'attachment.label.description' | translate}} ({{'global.in-german' | translate}})</label>
<input fdz-required="!ctrl.attachmentMetadata.description.en" md-maxlength="512" ng-model="ctrl.attachmentMetadata.description.de" name="descriptionDe" lang="de" md-no-asterisk>
<div ng-if="!attachmentForm.descriptionDe.$dirty && !attachmentForm.descriptionDe.$touched" class="fdz-input-hint">{{'attachment.hint.description.de' | translate}}</div>
Expand All @@ -107,16 +107,29 @@
<div ng-message="md-maxlength">{{'attachment.error.description.i18n-string-size' | translate}}</div>
</div>
</md-input-container>
<md-input-container flex="50" class="ms-flex mr8" md-is-error="!attachmentForm.descriptionEn.$valid && (attachmentForm.descriptionEn.$dirty || attachmentForm.descriptionEn.$touched)">
<md-input-container flex="50" class="ms-flex" md-is-error="!attachmentForm.descriptionEn.$valid && (attachmentForm.descriptionEn.$dirty || attachmentForm.descriptionEn.$touched)">
<label class="fdz-input-required">{{'attachment.label.description' | translate}} ({{'global.in-english' | translate}})</label>
<input fdz-required="!ctrl.attachmentMetadata.description.de" md-maxlength="512" ng-model="ctrl.attachmentMetadata.description.en" name="descriptionEn" lang="en" md-no-asterisk>
<div ng-if="!attachmentForm.descriptionEn.$dirty && !attachmentForm.descriptionEn.$touched" class="fdz-input-hint">{{'attachment.hint.description.en' | translate}}</div>
<div ng-messages="attachmentForm.descriptionEn.$error" multiple>
<div ng-message="fdz-required">{{'attachment.error.description.i18n-string-not-empty' | translate}}</div>
<div ng-message="fdz-required">{{'atthiuzguachment.error.description.i18n-string-not-empty' | translate}}</div>
<div ng-message="md-maxlength">{{'attachment.error.description.i18n-string-size' | translate}}</div>
</div>
</md-input-container>
</div>
<div flex="100" flex-gt-sm="50" layout="column" layout-gt-sm="row" class="ms-flex">
<md-input-container flex="50" class="ms-flex" md-is-error="!attachmentForm.doi.$valid && (attachmentForm.doi.$dirty || attachmentForm.doi.$touched)">
<label>{{'attachment.label.doi' | translate}}</label>
<input ng-pattern="/^https:\/\/doi.org\/?([_A-Za-z0-9äöüÄÖÜß\-\/\:.]{2,}$)/" md-maxlength="512" name="doi" ng-model="ctrl.attachmentMetadata.doi">
<div class="fdz-input-hint" ng-if="!attachmentForm.doi.$dirty && !attachmentForm.doi.$touched" >
{{'attachment.hint.doi' | translate}}
</div>
<div multiple ng-messages="attachmentForm.doi.$error">
<div ng-message="md-maxlength">{{'attachment.error.doi.size' | translate}}</div>
<div ng-message="pattern">{{'attachment.error.doi.pattern' | translate}}</div>
</div>
</md-input-container>
</div>
</md-card-content>
</md-card>
<edit-people-component ng-if="ctrl.attachmentMetadata.type.en === 'Method Report' && ctrl.attachmentMetadata.citationDetails" people="ctrl.attachmentMetadata.citationDetails.authors" people-id="'authors'" translation-keys="ctrl.translationKeys" current-form="attachmentForm"></edit-people-component>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,11 @@ angular.module('metadatamanagementApp').config(
'title': {
'maxlength': 'Der Titel des Attachments darf nicht länger als 2048 Zeichen sein.',
'not-empty': 'Der Titel des Attachments darf nicht leer sein.'
},

'doi': {
'size': 'Die DOI muss kurzer als 512 Zeichen sein.',
'pattern': 'Die DOI-Url sollte nach folgendem Muster eingegtragen werden: https://doi.org/<id>'
}
},
'hint': {
Expand All @@ -44,14 +49,16 @@ angular.module('metadatamanagementApp').config(
'description': {
'de': 'Geben Sie eine Beschreibung dieser Datei auf Deutsch ein.',
'en': 'Geben Sie eine Beschreibung dieser Datei auf Englisch ein.'
}
},
'doi': 'Bitte tragen Sie die DOI als URL ein (Beispiel: https://doi.org/10.21249/DZHW:gra2009:2.0.0).',
},
'label': {
'description': 'Beschreibung',
'file': 'Datei',
'type': 'Typ',
'language': 'Dokumentensprache',
'title': 'Titel'
'title': 'Titel',
'doi': 'DOI',
},
'tooltip': {
'cancel': 'Klicken, um den Dialog, ohne zu speichern, zu schließen.',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,10 @@ angular.module('metadatamanagementApp').config(
'title': {
'maxlength': 'The title of the attachment must not contain more than 2048 characters.',
'not-empty': 'The titel of the attachment must not be empty.'
},
'doi': {
'size': 'The DOI must be shorter then 512 characters.',
'pattern': 'The DOI-Url should match the following pattern: https://doi.org/<id>'
}
},
'hint': {
Expand All @@ -44,14 +48,16 @@ angular.module('metadatamanagementApp').config(
'description': {
'de': 'Please enter a description for the file in German.',
'en': 'Please enter a description for the file in English.'
}
},
'doi': 'Please enter the DOI as URL (Example: https://doi.org/10.21249/DZHW:gra2009:2.0.0).',
},
'label': {
'description': 'Description',
'file': 'File',
'type': 'Type',
'language': 'Document Language',
'title': 'Title'
'title': 'Title',
'doi': 'DOI',
},
'tooltip': {
'cancel': 'Click to close this dialog without saving.',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@
</th>
<th>{{'data-package-management.detail.label.attachments.language' | translate }}
</th>
<th>DOI
</th>
<th>{{'data-package-management.detail.label.attachments.file' | translate }}
</th>
</tr>
Expand All @@ -32,6 +34,17 @@
<td lang="{{row.language}}">{{row.title}}&nbsp;</td>
<td class="fdz-text-block" display-i18n-string="row.description" ></td>
<td>{{row.language | displayIsoLanguage: $ctrl.lang}}</td>
<td>
<a target="_blank" rel="noopener noreferrer" href="{{row.doi}}" ng-if="row.doi">
<md-icon md-font-set="material-icons" class="ng-scope material-icons md-primary" role="img">link</md-icon>
<md-tooltip md-autohide="true" md-z-index="bowser.mobile || bowser.tablet ? -100 : 100001">
{{row.doi}}
</md-tooltip>
<a ng-if="!row.doi" aria-disabled>
<md-icon md-font-set="material-icons" class="ng-scope material-icons" role="img">link_off</md-icon>
</a>
</a>
</td>
<td class="fdz-td-filename"><a ng-href="{{row.id}}" target="_blank" fdz-track-download analytics-if="row.type.en === 'Method Report'" analytics-on="click" analytics-event="download-method-report" analytics-label="{{row.title}}" analytics-category="Downloads">{{row.fileName}}
<md-tooltip md-autohide="true" md-z-index="bowser.mobile || bowser.tablet ? -100 : 100001">
{{'global.tooltips.files.download' | translate: {filename: row.fileName} }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -645,6 +645,8 @@
{{'data-package-management.detail.label.attachments.language' | translate }}
</md-tooltip>
</th>
<th>DOI
</th>
<th>{{'data-package-management.detail.label.attachments.file' | translate }}
<md-tooltip hide-gt-xs md-direction="right">
{{'data-package-management.detail.label.attachments.file' | translate }}
Expand Down Expand Up @@ -689,6 +691,17 @@
<td class="fdz-text-block" display-i18n-string="row.description" ></td>
<td lang="{{row.language}}">{{row.title}}&nbsp;</td>
<td>{{row.language | displayIsoLanguage: currentLanguage}}&nbsp;</td>
<td>
<a target="_blank" rel="noopener noreferrer" href="{{row.doi}}" ng-if="row.doi">
<md-icon md-font-set="material-icons" class="ng-scope material-icons md-primary" role="img">link</md-icon>
<md-tooltip md-autohide="true" md-z-index="bowser.mobile || bowser.tablet ? -100 : 100001">
{{row.doi}}
</md-tooltip>
</a>
<a ng-if="!row.doi" aria-disabled>
<md-icon md-font-set="material-icons" class="ng-scope material-icons" role="img">link_off</md-icon>
</a>
</td>
<td class="nowrap"><a ng-href="{{row.id}}" target="_blank">{{row.fileName}}
<md-tooltip md-autohide="true" md-z-index="bowser.mobile || bowser.tablet ? -100 : 100001">
{{'global.tooltips.files.download' | translate: {filename: row.fileName} }}
Expand Down

0 comments on commit 7ef4fa9

Please sign in to comment.