Merge pull request #281 from ankurkaushal/master
Reformat according to google style guide
This commit is contained in:
@ -1,20 +1,16 @@
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more contributor license
|
||||
* agreements. See the NOTICE file distributed with this work for additional information regarding
|
||||
* copyright ownership. The ASF licenses this file to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance with the License. You may obtain a
|
||||
* copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software distributed under the License
|
||||
* is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
|
||||
* or implied. See the License for the specific language governing permissions and limitations under
|
||||
* the License.
|
||||
*/
|
||||
package domainapp.fixture;
|
||||
|
||||
@ -31,14 +27,12 @@ import domainapp.fixture.scenarios.RecreateSimpleObjects;
|
||||
*/
|
||||
@DomainService(nature = NatureOfService.DOMAIN)
|
||||
public class DomainAppFixturesProvider implements FixtureScriptsSpecificationProvider {
|
||||
@Override
|
||||
public FixtureScriptsSpecification getSpecification() {
|
||||
return FixtureScriptsSpecification
|
||||
.builder(DomainAppFixturesProvider.class)
|
||||
.with(FixtureScripts.MultipleExecutionStrategy.EXECUTE)
|
||||
.withRunScriptDefault(RecreateSimpleObjects.class)
|
||||
.withRunScriptDropDown(FixtureScriptsSpecification.DropDownPolicy.CHOICES)
|
||||
.withRecreate(RecreateSimpleObjects.class)
|
||||
.build();
|
||||
}
|
||||
@Override
|
||||
public FixtureScriptsSpecification getSpecification() {
|
||||
return FixtureScriptsSpecification.builder(DomainAppFixturesProvider.class)
|
||||
.with(FixtureScripts.MultipleExecutionStrategy.EXECUTE)
|
||||
.withRunScriptDefault(RecreateSimpleObjects.class)
|
||||
.withRunScriptDropDown(FixtureScriptsSpecification.DropDownPolicy.CHOICES)
|
||||
.withRecreate(RecreateSimpleObjects.class).build();
|
||||
}
|
||||
}
|
||||
|
@ -1,20 +1,16 @@
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more contributor license
|
||||
* agreements. See the NOTICE file distributed with this work for additional information regarding
|
||||
* copyright ownership. The ASF licenses this file to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance with the License. You may obtain a
|
||||
* copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software distributed under the License
|
||||
* is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
|
||||
* or implied. See the License for the specific language governing permissions and limitations under
|
||||
* the License.
|
||||
*/
|
||||
|
||||
package domainapp.fixture.modules.simple;
|
||||
@ -26,46 +22,50 @@ import domainapp.dom.modules.simple.SimpleObjects;
|
||||
|
||||
public class SimpleObjectCreate extends FixtureScript {
|
||||
|
||||
//region > name (input)
|
||||
private String name;
|
||||
/**
|
||||
* Name of the object (required)
|
||||
*/
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
// region > name (input)
|
||||
private String name;
|
||||
|
||||
public SimpleObjectCreate setName(final String name) {
|
||||
this.name = name;
|
||||
return this;
|
||||
}
|
||||
//endregion
|
||||
/**
|
||||
* Name of the object (required)
|
||||
*/
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public SimpleObjectCreate setName(final String name) {
|
||||
this.name = name;
|
||||
return this;
|
||||
}
|
||||
|
||||
// endregion
|
||||
|
||||
|
||||
//region > simpleObject (output)
|
||||
private SimpleObject simpleObject;
|
||||
// region > simpleObject (output)
|
||||
private SimpleObject simpleObject;
|
||||
|
||||
/**
|
||||
* The created simple object (output).
|
||||
* @return
|
||||
*/
|
||||
public SimpleObject getSimpleObject() {
|
||||
return simpleObject;
|
||||
}
|
||||
//endregion
|
||||
/**
|
||||
* The created simple object (output).
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public SimpleObject getSimpleObject() {
|
||||
return simpleObject;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void execute(final ExecutionContext ec) {
|
||||
// endregion
|
||||
|
||||
String name = checkParam("name", ec, String.class);
|
||||
@Override
|
||||
protected void execute(final ExecutionContext ec) {
|
||||
|
||||
this.simpleObject = wrap(simpleObjects).create(name);
|
||||
String name = checkParam("name", ec, String.class);
|
||||
|
||||
// also make available to UI
|
||||
ec.addResult(this, simpleObject);
|
||||
}
|
||||
this.simpleObject = wrap(simpleObjects).create(name);
|
||||
|
||||
@javax.inject.Inject
|
||||
private SimpleObjects simpleObjects;
|
||||
// also make available to UI
|
||||
ec.addResult(this, simpleObject);
|
||||
}
|
||||
|
||||
@javax.inject.Inject
|
||||
private SimpleObjects simpleObjects;
|
||||
|
||||
}
|
||||
|
@ -1,20 +1,16 @@
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more contributor license
|
||||
* agreements. See the NOTICE file distributed with this work for additional information regarding
|
||||
* copyright ownership. The ASF licenses this file to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance with the License. You may obtain a
|
||||
* copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software distributed under the License
|
||||
* is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
|
||||
* or implied. See the License for the specific language governing permissions and limitations under
|
||||
* the License.
|
||||
*/
|
||||
|
||||
package domainapp.fixture.modules.simple;
|
||||
@ -24,13 +20,13 @@ import org.apache.isis.applib.services.jdosupport.IsisJdoSupport;
|
||||
|
||||
public class SimpleObjectsTearDown extends FixtureScript {
|
||||
|
||||
@Override
|
||||
protected void execute(ExecutionContext executionContext) {
|
||||
isisJdoSupport.executeUpdate("delete from \"simple\".\"SimpleObject\"");
|
||||
}
|
||||
@Override
|
||||
protected void execute(ExecutionContext executionContext) {
|
||||
isisJdoSupport.executeUpdate("delete from \"simple\".\"SimpleObject\"");
|
||||
}
|
||||
|
||||
|
||||
@javax.inject.Inject
|
||||
private IsisJdoSupport isisJdoSupport;
|
||||
@javax.inject.Inject
|
||||
private IsisJdoSupport isisJdoSupport;
|
||||
|
||||
}
|
||||
|
@ -1,20 +1,16 @@
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more contributor license
|
||||
* agreements. See the NOTICE file distributed with this work for additional information regarding
|
||||
* copyright ownership. The ASF licenses this file to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance with the License. You may obtain a
|
||||
* copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software distributed under the License
|
||||
* is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
|
||||
* or implied. See the License for the specific language governing permissions and limitations under
|
||||
* the License.
|
||||
*/
|
||||
|
||||
package domainapp.fixture.scenarios;
|
||||
@ -33,60 +29,63 @@ import domainapp.fixture.modules.simple.SimpleObjectsTearDown;
|
||||
|
||||
public class RecreateSimpleObjects extends FixtureScript {
|
||||
|
||||
public final List<String> NAMES = Collections.unmodifiableList(Arrays.asList(
|
||||
"Foo", "Bar", "Baz", "Frodo", "Froyo", "Fizz", "Bip", "Bop", "Bang", "Boo"));
|
||||
public final List<String> NAMES = Collections.unmodifiableList(Arrays.asList("Foo", "Bar", "Baz",
|
||||
"Frodo", "Froyo", "Fizz", "Bip", "Bop", "Bang", "Boo"));
|
||||
|
||||
public RecreateSimpleObjects() {
|
||||
withDiscoverability(Discoverability.DISCOVERABLE);
|
||||
public RecreateSimpleObjects() {
|
||||
withDiscoverability(Discoverability.DISCOVERABLE);
|
||||
}
|
||||
|
||||
// region > number (optional input)
|
||||
private Integer number;
|
||||
|
||||
/**
|
||||
* The number of objects to create, up to 10; optional, defaults to 3.
|
||||
*/
|
||||
public Integer getNumber() {
|
||||
return number;
|
||||
}
|
||||
|
||||
public RecreateSimpleObjects setNumber(final Integer number) {
|
||||
this.number = number;
|
||||
return this;
|
||||
}
|
||||
|
||||
// endregion
|
||||
|
||||
// region > simpleObjects (output)
|
||||
private final List<SimpleObject> simpleObjects = Lists.newArrayList();
|
||||
|
||||
/**
|
||||
* The simpleobjects created by this fixture (output).
|
||||
*/
|
||||
public List<SimpleObject> getSimpleObjects() {
|
||||
return simpleObjects;
|
||||
}
|
||||
|
||||
// endregion
|
||||
|
||||
@Override
|
||||
protected void execute(final ExecutionContext ec) {
|
||||
|
||||
// defaults
|
||||
final int number = defaultParam("number", ec, 3);
|
||||
|
||||
// validate
|
||||
if (number < 0 || number > NAMES.size()) {
|
||||
throw new IllegalArgumentException(String.format("number must be in range [0,%d)",
|
||||
NAMES.size()));
|
||||
}
|
||||
|
||||
//region > number (optional input)
|
||||
private Integer number;
|
||||
//
|
||||
// execute
|
||||
//
|
||||
ec.executeChild(this, new SimpleObjectsTearDown());
|
||||
|
||||
/**
|
||||
* The number of objects to create, up to 10; optional, defaults to 3.
|
||||
*/
|
||||
public Integer getNumber() {
|
||||
return number;
|
||||
}
|
||||
|
||||
public RecreateSimpleObjects setNumber(final Integer number) {
|
||||
this.number = number;
|
||||
return this;
|
||||
}
|
||||
//endregion
|
||||
|
||||
//region > simpleObjects (output)
|
||||
private final List<SimpleObject> simpleObjects = Lists.newArrayList();
|
||||
|
||||
/**
|
||||
* The simpleobjects created by this fixture (output).
|
||||
*/
|
||||
public List<SimpleObject> getSimpleObjects() {
|
||||
return simpleObjects;
|
||||
}
|
||||
//endregion
|
||||
|
||||
@Override
|
||||
protected void execute(final ExecutionContext ec) {
|
||||
|
||||
// defaults
|
||||
final int number = defaultParam("number", ec, 3);
|
||||
|
||||
// validate
|
||||
if(number < 0 || number > NAMES.size()) {
|
||||
throw new IllegalArgumentException(String.format("number must be in range [0,%d)", NAMES.size()));
|
||||
}
|
||||
|
||||
//
|
||||
// execute
|
||||
//
|
||||
ec.executeChild(this, new SimpleObjectsTearDown());
|
||||
|
||||
for (int i = 0; i < number; i++) {
|
||||
final SimpleObjectCreate fs = new SimpleObjectCreate().setName(NAMES.get(i));
|
||||
ec.executeChild(this, fs.getName(), fs);
|
||||
simpleObjects.add(fs.getSimpleObject());
|
||||
}
|
||||
for (int i = 0; i < number; i++) {
|
||||
final SimpleObjectCreate fs = new SimpleObjectCreate().setName(NAMES.get(i));
|
||||
ec.executeChild(this, fs.getName(), fs);
|
||||
simpleObjects.add(fs.getSimpleObject());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user