Search in sources :

Example 6 with Member

use of org.geotoolkit.sml.xml.v100.Member in project LectureContents by KHWeb19.

the class Second29thMemberRestController method viewInfo.

@GetMapping("/view-info")
public Member viewInfo() {
    log.info("viewInfo()");
    Member member = new Member();
    log.info("member: " + member);
    return member;
}
Also used : Member(com.example.demo.entity.order29.Member) GetMapping(org.springframework.web.bind.annotation.GetMapping)

Example 7 with Member

use of org.geotoolkit.sml.xml.v100.Member in project LectureContents by KHWeb19.

the class Second29thMemberRestController method viewMemberMapInfo.

@GetMapping("/view-map")
public Map<String, Member> viewMemberMapInfo() {
    log.info("viewMemberMapInfo()");
    Map<String, Member> map = new HashMap<>();
    for (int i = 0; i < 3; i++) {
        Member member = new Member();
        map.put("key" + i, member);
    }
    return map;
}
Also used : HashMap(java.util.HashMap) Member(com.example.demo.entity.order29.Member) GetMapping(org.springframework.web.bind.annotation.GetMapping)

Example 8 with Member

use of org.geotoolkit.sml.xml.v100.Member in project LectureContents by KHWeb19.

the class QnaController method doubleMapTest.

@GetMapping("doubleMapTest")
public Map<String, Member> doubleMapTest() {
    log.info("doubleMapTest()");
    Map<String, Member> map = new HashMap<>();
    for (int i = 0; i < 3; i++) {
        Member member = new Member();
        map.put("key" + i, member);
    }
    for (Map.Entry<String, Member> each : map.entrySet()) {
        String key = each.getKey();
        Member value = each.getValue();
        log.info("key = " + key + ", value = " + value);
    }
    return map;
}
Also used : HashMap(java.util.HashMap) Member(com.example.demo.entity.order29.Member) Map(java.util.Map) HashMap(java.util.HashMap) GetMapping(org.springframework.web.bind.annotation.GetMapping)

Example 9 with Member

use of org.geotoolkit.sml.xml.v100.Member in project study-effective-java by doyoung0205.

the class Item17Test method vafiableObject.

@Test
@DisplayName("불변 클래스에서 가변 객체를 참조하면 안되는 이유")
void vafiableObject() {
    // given
    Address address = new Address("지번주소1", "도로명주소1", "우편번호1");
    // when
    Member student = new Member("학생1", address);
    address.setJibun("변경");
    // then
    assertThat(student.getAddress().getJibun()).isEqualTo("변경");
}
Also used : Address(study.heejin.chapter4.item17.Address) Member(study.heejin.chapter4.item17.Member) Test(org.junit.jupiter.api.Test) DisplayName(org.junit.jupiter.api.DisplayName)

Example 10 with Member

use of org.geotoolkit.sml.xml.v100.Member in project geotoolkit by Geomatys.

the class SmlXMLBindingTest method ComponentUnmarshallMarshalingTest.

/**
 * Test simple Record Marshalling.
 *
 * @throws java.lang.Exception
 */
@Test
public void ComponentUnmarshallMarshalingTest() throws Exception {
    Unmarshaller unmarshaller = SensorMLMarshallerPool.getInstance().acquireUnmarshaller();
    InputStream is = SmlXMLBindingTest.class.getResourceAsStream("/org/geotoolkit/sml/component.xml");
    Object unmarshalled = unmarshaller.unmarshal(is);
    if (unmarshalled instanceof JAXBElement) {
        unmarshalled = ((JAXBElement) unmarshalled).getValue();
    }
    assertTrue(unmarshalled instanceof SensorML);
    SensorML result = (SensorML) unmarshalled;
    Member member = new Member();
    member.setRole("urn:x-ogx:def:sensor:OGC:detector");
    ComponentType component = new ComponentType();
    List<JAXBElement<String>> kw = new ArrayList<JAXBElement<String>>();
    kw.add(sml100Factory.createKeywordsKeywordListKeyword("piezometer"));
    kw.add(sml100Factory.createKeywordsKeywordListKeyword("geosciences"));
    kw.add(sml100Factory.createKeywordsKeywordListKeyword("point d'eau"));
    Keywords keywords = new Keywords(new KeywordList(URI.create("urn:x-brgm:def:gcmd:keywords"), kw));
    component.setKeywords(keywords);
    Classifier cl1 = new Classifier("intendedApplication", new Term("eaux souterraines", URI.create("urn:x-ogc:def:classifier:OGC:application")));
    CodeSpacePropertyType cs = new CodeSpacePropertyType("urn:x-brgm:def:GeoPoint:bss");
    Classifier cl2 = new Classifier("sensorType", new Term(cs, "Profondeur", URI.create("urn:sensor:classifier:sensorType")));
    List<Classifier> cls = new ArrayList<Classifier>();
    cls.add(cl1);
    cls.add(cl2);
    ClassifierList claList = new ClassifierList(null, cls);
    Classification classification = new Classification(claList);
    component.setClassification(classification);
    List<Identifier> identifiers = new ArrayList<Identifier>();
    cs = new CodeSpacePropertyType("urn:x-brgm:def:sensorSystem:hydras");
    Identifier id1 = new Identifier("supervisorCode", new Term(cs, "00ARGLELES_2000", URI.create("urn:x-ogc:def:identifier:OGC:modelNumber")));
    Identifier id2 = new Identifier("longName", new Term("Madofil II", URI.create("urn:x-ogc:def:identifier:OGC:longname")));
    identifiers.add(id1);
    identifiers.add(id2);
    IdentifierList identifierList = new IdentifierList(null, identifiers);
    Identification identification = new Identification(identifierList);
    component.setIdentification(identification);
    TimePeriodType period = new TimePeriodType(new TimePositionType("2004-06-01"));
    ValidTime vTime = new ValidTime(period);
    component.setValidTime(vTime);
    Capabilities capabilities = new Capabilities();
    TimeRange timeRange = new TimeRange(Arrays.asList("1987-04-23", "now"));
    DataComponentPropertyType field = new DataComponentPropertyType("periodOfData", "urn:x-brgm:def:property:periodOfData", timeRange);
    DataRecordType record = new DataRecordType("urn:x-brgm:def:property:periodOfData", Arrays.asList(field));
    JAXBElement<? extends AbstractDataRecordType> jbRecord = swe100Factory.createDataRecord(record);
    capabilities.setAbstractDataRecord(jbRecord);
    component.setCapabilities(capabilities);
    Contact contact = new Contact("urn:x-ogc:def:role:manufacturer", new ResponsibleParty("IRIS"));
    component.setContact(contact);
    Position position = new Position("conductivitePosition", "piezometer#piezoPosition");
    component.setPosition(position);
    IoComponentPropertyType io = new IoComponentPropertyType("level", new ObservableProperty("urn:x-ogc:def:phenomenon:OGC:level"));
    InputList inputList = new InputList(Arrays.asList(io));
    Inputs inputs = new Inputs(inputList);
    component.setInputs(inputs);
    IoComponentPropertyType io2 = new IoComponentPropertyType("depth", new ObservableProperty("urn:x-ogc:def:phenomenon:OGC:depth"));
    OutputList outputList = new OutputList(Arrays.asList(io2));
    Outputs outputs = new Outputs(outputList);
    component.setOutputs(outputs);
    List<DataComponentPropertyType> params = new ArrayList<DataComponentPropertyType>();
    UomPropertyType uom = new UomPropertyType(null, "urn:ogc:unit:minuts");
    QuantityType quantity1 = new QuantityType("urn:x-ogc:def:property:frequency", uom, 60.0);
    DataComponentPropertyType p1 = new DataComponentPropertyType("frequency", "urn:x-ogc:def:property:frequency", quantity1);
    params.add(p1);
    UomPropertyType uom2 = new UomPropertyType("m", null);
    QuantityType quantity2 = new QuantityType("urn:x-ogc:def:property:precision", uom2, 0.05);
    DataComponentPropertyType p2 = new DataComponentPropertyType("precision", "urn:x-ogc:def:property:precision", quantity2);
    params.add(p2);
    QuantityRange quantityRange = new QuantityRange(uom2, Arrays.asList(0.0, 10.0));
    DataComponentPropertyType p3 = new DataComponentPropertyType("validity", "urn:x-ogc:def:property:validity", quantityRange);
    params.add(p3);
    ParameterList paramList = new ParameterList(params);
    Parameters parameters = new Parameters(paramList);
    component.setParameters(parameters);
    component.setPosition(new Position("conductivitePosition", "piezometer#piezoPosition"));
    component.setName(new DefaultIdentifier("Capteur Profondeur de ARGELES"));
    member.setProcess(sml100Factory.createComponent(component));
    SensorML expectedResult = new SensorML("1.0", Arrays.asList(member));
    assertEquals(result.getMember().size(), 1);
    assertTrue(result.getMember().get(0).getProcess() != null);
    assertTrue(result.getMember().get(0).getProcess().getValue() instanceof ComponentType);
    ComponentType resultProcess = (ComponentType) result.getMember().get(0).getProcess().getValue();
    assertEquals(resultProcess.getCapabilities(), component.getCapabilities());
    assertTrue(resultProcess.getContact().size() == 1);
    assertEquals(resultProcess.getContact().get(0).getContactList(), component.getContact().get(0).getContactList());
    assertEquals(resultProcess.getContact().get(0).getResponsibleParty().getContactInfo(), component.getContact().get(0).getResponsibleParty().getContactInfo());
    assertEquals(resultProcess.getContact().get(0).getResponsibleParty().getOrganizationName(), component.getContact().get(0).getResponsibleParty().getOrganizationName());
    assertEquals(resultProcess.getContact().get(0).getResponsibleParty(), component.getContact().get(0).getResponsibleParty());
    assertEquals(resultProcess.getContact().get(0), component.getContact().get(0));
    assertEquals(resultProcess.getContact(), component.getContact());
    assertTrue(resultProcess.getClassification().size() == 1);
    assertTrue(resultProcess.getClassification().get(0).getClassifierList().getClassifier().size() == 2);
    assertEquals(resultProcess.getClassification().get(0).getClassifierList().getClassifier().get(0).getTerm(), component.getClassification().get(0).getClassifierList().getClassifier().get(0).getTerm());
    assertEquals(resultProcess.getClassification().get(0).getClassifierList().getClassifier().get(0), component.getClassification().get(0).getClassifierList().getClassifier().get(0));
    assertEquals(resultProcess.getClassification().get(0).getClassifierList().getClassifier(), component.getClassification().get(0).getClassifierList().getClassifier());
    assertEquals(resultProcess.getClassification().get(0).getClassifierList(), component.getClassification().get(0).getClassifierList());
    assertEquals(resultProcess.getClassification().get(0), component.getClassification().get(0));
    assertEquals(resultProcess.getClassification(), component.getClassification());
    assertEquals(resultProcess.getIdentification(), component.getIdentification());
    assertEquals(resultProcess.getValidTime(), component.getValidTime());
    assertEquals(resultProcess.getParameters(), component.getParameters());
    assertEquals(resultProcess.getInputs().getInputList().getInput(), component.getInputs().getInputList().getInput());
    assertEquals(resultProcess.getInputs().getInputList(), component.getInputs().getInputList());
    assertEquals(resultProcess.getInputs(), component.getInputs());
    assertEquals(resultProcess.getOutputs(), component.getOutputs());
    assertEquals(resultProcess.getSMLLocation(), component.getSMLLocation());
    assertEquals(resultProcess.getPosition(), component.getPosition());
    assertEquals(resultProcess.getSpatialReferenceFrame(), component.getSpatialReferenceFrame());
    assertEquals(resultProcess.getDocumentation(), component.getDocumentation());
    assertEquals(resultProcess.getCharacteristics(), component.getCharacteristics());
    assertEquals(resultProcess.getKeywords(), component.getKeywords());
    assertEquals(resultProcess.getParameters(), component.getParameters());
    assertEquals(resultProcess.getName(), component.getName());
    assertEquals(resultProcess, component);
    assertEquals(expectedResult.getMember().get(0), result.getMember().get(0));
    assertEquals(expectedResult.getMember(), result.getMember());
    assertEquals(expectedResult, result);
    SensorMLMarshallerPool.getInstance().recycle(unmarshaller);
}
Also used : DataRecordType(org.geotoolkit.swe.xml.v100.DataRecordType) AbstractDataRecordType(org.geotoolkit.swe.xml.v100.AbstractDataRecordType) Keywords(org.geotoolkit.sml.xml.v100.Keywords) InputList(org.geotoolkit.sml.xml.v100.InputList) ArrayList(java.util.ArrayList) Identification(org.geotoolkit.sml.xml.v100.Identification) Classifier(org.geotoolkit.sml.xml.v100.Classifier) IdentifierList(org.geotoolkit.sml.xml.v100.IdentifierList) ValidTime(org.geotoolkit.sml.xml.v100.ValidTime) UomPropertyType(org.geotoolkit.swe.xml.v100.UomPropertyType) Identifier(org.geotoolkit.sml.xml.v100.Identifier) DefaultIdentifier(org.apache.sis.metadata.iso.DefaultIdentifier) ObservableProperty(org.geotoolkit.swe.xml.v100.ObservableProperty) Classification(org.geotoolkit.sml.xml.v100.Classification) CodeSpacePropertyType(org.geotoolkit.swe.xml.v100.CodeSpacePropertyType) DataComponentPropertyType(org.geotoolkit.swe.xml.v100.DataComponentPropertyType) DefaultIdentifier(org.apache.sis.metadata.iso.DefaultIdentifier) Unmarshaller(javax.xml.bind.Unmarshaller) Member(org.geotoolkit.sml.xml.v100.Member) Inputs(org.geotoolkit.sml.xml.v100.Inputs) TimePositionType(org.geotoolkit.gml.xml.v311.TimePositionType) ComponentType(org.geotoolkit.sml.xml.v100.ComponentType) Parameters(org.geotoolkit.sml.xml.v100.Parameters) Position(org.geotoolkit.sml.xml.v100.Position) InputStream(java.io.InputStream) ClassifierList(org.geotoolkit.sml.xml.v100.ClassifierList) QuantityRange(org.geotoolkit.swe.xml.v100.QuantityRange) JAXBElement(javax.xml.bind.JAXBElement) Term(org.geotoolkit.sml.xml.v100.Term) ResponsibleParty(org.geotoolkit.sml.xml.v100.ResponsibleParty) SensorML(org.geotoolkit.sml.xml.v100.SensorML) IoComponentPropertyType(org.geotoolkit.sml.xml.v100.IoComponentPropertyType) Contact(org.geotoolkit.sml.xml.v100.Contact) TimeRange(org.geotoolkit.swe.xml.v100.TimeRange) TimePeriodType(org.geotoolkit.gml.xml.v311.TimePeriodType) QuantityType(org.geotoolkit.swe.xml.v100.QuantityType) Capabilities(org.geotoolkit.sml.xml.v100.Capabilities) KeywordList(org.geotoolkit.sml.xml.v100.KeywordList) Outputs(org.geotoolkit.sml.xml.v100.Outputs) ParameterList(org.geotoolkit.sml.xml.v100.ParameterList) OutputList(org.geotoolkit.sml.xml.v100.OutputList)

Aggregations

Member (com.example.demo.entity.order29.Member)5 GetMapping (org.springframework.web.bind.annotation.GetMapping)5 Member (com.eomcs.generic.ex02.Member)4 ArrayList (java.util.ArrayList)4 Member (org.openstack4j.model.image.v2.Member)4 Capabilities (org.geotoolkit.sml.xml.v100.Capabilities)3 Classification (org.geotoolkit.sml.xml.v100.Classification)3 Contact (org.geotoolkit.sml.xml.v100.Contact)3 Identification (org.geotoolkit.sml.xml.v100.Identification)3 Keywords (org.geotoolkit.sml.xml.v100.Keywords)3 Member (org.geotoolkit.sml.xml.v100.Member)3 InputStream (java.io.InputStream)2 HashMap (java.util.HashMap)2 JAXBElement (javax.xml.bind.JAXBElement)2 Unmarshaller (javax.xml.bind.Unmarshaller)2 DefaultIdentifier (org.apache.sis.metadata.iso.DefaultIdentifier)2 TimePositionType (org.geotoolkit.gml.xml.v311.TimePositionType)2 Classifier (org.geotoolkit.sml.xml.v100.Classifier)2 ClassifierList (org.geotoolkit.sml.xml.v100.ClassifierList)2 Identifier (org.geotoolkit.sml.xml.v100.Identifier)2