Search in sources :

Example 76 with Link

use of org.wso2.carbon.bpel.ui.bpel2svg.Link in project carbon-business-process by wso2.

the class ProcessInstanceService method getIdentityLinK.

@GET
@Path("/{processInstanceId}/identitylinks/users/{identityId}/{type}")
@Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
public Response getIdentityLinK(@PathParam("processInstanceId") String processInstanceId, @PathParam("identityId") String identityId, @PathParam("type") String type) {
    ProcessInstance processInstance = getProcessInstanceFromRequest(processInstanceId);
    validateIdentityLinkArguments(identityId, type);
    IdentityLink link = getIdentityLink(identityId, type, processInstance.getId());
    return Response.ok().entity(new RestResponseFactory().createRestIdentityLink(link, uriInfo.getBaseUri().toString())).build();
}
Also used : RestResponseFactory(org.wso2.carbon.bpmn.rest.common.RestResponseFactory) ProcessInstance(org.activiti.engine.runtime.ProcessInstance) RestIdentityLink(org.wso2.carbon.bpmn.rest.model.common.RestIdentityLink) IdentityLink(org.activiti.engine.task.IdentityLink) Path(javax.ws.rs.Path) Produces(javax.ws.rs.Produces) GET(javax.ws.rs.GET)

Example 77 with Link

use of org.wso2.carbon.bpel.ui.bpel2svg.Link in project carbon-business-process by wso2.

the class WorkflowTaskService method getIdentityLinksForFamily.

@GET
@Path("/{taskId}/identitylinks/{family}")
@Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
public Response getIdentityLinksForFamily(@PathParam("taskId") String taskId, @PathParam("family") String family) {
    Task task = getTaskFromRequest(taskId);
    TaskService taskService = BPMNOSGIService.getTaskService();
    if (family == null || (!RestUrls.SEGMENT_IDENTITYLINKS_FAMILY_GROUPS.equals(family) && !RestUrls.SEGMENT_IDENTITYLINKS_FAMILY_USERS.equals(family))) {
        throw new ActivitiIllegalArgumentException("Identity link family should be 'users' or 'groups'.");
    }
    boolean isUser = family.equals(RestUrls.SEGMENT_IDENTITYLINKS_FAMILY_USERS);
    List<RestIdentityLink> results = new ArrayList<RestIdentityLink>();
    List<IdentityLink> allLinks = taskService.getIdentityLinksForTask(task.getId());
    for (IdentityLink link : allLinks) {
        boolean match = false;
        if (isUser) {
            match = link.getUserId() != null;
        } else {
            match = link.getGroupId() != null;
        }
        if (match) {
            results.add(new RestResponseFactory().createRestIdentityLink(link, uriInfo.getBaseUri().toString()));
        }
    }
    RestIdentityLinkCollection restIdentityLinkCollection = new RestIdentityLinkCollection();
    restIdentityLinkCollection.setRestIdentityLinks(results);
    return Response.ok().entity(restIdentityLinkCollection).build();
}
Also used : RestIdentityLink(org.wso2.carbon.bpmn.rest.model.common.RestIdentityLink) RestResponseFactory(org.wso2.carbon.bpmn.rest.common.RestResponseFactory) BaseTaskService(org.wso2.carbon.bpmn.rest.service.base.BaseTaskService) RestIdentityLink(org.wso2.carbon.bpmn.rest.model.common.RestIdentityLink)

Example 78 with Link

use of org.wso2.carbon.bpel.ui.bpel2svg.Link in project carbon-business-process by wso2.

the class AttachmentMgtDAOBasicOperationsTest method createAttachment.

/**
 * Creates an attachment stub bean which is consumable by the Back-End server interface
 * {@link org.wso2.carbon.attachment.mgt.skeleton.AttachmentMgtServiceSkeletonInterface}
 *
 * @return an attachment stub bean which is consumable by the Back-End server interface
 */
private TAttachment createAttachment() {
    dummyAttachment = new TAttachment();
    dummyAttachment.setName("DummyName");
    dummyAttachment.setContentType("DummyContentType");
    dummyAttachment.setCreatedBy("DummyUser");
    DataHandler handler = new DataHandler(new FileDataSource(new File("src" + File.separator + "test" + File.separator + "resources" + File.separator + "dbConfig.xml")));
    dummyAttachment.setContent(handler);
    return dummyAttachment;
}
Also used : TAttachment(org.wso2.carbon.attachment.mgt.skeleton.types.TAttachment) FileDataSource(javax.activation.FileDataSource) DataHandler(javax.activation.DataHandler) File(java.io.File)

Example 79 with Link

use of org.wso2.carbon.bpel.ui.bpel2svg.Link in project ballerina by ballerina-lang.

the class CommandUtil method getCommandsByDiagnostic.

/**
 * Get the command instances for a given diagnostic.
 * @param diagnostic        Diagnostic to get the command against
 * @param params            Code Action parameters
 * @param lsPackageCache    Lang Server Package cache
 * @return  {@link List}    List of commands related to the given diagnostic
 */
public static List<Command> getCommandsByDiagnostic(Diagnostic diagnostic, CodeActionParams params, LSPackageCache lsPackageCache) {
    String diagnosticMessage = diagnostic.getMessage();
    List<Command> commands = new ArrayList<>();
    if (isUndefinedPackage(diagnosticMessage)) {
        String packageAlias = diagnosticMessage.substring(diagnosticMessage.indexOf("'") + 1, diagnosticMessage.lastIndexOf("'"));
        LSDocument sourceDocument = new LSDocument(params.getTextDocument().getUri());
        Path openedPath = CommonUtil.getPath(sourceDocument);
        String sourceRoot = TextDocumentServiceUtil.getSourceRoot(openedPath);
        sourceDocument.setSourceRoot(sourceRoot);
        lsPackageCache.getPackageMap().entrySet().stream().filter(pkgEntry -> {
            String fullPkgName = pkgEntry.getValue().packageID.orgName.getValue() + "/" + pkgEntry.getValue().packageID.getName().getValue();
            return fullPkgName.endsWith("." + packageAlias) || fullPkgName.endsWith("/" + packageAlias);
        }).forEach(pkgEntry -> {
            PackageID packageID = pkgEntry.getValue().packageID;
            String commandTitle = CommandConstants.IMPORT_PKG_TITLE + " " + packageID.getName().toString();
            String fullPkgName = packageID.getOrgName() + "/" + packageID.getName().getValue();
            CommandArgument pkgArgument = new CommandArgument(CommandConstants.ARG_KEY_PKG_NAME, fullPkgName);
            CommandArgument docUriArgument = new CommandArgument(CommandConstants.ARG_KEY_DOC_URI, params.getTextDocument().getUri());
            commands.add(new Command(commandTitle, CommandConstants.CMD_IMPORT_PACKAGE, new ArrayList<>(Arrays.asList(pkgArgument, docUriArgument))));
        });
    }
    return commands;
}
Also used : Path(java.nio.file.Path) CommonUtil(org.ballerinalang.langserver.common.utils.CommonUtil) Arrays(java.util.Arrays) BLangVariable(org.wso2.ballerinalang.compiler.tree.BLangVariable) CommandConstants(org.ballerinalang.langserver.common.constants.CommandConstants) Diagnostic(org.eclipse.lsp4j.Diagnostic) ArrayList(java.util.ArrayList) CodeActionParams(org.eclipse.lsp4j.CodeActionParams) LSDocument(org.ballerinalang.langserver.common.LSDocument) BLangResource(org.wso2.ballerinalang.compiler.tree.BLangResource) DocTag(org.ballerinalang.model.elements.DocTag) Locale(java.util.Locale) TopLevelNode(org.ballerinalang.model.tree.TopLevelNode) DiagnosticPos(org.wso2.ballerinalang.compiler.util.diagnotic.DiagnosticPos) Path(java.nio.file.Path) BLangPackage(org.wso2.ballerinalang.compiler.tree.BLangPackage) BLangObject(org.wso2.ballerinalang.compiler.tree.BLangObject) PackageID(org.ballerinalang.model.elements.PackageID) FunctionNode(org.ballerinalang.model.tree.FunctionNode) LSPackageCache(org.ballerinalang.langserver.LSPackageCache) BLangFunction(org.wso2.ballerinalang.compiler.tree.BLangFunction) BLangAnnotationAttachment(org.wso2.ballerinalang.compiler.tree.BLangAnnotationAttachment) BLangTransformer(org.wso2.ballerinalang.compiler.tree.BLangTransformer) TextDocumentServiceUtil(org.ballerinalang.langserver.TextDocumentServiceUtil) BLangService(org.wso2.ballerinalang.compiler.tree.BLangService) List(java.util.List) BLangEnum(org.wso2.ballerinalang.compiler.tree.BLangEnum) Command(org.eclipse.lsp4j.Command) BEndpointVarSymbol(org.wso2.ballerinalang.compiler.semantics.model.symbols.BEndpointVarSymbol) BLangStruct(org.wso2.ballerinalang.compiler.tree.BLangStruct) Collections(java.util.Collections) Command(org.eclipse.lsp4j.Command) LSDocument(org.ballerinalang.langserver.common.LSDocument) ArrayList(java.util.ArrayList) PackageID(org.ballerinalang.model.elements.PackageID)

Example 80 with Link

use of org.wso2.carbon.bpel.ui.bpel2svg.Link in project ballerina by ballerina-lang.

the class CommandUtil method getStructDocumentationByPosition.

/**
 * Get the Documentation attachment for the struct definition.
 * @param bLangPackage      BLangPackage built
 * @param line              Start line of the struct in the source
 * @return {@link String}   Documentation attachment for the struct
 */
static DocAttachmentInfo getStructDocumentationByPosition(BLangPackage bLangPackage, int line) {
    for (TopLevelNode topLevelNode : bLangPackage.topLevelNodes) {
        if (topLevelNode instanceof BLangStruct) {
            BLangStruct structNode = (BLangStruct) topLevelNode;
            DiagnosticPos structPos = CommonUtil.toZeroBasedPosition(structNode.getPosition());
            int structStart = structPos.getStartLine();
            if (structStart == line) {
                return getStructNodeDocumentation(structNode, line);
            }
        }
    }
    return null;
}
Also used : DiagnosticPos(org.wso2.ballerinalang.compiler.util.diagnotic.DiagnosticPos) BLangStruct(org.wso2.ballerinalang.compiler.tree.BLangStruct) TopLevelNode(org.ballerinalang.model.tree.TopLevelNode)

Aggregations

PreparedStatement (java.sql.PreparedStatement)47 ArrayList (java.util.ArrayList)47 Connection (java.sql.Connection)43 SQLException (java.sql.SQLException)41 ResultSet (java.sql.ResultSet)37 APIMgtDAOException (org.wso2.carbon.apimgt.core.exception.APIMgtDAOException)26 BLangPackage (org.wso2.ballerinalang.compiler.tree.BLangPackage)18 HashSet (java.util.HashSet)16 APIManagementException (org.wso2.carbon.apimgt.core.exception.APIManagementException)15 IOException (java.io.IOException)14 HashMap (java.util.HashMap)14 List (java.util.List)13 Map (java.util.Map)13 Expression (org.wso2.siddhi.query.api.expression.Expression)13 CompilerContext (org.wso2.ballerinalang.compiler.util.CompilerContext)12 TimeConstant (org.wso2.siddhi.query.api.expression.constant.TimeConstant)12 DiagnosticPos (org.wso2.ballerinalang.compiler.util.diagnotic.DiagnosticPos)11 API (org.wso2.carbon.apimgt.core.models.API)11 UserStoreException (org.wso2.carbon.user.api.UserStoreException)10 SiddhiQLParser (org.wso2.siddhi.query.compiler.SiddhiQLParser)10