Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/eclipse/dirigible.git
Browse files Browse the repository at this point in the history
  • Loading branch information
delchev committed Apr 18, 2024
2 parents b35b0b2 + e91d8a2 commit 06ee480
Show file tree
Hide file tree
Showing 13 changed files with 1,008 additions and 53 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import * as rs from "sdk/http/rs"
const router = rs.service();
let instance = null;

export function Controller(ctr: {new()}, context: ClassDecoratorContext): void {
export function Controller(ctr: { new() }, context: ClassDecoratorContext): void {
instance = new ctr();
router.execute();
}
Expand All @@ -29,15 +29,12 @@ export const Head = createRequestDecorator("head")
export const Options = createRequestDecorator("options")

function createRequestDecorator(httpMethod) {
return function (path: string): any {
return function (path: string, consumesMimeTypes: undefined | string | string[] = ['*/*'], producesMimeTypes: undefined | string | string[] = ['application/json']): any {
return function (target, propertyKey, descriptor) {
const handler = descriptor ? descriptor.value : target;
router[httpMethod](
path,
(ctx, req, res) => {
handleRequest(req, res, ctx, handler);
}
);
router.resource(path)[httpMethod]((ctx, req, res) => {
handleRequest(req, res, ctx, handler);
}).consumes(consumesMimeTypes).produces(producesMimeTypes);
};
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,7 @@ const catchErrorHandler = function (logctx, ctx, err, request, response) {
const matchMediaType = function (request, producesMediaTypes, consumesMediaTypes) {
let isProduceMatched = false;
const acceptsMediaTypes = normalizeMediaTypeHeaderValue(request.getHeader('Accept'));
if (!acceptsMediaTypes || acceptsMediaTypes.indexOf('*/*') > -1) { //output media type is not restricted
if (!acceptsMediaTypes || acceptsMediaTypes.length === 0 || acceptsMediaTypes.indexOf('*/*') > -1) { //output media type is not restricted
isProduceMatched = true;
} else {
let matchedProducesMIME;
Expand All @@ -286,7 +286,7 @@ const matchMediaType = function (request, producesMediaTypes, consumesMediaTypes

let isConsumeMatched = false;
const contentTypeMediaTypes = normalizeMediaTypeHeaderValue(request.getContentType());
if (!consumesMediaTypes || consumesMediaTypes.indexOf('*') > -1) { //input media type is not restricted
if (!consumesMediaTypes || consumesMediaTypes.length === 0 || consumesMediaTypes.indexOf('*/*') > -1) { //input media type is not restricted
isConsumeMatched = true;
} else {
let matchedConsumesMIME;
Expand Down
2 changes: 1 addition & 1 deletion components/api/api-s3/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
<dependency>
<groupId>software.amazon.awssdk</groupId>
<artifactId>s3-transfer-manager</artifactId>
<version>2.25.28</version>
<version>2.25.32</version>
</dependency>

<!-- Test -->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,6 @@ angular.module('edmDetails', ['ideUI', 'ideView'])
dataName: $scope.dataParameters.dataName,
dataCount: $scope.dataParameters.dataCount,
dataQuery: $scope.dataParameters.dataQuery,
disableGeneration: $scope.dataParameters.disableGeneration,
title: $scope.dataParameters.title,
caption: $scope.dataParameters.caption,
tooltip: $scope.dataParameters.tooltip,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,14 @@
* SPDX-FileCopyrightText: Eclipse Dirigible contributors
* SPDX-License-Identifier: EPL-2.0
*/
function _uuid () {
function _uuid() {
function _p8(s) {
let p = (Math.random().toString(16) + "000000000").substr(2, 8);
return s ? "-" + p.substr(0, 4) + "-" + p.substr(4, 4) : p;
}
return _p8() + _p8(true) + _p8(true) + _p8();
let p = (Math.random().toString(16) + "000000000").substr(2, 8);
return s ? "-" + p.substr(0, 4) + "-" + p.substr(4, 4) : p;
}
return _p8() + _p8(true) + _p8(true) + _p8();
}

angular.module('ui.entity-data.modeler', ["ideUI", "ideView", "ideWorkspace", "ideGenerate", "ideTemplates"])
.controller('ModelerCtrl', function ($scope, messageHub, $window, workspaceApi, generateApi, templatesApi, ViewParameters) {
let contents;
Expand Down Expand Up @@ -303,7 +303,6 @@ angular.module('ui.entity-data.modeler', ["ideUI", "ideView", "ideWorkspace", "i
cell.value.dataName = msg.data.dataName;
cell.value.dataCount = msg.data.dataCount;
cell.value.dataQuery = msg.data.dataQuery;
cell.value.disableGeneration = msg.data.disableGeneration;
cell.value.title = msg.data.title;
cell.value.caption = msg.data.caption;
cell.value.tooltip = msg.data.tooltip;
Expand Down Expand Up @@ -500,7 +499,7 @@ angular.module('ui.entity-data.modeler', ["ideUI", "ideView", "ideWorkspace", "i
},
true
);

function main(container, outline, toolbar, sidebar) {
let ICON_ENTITY = 'sap-icon--header';
let ICON_PROPERTY = 'sap-icon--bullet-text';
Expand Down Expand Up @@ -584,9 +583,9 @@ angular.module('ui.entity-data.modeler', ["ideUI", "ideView", "ideWorkspace", "i
$scope.graph.isCellMovable = function (cell) {
return this.isSwimlane(cell);
};
$scope.graph.model.createId = function(_cell) {
let id = _uuid();

$scope.graph.model.createId = function (_cell) {
let id = _uuid();
return this.prefix + id + this.postfix;
};

Expand Down Expand Up @@ -983,7 +982,6 @@ angular.module('ui.entity-data.modeler', ["ideUI", "ideView", "ideWorkspace", "i
dataName: cell.value.dataName,
dataCount: cell.value.dataCount,
dataQuery: cell.value.dataQuery,
disableGeneration: cell.value.disableGeneration,
title: cell.value.title,
caption: cell.value.caption,
tooltip: cell.value.tooltip,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,10 @@ function createModel(graph) {
child.value.tooltip = child.value.tooltip ? child.value.tooltip : child.value.name;
child.value.menuKey = child.value.menuKey ? child.value.menuKey : JSON.stringify(child.value.name).replace(/\W/g, '').toLowerCase();
child.value.menuLabel = child.value.menuLabel ? child.value.menuLabel : child.value.name;
child.value.disableGeneration = child.value.disableGeneration ? child.value.disableGeneration : "false";
let entityContent = ' <entity name="' + _.escape(child.value.name) +
'" dataName="' + _.escape(child.value.dataName) +
'" dataCount="' + _.escape(child.value.dataCount) +
'" dataQuery="' + _.escape(child.value.dataQuery) +
'" disableGeneration="' + _.escape(child.value.disableGeneration) +
'" type="' + _.escape(child.value.entityType ? child.value.entityType : 'PRIMARY') +
'" title="' + _.escape(child.value.title) +
'" caption="' + _.escape(child.value.caption) +
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,18 +93,6 @@
</fd-select>
</div>
</fd-form-item>
<fd-form-item class="fd-row fd-margin-top--tiny">
<div class="fd-col fd-col-md--2">
</div>
<div class="fd-col fd-col-md--3">
<fd-checkbox id="generalShouldGenerate" compact="false" ng-required="false"
ng-model="dataParameters.disableGeneration" data-ng-true-value="'true'"
data-ng-false-value="'false'">
</fd-checkbox>
<fd-checkbox-label for="generalShouldGenerate" dg-required="false">Skip generation
</fd-checkbox-label>
</div>
</fd-form-item>
</fd-form-group>
<fd-form-group class="fd-container fd-form-layout-grid-container" style="max-width:1024px;"
ng-if="dialogType === 'property'">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,9 @@ exports.generateGeneric = function (model, parameters, templateSources) {
exports.generateFiles = function (model, parameters, templateSources) {
let generatedFiles = [];

const models = model.entities.filter(e => e.type !== "REPORT" && e.type !== "FILTER" && e.disableGeneration !== "true");
const models = model.entities.filter(e => e.type !== "REPORT" && e.type !== "FILTER");
const apiModels = model.entities.filter(e => e.type !== "PROJECTION");
const daoModels = model.entities.filter(e => e.type !== "PROJECTION");
const feedModels = model.entities.filter(e => e.feedUrl);

const reportModels = model.entities.filter(e => e.type === "REPORT");
Expand Down Expand Up @@ -94,6 +96,12 @@ exports.generateFiles = function (model, parameters, templateSources) {
case "models":
generatedFiles = generatedFiles.concat(generateCollection(location, content, template, models, parameters));
break;
case "apiModels":
generatedFiles = generatedFiles.concat(generateCollection(location, content, template, apiModels, parameters));
break;
case "daoModels":
generatedFiles = generatedFiles.concat(generateCollection(location, content, template, daoModels, parameters));
break;
case "reportModels":
generatedFiles = generatedFiles.concat(generateCollection(location, content, template, reportModels, parameters));
break;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,13 @@ exports.getTemplate = function (parameters) {
action: "generate",
rename: "gen/dao/{{perspectiveName}}/{{name}}Repository.ts",
engine: "velocity",
collection: "models"
collection: "daoModels"
}, {
location: "/template-application-dao/dao/entity.extensionpoint.template",
action: "generate",
rename: "gen/dao/{{perspectiveName}}/{{name}}.extensionpoint",
engine: "velocity",
collection: "daoModels"
}, {
location: "/template-application-dao/dao/reportEntity.ts.template",
action: "generate",
Expand All @@ -40,12 +46,6 @@ exports.getTemplate = function (parameters) {
action: "generate",
rename: "tsconfig.json",
engine: "velocity"
}, {
location: "/template-application-dao/dao/entity.extensionpoint.template",
action: "generate",
rename: "gen/dao/{{perspectiveName}}/{{name}}.extensionpoint",
engine: "velocity",
collection: "models"
}, {
location: "/template-application-dao/dao/utils/EntityUtils.ts.template",
action: "copy",
Expand Down
Loading

0 comments on commit 06ee480

Please sign in to comment.