Search in sources :

Example 1 with ContainerOrg

use of org.ligoj.app.iam.ContainerOrg in project ligoj-api by ligoj.

the class DelegateOrgResource method toEntity.

/**
 * Build the entity from the import entry.
 *
 * @param importEntry
 *            The new delegate.
 * @return The JPA entity form with validated inputs.
 */
private DelegateOrg toEntity(final DelegateOrgEditionVo importEntry) {
    // Validate the related receiver of this delegate
    final ResourceOrg receiver = toReceiver.get(importEntry.getReceiverType()).apply(importEntry.getReceiver());
    final DelegateOrg entity = new DelegateOrg();
    entity.setId(importEntry.getId());
    entity.setName(Normalizer.normalize(importEntry.getName()));
    entity.setCanAdmin(importEntry.isCanAdmin());
    entity.setCanWrite(importEntry.isCanWrite());
    entity.setType(importEntry.getType());
    entity.setReceiver(receiver.getId());
    entity.setReceiverType(importEntry.getReceiverType());
    if (receiver instanceof ContainerOrg) {
        // Store receiver DN only for immutable containers
        entity.setReceiverDn(receiver.getDn());
    }
    return entity;
}
Also used : ContainerOrg(org.ligoj.app.iam.ContainerOrg) DelegateOrg(org.ligoj.app.iam.model.DelegateOrg) ResourceOrg(org.ligoj.app.iam.ResourceOrg)

Aggregations

ContainerOrg (org.ligoj.app.iam.ContainerOrg)1 ResourceOrg (org.ligoj.app.iam.ResourceOrg)1 DelegateOrg (org.ligoj.app.iam.model.DelegateOrg)1