use of io.vertigo.util.ListBuilder in project vertigo by KleeGroup.
the class AnnotationWriter method writeSimpleAssociationAnnotation.
/**
* Ectiture des annotations sur un DT_FIELD gérant une association.
*
* @param associationSimple Definition de l'association
* @return Liste des lignes de code java à ajouter.
*/
List<String> writeSimpleAssociationAnnotation(final AssociationSimpleDefinition associationSimple) {
final AssociationNode primaryNode = associationSimple.getPrimaryAssociationNode();
final AssociationNode foreignNode = associationSimple.getForeignAssociationNode();
final String primaryMultiplicity = AssociationUtil.getMultiplicity(primaryNode.isNotNull(), primaryNode.isMultiple());
final String foreignMultiplipicity = AssociationUtil.getMultiplicity(foreignNode.isNotNull(), foreignNode.isMultiple());
return new ListBuilder<String>().add("@" + Association.class.getCanonicalName() + "(").add(INDENT + "name = \"" + associationSimple.getName() + "\",").add(INDENT + "fkFieldName = \"" + associationSimple.getFKField().getName() + "\",").add(INDENT + "primaryDtDefinitionName = \"" + primaryNode.getDtDefinition().getName() + "\",").add(INDENT + "primaryIsNavigable = " + primaryNode.isNavigable() + ',').add(INDENT + "primaryRole = \"" + primaryNode.getRole() + "\",").add(INDENT + "primaryLabel = \"" + primaryNode.getLabel() + "\",").add(INDENT + "primaryMultiplicity = \"" + primaryMultiplicity + "\",").add(INDENT + "foreignDtDefinitionName = \"" + foreignNode.getDtDefinition().getName() + "\",").add(INDENT + "foreignIsNavigable = " + foreignNode.isNavigable() + ',').add(INDENT + "foreignRole = \"" + foreignNode.getRole() + "\",").add(INDENT + "foreignLabel = \"" + foreignNode.getLabel() + "\",").add(INDENT + "foreignMultiplicity = \"" + foreignMultiplipicity + "\")").build();
}
use of io.vertigo.util.ListBuilder in project vertigo by KleeGroup.
the class AnnotationWriter method writeNNAssociationAnnotation.
/**
* Ectiture des annotations sur un DT_FIELD gérant une association.
*
* @param associationNN Definition de l'association
* @return Liste des lignes de code java à ajouter.
*/
List<String> writeNNAssociationAnnotation(final AssociationNNDefinition associationNN) {
final AssociationNode nodeA = associationNN.getAssociationNodeA();
final AssociationNode nodeB = associationNN.getAssociationNodeB();
return new ListBuilder<String>().add("@" + AssociationNN.class.getCanonicalName() + "(").add(INDENT + "name = \"" + associationNN.getName() + "\",").add(INDENT + "tableName = \"" + associationNN.getTableName() + "\",").add(INDENT + "dtDefinitionA = \"" + nodeA.getDtDefinition().getName() + "\",").add(INDENT + "dtDefinitionB = \"" + nodeB.getDtDefinition().getName() + "\",").add(INDENT + "navigabilityA = " + nodeA.isNavigable() + ',').add(INDENT + "navigabilityB = " + nodeB.isNavigable() + ',').add(INDENT + "roleA = \"" + nodeA.getRole() + "\",").add(INDENT + "roleB = \"" + nodeB.getRole() + "\",").add(INDENT + "labelA = \"" + nodeA.getLabel() + "\",").add(INDENT + "labelB = \"" + nodeB.getLabel() + "\")").build();
}
use of io.vertigo.util.ListBuilder in project vertigo by KleeGroup.
the class AccountDefinitionProvider method provideDefinitions.
/**
* {@inheritDoc}
*/
@Override
public List<Definition> provideDefinitions(final DefinitionSpace definitionSpace) {
final Domain domainAccountId = Domain.builder("DO_X_ACCOUNT_ID", DataType.String).build();
final Domain domainAccountName = Domain.builder("DO_X_ACCOUNT_NAME", DataType.String).build();
final Domain domainAccountEmail = Domain.builder("DO_X_ACCOUNT_EMAIL", DataType.String).build();
final DtDefinition accountDtDefinition = DtDefinition.builder("DT_ACCOUNT").addIdField(ID, "id", domainAccountId).addDataField(DISPLAY_NAME, "displayName", domainAccountName, false, true).addDataField(EMAIL, "email", domainAccountEmail, false, true).withSortField(DISPLAY_NAME).withDisplayField(DISPLAY_NAME).build();
final DtDefinition accountGroupDtDefinition = DtDefinition.builder("DT_ACCOUNT_GROUP").addIdField(ID, "id", domainAccountId).addDataField(DISPLAY_NAME, "displayName", domainAccountName, false, true).withSortField(DISPLAY_NAME).withDisplayField(DISPLAY_NAME).build();
return new ListBuilder<Definition>().add(domainAccountId).add(domainAccountName).add(domainAccountEmail).add(accountDtDefinition).add(accountGroupDtDefinition).build();
}
use of io.vertigo.util.ListBuilder in project vertigo by KleeGroup.
the class WebServiceManagerImpl method scanComponents.
/**
* Scan WebServices as WebServiceDefinitions on all the components.
* @param componentSpace ComponentSpace
* @return Scanned webServiceDefinitions
*/
List<WebServiceDefinition> scanComponents(final ComponentSpace componentSpace) {
final AopPlugin aopPlugin = Home.getApp().getConfig().getBootConfig().getAopPlugin();
final ListBuilder<WebServiceDefinition> allWebServiceDefinitionListBuilder = new ListBuilder<>();
// 1- We introspect all RestfulService class
for (final String componentId : componentSpace.keySet()) {
final Object component = componentSpace.resolve(componentId, Object.class);
if (component instanceof WebServices) {
final WebServices webServices = aopPlugin.unwrap(WebServices.class.cast(component));
final List<WebServiceDefinition> webServiceDefinitions = webServiceScannerPlugin.scanWebService(webServices.getClass());
allWebServiceDefinitionListBuilder.addAll(webServiceDefinitions);
}
}
// 2- We sort by path, parameterized path should be after strict path
return allWebServiceDefinitionListBuilder.sort(Comparator.comparing(WebServiceDefinition::getName)).unmodifiable().build();
}
use of io.vertigo.util.ListBuilder in project vertigo by KleeGroup.
the class VegaFeatures method buildFeatures.
/**
* {@inheritDoc}
*/
@Override
protected void buildFeatures() {
final PluginConfigBuilder corsAllowerPluginConfigBuilder = PluginConfig.builder(CorsAllowerWebServiceHandlerPlugin.class);
if (myOriginCORSFilter != null) {
corsAllowerPluginConfigBuilder.addParam(Param.of("originCORSFilter", myOriginCORSFilter));
}
getModuleConfigBuilder().addComponent(WebServiceManager.class, WebServiceManagerImpl.class).addPlugin(AnnotationsWebServiceScannerPlugin.class).addComponent(SwaggerWebServices.class).addComponent(CatalogWebServices.class).addPlugin(ExceptionWebServiceHandlerPlugin.class).addPlugin(corsAllowerPluginConfigBuilder.build()).addPlugin(AnalyticsWebServiceHandlerPlugin.class).addPlugin(JsonConverterWebServiceHandlerPlugin.class);
if (mySearchApiVersion != null) {
getModuleConfigBuilder().addComponent(JsonEngine.class, GoogleJsonEngine.class, Param.of("searchApiVersion", mySearchApiVersion));
} else {
getModuleConfigBuilder().addComponent(JsonEngine.class, GoogleJsonEngine.class);
}
if (securityEnabled) {
getModuleConfigBuilder().addPlugin(SessionInvalidateWebServiceHandlerPlugin.class).addPlugin(SessionWebServiceHandlerPlugin.class).addPlugin(SecurityWebServiceHandlerPlugin.class);
}
if (tokensEnabled) {
getModuleConfigBuilder().addPlugin(ServerSideStateWebServiceHandlerPlugin.class).addPlugin(AccessTokenWebServiceHandlerPlugin.class).addPlugin(PaginatorAndSortWebServiceHandlerPlugin.class).addComponent(TokenManager.class, TokenManagerImpl.class, Param.of("collection", myTokens));
}
if (miscEnabled) {
getModuleConfigBuilder().addPlugin(RateLimitingWebServiceHandlerPlugin.class);
}
if (myPort != null) {
final ListBuilder<Param> params = new ListBuilder().add(Param.of("port", Integer.toString(myPort)));
if (myApiPrefix != null) {
params.add(Param.of("apiPrefix", myApiPrefix));
}
getModuleConfigBuilder().addPlugin(new PluginConfig(SparkJavaEmbeddedWebServerPlugin.class, params.build()));
}
getModuleConfigBuilder().addPlugin(ValidatorWebServiceHandlerPlugin.class).addPlugin(RestfulServiceWebServiceHandlerPlugin.class);
}
Aggregations