public static KeywordsType keywords(List<String> keywords) { if (keywords == null || keywords.size() == 0) { return null; } KeywordsType kw = f.createKeywordsType(); for (String keyword : keywords) { kw.getKeyword().add(languageString(keyword)); } return kw; }
public static ExceptionReportType exceptionReport( ServiceException exception, boolean verboseExceptions, String version) { ExceptionType e = f.createExceptionType(); if (exception.getCode() != null) { e.setExceptionCode(exception.getCode()); } else { // set a default e.setExceptionCode("NoApplicableCode"); } e.setLocator(exception.getLocator()); // add the message StringBuffer sb = new StringBuffer(); OwsUtils.dumpExceptionMessages(exception, sb, true); e.getExceptionText().add(sb.toString()); e.getExceptionText().addAll(exception.getExceptionText()); if (verboseExceptions) { // add the entire stack trace // exception. e.getExceptionText().add("Details:"); ByteArrayOutputStream trace = new ByteArrayOutputStream(); exception.printStackTrace(new PrintStream(trace)); e.getExceptionText().add(new String(trace.toByteArray())); } ExceptionReportType report = f.createExceptionReportType(); version = version != null ? version : "1.1.0"; report.setVersion(version); report.getException().add(e); return report; }
public void testEncode() throws Exception { Ows10Factory f = Ows10Factory.eINSTANCE; GetCapabilitiesType caps = f.createGetCapabilitiesType(); AcceptVersionsType versions = f.createAcceptVersionsType(); caps.setAcceptVersions(versions); versions.getVersion().add("1.0.0"); versions.getVersion().add("1.1.0"); ByteArrayOutputStream output = new ByteArrayOutputStream(); response.write(caps, output, null); Document d = DocumentBuilderFactory.newInstance().newDocumentBuilder().newDocument(); TransformerFactory.newInstance() .newTransformer() .transform( new StreamSource(new ByteArrayInputStream(output.toByteArray())), new DOMResult(d)); assertEquals("ows:GetCapabilities", d.getDocumentElement().getNodeName()); assertEquals(2, d.getElementsByTagName("ows:Version").getLength()); } }
e.getExceptionText().add(sb.toString()); e.getExceptionText().addAll(exception.getExceptionText()); e.getExceptionText().add("Details:"); ByteArrayOutputStream trace = new ByteArrayOutputStream(); exception.printStackTrace(new PrintStream(trace)); e.getExceptionText().add(new String(trace.toByteArray())); report.getException().add(e);
public static DCPType dcp(String service, EObject request) { String baseUrl = (String) EMFUtils.get(request, "baseUrl"); if (baseUrl == null) { throw new IllegalArgumentException( "Request object" + request + " has no 'baseUrl' property."); } String href = ResponseUtils.buildURL( baseUrl, service, new HashMap<String, String>(), URLType.SERVICE); DCPType dcp = f.createDCPType(); dcp.setHTTP(f.createHTTPType()); RequestMethodType get = f.createRequestMethodType(); get.setHref(href); dcp.getHTTP().getGet().add(get); RequestMethodType post = f.createRequestMethodType(); post.setHref(href); dcp.getHTTP().getPost().add(post); return dcp; } }
root.setName("import"); documentRoot.setImport(root); inResource.getContents().add(documentRoot);
root.setScriptFormat("format"); documentRoot.setOnEntryScript(root); inResource.getContents().add(documentRoot);
root.setType("type"); documentRoot.setGlobal(root); inResource.getContents().add(documentRoot);
root.setScriptFormat("format"); documentRoot.setOnExitScript(root); inResource.getContents().add(documentRoot);
inResource.getContents().add(documentRoot);
@SuppressWarnings("unchecked") public void testColorAttributes() throws Exception { XMLResource inResource = (XMLResource) resourceSet.createResource(URI.createURI("inputStream://dummyUriWithValidSuffix.xml")); inResource.getDefaultLoadOptions().put(XMLResource.OPTION_ENCODING, "UTF-8"); inResource.setEncoding("UTF-8"); DocumentRoot documentRoot = ColorFactory.eINSTANCE.createDocumentRoot(); documentRoot.setBackgroundColor("#FFFFFF"); documentRoot.setBorderColor("#000000"); documentRoot.setColor("#AAAAAA"); inResource.getContents().add(documentRoot); DocumentRoot outRoot = (DocumentRoot) inResource.getContents().get(0); assertNotNull(outRoot); assertEquals(outRoot.getBackgroundColor(), "#FFFFFF"); assertEquals(outRoot.getBorderColor(), "#000000"); assertEquals(outRoot.getColor(), "#AAAAAA"); } }
@SuppressWarnings("unchecked") private void addOperation(OperationsMetadataType om, OperationType operation) { if (operation != null) { om.getOperation().add(operation); } } }
uniformDistrobutionType.setMin(180.0); uniformDistrobutionType.setMax(600.0); processingTimeParameter.getParameterValue().add(uniformDistrobutionType); elementTimeParams.setProcessingTime(processingTimeParameter); elementParams.setTimeParameters(elementTimeParams); defaultScenario.getElementParameters().add(elementParams); bpsimData.getScenario().add(defaultScenario); inResource.getContents().add(documentRoot); StringWriter stringWriter = new StringWriter(); inResource.save(stringWriter, null);
public EClass createEClass(EPackage ePackage, String name, EClass... superClasses) { EClass eClass = EcoreFactory.eINSTANCE.createEClass(); eClass.setName(name); changes.add(new NewClassChange(eClass)); for (EClass superClass : superClasses) { eClass.getESuperTypes().add(superClass); } ePackage.getEClassifiers().add(eClass); return eClass; }
public Object parse(ElementInstance instance, Node node, Object value) { InsertResultsType resultType = wfsfactory.createInsertResultsType(); for (Object featureid : node.getChildValues("FeatureId")) { if (!"none".equals(featureid.toString())) { InsertedFeatureType feature = wfsfactory.createInsertedFeatureType(); feature.getFeatureId().add(featureid); resultType.getFeature().add(feature); } } return resultType; }
betaDistributionTypeEClass.getESuperTypes().add(this.getDistributionParameter()); binomialDistributionTypeEClass.getESuperTypes().add(this.getDistributionParameter()); booleanParameterTypeEClass.getESuperTypes().add(this.getConstantParameter()); constantParameterEClass.getESuperTypes().add(this.getParameterValue()); dateTimeParameterTypeEClass.getESuperTypes().add(this.getConstantParameter()); distributionParameterEClass.getESuperTypes().add(this.getParameterValue()); durationParameterTypeEClass.getESuperTypes().add(this.getConstantParameter()); elementParametersTypeEClass.getESuperTypes().add(this.getElementParameters()); enumParameterTypeEClass.getESuperTypes().add(this.getParameterValue()); erlangDistributionTypeEClass.getESuperTypes().add(this.getDistributionParameter()); expressionParameterTypeEClass.getESuperTypes().add(this.getParameterValue()); floatingParameterTypeEClass.getESuperTypes().add(this.getConstantParameter()); gammaDistributionTypeEClass.getESuperTypes().add(this.getDistributionParameter()); logNormalDistributionTypeEClass.getESuperTypes().add(this.getDistributionParameter()); negativeExponentialDistributionTypeEClass.getESuperTypes().add(this.getDistributionParameter()); normalDistributionTypeEClass.getESuperTypes().add(this.getDistributionParameter()); numericParameterTypeEClass.getESuperTypes().add(this.getConstantParameter()); poissonDistributionTypeEClass.getESuperTypes().add(this.getDistributionParameter()); propertyTypeEClass.getESuperTypes().add(this.getParameter()); scenarioParametersTypeEClass.getESuperTypes().add(this.getScenarioParameters()); stringParameterTypeEClass.getESuperTypes().add(this.getConstantParameter()); triangularDistributionTypeEClass.getESuperTypes().add(this.getDistributionParameter()); truncatedNormalDistributionTypeEClass.getESuperTypes().add(this.getDistributionParameter()); uniformDistributionTypeEClass.getESuperTypes().add(this.getDistributionParameter()); userDistributionTypeEClass.getESuperTypes().add(this.getDistributionParameter()); weibullDistributionTypeEClass.getESuperTypes().add(this.getDistributionParameter());
@SuppressWarnings("unchecked") private void addDCPTypes(Node node, OperationType operationType) { List<Node> dcpNodes = node.getChildren(DCPType.class); for (Node dcpNode : dcpNodes) { DCPType dcp = (DCPType) dcpNode.getValue(); operationType.getDCP().add(dcp); } }
@Override public Void execute() throws UserException, BimserverLockConflictException, BimserverDatabaseException { Project project = getDatabaseSession().get(StorePackage.eINSTANCE.getProject(), poid, OldQuery.getDefault()); project.getModelCheckers().add(modelChecker); getDatabaseSession().store(modelChecker); getDatabaseSession().store(project); return null; } }
@Override public Long execute() throws UserException, BimserverLockConflictException, BimserverDatabaseException { User user = getDatabaseSession().get(StorePackage.eINSTANCE.getUser(), authorization.getUoid(), OldQuery.getDefault()); user.getUserSettings().getRenderEngines().add(getIdEObject()); getDatabaseSession().store(user.getUserSettings()); return super.execute(); } }
@Override public Long execute() throws UserException, BimserverLockConflictException, BimserverDatabaseException { User user = getDatabaseSession().get(StorePackage.eINSTANCE.getUser(), authorization.getUoid(), OldQuery.getDefault()); user.getUserSettings().getModelCompares().add(getIdEObject()); getDatabaseSession().store(user.getUserSettings()); return super.execute(); } }