Search in sources :

Example 21 with Identifier

use of org.wso2.carbon.apimgt.api.model.Identifier in project ballerina by ballerina-lang.

the class BLangPackageBuilder method addVar.

public BLangVariable addVar(DiagnosticPos pos, Set<Whitespace> ws, String identifier, boolean exprAvailable, int annotCount) {
    BLangVariable var = (BLangVariable) this.generateBasicVarNode(pos, ws, identifier, exprAvailable);
    attachAnnotations(var, annotCount);
    var.pos = pos;
    if (this.varListStack.empty()) {
        this.varStack.push(var);
    } else {
        this.varListStack.peek().add(var);
    }
    return var;
}
Also used : BLangVariable(org.wso2.ballerinalang.compiler.tree.BLangVariable)

Example 22 with Identifier

use of org.wso2.carbon.apimgt.api.model.Identifier in project ballerina by ballerina-lang.

the class BLangPackageBuilder method addEndpointDefinition.

public void addEndpointDefinition(DiagnosticPos pos, Set<Whitespace> ws, String identifier, boolean initExprExist) {
    final BLangEndpoint endpointNode = (BLangEndpoint) TreeBuilder.createEndpointNode();
    attachAnnotations(endpointNode);
    endpointNode.pos = pos;
    endpointNode.name = (BLangIdentifier) this.createIdentifier(identifier);
    endpointNode.endpointTypeNode = (BLangUserDefinedType) typeNodeStack.pop();
    if (initExprExist) {
        endpointNode.configurationExpr = (BLangExpression) this.exprNodeStack.pop();
    }
    endpointNode.addWS(ws);
    if (endpointListStack.empty()) {
        // Top level node.
        lastBuiltEndpoint = endpointNode;
        this.compUnit.addTopLevelNode(endpointNode);
    } else {
        endpointListStack.peek().add(endpointNode);
    }
}
Also used : BLangEndpoint(org.wso2.ballerinalang.compiler.tree.BLangEndpoint)

Example 23 with Identifier

use of org.wso2.carbon.apimgt.api.model.Identifier in project ballerina by ballerina-lang.

the class BLangPackageBuilder method endAnnotationDef.

public void endAnnotationDef(Set<Whitespace> ws, String identifier, boolean publicAnnotation, boolean isTypeAttached) {
    BLangAnnotation annotationNode = (BLangAnnotation) this.annotationStack.pop();
    annotationNode.addWS(ws);
    annotationNode.setName(this.createIdentifier(identifier));
    if (publicAnnotation) {
        annotationNode.flagSet.add(Flag.PUBLIC);
    }
    while (!attachmentPointStack.empty()) {
        annotationNode.attachmentPoints.add(attachmentPointStack.pop());
    }
    if (isTypeAttached) {
        annotationNode.typeNode = (BLangType) this.typeNodeStack.pop();
    }
    this.compUnit.addTopLevelNode(annotationNode);
}
Also used : BLangAnnotation(org.wso2.ballerinalang.compiler.tree.BLangAnnotation)

Example 24 with Identifier

use of org.wso2.carbon.apimgt.api.model.Identifier in project ballerina by ballerina-lang.

the class BLangPackageBuilder method generateBasicVarNode.

private VariableNode generateBasicVarNode(DiagnosticPos pos, Set<Whitespace> ws, String identifier, boolean exprAvailable) {
    BLangVariable var = (BLangVariable) TreeBuilder.createVariableNode();
    var.pos = pos;
    IdentifierNode name = this.createIdentifier(identifier);
    var.setName(name);
    var.addWS(ws);
    var.setTypeNode(this.typeNodeStack.pop());
    if (exprAvailable) {
        var.setInitialExpression(this.exprNodeStack.pop());
    }
    return var;
}
Also used : IdentifierNode(org.ballerinalang.model.tree.IdentifierNode) BLangVariable(org.wso2.ballerinalang.compiler.tree.BLangVariable)

Example 25 with Identifier

use of org.wso2.carbon.apimgt.api.model.Identifier in project ballerina by ballerina-lang.

the class BLangPackageBuilder method generateObjectVarNode.

private VariableNode generateObjectVarNode(DiagnosticPos pos, Set<Whitespace> ws, boolean isField, String identifier, boolean exprAvailable) {
    BLangVariable var = (BLangVariable) TreeBuilder.createVariableNode();
    var.pos = pos;
    IdentifierNode name = this.createIdentifier(identifier);
    var.setName(name);
    var.addWS(ws);
    var.isField = isField;
    if (!isField) {
        var.setTypeNode(this.typeNodeStack.pop());
    }
    if (exprAvailable) {
        var.setInitialExpression(this.exprNodeStack.pop());
    }
    return var;
}
Also used : IdentifierNode(org.ballerinalang.model.tree.IdentifierNode) BLangVariable(org.wso2.ballerinalang.compiler.tree.BLangVariable)

Aggregations

APIManagementException (org.wso2.carbon.apimgt.api.APIManagementException)118 APIIdentifier (org.wso2.carbon.apimgt.api.model.APIIdentifier)83 RegistryException (org.wso2.carbon.registry.core.exceptions.RegistryException)66 API (org.wso2.carbon.apimgt.api.model.API)42 Resource (org.wso2.carbon.registry.core.Resource)40 APIProductIdentifier (org.wso2.carbon.apimgt.api.model.APIProductIdentifier)39 Test (org.junit.Test)36 PreparedStatement (java.sql.PreparedStatement)34 SQLException (java.sql.SQLException)34 SubscribedAPI (org.wso2.carbon.apimgt.api.model.SubscribedAPI)34 Connection (java.sql.Connection)33 UserStoreException (org.wso2.carbon.user.core.UserStoreException)31 ResultSet (java.sql.ResultSet)29 ArrayList (java.util.ArrayList)29 APIProvider (org.wso2.carbon.apimgt.api.APIProvider)29 UserRegistry (org.wso2.carbon.registry.core.session.UserRegistry)27 IOException (java.io.IOException)26 PrepareForTest (org.powermock.core.classloader.annotations.PrepareForTest)26 APIProductResource (org.wso2.carbon.apimgt.api.model.APIProductResource)25 HumanTaskException (org.wso2.carbon.humantask.core.engine.HumanTaskException)24