use of org.springframework.web.bind.annotation.ResponseStatus in project plumdo-work by wengwh.
the class TaskIdentityResource method createIdentityLink.
@RequestMapping(value = "/task/{taskId}/identity", method = RequestMethod.POST, name = "任务候选人创建")
@ResponseStatus(value = HttpStatus.OK)
public void createIdentityLink(@PathVariable("taskId") String taskId, @RequestBody TaskIdentityRequest taskIdentityRequest) {
Task task = getTaskFromRequest(taskId, false);
validateIdentityLinkArguments(taskIdentityRequest.getIdentityId(), taskIdentityRequest.getType());
if (TaskIdentityRequest.AUTHORIZE_GROUP.equals(taskIdentityRequest.getType())) {
taskService.addGroupIdentityLink(task.getId(), taskIdentityRequest.getIdentityId(), IdentityLinkType.CANDIDATE);
} else if (TaskIdentityRequest.AUTHORIZE_USER.equals(taskIdentityRequest.getType())) {
taskService.addUserIdentityLink(task.getId(), taskIdentityRequest.getIdentityId(), IdentityLinkType.CANDIDATE);
}
}
use of org.springframework.web.bind.annotation.ResponseStatus in project ORCID-Source by ORCID.
the class PasswordResetController method sendReactivation.
@RequestMapping(value = "/sendReactivation.json", method = RequestMethod.POST)
@ResponseStatus(value = HttpStatus.OK)
public void sendReactivation(@RequestParam("email") String email) {
OrcidProfile orcidProfile = orcidProfileCacheManager.retrieve(emailManager.findOrcidIdByEmail(email));
notificationManager.sendReactivationEmail(email, orcidProfile);
}
use of org.springframework.web.bind.annotation.ResponseStatus in project dhis2-core by dhis2.
the class CompleteDataSetRegistrationController method deleteCompleteDataSetRegistration.
// -------------------------------------------------------------------------
// DELETE
// -------------------------------------------------------------------------
@ApiVersion({ DhisApiVersion.ALL, DhisApiVersion.DEFAULT })
@RequestMapping(method = RequestMethod.DELETE)
@ResponseStatus(HttpStatus.NO_CONTENT)
public void deleteCompleteDataSetRegistration(@RequestParam Set<String> ds, @RequestParam String pe, @RequestParam String ou, @RequestParam(required = false) String cc, @RequestParam(required = false) String cp, @RequestParam(required = false) boolean multiOu, HttpServletResponse response) throws WebMessageException {
Set<DataSet> dataSets = new HashSet<>(manager.getByUid(DataSet.class, ds));
if (dataSets.size() != ds.size()) {
throw new WebMessageException(WebMessageUtils.conflict("Illegal data set identifier in this list: " + ds));
}
Period period = PeriodType.getPeriodFromIsoString(pe);
if (period == null) {
throw new WebMessageException(WebMessageUtils.conflict("Illegal period identifier: " + pe));
}
OrganisationUnit organisationUnit = organisationUnitService.getOrganisationUnit(ou);
if (organisationUnit == null) {
throw new WebMessageException(WebMessageUtils.conflict("Illegal organisation unit identifier: " + ou));
}
DataElementCategoryOptionCombo attributeOptionCombo = inputUtils.getAttributeOptionCombo(cc, cp, false);
if (attributeOptionCombo == null) {
return;
}
// ---------------------------------------------------------------------
// Check locked status
// ---------------------------------------------------------------------
List<String> lockedDataSets = new ArrayList<>();
for (DataSet dataSet : dataSets) {
if (dataSetService.isLocked(dataSet, period, organisationUnit, attributeOptionCombo, null, multiOu)) {
lockedDataSets.add(dataSet.getUid());
}
}
if (lockedDataSets.size() != 0) {
throw new WebMessageException(WebMessageUtils.conflict("Locked Data set(s) : " + StringUtils.join(lockedDataSets, ", ")));
}
// ---------------------------------------------------------------------
// Un-register as completed data set
// ---------------------------------------------------------------------
Set<OrganisationUnit> orgUnits = new HashSet<>();
orgUnits.add(organisationUnit);
if (multiOu) {
orgUnits.addAll(organisationUnit.getChildren());
}
unRegisterCompleteDataSet(dataSets, period, orgUnits, attributeOptionCombo);
}
use of org.springframework.web.bind.annotation.ResponseStatus in project dhis2-core by dhis2.
the class DataApprovalController method acceptApprovalMultiple.
@PreAuthorize("hasRole('ALL') or hasRole('F_ACCEPT_DATA_LOWER_LEVELS')")
@RequestMapping(value = MULTIPLE_ACCEPTANCES_RESOURCE_PATH, method = RequestMethod.POST)
@ResponseStatus(HttpStatus.NO_CONTENT)
public void acceptApprovalMultiple(@RequestBody DataApprovalStateRequests dataApprovalStateRequests, HttpServletResponse response) throws WebMessageException {
List<DataApproval> dataApprovalList = new ArrayList<>();
for (DataApprovalStateRequest approvalStateRequest : dataApprovalStateRequests) {
DataApprovalWorkflow workflow = getAndValidateWorkflow(approvalStateRequest.getDs(), null);
Period period = getAndValidatePeriod(approvalStateRequest.getPe());
OrganisationUnit organisationUnit = getAndValidateOrgUnit(approvalStateRequest.getOu());
DataApprovalLevel dataApprovalLevel = getAndValidateApprovalLevel(organisationUnit);
User user = approvalStateRequest.getAb() == null ? currentUserService.getCurrentUser() : userService.getUserCredentialsByUsername(approvalStateRequest.getAb()).getUserInfo();
Date approvalDate = (approvalStateRequest.getAd() == null) ? new Date() : approvalStateRequest.getAd();
dataApprovalList.addAll(getApprovalsAsList(dataApprovalLevel, workflow, period, organisationUnit, false, approvalDate, user));
}
dataApprovalService.acceptData(dataApprovalList);
}
use of org.springframework.web.bind.annotation.ResponseStatus in project dhis2-core by dhis2.
the class DataApprovalController method saveApprovalMultiple.
@PreAuthorize("hasRole('ALL') or hasRole('F_APPROVE_DATA') or hasRole('F_APPROVE_DATA_LOWER_LEVELS')")
@RequestMapping(value = MULTIPLE_SAVE_RESOURCE_PATH, method = RequestMethod.POST)
@ResponseStatus(HttpStatus.NO_CONTENT)
public void saveApprovalMultiple(@RequestBody DataApprovalStateRequests dataApprovalStateRequests, HttpServletResponse response) throws WebMessageException {
List<DataApproval> dataApprovalList = new ArrayList<>();
for (DataApprovalStateRequest approvalStateRequest : dataApprovalStateRequests) {
DataApprovalWorkflow workflow = getAndValidateWorkflow(approvalStateRequest.getDs(), null);
Period period = getAndValidatePeriod(approvalStateRequest.getPe());
OrganisationUnit organisationUnit = getAndValidateOrgUnit(approvalStateRequest.getOu());
DataApprovalLevel dataApprovalLevel = getAndValidateApprovalLevel(organisationUnit);
User user = approvalStateRequest.getAb() == null ? currentUserService.getCurrentUser() : userService.getUserCredentialsByUsername(approvalStateRequest.getAb()).getUserInfo();
Date approvalDate = approvalStateRequest.getAd() == null ? new Date() : approvalStateRequest.getAd();
dataApprovalList.addAll(getApprovalsAsList(dataApprovalLevel, workflow, period, organisationUnit, false, approvalDate, user));
}
dataApprovalService.approveData(dataApprovalList);
}
Aggregations