当前位置: 首页>>代码示例>>Java>>正文


Java Workspace类代码示例

本文整理汇总了Java中com.structurizr.Workspace的典型用法代码示例。如果您正苦于以下问题:Java Workspace类的具体用法?Java Workspace怎么用?Java Workspace使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


Workspace类属于com.structurizr包,在下文中一共展示了Workspace类的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: putWorkspace

import com.structurizr.Workspace; //导入依赖的package包/类
@Override
public void putWorkspace(long workspaceId, String json) throws WorkspaceComponentException {
    try {
        File path = getPathToWorkspace(workspaceId);
        File file = new File(path, "workspace.json");

        Files.write(file.toPath(), json.getBytes("UTF-8"));

        try {
            Workspace workspace = WorkspaceUtils.loadWorkspaceFromJson(file);
            writeWorkspaceSummary(workspaceId, workspace.getName(), workspace.getDescription(), workspace.getThumbnail());
        } catch (Exception e) {
            e.printStackTrace();
        }
    } catch (IOException ioe) {
        throw new WorkspaceComponentException("Could not put workspace " + workspaceId, ioe);
    }
}
 
开发者ID:structurizr,项目名称:api,代码行数:19,代码来源:FileSystemWorkspaceComponent.java

示例2: test_putAndGetWorkspace

import com.structurizr.Workspace; //导入依赖的package包/类
@Test
public void test_putAndGetWorkspace() throws Exception {
    Workspace workspace = new Workspace("Name", "Description");
    workspace.setThumbnail("Thumbnail");

    JsonWriter jsonWriter = new JsonWriter(false);
    StringWriter stringWriter = new StringWriter();
    jsonWriter.write(workspace, stringWriter);

    String content = stringWriter.toString();
    workspaceComponent.putWorkspace(1, content);

    Properties properties = new Properties();
    File propertiesFile = new File(new File(dataDirectory, "1"), "workspace.properties");
    properties.load(new FileReader(propertiesFile));
    assertEquals("Name", properties.getProperty("name"));
    assertEquals("Description", properties.getProperty("description"));
    assertEquals("Thumbnail", properties.getProperty("thumbnail"));

    assertEquals(content, workspaceComponent.getWorkspace(1));
}
 
开发者ID:structurizr,项目名称:api,代码行数:22,代码来源:FileSystemWorkspaceComponentTests.java

示例3: StyleProvider

import com.structurizr.Workspace; //导入依赖的package包/类
@Autowired
public StyleProvider(Workspace workspace) {
    Styles styles = workspace.getViews().getConfiguration().getStyles();
    styles.addElementStyle(Tags.ELEMENT).width(500).height(350).color("#ffffff").fontSize(30).shape(Shape.RoundedBox);
    styles.addElementStyle(Tags.SOFTWARE_SYSTEM).background("#2A4E6E");
    styles.addElementStyle(Tags.CONTAINER).background("#007F0E");
    styles.addElementStyle(Tags.COMPONENT).background("#3059BA");
    styles.addElementStyle(Tags.PERSON).width(475).background("#728da5").shape(Shape.Person);
    styles.addRelationshipStyle(Tags.RELATIONSHIP).dashed(true).thickness(5).fontSize(40).width(400);
    styles.addRelationshipStyle(Tags.SYNCHRONOUS).dashed(false);
    styles.addRelationshipStyle(Tags.ASYNCHRONOUS).dashed(true);
}
 
开发者ID:Catalysts,项目名称:cat-boot,代码行数:13,代码来源:StyleProvider.java

示例4: main

import com.structurizr.Workspace; //导入依赖的package包/类
public static void main(String[] args) throws Exception {
    // a Structurizr workspace is the wrapper for a software architecture model, views and documentation
    Workspace workspace = new Workspace("Getting Started", "This is a model of my software system.");
    Model model = workspace.getModel();

    // add some elements to your software architecture model
    Person user = model.addPerson("User", "A user of my software system.");
    SoftwareSystem softwareSystem = model.addSoftwareSystem("Software System", "My software system.");
    user.uses(softwareSystem, "Uses");

    // define some views (the diagrams you would like to see)
    ViewSet views = workspace.getViews();
    SystemContextView contextView = views.createSystemContextView(softwareSystem, "SystemContext", "An example of a System Context diagram.");
    contextView.setPaperSize(PaperSize.A5_Landscape);
    contextView.addAllSoftwareSystems();
    contextView.addAllPeople();

    // add some documentation
    StructurizrDocumentationTemplate template = new StructurizrDocumentationTemplate(workspace);
    template.addContextSection(softwareSystem, Format.Markdown,
            "Here is some context about the software system...\n" +
                    "\n" +
                    "![](embed:SystemContext)");

    // add some styling
    Styles styles = views.getConfiguration().getStyles();
    styles.addElementStyle(Tags.SOFTWARE_SYSTEM).background("#1168bd").color("#ffffff");
    styles.addElementStyle(Tags.PERSON).background("#08427b").color("#ffffff").shape(Shape.Person);

    uploadWorkspaceToStructurizr(workspace);
}
 
开发者ID:structurizr,项目名称:java-quickstart,代码行数:32,代码来源:Structurizr.java

示例5: printPlantUml

import com.structurizr.Workspace; //导入依赖的package包/类
/**
 * Prints the plant uml.
 *
 * @param workspace
 *            the workspace
 * @throws WorkspaceWriterException
 *             the workspace writer exception
 * @throws IOException
 *             Signals that an I/O exception has occurred.
 * @throws InterruptedException
 *             the interrupted exception
 */
private static void printPlantUml(final Workspace workspace) throws WorkspaceWriterException, IOException, InterruptedException {
	StringWriter stringWriter = new StringWriter();
	PlantUMLWriter plantUMLWriter = new PlantUMLWriter();
	plantUMLWriter.write(workspace, stringWriter);
	String allPlantUmlsString = stringWriter.toString();
	
	String systemUml2 = allPlantUmlsString.substring(allPlantUmlsString.lastIndexOf("@startuml"), allPlantUmlsString.lastIndexOf("@enduml") + "@enduml".length());
	allPlantUmlsString = allPlantUmlsString.replace(systemUml2,"");
	writePlantUml("Citizen-Intelligence-Agency-System-System-Deployment",systemUml2);
	
	String componentUml = allPlantUmlsString.substring(allPlantUmlsString.lastIndexOf("@startuml"), allPlantUmlsString.lastIndexOf("@enduml") + "@enduml".length());
	allPlantUmlsString = allPlantUmlsString.replace(componentUml,"");
	writePlantUml("Citizen-Intelligence-Agency-System-Web-Application-Components",componentUml);
	
	String containersUml = allPlantUmlsString.substring(allPlantUmlsString.lastIndexOf("@startuml"), allPlantUmlsString.lastIndexOf("@enduml") + "@enduml".length());
	allPlantUmlsString = allPlantUmlsString.replace(containersUml,"");
	writePlantUml("Citizen-Intelligence-Agency-System-Containers",containersUml);
	
	String systemUml = allPlantUmlsString.substring(allPlantUmlsString.lastIndexOf("@startuml"), allPlantUmlsString.lastIndexOf("@enduml") + "@enduml".length());
	allPlantUmlsString = allPlantUmlsString.replace(systemUml,"");
	writePlantUml("Citizen-Intelligence-Agency-System-System-Context",systemUml);

	
	String enterpriseUml = allPlantUmlsString.substring(allPlantUmlsString.lastIndexOf("@startuml"), allPlantUmlsString.lastIndexOf("@enduml") + "@enduml".length());
	allPlantUmlsString = allPlantUmlsString.replace(enterpriseUml,"");
	writePlantUml("Enterprise-Context-for-Hack23",enterpriseUml);
}
 
开发者ID:Hack23,项目名称:cia,代码行数:40,代码来源:AppPublicSystemDocumentation.java

示例6: StructurizrService

import com.structurizr.Workspace; //导入依赖的package包/类
@Autowired
public StructurizrService(StructurizrClient structurizrClient, Workspace workspace, StructurizrConfigurationProperties config) {
    this.structurizrClient = structurizrClient;
    this.workspace = workspace;
    this.config = config;
}
 
开发者ID:Catalysts,项目名称:cat-boot,代码行数:7,代码来源:StructurizrService.java

示例7: model

import com.structurizr.Workspace; //导入依赖的package包/类
@Bean
Model model(Workspace workspace) {
    return workspace.getModel();
}
 
开发者ID:Catalysts,项目名称:cat-boot,代码行数:5,代码来源:StructurizrAutoConfiguration.java

示例8: workspace

import com.structurizr.Workspace; //导入依赖的package包/类
@Bean
Workspace workspace(StructurizrConfigurationProperties config) {
    return new Workspace(config.getName(), config.getDescription());
}
 
开发者ID:Catalysts,项目名称:cat-boot,代码行数:5,代码来源:StructurizrAutoConfiguration.java

示例9: uploadWorkspaceToStructurizr

import com.structurizr.Workspace; //导入依赖的package包/类
private static void uploadWorkspaceToStructurizr(Workspace workspace) throws Exception {
    StructurizrClient structurizrClient = new StructurizrClient(API_KEY, API_SECRET);
    structurizrClient.putWorkspace(WORKSPACE_ID, workspace);
}
 
开发者ID:structurizr,项目名称:java-quickstart,代码行数:5,代码来源:Structurizr.java


注:本文中的com.structurizr.Workspace类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。