org.apache.syncope.common.lib.SyncopeClientException.build() - java examples

Here are the examples of the java api org.apache.syncope.common.lib.SyncopeClientException.build() taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.

114 Examples 7

19 View Complete Implementation : FilterConverter.java
Copyright Apache License 2.0
Author : apache
/**
 * Parses a FIQL expression into ConnId's {@link Filter}, using {@link SyncopeFiqlParser}.
 *
 * @param fiql FIQL string
 * @return {@link Filter} instance for given FIQL expression
 */
public static Filter convert(final String fiql) {
    SyncopeFiqlParser<SearchBean> parser = new SyncopeFiqlParser<>(SearchBean.clreplaced, AbstractFiqlSearchConditionBuilder.CONTEXTUAL_PROPERTIES);
    try {
        FilterVisitor visitor = new FilterVisitor();
        SearchCondition<SearchBean> sc = parser.parse(URLDecoder.decode(fiql, StandardCharsets.UTF_8));
        sc.accept(visitor);
        return visitor.getQuery();
    } catch (Exception e) {
        SyncopeClientException sce = SyncopeClientException.build(ClientExceptionType.InvalidSearchExpression);
        sce.getElements().add(fiql);
        sce.getElements().add(ExceptionUtils.getRootCauseMessage(e));
        throw sce;
    }
}

19 View Complete Implementation : SearchCondConverter.java
Copyright Apache License 2.0
Author : apache
/**
 * Parses a FIQL expression into Syncope's {@link SearchCond}, using {@link SyncopeFiqlParser}.
 *
 * @param visitor visitor instance
 * @param fiql FIQL string
 * @param realms optional realm to provide to {@link SearchCondVisitor}
 * @return {@link SearchCond} instance for given FIQL expression
 */
public static SearchCond convert(final SearchCondVisitor visitor, final String fiql, final String... realms) {
    SyncopeFiqlParser<SearchBean> parser = new SyncopeFiqlParser<>(SearchBean.clreplaced, AbstractFiqlSearchConditionBuilder.CONTEXTUAL_PROPERTIES);
    try {
        if (realms != null && realms.length > 0) {
            visitor.setRealm(realms[0]);
        }
        SearchCondition<SearchBean> sc = parser.parse(URLDecoder.decode(fiql, StandardCharsets.UTF_8));
        sc.accept(visitor);
        return visitor.getQuery();
    } catch (Exception e) {
        SyncopeClientException sce = SyncopeClientException.build(ClientExceptionType.InvalidSearchExpression);
        sce.getElements().add(fiql);
        sce.getElements().add(ExceptionUtils.getRootCauseMessage(e));
        throw sce;
    }
}

19 View Complete Implementation : AnyObjectServiceImpl.java
Copyright Apache License 2.0
Author : apache
@Override
public PagedResult<AnyObjectTO> search(final AnyQuery anyQuery) {
    if (StringUtils.isBlank(anyQuery.getFiql()) || -1 == anyQuery.getFiql().indexOf(SpecialAttr.TYPE.toString())) {
        SyncopeClientException sce = SyncopeClientException.build(ClientExceptionType.InvalidSearchExpression);
        sce.getElements().add(SpecialAttr.TYPE.toString() + " is required in the FIQL string");
        throw sce;
    }
    return super.search(anyQuery);
}

18 View Complete Implementation : AbstractServiceImpl.java
Copyright Apache License 2.0
Author : apache
protected void checkETag(final String etag) {
    Response.ResponseBuilder builder = messageContext.getRequest().evaluatePreconditions(new EnreplacedyTag(etag));
    if (builder != null) {
        SyncopeClientException sce = SyncopeClientException.build(ClientExceptionType.ConcurrentModification);
        sce.getElements().add("Mismatching ETag value");
        throw sce;
    }
}

18 View Complete Implementation : UserSelfServiceImpl.java
Copyright Apache License 2.0
Author : apache
@Override
public void confirmPreplacedwordReset(final String token, final String preplacedword) {
    if (!syncopeLogic.isPwdResetAllowed()) {
        SyncopeClientException sce = SyncopeClientException.build(ClientExceptionType.DelegatedAdministration);
        sce.getElements().add("Preplacedword reset forbidden by configuration");
        throw sce;
    }
    logic.confirmPreplacedwordReset(token, preplacedword);
}

18 View Complete Implementation : TemplateUtils.java
Copyright Apache License 2.0
Author : apache
public static void check(final Map<String, AnyTO> templates, final ClientExceptionType clientExceptionType) {
    SyncopeClientException sce = SyncopeClientException.build(clientExceptionType);
    templates.values().forEach(value -> {
        value.getPlainAttrs().stream().filter(attrTO -> !attrTO.getValues().isEmpty() && !JexlUtils.isExpressionValid(attrTO.getValues().get(0))).forEachOrdered(attrTO -> sce.getElements().add("Invalid JEXL: " + attrTO.getValues().get(0)));
        value.getVirAttrs().stream().filter(attrTO -> !attrTO.getValues().isEmpty() && !JexlUtils.isExpressionValid(attrTO.getValues().get(0))).forEachOrdered((attrTO) -> sce.getElements().add("Invalid JEXL: " + attrTO.getValues().get(0)));
        if (value instanceof UserTO) {
            UserTO template = (UserTO) value;
            if (StringUtils.isNotBlank(template.getUsername()) && !JexlUtils.isExpressionValid(template.getUsername())) {
                sce.getElements().add("Invalid JEXL: " + template.getUsername());
            }
            if (StringUtils.isNotBlank(template.getPreplacedword()) && !JexlUtils.isExpressionValid(template.getPreplacedword())) {
                sce.getElements().add("Invalid JEXL: " + template.getPreplacedword());
            }
        } else if (value instanceof GroupTO) {
            GroupTO template = (GroupTO) value;
            if (StringUtils.isNotBlank(template.getName()) && !JexlUtils.isExpressionValid(template.getName())) {
                sce.getElements().add("Invalid JEXL: " + template.getName());
            }
        }
    });
    if (!sce.isEmpty()) {
        throw sce;
    }
}

18 View Complete Implementation : UserRequestLogic.java
Copyright Apache License 2.0
Author : apache
protected static void securityChecks(final String username, final String enreplacedlement, final String errorMessage) {
    if (!AuthContextUtils.getUsername().equals(username) && !AuthContextUtils.getAuthorities().stream().anyMatch(auth -> enreplacedlement.equals(auth.getAuthority()))) {
        SyncopeClientException sce = SyncopeClientException.build(ClientExceptionType.DelegatedAdministration);
        sce.getElements().add(errorMessage);
        throw sce;
    }
}

17 View Complete Implementation : RoleDataBinderImpl.java
Copyright Apache License 2.0
Author : apache
private void setDynMembership(final Role role, final String dynMembershipFIQL) {
    SearchCond dynMembershipCond = SearchCondConverter.convert(searchCondVisitor, dynMembershipFIQL);
    if (!dynMembershipCond.isValid()) {
        SyncopeClientException sce = SyncopeClientException.build(ClientExceptionType.InvalidSearchExpression);
        sce.getElements().add(dynMembershipFIQL);
        throw sce;
    }
    DynRoleMembership dynMembership;
    if (role.getDynMembership() == null) {
        dynMembership = enreplacedyFactory.newEnreplacedy(DynRoleMembership.clreplaced);
        dynMembership.setRole(role);
        role.setDynMembership(dynMembership);
    } else {
        dynMembership = role.getDynMembership();
    }
    dynMembership.setFIQLCond(dynMembershipFIQL);
}

17 View Complete Implementation : SAML2SPLogic.java
Copyright Apache License 2.0
Author : apache
private static void validateUrl(final String url) {
    boolean isValid = true;
    if (url.contains("..")) {
        isValid = false;
    }
    if (isValid) {
        isValid = ResourceUtils.isUrl(url);
    }
    if (!isValid) {
        SyncopeClientException sce = SyncopeClientException.build(ClientExceptionType.Unknown);
        sce.getElements().add("Invalid URL: " + url);
        throw sce;
    }
}

17 View Complete Implementation : LoggerLogic.java
Copyright Apache License 2.0
Author : apache
private static void throwInvalidLogger(final LoggerType type) {
    SyncopeClientException sce = SyncopeClientException.build(ClientExceptionType.InvalidLogger);
    sce.getElements().add("Expected " + type.name());
    throw sce;
}

17 View Complete Implementation : MailTemplateLogic.java
Copyright Apache License 2.0
Author : apache
@PreAuthorize("hasRole('" + IdRepoEnreplacedlement.MAIL_TEMPLATE_DELETE + "')")
public MailTemplateTO delete(final String key) {
    MailTemplate mailTemplate = mailTemplateDAO.find(key);
    if (mailTemplate == null) {
        LOG.error("Could not find mail template '" + key + '\'');
        throw new NotFoundException(key);
    }
    List<Notification> notifications = notificationDAO.findByTemplate(mailTemplate);
    if (!notifications.isEmpty()) {
        SyncopeClientException sce = SyncopeClientException.build(ClientExceptionType.InUse);
        sce.getElements().addAll(notifications.stream().map(Enreplacedy::getKey).collect(Collectors.toList()));
        throw sce;
    }
    MailTemplateTO deleted = getMailTemplateTO(key);
    mailTemplateDAO.delete(key);
    return deleted;
}

17 View Complete Implementation : PolicyLogic.java
Copyright Apache License 2.0
Author : apache
@PreAuthorize("hasRole('" + IdRepoEnreplacedlement.POLICY_READ + "')")
@Transactional(readOnly = true)
public <T extends PolicyTO> T read(final PolicyType type, final String key) {
    Policy policy = policyDAO.find(key);
    if (policy == null) {
        throw new NotFoundException("Policy " + key + " not found");
    }
    PolicyUtils policyUtils = policyUtilsFactory.getInstance(policy);
    if (type != null && policyUtils.getType() != type) {
        SyncopeClientException sce = SyncopeClientException.build(ClientExceptionType.InvalidRequest);
        sce.getElements().add("Found " + type + ", expected " + policyUtils.getType());
        throw sce;
    }
    return binder.getPolicyTO(policy);
}

17 View Complete Implementation : UserSelfServiceImpl.java
Copyright Apache License 2.0
Author : apache
@Override
public Response create(final UserCR createReq) {
    if (!syncopeLogic.isSelfRegAllowed()) {
        SyncopeClientException sce = SyncopeClientException.build(ClientExceptionType.DelegatedAdministration);
        sce.getElements().add("Self registration forbidden by configuration");
        throw sce;
    }
    ProvisioningResult<UserTO> created = logic.selfCreate(createReq, isNullPriorityAsync());
    return createResponse(created);
}

17 View Complete Implementation : ImplementationLogic.java
Copyright Apache License 2.0
Author : apache
private static void checkType(final String type) {
    if (!ImplementationTypesHolder.getInstance().getValues().containsKey(type)) {
        SyncopeClientException sce = SyncopeClientException.build(ClientExceptionType.InvalidImplementationType);
        sce.getElements().add("Implementation type not found: ");
        throw sce;
    }
}

17 View Complete Implementation : PolicyLogic.java
Copyright Apache License 2.0
Author : apache
@PreAuthorize("hasRole('" + IdRepoEnreplacedlement.POLICY_DELETE + "')")
public <T extends PolicyTO> T delete(final PolicyType type, final String key) {
    Policy policy = policyDAO.find(key);
    if (policy == null) {
        throw new NotFoundException("Policy " + key + " not found");
    }
    PolicyUtils policyUtils = policyUtilsFactory.getInstance(policy);
    if (type != null && policyUtils.getType() != type) {
        SyncopeClientException sce = SyncopeClientException.build(ClientExceptionType.InvalidRequest);
        sce.getElements().add("Found " + type + ", expected " + policyUtils.getType());
        throw sce;
    }
    T deleted = binder.getPolicyTO(policy);
    policyDAO.delete(policy);
    return deleted;
}

17 View Complete Implementation : UserLogic.java
Copyright Apache License 2.0
Author : apache
@PreAuthorize("isAnonymous() or hasRole('" + IdRepoEnreplacedlement.ANONYMOUS + "')")
@Transactional
public void requestPreplacedwordReset(final String username, final String securityAnswer) {
    if (username == null) {
        throw new NotFoundException("Null username");
    }
    User user = userDAO.findByUsername(username);
    if (user == null) {
        throw new NotFoundException("User " + username);
    }
    if (syncopeLogic.isPwdResetRequiringSecurityQuestions() && (securityAnswer == null || !securityAnswer.equals(user.getSecurityAnswer()))) {
        throw SyncopeClientException.build(ClientExceptionType.InvalidSecurityAnswer);
    }
    provisioningManager.requestPreplacedwordReset(user.getKey());
}

17 View Complete Implementation : AbstractServiceImpl.java
Copyright Apache License 2.0
Author : apache
protected SearchCond getSearchCond(final String fiql, final String realm) {
    try {
        searchCondVisitor.setRealm(realm);
        SearchCondition<SearchBean> sc = searchContext.getCondition(fiql, SearchBean.clreplaced);
        sc.accept(searchCondVisitor);
        return searchCondVisitor.getQuery();
    } catch (Exception e) {
        LOG.error("Invalid FIQL expression: {}", fiql, e);
        SyncopeClientException sce = SyncopeClientException.build(ClientExceptionType.InvalidSearchExpression);
        sce.getElements().add(fiql);
        sce.getElements().add(ExceptionUtils.getRootCauseMessage(e));
        throw sce;
    }
}

17 View Complete Implementation : UserSelfServiceImpl.java
Copyright Apache License 2.0
Author : apache
@Override
public void requestPreplacedwordReset(final String username, final String securityAnswer) {
    if (!syncopeLogic.isPwdResetAllowed()) {
        SyncopeClientException sce = SyncopeClientException.build(ClientExceptionType.DelegatedAdministration);
        sce.getElements().add("Preplacedword reset forbidden by configuration");
        throw sce;
    }
    logic.requestPreplacedwordReset(username, securityAnswer);
}

16 View Complete Implementation : SyncopeConsoleApplicationTest.java
Copyright Apache License 2.0
Author : apache
@Test
public void errors() {
    SyncopeConsoleSession session = SyncopeConsoleSession.get();
    replacedertNull(session.getFeedbackMessages().first());
    session.onException(new AccessControlException("JWT Expired"));
    FeedbackMessage message = session.getFeedbackMessages().first();
    replacedertNotNull(message);
    replacedertTrue(message.isError());
    replacedertEquals(SyncopeConsoleSession.Error.SESSION_EXPIRED.fallback(), message.getMessage());
    session.getFeedbackMessages().clear();
    session.onException(new AccessControlException("Auth Exception"));
    message = session.getFeedbackMessages().first();
    replacedertNotNull(message);
    replacedertTrue(message.isError());
    replacedertEquals(SyncopeConsoleSession.Error.AUTHORIZATION.fallback(), message.getMessage());
    session.getFeedbackMessages().clear();
    session.onException(new BadRequestException());
    message = session.getFeedbackMessages().first();
    replacedertNotNull(message);
    replacedertTrue(message.isError());
    replacedertEquals(SyncopeConsoleSession.Error.REST.fallback(), message.getMessage());
    session.getFeedbackMessages().clear();
    SyncopeClientException sce = SyncopeClientException.build(ClientExceptionType.InvalidUser);
    sce.getElements().add("Error 1");
    session.onException(sce);
    message = session.getFeedbackMessages().first();
    replacedertNotNull(message);
    replacedertTrue(message.isError());
    replacedertEquals("Error 1", message.getMessage());
    session.getFeedbackMessages().clear();
    sce = SyncopeClientException.build(ClientExceptionType.InvalidUser);
    sce.getElements().add("Error 1");
    sce.getElements().add("Error 2");
    session.onException(sce);
    message = session.getFeedbackMessages().first();
    replacedertNotNull(message);
    replacedertTrue(message.isError());
    replacedertEquals("Error 1, Error 2", message.getMessage());
    session.getFeedbackMessages().clear();
    SyncopeClientCompositeException scce = SyncopeClientException.buildComposite();
    scce.addException(SyncopeClientException.build(ClientExceptionType.InvalidUser));
    scce.addException(SyncopeClientException.build(ClientExceptionType.InvalidExternalResource));
    session.onException(new ExecutionException(scce));
    message = session.getFeedbackMessages().first();
    replacedertNotNull(message);
    replacedertTrue(message.isError());
    replacedertEquals(scce.getMessage(), message.getMessage());
    session.getFeedbackMessages().clear();
}

16 View Complete Implementation : ConnectorLogic.java
Copyright Apache License 2.0
Author : apache
@PreAuthorize("hasRole('" + IdMEnreplacedlement.CONNECTOR_READ + "')")
@Transactional(readOnly = true)
public void check(final ConnInstanceTO connInstanceTO) {
    if (connInstanceTO.getAdminRealm() == null) {
        throw SyncopeClientException.build(ClientExceptionType.InvalidRealm);
    }
    connFactory.createConnector(binder.getConnInstance(connInstanceTO)).test();
}

16 View Complete Implementation : AccessTokenLogic.java
Copyright Apache License 2.0
Author : apache
@PreAuthorize("isAuthenticated()")
public Pair<String, Date> login() {
    if (anonymousUser.equals(AuthContextUtils.getUsername())) {
        SyncopeClientException sce = SyncopeClientException.build(ClientExceptionType.InvalidRequest);
        sce.getElements().add(anonymousUser + " cannot be granted an access token");
        throw sce;
    }
    return binder.create(AuthContextUtils.getUsername(), Collections.<String, Object>emptyMap(), getAuthorities(), false);
}

16 View Complete Implementation : AnyTypeClassLogic.java
Copyright Apache License 2.0
Author : apache
@PreAuthorize("hasRole('" + IdRepoEnreplacedlement.ANYTYPECLreplaced_CREATE + "')")
public AnyTypeClreplacedTO create(final AnyTypeClreplacedTO anyTypeClreplacedTO) {
    if (StringUtils.isBlank(anyTypeClreplacedTO.getKey())) {
        SyncopeClientException sce = SyncopeClientException.build(ClientExceptionType.RequiredValuesMissing);
        sce.getElements().add(AnyTypeClreplaced.clreplaced.getSimpleName() + " name");
        throw sce;
    }
    if (anyTypeClreplacedDAO.find(anyTypeClreplacedTO.getKey()) != null) {
        throw new DuplicateException(anyTypeClreplacedTO.getKey());
    }
    return binder.getAnyTypeClreplacedTO(anyTypeClreplacedDAO.save(binder.create(anyTypeClreplacedTO)));
}

16 View Complete Implementation : AnyTypeLogic.java
Copyright Apache License 2.0
Author : apache
@PreAuthorize("hasRole('" + IdRepoEnreplacedlement.ANYTYPE_CREATE + "')")
public AnyTypeTO create(final AnyTypeTO anyTypeTO) {
    if (StringUtils.isBlank(anyTypeTO.getKey())) {
        SyncopeClientException sce = SyncopeClientException.build(ClientExceptionType.RequiredValuesMissing);
        sce.getElements().add(AnyType.clreplaced.getSimpleName() + " key");
        throw sce;
    }
    if (anyTypeDAO.find(anyTypeTO.getKey()) != null) {
        throw new DuplicateException(anyTypeTO.getKey());
    }
    return binder.getAnyTypeTO(anyTypeDAO.save(binder.create(anyTypeTO)));
}

16 View Complete Implementation : AnyTypeLogic.java
Copyright Apache License 2.0
Author : apache
@PreAuthorize("hasRole('" + IdRepoEnreplacedlement.ANYTYPE_DELETE + "')")
public AnyTypeTO delete(final String key) {
    AnyType anyType = anyTypeDAO.find(key);
    if (anyType == null) {
        LOG.error("Could not find anyType '" + key + '\'');
        throw new NotFoundException(key);
    }
    Integer anyObjects = anyObjectDAO.countByType().get(anyType);
    if (anyObjects != null && anyObjects > 0) {
        LOG.error("{} AnyObject instances found for {}, aborting", anyObjects, anyType);
        SyncopeClientException sce = SyncopeClientException.build(ClientExceptionType.InvalidAnyType);
        sce.getElements().add("AnyObject instances found for " + key);
        throw sce;
    }
    try {
        return binder.delete(anyType);
    } catch (IllegalArgumentException | InvalidDataAccessApiUsageException e) {
        SyncopeClientException sce = SyncopeClientException.build(ClientExceptionType.InvalidRequest);
        sce.getElements().add(e.getMessage());
        throw sce;
    }
}

16 View Complete Implementation : ImplementationLogic.java
Copyright Apache License 2.0
Author : apache
@PreAuthorize("hasRole('" + IdRepoEnreplacedlement.IMPLEMENTATION_READ + "')")
@Transactional(readOnly = true)
public ImplementationTO read(final String type, final String key) {
    checkType(type);
    Implementation implementation = implementationDAO.find(key);
    if (implementation == null) {
        LOG.error("Could not find implementation '" + key + '\'');
        throw new NotFoundException(key);
    }
    if (!implementation.getType().equals(type)) {
        SyncopeClientException sce = SyncopeClientException.build(ClientExceptionType.InvalidRequest);
        sce.getElements().add("Found " + type + ", expected " + implementation.getType());
        throw sce;
    }
    return binder.getImplementationTO(implementation);
}

16 View Complete Implementation : PolicyLogic.java
Copyright Apache License 2.0
Author : apache
@PreAuthorize("hasRole('" + IdRepoEnreplacedlement.POLICY_CREATE + "')")
public <T extends PolicyTO> T create(final PolicyType type, final T policyTO) {
    PolicyUtils policyUtils = policyUtilsFactory.getInstance(policyTO);
    if (policyUtils.getType() != type) {
        SyncopeClientException sce = SyncopeClientException.build(ClientExceptionType.InvalidRequest);
        sce.getElements().add("Found " + type + ", expected " + policyUtils.getType());
        throw sce;
    }
    return binder.getPolicyTO(policyDAO.save(binder.create(policyTO)));
}

16 View Complete Implementation : ReportLogic.java
Copyright Apache License 2.0
Author : apache
@PreAuthorize("hasRole('" + IdRepoEnreplacedlement.REPORT_READ + "')")
public ReportExec getReportExec(final String executionKey) {
    ReportExec reportExec = reportExecDAO.find(executionKey);
    if (reportExec == null) {
        throw new NotFoundException("Report execution " + executionKey);
    }
    if (!ReportExecStatus.SUCCESS.name().equals(reportExec.getStatus()) || reportExec.getExecResult() == null) {
        SyncopeClientException sce = SyncopeClientException.build(ClientExceptionType.InvalidReportExec);
        sce.getElements().add(reportExec.getExecResult() == null ? "No report data produced" : "Report did not run successfully");
        throw sce;
    }
    return reportExec;
}

16 View Complete Implementation : ReportLogic.java
Copyright Apache License 2.0
Author : apache
@PreAuthorize("hasRole('" + IdRepoEnreplacedlement.REPORT_READ + "')")
@Override
public JobTO getJob(final String key) {
    Report report = reportDAO.find(key);
    if (report == null) {
        throw new NotFoundException("Report " + key);
    }
    JobTO jobTO = null;
    try {
        jobTO = getJobTO(JobNamer.getJobKey(report), false);
    } catch (SchedulerException e) {
        LOG.error("Problems while retrieving scheduled job {}", JobNamer.getJobKey(report), e);
        SyncopeClientException sce = SyncopeClientException.build(ClientExceptionType.Scheduling);
        sce.getElements().add(e.getMessage());
        throw sce;
    }
    if (jobTO == null) {
        throw new NotFoundException("Job for report " + key);
    }
    return jobTO;
}

16 View Complete Implementation : DynRealmDataBinderImpl.java
Copyright Apache License 2.0
Author : apache
private void setDynMembership(final DynRealm dynRealm, final AnyType anyType, final String dynMembershipFIQL) {
    SearchCond dynMembershipCond = SearchCondConverter.convert(searchCondVisitor, dynMembershipFIQL);
    if (!dynMembershipCond.isValid()) {
        SyncopeClientException sce = SyncopeClientException.build(ClientExceptionType.InvalidSearchExpression);
        sce.getElements().add(dynMembershipFIQL);
        throw sce;
    }
    DynRealmMembership dynMembership;
    if (dynRealm.getDynMembership(anyType).isPresent()) {
        dynMembership = dynRealm.getDynMembership(anyType).get();
    } else {
        dynMembership = enreplacedyFactory.newEnreplacedy(DynRealmMembership.clreplaced);
        dynMembership.setDynRealm(dynRealm);
        dynMembership.setAnyType(anyType);
        dynRealm.add(dynMembership);
    }
    dynMembership.setFIQLCond(dynMembershipFIQL);
}

16 View Complete Implementation : OIDCClientLogic.java
Copyright Apache License 2.0
Author : apache
private static TokenEndpointResponse getOIDCTokens(final String url, final String body) throws IOException {
    Response response = WebClient.create(url, List.of(new JacksonJsonProvider())).type(MediaType.APPLICATION_FORM_URLENCODED).accept(MediaType.APPLICATION_JSON).post(body);
    if (response.getStatus() != Response.Status.OK.getStatusCode()) {
        LOG.error("Unexpected response from OIDC Provider: {}\n{}\n{}", response.getStatus(), response.getHeaders(), IOUtils.toString((InputStream) response.getEnreplacedy()));
        SyncopeClientException sce = SyncopeClientException.build(ClientExceptionType.Unknown);
        sce.getElements().add("Unexpected response from OIDC Provider");
        throw sce;
    }
    return response.readEnreplacedy(TokenEndpointResponse.clreplaced);
}

15 View Complete Implementation : ImplementationLogic.java
Copyright Apache License 2.0
Author : apache
@PreAuthorize("hasRole('" + IdRepoEnreplacedlement.IMPLEMENTATION_DELETE + "')")
public void delete(final String type, final String key) {
    Implementation implementation = implementationDAO.find(key);
    if (implementation == null) {
        LOG.error("Could not find implementation '" + key + '\'');
        throw new NotFoundException(key);
    }
    if (!implementation.getType().equals(type)) {
        SyncopeClientException sce = SyncopeClientException.build(ClientExceptionType.InvalidRequest);
        sce.getElements().add("Found " + type + ", expected " + implementation.getType());
        throw sce;
    }
    boolean inUse = false;
    switch(implementation.getType()) {
        case IdRepoImplementationType.REPORTLET:
            inUse = !reportDAO.findByReportlet(implementation).isEmpty();
            break;
        case IdRepoImplementationType.ACCOUNT_RULE:
            inUse = !policyDAO.findByAccountRule(implementation).isEmpty();
            break;
        case IdRepoImplementationType.PreplacedWORD_RULE:
            inUse = !policyDAO.findByPreplacedwordRule(implementation).isEmpty();
            break;
        case IdMImplementationType.ITEM_TRANSFORMER:
            inUse = !resourceDAO.findByTransformer(implementation).isEmpty();
            break;
        case IdRepoImplementationType.TASKJOB_DELEGATE:
            inUse = !taskDAO.findByDelegate(implementation).isEmpty();
            break;
        case IdMImplementationType.RECON_FILTER_BUILDER:
            inUse = !taskDAO.findByReconFilterBuilder(implementation).isEmpty();
            break;
        case IdRepoImplementationType.LOGIC_ACTIONS:
            inUse = !realmDAO.findByLogicActions(implementation).isEmpty();
            break;
        case IdMImplementationType.PROPAGATION_ACTIONS:
            inUse = !resourceDAO.findByPropagationActions(implementation).isEmpty();
            break;
        case IdMImplementationType.PULL_ACTIONS:
            inUse = !taskDAO.findByPullActions(implementation).isEmpty();
            break;
        case IdMImplementationType.PUSH_ACTIONS:
            inUse = !taskDAO.findByPushActions(implementation).isEmpty();
            break;
        case IdMImplementationType.PULL_CORRELATION_RULE:
            inUse = !policyDAO.findByPullCorrelationRule(implementation).isEmpty();
            break;
        case IdMImplementationType.PUSH_CORRELATION_RULE:
            inUse = !policyDAO.findByPushCorrelationRule(implementation).isEmpty();
            break;
        case IdRepoImplementationType.VALIDATOR:
            inUse = !plainSchemaDAO.findByValidator(implementation).isEmpty();
            break;
        case IdRepoImplementationType.RECIPIENTS_PROVIDER:
            inUse = !notificationDAO.findByRecipientsProvider(implementation).isEmpty();
            break;
        default:
    }
    if (inUse) {
        SyncopeClientException sce = SyncopeClientException.build(ClientExceptionType.InUse);
        sce.getElements().add("This implementation is in use");
        throw sce;
    }
    implementationDAO.delete(key);
}

15 View Complete Implementation : PolicyLogic.java
Copyright Apache License 2.0
Author : apache
@PreAuthorize("hasRole('" + IdRepoEnreplacedlement.POLICY_UPDATE + "')")
public PolicyTO update(final PolicyType type, final PolicyTO policyTO) {
    Policy policy = policyDAO.find(policyTO.getKey());
    PolicyUtils policyUtils = policyUtilsFactory.getInstance(policy);
    if (policyUtils.getType() != type) {
        SyncopeClientException sce = SyncopeClientException.build(ClientExceptionType.InvalidRequest);
        sce.getElements().add("Found " + type + ", expected " + policyUtils.getType());
        throw sce;
    }
    return binder.getPolicyTO(policyDAO.save(binder.update(policy, policyTO)));
}

15 View Complete Implementation : ImplementationDataBinderImpl.java
Copyright Apache License 2.0
Author : apache
@Override
public void update(final Implementation implementation, final ImplementationTO implementationTO) {
    SyncopeClientException sce = SyncopeClientException.build(ClientExceptionType.InvalidImplementation);
    if (implementation.getType() != null && !implementation.getType().equals(implementationTO.getType())) {
        sce.getElements().add("ImplementationType cannot be changed");
        throw sce;
    }
    if (StringUtils.isBlank(implementationTO.getBody())) {
        sce.getElements().add("No actual implementation provided");
        throw sce;
    }
    implementation.setKey(implementationTO.getKey());
    implementation.setEngine(implementationTO.getEngine());
    implementation.setType(implementationTO.getType());
    implementation.setBody(implementationTO.getBody());
    if (implementation.getEngine() == ImplementationEngine.JAVA) {
        Clreplaced<?> base = null;
        switch(implementation.getType()) {
            case IdRepoImplementationType.REPORTLET:
                base = Reportlet.clreplaced;
                break;
            case IdRepoImplementationType.ACCOUNT_RULE:
                base = AccountRule.clreplaced;
                break;
            case IdRepoImplementationType.PreplacedWORD_RULE:
                base = PreplacedwordRule.clreplaced;
                break;
            case IdMImplementationType.ITEM_TRANSFORMER:
                base = ItemTransformer.clreplaced;
                break;
            case IdRepoImplementationType.TASKJOB_DELEGATE:
                base = SchedTaskJobDelegate.clreplaced;
                break;
            case IdMImplementationType.RECON_FILTER_BUILDER:
                base = ReconFilterBuilder.clreplaced;
                break;
            case IdRepoImplementationType.LOGIC_ACTIONS:
                base = LogicActions.clreplaced;
                break;
            case IdMImplementationType.PROPAGATION_ACTIONS:
                base = PropagationActions.clreplaced;
                break;
            case IdMImplementationType.PULL_ACTIONS:
                base = PullActions.clreplaced;
                break;
            case IdMImplementationType.PUSH_ACTIONS:
                base = PushActions.clreplaced;
                break;
            case IdMImplementationType.PULL_CORRELATION_RULE:
                base = PullCorrelationRule.clreplaced;
                break;
            case IdMImplementationType.PUSH_CORRELATION_RULE:
                base = PushCorrelationRule.clreplaced;
                break;
            case IdRepoImplementationType.VALIDATOR:
                base = Validator.clreplaced;
                break;
            case IdRepoImplementationType.RECIPIENTS_PROVIDER:
                base = RecipientsProvider.clreplaced;
                break;
            default:
        }
        if (base == null) {
            sce.getElements().add("No Java interface found for " + implementation.getType());
            throw sce;
        }
        switch(implementation.getType()) {
            case IdRepoImplementationType.REPORTLET:
                ReportletConf reportlet = POJOHelper.deserialize(implementation.getBody(), ReportletConf.clreplaced);
                if (reportlet == null) {
                    sce.getElements().add("Could not deserialize as ReportletConf");
                    throw sce;
                }
                break;
            case IdRepoImplementationType.ACCOUNT_RULE:
            case IdRepoImplementationType.PreplacedWORD_RULE:
            case IdMImplementationType.PULL_CORRELATION_RULE:
            case IdMImplementationType.PUSH_CORRELATION_RULE:
                RuleConf rule = POJOHelper.deserialize(implementation.getBody(), RuleConf.clreplaced);
                if (rule == null) {
                    sce.getElements().add("Could not deserialize as neither " + "Account, Preplacedword, Pull nor Push Correlation RuleConf");
                    throw sce;
                }
                break;
            default:
                Clreplaced<?> clazz = null;
                try {
                    clazz = Clreplaced.forName(implementation.getBody());
                } catch (Exception e) {
                    LOG.error("Clreplaced '{}' not found", implementation.getBody(), e);
                    sce.getElements().add("No Java clreplaced found: " + implementation.getBody());
                    throw sce;
                }
                if (!base.isreplacedignableFrom(clazz)) {
                    sce.getElements().add("Java clreplaced " + implementation.getBody() + " must comply with " + base.getName());
                    throw sce;
                }
                if (Modifier.isAbstract(clazz.getModifiers())) {
                    sce.getElements().add("Java clreplaced " + implementation.getBody() + " is abstract");
                    throw sce;
                }
                break;
        }
    }
}

15 View Complete Implementation : CamelRouteLogic.java
Copyright Apache License 2.0
Author : apache
@PreAuthorize("hasRole('" + CamelEnreplacedlement.ROUTE_READ + "')")
@Transactional(readOnly = true)
public CamelRouteTO read(final AnyTypeKind anyTypeKind, final String key) {
    CamelRoute route = routeDAO.find(key);
    if (route == null) {
        throw new NotFoundException("CamelRoute with key=" + key);
    }
    if (route.getAnyTypeKind() != anyTypeKind) {
        SyncopeClientException sce = SyncopeClientException.build(ClientExceptionType.InvalidRequest);
        sce.getElements().add("Found " + anyTypeKind + ", expected " + route.getAnyTypeKind());
        throw sce;
    }
    return binder.getRouteTO(route);
}

15 View Complete Implementation : RestClientExceptionMapper.java
Copyright Apache License 2.0
Author : apache
private static SyncopeClientCompositeException checkSyncopeClientCompositeException(final Response response) {
    SyncopeClientCompositeException compException = SyncopeClientException.buildComposite();
    // Attempts to read ErrorTO or List<ErrorTO> as enreplacedy...
    List<ErrorTO> errors = null;
    try {
        ErrorTO error = response.readEnreplacedy(ErrorTO.clreplaced);
        if (error != null) {
            errors = List.of(error);
        }
    } catch (Exception e) {
        LOG.debug("Could not read {}, attempting to read composite...", ErrorTO.clreplaced.getName(), e);
    }
    if (errors == null) {
        try {
            errors = response.readEnreplacedy(new GenericType<List<ErrorTO>>() {
            });
        } catch (Exception e) {
            LOG.debug("Could not read {} list, attempting to read headers...", ErrorTO.clreplaced.getName(), e);
        }
    }
    // ...if not possible, attempts to parse response headers
    if (errors == null) {
        List<String> exTypesInHeaders = response.getStringHeaders().get(RESTHeaders.ERROR_CODE);
        if (exTypesInHeaders == null) {
            LOG.debug("No " + RESTHeaders.ERROR_CODE + " provided");
            return null;
        }
        List<String> exInfos = response.getStringHeaders().get(RESTHeaders.ERROR_INFO);
        Set<String> handledExceptions = new HashSet<>();
        exTypesInHeaders.forEach(exTypereplacedtring -> {
            ClientExceptionType exceptionType = null;
            try {
                exceptionType = ClientExceptionType.fromHeaderValue(exTypereplacedtring);
            } catch (IllegalArgumentException e) {
                LOG.error("Unexpected value of " + RESTHeaders.ERROR_CODE + ": " + exTypereplacedtring, e);
            }
            if (exceptionType != null) {
                handledExceptions.add(exTypereplacedtring);
                SyncopeClientException clientException = SyncopeClientException.build(exceptionType);
                if (exInfos != null && !exInfos.isEmpty()) {
                    for (String element : exInfos) {
                        if (element.startsWith(exceptionType.name())) {
                            clientException.getElements().add(StringUtils.substringAfter(element, ":"));
                        }
                    }
                }
                compException.addException(clientException);
            }
        });
        exTypesInHeaders.removeAll(handledExceptions);
        if (!exTypesInHeaders.isEmpty()) {
            LOG.error("Unmanaged exceptions: " + exTypesInHeaders);
        }
    } else {
        for (ErrorTO error : errors) {
            SyncopeClientException clientException = SyncopeClientException.build(error.getType());
            clientException.getElements().addAll(error.getElements());
            compException.addException(clientException);
        }
    }
    if (compException.hasExceptions()) {
        return compException;
    }
    return null;
}

14 View Complete Implementation : LoggerLogic.java
Copyright Apache License 2.0
Author : apache
@PreAuthorize("hasRole('" + IdRepoEnreplacedlement.AUDIT_DISABLE + "')")
public void disableAudit(final AuditLoggerName auditLoggerName) {
    try {
        delete(auditLoggerName.toLoggerName(), LoggerType.AUDIT);
    } catch (NotFoundException e) {
        LOG.debug("Ignoring disable of non existing logger {}", auditLoggerName.toLoggerName());
    } catch (IllegalArgumentException | InvalidDataAccessApiUsageException e) {
        SyncopeClientException sce = SyncopeClientException.build(ClientExceptionType.InvalidLogger);
        sce.getElements().add(e.getMessage());
        throw sce;
    }
}

14 View Complete Implementation : LoggerLogic.java
Copyright Apache License 2.0
Author : apache
@PreAuthorize("hasRole('" + IdRepoEnreplacedlement.AUDIT_ENABLE + "')")
public void enableAudit(final AuditLoggerName auditLoggerName) {
    try {
        setLevel(auditLoggerName.toLoggerName(), Level.DEBUG, LoggerType.AUDIT);
    } catch (IllegalArgumentException | InvalidDataAccessApiUsageException e) {
        SyncopeClientException sce = SyncopeClientException.build(ClientExceptionType.InvalidLogger);
        sce.getElements().add(e.getMessage());
        throw sce;
    }
}

14 View Complete Implementation : ReportTemplateLogic.java
Copyright Apache License 2.0
Author : apache
@PreAuthorize("hasRole('" + IdRepoEnreplacedlement.REPORT_TEMPLATE_DELETE + "')")
public ReportTemplateTO delete(final String key) {
    ReportTemplate reportTemplate = reportTemplateDAO.find(key);
    if (reportTemplate == null) {
        LOG.error("Could not find report template '" + key + '\'');
        throw new NotFoundException(key);
    }
    List<Report> reports = reportDAO.findByTemplate(reportTemplate);
    if (!reports.isEmpty()) {
        SyncopeClientException sce = SyncopeClientException.build(ClientExceptionType.InUse);
        sce.getElements().addAll(reports.stream().map(Enreplacedy::getKey).collect(Collectors.toList()));
        throw sce;
    }
    ReportTemplateTO deleted = getReportTemplateTO(key);
    reportTemplateDAO.delete(key);
    return deleted;
}

14 View Complete Implementation : SchemaLogic.java
Copyright Apache License 2.0
Author : apache
@PreAuthorize("hasRole('" + IdRepoEnreplacedlement.SCHEMA_CREATE + "')")
@SuppressWarnings("unchecked")
public <T extends SchemaTO> T create(final SchemaType schemaType, final T schemaTO) {
    if (StringUtils.isBlank(schemaTO.getKey())) {
        SyncopeClientException sce = SyncopeClientException.build(ClientExceptionType.RequiredValuesMissing);
        sce.getElements().add("Schema key");
        throw sce;
    }
    if (doesSchemaExist(schemaType, schemaTO.getKey())) {
        throw new DuplicateException(schemaType + "/" + schemaTO.getKey());
    }
    T created;
    switch(schemaType) {
        case VIRTUAL:
            VirSchema virSchema = virSchemaDAO.save(binder.create((VirSchemaTO) schemaTO));
            created = (T) binder.getVirSchemaTO(virSchema.getKey());
            break;
        case DERIVED:
            DerSchema derSchema = derSchemaDAO.save(binder.create((DerSchemaTO) schemaTO));
            created = (T) binder.getDerSchemaTO(derSchema.getKey());
            break;
        case PLAIN:
        default:
            PlainSchema plainSchema = plainSchemaDAO.save(binder.create((PlainSchemaTO) schemaTO));
            created = (T) binder.getPlainSchemaTO(plainSchema.getKey());
    }
    return created;
}

14 View Complete Implementation : TaskLogic.java
Copyright Apache License 2.0
Author : apache
@PreAuthorize("hasRole('" + IdRepoEnreplacedlement.TASK_DELETE + "')")
public <T extends TaskTO> T delete(final TaskType type, final String key) {
    Task task = taskDAO.find(key);
    if (task == null) {
        throw new NotFoundException("Task " + key);
    }
    TaskUtils taskUtils = taskUtilsFactory.getInstance(task);
    if (type != null && taskUtils.getType() != type) {
        SyncopeClientException sce = SyncopeClientException.build(ClientExceptionType.InvalidRequest);
        sce.getElements().add("Found " + type + ", expected " + taskUtils.getType());
        throw sce;
    }
    T taskToDelete = binder.getTaskTO(task, taskUtils, true);
    if (TaskType.SCHEDULED == taskUtils.getType() || TaskType.PULL == taskUtils.getType() || TaskType.PUSH == taskUtils.getType()) {
        jobManager.unregister(task);
    }
    taskDAO.delete(task);
    return taskToDelete;
}

14 View Complete Implementation : ApplicationDataBinderImpl.java
Copyright Apache License 2.0
Author : apache
@Override
public Application update(final Application toBeUpdated, final ApplicationTO applicationTO) {
    toBeUpdated.setKey(applicationTO.getKey());
    Application application = applicationDAO.save(toBeUpdated);
    application.setDescription(applicationTO.getDescription());
    // 1. add or update all (valid) privileges from TO
    applicationTO.getPrivileges().forEach(privilegeTO -> {
        if (privilegeTO == null) {
            LOG.error("Null {}", PrivilegeTO.clreplaced.getSimpleName());
        } else {
            Privilege privilege = applicationDAO.findPrivilege(privilegeTO.getKey());
            if (privilege == null) {
                privilege = enreplacedyFactory.newEnreplacedy(Privilege.clreplaced);
                privilege.setKey(privilegeTO.getKey());
                privilege.setApplication(application);
                application.add(privilege);
            } else if (!application.equals(privilege.getApplication())) {
                SyncopeClientException sce = SyncopeClientException.build(ClientExceptionType.InvalidPrivilege);
                sce.getElements().add("Privilege " + privilege.getKey() + " already owned by " + privilege.getApplication());
                throw sce;
            }
            privilege.setDescription(privilegeTO.getDescription());
            privilege.setSpec(privilegeTO.getSpec());
        }
    });
    // 2. remove all privileges not contained in the TO
    for (Iterator<? extends Privilege> itor = application.getPrivileges().iterator(); itor.hasNext(); ) {
        Privilege privilege = itor.next();
        if (!applicationTO.getPrivileges().stream().anyMatch(privilegeTO -> privilege.getKey().equals(privilegeTO.getKey()))) {
            privilege.setApplication(null);
            itor.remove();
        }
    }
    return application;
}

14 View Complete Implementation : CamelRouteLogic.java
Copyright Apache License 2.0
Author : apache
@PreAuthorize("hasRole('" + CamelEnreplacedlement.ROUTE_UPDATE + "')")
public void update(final AnyTypeKind anyTypeKind, final CamelRouteTO routeTO) {
    CamelRoute route = routeDAO.find(routeTO.getKey());
    if (route == null) {
        throw new NotFoundException("CamelRoute with key=" + routeTO.getKey());
    }
    if (route.getAnyTypeKind() != anyTypeKind) {
        SyncopeClientException sce = SyncopeClientException.build(ClientExceptionType.InvalidRequest);
        sce.getElements().add("Found " + anyTypeKind + ", expected " + route.getAnyTypeKind());
        throw sce;
    }
    String originalContent = route.getContent();
    LOG.debug("Updating route {} with content {}", routeTO.getKey(), routeTO.getContent());
    binder.update(route, routeTO);
    try {
        context.updateContext(routeTO.getKey());
    } catch (CamelException e) {
        // if an exception was thrown while updating the context, restore the former route definition
        LOG.debug("Update of route {} failed, reverting", routeTO.getKey());
        context.restoreRoute(routeTO.getKey(), originalContent);
        throw e;
    }
}

14 View Complete Implementation : OIDCClientLogic.java
Copyright Apache License 2.0
Author : apache
private static UserInfo getUserInfo(final String endpoint, final String accessToken, final IdToken idToken, final Consumer consumer) {
    WebClient userInfoServiceClient = WebClient.create(endpoint, List.of(new JsonMapObjectProvider())).accept(MediaType.APPLICATION_JSON);
    ClientAccessToken clientAccessToken = new ClientAccessToken(OAuthConstants.BEARER_AUTHORIZATION_SCHEME, accessToken);
    UserInfoClient userInfoClient = new UserInfoClient();
    userInfoClient.setUserInfoServiceClient(userInfoServiceClient);
    UserInfo userInfo = null;
    try {
        userInfo = userInfoClient.getUserInfo(clientAccessToken, idToken, consumer);
    } catch (Exception e) {
        LOG.error("While getting the userInfo", e);
        SyncopeClientException sce = SyncopeClientException.build(ClientExceptionType.Unknown);
        sce.getElements().add(e.getMessage());
        throw sce;
    }
    return userInfo;
}

14 View Complete Implementation : OIDCClientLogic.java
Copyright Apache License 2.0
Author : apache
private static IdToken getValidatedIdToken(final OIDCProvider op, final Consumer consumer, final String jwtIdToken) {
    IdTokenReader idTokenReader = new IdTokenReader();
    idTokenReader.setClockOffset(10);
    idTokenReader.setIssuerId(op.getIssuer());
    idTokenReader.setJwkSetClient(WebClient.create(op.getJwksUri(), List.of(new JsonWebKeysProvider())).accept(MediaType.APPLICATION_JSON));
    IdToken idToken;
    try {
        idToken = idTokenReader.getIdToken(jwtIdToken, consumer);
    } catch (Exception e) {
        LOG.error("While validating the id_token", e);
        SyncopeClientException sce = SyncopeClientException.build(ClientExceptionType.Unknown);
        sce.getElements().add(e.getMessage());
        throw sce;
    }
    return idToken;
}

14 View Complete Implementation : OIDCProviderLogic.java
Copyright Apache License 2.0
Author : apache
private static OIDCProviderDiscoveryDoreplacedent getDiscoveryDoreplacedent(final String issuer) {
    String discoveryDoreplacedentURL = issuer + "/.well-known/openid-configuration";
    WebClient client = WebClient.create(discoveryDoreplacedentURL, List.of(new JacksonJsonProvider())).accept(MediaType.APPLICATION_JSON);
    try {
        return client.get(OIDCProviderDiscoveryDoreplacedent.clreplaced);
    } catch (ClientErrorException e) {
        LOG.error("While getting the Discovery Doreplacedent at {}", discoveryDoreplacedentURL, e);
        if (e instanceof javax.ws.rs.NotFoundException) {
            throw new NotFoundException("Discovery Doreplacedent cannot be found at " + discoveryDoreplacedentURL);
        } else {
            SyncopeClientException sce = SyncopeClientException.build(ClientExceptionType.Unknown);
            sce.getElements().add(e.getMessage());
            throw sce;
        }
    }
}

14 View Complete Implementation : SAML2SPLogic.java
Copyright Apache License 2.0
Author : apache
private SAML2IdPEnreplacedy getIdP(final String enreplacedyID) {
    SAML2IdPEnreplacedy idp = null;
    SAML2IdP saml2IdP = saml2IdPDAO.findByEnreplacedyID(enreplacedyID);
    if (saml2IdP != null) {
        try {
            idp = cache.put(saml2IdP);
        } catch (Exception e) {
            LOG.error("Could not build SAML 2.0 IdP with key {}", enreplacedyID, e);
            SyncopeClientException sce = SyncopeClientException.build(ClientExceptionType.Unknown);
            sce.getElements().add(e.getMessage());
            throw sce;
        }
    }
    if (idp == null) {
        throw new NotFoundException("SAML 2.0 IdP '" + enreplacedyID + '\'');
    }
    return idp;
}

13 View Complete Implementation : ResourceServiceImpl.java
Copyright Apache License 2.0
Author : apache
@Override
public PagedConnObjectTOResult searchConnObjects(final String key, final String anyTypeKey, final ConnObjectTOQuery query) {
    Filter filter = null;
    Set<String> moreAttrsToGet = Set.of();
    if (StringUtils.isNotBlank(query.getFiql())) {
        try {
            FilterVisitor visitor = new FilterVisitor();
            SearchCondition<SearchBean> sc = searchContext.getCondition(query.getFiql(), SearchBean.clreplaced);
            sc.accept(visitor);
            filter = visitor.getQuery();
            moreAttrsToGet = visitor.getAttrs();
        } catch (Exception e) {
            LOG.error("Invalid FIQL expression: {}", query.getFiql(), e);
            SyncopeClientException sce = SyncopeClientException.build(ClientExceptionType.InvalidSearchExpression);
            sce.getElements().add(query.getFiql());
            sce.getElements().add(ExceptionUtils.getRootCauseMessage(e));
            throw sce;
        }
    }
    Pair<SearchResult, List<ConnObjectTO>> list = logic.searchConnObjects(filter, moreAttrsToGet, key, anyTypeKey, query.getSize(), query.getPagedResultsCookie(), getOrderByClauses(query.getOrderBy()));
    PagedConnObjectTOResult result = new PagedConnObjectTOResult();
    if (list.getLeft() != null) {
        result.setAllResultsReturned(list.getLeft().isAllResultsReturned());
        result.setPagedResultsCookie(list.getLeft().getPagedResultsCookie());
        result.setRemainingPagedResults(list.getLeft().getRemainingPagedResults());
    }
    result.getResult().addAll(list.getRight());
    UriBuilder builder = uriInfo.getAbsolutePathBuilder();
    MultivaluedMap<String, String> queryParams = uriInfo.getQueryParameters();
    for (Map.Entry<String, List<String>> queryParam : queryParams.entrySet()) {
        builder = builder.queryParam(queryParam.getKey(), queryParam.getValue().toArray());
    }
    if (StringUtils.isNotBlank(result.getPagedResultsCookie())) {
        result.setNext(builder.replaceQueryParam(PARAM_CONNID_PAGED_RESULTS_COOKIE, result.getPagedResultsCookie()).replaceQueryParam(PARAM_SIZE, query.getSize()).build());
    }
    return result;
}

13 View Complete Implementation : ImplementationLogic.java
Copyright Apache License 2.0
Author : apache
@PreAuthorize("hasRole('" + IdRepoEnreplacedlement.IMPLEMENTATION_CREATE + "')")
public ImplementationTO create(final ImplementationTO implementationTO) {
    if (StringUtils.isBlank(implementationTO.getKey())) {
        SyncopeClientException sce = SyncopeClientException.build(ClientExceptionType.RequiredValuesMissing);
        sce.getElements().add("Implementation key");
        throw sce;
    }
    checkType(implementationTO.getType());
    Implementation implementation = implementationDAO.find(implementationTO.getKey());
    if (implementation != null) {
        throw new DuplicateException(implementationTO.getKey());
    }
    return binder.getImplementationTO(implementationDAO.save(binder.create(implementationTO)));
}

13 View Complete Implementation : ReportLogic.java
Copyright Apache License 2.0
Author : apache
@PreAuthorize("hasRole('" + IdRepoEnreplacedlement.REPORT_CREATE + "')")
public ReportTO create(final ReportTO reportTO) {
    Report report = enreplacedyFactory.newEnreplacedy(Report.clreplaced);
    binder.getReport(report, reportTO);
    report = reportDAO.save(report);
    try {
        jobManager.register(report, null, confParamOps.get(AuthContextUtils.getDomain(), "tasks.interruptMaxRetries", 1L, Long.clreplaced), AuthContextUtils.getUsername());
    } catch (Exception e) {
        LOG.error("While registering quartz job for report " + report.getKey(), e);
        SyncopeClientException sce = SyncopeClientException.build(ClientExceptionType.Scheduling);
        sce.getElements().add(e.getMessage());
        throw sce;
    }
    return binder.getReportTO(report);
}

13 View Complete Implementation : TaskLogic.java
Copyright Apache License 2.0
Author : apache
@PreAuthorize("hasRole('" + IdRepoEnreplacedlement.TASK_READ + "')")
@Transactional(readOnly = true)
public <T extends TaskTO> T read(final TaskType type, final String key, final boolean details) {
    Task task = taskDAO.find(key);
    if (task == null) {
        throw new NotFoundException("Task " + key);
    }
    TaskUtils taskUtils = taskUtilsFactory.getInstance(task);
    if (type != null && taskUtils.getType() != type) {
        SyncopeClientException sce = SyncopeClientException.build(ClientExceptionType.InvalidRequest);
        sce.getElements().add("Found " + type + ", expected " + taskUtils.getType());
        throw sce;
    }
    return binder.getTaskTO(task, taskUtilsFactory.getInstance(task), details);
}