Dmp-Profile Delete + Enum
This commit is contained in:
parent
b498a53441
commit
8a67f0c7f1
|
@ -62,6 +62,7 @@ public class DMPProfileDaoImpl extends DatabaseAccess<DMPProfile> implements DMP
|
||||||
QueryableList<DMPProfile> query = getDatabaseService().getQueryable(DMPProfile.class);
|
QueryableList<DMPProfile> query = getDatabaseService().getQueryable(DMPProfile.class);
|
||||||
if (criteria.getLike() != null && !criteria.getLike().isEmpty())
|
if (criteria.getLike() != null && !criteria.getLike().isEmpty())
|
||||||
query.where((builder, root) -> builder.like(builder.upper(root.get("label")), "%" + criteria.getLike().toUpperCase() + "%"));
|
query.where((builder, root) -> builder.like(builder.upper(root.get("label")), "%" + criteria.getLike().toUpperCase() + "%"));
|
||||||
|
query.where(((builder, root) -> builder.notEqual(root.get("status"), DMPProfile.Status.DELETED.getValue())));
|
||||||
return query;
|
return query;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,6 +17,33 @@ import java.util.UUID;
|
||||||
@Table(name = "\"DMPProfile\"")
|
@Table(name = "\"DMPProfile\"")
|
||||||
public class DMPProfile implements DataEntity<DMPProfile, UUID> {
|
public class DMPProfile implements DataEntity<DMPProfile, UUID> {
|
||||||
|
|
||||||
|
public enum Status {
|
||||||
|
SAVED((short) 0), FINALIZED((short) 1), DELETED((short) 99);
|
||||||
|
|
||||||
|
private short value;
|
||||||
|
|
||||||
|
private Status(short value) {
|
||||||
|
this.value = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
public short getValue() {
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Status fromInteger(int value) {
|
||||||
|
switch (value) {
|
||||||
|
case 0:
|
||||||
|
return SAVED;
|
||||||
|
case 1:
|
||||||
|
return FINALIZED;
|
||||||
|
case 99:
|
||||||
|
return DELETED;
|
||||||
|
default:
|
||||||
|
throw new RuntimeException("Unsupported Dmp Profile Status");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Id
|
@Id
|
||||||
@GeneratedValue
|
@GeneratedValue
|
||||||
@GenericGenerator(name = "uuid2", strategy = "uuid2")
|
@GenericGenerator(name = "uuid2", strategy = "uuid2")
|
||||||
|
@ -109,6 +136,7 @@ public class DMPProfile implements DataEntity<DMPProfile, UUID> {
|
||||||
this.modified = new Date();
|
this.modified = new Date();
|
||||||
this.definition = entity.getDefinition();
|
this.definition = entity.getDefinition();
|
||||||
this.label = entity.getLabel();
|
this.label = entity.getLabel();
|
||||||
|
this.status= entity.getStatus();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -0,0 +1,5 @@
|
||||||
|
export enum DmpProfileStatus {
|
||||||
|
Draft = 0,
|
||||||
|
Finalized = 1,
|
||||||
|
Deleted = 99
|
||||||
|
}
|
|
@ -13,6 +13,7 @@ import { DmpProfileService } from '../../../../core/services/dmp/dmp-profile.ser
|
||||||
import { SnackBarNotificationLevel, UiNotificationService } from '../../../../core/services/notification/ui-notification-service';
|
import { SnackBarNotificationLevel, UiNotificationService } from '../../../../core/services/notification/ui-notification-service';
|
||||||
import { EnumUtils } from '../../../../core/services/utilities/enum-utils.service';
|
import { EnumUtils } from '../../../../core/services/utilities/enum-utils.service';
|
||||||
import { DmpProfileEditorModel, DmpProfileFieldEditorModel } from './dmp-profile-editor.model';
|
import { DmpProfileEditorModel, DmpProfileFieldEditorModel } from './dmp-profile-editor.model';
|
||||||
|
import { DmpProfileStatus } from '../../../../core/common/enum/dmp-profile-status';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-dmp-profile-editor-component',
|
selector: 'app-dmp-profile-editor-component',
|
||||||
|
@ -173,6 +174,12 @@ export class DmpProfileEditorComponent extends BaseComponent implements AfterVie
|
||||||
}
|
}
|
||||||
|
|
||||||
delete() {
|
delete() {
|
||||||
//TODO
|
this.formGroup.get('status').setValue(DmpProfileStatus.Deleted);
|
||||||
|
this.dmpProfileService.createDmp(this.formGroup.value)
|
||||||
|
.pipe(takeUntil(this._destroyed))
|
||||||
|
.subscribe(
|
||||||
|
complete => this.onCallbackSuccess(),
|
||||||
|
error => this.onCallbackError(error)
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Reference in New Issue