Search in sources :

Example 1 with PromotionAuthor

use of io.gravitee.repository.management.model.PromotionAuthor in project gravitee-management-rest-api by gravitee-io.

the class PromotionServiceImpl method convert.

private Promotion convert(PromotionEntity promotionEntity) {
    PromotionAuthor promotionAuthor = new PromotionAuthor();
    promotionAuthor.setUserId(promotionEntity.getAuthor().getUserId());
    promotionAuthor.setDisplayName(promotionEntity.getAuthor().getDisplayName());
    promotionAuthor.setEmail(promotionEntity.getAuthor().getEmail());
    promotionAuthor.setPicture(promotionEntity.getAuthor().getPicture());
    promotionAuthor.setSource(promotionEntity.getAuthor().getSource());
    promotionAuthor.setSourceId(promotionEntity.getAuthor().getSourceId());
    Promotion promotion = new Promotion();
    promotion.setId(promotionEntity.getId());
    promotion.setApiId(promotionEntity.getApiId());
    promotion.setCreatedAt(promotionEntity.getCreatedAt());
    promotion.setUpdatedAt(promotionEntity.getUpdatedAt());
    promotion.setSourceEnvCockpitId(promotionEntity.getSourceEnvCockpitId());
    promotion.setSourceEnvName(promotionEntity.getSourceEnvName());
    promotion.setTargetEnvCockpitId(promotionEntity.getTargetEnvCockpitId());
    promotion.setTargetEnvName(promotionEntity.getTargetEnvName());
    promotion.setApiDefinition(promotionEntity.getApiDefinition());
    promotion.setStatus(convert(promotionEntity.getStatus()));
    promotion.setAuthor(promotionAuthor);
    return promotion;
}
Also used : PromotionAuthor(io.gravitee.repository.management.model.PromotionAuthor) Promotion(io.gravitee.repository.management.model.Promotion)

Example 2 with PromotionAuthor

use of io.gravitee.repository.management.model.PromotionAuthor in project gravitee-management-rest-api by gravitee-io.

the class PromotionServiceTest method getAPromotion.

private Promotion getAPromotion() {
    PromotionAuthor promotionAuthor = new PromotionAuthor();
    promotionAuthor.setUserId("user#1");
    promotionAuthor.setDisplayName("User 1");
    promotionAuthor.setEmail("user1@gv.io");
    promotionAuthor.setSource("cockpit");
    promotionAuthor.setSourceId("user1");
    Promotion promotion = new Promotion();
    promotion.setCreatedAt(new Date());
    promotion.setStatus(PromotionStatus.TO_BE_VALIDATED);
    promotion.setApiId("api#1");
    promotion.setApiDefinition("apiDefinition");
    promotion.setSourceEnvCockpitId("sourceEnvId");
    promotion.setSourceEnvName("sourceEnv Name");
    promotion.setTargetEnvCockpitId("targetEnvironmentId");
    promotion.setTargetEnvName("targetEnv Name");
    promotion.setAuthor(promotionAuthor);
    return promotion;
}
Also used : PromotionAuthor(io.gravitee.repository.management.model.PromotionAuthor) Promotion(io.gravitee.repository.management.model.Promotion) Date(java.util.Date)

Example 3 with PromotionAuthor

use of io.gravitee.repository.management.model.PromotionAuthor in project gravitee-management-rest-api by gravitee-io.

the class PromotionServiceImpl method convert.

private Promotion convert(String apiId, String apiDefinition, EnvironmentEntity source, PromotionRequestEntity target, UserEntity author) {
    PromotionAuthor promotionAuthor = new PromotionAuthor();
    promotionAuthor.setUserId(author.getId());
    promotionAuthor.setDisplayName(author.getDisplayName());
    promotionAuthor.setEmail(author.getEmail());
    promotionAuthor.setPicture(author.getPicture());
    promotionAuthor.setSource(author.getSource());
    promotionAuthor.setSourceId(author.getSourceId());
    Promotion promotion = new Promotion();
    promotion.setCreatedAt(new Date());
    promotion.setStatus(PromotionStatus.CREATED);
    promotion.setApiDefinition(apiDefinition);
    promotion.setApiId(apiId);
    promotion.setSourceEnvCockpitId(source.getCockpitId());
    promotion.setSourceEnvName(source.getName());
    promotion.setTargetEnvCockpitId(target.getTargetEnvCockpitId());
    promotion.setTargetEnvName(target.getTargetEnvName());
    promotion.setAuthor(promotionAuthor);
    return promotion;
}
Also used : PromotionAuthor(io.gravitee.repository.management.model.PromotionAuthor) Promotion(io.gravitee.repository.management.model.Promotion) Date(java.util.Date)

Aggregations

Promotion (io.gravitee.repository.management.model.Promotion)3 PromotionAuthor (io.gravitee.repository.management.model.PromotionAuthor)3 Date (java.util.Date)2