Skip to content

Commit

Permalink
ammends in dao, model, service, controller
Browse files Browse the repository at this point in the history
  • Loading branch information
nocs00 committed Jul 19, 2016
1 parent c8f9a6c commit af19b6d
Show file tree
Hide file tree
Showing 12 changed files with 152 additions and 102 deletions.
Expand Up @@ -67,12 +67,7 @@
import org.kaaproject.kaa.common.dto.ctl.CTLSchemaDto; import org.kaaproject.kaa.common.dto.ctl.CTLSchemaDto;
import org.kaaproject.kaa.common.dto.ctl.CTLSchemaExportMethod; import org.kaaproject.kaa.common.dto.ctl.CTLSchemaExportMethod;
import org.kaaproject.kaa.common.dto.ctl.CTLSchemaMetaInfoDto; import org.kaaproject.kaa.common.dto.ctl.CTLSchemaMetaInfoDto;
import org.kaaproject.kaa.common.dto.event.AefMapInfoDto; import org.kaaproject.kaa.common.dto.event.*;
import org.kaaproject.kaa.common.dto.event.ApplicationEventFamilyMapDto;
import org.kaaproject.kaa.common.dto.event.EcfInfoDto;
import org.kaaproject.kaa.common.dto.event.EventClassDto;
import org.kaaproject.kaa.common.dto.event.EventClassFamilyDto;
import org.kaaproject.kaa.common.dto.event.EventClassType;
import org.kaaproject.kaa.common.dto.file.FileData; import org.kaaproject.kaa.common.dto.file.FileData;
import org.kaaproject.kaa.common.dto.logs.LogAppenderDto; import org.kaaproject.kaa.common.dto.logs.LogAppenderDto;
import org.kaaproject.kaa.common.dto.logs.LogSchemaDto; import org.kaaproject.kaa.common.dto.logs.LogSchemaDto;
Expand Down Expand Up @@ -631,6 +626,13 @@ public EventClassFamilyDto getEventClassFamilyById(String ecfId) {
return restTemplate.getForObject(restTemplate.getUrl() + "eventClassFamily/" + ecfId, EventClassFamilyDto.class); return restTemplate.getForObject(restTemplate.getUrl() + "eventClassFamily/" + ecfId, EventClassFamilyDto.class);
} }


public List<EventClassFamilyVersionDto> getEventClassFamilyVersionsById(String ecfId) {
ParameterizedTypeReference<List<EventClassFamilyVersionDto>> typeRef = new ParameterizedTypeReference<List<EventClassFamilyVersionDto>>() {
};
ResponseEntity<List<EventClassFamilyVersionDto>> entity = restTemplate.exchange(restTemplate.getUrl() + "eventClassFamilyVersions/" + ecfId, HttpMethod.GET, null, typeRef);
return entity.getBody();
}

public EventClassFamilyDto getEventClassFamily(String familyName) { public EventClassFamilyDto getEventClassFamily(String familyName) {
ParameterizedTypeReference<List<EventClassFamilyDto>> typeRef = new ParameterizedTypeReference<List<EventClassFamilyDto>>() { ParameterizedTypeReference<List<EventClassFamilyDto>> typeRef = new ParameterizedTypeReference<List<EventClassFamilyDto>>() {
}; };
Expand All @@ -651,11 +653,11 @@ public List<EventClassFamilyDto> getEventClassFamilies() {
return entity.getBody(); return entity.getBody();
} }


public void addEventClassFamilySchema(String eventClassFamilyId, String schemaResource) throws Exception { public void addEventClassFamilyVersion(String eventClassFamilyId, EventClassFamilyVersionDto eventClassFamilyVersion) throws Exception {
MultiValueMap<String, Object> params = new LinkedMultiValueMap<>(); MultiValueMap<String, Object> params = new LinkedMultiValueMap<>();
params.add("eventClassFamilyId", eventClassFamilyId); params.add("eventClassFamilyId", eventClassFamilyId);
params.add("file", getFileResource(schemaResource)); params.add("eventClassFamilyVersion", eventClassFamilyVersion);
restTemplate.postForLocation(restTemplate.getUrl() + "addEventClassFamilySchema", params); restTemplate.postForLocation(restTemplate.getUrl() + "addEventClassFamilyVersion", params);
} }


public List<EventClassDto> getEventClassesByFamilyIdVersionAndType(String eventClassFamilyId, int version, EventClassType type) public List<EventClassDto> getEventClassesByFamilyIdVersionAndType(String eventClassFamilyId, int version, EventClassType type)
Expand Down
Expand Up @@ -89,6 +89,7 @@ public class DaoConstants {
public static final String CONFIGURATION_ID = "configuration_id"; public static final String CONFIGURATION_ID = "configuration_id";
public static final String PROFILE_FILTER_ID = "profile_filter_id"; public static final String PROFILE_FILTER_ID = "profile_filter_id";
public static final String EVENT_CLASS_FAMILY_ID = "events_class_family_id"; public static final String EVENT_CLASS_FAMILY_ID = "events_class_family_id";
public static final String EVENT_CLASS_FAMILY_VERSION_ID = "event_class_family_versions_id";
public static final String FQN = "fqn"; public static final String FQN = "fqn";
public static final String VERSION = "version"; public static final String VERSION = "version";


Expand Down Expand Up @@ -259,9 +260,9 @@ public class DaoConstants {
public static final String CHANGE_PROFILE_FILTER_ID = PROFILE_FILTER_ID; public static final String CHANGE_PROFILE_FILTER_ID = PROFILE_FILTER_ID;


/** /**
* Event schems version constants. * Event class family version constants.
*/ */
public static final String EVENT_CLASS_FAMILY_VERSION_TABLE_NAME = "event_schems_versions"; public static final String EVENT_CLASS_FAMILY_VERSION_TABLE_NAME = "event_class_family_versions";
public static final String EVENT_CLASS_FAMILY_VERSION_VERSION = VERSION; public static final String EVENT_CLASS_FAMILY_VERSION_VERSION = VERSION;
public static final String EVENT_CLASS_FAMILY_VERSION_CREATED_USERNAME = CREATED_USERNAME; public static final String EVENT_CLASS_FAMILY_VERSION_CREATED_USERNAME = CREATED_USERNAME;
public static final String EVENT_CLASS_FAMILY_VERSION_CREATED_TIME = CREATED_TIME; public static final String EVENT_CLASS_FAMILY_VERSION_CREATED_TIME = CREATED_TIME;
Expand All @@ -284,7 +285,7 @@ public class DaoConstants {
*/ */
public static final String EVENT_CLASS_TABLE_NAME = "events_class"; public static final String EVENT_CLASS_TABLE_NAME = "events_class";
public static final String EVENT_CLASS_TENANT_ID = TENANT_ID; public static final String EVENT_CLASS_TENANT_ID = TENANT_ID;
public static final String EVENT_CLASS_EVENT_CLASS_FAMILY_ID = EVENT_CLASS_FAMILY_ID; public static final String EVENT_CLASS_EVENT_CLASS_FAMILY_VERSION_ID = EVENT_CLASS_FAMILY_VERSION_ID;
public static final String EVENT_CLASS_FQN = FQN; public static final String EVENT_CLASS_FQN = FQN;
public static final String EVENT_CLASS_TYPE = "type"; public static final String EVENT_CLASS_TYPE = "type";
public static final String EVENT_CLASS_SCHEMA = "schems"; public static final String EVENT_CLASS_SCHEMA = "schems";
Expand Down
Expand Up @@ -55,19 +55,19 @@ public interface EventClassService {
/** /**
* Save event class family. * Save event class family.
* *
* @param eventClassFamilyVersionDto the event class family version dto * @param eventClassFamilyDto the event class family dto
* @return the event class family dto * @return the event class family dto
*/ */
EventClassFamilyDto saveEventClassFamily(EventClassFamilyVersionDto eventClassFamilyVersionDto); EventClassFamilyDto saveEventClassFamily(EventClassFamilyDto eventClassFamilyDto);


/** /**
* Add event class family schema. * Add event class family schema.
* *
* @param eventClassFamilyId the event class family id * @param eventClassFamilyId the event class family id
* @param eventClassFamilySchema the event class family schema * @param eventClassFamilyVersion the event class family version
* @param createdUsername the created username * @param createdUsername the created username
*/ */
void addEventClassFamilySchema(String eventClassFamilyId, String eventClassFamilySchema, String createdUsername); void addEventClassFamilyVersion(String eventClassFamilyId, EventClassFamilyVersionDto eventClassFamilyVersion, String createdUsername);


/** /**
* Find event classes by event class family Id and version. * Find event classes by event class family Id and version.
Expand Down
Expand Up @@ -23,11 +23,7 @@


import javax.persistence.*; import javax.persistence.*;


import static org.kaaproject.kaa.server.common.dao.DaoConstants.EVENT_CLASS_EVENT_CLASS_FAMILY_ID; import static org.kaaproject.kaa.server.common.dao.DaoConstants.*;
import static org.kaaproject.kaa.server.common.dao.DaoConstants.EVENT_CLASS_FQN;
import static org.kaaproject.kaa.server.common.dao.DaoConstants.EVENT_CLASS_TABLE_NAME;
import static org.kaaproject.kaa.server.common.dao.DaoConstants.EVENT_CLASS_TENANT_ID;
import static org.kaaproject.kaa.server.common.dao.DaoConstants.EVENT_CLASS_TYPE;
import static org.kaaproject.kaa.server.common.dao.model.sql.ModelUtils.getLongId; import static org.kaaproject.kaa.server.common.dao.model.sql.ModelUtils.getLongId;


@Entity @Entity
Expand All @@ -42,7 +38,6 @@ public class EventClass extends BaseSchema<EventClassDto> {
private Tenant tenant; private Tenant tenant;


@ManyToOne @ManyToOne
@JoinColumn(name = EVENT_CLASS_EVENT_CLASS_FAMILY_ID, nullable = false)
@OnDelete(action = OnDeleteAction.CASCADE) @OnDelete(action = OnDeleteAction.CASCADE)
private EventClassFamilyVersion ecf; private EventClassFamilyVersion ecf;


Expand Down
Expand Up @@ -72,7 +72,7 @@ public class EventClassFamily extends GenericModel<EventClassFamilyDto> {
protected long createdTime; protected long createdTime;


@OneToMany(cascade = CascadeType.ALL) @OneToMany(cascade = CascadeType.ALL)
@JoinColumn(name = EVENT_CLASS_FAMILY_VERSION_EVENT_CLASS_FAMILY_ID, nullable = false) @JoinColumn(name = EVENT_CLASS_FAMILY_VERSION_EVENT_CLASS_FAMILY_ID)
private List<EventClassFamilyVersion> schemas; private List<EventClassFamilyVersion> schemas;


public EventClassFamily() { public EventClassFamily() {
Expand Down
Expand Up @@ -20,14 +20,13 @@
import org.kaaproject.kaa.common.dto.event.EventClassFamilyVersionDto; import org.kaaproject.kaa.common.dto.event.EventClassFamilyVersionDto;


import javax.persistence.*; import javax.persistence.*;
import javax.persistence.Entity;
import javax.persistence.Table;


import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;


import static org.kaaproject.kaa.server.common.dao.DaoConstants.EVENT_CLASS_FAMILY_VERSION_CREATED_TIME; import static org.kaaproject.kaa.server.common.dao.DaoConstants.*;
import static org.kaaproject.kaa.server.common.dao.DaoConstants.EVENT_CLASS_FAMILY_VERSION_CREATED_USERNAME;
import static org.kaaproject.kaa.server.common.dao.DaoConstants.EVENT_CLASS_FAMILY_VERSION_TABLE_NAME;
import static org.kaaproject.kaa.server.common.dao.DaoConstants.EVENT_CLASS_FAMILY_VERSION_VERSION;
import static org.kaaproject.kaa.server.common.dao.model.sql.ModelUtils.getLongId; import static org.kaaproject.kaa.server.common.dao.model.sql.ModelUtils.getLongId;


@Entity @Entity
Expand All @@ -36,7 +35,8 @@ public class EventClassFamilyVersion extends GenericModel<EventClassFamilyVersio


private static final long serialVersionUID = -7490111487256831990L; private static final long serialVersionUID = -7490111487256831990L;


@OneToMany @OneToMany(cascade = CascadeType.ALL)
@JoinColumn(name = EVENT_CLASS_EVENT_CLASS_FAMILY_VERSION_ID)
private List<EventClass> records; private List<EventClass> records;


@Column(name = EVENT_CLASS_FAMILY_VERSION_VERSION) @Column(name = EVENT_CLASS_FAMILY_VERSION_VERSION)
Expand Down
Expand Up @@ -27,6 +27,8 @@
import java.util.Comparator; import java.util.Comparator;
import java.util.List; import java.util.List;


import org.apache.commons.lang.StringUtils;
import org.kaaproject.avro.ui.shared.NamesValidator;
import org.kaaproject.kaa.common.dto.event.EventClassDto; import org.kaaproject.kaa.common.dto.event.EventClassDto;
import org.kaaproject.kaa.common.dto.event.EventClassFamilyDto; import org.kaaproject.kaa.common.dto.event.EventClassFamilyDto;
import org.kaaproject.kaa.common.dto.event.EventClassFamilyVersionDto; import org.kaaproject.kaa.common.dto.event.EventClassFamilyVersionDto;
Expand All @@ -38,8 +40,6 @@
import org.kaaproject.kaa.server.common.dao.model.sql.EventClass; import org.kaaproject.kaa.server.common.dao.model.sql.EventClass;
import org.kaaproject.kaa.server.common.dao.model.sql.EventClassFamily; import org.kaaproject.kaa.server.common.dao.model.sql.EventClassFamily;
import org.kaaproject.kaa.server.common.dao.model.sql.EventClassFamilyVersion; import org.kaaproject.kaa.server.common.dao.model.sql.EventClassFamilyVersion;
import org.kaaproject.kaa.server.common.dao.schema.EventSchemaException;
import org.kaaproject.kaa.server.common.dao.schema.EventSchemaMetadata;
import org.kaaproject.kaa.server.common.dao.schema.EventSchemaProcessor; import org.kaaproject.kaa.server.common.dao.schema.EventSchemaProcessor;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
Expand Down Expand Up @@ -100,36 +100,46 @@ public List<EventClassFamilyVersionDto> findEventClassFamilyVersionsById(String


@Override @Override
public EventClassFamilyDto saveEventClassFamily( public EventClassFamilyDto saveEventClassFamily(
EventClassFamilyVersionDto eventClassFamilyVersionDto) { EventClassFamilyDto eventClassFamilyDto) {
EventClassFamilyDto savedEventClassFamilyDto = null; EventClassFamilyDto savedEventClassFamilyDto = null;
if (isValidSqlObject(eventClassFamilyVersionDto)) { if (isValidSqlObject(eventClassFamilyDto)) {
savedEventClassFamilyDto = getDto(eventClassFamilyDao.findById(eventClassFamilyVersionDto.getId())); if (eventClassFamilyDao.validateName(eventClassFamilyDto.getTenantId(), eventClassFamilyDto.getId(), eventClassFamilyDto.getName())) {
savedEventClassFamilyDto.setCreatedTime(System.currentTimeMillis()); if (StringUtils.isBlank(eventClassFamilyDto.getId())) {
EventClassFamily ecf = new EventClassFamily(savedEventClassFamilyDto); if (NamesValidator.validateNamespace(eventClassFamilyDto.getNamespace())) {
List<EventClassFamilyVersion> schemas = new ArrayList<>(); if (NamesValidator.validateClassName(eventClassFamilyDto.getClassName())) {
findEventClassFamilyVersionsById(eventClassFamilyVersionDto.getId()).forEach(s -> schemas.add(new EventClassFamilyVersion(s))); if (eventClassFamilyDao.validateClassName(eventClassFamilyDto.getTenantId(), eventClassFamilyDto.getId(), eventClassFamilyDto.getClassName())) {
schemas.add(new EventClassFamilyVersion(eventClassFamilyVersionDto)); eventClassFamilyDto.setCreatedTime(System.currentTimeMillis());
ecf.setSchemas(schemas); } else {
savedEventClassFamilyDto = getDto(eventClassFamilyDao.save(ecf)); LOG.debug("Can't save event class family. Class name should be unique within the tenant.");
throw new IncorrectParameterException("Incorrect event class family. Class name should be unique within the tenant.");
}
} else {
LOG.debug("Can't save event class family. Class name [{}] is not valid.", eventClassFamilyDto.getClassName());
throw new IncorrectParameterException("Incorrect event class family. Class name is not valid. '" + eventClassFamilyDto.getClassName() + "' is not a valid identifier.");
}
} else {
LOG.debug("Can't save event class family. Namespace [{}] is not valid.", eventClassFamilyDto.getNamespace());
throw new IncorrectParameterException("Incorrect event class family. Namespace is not valid. '" + eventClassFamilyDto.getNamespace() + "' is not a valid identifier.");
}
}
savedEventClassFamilyDto = getDto(eventClassFamilyDao.save(new EventClassFamily(eventClassFamilyDto)));
} else {
LOG.debug("Can't save event class family. Name should be unique within the tenant.");
throw new IncorrectParameterException("Incorrect event class family. Name should be unique within the tenant.");
}
} }
return savedEventClassFamilyDto; return savedEventClassFamilyDto;
} }


@Override @Override
public void addEventClassFamilySchema(String eventClassFamilyId, public void addEventClassFamilyVersion(String eventClassFamilyId,
String eventClassFamilySchema, String createdUsername) { EventClassFamilyVersionDto eventClassFamilyVersion, String createdUsername) {
EventClassFamilyDto eventClassFamily = findEventClassFamilyById(eventClassFamilyId); EventClassFamilyDto eventClassFamily = findEventClassFamilyById(eventClassFamilyId);
if (eventClassFamily != null) { if (eventClassFamily != null) {
List<EventSchemaMetadata> eventSchemas; List<EventClassDto> records = eventClassFamilyVersion.getRecords();
try { List<String> fqns = new ArrayList<>(records.size());
eventSchemas = eventSchemaProcessor.processSchema(eventClassFamilySchema); for (EventClassDto eventClass : records) {
} catch (EventSchemaException e) { fqns.add(eventClass.getFqn());
LOG.warn("Can't process event class family schema.", e);
throw new IncorrectParameterException("Incorrect event class family schema.");
}
List<String> fqns = new ArrayList<>(eventSchemas.size());
for (EventSchemaMetadata eventSchema : eventSchemas) {
fqns.add(eventSchema.getFqn());
} }
if (validateEventClassFamilyFqns(eventClassFamily, fqns)) { if (validateEventClassFamilyFqns(eventClassFamily, fqns)) {
List<EventClassFamilyVersionDto> schemasDto = findEventClassFamilyVersionsById(eventClassFamilyId); List<EventClassFamilyVersionDto> schemasDto = findEventClassFamilyVersionsById(eventClassFamilyId);
Expand All @@ -143,20 +153,21 @@ public int compare(EventClassFamilyVersionDto o1,
} }
}); });
version = schemasDto.get(schemasDto.size()-1).getVersion()+1; version = schemasDto.get(schemasDto.size()-1).getVersion()+1;
} else {
schemasDto = new ArrayList<>();
} }
EventClassFamilyVersionDto eventClassFamilyVersion = new EventClassFamilyVersionDto();
eventClassFamilyVersion.setVersion(version); eventClassFamilyVersion.setVersion(version);
eventClassFamilyVersion.setCreatedTime(System.currentTimeMillis()); eventClassFamilyVersion.setCreatedTime(System.currentTimeMillis());
eventClassFamilyVersion.setCreatedUsername(createdUsername); eventClassFamilyVersion.setCreatedUsername(createdUsername);
schemasDto.add(eventClassFamilyVersion); schemasDto.add(eventClassFamilyVersion);
EventClassFamily ecf = new EventClassFamily(eventClassFamily); EventClassFamily ecf = new EventClassFamily(eventClassFamily);
List<EventClassFamilyVersion> schemas = new ArrayList<>(); List<EventClassFamilyVersion> schemas = new ArrayList<>();
for (EventClassDto eventClass : records) {
saveEventClass(eventClassFamily, eventClass, version);
}
schemasDto.forEach(s -> schemas.add(new EventClassFamilyVersion(s))); schemasDto.forEach(s -> schemas.add(new EventClassFamilyVersion(s)));
ecf.setSchemas(schemas); ecf.setSchemas(schemas);
eventClassFamilyDao.save(new EventClassFamily(eventClassFamily)); eventClassFamilyDao.save(ecf);
for (EventSchemaMetadata eventSchema : eventSchemas) {
saveEventClassSchema(eventClassFamily, eventSchema, version);
}
} else { } else {
LOG.debug("Can't process event class family schema."); LOG.debug("Can't process event class family schema.");
throw new IncorrectParameterException("Incorrect event class family schema. FQNs should be unique within the tenant."); throw new IncorrectParameterException("Incorrect event class family schema. FQNs should be unique within the tenant.");
Expand All @@ -167,15 +178,11 @@ public int compare(EventClassFamilyVersionDto o1,
} }
} }


private void saveEventClassSchema(EventClassFamilyDto eventClassFamilyDto, EventSchemaMetadata eventSchema, int version) { private void saveEventClass(EventClassFamilyDto eventClassFamilyDto, EventClassDto eventClass, int version) {
EventClassDto eventClass = new EventClassDto();
eventClass.setTenantId(eventClassFamilyDto.getTenantId()); eventClass.setTenantId(eventClassFamilyDto.getTenantId());
eventClass.setEcfId(eventClassFamilyDto.getId()); eventClass.setEcfId(eventClassFamilyDto.getId());
eventClass.setFqn(eventSchema.getFqn());
eventClass.setType(eventSchema.getType());
eventClass.setVersion(version); eventClass.setVersion(version);
eventClass.setCtlSchemaId(eventSchema.getCtlSchemaId()); //eventClassDao.save(new EventClass(eventClass));
eventClassDao.save(new EventClass(eventClass));
} }


private boolean validateEventClassFamilyFqns(EventClassFamilyDto eventClassFamily, List<String> fqns) { private boolean validateEventClassFamilyFqns(EventClassFamilyDto eventClassFamily, List<String> fqns) {
Expand Down
Expand Up @@ -1927,38 +1927,52 @@ public EventClassFamilyDto getEventClassFamily(@PathVariable String eventClassFa
return kaaAdminService.getEventClassFamily(eventClassFamilyId); return kaaAdminService.getEventClassFamily(eventClassFamilyId);
} }


/**
* Gets the event class family versions by its id.
*
* @param eventClassFamilyId
* the event class family id
* @return the list of event class family version dto
* @throws KaaAdminServiceException
* the kaa admin service exception
*/
@RequestMapping(value = "eventClassFamilyVersions/{eventClassFamilyId}", method = RequestMethod.GET)
@ResponseBody
public List<EventClassFamilyVersionDto> getEventClassFamilyVersions(@PathVariable String eventClassFamilyId) throws KaaAdminServiceException {
return kaaAdminService.getEventClassFamilyVersions(eventClassFamilyId);
}

/** /**
* Edits event class family to the list of all event class families. * Edits event class family to the list of all event class families.
* *
* @param eventClassFamilyVersion * @param eventClassFamily
* the version of event class family * the event class family
* @return the event class family dto * @return the event class family dto
* @throws KaaAdminServiceException * @throws KaaAdminServiceException
* the kaa admin service exception * the kaa admin service exception
*/ */
@RequestMapping(value = "eventClassFamily", method = RequestMethod.POST) @RequestMapping(value = "eventClassFamily", method = RequestMethod.POST)
@ResponseBody @ResponseBody
public EventClassFamilyDto editEventClassFamily(@RequestBody EventClassFamilyVersionDto eventClassFamilyVersion) throws KaaAdminServiceException { public EventClassFamilyDto editEventClassFamily(@RequestBody EventClassFamilyDto eventClassFamily) throws KaaAdminServiceException {
return kaaAdminService.editEventClassFamily(eventClassFamilyVersion); return kaaAdminService.editEventClassFamily(eventClassFamily);
} }


/** /**
* Adds the event class family schema to the event class family with * Adds the event class family version to existing event class family with
* specific id. Current user will be marked as creator of schema. * specific id. Current user will be marked as creator of schema.
* *
* @param eventClassFamilyId * @param eventClassFamilyId
* the event class family id * the event class family id
* @param file * @param eventClassFamilyVersion
* the file * the version of event class family
* @throws KaaAdminServiceException * @throws KaaAdminServiceException
* the kaa admin service exception * the kaa admin service exception
*/ */
@RequestMapping(value = "addEventClassFamilySchema", method = RequestMethod.POST, consumes = { "multipart/mixed", "multipart/form-data" }) @RequestMapping(value = "addEventClassFamilyVersion", method = RequestMethod.POST, consumes = { "multipart/mixed", "multipart/form-data" })
@ResponseStatus(value = HttpStatus.OK) @ResponseStatus(value = HttpStatus.OK)
public void addEventClassFamilySchema(@RequestPart(value = "eventClassFamilyId") String eventClassFamilyId, public void addEventClassFamilyVersion(@RequestPart(value = "eventClassFamilyId") String eventClassFamilyId,
@RequestPart("file") MultipartFile file) throws KaaAdminServiceException { @RequestPart(value = "eventClassFamilyVersion") EventClassFamilyVersionDto eventClassFamilyVersion) throws KaaAdminServiceException {
byte[] data = getFileContent(file); kaaAdminService.addEventClassFamilyVersion(eventClassFamilyId, eventClassFamilyVersion);
kaaAdminService.addEventClassFamilySchema(eventClassFamilyId, data);
} }


/** /**
Expand Down

0 comments on commit af19b6d

Please sign in to comment.