private void validateScope(VolumeTemplate template) { if (!(Boolean.TRUE.equals(template.getPerContainer()) || Boolean.TRUE.equals(template.getExternal()) || template .getStackId() != null)) { throw new ValidationErrorException(ValidationErrorCodes.INVALID_OPTION, "Scope is not set on the volume. Should either be per container, external or per stack"); } } }
private void validateNameUniqueness(VolumeTemplate template) { if (objectManager.find(VolumeTemplate.class, VOLUME_TEMPLATE.REMOVED, null, VOLUME_TEMPLATE.STACK_ID, template.getStackId(), VOLUME_TEMPLATE.NAME, template.getName()).size() > 0) { throw new ValidationErrorException(ValidationErrorCodes.NOT_UNIQUE, "name"); } }
/** * {@inheritDoc} */ @Override public void from(io.cattle.platform.core.model.VolumeTemplate from) { setId(from.getId()); setName(from.getName()); setAccountId(from.getAccountId()); setKind(from.getKind()); setUuid(from.getUuid()); setDescription(from.getDescription()); setState(from.getState()); setCreated(from.getCreated()); setRemoved(from.getRemoved()); setRemoveTime(from.getRemoveTime()); setData(from.getData()); setDriver(from.getDriver()); setStackId(from.getStackId()); setExternal(from.getExternal()); setPerContainer(from.getPerContainer()); }