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();
}
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();
}
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;
}
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;
}
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;
}
Aggregations