Skip to content

Instantly share code, notes, and snippets.

View hugithordarson's full-sized avatar

Hugi Thordarson hugithordarson

View GitHub Profile
void performFetch() {
addDateTruncAttribute( editingContext, "SomeEntity", "checkInTimeTruncated", "check_in_time" );
addDateTruncAttribute( editingContext, "SomeEntity", "requestedTruncated", "requested" );
EOQualifier q = EOQualifier.qualifierWithQualifierFormat( "checkInTimeTruncated>=requestedTruncated", null );
// ...finish your fetch using the qualifier
}
static void addDateTruncAttribute( EOEditingContext ec, String entityName, String attributeName, String columnName ) {
EOAttribute attribute = new EOAttribute();
package is.rebbi.core.formatters;
import java.text.FieldPosition;
import java.text.Format;
import java.text.ParsePosition;
import java.time.format.DateTimeFormatter;
import java.time.temporal.TemporalAccessor;
import java.util.Objects;
public class DateTimeFormatterWrapper extends Format {
package strimillinn.core.ocr;
import java.io.File;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.atomic.LongAdder;
import org.apache.cayenne.query.SelectQuery;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public static ServerRuntime createServerRuntime() {
return ServerRuntime
.builder()
.addConfig( "cayenne-project.xml" )
.addModule( b -> b.bind( DataSourceFactory.class ).to( AppDataSourceFactory.class ) )
.build();
}
private static class AppDataSourceFactory implements DataSourceFactory {

Getting started with WO Development using Maven

This tutorial focuses on getting started with Maven in Eclipse/Development. Maven and the Maven integration plugin are bundled with Eclipse so you don't need to install anything additional.

We don't cover Maven building on the CLI nor do we discuss concepts or how any of this actually works. This just gets the darned thing up and running, we can talk concepts and understanding later. So:

Let's set it up

1. Let Maven know WO/Wonder exists

Maven needs to know where to fetch the WO/Wonder frameworks and jars. If you're starting fresh, that means copying settings.xml (seen below in this gist) into ~/.m2/settings.xml. Now Maven knows where WOCommunity keeps it's stuff.

Preparing

To prepare, turn off automatic builds in Eclipse (otherwise, Eclipse is going to be really, really "helpful" by creating folders, modifying .classpath etc.). Keep automatic builds off until you've at least finished step 2 (changing your configuration files.

Once you've changed the configuration files, close the project and open it again, then turn on the Eclipse builds again.

1. Creating folders and moving stuff around

Here are the modifications you have to do to your project's layout, expressed in bash (as if your working directory is your project's root).

package nb;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.StringReader;
import java.io.StringWriter;
import java.util.Arrays;
import java.util.HashSet;
import java.util.Properties;
package nb.db;
import java.util.Iterator;
import java.util.List;
import org.apache.cayenne.access.translator.batch.BatchTranslator;
import org.apache.cayenne.access.translator.batch.DefaultBatchTranslatorFactory;
import org.apache.cayenne.access.translator.batch.UpdateBatchTranslator;
import org.apache.cayenne.dba.DbAdapter;
import org.apache.cayenne.dba.QuotingStrategy;
package nb;
import java.time.LocalDateTime;
import org.apache.cayenne.BaseDataObject;
import org.apache.cayenne.annotation.PostAdd;
import org.apache.cayenne.annotation.PreUpdate;
import jambalaya.interfaces.DateTimeStampedCreation;
import jambalaya.interfaces.DateTimeStampedModification;
@hugithordarson
hugithordarson / Rafrænir reikningar.md
Last active July 1, 2020 15:52
Almenn umfjöllun um rafræna reikninga, kröfur sem eru gerðar til þeirra o.fl.

Rafrænir reikningar fyrir forritara

// FIXME: Hvers vegna

Aðilar sem taka við rafrænum reikningum

Ríki

// FIXME: Kennitölur stofnana, kröfulisti

Sveitarfélög

// FIXME: Kennitölur, listi yfir sveitarfélög. Mismunandi kröfur milli sveitarfélaga.