repo_name
stringlengths
7
104
file_path
stringlengths
13
198
context
stringlengths
67
7.15k
import_statement
stringlengths
16
4.43k
code
stringlengths
40
6.98k
prompt
stringlengths
227
8.27k
next_line
stringlengths
8
795
xm-online/xm-lep
xm-lep-groovy/src/main/java/com/icthh/xm/lep/groovy/ExecutionStrategy.java
// Path: xm-lep-api/src/main/java/com/icthh/xm/lep/api/LepInvocationCauseException.java // public class LepInvocationCauseException extends Exception { // // /** // * Serial UID. // */ // private static final long serialVersionUID = -6216272704551111089L; // // /** // * This field holds the cause if the // * LepInvocationCauseException(Throwable lepCause) constructor was // * used to instantiate the object. // */ // private Exception lepCause; // // /** // * Constructs an {@code LepInvocationCauseException} with // * {@code null} as the target exception. // */ // private LepInvocationCauseException() { // super((Exception) null); // Disallow initCause // } // // /** // * Constructs a LepInvocationCauseException with a LEP exception. // * // * @param lepCause the LEP exception // */ // public LepInvocationCauseException(Exception lepCause) { // super((Exception) null); // Disallow initCause // this.lepCause = lepCause; // } // // /** // * Constructs a InvocationTargetException with a target exception // * and a detail message. // * // * @param lepCause the LEP exception // * @param msg the detail message // */ // public LepInvocationCauseException(Exception lepCause, String msg) { // super(msg, null); // Disallow initCause // this.lepCause = lepCause; // } // // /** // * Returns the cause of this exception (the LEP thrown cause exception, // * which may be {@code null}). // * // * @return the cause of this exception. // */ // @Override // public Exception getCause() { // return lepCause; // } // // } // // Path: xm-lep-api/src/main/java/com/icthh/xm/lep/api/LepManagerService.java // public interface LepManagerService extends ContextsHolder { // // ExtensionService getExtensionService(); // // LepResourceService getResourceService(); // // } // // Path: xm-lep-api/src/main/java/com/icthh/xm/lep/api/LepMethod.java // public interface LepMethod { // // Object getTarget(); // // MethodSignature getMethodSignature(); // // Object[] getMethodArgValues(); // // } // // Path: xm-lep-api/src/main/java/com/icthh/xm/lep/api/LepResourceKey.java // public interface LepResourceKey { // // String getId(); // // Version getVersion(); // // }
import com.icthh.xm.lep.api.LepInvocationCauseException; import com.icthh.xm.lep.api.LepManagerService; import com.icthh.xm.lep.api.LepMethod; import com.icthh.xm.lep.api.LepResourceKey; import java.util.function.Supplier;
package com.icthh.xm.lep.groovy; /** * The {@link ExecutionStrategy} interface. */ public interface ExecutionStrategy<E, K extends LepResourceKey> { /** * Executes LEP resource using some executor. * * @param resourceKey LEP resource key * @param method LEP method info data * @param managerService LEP manager service * @param resourceExecutorSupplier LEP resource executor supplier function * @return LEP method result * @throws LepInvocationCauseException when LEP invocation resource throws exception */ Object executeLepResource(K resourceKey, LepMethod method,
// Path: xm-lep-api/src/main/java/com/icthh/xm/lep/api/LepInvocationCauseException.java // public class LepInvocationCauseException extends Exception { // // /** // * Serial UID. // */ // private static final long serialVersionUID = -6216272704551111089L; // // /** // * This field holds the cause if the // * LepInvocationCauseException(Throwable lepCause) constructor was // * used to instantiate the object. // */ // private Exception lepCause; // // /** // * Constructs an {@code LepInvocationCauseException} with // * {@code null} as the target exception. // */ // private LepInvocationCauseException() { // super((Exception) null); // Disallow initCause // } // // /** // * Constructs a LepInvocationCauseException with a LEP exception. // * // * @param lepCause the LEP exception // */ // public LepInvocationCauseException(Exception lepCause) { // super((Exception) null); // Disallow initCause // this.lepCause = lepCause; // } // // /** // * Constructs a InvocationTargetException with a target exception // * and a detail message. // * // * @param lepCause the LEP exception // * @param msg the detail message // */ // public LepInvocationCauseException(Exception lepCause, String msg) { // super(msg, null); // Disallow initCause // this.lepCause = lepCause; // } // // /** // * Returns the cause of this exception (the LEP thrown cause exception, // * which may be {@code null}). // * // * @return the cause of this exception. // */ // @Override // public Exception getCause() { // return lepCause; // } // // } // // Path: xm-lep-api/src/main/java/com/icthh/xm/lep/api/LepManagerService.java // public interface LepManagerService extends ContextsHolder { // // ExtensionService getExtensionService(); // // LepResourceService getResourceService(); // // } // // Path: xm-lep-api/src/main/java/com/icthh/xm/lep/api/LepMethod.java // public interface LepMethod { // // Object getTarget(); // // MethodSignature getMethodSignature(); // // Object[] getMethodArgValues(); // // } // // Path: xm-lep-api/src/main/java/com/icthh/xm/lep/api/LepResourceKey.java // public interface LepResourceKey { // // String getId(); // // Version getVersion(); // // } // Path: xm-lep-groovy/src/main/java/com/icthh/xm/lep/groovy/ExecutionStrategy.java import com.icthh.xm.lep.api.LepInvocationCauseException; import com.icthh.xm.lep.api.LepManagerService; import com.icthh.xm.lep.api.LepMethod; import com.icthh.xm.lep.api.LepResourceKey; import java.util.function.Supplier; package com.icthh.xm.lep.groovy; /** * The {@link ExecutionStrategy} interface. */ public interface ExecutionStrategy<E, K extends LepResourceKey> { /** * Executes LEP resource using some executor. * * @param resourceKey LEP resource key * @param method LEP method info data * @param managerService LEP manager service * @param resourceExecutorSupplier LEP resource executor supplier function * @return LEP method result * @throws LepInvocationCauseException when LEP invocation resource throws exception */ Object executeLepResource(K resourceKey, LepMethod method,
LepManagerService managerService,
xm-online/xm-lep
xm-lep-groovy/src/main/java/com/icthh/xm/lep/groovy/ExecutionStrategy.java
// Path: xm-lep-api/src/main/java/com/icthh/xm/lep/api/LepInvocationCauseException.java // public class LepInvocationCauseException extends Exception { // // /** // * Serial UID. // */ // private static final long serialVersionUID = -6216272704551111089L; // // /** // * This field holds the cause if the // * LepInvocationCauseException(Throwable lepCause) constructor was // * used to instantiate the object. // */ // private Exception lepCause; // // /** // * Constructs an {@code LepInvocationCauseException} with // * {@code null} as the target exception. // */ // private LepInvocationCauseException() { // super((Exception) null); // Disallow initCause // } // // /** // * Constructs a LepInvocationCauseException with a LEP exception. // * // * @param lepCause the LEP exception // */ // public LepInvocationCauseException(Exception lepCause) { // super((Exception) null); // Disallow initCause // this.lepCause = lepCause; // } // // /** // * Constructs a InvocationTargetException with a target exception // * and a detail message. // * // * @param lepCause the LEP exception // * @param msg the detail message // */ // public LepInvocationCauseException(Exception lepCause, String msg) { // super(msg, null); // Disallow initCause // this.lepCause = lepCause; // } // // /** // * Returns the cause of this exception (the LEP thrown cause exception, // * which may be {@code null}). // * // * @return the cause of this exception. // */ // @Override // public Exception getCause() { // return lepCause; // } // // } // // Path: xm-lep-api/src/main/java/com/icthh/xm/lep/api/LepManagerService.java // public interface LepManagerService extends ContextsHolder { // // ExtensionService getExtensionService(); // // LepResourceService getResourceService(); // // } // // Path: xm-lep-api/src/main/java/com/icthh/xm/lep/api/LepMethod.java // public interface LepMethod { // // Object getTarget(); // // MethodSignature getMethodSignature(); // // Object[] getMethodArgValues(); // // } // // Path: xm-lep-api/src/main/java/com/icthh/xm/lep/api/LepResourceKey.java // public interface LepResourceKey { // // String getId(); // // Version getVersion(); // // }
import com.icthh.xm.lep.api.LepInvocationCauseException; import com.icthh.xm.lep.api.LepManagerService; import com.icthh.xm.lep.api.LepMethod; import com.icthh.xm.lep.api.LepResourceKey; import java.util.function.Supplier;
package com.icthh.xm.lep.groovy; /** * The {@link ExecutionStrategy} interface. */ public interface ExecutionStrategy<E, K extends LepResourceKey> { /** * Executes LEP resource using some executor. * * @param resourceKey LEP resource key * @param method LEP method info data * @param managerService LEP manager service * @param resourceExecutorSupplier LEP resource executor supplier function * @return LEP method result * @throws LepInvocationCauseException when LEP invocation resource throws exception */ Object executeLepResource(K resourceKey, LepMethod method, LepManagerService managerService,
// Path: xm-lep-api/src/main/java/com/icthh/xm/lep/api/LepInvocationCauseException.java // public class LepInvocationCauseException extends Exception { // // /** // * Serial UID. // */ // private static final long serialVersionUID = -6216272704551111089L; // // /** // * This field holds the cause if the // * LepInvocationCauseException(Throwable lepCause) constructor was // * used to instantiate the object. // */ // private Exception lepCause; // // /** // * Constructs an {@code LepInvocationCauseException} with // * {@code null} as the target exception. // */ // private LepInvocationCauseException() { // super((Exception) null); // Disallow initCause // } // // /** // * Constructs a LepInvocationCauseException with a LEP exception. // * // * @param lepCause the LEP exception // */ // public LepInvocationCauseException(Exception lepCause) { // super((Exception) null); // Disallow initCause // this.lepCause = lepCause; // } // // /** // * Constructs a InvocationTargetException with a target exception // * and a detail message. // * // * @param lepCause the LEP exception // * @param msg the detail message // */ // public LepInvocationCauseException(Exception lepCause, String msg) { // super(msg, null); // Disallow initCause // this.lepCause = lepCause; // } // // /** // * Returns the cause of this exception (the LEP thrown cause exception, // * which may be {@code null}). // * // * @return the cause of this exception. // */ // @Override // public Exception getCause() { // return lepCause; // } // // } // // Path: xm-lep-api/src/main/java/com/icthh/xm/lep/api/LepManagerService.java // public interface LepManagerService extends ContextsHolder { // // ExtensionService getExtensionService(); // // LepResourceService getResourceService(); // // } // // Path: xm-lep-api/src/main/java/com/icthh/xm/lep/api/LepMethod.java // public interface LepMethod { // // Object getTarget(); // // MethodSignature getMethodSignature(); // // Object[] getMethodArgValues(); // // } // // Path: xm-lep-api/src/main/java/com/icthh/xm/lep/api/LepResourceKey.java // public interface LepResourceKey { // // String getId(); // // Version getVersion(); // // } // Path: xm-lep-groovy/src/main/java/com/icthh/xm/lep/groovy/ExecutionStrategy.java import com.icthh.xm.lep.api.LepInvocationCauseException; import com.icthh.xm.lep.api.LepManagerService; import com.icthh.xm.lep.api.LepMethod; import com.icthh.xm.lep.api.LepResourceKey; import java.util.function.Supplier; package com.icthh.xm.lep.groovy; /** * The {@link ExecutionStrategy} interface. */ public interface ExecutionStrategy<E, K extends LepResourceKey> { /** * Executes LEP resource using some executor. * * @param resourceKey LEP resource key * @param method LEP method info data * @param managerService LEP manager service * @param resourceExecutorSupplier LEP resource executor supplier function * @return LEP method result * @throws LepInvocationCauseException when LEP invocation resource throws exception */ Object executeLepResource(K resourceKey, LepMethod method, LepManagerService managerService,
Supplier<E> resourceExecutorSupplier) throws LepInvocationCauseException;
xm-online/xm-lep
xm-lep-groovy/src/main/java/com/icthh/xm/lep/groovy/LazyGroovyScriptEngineProviderStrategy.java
// Path: xm-lep-api/src/main/java/com/icthh/xm/lep/api/ContextsHolder.java // public interface ContextsHolder { // // /** // * Return context instance by scope name. // * // * @param scope context scope name, this name is unique across all // * scopes in one {@link ContextsHolder} instance // * @return context instance // * @see ContextScopes // */ // ScopedContext getContext(String scope); // // } // // Path: xm-lep-api/src/main/java/com/icthh/xm/lep/api/LepManagerService.java // public interface LepManagerService extends ContextsHolder { // // ExtensionService getExtensionService(); // // LepResourceService getResourceService(); // // }
import com.icthh.xm.lep.api.ContextsHolder; import com.icthh.xm.lep.api.LepManagerService; import groovy.util.GroovyScriptEngine; import groovy.util.ResourceConnector; import java.util.Objects;
package com.icthh.xm.lep.groovy; /** * The {@link LazyGroovyScriptEngineProviderStrategy} class. */ public class LazyGroovyScriptEngineProviderStrategy implements GroovyScriptEngineProviderStrategy { private final ScriptNameLepResourceKeyMapper resourceKeyMapper; private volatile GroovyScriptEngine groovyScriptEngine; public LazyGroovyScriptEngineProviderStrategy(ScriptNameLepResourceKeyMapper resourceKeyMapper) { this.resourceKeyMapper = Objects.requireNonNull(resourceKeyMapper, "resourceKeyMapper can't be null"); } /** * Strategy: build new instance on first call. * * @param managerService LEP manager service * @return GroovyScriptEngine instance */ @Override
// Path: xm-lep-api/src/main/java/com/icthh/xm/lep/api/ContextsHolder.java // public interface ContextsHolder { // // /** // * Return context instance by scope name. // * // * @param scope context scope name, this name is unique across all // * scopes in one {@link ContextsHolder} instance // * @return context instance // * @see ContextScopes // */ // ScopedContext getContext(String scope); // // } // // Path: xm-lep-api/src/main/java/com/icthh/xm/lep/api/LepManagerService.java // public interface LepManagerService extends ContextsHolder { // // ExtensionService getExtensionService(); // // LepResourceService getResourceService(); // // } // Path: xm-lep-groovy/src/main/java/com/icthh/xm/lep/groovy/LazyGroovyScriptEngineProviderStrategy.java import com.icthh.xm.lep.api.ContextsHolder; import com.icthh.xm.lep.api.LepManagerService; import groovy.util.GroovyScriptEngine; import groovy.util.ResourceConnector; import java.util.Objects; package com.icthh.xm.lep.groovy; /** * The {@link LazyGroovyScriptEngineProviderStrategy} class. */ public class LazyGroovyScriptEngineProviderStrategy implements GroovyScriptEngineProviderStrategy { private final ScriptNameLepResourceKeyMapper resourceKeyMapper; private volatile GroovyScriptEngine groovyScriptEngine; public LazyGroovyScriptEngineProviderStrategy(ScriptNameLepResourceKeyMapper resourceKeyMapper) { this.resourceKeyMapper = Objects.requireNonNull(resourceKeyMapper, "resourceKeyMapper can't be null"); } /** * Strategy: build new instance on first call. * * @param managerService LEP manager service * @return GroovyScriptEngine instance */ @Override
public GroovyScriptEngine getEngine(LepManagerService managerService) {
xm-online/xm-lep
xm-lep-groovy/src/main/java/com/icthh/xm/lep/groovy/LazyGroovyScriptEngineProviderStrategy.java
// Path: xm-lep-api/src/main/java/com/icthh/xm/lep/api/ContextsHolder.java // public interface ContextsHolder { // // /** // * Return context instance by scope name. // * // * @param scope context scope name, this name is unique across all // * scopes in one {@link ContextsHolder} instance // * @return context instance // * @see ContextScopes // */ // ScopedContext getContext(String scope); // // } // // Path: xm-lep-api/src/main/java/com/icthh/xm/lep/api/LepManagerService.java // public interface LepManagerService extends ContextsHolder { // // ExtensionService getExtensionService(); // // LepResourceService getResourceService(); // // }
import com.icthh.xm.lep.api.ContextsHolder; import com.icthh.xm.lep.api.LepManagerService; import groovy.util.GroovyScriptEngine; import groovy.util.ResourceConnector; import java.util.Objects;
GroovyScriptEngine engine = this.groovyScriptEngine; if (engine == null) { synchronized (this) { engine = this.groovyScriptEngine; if (engine == null) { this.groovyScriptEngine = engine = buildGroovyScriptEngine(managerService); } } } return engine; } private GroovyScriptEngine buildGroovyScriptEngine(LepManagerService managerService) { final ClassLoader parentClassLoader = getParentClassLoader(); final ResourceConnector rc = buildResourceConnector(managerService); GroovyScriptEngine engine = (parentClassLoader == null) ? new GroovyScriptEngine(rc) : new GroovyScriptEngine(rc, parentClassLoader); initGroovyScriptEngine(engine, managerService); return engine; } protected ClassLoader getParentClassLoader() { return null; } protected void initGroovyScriptEngine(GroovyScriptEngine engine,
// Path: xm-lep-api/src/main/java/com/icthh/xm/lep/api/ContextsHolder.java // public interface ContextsHolder { // // /** // * Return context instance by scope name. // * // * @param scope context scope name, this name is unique across all // * scopes in one {@link ContextsHolder} instance // * @return context instance // * @see ContextScopes // */ // ScopedContext getContext(String scope); // // } // // Path: xm-lep-api/src/main/java/com/icthh/xm/lep/api/LepManagerService.java // public interface LepManagerService extends ContextsHolder { // // ExtensionService getExtensionService(); // // LepResourceService getResourceService(); // // } // Path: xm-lep-groovy/src/main/java/com/icthh/xm/lep/groovy/LazyGroovyScriptEngineProviderStrategy.java import com.icthh.xm.lep.api.ContextsHolder; import com.icthh.xm.lep.api.LepManagerService; import groovy.util.GroovyScriptEngine; import groovy.util.ResourceConnector; import java.util.Objects; GroovyScriptEngine engine = this.groovyScriptEngine; if (engine == null) { synchronized (this) { engine = this.groovyScriptEngine; if (engine == null) { this.groovyScriptEngine = engine = buildGroovyScriptEngine(managerService); } } } return engine; } private GroovyScriptEngine buildGroovyScriptEngine(LepManagerService managerService) { final ClassLoader parentClassLoader = getParentClassLoader(); final ResourceConnector rc = buildResourceConnector(managerService); GroovyScriptEngine engine = (parentClassLoader == null) ? new GroovyScriptEngine(rc) : new GroovyScriptEngine(rc, parentClassLoader); initGroovyScriptEngine(engine, managerService); return engine; } protected ClassLoader getParentClassLoader() { return null; } protected void initGroovyScriptEngine(GroovyScriptEngine engine,
ContextsHolder contextsHolder) {
xm-online/xm-lep
xm-lep-script/src/main/java/com/icthh/xm/lep/script/CompositeGroupLepResource.java
// Path: xm-lep-api/src/main/java/com/icthh/xm/lep/api/CompositeLepResource.java // public interface CompositeLepResource extends LepResource { // // List<LepResource> getChildren(); // // } // // Path: xm-lep-api/src/main/java/com/icthh/xm/lep/api/LepResource.java // public interface LepResource { // // /** // * Composite class constant. // */ // Class<CompositeLepResource> COMPOSITE_CLASS = CompositeLepResource.class; // // LepResourceDescriptor getDescriptor(); // // <V> V getValue(Class<? extends V> valueClass); // // default boolean isComposite() { // return COMPOSITE_CLASS.isInstance(this); // } // // /** // * Check is composite implementation and if so cast or throw exception otherwise. // * // * @return composite class representation of resource // */ // default CompositeLepResource asComposite() { // if (isComposite()) { // return COMPOSITE_CLASS.cast(this); // } else { // throw new IllegalStateException("Can't cast not composite: " // + this.getClass().getSimpleName() // + " object to composite: " // + COMPOSITE_CLASS.getSimpleName()); // } // } // // } // // Path: xm-lep-api/src/main/java/com/icthh/xm/lep/api/LepResourceDescriptor.java // public interface LepResourceDescriptor { // // /** // * Composite class constant. // */ // Class<CompositeLepResourceDescriptor> COMPOSITE_CLASS = CompositeLepResourceDescriptor.class; // // LepResourceType getType(); // // LepResourceType getSubType(); // // LepResourceKey getKey(); // // Instant getCreationTime(); // // Instant getModificationTime(); // // Version getVersion(); // // default boolean isComposite() { // return COMPOSITE_CLASS.isInstance(this); // } // // /** // * Check is composite implementation and if so cast or throw exception otherwise. // * // * @return composite class representation of resource descriptor // */ // default CompositeLepResourceDescriptor asComposite() { // if (isComposite()) { // return COMPOSITE_CLASS.cast(this); // } else { // throw new IllegalStateException("Can't cast not composite: " // + this.getClass().getSimpleName() // + " object to composite: " // + COMPOSITE_CLASS.getSimpleName()); // } // } // // }
import com.icthh.xm.lep.api.CompositeLepResource; import com.icthh.xm.lep.api.LepResource; import com.icthh.xm.lep.api.LepResourceDescriptor; import java.util.List; import java.util.Objects;
package com.icthh.xm.lep.script; /** * The {@link CompositeGroupLepResource} class. */ public class CompositeGroupLepResource implements CompositeLepResource { private LepResourceDescriptor descriptor;
// Path: xm-lep-api/src/main/java/com/icthh/xm/lep/api/CompositeLepResource.java // public interface CompositeLepResource extends LepResource { // // List<LepResource> getChildren(); // // } // // Path: xm-lep-api/src/main/java/com/icthh/xm/lep/api/LepResource.java // public interface LepResource { // // /** // * Composite class constant. // */ // Class<CompositeLepResource> COMPOSITE_CLASS = CompositeLepResource.class; // // LepResourceDescriptor getDescriptor(); // // <V> V getValue(Class<? extends V> valueClass); // // default boolean isComposite() { // return COMPOSITE_CLASS.isInstance(this); // } // // /** // * Check is composite implementation and if so cast or throw exception otherwise. // * // * @return composite class representation of resource // */ // default CompositeLepResource asComposite() { // if (isComposite()) { // return COMPOSITE_CLASS.cast(this); // } else { // throw new IllegalStateException("Can't cast not composite: " // + this.getClass().getSimpleName() // + " object to composite: " // + COMPOSITE_CLASS.getSimpleName()); // } // } // // } // // Path: xm-lep-api/src/main/java/com/icthh/xm/lep/api/LepResourceDescriptor.java // public interface LepResourceDescriptor { // // /** // * Composite class constant. // */ // Class<CompositeLepResourceDescriptor> COMPOSITE_CLASS = CompositeLepResourceDescriptor.class; // // LepResourceType getType(); // // LepResourceType getSubType(); // // LepResourceKey getKey(); // // Instant getCreationTime(); // // Instant getModificationTime(); // // Version getVersion(); // // default boolean isComposite() { // return COMPOSITE_CLASS.isInstance(this); // } // // /** // * Check is composite implementation and if so cast or throw exception otherwise. // * // * @return composite class representation of resource descriptor // */ // default CompositeLepResourceDescriptor asComposite() { // if (isComposite()) { // return COMPOSITE_CLASS.cast(this); // } else { // throw new IllegalStateException("Can't cast not composite: " // + this.getClass().getSimpleName() // + " object to composite: " // + COMPOSITE_CLASS.getSimpleName()); // } // } // // } // Path: xm-lep-script/src/main/java/com/icthh/xm/lep/script/CompositeGroupLepResource.java import com.icthh.xm.lep.api.CompositeLepResource; import com.icthh.xm.lep.api.LepResource; import com.icthh.xm.lep.api.LepResourceDescriptor; import java.util.List; import java.util.Objects; package com.icthh.xm.lep.script; /** * The {@link CompositeGroupLepResource} class. */ public class CompositeGroupLepResource implements CompositeLepResource { private LepResourceDescriptor descriptor;
private List<LepResource> children;
xm-online/xm-lep
xm-lep-entry/src/main/java/com/icthh/xm/lep/entry/LogicExtensionPoint.java
// Path: xm-lep-api/src/main/java/com/icthh/xm/lep/api/LepKeyResolver.java // public interface LepKeyResolver { // // /** // * Resolve dynamic part of LEP key by method arguments. // * // * @param baseKey base LEP key (prefix), can be {@code null} // * @param method method data on what LEP call occurs // * @param managerService LEP manager service // * @return complete LEP key (baseKey + dynamic part) // */ // LepKey resolve(LepKey baseKey, // LepMethod method, // LepManagerService managerService); // // }
import com.icthh.xm.lep.api.LepKeyResolver; import java.lang.annotation.ElementType; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target;
package com.icthh.xm.lep.entry; /** * The annotation type {@link LogicExtensionPoint} is used to indicate point in code that can * be extended by custom implementation. * Custom implementation represents by {@link com.icthh.xm.lep.api.LepResource}) interface and * can be script, byte code, etc. */ @Target({ ElementType.METHOD, ElementType.TYPE }) @Retention(RetentionPolicy.RUNTIME) public @interface LogicExtensionPoint { /** * Default group name. */ String DEFAULT_GROUP = "general"; /** * Base LEP key, or complete LEP key if resolver not specified. * * @return logic extension point key */ String key(); /** * LEP group name, it's just marker for grouping {@link LogicExtensionPoint}s (can be used * like Java package name convention). * * @return LEP group name */ String group() default DEFAULT_GROUP; /** * LEP key resolver implementation class to determine complete (dynamic) LEP key. * * @return LEP key resolver implementation class */
// Path: xm-lep-api/src/main/java/com/icthh/xm/lep/api/LepKeyResolver.java // public interface LepKeyResolver { // // /** // * Resolve dynamic part of LEP key by method arguments. // * // * @param baseKey base LEP key (prefix), can be {@code null} // * @param method method data on what LEP call occurs // * @param managerService LEP manager service // * @return complete LEP key (baseKey + dynamic part) // */ // LepKey resolve(LepKey baseKey, // LepMethod method, // LepManagerService managerService); // // } // Path: xm-lep-entry/src/main/java/com/icthh/xm/lep/entry/LogicExtensionPoint.java import com.icthh.xm.lep.api.LepKeyResolver; import java.lang.annotation.ElementType; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; package com.icthh.xm.lep.entry; /** * The annotation type {@link LogicExtensionPoint} is used to indicate point in code that can * be extended by custom implementation. * Custom implementation represents by {@link com.icthh.xm.lep.api.LepResource}) interface and * can be script, byte code, etc. */ @Target({ ElementType.METHOD, ElementType.TYPE }) @Retention(RetentionPolicy.RUNTIME) public @interface LogicExtensionPoint { /** * Default group name. */ String DEFAULT_GROUP = "general"; /** * Base LEP key, or complete LEP key if resolver not specified. * * @return logic extension point key */ String key(); /** * LEP group name, it's just marker for grouping {@link LogicExtensionPoint}s (can be used * like Java package name convention). * * @return LEP group name */ String group() default DEFAULT_GROUP; /** * LEP key resolver implementation class to determine complete (dynamic) LEP key. * * @return LEP key resolver implementation class */
Class<? extends LepKeyResolver> resolver() default LepKeyResolver.class;
xm-online/xm-lep
xm-lep-core/src/main/java/com/icthh/xm/lep/core/CoreContextsHolder.java
// Path: xm-lep-api/src/main/java/com/icthh/xm/lep/api/ContextScopes.java // public final class ContextScopes { // // public static final String THREAD = "lep.system.thread"; // // public static final String EXECUTION = "lep.system.execution"; // // /** // * Private utils class constructor, to prevent instantiation with reflection API. // */ // private ContextScopes() { // throw new IllegalAccessError("not permitted access for utils class"); // } // // } // // Path: xm-lep-api/src/main/java/com/icthh/xm/lep/api/ContextsHolder.java // public interface ContextsHolder { // // /** // * Return context instance by scope name. // * // * @param scope context scope name, this name is unique across all // * scopes in one {@link ContextsHolder} instance // * @return context instance // * @see ContextScopes // */ // ScopedContext getContext(String scope); // // } // // Path: xm-lep-api/src/main/java/com/icthh/xm/lep/api/ScopedContext.java // public interface ScopedContext extends Context { // // String getScope(); // // }
import com.icthh.xm.lep.api.ContextScopes; import com.icthh.xm.lep.api.ContextsHolder; import com.icthh.xm.lep.api.ScopedContext; import java.util.HashMap; import java.util.Map; import java.util.Objects;
package com.icthh.xm.lep.core; /** * The {@link CoreContextsHolder} class. */ public class CoreContextsHolder implements ContextsHolder { private static volatile Map<String, ThreadLocal<ScopedContext>> contexts = new HashMap<>(); static {
// Path: xm-lep-api/src/main/java/com/icthh/xm/lep/api/ContextScopes.java // public final class ContextScopes { // // public static final String THREAD = "lep.system.thread"; // // public static final String EXECUTION = "lep.system.execution"; // // /** // * Private utils class constructor, to prevent instantiation with reflection API. // */ // private ContextScopes() { // throw new IllegalAccessError("not permitted access for utils class"); // } // // } // // Path: xm-lep-api/src/main/java/com/icthh/xm/lep/api/ContextsHolder.java // public interface ContextsHolder { // // /** // * Return context instance by scope name. // * // * @param scope context scope name, this name is unique across all // * scopes in one {@link ContextsHolder} instance // * @return context instance // * @see ContextScopes // */ // ScopedContext getContext(String scope); // // } // // Path: xm-lep-api/src/main/java/com/icthh/xm/lep/api/ScopedContext.java // public interface ScopedContext extends Context { // // String getScope(); // // } // Path: xm-lep-core/src/main/java/com/icthh/xm/lep/core/CoreContextsHolder.java import com.icthh.xm.lep.api.ContextScopes; import com.icthh.xm.lep.api.ContextsHolder; import com.icthh.xm.lep.api.ScopedContext; import java.util.HashMap; import java.util.Map; import java.util.Objects; package com.icthh.xm.lep.core; /** * The {@link CoreContextsHolder} class. */ public class CoreContextsHolder implements ContextsHolder { private static volatile Map<String, ThreadLocal<ScopedContext>> contexts = new HashMap<>(); static {
contexts.put(ContextScopes.THREAD, new ThreadLocal<>());
xm-online/xm-lep
xm-lep-script/src/main/java/com/icthh/xm/lep/script/ScriptLepResource.java
// Path: xm-lep-api/src/main/java/com/icthh/xm/lep/api/LepResource.java // public interface LepResource { // // /** // * Composite class constant. // */ // Class<CompositeLepResource> COMPOSITE_CLASS = CompositeLepResource.class; // // LepResourceDescriptor getDescriptor(); // // <V> V getValue(Class<? extends V> valueClass); // // default boolean isComposite() { // return COMPOSITE_CLASS.isInstance(this); // } // // /** // * Check is composite implementation and if so cast or throw exception otherwise. // * // * @return composite class representation of resource // */ // default CompositeLepResource asComposite() { // if (isComposite()) { // return COMPOSITE_CLASS.cast(this); // } else { // throw new IllegalStateException("Can't cast not composite: " // + this.getClass().getSimpleName() // + " object to composite: " // + COMPOSITE_CLASS.getSimpleName()); // } // } // // } // // Path: xm-lep-api/src/main/java/com/icthh/xm/lep/api/LepResourceDescriptor.java // public interface LepResourceDescriptor { // // /** // * Composite class constant. // */ // Class<CompositeLepResourceDescriptor> COMPOSITE_CLASS = CompositeLepResourceDescriptor.class; // // LepResourceType getType(); // // LepResourceType getSubType(); // // LepResourceKey getKey(); // // Instant getCreationTime(); // // Instant getModificationTime(); // // Version getVersion(); // // default boolean isComposite() { // return COMPOSITE_CLASS.isInstance(this); // } // // /** // * Check is composite implementation and if so cast or throw exception otherwise. // * // * @return composite class representation of resource descriptor // */ // default CompositeLepResourceDescriptor asComposite() { // if (isComposite()) { // return COMPOSITE_CLASS.cast(this); // } else { // throw new IllegalStateException("Can't cast not composite: " // + this.getClass().getSimpleName() // + " object to composite: " // + COMPOSITE_CLASS.getSimpleName()); // } // } // // }
import com.icthh.xm.lep.api.LepResource; import com.icthh.xm.lep.api.LepResourceDescriptor; import java.io.BufferedReader; import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.nio.charset.Charset; import java.nio.charset.StandardCharsets; import java.util.Objects; import java.util.stream.Collectors;
package com.icthh.xm.lep.script; /** * The {@link ScriptLepResource} class. */ public class ScriptLepResource implements LepResource, InputStreamSupplier { public static final String DEFAULT_ENCODING = StandardCharsets.UTF_8.name(); private static final int SCRIPT_PREVIEW_MAX_LENGTH = 360; private static final int SCRIPT_PREVIEW_LINES_COUNT = 5;
// Path: xm-lep-api/src/main/java/com/icthh/xm/lep/api/LepResource.java // public interface LepResource { // // /** // * Composite class constant. // */ // Class<CompositeLepResource> COMPOSITE_CLASS = CompositeLepResource.class; // // LepResourceDescriptor getDescriptor(); // // <V> V getValue(Class<? extends V> valueClass); // // default boolean isComposite() { // return COMPOSITE_CLASS.isInstance(this); // } // // /** // * Check is composite implementation and if so cast or throw exception otherwise. // * // * @return composite class representation of resource // */ // default CompositeLepResource asComposite() { // if (isComposite()) { // return COMPOSITE_CLASS.cast(this); // } else { // throw new IllegalStateException("Can't cast not composite: " // + this.getClass().getSimpleName() // + " object to composite: " // + COMPOSITE_CLASS.getSimpleName()); // } // } // // } // // Path: xm-lep-api/src/main/java/com/icthh/xm/lep/api/LepResourceDescriptor.java // public interface LepResourceDescriptor { // // /** // * Composite class constant. // */ // Class<CompositeLepResourceDescriptor> COMPOSITE_CLASS = CompositeLepResourceDescriptor.class; // // LepResourceType getType(); // // LepResourceType getSubType(); // // LepResourceKey getKey(); // // Instant getCreationTime(); // // Instant getModificationTime(); // // Version getVersion(); // // default boolean isComposite() { // return COMPOSITE_CLASS.isInstance(this); // } // // /** // * Check is composite implementation and if so cast or throw exception otherwise. // * // * @return composite class representation of resource descriptor // */ // default CompositeLepResourceDescriptor asComposite() { // if (isComposite()) { // return COMPOSITE_CLASS.cast(this); // } else { // throw new IllegalStateException("Can't cast not composite: " // + this.getClass().getSimpleName() // + " object to composite: " // + COMPOSITE_CLASS.getSimpleName()); // } // } // // } // Path: xm-lep-script/src/main/java/com/icthh/xm/lep/script/ScriptLepResource.java import com.icthh.xm.lep.api.LepResource; import com.icthh.xm.lep.api.LepResourceDescriptor; import java.io.BufferedReader; import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.nio.charset.Charset; import java.nio.charset.StandardCharsets; import java.util.Objects; import java.util.stream.Collectors; package com.icthh.xm.lep.script; /** * The {@link ScriptLepResource} class. */ public class ScriptLepResource implements LepResource, InputStreamSupplier { public static final String DEFAULT_ENCODING = StandardCharsets.UTF_8.name(); private static final int SCRIPT_PREVIEW_MAX_LENGTH = 360; private static final int SCRIPT_PREVIEW_LINES_COUNT = 5;
private final LepResourceDescriptor descriptor;
xm-online/xm-lep
xm-lep-api-commons/src/main/java/com/icthh/xm/lep/api/commons/DefaultLepMethod.java
// Path: xm-lep-api/src/main/java/com/icthh/xm/lep/api/LepMethod.java // public interface LepMethod { // // Object getTarget(); // // MethodSignature getMethodSignature(); // // Object[] getMethodArgValues(); // // } // // Path: xm-lep-api/src/main/java/com/icthh/xm/lep/api/MethodSignature.java // public interface MethodSignature { // // /** // * Returns the identifier part of this signature. For methods this // * will return the method name. // * // * @return the identifier part of this signature // * @see java.lang.reflect.Member#getName // */ // String getName(); // // /** // * Returns the modifiers on this signature represented as an int. Use // * the constants and helper methods defined on {@code java.lang.reflect.Modifier} to manipulate this, i.e. // * <pre> // * // check if this signature is public // * java.lang.reflect.Modifier.isPublic(sig.getModifiers()); // * // * // print out the modifiers // * java.lang.reflect.Modifier.toString(sig.getModifiers()); // * </pre> // * // * @return the modifiers on this signature represented as an int // * @see java.lang.reflect.Member#getModifiers // * @see java.lang.reflect.Modifier // */ // int getModifiers(); // // /** // * <p>Returns a {@code java.lang.Class} object representing the class, // * interface, or aspect (proxy) that declared this member. For intra-member // * declarations, this will be the type on which the member is declared, // * not the type where the declaration is lexically written. Use // * {@code SourceLocation.getWithinType()} to get the type in // * which the declaration occurs lexically.</p> // * <p>For consistency with {@code java.lang.reflect.Member}, this // * method named {@code getDeclaringClass()}.</p> // * // * @return a {@code java.lang.Class} object representing the class, interface, // * or aspect (proxy) that declared this member // * @see java.lang.reflect.Member#getDeclaringClass // */ // Class<?> getDeclaringClass(); // // /** // * Returns the fully-qualified name of the declaring type. This is // * equivalent to calling getDeclaringClass().getName(), but caches // * the result for greater efficiency. // * // * @return the fully-qualified name of the declaring type // */ // String getDeclaringClassName(); // // /** // * Returns an array of {@code Class} objects that represent the formal // * parameter types, in declaration order, of the method. Returns an array of length // * 0 if the underlying method takes no parameters. // * // * @return the parameter types for the method // */ // Class<?>[] getParameterTypes(); // // /** // * Returns an array of {@code String} objects that represent parameter names, // * in declaration order, of the method. Returns an array of length // * 0 if the underlying method takes no parameters. // * // * @return the parameter names for the method // */ // String[] getParameterNames(); // // /** // * Returns an array of {@code Class} objects that represent the // * types of exceptions declared to be thrown by the underlying // * method. Returns an array of length 0 if the method declares no exceptions in its {@code // * throws} clause. // * // * @return the exception types declared as being thrown by the method // */ // Class<?>[] getExceptionTypes(); // // /** // * Returns a {@code Class} object that represents the formal return type // * of the method. // * // * @return the return type for the method this object represents // */ // Class<?> getReturnType(); // // /** // * Returns {@code Method} object reflecting the declared method. // * // * @return the {@code Method} object reflecting the declared method. // */ // Method getMethod(); // // }
import com.icthh.xm.lep.api.LepMethod; import com.icthh.xm.lep.api.MethodSignature; import java.util.Arrays; import java.util.Objects;
package com.icthh.xm.lep.api.commons; /** * The {@link DefaultLepMethod} class. */ public class DefaultLepMethod implements LepMethod { private static final Object[] EMPTY_OBJ_ARRAY = new Object[0]; private final Object target;
// Path: xm-lep-api/src/main/java/com/icthh/xm/lep/api/LepMethod.java // public interface LepMethod { // // Object getTarget(); // // MethodSignature getMethodSignature(); // // Object[] getMethodArgValues(); // // } // // Path: xm-lep-api/src/main/java/com/icthh/xm/lep/api/MethodSignature.java // public interface MethodSignature { // // /** // * Returns the identifier part of this signature. For methods this // * will return the method name. // * // * @return the identifier part of this signature // * @see java.lang.reflect.Member#getName // */ // String getName(); // // /** // * Returns the modifiers on this signature represented as an int. Use // * the constants and helper methods defined on {@code java.lang.reflect.Modifier} to manipulate this, i.e. // * <pre> // * // check if this signature is public // * java.lang.reflect.Modifier.isPublic(sig.getModifiers()); // * // * // print out the modifiers // * java.lang.reflect.Modifier.toString(sig.getModifiers()); // * </pre> // * // * @return the modifiers on this signature represented as an int // * @see java.lang.reflect.Member#getModifiers // * @see java.lang.reflect.Modifier // */ // int getModifiers(); // // /** // * <p>Returns a {@code java.lang.Class} object representing the class, // * interface, or aspect (proxy) that declared this member. For intra-member // * declarations, this will be the type on which the member is declared, // * not the type where the declaration is lexically written. Use // * {@code SourceLocation.getWithinType()} to get the type in // * which the declaration occurs lexically.</p> // * <p>For consistency with {@code java.lang.reflect.Member}, this // * method named {@code getDeclaringClass()}.</p> // * // * @return a {@code java.lang.Class} object representing the class, interface, // * or aspect (proxy) that declared this member // * @see java.lang.reflect.Member#getDeclaringClass // */ // Class<?> getDeclaringClass(); // // /** // * Returns the fully-qualified name of the declaring type. This is // * equivalent to calling getDeclaringClass().getName(), but caches // * the result for greater efficiency. // * // * @return the fully-qualified name of the declaring type // */ // String getDeclaringClassName(); // // /** // * Returns an array of {@code Class} objects that represent the formal // * parameter types, in declaration order, of the method. Returns an array of length // * 0 if the underlying method takes no parameters. // * // * @return the parameter types for the method // */ // Class<?>[] getParameterTypes(); // // /** // * Returns an array of {@code String} objects that represent parameter names, // * in declaration order, of the method. Returns an array of length // * 0 if the underlying method takes no parameters. // * // * @return the parameter names for the method // */ // String[] getParameterNames(); // // /** // * Returns an array of {@code Class} objects that represent the // * types of exceptions declared to be thrown by the underlying // * method. Returns an array of length 0 if the method declares no exceptions in its {@code // * throws} clause. // * // * @return the exception types declared as being thrown by the method // */ // Class<?>[] getExceptionTypes(); // // /** // * Returns a {@code Class} object that represents the formal return type // * of the method. // * // * @return the return type for the method this object represents // */ // Class<?> getReturnType(); // // /** // * Returns {@code Method} object reflecting the declared method. // * // * @return the {@code Method} object reflecting the declared method. // */ // Method getMethod(); // // } // Path: xm-lep-api-commons/src/main/java/com/icthh/xm/lep/api/commons/DefaultLepMethod.java import com.icthh.xm.lep.api.LepMethod; import com.icthh.xm.lep.api.MethodSignature; import java.util.Arrays; import java.util.Objects; package com.icthh.xm.lep.api.commons; /** * The {@link DefaultLepMethod} class. */ public class DefaultLepMethod implements LepMethod { private static final Object[] EMPTY_OBJ_ARRAY = new Object[0]; private final Object target;
private final MethodSignature methodSignature;
xm-online/xm-lep
xm-lep-core/src/test/java/com/icthh/xm/lep/core/CoreLepManagerThreadContextTest.java
// Path: xm-lep-api/src/main/java/com/icthh/xm/lep/api/ContextScopes.java // public final class ContextScopes { // // public static final String THREAD = "lep.system.thread"; // // public static final String EXECUTION = "lep.system.execution"; // // /** // * Private utils class constructor, to prevent instantiation with reflection API. // */ // private ContextScopes() { // throw new IllegalAccessError("not permitted access for utils class"); // } // // } // // Path: xm-lep-api/src/main/java/com/icthh/xm/lep/api/ScopedContext.java // public interface ScopedContext extends Context { // // String getScope(); // // }
import static org.junit.Assert.*; import com.icthh.xm.lep.api.ContextScopes; import com.icthh.xm.lep.api.ScopedContext; import org.junit.After; import org.junit.Before; import org.junit.Rule; import org.junit.Test; import org.junit.rules.ExpectedException;
package com.icthh.xm.lep.core; /** * The {@link CoreLepManagerThreadContextTest} class. */ public class CoreLepManagerThreadContextTest { private CoreLepManager manager; @Rule public ExpectedException thrown = ExpectedException.none(); @Before public void beforeEachTest() { manager = new CoreLepManager(); } @After public void afterEachTest() { manager.destroy(); } @Test public void throwsNPEOnNullInitThreadContextAction() { thrown.expect(NullPointerException.class); thrown.expectMessage("context init action can't be null"); manager.beginThreadContext(null); } @Test public void getsNullIfThreadContextNotBegin() {
// Path: xm-lep-api/src/main/java/com/icthh/xm/lep/api/ContextScopes.java // public final class ContextScopes { // // public static final String THREAD = "lep.system.thread"; // // public static final String EXECUTION = "lep.system.execution"; // // /** // * Private utils class constructor, to prevent instantiation with reflection API. // */ // private ContextScopes() { // throw new IllegalAccessError("not permitted access for utils class"); // } // // } // // Path: xm-lep-api/src/main/java/com/icthh/xm/lep/api/ScopedContext.java // public interface ScopedContext extends Context { // // String getScope(); // // } // Path: xm-lep-core/src/test/java/com/icthh/xm/lep/core/CoreLepManagerThreadContextTest.java import static org.junit.Assert.*; import com.icthh.xm.lep.api.ContextScopes; import com.icthh.xm.lep.api.ScopedContext; import org.junit.After; import org.junit.Before; import org.junit.Rule; import org.junit.Test; import org.junit.rules.ExpectedException; package com.icthh.xm.lep.core; /** * The {@link CoreLepManagerThreadContextTest} class. */ public class CoreLepManagerThreadContextTest { private CoreLepManager manager; @Rule public ExpectedException thrown = ExpectedException.none(); @Before public void beforeEachTest() { manager = new CoreLepManager(); } @After public void afterEachTest() { manager.destroy(); } @Test public void throwsNPEOnNullInitThreadContextAction() { thrown.expect(NullPointerException.class); thrown.expectMessage("context init action can't be null"); manager.beginThreadContext(null); } @Test public void getsNullIfThreadContextNotBegin() {
assertNull(manager.getContext(ContextScopes.THREAD));
xm-online/xm-lep
xm-lep-core/src/test/java/com/icthh/xm/lep/core/CoreLepManagerThreadContextTest.java
// Path: xm-lep-api/src/main/java/com/icthh/xm/lep/api/ContextScopes.java // public final class ContextScopes { // // public static final String THREAD = "lep.system.thread"; // // public static final String EXECUTION = "lep.system.execution"; // // /** // * Private utils class constructor, to prevent instantiation with reflection API. // */ // private ContextScopes() { // throw new IllegalAccessError("not permitted access for utils class"); // } // // } // // Path: xm-lep-api/src/main/java/com/icthh/xm/lep/api/ScopedContext.java // public interface ScopedContext extends Context { // // String getScope(); // // }
import static org.junit.Assert.*; import com.icthh.xm.lep.api.ContextScopes; import com.icthh.xm.lep.api.ScopedContext; import org.junit.After; import org.junit.Before; import org.junit.Rule; import org.junit.Test; import org.junit.rules.ExpectedException;
@After public void afterEachTest() { manager.destroy(); } @Test public void throwsNPEOnNullInitThreadContextAction() { thrown.expect(NullPointerException.class); thrown.expectMessage("context init action can't be null"); manager.beginThreadContext(null); } @Test public void getsNullIfThreadContextNotBegin() { assertNull(manager.getContext(ContextScopes.THREAD)); } @Test public void getsContextIfThreadContextBegin() { manager.beginThreadContext(scopedContext -> { }); assertNotNull(manager.getContext(ContextScopes.THREAD)); } @Test public void getsSameThreadContextForSameThread() { manager.beginThreadContext(scopedContext -> { scopedContext.setValue("test", 123); });
// Path: xm-lep-api/src/main/java/com/icthh/xm/lep/api/ContextScopes.java // public final class ContextScopes { // // public static final String THREAD = "lep.system.thread"; // // public static final String EXECUTION = "lep.system.execution"; // // /** // * Private utils class constructor, to prevent instantiation with reflection API. // */ // private ContextScopes() { // throw new IllegalAccessError("not permitted access for utils class"); // } // // } // // Path: xm-lep-api/src/main/java/com/icthh/xm/lep/api/ScopedContext.java // public interface ScopedContext extends Context { // // String getScope(); // // } // Path: xm-lep-core/src/test/java/com/icthh/xm/lep/core/CoreLepManagerThreadContextTest.java import static org.junit.Assert.*; import com.icthh.xm.lep.api.ContextScopes; import com.icthh.xm.lep.api.ScopedContext; import org.junit.After; import org.junit.Before; import org.junit.Rule; import org.junit.Test; import org.junit.rules.ExpectedException; @After public void afterEachTest() { manager.destroy(); } @Test public void throwsNPEOnNullInitThreadContextAction() { thrown.expect(NullPointerException.class); thrown.expectMessage("context init action can't be null"); manager.beginThreadContext(null); } @Test public void getsNullIfThreadContextNotBegin() { assertNull(manager.getContext(ContextScopes.THREAD)); } @Test public void getsContextIfThreadContextBegin() { manager.beginThreadContext(scopedContext -> { }); assertNotNull(manager.getContext(ContextScopes.THREAD)); } @Test public void getsSameThreadContextForSameThread() { manager.beginThreadContext(scopedContext -> { scopedContext.setValue("test", 123); });
ScopedContext context1 = manager.getContext(ContextScopes.THREAD);
frosch95/SmartCSV.fx
src/main/java/ninja/javafx/smartcsv/validation/checker/UuidValidation.java
// Path: src/main/java/ninja/javafx/smartcsv/validation/ValidationError.java // public class ValidationError { // // private List<ValidationMessage> messages = new ArrayList<>(); // private Integer lineNumber; // private String column = ""; // // private ValidationError(Integer lineNumber) { // this.lineNumber = lineNumber; // } // // public static ValidationError withLineNumber(int lineNumber) { // return new ValidationError(lineNumber); // } // // public static ValidationError withoutLineNumber() { // return new ValidationError(-1); // } // // public ValidationError column(String column) { // this.column = column; // return this; // } // // public Integer getLineNumber() { // return lineNumber; // } // // public String getColumn() { // return column; // } // // public List<ValidationMessage> getMessages() { // return messages; // } // // public ValidationError add(String key, String... parameters) { // messages.add(new ValidationMessage(key, parameters)); // return this; // } // // public boolean isEmpty() { // return messages.isEmpty(); // } // }
import ninja.javafx.smartcsv.validation.ValidationError; import java.util.UUID;
/* The MIT License (MIT) ----------------------------------------------------------------------------- Copyright (c) 2015-2021 javafx.ninja <info@javafx.ninja> Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ package ninja.javafx.smartcsv.validation.checker; /** * checks if the value is a valid uuid */ public class UuidValidation extends EmptyValueIsValid { @SuppressWarnings("ResultOfMethodCallIgnored") @Override
// Path: src/main/java/ninja/javafx/smartcsv/validation/ValidationError.java // public class ValidationError { // // private List<ValidationMessage> messages = new ArrayList<>(); // private Integer lineNumber; // private String column = ""; // // private ValidationError(Integer lineNumber) { // this.lineNumber = lineNumber; // } // // public static ValidationError withLineNumber(int lineNumber) { // return new ValidationError(lineNumber); // } // // public static ValidationError withoutLineNumber() { // return new ValidationError(-1); // } // // public ValidationError column(String column) { // this.column = column; // return this; // } // // public Integer getLineNumber() { // return lineNumber; // } // // public String getColumn() { // return column; // } // // public List<ValidationMessage> getMessages() { // return messages; // } // // public ValidationError add(String key, String... parameters) { // messages.add(new ValidationMessage(key, parameters)); // return this; // } // // public boolean isEmpty() { // return messages.isEmpty(); // } // } // Path: src/main/java/ninja/javafx/smartcsv/validation/checker/UuidValidation.java import ninja.javafx.smartcsv.validation.ValidationError; import java.util.UUID; /* The MIT License (MIT) ----------------------------------------------------------------------------- Copyright (c) 2015-2021 javafx.ninja <info@javafx.ninja> Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ package ninja.javafx.smartcsv.validation.checker; /** * checks if the value is a valid uuid */ public class UuidValidation extends EmptyValueIsValid { @SuppressWarnings("ResultOfMethodCallIgnored") @Override
public void check(int row, String value, ValidationError error) {
frosch95/SmartCSV.fx
src/main/java/ninja/javafx/smartcsv/validation/checker/UniqueValidation.java
// Path: src/main/java/ninja/javafx/smartcsv/fx/table/model/ColumnValueProvider.java // public interface ColumnValueProvider { // // String getValue(int row, String column); // int getNumberOfRows(); // // } // // Path: src/main/java/ninja/javafx/smartcsv/validation/ValidationError.java // public class ValidationError { // // private List<ValidationMessage> messages = new ArrayList<>(); // private Integer lineNumber; // private String column = ""; // // private ValidationError(Integer lineNumber) { // this.lineNumber = lineNumber; // } // // public static ValidationError withLineNumber(int lineNumber) { // return new ValidationError(lineNumber); // } // // public static ValidationError withoutLineNumber() { // return new ValidationError(-1); // } // // public ValidationError column(String column) { // this.column = column; // return this; // } // // public Integer getLineNumber() { // return lineNumber; // } // // public String getColumn() { // return column; // } // // public List<ValidationMessage> getMessages() { // return messages; // } // // public ValidationError add(String key, String... parameters) { // messages.add(new ValidationMessage(key, parameters)); // return this; // } // // public boolean isEmpty() { // return messages.isEmpty(); // } // }
import static java.util.Collections.sort; import static java.util.stream.Collectors.joining; import ninja.javafx.smartcsv.fx.table.model.ColumnValueProvider; import ninja.javafx.smartcsv.validation.ValidationError; import java.util.ArrayList; import java.util.List;
/* The MIT License (MIT) ----------------------------------------------------------------------------- Copyright (c) 2015-2021 javafx.ninja <info@javafx.ninja> Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ package ninja.javafx.smartcsv.validation.checker; /** * Checks if the value is unique in the column */ public class UniqueValidation extends EmptyValueIsValid { private ColumnValueProvider columnValueProvider; private String column; public UniqueValidation(ColumnValueProvider columnValueProvider, String column) { this.columnValueProvider = columnValueProvider; this.column = column; } @Override
// Path: src/main/java/ninja/javafx/smartcsv/fx/table/model/ColumnValueProvider.java // public interface ColumnValueProvider { // // String getValue(int row, String column); // int getNumberOfRows(); // // } // // Path: src/main/java/ninja/javafx/smartcsv/validation/ValidationError.java // public class ValidationError { // // private List<ValidationMessage> messages = new ArrayList<>(); // private Integer lineNumber; // private String column = ""; // // private ValidationError(Integer lineNumber) { // this.lineNumber = lineNumber; // } // // public static ValidationError withLineNumber(int lineNumber) { // return new ValidationError(lineNumber); // } // // public static ValidationError withoutLineNumber() { // return new ValidationError(-1); // } // // public ValidationError column(String column) { // this.column = column; // return this; // } // // public Integer getLineNumber() { // return lineNumber; // } // // public String getColumn() { // return column; // } // // public List<ValidationMessage> getMessages() { // return messages; // } // // public ValidationError add(String key, String... parameters) { // messages.add(new ValidationMessage(key, parameters)); // return this; // } // // public boolean isEmpty() { // return messages.isEmpty(); // } // } // Path: src/main/java/ninja/javafx/smartcsv/validation/checker/UniqueValidation.java import static java.util.Collections.sort; import static java.util.stream.Collectors.joining; import ninja.javafx.smartcsv.fx.table.model.ColumnValueProvider; import ninja.javafx.smartcsv.validation.ValidationError; import java.util.ArrayList; import java.util.List; /* The MIT License (MIT) ----------------------------------------------------------------------------- Copyright (c) 2015-2021 javafx.ninja <info@javafx.ninja> Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ package ninja.javafx.smartcsv.validation.checker; /** * Checks if the value is unique in the column */ public class UniqueValidation extends EmptyValueIsValid { private ColumnValueProvider columnValueProvider; private String column; public UniqueValidation(ColumnValueProvider columnValueProvider, String column) { this.columnValueProvider = columnValueProvider; this.column = column; } @Override
public void check(int row, String value, ValidationError error) {
frosch95/SmartCSV.fx
src/main/java/ninja/javafx/smartcsv/validation/checker/NotEmptyValidation.java
// Path: src/main/java/ninja/javafx/smartcsv/validation/ValidationError.java // public class ValidationError { // // private List<ValidationMessage> messages = new ArrayList<>(); // private Integer lineNumber; // private String column = ""; // // private ValidationError(Integer lineNumber) { // this.lineNumber = lineNumber; // } // // public static ValidationError withLineNumber(int lineNumber) { // return new ValidationError(lineNumber); // } // // public static ValidationError withoutLineNumber() { // return new ValidationError(-1); // } // // public ValidationError column(String column) { // this.column = column; // return this; // } // // public Integer getLineNumber() { // return lineNumber; // } // // public String getColumn() { // return column; // } // // public List<ValidationMessage> getMessages() { // return messages; // } // // public ValidationError add(String key, String... parameters) { // messages.add(new ValidationMessage(key, parameters)); // return this; // } // // public boolean isEmpty() { // return messages.isEmpty(); // } // }
import ninja.javafx.smartcsv.validation.ValidationError; import static org.apache.commons.validator.GenericValidator.isBlankOrNull;
/* The MIT License (MIT) ----------------------------------------------------------------------------- Copyright (c) 2015-2021 javafx.ninja <info@javafx.ninja> Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ package ninja.javafx.smartcsv.validation.checker; /** * Checks if the value is not empty */ public class NotEmptyValidation implements Validation { @Override
// Path: src/main/java/ninja/javafx/smartcsv/validation/ValidationError.java // public class ValidationError { // // private List<ValidationMessage> messages = new ArrayList<>(); // private Integer lineNumber; // private String column = ""; // // private ValidationError(Integer lineNumber) { // this.lineNumber = lineNumber; // } // // public static ValidationError withLineNumber(int lineNumber) { // return new ValidationError(lineNumber); // } // // public static ValidationError withoutLineNumber() { // return new ValidationError(-1); // } // // public ValidationError column(String column) { // this.column = column; // return this; // } // // public Integer getLineNumber() { // return lineNumber; // } // // public String getColumn() { // return column; // } // // public List<ValidationMessage> getMessages() { // return messages; // } // // public ValidationError add(String key, String... parameters) { // messages.add(new ValidationMessage(key, parameters)); // return this; // } // // public boolean isEmpty() { // return messages.isEmpty(); // } // } // Path: src/main/java/ninja/javafx/smartcsv/validation/checker/NotEmptyValidation.java import ninja.javafx.smartcsv.validation.ValidationError; import static org.apache.commons.validator.GenericValidator.isBlankOrNull; /* The MIT License (MIT) ----------------------------------------------------------------------------- Copyright (c) 2015-2021 javafx.ninja <info@javafx.ninja> Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ package ninja.javafx.smartcsv.validation.checker; /** * Checks if the value is not empty */ public class NotEmptyValidation implements Validation { @Override
public void check(int row, String value, ValidationError error) {
frosch95/SmartCSV.fx
src/main/java/ninja/javafx/smartcsv/fx/util/LoadFileService.java
// Path: src/main/java/ninja/javafx/smartcsv/files/FileStorage.java // public class FileStorage<E> { // // private FileReader<E> reader; // private FileWriter<E> writer; // // public FileStorage(FileReader<E> reader, FileWriter<E> writer) { // this.reader = reader; // this.writer = writer; // } // // private BooleanProperty fileChanged = new SimpleBooleanProperty(true); // private ObjectProperty<File> file = new SimpleObjectProperty<>(); // private ObjectProperty<E> content = new SimpleObjectProperty<>(); // // public boolean isFileChanged() { // return fileChanged.get(); // } // // public BooleanProperty fileChangedProperty() { // return fileChanged; // } // // public void setFileChanged(boolean fileChanged) { // this.fileChanged.set(fileChanged); // } // // public File getFile() { // return file.get(); // } // // public ObjectProperty<File> fileProperty() { // return file; // } // // public void setFile(File file) { // this.file.set(file); // } // // public E getContent() { // return content.get(); // } // // public ObjectProperty<E> contentProperty() { // return content; // } // // public void setContent(E content) { // this.content.set(content); // } // // public void load() throws IOException { // reader.read(file.get()); // setContent(reader.getContent()); // setFileChanged(false); // } // // public void save() throws IOException { // writer.setContent(content.get()); // writer.write(file.get()); // setFileChanged(false); // } // }
import javafx.concurrent.Service; import javafx.concurrent.Task; import ninja.javafx.smartcsv.files.FileStorage;
/* The MIT License (MIT) ----------------------------------------------------------------------------- Copyright (c) 2015-2021 javafx.ninja <info@javafx.ninja> Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ package ninja.javafx.smartcsv.fx.util; /** * Service class for async load of a csv file */ @org.springframework.stereotype.Service public class LoadFileService extends Service<Void> {
// Path: src/main/java/ninja/javafx/smartcsv/files/FileStorage.java // public class FileStorage<E> { // // private FileReader<E> reader; // private FileWriter<E> writer; // // public FileStorage(FileReader<E> reader, FileWriter<E> writer) { // this.reader = reader; // this.writer = writer; // } // // private BooleanProperty fileChanged = new SimpleBooleanProperty(true); // private ObjectProperty<File> file = new SimpleObjectProperty<>(); // private ObjectProperty<E> content = new SimpleObjectProperty<>(); // // public boolean isFileChanged() { // return fileChanged.get(); // } // // public BooleanProperty fileChangedProperty() { // return fileChanged; // } // // public void setFileChanged(boolean fileChanged) { // this.fileChanged.set(fileChanged); // } // // public File getFile() { // return file.get(); // } // // public ObjectProperty<File> fileProperty() { // return file; // } // // public void setFile(File file) { // this.file.set(file); // } // // public E getContent() { // return content.get(); // } // // public ObjectProperty<E> contentProperty() { // return content; // } // // public void setContent(E content) { // this.content.set(content); // } // // public void load() throws IOException { // reader.read(file.get()); // setContent(reader.getContent()); // setFileChanged(false); // } // // public void save() throws IOException { // writer.setContent(content.get()); // writer.write(file.get()); // setFileChanged(false); // } // } // Path: src/main/java/ninja/javafx/smartcsv/fx/util/LoadFileService.java import javafx.concurrent.Service; import javafx.concurrent.Task; import ninja.javafx.smartcsv.files.FileStorage; /* The MIT License (MIT) ----------------------------------------------------------------------------- Copyright (c) 2015-2021 javafx.ninja <info@javafx.ninja> Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ package ninja.javafx.smartcsv.fx.util; /** * Service class for async load of a csv file */ @org.springframework.stereotype.Service public class LoadFileService extends Service<Void> {
private FileStorage<?> file;
frosch95/SmartCSV.fx
src/main/java/ninja/javafx/smartcsv/export/ErrorExport.java
// Path: src/main/java/ninja/javafx/smartcsv/fx/table/model/CSVModel.java // public final class CSVModel implements ColumnValueProvider { // // private static final Logger logger = LogManager.getLogger(CSVModel.class); // // private Validator validator; // private ObservableList<CSVRow> rows = FXCollections.observableArrayList(); // private String[] header; // private ObservableList<ValidationError> validationError = FXCollections.observableArrayList(); // private RevalidationService revalidationService = new RevalidationService(); // // /** // * sets the validator configuration for the data revalidates // * // * @param validationConfiguration the validator configuration for this data // */ // public void setValidationConfiguration(ValidationConfiguration validationConfiguration) { // this.validator = new Validator(validationConfiguration, this); // revalidate(); // } // // /** // * returns the data as a list of rows of the // * // * @return list of rows // */ // public ObservableList<CSVRow> getRows() { // return rows; // } // // public ObservableList<ValidationError> getValidationError() { // return validationError; // } // // /** // * adds a new and empty row // * // * @return the new row // */ // public CSVRow addRow() { // CSVRow row = new CSVRow(); // row.setRowNumber(rows.size()); // rows.add(row); // return row; // } // // public void addValue(final CSVRow row, final String column, final String value) { // final CSVValue csvValue = row.addValue(column, value); // csvValue.valueProperty().addListener(observable -> { // if (validator.needsColumnValidation(column)) { // revalidate(); // } else { // csvValue.setValidationError(validator.isValid(row.getRowNumber(), column, csvValue.getValue())); // } // }); // } // // /** // * sets the column headers as string array // * // * @param header the headers of the columns // */ // public void setHeader(String[] header) { // this.header = header; // revalidate(); // } // // /** // * returns the column headers // * // * @return the column headers // */ // public String[] getHeader() { // return header; // } // // // public void revalidate(String column) { // if (!hasValidator()) return; // validator.reinitializeColumn(column); // revalidate(); // } // // /** // * walks through the data and validates each value // */ // public void revalidate() { // validationError.clear(); // // logger.info("revalidate: hasValidator -> {}", hasValidator()); // // if (!hasValidator()) return; // revalidationService.setHeader(header); // revalidationService.setRows(rows); // revalidationService.setValidator(validator); // revalidationService.setOnSucceeded(t -> validationError.setAll(revalidationService.getValue())); // revalidationService.setOnFailed(t -> logger.error("revalidation service failed!")); // revalidationService.restart(); // } // // private boolean hasValidator() { // return validator != null && validator.hasConfig(); // } // // public ValidationConfiguration createValidationConfiguration() { // ValidationConfiguration newValidationConfiguration = new ValidationConfiguration(); // newValidationConfiguration.setHeaderNames(this.header); // this.validator = new Validator(newValidationConfiguration, this); // this.revalidate(); // return newValidationConfiguration; // } // // // @Override // public String getValue(int row, String column) { // return rows.get(row).getColumns().get(column).getValue().getValue(); // } // // @Override // public int getNumberOfRows() { // return rows.size(); // } // } // // Path: src/main/java/ninja/javafx/smartcsv/fx/util/I18nValidationUtil.java // public static String getI18nValidatioMessage(ResourceBundle resourceBundle, List<ValidationError> errors) { // // StringWriter message = new StringWriter(); // errors.forEach(error -> message.append(getI18nValidatioMessage(resourceBundle, error)).append("\n")); // // // if (message.toString().length() != 0) { // return cutOffLastLineBreak(message.toString()); // } // // return ""; // }
import java.io.File; import java.io.StringWriter; import java.nio.file.Files; import java.util.ResourceBundle; import static java.text.MessageFormat.format; import static ninja.javafx.smartcsv.fx.util.I18nValidationUtil.getI18nValidatioMessage; import javafx.concurrent.Service; import javafx.concurrent.Task; import ninja.javafx.smartcsv.fx.table.model.CSVModel;
/* The MIT License (MIT) ----------------------------------------------------------------------------- Copyright (c) 2015-2021 javafx.ninja <info@javafx.ninja> Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ package ninja.javafx.smartcsv.export; /** * this class exports the error messages into a log file */ @org.springframework.stereotype.Service public class ErrorExport extends Service {
// Path: src/main/java/ninja/javafx/smartcsv/fx/table/model/CSVModel.java // public final class CSVModel implements ColumnValueProvider { // // private static final Logger logger = LogManager.getLogger(CSVModel.class); // // private Validator validator; // private ObservableList<CSVRow> rows = FXCollections.observableArrayList(); // private String[] header; // private ObservableList<ValidationError> validationError = FXCollections.observableArrayList(); // private RevalidationService revalidationService = new RevalidationService(); // // /** // * sets the validator configuration for the data revalidates // * // * @param validationConfiguration the validator configuration for this data // */ // public void setValidationConfiguration(ValidationConfiguration validationConfiguration) { // this.validator = new Validator(validationConfiguration, this); // revalidate(); // } // // /** // * returns the data as a list of rows of the // * // * @return list of rows // */ // public ObservableList<CSVRow> getRows() { // return rows; // } // // public ObservableList<ValidationError> getValidationError() { // return validationError; // } // // /** // * adds a new and empty row // * // * @return the new row // */ // public CSVRow addRow() { // CSVRow row = new CSVRow(); // row.setRowNumber(rows.size()); // rows.add(row); // return row; // } // // public void addValue(final CSVRow row, final String column, final String value) { // final CSVValue csvValue = row.addValue(column, value); // csvValue.valueProperty().addListener(observable -> { // if (validator.needsColumnValidation(column)) { // revalidate(); // } else { // csvValue.setValidationError(validator.isValid(row.getRowNumber(), column, csvValue.getValue())); // } // }); // } // // /** // * sets the column headers as string array // * // * @param header the headers of the columns // */ // public void setHeader(String[] header) { // this.header = header; // revalidate(); // } // // /** // * returns the column headers // * // * @return the column headers // */ // public String[] getHeader() { // return header; // } // // // public void revalidate(String column) { // if (!hasValidator()) return; // validator.reinitializeColumn(column); // revalidate(); // } // // /** // * walks through the data and validates each value // */ // public void revalidate() { // validationError.clear(); // // logger.info("revalidate: hasValidator -> {}", hasValidator()); // // if (!hasValidator()) return; // revalidationService.setHeader(header); // revalidationService.setRows(rows); // revalidationService.setValidator(validator); // revalidationService.setOnSucceeded(t -> validationError.setAll(revalidationService.getValue())); // revalidationService.setOnFailed(t -> logger.error("revalidation service failed!")); // revalidationService.restart(); // } // // private boolean hasValidator() { // return validator != null && validator.hasConfig(); // } // // public ValidationConfiguration createValidationConfiguration() { // ValidationConfiguration newValidationConfiguration = new ValidationConfiguration(); // newValidationConfiguration.setHeaderNames(this.header); // this.validator = new Validator(newValidationConfiguration, this); // this.revalidate(); // return newValidationConfiguration; // } // // // @Override // public String getValue(int row, String column) { // return rows.get(row).getColumns().get(column).getValue().getValue(); // } // // @Override // public int getNumberOfRows() { // return rows.size(); // } // } // // Path: src/main/java/ninja/javafx/smartcsv/fx/util/I18nValidationUtil.java // public static String getI18nValidatioMessage(ResourceBundle resourceBundle, List<ValidationError> errors) { // // StringWriter message = new StringWriter(); // errors.forEach(error -> message.append(getI18nValidatioMessage(resourceBundle, error)).append("\n")); // // // if (message.toString().length() != 0) { // return cutOffLastLineBreak(message.toString()); // } // // return ""; // } // Path: src/main/java/ninja/javafx/smartcsv/export/ErrorExport.java import java.io.File; import java.io.StringWriter; import java.nio.file.Files; import java.util.ResourceBundle; import static java.text.MessageFormat.format; import static ninja.javafx.smartcsv.fx.util.I18nValidationUtil.getI18nValidatioMessage; import javafx.concurrent.Service; import javafx.concurrent.Task; import ninja.javafx.smartcsv.fx.table.model.CSVModel; /* The MIT License (MIT) ----------------------------------------------------------------------------- Copyright (c) 2015-2021 javafx.ninja <info@javafx.ninja> Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ package ninja.javafx.smartcsv.export; /** * this class exports the error messages into a log file */ @org.springframework.stereotype.Service public class ErrorExport extends Service {
private CSVModel model;
frosch95/SmartCSV.fx
src/main/java/ninja/javafx/smartcsv/export/ErrorExport.java
// Path: src/main/java/ninja/javafx/smartcsv/fx/table/model/CSVModel.java // public final class CSVModel implements ColumnValueProvider { // // private static final Logger logger = LogManager.getLogger(CSVModel.class); // // private Validator validator; // private ObservableList<CSVRow> rows = FXCollections.observableArrayList(); // private String[] header; // private ObservableList<ValidationError> validationError = FXCollections.observableArrayList(); // private RevalidationService revalidationService = new RevalidationService(); // // /** // * sets the validator configuration for the data revalidates // * // * @param validationConfiguration the validator configuration for this data // */ // public void setValidationConfiguration(ValidationConfiguration validationConfiguration) { // this.validator = new Validator(validationConfiguration, this); // revalidate(); // } // // /** // * returns the data as a list of rows of the // * // * @return list of rows // */ // public ObservableList<CSVRow> getRows() { // return rows; // } // // public ObservableList<ValidationError> getValidationError() { // return validationError; // } // // /** // * adds a new and empty row // * // * @return the new row // */ // public CSVRow addRow() { // CSVRow row = new CSVRow(); // row.setRowNumber(rows.size()); // rows.add(row); // return row; // } // // public void addValue(final CSVRow row, final String column, final String value) { // final CSVValue csvValue = row.addValue(column, value); // csvValue.valueProperty().addListener(observable -> { // if (validator.needsColumnValidation(column)) { // revalidate(); // } else { // csvValue.setValidationError(validator.isValid(row.getRowNumber(), column, csvValue.getValue())); // } // }); // } // // /** // * sets the column headers as string array // * // * @param header the headers of the columns // */ // public void setHeader(String[] header) { // this.header = header; // revalidate(); // } // // /** // * returns the column headers // * // * @return the column headers // */ // public String[] getHeader() { // return header; // } // // // public void revalidate(String column) { // if (!hasValidator()) return; // validator.reinitializeColumn(column); // revalidate(); // } // // /** // * walks through the data and validates each value // */ // public void revalidate() { // validationError.clear(); // // logger.info("revalidate: hasValidator -> {}", hasValidator()); // // if (!hasValidator()) return; // revalidationService.setHeader(header); // revalidationService.setRows(rows); // revalidationService.setValidator(validator); // revalidationService.setOnSucceeded(t -> validationError.setAll(revalidationService.getValue())); // revalidationService.setOnFailed(t -> logger.error("revalidation service failed!")); // revalidationService.restart(); // } // // private boolean hasValidator() { // return validator != null && validator.hasConfig(); // } // // public ValidationConfiguration createValidationConfiguration() { // ValidationConfiguration newValidationConfiguration = new ValidationConfiguration(); // newValidationConfiguration.setHeaderNames(this.header); // this.validator = new Validator(newValidationConfiguration, this); // this.revalidate(); // return newValidationConfiguration; // } // // // @Override // public String getValue(int row, String column) { // return rows.get(row).getColumns().get(column).getValue().getValue(); // } // // @Override // public int getNumberOfRows() { // return rows.size(); // } // } // // Path: src/main/java/ninja/javafx/smartcsv/fx/util/I18nValidationUtil.java // public static String getI18nValidatioMessage(ResourceBundle resourceBundle, List<ValidationError> errors) { // // StringWriter message = new StringWriter(); // errors.forEach(error -> message.append(getI18nValidatioMessage(resourceBundle, error)).append("\n")); // // // if (message.toString().length() != 0) { // return cutOffLastLineBreak(message.toString()); // } // // return ""; // }
import java.io.File; import java.io.StringWriter; import java.nio.file.Files; import java.util.ResourceBundle; import static java.text.MessageFormat.format; import static ninja.javafx.smartcsv.fx.util.I18nValidationUtil.getI18nValidatioMessage; import javafx.concurrent.Service; import javafx.concurrent.Task; import ninja.javafx.smartcsv.fx.table.model.CSVModel;
} public void setResourceBundle(ResourceBundle resourceBundle) { this.resourceBundle = resourceBundle; } public void setModel(CSVModel model) { this.model = model; } public void setFile(File file) { this.file = file; } @Override protected Task createTask() { return new Task() { @Override protected Void call() throws Exception { try { StringWriter log = new StringWriter(); log.append( format(resourceBundle.getString("log.header.message"), csvFilename, Integer.toString(model.getValidationError().size()))).append("\n\n"); model.getValidationError().forEach(error -> log.append( format(resourceBundle.getString("log.message"), error.getLineNumber().toString(), error.getColumn(),
// Path: src/main/java/ninja/javafx/smartcsv/fx/table/model/CSVModel.java // public final class CSVModel implements ColumnValueProvider { // // private static final Logger logger = LogManager.getLogger(CSVModel.class); // // private Validator validator; // private ObservableList<CSVRow> rows = FXCollections.observableArrayList(); // private String[] header; // private ObservableList<ValidationError> validationError = FXCollections.observableArrayList(); // private RevalidationService revalidationService = new RevalidationService(); // // /** // * sets the validator configuration for the data revalidates // * // * @param validationConfiguration the validator configuration for this data // */ // public void setValidationConfiguration(ValidationConfiguration validationConfiguration) { // this.validator = new Validator(validationConfiguration, this); // revalidate(); // } // // /** // * returns the data as a list of rows of the // * // * @return list of rows // */ // public ObservableList<CSVRow> getRows() { // return rows; // } // // public ObservableList<ValidationError> getValidationError() { // return validationError; // } // // /** // * adds a new and empty row // * // * @return the new row // */ // public CSVRow addRow() { // CSVRow row = new CSVRow(); // row.setRowNumber(rows.size()); // rows.add(row); // return row; // } // // public void addValue(final CSVRow row, final String column, final String value) { // final CSVValue csvValue = row.addValue(column, value); // csvValue.valueProperty().addListener(observable -> { // if (validator.needsColumnValidation(column)) { // revalidate(); // } else { // csvValue.setValidationError(validator.isValid(row.getRowNumber(), column, csvValue.getValue())); // } // }); // } // // /** // * sets the column headers as string array // * // * @param header the headers of the columns // */ // public void setHeader(String[] header) { // this.header = header; // revalidate(); // } // // /** // * returns the column headers // * // * @return the column headers // */ // public String[] getHeader() { // return header; // } // // // public void revalidate(String column) { // if (!hasValidator()) return; // validator.reinitializeColumn(column); // revalidate(); // } // // /** // * walks through the data and validates each value // */ // public void revalidate() { // validationError.clear(); // // logger.info("revalidate: hasValidator -> {}", hasValidator()); // // if (!hasValidator()) return; // revalidationService.setHeader(header); // revalidationService.setRows(rows); // revalidationService.setValidator(validator); // revalidationService.setOnSucceeded(t -> validationError.setAll(revalidationService.getValue())); // revalidationService.setOnFailed(t -> logger.error("revalidation service failed!")); // revalidationService.restart(); // } // // private boolean hasValidator() { // return validator != null && validator.hasConfig(); // } // // public ValidationConfiguration createValidationConfiguration() { // ValidationConfiguration newValidationConfiguration = new ValidationConfiguration(); // newValidationConfiguration.setHeaderNames(this.header); // this.validator = new Validator(newValidationConfiguration, this); // this.revalidate(); // return newValidationConfiguration; // } // // // @Override // public String getValue(int row, String column) { // return rows.get(row).getColumns().get(column).getValue().getValue(); // } // // @Override // public int getNumberOfRows() { // return rows.size(); // } // } // // Path: src/main/java/ninja/javafx/smartcsv/fx/util/I18nValidationUtil.java // public static String getI18nValidatioMessage(ResourceBundle resourceBundle, List<ValidationError> errors) { // // StringWriter message = new StringWriter(); // errors.forEach(error -> message.append(getI18nValidatioMessage(resourceBundle, error)).append("\n")); // // // if (message.toString().length() != 0) { // return cutOffLastLineBreak(message.toString()); // } // // return ""; // } // Path: src/main/java/ninja/javafx/smartcsv/export/ErrorExport.java import java.io.File; import java.io.StringWriter; import java.nio.file.Files; import java.util.ResourceBundle; import static java.text.MessageFormat.format; import static ninja.javafx.smartcsv.fx.util.I18nValidationUtil.getI18nValidatioMessage; import javafx.concurrent.Service; import javafx.concurrent.Task; import ninja.javafx.smartcsv.fx.table.model.CSVModel; } public void setResourceBundle(ResourceBundle resourceBundle) { this.resourceBundle = resourceBundle; } public void setModel(CSVModel model) { this.model = model; } public void setFile(File file) { this.file = file; } @Override protected Task createTask() { return new Task() { @Override protected Void call() throws Exception { try { StringWriter log = new StringWriter(); log.append( format(resourceBundle.getString("log.header.message"), csvFilename, Integer.toString(model.getValidationError().size()))).append("\n\n"); model.getValidationError().forEach(error -> log.append( format(resourceBundle.getString("log.message"), error.getLineNumber().toString(), error.getColumn(),
getI18nValidatioMessage(resourceBundle, error))).append("\n")
frosch95/SmartCSV.fx
src/main/java/ninja/javafx/smartcsv/fx/SmartCSV.java
// Path: src/main/java/ninja/javafx/smartcsv/fx/about/AboutController.java // @Component // public class AboutController extends FXMLController { // // private HostServices hostServices; // // @Value("${fxml.smartcvs.about.view}") // @Override // public void setFxmlFilePath(String filePath) { // this.fxmlFilePath = filePath; // } // // @Override // public void initialize(URL location, ResourceBundle resources) { // // } // // @FXML // public void openLinkInBrowser(ActionEvent actionEvent) { // Hyperlink hyperlink = (Hyperlink)actionEvent.getSource(); // hostServices.showDocument(hyperlink.getText()); // } // // public void setHostServices(HostServices hostServices) { // this.hostServices = hostServices; // } // }
import javafx.scene.image.Image; import javafx.stage.Stage; import ninja.javafx.smartcsv.fx.about.AboutController; import org.springframework.context.annotation.*; import org.springframework.context.support.PropertySourcesPlaceholderConfigurer; import static javafx.application.Platform.exit; import javafx.application.Application; import javafx.application.Platform; import javafx.scene.Parent; import javafx.scene.Scene;
/* The MIT License (MIT) ----------------------------------------------------------------------------- Copyright (c) 2015-2021 javafx.ninja <info@javafx.ninja> Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ package ninja.javafx.smartcsv.fx; @Configuration @ComponentScan("ninja.javafx") @PropertySource(value = "classpath:/ninja/javafx/smartcsv/fx/application.properties") public class SmartCSV extends Application { private AnnotationConfigApplicationContext appContext; @Override public void start(Stage primaryStage) throws Exception { appContext = new AnnotationConfigApplicationContext(SmartCSV.class); String name = appContext.getEnvironment().getProperty("application.name"); String version = appContext.getEnvironment().getProperty("application.version"); Platform.setImplicitExit(false);
// Path: src/main/java/ninja/javafx/smartcsv/fx/about/AboutController.java // @Component // public class AboutController extends FXMLController { // // private HostServices hostServices; // // @Value("${fxml.smartcvs.about.view}") // @Override // public void setFxmlFilePath(String filePath) { // this.fxmlFilePath = filePath; // } // // @Override // public void initialize(URL location, ResourceBundle resources) { // // } // // @FXML // public void openLinkInBrowser(ActionEvent actionEvent) { // Hyperlink hyperlink = (Hyperlink)actionEvent.getSource(); // hostServices.showDocument(hyperlink.getText()); // } // // public void setHostServices(HostServices hostServices) { // this.hostServices = hostServices; // } // } // Path: src/main/java/ninja/javafx/smartcsv/fx/SmartCSV.java import javafx.scene.image.Image; import javafx.stage.Stage; import ninja.javafx.smartcsv.fx.about.AboutController; import org.springframework.context.annotation.*; import org.springframework.context.support.PropertySourcesPlaceholderConfigurer; import static javafx.application.Platform.exit; import javafx.application.Application; import javafx.application.Platform; import javafx.scene.Parent; import javafx.scene.Scene; /* The MIT License (MIT) ----------------------------------------------------------------------------- Copyright (c) 2015-2021 javafx.ninja <info@javafx.ninja> Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ package ninja.javafx.smartcsv.fx; @Configuration @ComponentScan("ninja.javafx") @PropertySource(value = "classpath:/ninja/javafx/smartcsv/fx/application.properties") public class SmartCSV extends Application { private AnnotationConfigApplicationContext appContext; @Override public void start(Stage primaryStage) throws Exception { appContext = new AnnotationConfigApplicationContext(SmartCSV.class); String name = appContext.getEnvironment().getProperty("application.name"); String version = appContext.getEnvironment().getProperty("application.version"); Platform.setImplicitExit(false);
AboutController aboutController = appContext.getBean(AboutController.class);
frosch95/SmartCSV.fx
src/main/java/ninja/javafx/smartcsv/validation/checker/UriValidation.java
// Path: src/main/java/ninja/javafx/smartcsv/validation/ValidationError.java // public class ValidationError { // // private List<ValidationMessage> messages = new ArrayList<>(); // private Integer lineNumber; // private String column = ""; // // private ValidationError(Integer lineNumber) { // this.lineNumber = lineNumber; // } // // public static ValidationError withLineNumber(int lineNumber) { // return new ValidationError(lineNumber); // } // // public static ValidationError withoutLineNumber() { // return new ValidationError(-1); // } // // public ValidationError column(String column) { // this.column = column; // return this; // } // // public Integer getLineNumber() { // return lineNumber; // } // // public String getColumn() { // return column; // } // // public List<ValidationMessage> getMessages() { // return messages; // } // // public ValidationError add(String key, String... parameters) { // messages.add(new ValidationMessage(key, parameters)); // return this; // } // // public boolean isEmpty() { // return messages.isEmpty(); // } // }
import ninja.javafx.smartcsv.validation.ValidationError; import java.net.URI; import java.net.URISyntaxException;
/* The MIT License (MIT) ----------------------------------------------------------------------------- Copyright (c) 2015-2021 javafx.ninja <info@javafx.ninja> Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ package ninja.javafx.smartcsv.validation.checker; /** * checks if the value is a valid uri address */ public class UriValidation extends EmptyValueIsValid { @Override
// Path: src/main/java/ninja/javafx/smartcsv/validation/ValidationError.java // public class ValidationError { // // private List<ValidationMessage> messages = new ArrayList<>(); // private Integer lineNumber; // private String column = ""; // // private ValidationError(Integer lineNumber) { // this.lineNumber = lineNumber; // } // // public static ValidationError withLineNumber(int lineNumber) { // return new ValidationError(lineNumber); // } // // public static ValidationError withoutLineNumber() { // return new ValidationError(-1); // } // // public ValidationError column(String column) { // this.column = column; // return this; // } // // public Integer getLineNumber() { // return lineNumber; // } // // public String getColumn() { // return column; // } // // public List<ValidationMessage> getMessages() { // return messages; // } // // public ValidationError add(String key, String... parameters) { // messages.add(new ValidationMessage(key, parameters)); // return this; // } // // public boolean isEmpty() { // return messages.isEmpty(); // } // } // Path: src/main/java/ninja/javafx/smartcsv/validation/checker/UriValidation.java import ninja.javafx.smartcsv.validation.ValidationError; import java.net.URI; import java.net.URISyntaxException; /* The MIT License (MIT) ----------------------------------------------------------------------------- Copyright (c) 2015-2021 javafx.ninja <info@javafx.ninja> Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ package ninja.javafx.smartcsv.validation.checker; /** * checks if the value is a valid uri address */ public class UriValidation extends EmptyValueIsValid { @Override
public void check(int row, String value, ValidationError error) {
frosch95/SmartCSV.fx
src/main/java/ninja/javafx/smartcsv/validation/checker/BinaryValidation.java
// Path: src/main/java/ninja/javafx/smartcsv/validation/ValidationError.java // public class ValidationError { // // private List<ValidationMessage> messages = new ArrayList<>(); // private Integer lineNumber; // private String column = ""; // // private ValidationError(Integer lineNumber) { // this.lineNumber = lineNumber; // } // // public static ValidationError withLineNumber(int lineNumber) { // return new ValidationError(lineNumber); // } // // public static ValidationError withoutLineNumber() { // return new ValidationError(-1); // } // // public ValidationError column(String column) { // this.column = column; // return this; // } // // public Integer getLineNumber() { // return lineNumber; // } // // public String getColumn() { // return column; // } // // public List<ValidationMessage> getMessages() { // return messages; // } // // public ValidationError add(String key, String... parameters) { // messages.add(new ValidationMessage(key, parameters)); // return this; // } // // public boolean isEmpty() { // return messages.isEmpty(); // } // }
import ninja.javafx.smartcsv.validation.ValidationError; import java.util.Base64;
/* The MIT License (MIT) ----------------------------------------------------------------------------- Copyright (c) 2015-2021 javafx.ninja <info@javafx.ninja> Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ package ninja.javafx.smartcsv.validation.checker; /** * checks if the value is a base64 encoded string representing binary data */ public class BinaryValidation extends EmptyValueIsValid { @Override
// Path: src/main/java/ninja/javafx/smartcsv/validation/ValidationError.java // public class ValidationError { // // private List<ValidationMessage> messages = new ArrayList<>(); // private Integer lineNumber; // private String column = ""; // // private ValidationError(Integer lineNumber) { // this.lineNumber = lineNumber; // } // // public static ValidationError withLineNumber(int lineNumber) { // return new ValidationError(lineNumber); // } // // public static ValidationError withoutLineNumber() { // return new ValidationError(-1); // } // // public ValidationError column(String column) { // this.column = column; // return this; // } // // public Integer getLineNumber() { // return lineNumber; // } // // public String getColumn() { // return column; // } // // public List<ValidationMessage> getMessages() { // return messages; // } // // public ValidationError add(String key, String... parameters) { // messages.add(new ValidationMessage(key, parameters)); // return this; // } // // public boolean isEmpty() { // return messages.isEmpty(); // } // } // Path: src/main/java/ninja/javafx/smartcsv/validation/checker/BinaryValidation.java import ninja.javafx.smartcsv.validation.ValidationError; import java.util.Base64; /* The MIT License (MIT) ----------------------------------------------------------------------------- Copyright (c) 2015-2021 javafx.ninja <info@javafx.ninja> Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ package ninja.javafx.smartcsv.validation.checker; /** * checks if the value is a base64 encoded string representing binary data */ public class BinaryValidation extends EmptyValueIsValid { @Override
public void check(int row, String value, ValidationError error) {
frosch95/SmartCSV.fx
src/main/java/ninja/javafx/smartcsv/fx/table/EditableValidationCell.java
// Path: src/main/java/ninja/javafx/smartcsv/fx/table/model/CSVRow.java // public class CSVRow { // private ObservableMap<String, ObjectProperty<CSVValue>> columns = FXCollections.observableHashMap(); // private int rowNumber; // // /** // * sets the row number // * @param rowNumber // */ // public void setRowNumber(int rowNumber) { // this.rowNumber = rowNumber; // } // // /** // * return the row number // * @return row number // */ // public int getRowNumber() { // return rowNumber; // } // // // /** // * returns the columns with data as Map // * @return columns with data // */ // public ObservableMap<String, ObjectProperty<CSVValue>> getColumns() { // return columns; // } // // /** // * stores the given value in the given column of this row // * @param column column name // * @param value the value to store // */ // CSVValue addValue(String column, String value) { // CSVValue v = new CSVValue(); // v.setValue(value); // columns.put(column, new SimpleObjectProperty<>(v)); // return v; // } // // } // // Path: src/main/java/ninja/javafx/smartcsv/fx/table/model/CSVValue.java // public class CSVValue { // private StringProperty value = new SimpleStringProperty(); // private ValidationError valid; // // /** // * returns the real value // * @return the real value // */ // public String getValue() { // return value.get(); // } // // /** // * JavaFX property representation of the real value // * @return property of real value // */ // public StringProperty valueProperty() { // return value; // } // // /** // * sets the real value // * @param value the real value // */ // public void setValue(String value) { // this.value.set(value); // } // // /** // * returns if the value is valid to the rules of the validator // * @return // */ // public ValidationError getValidationError() { // return valid; // } // // /** // * sets the state if a value is valid or not // * @param valid the validation state // */ // public void setValidationError(ValidationError valid) { // this.valid = valid; // } // } // // Path: src/main/java/ninja/javafx/smartcsv/fx/util/ColorConstants.java // public static final String ERROR_COLOR = "#ff3333"; // // Path: src/main/java/ninja/javafx/smartcsv/fx/util/I18nValidationUtil.java // public static String getI18nValidatioMessage(ResourceBundle resourceBundle, List<ValidationError> errors) { // // StringWriter message = new StringWriter(); // errors.forEach(error -> message.append(getI18nValidatioMessage(resourceBundle, error)).append("\n")); // // // if (message.toString().length() != 0) { // return cutOffLastLineBreak(message.toString()); // } // // return ""; // }
import javafx.scene.input.KeyCode; import ninja.javafx.smartcsv.fx.table.model.CSVRow; import ninja.javafx.smartcsv.fx.table.model.CSVValue; import java.util.ResourceBundle; import static javafx.application.Platform.runLater; import static ninja.javafx.smartcsv.fx.util.ColorConstants.ERROR_COLOR; import static ninja.javafx.smartcsv.fx.util.I18nValidationUtil.getI18nValidatioMessage; import javafx.scene.control.ContentDisplay; import javafx.scene.control.TableCell; import javafx.scene.control.TextField; import javafx.scene.control.Tooltip;
/* The MIT License (MIT) ----------------------------------------------------------------------------- Copyright (c) 2015-2021 javafx.ninja <info@javafx.ninja> Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ package ninja.javafx.smartcsv.fx.table; /** * cell representation which indicates if a cell is valid and not * and allows editing */ public class EditableValidationCell extends TableCell<CSVRow, CSVValue> { private ValueTextField textField; private ResourceBundle resourceBundle; public EditableValidationCell(ResourceBundle resourceBundle) { this.resourceBundle = resourceBundle; } @Override public void startEdit() { super.startEdit(); setTextField(); runLater(() -> { textField.requestFocus(); textField.selectAll(); }); } @Override public void cancelEdit() { super.cancelEdit(); setText(getItem().getValue()); setContentDisplay(ContentDisplay.TEXT_ONLY); } @Override protected void updateItem(CSVValue item, boolean empty) { super.updateItem(item, empty); if (item == null || item.getValidationError() == null || isEditing()) { setStyle(""); setTooltip(null); } else if (item.getValidationError() != null) {
// Path: src/main/java/ninja/javafx/smartcsv/fx/table/model/CSVRow.java // public class CSVRow { // private ObservableMap<String, ObjectProperty<CSVValue>> columns = FXCollections.observableHashMap(); // private int rowNumber; // // /** // * sets the row number // * @param rowNumber // */ // public void setRowNumber(int rowNumber) { // this.rowNumber = rowNumber; // } // // /** // * return the row number // * @return row number // */ // public int getRowNumber() { // return rowNumber; // } // // // /** // * returns the columns with data as Map // * @return columns with data // */ // public ObservableMap<String, ObjectProperty<CSVValue>> getColumns() { // return columns; // } // // /** // * stores the given value in the given column of this row // * @param column column name // * @param value the value to store // */ // CSVValue addValue(String column, String value) { // CSVValue v = new CSVValue(); // v.setValue(value); // columns.put(column, new SimpleObjectProperty<>(v)); // return v; // } // // } // // Path: src/main/java/ninja/javafx/smartcsv/fx/table/model/CSVValue.java // public class CSVValue { // private StringProperty value = new SimpleStringProperty(); // private ValidationError valid; // // /** // * returns the real value // * @return the real value // */ // public String getValue() { // return value.get(); // } // // /** // * JavaFX property representation of the real value // * @return property of real value // */ // public StringProperty valueProperty() { // return value; // } // // /** // * sets the real value // * @param value the real value // */ // public void setValue(String value) { // this.value.set(value); // } // // /** // * returns if the value is valid to the rules of the validator // * @return // */ // public ValidationError getValidationError() { // return valid; // } // // /** // * sets the state if a value is valid or not // * @param valid the validation state // */ // public void setValidationError(ValidationError valid) { // this.valid = valid; // } // } // // Path: src/main/java/ninja/javafx/smartcsv/fx/util/ColorConstants.java // public static final String ERROR_COLOR = "#ff3333"; // // Path: src/main/java/ninja/javafx/smartcsv/fx/util/I18nValidationUtil.java // public static String getI18nValidatioMessage(ResourceBundle resourceBundle, List<ValidationError> errors) { // // StringWriter message = new StringWriter(); // errors.forEach(error -> message.append(getI18nValidatioMessage(resourceBundle, error)).append("\n")); // // // if (message.toString().length() != 0) { // return cutOffLastLineBreak(message.toString()); // } // // return ""; // } // Path: src/main/java/ninja/javafx/smartcsv/fx/table/EditableValidationCell.java import javafx.scene.input.KeyCode; import ninja.javafx.smartcsv.fx.table.model.CSVRow; import ninja.javafx.smartcsv.fx.table.model.CSVValue; import java.util.ResourceBundle; import static javafx.application.Platform.runLater; import static ninja.javafx.smartcsv.fx.util.ColorConstants.ERROR_COLOR; import static ninja.javafx.smartcsv.fx.util.I18nValidationUtil.getI18nValidatioMessage; import javafx.scene.control.ContentDisplay; import javafx.scene.control.TableCell; import javafx.scene.control.TextField; import javafx.scene.control.Tooltip; /* The MIT License (MIT) ----------------------------------------------------------------------------- Copyright (c) 2015-2021 javafx.ninja <info@javafx.ninja> Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ package ninja.javafx.smartcsv.fx.table; /** * cell representation which indicates if a cell is valid and not * and allows editing */ public class EditableValidationCell extends TableCell<CSVRow, CSVValue> { private ValueTextField textField; private ResourceBundle resourceBundle; public EditableValidationCell(ResourceBundle resourceBundle) { this.resourceBundle = resourceBundle; } @Override public void startEdit() { super.startEdit(); setTextField(); runLater(() -> { textField.requestFocus(); textField.selectAll(); }); } @Override public void cancelEdit() { super.cancelEdit(); setText(getItem().getValue()); setContentDisplay(ContentDisplay.TEXT_ONLY); } @Override protected void updateItem(CSVValue item, boolean empty) { super.updateItem(item, empty); if (item == null || item.getValidationError() == null || isEditing()) { setStyle(""); setTooltip(null); } else if (item.getValidationError() != null) {
setStyle("-fx-background-color: derive("+ ERROR_COLOR +", 30%)");
frosch95/SmartCSV.fx
src/main/java/ninja/javafx/smartcsv/fx/table/EditableValidationCell.java
// Path: src/main/java/ninja/javafx/smartcsv/fx/table/model/CSVRow.java // public class CSVRow { // private ObservableMap<String, ObjectProperty<CSVValue>> columns = FXCollections.observableHashMap(); // private int rowNumber; // // /** // * sets the row number // * @param rowNumber // */ // public void setRowNumber(int rowNumber) { // this.rowNumber = rowNumber; // } // // /** // * return the row number // * @return row number // */ // public int getRowNumber() { // return rowNumber; // } // // // /** // * returns the columns with data as Map // * @return columns with data // */ // public ObservableMap<String, ObjectProperty<CSVValue>> getColumns() { // return columns; // } // // /** // * stores the given value in the given column of this row // * @param column column name // * @param value the value to store // */ // CSVValue addValue(String column, String value) { // CSVValue v = new CSVValue(); // v.setValue(value); // columns.put(column, new SimpleObjectProperty<>(v)); // return v; // } // // } // // Path: src/main/java/ninja/javafx/smartcsv/fx/table/model/CSVValue.java // public class CSVValue { // private StringProperty value = new SimpleStringProperty(); // private ValidationError valid; // // /** // * returns the real value // * @return the real value // */ // public String getValue() { // return value.get(); // } // // /** // * JavaFX property representation of the real value // * @return property of real value // */ // public StringProperty valueProperty() { // return value; // } // // /** // * sets the real value // * @param value the real value // */ // public void setValue(String value) { // this.value.set(value); // } // // /** // * returns if the value is valid to the rules of the validator // * @return // */ // public ValidationError getValidationError() { // return valid; // } // // /** // * sets the state if a value is valid or not // * @param valid the validation state // */ // public void setValidationError(ValidationError valid) { // this.valid = valid; // } // } // // Path: src/main/java/ninja/javafx/smartcsv/fx/util/ColorConstants.java // public static final String ERROR_COLOR = "#ff3333"; // // Path: src/main/java/ninja/javafx/smartcsv/fx/util/I18nValidationUtil.java // public static String getI18nValidatioMessage(ResourceBundle resourceBundle, List<ValidationError> errors) { // // StringWriter message = new StringWriter(); // errors.forEach(error -> message.append(getI18nValidatioMessage(resourceBundle, error)).append("\n")); // // // if (message.toString().length() != 0) { // return cutOffLastLineBreak(message.toString()); // } // // return ""; // }
import javafx.scene.input.KeyCode; import ninja.javafx.smartcsv.fx.table.model.CSVRow; import ninja.javafx.smartcsv.fx.table.model.CSVValue; import java.util.ResourceBundle; import static javafx.application.Platform.runLater; import static ninja.javafx.smartcsv.fx.util.ColorConstants.ERROR_COLOR; import static ninja.javafx.smartcsv.fx.util.I18nValidationUtil.getI18nValidatioMessage; import javafx.scene.control.ContentDisplay; import javafx.scene.control.TableCell; import javafx.scene.control.TextField; import javafx.scene.control.Tooltip;
/* The MIT License (MIT) ----------------------------------------------------------------------------- Copyright (c) 2015-2021 javafx.ninja <info@javafx.ninja> Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ package ninja.javafx.smartcsv.fx.table; /** * cell representation which indicates if a cell is valid and not * and allows editing */ public class EditableValidationCell extends TableCell<CSVRow, CSVValue> { private ValueTextField textField; private ResourceBundle resourceBundle; public EditableValidationCell(ResourceBundle resourceBundle) { this.resourceBundle = resourceBundle; } @Override public void startEdit() { super.startEdit(); setTextField(); runLater(() -> { textField.requestFocus(); textField.selectAll(); }); } @Override public void cancelEdit() { super.cancelEdit(); setText(getItem().getValue()); setContentDisplay(ContentDisplay.TEXT_ONLY); } @Override protected void updateItem(CSVValue item, boolean empty) { super.updateItem(item, empty); if (item == null || item.getValidationError() == null || isEditing()) { setStyle(""); setTooltip(null); } else if (item.getValidationError() != null) { setStyle("-fx-background-color: derive("+ ERROR_COLOR +", 30%)");
// Path: src/main/java/ninja/javafx/smartcsv/fx/table/model/CSVRow.java // public class CSVRow { // private ObservableMap<String, ObjectProperty<CSVValue>> columns = FXCollections.observableHashMap(); // private int rowNumber; // // /** // * sets the row number // * @param rowNumber // */ // public void setRowNumber(int rowNumber) { // this.rowNumber = rowNumber; // } // // /** // * return the row number // * @return row number // */ // public int getRowNumber() { // return rowNumber; // } // // // /** // * returns the columns with data as Map // * @return columns with data // */ // public ObservableMap<String, ObjectProperty<CSVValue>> getColumns() { // return columns; // } // // /** // * stores the given value in the given column of this row // * @param column column name // * @param value the value to store // */ // CSVValue addValue(String column, String value) { // CSVValue v = new CSVValue(); // v.setValue(value); // columns.put(column, new SimpleObjectProperty<>(v)); // return v; // } // // } // // Path: src/main/java/ninja/javafx/smartcsv/fx/table/model/CSVValue.java // public class CSVValue { // private StringProperty value = new SimpleStringProperty(); // private ValidationError valid; // // /** // * returns the real value // * @return the real value // */ // public String getValue() { // return value.get(); // } // // /** // * JavaFX property representation of the real value // * @return property of real value // */ // public StringProperty valueProperty() { // return value; // } // // /** // * sets the real value // * @param value the real value // */ // public void setValue(String value) { // this.value.set(value); // } // // /** // * returns if the value is valid to the rules of the validator // * @return // */ // public ValidationError getValidationError() { // return valid; // } // // /** // * sets the state if a value is valid or not // * @param valid the validation state // */ // public void setValidationError(ValidationError valid) { // this.valid = valid; // } // } // // Path: src/main/java/ninja/javafx/smartcsv/fx/util/ColorConstants.java // public static final String ERROR_COLOR = "#ff3333"; // // Path: src/main/java/ninja/javafx/smartcsv/fx/util/I18nValidationUtil.java // public static String getI18nValidatioMessage(ResourceBundle resourceBundle, List<ValidationError> errors) { // // StringWriter message = new StringWriter(); // errors.forEach(error -> message.append(getI18nValidatioMessage(resourceBundle, error)).append("\n")); // // // if (message.toString().length() != 0) { // return cutOffLastLineBreak(message.toString()); // } // // return ""; // } // Path: src/main/java/ninja/javafx/smartcsv/fx/table/EditableValidationCell.java import javafx.scene.input.KeyCode; import ninja.javafx.smartcsv.fx.table.model.CSVRow; import ninja.javafx.smartcsv.fx.table.model.CSVValue; import java.util.ResourceBundle; import static javafx.application.Platform.runLater; import static ninja.javafx.smartcsv.fx.util.ColorConstants.ERROR_COLOR; import static ninja.javafx.smartcsv.fx.util.I18nValidationUtil.getI18nValidatioMessage; import javafx.scene.control.ContentDisplay; import javafx.scene.control.TableCell; import javafx.scene.control.TextField; import javafx.scene.control.Tooltip; /* The MIT License (MIT) ----------------------------------------------------------------------------- Copyright (c) 2015-2021 javafx.ninja <info@javafx.ninja> Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ package ninja.javafx.smartcsv.fx.table; /** * cell representation which indicates if a cell is valid and not * and allows editing */ public class EditableValidationCell extends TableCell<CSVRow, CSVValue> { private ValueTextField textField; private ResourceBundle resourceBundle; public EditableValidationCell(ResourceBundle resourceBundle) { this.resourceBundle = resourceBundle; } @Override public void startEdit() { super.startEdit(); setTextField(); runLater(() -> { textField.requestFocus(); textField.selectAll(); }); } @Override public void cancelEdit() { super.cancelEdit(); setText(getItem().getValue()); setContentDisplay(ContentDisplay.TEXT_ONLY); } @Override protected void updateItem(CSVValue item, boolean empty) { super.updateItem(item, empty); if (item == null || item.getValidationError() == null || isEditing()) { setStyle(""); setTooltip(null); } else if (item.getValidationError() != null) { setStyle("-fx-background-color: derive("+ ERROR_COLOR +", 30%)");
setTooltip(new Tooltip(getI18nValidatioMessage(resourceBundle, item.getValidationError())));
frosch95/SmartCSV.fx
src/main/java/ninja/javafx/smartcsv/fx/table/model/CSVValue.java
// Path: src/main/java/ninja/javafx/smartcsv/validation/ValidationError.java // public class ValidationError { // // private List<ValidationMessage> messages = new ArrayList<>(); // private Integer lineNumber; // private String column = ""; // // private ValidationError(Integer lineNumber) { // this.lineNumber = lineNumber; // } // // public static ValidationError withLineNumber(int lineNumber) { // return new ValidationError(lineNumber); // } // // public static ValidationError withoutLineNumber() { // return new ValidationError(-1); // } // // public ValidationError column(String column) { // this.column = column; // return this; // } // // public Integer getLineNumber() { // return lineNumber; // } // // public String getColumn() { // return column; // } // // public List<ValidationMessage> getMessages() { // return messages; // } // // public ValidationError add(String key, String... parameters) { // messages.add(new ValidationMessage(key, parameters)); // return this; // } // // public boolean isEmpty() { // return messages.isEmpty(); // } // }
import javafx.beans.property.SimpleStringProperty; import javafx.beans.property.StringProperty; import ninja.javafx.smartcsv.validation.ValidationError;
/* The MIT License (MIT) ----------------------------------------------------------------------------- Copyright (c) 2015-2021 javafx.ninja <info@javafx.ninja> Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ package ninja.javafx.smartcsv.fx.table.model; /** * The csv value represents the value of a single cell. * It also knows about the position (row and column) * and if the value is valid based on the validator. */ public class CSVValue { private StringProperty value = new SimpleStringProperty();
// Path: src/main/java/ninja/javafx/smartcsv/validation/ValidationError.java // public class ValidationError { // // private List<ValidationMessage> messages = new ArrayList<>(); // private Integer lineNumber; // private String column = ""; // // private ValidationError(Integer lineNumber) { // this.lineNumber = lineNumber; // } // // public static ValidationError withLineNumber(int lineNumber) { // return new ValidationError(lineNumber); // } // // public static ValidationError withoutLineNumber() { // return new ValidationError(-1); // } // // public ValidationError column(String column) { // this.column = column; // return this; // } // // public Integer getLineNumber() { // return lineNumber; // } // // public String getColumn() { // return column; // } // // public List<ValidationMessage> getMessages() { // return messages; // } // // public ValidationError add(String key, String... parameters) { // messages.add(new ValidationMessage(key, parameters)); // return this; // } // // public boolean isEmpty() { // return messages.isEmpty(); // } // } // Path: src/main/java/ninja/javafx/smartcsv/fx/table/model/CSVValue.java import javafx.beans.property.SimpleStringProperty; import javafx.beans.property.StringProperty; import ninja.javafx.smartcsv.validation.ValidationError; /* The MIT License (MIT) ----------------------------------------------------------------------------- Copyright (c) 2015-2021 javafx.ninja <info@javafx.ninja> Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ package ninja.javafx.smartcsv.fx.table.model; /** * The csv value represents the value of a single cell. * It also knows about the position (row and column) * and if the value is valid based on the validator. */ public class CSVValue { private StringProperty value = new SimpleStringProperty();
private ValidationError valid;
frosch95/SmartCSV.fx
src/main/java/ninja/javafx/smartcsv/validation/checker/DoubleValidation.java
// Path: src/main/java/ninja/javafx/smartcsv/validation/ValidationError.java // public class ValidationError { // // private List<ValidationMessage> messages = new ArrayList<>(); // private Integer lineNumber; // private String column = ""; // // private ValidationError(Integer lineNumber) { // this.lineNumber = lineNumber; // } // // public static ValidationError withLineNumber(int lineNumber) { // return new ValidationError(lineNumber); // } // // public static ValidationError withoutLineNumber() { // return new ValidationError(-1); // } // // public ValidationError column(String column) { // this.column = column; // return this; // } // // public Integer getLineNumber() { // return lineNumber; // } // // public String getColumn() { // return column; // } // // public List<ValidationMessage> getMessages() { // return messages; // } // // public ValidationError add(String key, String... parameters) { // messages.add(new ValidationMessage(key, parameters)); // return this; // } // // public boolean isEmpty() { // return messages.isEmpty(); // } // }
import ninja.javafx.smartcsv.validation.ValidationError; import static org.apache.commons.validator.GenericValidator.isDouble;
/* The MIT License (MIT) ----------------------------------------------------------------------------- Copyright (c) 2015-2021 javafx.ninja <info@javafx.ninja> Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ package ninja.javafx.smartcsv.validation.checker; /** * Checks if the value is a double */ public class DoubleValidation extends EmptyValueIsValid { @Override
// Path: src/main/java/ninja/javafx/smartcsv/validation/ValidationError.java // public class ValidationError { // // private List<ValidationMessage> messages = new ArrayList<>(); // private Integer lineNumber; // private String column = ""; // // private ValidationError(Integer lineNumber) { // this.lineNumber = lineNumber; // } // // public static ValidationError withLineNumber(int lineNumber) { // return new ValidationError(lineNumber); // } // // public static ValidationError withoutLineNumber() { // return new ValidationError(-1); // } // // public ValidationError column(String column) { // this.column = column; // return this; // } // // public Integer getLineNumber() { // return lineNumber; // } // // public String getColumn() { // return column; // } // // public List<ValidationMessage> getMessages() { // return messages; // } // // public ValidationError add(String key, String... parameters) { // messages.add(new ValidationMessage(key, parameters)); // return this; // } // // public boolean isEmpty() { // return messages.isEmpty(); // } // } // Path: src/main/java/ninja/javafx/smartcsv/validation/checker/DoubleValidation.java import ninja.javafx.smartcsv.validation.ValidationError; import static org.apache.commons.validator.GenericValidator.isDouble; /* The MIT License (MIT) ----------------------------------------------------------------------------- Copyright (c) 2015-2021 javafx.ninja <info@javafx.ninja> Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ package ninja.javafx.smartcsv.validation.checker; /** * Checks if the value is a double */ public class DoubleValidation extends EmptyValueIsValid { @Override
public void check(int row, String value, ValidationError error) {
frosch95/SmartCSV.fx
src/test/java/ninja/javafx/smartcsv/validation/ValidatorTest.java
// Path: src/main/java/ninja/javafx/smartcsv/validation/configuration/ValidationConfiguration.java // public class ValidationConfiguration { // // @SerializedName("fields") // private Field[] fields; // // public Field[] getFields() { // return fields; // } // // public void setFields(Field[] fields) { // this.fields = fields; // } // // public Field getFieldConfiguration(String column) { // for (Field field : fields) { // if (field.getName().equals(column)) { // return field; // } // } // return null; // } // // public String[] headerNames() { // if (fields != null) { // List<String> headerNames = new ArrayList<>(); // for (Field field : fields) { // headerNames.add(field.getName()); // } // return headerNames.toArray(new String[headerNames.size()]); // } // // return null; // } // // public void setHeaderNames(String[] header) { // fields = new Field[header.length]; // int i = 0; // for (String headerName: header) { // fields[i] = new Field(); // fields[i].setName(headerName); // i++; // } // } // }
import com.google.gson.Gson; import com.google.gson.GsonBuilder; import ninja.javafx.smartcsv.validation.configuration.ValidationConfiguration; import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.provider.Arguments; import org.junit.jupiter.params.provider.MethodSource; import java.util.List; import java.util.stream.Stream; import static java.util.Arrays.asList; import static java.util.stream.Collectors.joining; import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.Matchers.contains; import static org.hamcrest.Matchers.is;
package ninja.javafx.smartcsv.validation; /** * unit test for validator */ public class ValidatorTest { //////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // tests //////////////////////////////////////////////////////////////////////////////////////////////////////////////////// @ParameterizedTest @MethodSource("validationConfigurations") public void validation(String config, String value, Boolean expectedResult, ValidationMessage expectedError) { // setup Gson gson = new GsonBuilder().create();
// Path: src/main/java/ninja/javafx/smartcsv/validation/configuration/ValidationConfiguration.java // public class ValidationConfiguration { // // @SerializedName("fields") // private Field[] fields; // // public Field[] getFields() { // return fields; // } // // public void setFields(Field[] fields) { // this.fields = fields; // } // // public Field getFieldConfiguration(String column) { // for (Field field : fields) { // if (field.getName().equals(column)) { // return field; // } // } // return null; // } // // public String[] headerNames() { // if (fields != null) { // List<String> headerNames = new ArrayList<>(); // for (Field field : fields) { // headerNames.add(field.getName()); // } // return headerNames.toArray(new String[headerNames.size()]); // } // // return null; // } // // public void setHeaderNames(String[] header) { // fields = new Field[header.length]; // int i = 0; // for (String headerName: header) { // fields[i] = new Field(); // fields[i].setName(headerName); // i++; // } // } // } // Path: src/test/java/ninja/javafx/smartcsv/validation/ValidatorTest.java import com.google.gson.Gson; import com.google.gson.GsonBuilder; import ninja.javafx.smartcsv.validation.configuration.ValidationConfiguration; import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.provider.Arguments; import org.junit.jupiter.params.provider.MethodSource; import java.util.List; import java.util.stream.Stream; import static java.util.Arrays.asList; import static java.util.stream.Collectors.joining; import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.Matchers.contains; import static org.hamcrest.Matchers.is; package ninja.javafx.smartcsv.validation; /** * unit test for validator */ public class ValidatorTest { //////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // tests //////////////////////////////////////////////////////////////////////////////////////////////////////////////////// @ParameterizedTest @MethodSource("validationConfigurations") public void validation(String config, String value, Boolean expectedResult, ValidationMessage expectedError) { // setup Gson gson = new GsonBuilder().create();
ValidationConfiguration validationConfiguration = gson.fromJson(config, ValidationConfiguration.class);
frosch95/SmartCSV.fx
src/main/java/ninja/javafx/smartcsv/Main.java
// Path: src/main/java/ninja/javafx/smartcsv/fx/SmartCSV.java // @Configuration // @ComponentScan("ninja.javafx") // @PropertySource(value = "classpath:/ninja/javafx/smartcsv/fx/application.properties") // public class SmartCSV extends Application { // // private AnnotationConfigApplicationContext appContext; // // @Override // public void start(Stage primaryStage) throws Exception { // appContext = new AnnotationConfigApplicationContext(SmartCSV.class); // String name = appContext.getEnvironment().getProperty("application.name"); // String version = appContext.getEnvironment().getProperty("application.version"); // // Platform.setImplicitExit(false); // // AboutController aboutController = appContext.getBean(AboutController.class); // aboutController.setHostServices(getHostServices()); // // try { // showUI(primaryStage, name, version); // } catch (Exception e) { // e.printStackTrace(); // } // // } // // @Bean // public static PropertySourcesPlaceholderConfigurer placeholderConfigurer() { // return new PropertySourcesPlaceholderConfigurer(); // } // // @Override // public void stop() throws Exception { // if (appContext != null) { // appContext.close(); // } // // super.stop(); // } // // public static void main(String[] args) { // launch(args); // } // // private void showUI(Stage primaryStage, String name, String version) { // SmartCSVController smartCVSController = appContext.getBean(SmartCSVController.class); // Scene scene = new Scene((Parent) smartCVSController.getView()); // var defaultThemeCss = getClass().getResource("/ninja/javafx/smartcsv/fx/smartcsv.css").toExternalForm(); // scene.getRoot().getStylesheets().add(defaultThemeCss); // // primaryStage.setScene(scene); // primaryStage.setTitle(String.format("%s %s", name, version)); // primaryStage.getIcons().add(new Image(SmartCSV.class.getResourceAsStream("/ninja/javafx/smartcsv/icon/logo.png"))); // primaryStage.show(); // primaryStage.setMaximized(true); // // primaryStage.setOnCloseRequest(event -> { // if (!smartCVSController.canExit()) { // event.consume(); // } else { // exit(); // } // }); // } // // }
import ninja.javafx.smartcsv.fx.SmartCSV;
/* The MIT License (MIT) ----------------------------------------------------------------------------- Copyright (c) 2015-2021 javafx.ninja <info@javafx.ninja> Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ package ninja.javafx.smartcsv; public class Main { public static void main(String[] args) { // workaround for module problem
// Path: src/main/java/ninja/javafx/smartcsv/fx/SmartCSV.java // @Configuration // @ComponentScan("ninja.javafx") // @PropertySource(value = "classpath:/ninja/javafx/smartcsv/fx/application.properties") // public class SmartCSV extends Application { // // private AnnotationConfigApplicationContext appContext; // // @Override // public void start(Stage primaryStage) throws Exception { // appContext = new AnnotationConfigApplicationContext(SmartCSV.class); // String name = appContext.getEnvironment().getProperty("application.name"); // String version = appContext.getEnvironment().getProperty("application.version"); // // Platform.setImplicitExit(false); // // AboutController aboutController = appContext.getBean(AboutController.class); // aboutController.setHostServices(getHostServices()); // // try { // showUI(primaryStage, name, version); // } catch (Exception e) { // e.printStackTrace(); // } // // } // // @Bean // public static PropertySourcesPlaceholderConfigurer placeholderConfigurer() { // return new PropertySourcesPlaceholderConfigurer(); // } // // @Override // public void stop() throws Exception { // if (appContext != null) { // appContext.close(); // } // // super.stop(); // } // // public static void main(String[] args) { // launch(args); // } // // private void showUI(Stage primaryStage, String name, String version) { // SmartCSVController smartCVSController = appContext.getBean(SmartCSVController.class); // Scene scene = new Scene((Parent) smartCVSController.getView()); // var defaultThemeCss = getClass().getResource("/ninja/javafx/smartcsv/fx/smartcsv.css").toExternalForm(); // scene.getRoot().getStylesheets().add(defaultThemeCss); // // primaryStage.setScene(scene); // primaryStage.setTitle(String.format("%s %s", name, version)); // primaryStage.getIcons().add(new Image(SmartCSV.class.getResourceAsStream("/ninja/javafx/smartcsv/icon/logo.png"))); // primaryStage.show(); // primaryStage.setMaximized(true); // // primaryStage.setOnCloseRequest(event -> { // if (!smartCVSController.canExit()) { // event.consume(); // } else { // exit(); // } // }); // } // // } // Path: src/main/java/ninja/javafx/smartcsv/Main.java import ninja.javafx.smartcsv.fx.SmartCSV; /* The MIT License (MIT) ----------------------------------------------------------------------------- Copyright (c) 2015-2021 javafx.ninja <info@javafx.ninja> Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ package ninja.javafx.smartcsv; public class Main { public static void main(String[] args) { // workaround for module problem
SmartCSV.main(args);
frosch95/SmartCSV.fx
src/main/java/ninja/javafx/smartcsv/validation/checker/MinLengthValidation.java
// Path: src/main/java/ninja/javafx/smartcsv/validation/ValidationError.java // public class ValidationError { // // private List<ValidationMessage> messages = new ArrayList<>(); // private Integer lineNumber; // private String column = ""; // // private ValidationError(Integer lineNumber) { // this.lineNumber = lineNumber; // } // // public static ValidationError withLineNumber(int lineNumber) { // return new ValidationError(lineNumber); // } // // public static ValidationError withoutLineNumber() { // return new ValidationError(-1); // } // // public ValidationError column(String column) { // this.column = column; // return this; // } // // public Integer getLineNumber() { // return lineNumber; // } // // public String getColumn() { // return column; // } // // public List<ValidationMessage> getMessages() { // return messages; // } // // public ValidationError add(String key, String... parameters) { // messages.add(new ValidationMessage(key, parameters)); // return this; // } // // public boolean isEmpty() { // return messages.isEmpty(); // } // }
import ninja.javafx.smartcsv.validation.ValidationError; import static org.apache.commons.validator.GenericValidator.minLength;
/* The MIT License (MIT) ----------------------------------------------------------------------------- Copyright (c) 2015-2021 javafx.ninja <info@javafx.ninja> Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ package ninja.javafx.smartcsv.validation.checker; /** * Checks if the value is at minimum long as the given min length */ public class MinLengthValidation extends EmptyValueIsValid { private int minLength; public MinLengthValidation(int minLength) { this.minLength = minLength; } @Override
// Path: src/main/java/ninja/javafx/smartcsv/validation/ValidationError.java // public class ValidationError { // // private List<ValidationMessage> messages = new ArrayList<>(); // private Integer lineNumber; // private String column = ""; // // private ValidationError(Integer lineNumber) { // this.lineNumber = lineNumber; // } // // public static ValidationError withLineNumber(int lineNumber) { // return new ValidationError(lineNumber); // } // // public static ValidationError withoutLineNumber() { // return new ValidationError(-1); // } // // public ValidationError column(String column) { // this.column = column; // return this; // } // // public Integer getLineNumber() { // return lineNumber; // } // // public String getColumn() { // return column; // } // // public List<ValidationMessage> getMessages() { // return messages; // } // // public ValidationError add(String key, String... parameters) { // messages.add(new ValidationMessage(key, parameters)); // return this; // } // // public boolean isEmpty() { // return messages.isEmpty(); // } // } // Path: src/main/java/ninja/javafx/smartcsv/validation/checker/MinLengthValidation.java import ninja.javafx.smartcsv.validation.ValidationError; import static org.apache.commons.validator.GenericValidator.minLength; /* The MIT License (MIT) ----------------------------------------------------------------------------- Copyright (c) 2015-2021 javafx.ninja <info@javafx.ninja> Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ package ninja.javafx.smartcsv.validation.checker; /** * Checks if the value is at minimum long as the given min length */ public class MinLengthValidation extends EmptyValueIsValid { private int minLength; public MinLengthValidation(int minLength) { this.minLength = minLength; } @Override
public void check(int row, String value, ValidationError error) {
frosch95/SmartCSV.fx
src/main/java/ninja/javafx/smartcsv/validation/checker/GroovyValidation.java
// Path: src/main/java/ninja/javafx/smartcsv/validation/ValidationError.java // public class ValidationError { // // private List<ValidationMessage> messages = new ArrayList<>(); // private Integer lineNumber; // private String column = ""; // // private ValidationError(Integer lineNumber) { // this.lineNumber = lineNumber; // } // // public static ValidationError withLineNumber(int lineNumber) { // return new ValidationError(lineNumber); // } // // public static ValidationError withoutLineNumber() { // return new ValidationError(-1); // } // // public ValidationError column(String column) { // this.column = column; // return this; // } // // public Integer getLineNumber() { // return lineNumber; // } // // public String getColumn() { // return column; // } // // public List<ValidationMessage> getMessages() { // return messages; // } // // public ValidationError add(String key, String... parameters) { // messages.add(new ValidationMessage(key, parameters)); // return this; // } // // public boolean isEmpty() { // return messages.isEmpty(); // } // }
import groovy.lang.Binding; import groovy.lang.GroovyShell; import groovy.lang.Script; import ninja.javafx.smartcsv.validation.ValidationError; import org.codehaus.groovy.control.CompilationFailedException;
/* The MIT License (MIT) ----------------------------------------------------------------------------- Copyright (c) 2015-2021 javafx.ninja <info@javafx.ninja> Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ package ninja.javafx.smartcsv.validation.checker; /** * Executes the given groovy as check */ public class GroovyValidation extends EmptyValueIsValid { private String groovyScript; private Script script; public GroovyValidation(String groovyScript) { this.groovyScript = groovyScript; GroovyShell shell = new GroovyShell(); script = shell.parse(groovyScript); } @Override
// Path: src/main/java/ninja/javafx/smartcsv/validation/ValidationError.java // public class ValidationError { // // private List<ValidationMessage> messages = new ArrayList<>(); // private Integer lineNumber; // private String column = ""; // // private ValidationError(Integer lineNumber) { // this.lineNumber = lineNumber; // } // // public static ValidationError withLineNumber(int lineNumber) { // return new ValidationError(lineNumber); // } // // public static ValidationError withoutLineNumber() { // return new ValidationError(-1); // } // // public ValidationError column(String column) { // this.column = column; // return this; // } // // public Integer getLineNumber() { // return lineNumber; // } // // public String getColumn() { // return column; // } // // public List<ValidationMessage> getMessages() { // return messages; // } // // public ValidationError add(String key, String... parameters) { // messages.add(new ValidationMessage(key, parameters)); // return this; // } // // public boolean isEmpty() { // return messages.isEmpty(); // } // } // Path: src/main/java/ninja/javafx/smartcsv/validation/checker/GroovyValidation.java import groovy.lang.Binding; import groovy.lang.GroovyShell; import groovy.lang.Script; import ninja.javafx.smartcsv.validation.ValidationError; import org.codehaus.groovy.control.CompilationFailedException; /* The MIT License (MIT) ----------------------------------------------------------------------------- Copyright (c) 2015-2021 javafx.ninja <info@javafx.ninja> Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ package ninja.javafx.smartcsv.validation.checker; /** * Executes the given groovy as check */ public class GroovyValidation extends EmptyValueIsValid { private String groovyScript; private Script script; public GroovyValidation(String groovyScript) { this.groovyScript = groovyScript; GroovyShell shell = new GroovyShell(); script = shell.parse(groovyScript); } @Override
public void check(int row, String value, ValidationError error) {
frosch95/SmartCSV.fx
src/main/java/ninja/javafx/smartcsv/files/FileStorage.java
// Path: src/main/java/ninja/javafx/smartcsv/FileReader.java // public interface FileReader<E> { // E getContent(); // void read(File filename) throws IOException; // } // // Path: src/main/java/ninja/javafx/smartcsv/FileWriter.java // public interface FileWriter<E> { // void setContent(E content); // void write(File filename) throws IOException; // }
import ninja.javafx.smartcsv.FileReader; import ninja.javafx.smartcsv.FileWriter; import java.io.File; import java.io.IOException; import javafx.beans.property.BooleanProperty; import javafx.beans.property.ObjectProperty; import javafx.beans.property.SimpleBooleanProperty; import javafx.beans.property.SimpleObjectProperty;
/* The MIT License (MIT) ----------------------------------------------------------------------------- Copyright (c) 2015-2021 javafx.ninja <info@javafx.ninja> Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ package ninja.javafx.smartcsv.files; /** * This class stores files and their state * @author abi */ public class FileStorage<E> { private FileReader<E> reader;
// Path: src/main/java/ninja/javafx/smartcsv/FileReader.java // public interface FileReader<E> { // E getContent(); // void read(File filename) throws IOException; // } // // Path: src/main/java/ninja/javafx/smartcsv/FileWriter.java // public interface FileWriter<E> { // void setContent(E content); // void write(File filename) throws IOException; // } // Path: src/main/java/ninja/javafx/smartcsv/files/FileStorage.java import ninja.javafx.smartcsv.FileReader; import ninja.javafx.smartcsv.FileWriter; import java.io.File; import java.io.IOException; import javafx.beans.property.BooleanProperty; import javafx.beans.property.ObjectProperty; import javafx.beans.property.SimpleBooleanProperty; import javafx.beans.property.SimpleObjectProperty; /* The MIT License (MIT) ----------------------------------------------------------------------------- Copyright (c) 2015-2021 javafx.ninja <info@javafx.ninja> Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ package ninja.javafx.smartcsv.files; /** * This class stores files and their state * @author abi */ public class FileStorage<E> { private FileReader<E> reader;
private FileWriter<E> writer;
frosch95/SmartCSV.fx
src/main/java/ninja/javafx/smartcsv/validation/checker/DateValidation.java
// Path: src/main/java/ninja/javafx/smartcsv/validation/ValidationError.java // public class ValidationError { // // private List<ValidationMessage> messages = new ArrayList<>(); // private Integer lineNumber; // private String column = ""; // // private ValidationError(Integer lineNumber) { // this.lineNumber = lineNumber; // } // // public static ValidationError withLineNumber(int lineNumber) { // return new ValidationError(lineNumber); // } // // public static ValidationError withoutLineNumber() { // return new ValidationError(-1); // } // // public ValidationError column(String column) { // this.column = column; // return this; // } // // public Integer getLineNumber() { // return lineNumber; // } // // public String getColumn() { // return column; // } // // public List<ValidationMessage> getMessages() { // return messages; // } // // public ValidationError add(String key, String... parameters) { // messages.add(new ValidationMessage(key, parameters)); // return this; // } // // public boolean isEmpty() { // return messages.isEmpty(); // } // }
import ninja.javafx.smartcsv.validation.ValidationError; import static org.apache.commons.validator.GenericValidator.isDate;
/* The MIT License (MIT) ----------------------------------------------------------------------------- Copyright (c) 2015-2021 javafx.ninja <info@javafx.ninja> Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ package ninja.javafx.smartcsv.validation.checker; /** * Checks if the date has the right format */ public class DateValidation extends EmptyValueIsValid { private String dateformat; public DateValidation(String dateformat) { assert dateformat != null && !dateformat.trim().isEmpty() : "empty date format for date validation"; this.dateformat = dateformat; } @Override
// Path: src/main/java/ninja/javafx/smartcsv/validation/ValidationError.java // public class ValidationError { // // private List<ValidationMessage> messages = new ArrayList<>(); // private Integer lineNumber; // private String column = ""; // // private ValidationError(Integer lineNumber) { // this.lineNumber = lineNumber; // } // // public static ValidationError withLineNumber(int lineNumber) { // return new ValidationError(lineNumber); // } // // public static ValidationError withoutLineNumber() { // return new ValidationError(-1); // } // // public ValidationError column(String column) { // this.column = column; // return this; // } // // public Integer getLineNumber() { // return lineNumber; // } // // public String getColumn() { // return column; // } // // public List<ValidationMessage> getMessages() { // return messages; // } // // public ValidationError add(String key, String... parameters) { // messages.add(new ValidationMessage(key, parameters)); // return this; // } // // public boolean isEmpty() { // return messages.isEmpty(); // } // } // Path: src/main/java/ninja/javafx/smartcsv/validation/checker/DateValidation.java import ninja.javafx.smartcsv.validation.ValidationError; import static org.apache.commons.validator.GenericValidator.isDate; /* The MIT License (MIT) ----------------------------------------------------------------------------- Copyright (c) 2015-2021 javafx.ninja <info@javafx.ninja> Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ package ninja.javafx.smartcsv.validation.checker; /** * Checks if the date has the right format */ public class DateValidation extends EmptyValueIsValid { private String dateformat; public DateValidation(String dateformat) { assert dateformat != null && !dateformat.trim().isEmpty() : "empty date format for date validation"; this.dateformat = dateformat; } @Override
public void check(int row, String value, ValidationError error) {
frosch95/SmartCSV.fx
src/main/java/ninja/javafx/smartcsv/validation/checker/ValueOfValidation.java
// Path: src/main/java/ninja/javafx/smartcsv/validation/ValidationError.java // public class ValidationError { // // private List<ValidationMessage> messages = new ArrayList<>(); // private Integer lineNumber; // private String column = ""; // // private ValidationError(Integer lineNumber) { // this.lineNumber = lineNumber; // } // // public static ValidationError withLineNumber(int lineNumber) { // return new ValidationError(lineNumber); // } // // public static ValidationError withoutLineNumber() { // return new ValidationError(-1); // } // // public ValidationError column(String column) { // this.column = column; // return this; // } // // public Integer getLineNumber() { // return lineNumber; // } // // public String getColumn() { // return column; // } // // public List<ValidationMessage> getMessages() { // return messages; // } // // public ValidationError add(String key, String... parameters) { // messages.add(new ValidationMessage(key, parameters)); // return this; // } // // public boolean isEmpty() { // return messages.isEmpty(); // } // }
import ninja.javafx.smartcsv.validation.ValidationError; import java.util.List; import static java.util.stream.Collectors.joining;
/* The MIT License (MIT) ----------------------------------------------------------------------------- Copyright (c) 2015-2021 javafx.ninja <info@javafx.ninja> Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ package ninja.javafx.smartcsv.validation.checker; /** * Checks if the value is part of a list of values */ public class ValueOfValidation extends EmptyValueIsValid { private List<String> values; public ValueOfValidation(List<String> values) { this.values = values; } @Override
// Path: src/main/java/ninja/javafx/smartcsv/validation/ValidationError.java // public class ValidationError { // // private List<ValidationMessage> messages = new ArrayList<>(); // private Integer lineNumber; // private String column = ""; // // private ValidationError(Integer lineNumber) { // this.lineNumber = lineNumber; // } // // public static ValidationError withLineNumber(int lineNumber) { // return new ValidationError(lineNumber); // } // // public static ValidationError withoutLineNumber() { // return new ValidationError(-1); // } // // public ValidationError column(String column) { // this.column = column; // return this; // } // // public Integer getLineNumber() { // return lineNumber; // } // // public String getColumn() { // return column; // } // // public List<ValidationMessage> getMessages() { // return messages; // } // // public ValidationError add(String key, String... parameters) { // messages.add(new ValidationMessage(key, parameters)); // return this; // } // // public boolean isEmpty() { // return messages.isEmpty(); // } // } // Path: src/main/java/ninja/javafx/smartcsv/validation/checker/ValueOfValidation.java import ninja.javafx.smartcsv.validation.ValidationError; import java.util.List; import static java.util.stream.Collectors.joining; /* The MIT License (MIT) ----------------------------------------------------------------------------- Copyright (c) 2015-2021 javafx.ninja <info@javafx.ninja> Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ package ninja.javafx.smartcsv.validation.checker; /** * Checks if the value is part of a list of values */ public class ValueOfValidation extends EmptyValueIsValid { private List<String> values; public ValueOfValidation(List<String> values) { this.values = values; } @Override
public void check(int row, String value, ValidationError error) {
frosch95/SmartCSV.fx
src/main/java/ninja/javafx/smartcsv/validation/checker/EmailValidation.java
// Path: src/main/java/ninja/javafx/smartcsv/validation/ValidationError.java // public class ValidationError { // // private List<ValidationMessage> messages = new ArrayList<>(); // private Integer lineNumber; // private String column = ""; // // private ValidationError(Integer lineNumber) { // this.lineNumber = lineNumber; // } // // public static ValidationError withLineNumber(int lineNumber) { // return new ValidationError(lineNumber); // } // // public static ValidationError withoutLineNumber() { // return new ValidationError(-1); // } // // public ValidationError column(String column) { // this.column = column; // return this; // } // // public Integer getLineNumber() { // return lineNumber; // } // // public String getColumn() { // return column; // } // // public List<ValidationMessage> getMessages() { // return messages; // } // // public ValidationError add(String key, String... parameters) { // messages.add(new ValidationMessage(key, parameters)); // return this; // } // // public boolean isEmpty() { // return messages.isEmpty(); // } // }
import ninja.javafx.smartcsv.validation.ValidationError; import org.apache.commons.validator.routines.EmailValidator;
/* The MIT License (MIT) ----------------------------------------------------------------------------- Copyright (c) 2015-2021 javafx.ninja <info@javafx.ninja> Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ package ninja.javafx.smartcsv.validation.checker; /** * checks if the value is a valid email address */ public class EmailValidation extends EmptyValueIsValid { @Override
// Path: src/main/java/ninja/javafx/smartcsv/validation/ValidationError.java // public class ValidationError { // // private List<ValidationMessage> messages = new ArrayList<>(); // private Integer lineNumber; // private String column = ""; // // private ValidationError(Integer lineNumber) { // this.lineNumber = lineNumber; // } // // public static ValidationError withLineNumber(int lineNumber) { // return new ValidationError(lineNumber); // } // // public static ValidationError withoutLineNumber() { // return new ValidationError(-1); // } // // public ValidationError column(String column) { // this.column = column; // return this; // } // // public Integer getLineNumber() { // return lineNumber; // } // // public String getColumn() { // return column; // } // // public List<ValidationMessage> getMessages() { // return messages; // } // // public ValidationError add(String key, String... parameters) { // messages.add(new ValidationMessage(key, parameters)); // return this; // } // // public boolean isEmpty() { // return messages.isEmpty(); // } // } // Path: src/main/java/ninja/javafx/smartcsv/validation/checker/EmailValidation.java import ninja.javafx.smartcsv.validation.ValidationError; import org.apache.commons.validator.routines.EmailValidator; /* The MIT License (MIT) ----------------------------------------------------------------------------- Copyright (c) 2015-2021 javafx.ninja <info@javafx.ninja> Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ package ninja.javafx.smartcsv.validation.checker; /** * checks if the value is a valid email address */ public class EmailValidation extends EmptyValueIsValid { @Override
public void check(int row, String value, ValidationError error) {
frosch95/SmartCSV.fx
src/main/java/ninja/javafx/smartcsv/validation/checker/Validation.java
// Path: src/main/java/ninja/javafx/smartcsv/validation/ValidationError.java // public class ValidationError { // // private List<ValidationMessage> messages = new ArrayList<>(); // private Integer lineNumber; // private String column = ""; // // private ValidationError(Integer lineNumber) { // this.lineNumber = lineNumber; // } // // public static ValidationError withLineNumber(int lineNumber) { // return new ValidationError(lineNumber); // } // // public static ValidationError withoutLineNumber() { // return new ValidationError(-1); // } // // public ValidationError column(String column) { // this.column = column; // return this; // } // // public Integer getLineNumber() { // return lineNumber; // } // // public String getColumn() { // return column; // } // // public List<ValidationMessage> getMessages() { // return messages; // } // // public ValidationError add(String key, String... parameters) { // messages.add(new ValidationMessage(key, parameters)); // return this; // } // // public boolean isEmpty() { // return messages.isEmpty(); // } // }
import ninja.javafx.smartcsv.validation.ValidationError;
/* The MIT License (MIT) ----------------------------------------------------------------------------- Copyright (c) 2015-2021 javafx.ninja <info@javafx.ninja> Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ package ninja.javafx.smartcsv.validation.checker; /** * Interface for all validations */ public interface Validation { enum Type { NOT_EMPTY, UNIQUE, DOUBLE, INTEGER, MIN_LENGTH, MAX_LENGTH, DATE, REGEXP, VALUE_OF, STRING, GROOVY }
// Path: src/main/java/ninja/javafx/smartcsv/validation/ValidationError.java // public class ValidationError { // // private List<ValidationMessage> messages = new ArrayList<>(); // private Integer lineNumber; // private String column = ""; // // private ValidationError(Integer lineNumber) { // this.lineNumber = lineNumber; // } // // public static ValidationError withLineNumber(int lineNumber) { // return new ValidationError(lineNumber); // } // // public static ValidationError withoutLineNumber() { // return new ValidationError(-1); // } // // public ValidationError column(String column) { // this.column = column; // return this; // } // // public Integer getLineNumber() { // return lineNumber; // } // // public String getColumn() { // return column; // } // // public List<ValidationMessage> getMessages() { // return messages; // } // // public ValidationError add(String key, String... parameters) { // messages.add(new ValidationMessage(key, parameters)); // return this; // } // // public boolean isEmpty() { // return messages.isEmpty(); // } // } // Path: src/main/java/ninja/javafx/smartcsv/validation/checker/Validation.java import ninja.javafx.smartcsv.validation.ValidationError; /* The MIT License (MIT) ----------------------------------------------------------------------------- Copyright (c) 2015-2021 javafx.ninja <info@javafx.ninja> Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ package ninja.javafx.smartcsv.validation.checker; /** * Interface for all validations */ public interface Validation { enum Type { NOT_EMPTY, UNIQUE, DOUBLE, INTEGER, MIN_LENGTH, MAX_LENGTH, DATE, REGEXP, VALUE_OF, STRING, GROOVY }
void check(int row, String value, ValidationError error);
frosch95/SmartCSV.fx
src/test/java/ninja/javafx/smartcsv/validation/HeaderValidationTest.java
// Path: src/main/java/ninja/javafx/smartcsv/validation/configuration/ValidationConfiguration.java // public class ValidationConfiguration { // // @SerializedName("fields") // private Field[] fields; // // public Field[] getFields() { // return fields; // } // // public void setFields(Field[] fields) { // this.fields = fields; // } // // public Field getFieldConfiguration(String column) { // for (Field field : fields) { // if (field.getName().equals(column)) { // return field; // } // } // return null; // } // // public String[] headerNames() { // if (fields != null) { // List<String> headerNames = new ArrayList<>(); // for (Field field : fields) { // headerNames.add(field.getName()); // } // return headerNames.toArray(new String[headerNames.size()]); // } // // return null; // } // // public void setHeaderNames(String[] header) { // fields = new Field[header.length]; // int i = 0; // for (String headerName: header) { // fields[i] = new Field(); // fields[i].setName(headerName); // i++; // } // } // }
import org.junit.jupiter.params.provider.Arguments; import org.junit.jupiter.params.provider.MethodSource; import java.util.List; import java.util.stream.Stream; import static java.util.Arrays.asList; import static java.util.Collections.singletonList; import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.Matchers.is; import static org.junit.jupiter.api.Assertions.assertTrue; import com.google.gson.Gson; import com.google.gson.GsonBuilder; import ninja.javafx.smartcsv.validation.configuration.ValidationConfiguration; import org.junit.jupiter.params.ParameterizedTest;
/* The MIT License (MIT) ----------------------------------------------------------------------------- Copyright (c) 2015-2021 javafx.ninja <info@javafx.ninja> Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ package ninja.javafx.smartcsv.validation; /** * unit test for header validator */ public class HeaderValidationTest { //////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // tests //////////////////////////////////////////////////////////////////////////////////////////////////////////////////// @ParameterizedTest @MethodSource("validationConfigurations") public void validation(String configHeaderNames, String[] headerNames, Boolean expectedResult, List<ValidationMessage> expectedErrors) { // setup Gson gson = new GsonBuilder().create();
// Path: src/main/java/ninja/javafx/smartcsv/validation/configuration/ValidationConfiguration.java // public class ValidationConfiguration { // // @SerializedName("fields") // private Field[] fields; // // public Field[] getFields() { // return fields; // } // // public void setFields(Field[] fields) { // this.fields = fields; // } // // public Field getFieldConfiguration(String column) { // for (Field field : fields) { // if (field.getName().equals(column)) { // return field; // } // } // return null; // } // // public String[] headerNames() { // if (fields != null) { // List<String> headerNames = new ArrayList<>(); // for (Field field : fields) { // headerNames.add(field.getName()); // } // return headerNames.toArray(new String[headerNames.size()]); // } // // return null; // } // // public void setHeaderNames(String[] header) { // fields = new Field[header.length]; // int i = 0; // for (String headerName: header) { // fields[i] = new Field(); // fields[i].setName(headerName); // i++; // } // } // } // Path: src/test/java/ninja/javafx/smartcsv/validation/HeaderValidationTest.java import org.junit.jupiter.params.provider.Arguments; import org.junit.jupiter.params.provider.MethodSource; import java.util.List; import java.util.stream.Stream; import static java.util.Arrays.asList; import static java.util.Collections.singletonList; import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.Matchers.is; import static org.junit.jupiter.api.Assertions.assertTrue; import com.google.gson.Gson; import com.google.gson.GsonBuilder; import ninja.javafx.smartcsv.validation.configuration.ValidationConfiguration; import org.junit.jupiter.params.ParameterizedTest; /* The MIT License (MIT) ----------------------------------------------------------------------------- Copyright (c) 2015-2021 javafx.ninja <info@javafx.ninja> Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ package ninja.javafx.smartcsv.validation; /** * unit test for header validator */ public class HeaderValidationTest { //////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // tests //////////////////////////////////////////////////////////////////////////////////////////////////////////////////// @ParameterizedTest @MethodSource("validationConfigurations") public void validation(String configHeaderNames, String[] headerNames, Boolean expectedResult, List<ValidationMessage> expectedErrors) { // setup Gson gson = new GsonBuilder().create();
ValidationConfiguration config = gson.fromJson(configHeaderNames, ValidationConfiguration.class);
frosch95/SmartCSV.fx
src/main/java/ninja/javafx/smartcsv/validation/checker/IntegerValidation.java
// Path: src/main/java/ninja/javafx/smartcsv/validation/ValidationError.java // public class ValidationError { // // private List<ValidationMessage> messages = new ArrayList<>(); // private Integer lineNumber; // private String column = ""; // // private ValidationError(Integer lineNumber) { // this.lineNumber = lineNumber; // } // // public static ValidationError withLineNumber(int lineNumber) { // return new ValidationError(lineNumber); // } // // public static ValidationError withoutLineNumber() { // return new ValidationError(-1); // } // // public ValidationError column(String column) { // this.column = column; // return this; // } // // public Integer getLineNumber() { // return lineNumber; // } // // public String getColumn() { // return column; // } // // public List<ValidationMessage> getMessages() { // return messages; // } // // public ValidationError add(String key, String... parameters) { // messages.add(new ValidationMessage(key, parameters)); // return this; // } // // public boolean isEmpty() { // return messages.isEmpty(); // } // }
import ninja.javafx.smartcsv.validation.ValidationError; import static org.apache.commons.validator.GenericValidator.isInt;
/* The MIT License (MIT) ----------------------------------------------------------------------------- Copyright (c) 2015-2021 javafx.ninja <info@javafx.ninja> Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ package ninja.javafx.smartcsv.validation.checker; /** * Checks if the value is an integer */ public class IntegerValidation extends EmptyValueIsValid { @Override
// Path: src/main/java/ninja/javafx/smartcsv/validation/ValidationError.java // public class ValidationError { // // private List<ValidationMessage> messages = new ArrayList<>(); // private Integer lineNumber; // private String column = ""; // // private ValidationError(Integer lineNumber) { // this.lineNumber = lineNumber; // } // // public static ValidationError withLineNumber(int lineNumber) { // return new ValidationError(lineNumber); // } // // public static ValidationError withoutLineNumber() { // return new ValidationError(-1); // } // // public ValidationError column(String column) { // this.column = column; // return this; // } // // public Integer getLineNumber() { // return lineNumber; // } // // public String getColumn() { // return column; // } // // public List<ValidationMessage> getMessages() { // return messages; // } // // public ValidationError add(String key, String... parameters) { // messages.add(new ValidationMessage(key, parameters)); // return this; // } // // public boolean isEmpty() { // return messages.isEmpty(); // } // } // Path: src/main/java/ninja/javafx/smartcsv/validation/checker/IntegerValidation.java import ninja.javafx.smartcsv.validation.ValidationError; import static org.apache.commons.validator.GenericValidator.isInt; /* The MIT License (MIT) ----------------------------------------------------------------------------- Copyright (c) 2015-2021 javafx.ninja <info@javafx.ninja> Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ package ninja.javafx.smartcsv.validation.checker; /** * Checks if the value is an integer */ public class IntegerValidation extends EmptyValueIsValid { @Override
public void check(int row, String value, ValidationError error) {
frosch95/SmartCSV.fx
src/main/java/ninja/javafx/smartcsv/validation/checker/RegExpValidation.java
// Path: src/main/java/ninja/javafx/smartcsv/validation/ValidationError.java // public class ValidationError { // // private List<ValidationMessage> messages = new ArrayList<>(); // private Integer lineNumber; // private String column = ""; // // private ValidationError(Integer lineNumber) { // this.lineNumber = lineNumber; // } // // public static ValidationError withLineNumber(int lineNumber) { // return new ValidationError(lineNumber); // } // // public static ValidationError withoutLineNumber() { // return new ValidationError(-1); // } // // public ValidationError column(String column) { // this.column = column; // return this; // } // // public Integer getLineNumber() { // return lineNumber; // } // // public String getColumn() { // return column; // } // // public List<ValidationMessage> getMessages() { // return messages; // } // // public ValidationError add(String key, String... parameters) { // messages.add(new ValidationMessage(key, parameters)); // return this; // } // // public boolean isEmpty() { // return messages.isEmpty(); // } // }
import ninja.javafx.smartcsv.validation.ValidationError; import static org.apache.commons.validator.GenericValidator.matchRegexp;
/* The MIT License (MIT) ----------------------------------------------------------------------------- Copyright (c) 2015-2021 javafx.ninja <info@javafx.ninja> Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ package ninja.javafx.smartcsv.validation.checker; /** * Checks the value against the given reg exp */ public class RegExpValidation extends EmptyValueIsValid { private String regexp; public RegExpValidation(String regexp) { this.regexp = regexp; } @Override
// Path: src/main/java/ninja/javafx/smartcsv/validation/ValidationError.java // public class ValidationError { // // private List<ValidationMessage> messages = new ArrayList<>(); // private Integer lineNumber; // private String column = ""; // // private ValidationError(Integer lineNumber) { // this.lineNumber = lineNumber; // } // // public static ValidationError withLineNumber(int lineNumber) { // return new ValidationError(lineNumber); // } // // public static ValidationError withoutLineNumber() { // return new ValidationError(-1); // } // // public ValidationError column(String column) { // this.column = column; // return this; // } // // public Integer getLineNumber() { // return lineNumber; // } // // public String getColumn() { // return column; // } // // public List<ValidationMessage> getMessages() { // return messages; // } // // public ValidationError add(String key, String... parameters) { // messages.add(new ValidationMessage(key, parameters)); // return this; // } // // public boolean isEmpty() { // return messages.isEmpty(); // } // } // Path: src/main/java/ninja/javafx/smartcsv/validation/checker/RegExpValidation.java import ninja.javafx.smartcsv.validation.ValidationError; import static org.apache.commons.validator.GenericValidator.matchRegexp; /* The MIT License (MIT) ----------------------------------------------------------------------------- Copyright (c) 2015-2021 javafx.ninja <info@javafx.ninja> Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ package ninja.javafx.smartcsv.validation.checker; /** * Checks the value against the given reg exp */ public class RegExpValidation extends EmptyValueIsValid { private String regexp; public RegExpValidation(String regexp) { this.regexp = regexp; } @Override
public void check(int row, String value, ValidationError error) {
frosch95/SmartCSV.fx
src/main/java/ninja/javafx/smartcsv/fx/util/I18nValidationUtil.java
// Path: src/main/java/ninja/javafx/smartcsv/validation/ValidationError.java // public class ValidationError { // // private List<ValidationMessage> messages = new ArrayList<>(); // private Integer lineNumber; // private String column = ""; // // private ValidationError(Integer lineNumber) { // this.lineNumber = lineNumber; // } // // public static ValidationError withLineNumber(int lineNumber) { // return new ValidationError(lineNumber); // } // // public static ValidationError withoutLineNumber() { // return new ValidationError(-1); // } // // public ValidationError column(String column) { // this.column = column; // return this; // } // // public Integer getLineNumber() { // return lineNumber; // } // // public String getColumn() { // return column; // } // // public List<ValidationMessage> getMessages() { // return messages; // } // // public ValidationError add(String key, String... parameters) { // messages.add(new ValidationMessage(key, parameters)); // return this; // } // // public boolean isEmpty() { // return messages.isEmpty(); // } // } // // Path: src/main/java/ninja/javafx/smartcsv/validation/ValidationMessage.java // public class ValidationMessage { // // private String key; // private String[] parameters; // // public ValidationMessage(String key, String... parameters) { // this.key = key; // this.parameters = parameters; // } // // public String getKey() { // return key; // } // // public String[] getParameters() { // return parameters; // } // // @Override // public boolean equals(Object o) { // if (this == o) return true; // if (o == null || getClass() != o.getClass()) return false; // // ValidationMessage that = (ValidationMessage) o; // // if (key != null ? !key.equals(that.key) : that.key != null) return false; // // Probably incorrect - comparing Object[] arrays with Arrays.equals // return Arrays.equals(parameters, that.parameters); // // } // // @Override // public int hashCode() { // int result = key != null ? key.hashCode() : 0; // result = 31 * result + Arrays.hashCode(parameters); // return result; // } // // @Override // public String toString() { // return "ValidationMessage{" + // "key='" + key + '\'' + // ", parameters=" + Arrays.toString(parameters) + // '}'; // } // }
import java.util.List; import java.util.ResourceBundle; import static java.text.MessageFormat.format; import ninja.javafx.smartcsv.validation.ValidationError; import ninja.javafx.smartcsv.validation.ValidationMessage; import java.io.StringWriter;
/* The MIT License (MIT) ----------------------------------------------------------------------------- Copyright (c) 2015-2021 javafx.ninja <info@javafx.ninja> Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ package ninja.javafx.smartcsv.fx.util; /** * This class makes validation messages readable in supported languages */ public class I18nValidationUtil { public static String getI18nValidatioMessage(ResourceBundle resourceBundle, List<ValidationError> errors) { StringWriter message = new StringWriter(); errors.forEach(error -> message.append(getI18nValidatioMessage(resourceBundle, error)).append("\n")); if (message.toString().length() != 0) { return cutOffLastLineBreak(message.toString()); } return ""; } public static String getI18nValidatioMessageWithColumn(ResourceBundle resourceBundle, ValidationError error) { return getI18nValidatioMessage(resourceBundle, error, resourceBundle.getString("column") + " " + error.getColumn() + " : "); } public static String getI18nValidatioMessage(ResourceBundle resourceBundle, ValidationError error) { return getI18nValidatioMessage(resourceBundle, error, ""); } private static String getI18nValidatioMessage(ResourceBundle resourceBundle, ValidationError error, String prefix) {
// Path: src/main/java/ninja/javafx/smartcsv/validation/ValidationError.java // public class ValidationError { // // private List<ValidationMessage> messages = new ArrayList<>(); // private Integer lineNumber; // private String column = ""; // // private ValidationError(Integer lineNumber) { // this.lineNumber = lineNumber; // } // // public static ValidationError withLineNumber(int lineNumber) { // return new ValidationError(lineNumber); // } // // public static ValidationError withoutLineNumber() { // return new ValidationError(-1); // } // // public ValidationError column(String column) { // this.column = column; // return this; // } // // public Integer getLineNumber() { // return lineNumber; // } // // public String getColumn() { // return column; // } // // public List<ValidationMessage> getMessages() { // return messages; // } // // public ValidationError add(String key, String... parameters) { // messages.add(new ValidationMessage(key, parameters)); // return this; // } // // public boolean isEmpty() { // return messages.isEmpty(); // } // } // // Path: src/main/java/ninja/javafx/smartcsv/validation/ValidationMessage.java // public class ValidationMessage { // // private String key; // private String[] parameters; // // public ValidationMessage(String key, String... parameters) { // this.key = key; // this.parameters = parameters; // } // // public String getKey() { // return key; // } // // public String[] getParameters() { // return parameters; // } // // @Override // public boolean equals(Object o) { // if (this == o) return true; // if (o == null || getClass() != o.getClass()) return false; // // ValidationMessage that = (ValidationMessage) o; // // if (key != null ? !key.equals(that.key) : that.key != null) return false; // // Probably incorrect - comparing Object[] arrays with Arrays.equals // return Arrays.equals(parameters, that.parameters); // // } // // @Override // public int hashCode() { // int result = key != null ? key.hashCode() : 0; // result = 31 * result + Arrays.hashCode(parameters); // return result; // } // // @Override // public String toString() { // return "ValidationMessage{" + // "key='" + key + '\'' + // ", parameters=" + Arrays.toString(parameters) + // '}'; // } // } // Path: src/main/java/ninja/javafx/smartcsv/fx/util/I18nValidationUtil.java import java.util.List; import java.util.ResourceBundle; import static java.text.MessageFormat.format; import ninja.javafx.smartcsv.validation.ValidationError; import ninja.javafx.smartcsv.validation.ValidationMessage; import java.io.StringWriter; /* The MIT License (MIT) ----------------------------------------------------------------------------- Copyright (c) 2015-2021 javafx.ninja <info@javafx.ninja> Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ package ninja.javafx.smartcsv.fx.util; /** * This class makes validation messages readable in supported languages */ public class I18nValidationUtil { public static String getI18nValidatioMessage(ResourceBundle resourceBundle, List<ValidationError> errors) { StringWriter message = new StringWriter(); errors.forEach(error -> message.append(getI18nValidatioMessage(resourceBundle, error)).append("\n")); if (message.toString().length() != 0) { return cutOffLastLineBreak(message.toString()); } return ""; } public static String getI18nValidatioMessageWithColumn(ResourceBundle resourceBundle, ValidationError error) { return getI18nValidatioMessage(resourceBundle, error, resourceBundle.getString("column") + " " + error.getColumn() + " : "); } public static String getI18nValidatioMessage(ResourceBundle resourceBundle, ValidationError error) { return getI18nValidatioMessage(resourceBundle, error, ""); } private static String getI18nValidatioMessage(ResourceBundle resourceBundle, ValidationError error, String prefix) {
List<ValidationMessage> validationMessages = error.getMessages();
frosch95/SmartCSV.fx
src/main/java/ninja/javafx/smartcsv/validation/ValidationFileReader.java
// Path: src/main/java/ninja/javafx/smartcsv/FileReader.java // public interface FileReader<E> { // E getContent(); // void read(File filename) throws IOException; // } // // Path: src/main/java/ninja/javafx/smartcsv/validation/configuration/Field.java // public class Field { // // private String name; // private String title; // private Type type; // private String description; // private String format; // private Object missingValue; // private Constraints constraints; // private String groovy; // // // public String getName() { // return name; // } // // public void setName(String name) { // this.name = name; // } // // public String getTitle() { // return title; // } // // public void setTitle(String title) { // this.title = title; // } // // public Type getType() { // return type; // } // // public void setType(Type type) { // this.type = type; // } // // public String getDescription() { // return description; // } // // public void setDescription(String description) { // this.description = description; // } // // public String getFormat() { // return format; // } // // public void setFormat(String format) { // this.format = format; // } // // public Object getMissingValue() { // return missingValue; // } // // public void setMissingValue(Object missingValue) { // this.missingValue = missingValue; // } // // public Constraints getConstraints() { // return constraints; // } // // public void setConstraints(Constraints constraints) { // this.constraints = constraints; // } // // public String getGroovy() { // return groovy; // } // // public void setGroovy(String groovy) { // this.groovy = groovy; // } // // } // // Path: src/main/java/ninja/javafx/smartcsv/validation/configuration/ValidationConfiguration.java // public class ValidationConfiguration { // // @SerializedName("fields") // private Field[] fields; // // public Field[] getFields() { // return fields; // } // // public void setFields(Field[] fields) { // this.fields = fields; // } // // public Field getFieldConfiguration(String column) { // for (Field field : fields) { // if (field.getName().equals(column)) { // return field; // } // } // return null; // } // // public String[] headerNames() { // if (fields != null) { // List<String> headerNames = new ArrayList<>(); // for (Field field : fields) { // headerNames.add(field.getName()); // } // return headerNames.toArray(new String[headerNames.size()]); // } // // return null; // } // // public void setHeaderNames(String[] header) { // fields = new Field[header.length]; // int i = 0; // for (String headerName: header) { // fields[i] = new Field(); // fields[i].setName(headerName); // i++; // } // } // } // // Path: src/main/java/ninja/javafx/smartcsv/validation/configuration/Type.java // public enum Type { // @SerializedName("string")STRING, // @SerializedName("integer")INTEGER, // @SerializedName("number")NUMBER, // @SerializedName("date")DATE, // @SerializedName("datetime")DATETIME, // @SerializedName("time")TIME // // TODO: currently not supported // // @SerializedName("object") OBJECT, // // @SerializedName("array") ARRAY, // // @SerializedName("duration") DURATION, // // @SerializedName("geopoint") GEOPOINT, // // @SerializedName("geojson") GEOJSON // }
import java.io.File; import java.io.IOException; import static ninja.javafx.smartcsv.validation.configuration.Type.*; import com.google.gson.GsonBuilder; import ninja.javafx.smartcsv.FileReader; import ninja.javafx.smartcsv.validation.configuration.Field; import ninja.javafx.smartcsv.validation.configuration.ValidationConfiguration;
/* The MIT License (MIT) ----------------------------------------------------------------------------- Copyright (c) 2015-2021 javafx.ninja <info@javafx.ninja> Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ package ninja.javafx.smartcsv.validation; /** * This class loads the constraints as json config */ public class ValidationFileReader implements FileReader<ValidationConfiguration> { private ValidationConfiguration config; @Override public void read(File file) throws IOException { config = new GsonBuilder().create().fromJson(new java.io.FileReader(file), ValidationConfiguration.class); setDefaults(); } private void setDefaults() {
// Path: src/main/java/ninja/javafx/smartcsv/FileReader.java // public interface FileReader<E> { // E getContent(); // void read(File filename) throws IOException; // } // // Path: src/main/java/ninja/javafx/smartcsv/validation/configuration/Field.java // public class Field { // // private String name; // private String title; // private Type type; // private String description; // private String format; // private Object missingValue; // private Constraints constraints; // private String groovy; // // // public String getName() { // return name; // } // // public void setName(String name) { // this.name = name; // } // // public String getTitle() { // return title; // } // // public void setTitle(String title) { // this.title = title; // } // // public Type getType() { // return type; // } // // public void setType(Type type) { // this.type = type; // } // // public String getDescription() { // return description; // } // // public void setDescription(String description) { // this.description = description; // } // // public String getFormat() { // return format; // } // // public void setFormat(String format) { // this.format = format; // } // // public Object getMissingValue() { // return missingValue; // } // // public void setMissingValue(Object missingValue) { // this.missingValue = missingValue; // } // // public Constraints getConstraints() { // return constraints; // } // // public void setConstraints(Constraints constraints) { // this.constraints = constraints; // } // // public String getGroovy() { // return groovy; // } // // public void setGroovy(String groovy) { // this.groovy = groovy; // } // // } // // Path: src/main/java/ninja/javafx/smartcsv/validation/configuration/ValidationConfiguration.java // public class ValidationConfiguration { // // @SerializedName("fields") // private Field[] fields; // // public Field[] getFields() { // return fields; // } // // public void setFields(Field[] fields) { // this.fields = fields; // } // // public Field getFieldConfiguration(String column) { // for (Field field : fields) { // if (field.getName().equals(column)) { // return field; // } // } // return null; // } // // public String[] headerNames() { // if (fields != null) { // List<String> headerNames = new ArrayList<>(); // for (Field field : fields) { // headerNames.add(field.getName()); // } // return headerNames.toArray(new String[headerNames.size()]); // } // // return null; // } // // public void setHeaderNames(String[] header) { // fields = new Field[header.length]; // int i = 0; // for (String headerName: header) { // fields[i] = new Field(); // fields[i].setName(headerName); // i++; // } // } // } // // Path: src/main/java/ninja/javafx/smartcsv/validation/configuration/Type.java // public enum Type { // @SerializedName("string")STRING, // @SerializedName("integer")INTEGER, // @SerializedName("number")NUMBER, // @SerializedName("date")DATE, // @SerializedName("datetime")DATETIME, // @SerializedName("time")TIME // // TODO: currently not supported // // @SerializedName("object") OBJECT, // // @SerializedName("array") ARRAY, // // @SerializedName("duration") DURATION, // // @SerializedName("geopoint") GEOPOINT, // // @SerializedName("geojson") GEOJSON // } // Path: src/main/java/ninja/javafx/smartcsv/validation/ValidationFileReader.java import java.io.File; import java.io.IOException; import static ninja.javafx.smartcsv.validation.configuration.Type.*; import com.google.gson.GsonBuilder; import ninja.javafx.smartcsv.FileReader; import ninja.javafx.smartcsv.validation.configuration.Field; import ninja.javafx.smartcsv.validation.configuration.ValidationConfiguration; /* The MIT License (MIT) ----------------------------------------------------------------------------- Copyright (c) 2015-2021 javafx.ninja <info@javafx.ninja> Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ package ninja.javafx.smartcsv.validation; /** * This class loads the constraints as json config */ public class ValidationFileReader implements FileReader<ValidationConfiguration> { private ValidationConfiguration config; @Override public void read(File file) throws IOException { config = new GsonBuilder().create().fromJson(new java.io.FileReader(file), ValidationConfiguration.class); setDefaults(); } private void setDefaults() {
for (Field field : config.getFields()) {
frosch95/SmartCSV.fx
src/main/java/ninja/javafx/smartcsv/validation/checker/MaxLengthValidation.java
// Path: src/main/java/ninja/javafx/smartcsv/validation/ValidationError.java // public class ValidationError { // // private List<ValidationMessage> messages = new ArrayList<>(); // private Integer lineNumber; // private String column = ""; // // private ValidationError(Integer lineNumber) { // this.lineNumber = lineNumber; // } // // public static ValidationError withLineNumber(int lineNumber) { // return new ValidationError(lineNumber); // } // // public static ValidationError withoutLineNumber() { // return new ValidationError(-1); // } // // public ValidationError column(String column) { // this.column = column; // return this; // } // // public Integer getLineNumber() { // return lineNumber; // } // // public String getColumn() { // return column; // } // // public List<ValidationMessage> getMessages() { // return messages; // } // // public ValidationError add(String key, String... parameters) { // messages.add(new ValidationMessage(key, parameters)); // return this; // } // // public boolean isEmpty() { // return messages.isEmpty(); // } // }
import ninja.javafx.smartcsv.validation.ValidationError; import static org.apache.commons.validator.GenericValidator.maxLength;
/* The MIT License (MIT) ----------------------------------------------------------------------------- Copyright (c) 2015-2021 javafx.ninja <info@javafx.ninja> Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ package ninja.javafx.smartcsv.validation.checker; /** * Checks if the value is shorter or exactly as long as the given max length */ public class MaxLengthValidation extends EmptyValueIsValid { private int maxLength; public MaxLengthValidation(int maxLength) { this.maxLength = maxLength; } @Override
// Path: src/main/java/ninja/javafx/smartcsv/validation/ValidationError.java // public class ValidationError { // // private List<ValidationMessage> messages = new ArrayList<>(); // private Integer lineNumber; // private String column = ""; // // private ValidationError(Integer lineNumber) { // this.lineNumber = lineNumber; // } // // public static ValidationError withLineNumber(int lineNumber) { // return new ValidationError(lineNumber); // } // // public static ValidationError withoutLineNumber() { // return new ValidationError(-1); // } // // public ValidationError column(String column) { // this.column = column; // return this; // } // // public Integer getLineNumber() { // return lineNumber; // } // // public String getColumn() { // return column; // } // // public List<ValidationMessage> getMessages() { // return messages; // } // // public ValidationError add(String key, String... parameters) { // messages.add(new ValidationMessage(key, parameters)); // return this; // } // // public boolean isEmpty() { // return messages.isEmpty(); // } // } // Path: src/main/java/ninja/javafx/smartcsv/validation/checker/MaxLengthValidation.java import ninja.javafx.smartcsv.validation.ValidationError; import static org.apache.commons.validator.GenericValidator.maxLength; /* The MIT License (MIT) ----------------------------------------------------------------------------- Copyright (c) 2015-2021 javafx.ninja <info@javafx.ninja> Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ package ninja.javafx.smartcsv.validation.checker; /** * Checks if the value is shorter or exactly as long as the given max length */ public class MaxLengthValidation extends EmptyValueIsValid { private int maxLength; public MaxLengthValidation(int maxLength) { this.maxLength = maxLength; } @Override
public void check(int row, String value, ValidationError error) {
frosch95/SmartCSV.fx
src/main/java/ninja/javafx/smartcsv/validation/RevalidationService.java
// Path: src/main/java/ninja/javafx/smartcsv/fx/table/model/CSVRow.java // public class CSVRow { // private ObservableMap<String, ObjectProperty<CSVValue>> columns = FXCollections.observableHashMap(); // private int rowNumber; // // /** // * sets the row number // * @param rowNumber // */ // public void setRowNumber(int rowNumber) { // this.rowNumber = rowNumber; // } // // /** // * return the row number // * @return row number // */ // public int getRowNumber() { // return rowNumber; // } // // // /** // * returns the columns with data as Map // * @return columns with data // */ // public ObservableMap<String, ObjectProperty<CSVValue>> getColumns() { // return columns; // } // // /** // * stores the given value in the given column of this row // * @param column column name // * @param value the value to store // */ // CSVValue addValue(String column, String value) { // CSVValue v = new CSVValue(); // v.setValue(value); // columns.put(column, new SimpleObjectProperty<>(v)); // return v; // } // // } // // Path: src/main/java/ninja/javafx/smartcsv/fx/table/model/CSVValue.java // public class CSVValue { // private StringProperty value = new SimpleStringProperty(); // private ValidationError valid; // // /** // * returns the real value // * @return the real value // */ // public String getValue() { // return value.get(); // } // // /** // * JavaFX property representation of the real value // * @return property of real value // */ // public StringProperty valueProperty() { // return value; // } // // /** // * sets the real value // * @param value the real value // */ // public void setValue(String value) { // this.value.set(value); // } // // /** // * returns if the value is valid to the rules of the validator // * @return // */ // public ValidationError getValidationError() { // return valid; // } // // /** // * sets the state if a value is valid or not // * @param valid the validation state // */ // public void setValidationError(ValidationError valid) { // this.valid = valid; // } // }
import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; import java.util.ArrayList; import java.util.List; import java.util.Map; import java.util.Set; import javafx.beans.property.ObjectProperty; import javafx.concurrent.Service; import javafx.concurrent.Task; import ninja.javafx.smartcsv.fx.table.model.CSVRow; import ninja.javafx.smartcsv.fx.table.model.CSVValue;
/* The MIT License (MIT) ----------------------------------------------------------------------------- Copyright (c) 2015-2021 javafx.ninja <info@javafx.ninja> Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ package ninja.javafx.smartcsv.validation; /** * Service for running the validation async of the ui thread */ public class RevalidationService extends Service<List<ValidationError>> { private static final Logger logger = LogManager.getLogger(RevalidationService.class); private Validator validator;
// Path: src/main/java/ninja/javafx/smartcsv/fx/table/model/CSVRow.java // public class CSVRow { // private ObservableMap<String, ObjectProperty<CSVValue>> columns = FXCollections.observableHashMap(); // private int rowNumber; // // /** // * sets the row number // * @param rowNumber // */ // public void setRowNumber(int rowNumber) { // this.rowNumber = rowNumber; // } // // /** // * return the row number // * @return row number // */ // public int getRowNumber() { // return rowNumber; // } // // // /** // * returns the columns with data as Map // * @return columns with data // */ // public ObservableMap<String, ObjectProperty<CSVValue>> getColumns() { // return columns; // } // // /** // * stores the given value in the given column of this row // * @param column column name // * @param value the value to store // */ // CSVValue addValue(String column, String value) { // CSVValue v = new CSVValue(); // v.setValue(value); // columns.put(column, new SimpleObjectProperty<>(v)); // return v; // } // // } // // Path: src/main/java/ninja/javafx/smartcsv/fx/table/model/CSVValue.java // public class CSVValue { // private StringProperty value = new SimpleStringProperty(); // private ValidationError valid; // // /** // * returns the real value // * @return the real value // */ // public String getValue() { // return value.get(); // } // // /** // * JavaFX property representation of the real value // * @return property of real value // */ // public StringProperty valueProperty() { // return value; // } // // /** // * sets the real value // * @param value the real value // */ // public void setValue(String value) { // this.value.set(value); // } // // /** // * returns if the value is valid to the rules of the validator // * @return // */ // public ValidationError getValidationError() { // return valid; // } // // /** // * sets the state if a value is valid or not // * @param valid the validation state // */ // public void setValidationError(ValidationError valid) { // this.valid = valid; // } // } // Path: src/main/java/ninja/javafx/smartcsv/validation/RevalidationService.java import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; import java.util.ArrayList; import java.util.List; import java.util.Map; import java.util.Set; import javafx.beans.property.ObjectProperty; import javafx.concurrent.Service; import javafx.concurrent.Task; import ninja.javafx.smartcsv.fx.table.model.CSVRow; import ninja.javafx.smartcsv.fx.table.model.CSVValue; /* The MIT License (MIT) ----------------------------------------------------------------------------- Copyright (c) 2015-2021 javafx.ninja <info@javafx.ninja> Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ package ninja.javafx.smartcsv.validation; /** * Service for running the validation async of the ui thread */ public class RevalidationService extends Service<List<ValidationError>> { private static final Logger logger = LogManager.getLogger(RevalidationService.class); private Validator validator;
private List<CSVRow> rows;
frosch95/SmartCSV.fx
src/main/java/ninja/javafx/smartcsv/validation/RevalidationService.java
// Path: src/main/java/ninja/javafx/smartcsv/fx/table/model/CSVRow.java // public class CSVRow { // private ObservableMap<String, ObjectProperty<CSVValue>> columns = FXCollections.observableHashMap(); // private int rowNumber; // // /** // * sets the row number // * @param rowNumber // */ // public void setRowNumber(int rowNumber) { // this.rowNumber = rowNumber; // } // // /** // * return the row number // * @return row number // */ // public int getRowNumber() { // return rowNumber; // } // // // /** // * returns the columns with data as Map // * @return columns with data // */ // public ObservableMap<String, ObjectProperty<CSVValue>> getColumns() { // return columns; // } // // /** // * stores the given value in the given column of this row // * @param column column name // * @param value the value to store // */ // CSVValue addValue(String column, String value) { // CSVValue v = new CSVValue(); // v.setValue(value); // columns.put(column, new SimpleObjectProperty<>(v)); // return v; // } // // } // // Path: src/main/java/ninja/javafx/smartcsv/fx/table/model/CSVValue.java // public class CSVValue { // private StringProperty value = new SimpleStringProperty(); // private ValidationError valid; // // /** // * returns the real value // * @return the real value // */ // public String getValue() { // return value.get(); // } // // /** // * JavaFX property representation of the real value // * @return property of real value // */ // public StringProperty valueProperty() { // return value; // } // // /** // * sets the real value // * @param value the real value // */ // public void setValue(String value) { // this.value.set(value); // } // // /** // * returns if the value is valid to the rules of the validator // * @return // */ // public ValidationError getValidationError() { // return valid; // } // // /** // * sets the state if a value is valid or not // * @param valid the validation state // */ // public void setValidationError(ValidationError valid) { // this.valid = valid; // } // }
import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; import java.util.ArrayList; import java.util.List; import java.util.Map; import java.util.Set; import javafx.beans.property.ObjectProperty; import javafx.concurrent.Service; import javafx.concurrent.Task; import ninja.javafx.smartcsv.fx.table.model.CSVRow; import ninja.javafx.smartcsv.fx.table.model.CSVValue;
this.validator = validator; } public void setRows(List<CSVRow> rows) { this.rows = rows; } public void setHeader(String[] header) { this.header = header; } @Override protected Task<List<ValidationError>> createTask() { return new Task<List<ValidationError>>() { @Override protected List<ValidationError> call() throws Exception { List<ValidationError> errors = new ArrayList<>(); try { if (header != null) { ValidationError headerError = validator.isHeaderValid(header); if (headerError != null) { logger.info("revalidate: header error found"); errors.add(headerError); } } int maxRows = rows.size(); for (int lineNumber = 0; lineNumber < maxRows; lineNumber++) { CSVRow row = rows.get(lineNumber);
// Path: src/main/java/ninja/javafx/smartcsv/fx/table/model/CSVRow.java // public class CSVRow { // private ObservableMap<String, ObjectProperty<CSVValue>> columns = FXCollections.observableHashMap(); // private int rowNumber; // // /** // * sets the row number // * @param rowNumber // */ // public void setRowNumber(int rowNumber) { // this.rowNumber = rowNumber; // } // // /** // * return the row number // * @return row number // */ // public int getRowNumber() { // return rowNumber; // } // // // /** // * returns the columns with data as Map // * @return columns with data // */ // public ObservableMap<String, ObjectProperty<CSVValue>> getColumns() { // return columns; // } // // /** // * stores the given value in the given column of this row // * @param column column name // * @param value the value to store // */ // CSVValue addValue(String column, String value) { // CSVValue v = new CSVValue(); // v.setValue(value); // columns.put(column, new SimpleObjectProperty<>(v)); // return v; // } // // } // // Path: src/main/java/ninja/javafx/smartcsv/fx/table/model/CSVValue.java // public class CSVValue { // private StringProperty value = new SimpleStringProperty(); // private ValidationError valid; // // /** // * returns the real value // * @return the real value // */ // public String getValue() { // return value.get(); // } // // /** // * JavaFX property representation of the real value // * @return property of real value // */ // public StringProperty valueProperty() { // return value; // } // // /** // * sets the real value // * @param value the real value // */ // public void setValue(String value) { // this.value.set(value); // } // // /** // * returns if the value is valid to the rules of the validator // * @return // */ // public ValidationError getValidationError() { // return valid; // } // // /** // * sets the state if a value is valid or not // * @param valid the validation state // */ // public void setValidationError(ValidationError valid) { // this.valid = valid; // } // } // Path: src/main/java/ninja/javafx/smartcsv/validation/RevalidationService.java import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; import java.util.ArrayList; import java.util.List; import java.util.Map; import java.util.Set; import javafx.beans.property.ObjectProperty; import javafx.concurrent.Service; import javafx.concurrent.Task; import ninja.javafx.smartcsv.fx.table.model.CSVRow; import ninja.javafx.smartcsv.fx.table.model.CSVValue; this.validator = validator; } public void setRows(List<CSVRow> rows) { this.rows = rows; } public void setHeader(String[] header) { this.header = header; } @Override protected Task<List<ValidationError>> createTask() { return new Task<List<ValidationError>>() { @Override protected List<ValidationError> call() throws Exception { List<ValidationError> errors = new ArrayList<>(); try { if (header != null) { ValidationError headerError = validator.isHeaderValid(header); if (headerError != null) { logger.info("revalidate: header error found"); errors.add(headerError); } } int maxRows = rows.size(); for (int lineNumber = 0; lineNumber < maxRows; lineNumber++) { CSVRow row = rows.get(lineNumber);
Map<String, ObjectProperty<CSVValue>> table = row.getColumns();
frosch95/SmartCSV.fx
src/main/java/ninja/javafx/smartcsv/fx/util/SaveFileService.java
// Path: src/main/java/ninja/javafx/smartcsv/files/FileStorage.java // public class FileStorage<E> { // // private FileReader<E> reader; // private FileWriter<E> writer; // // public FileStorage(FileReader<E> reader, FileWriter<E> writer) { // this.reader = reader; // this.writer = writer; // } // // private BooleanProperty fileChanged = new SimpleBooleanProperty(true); // private ObjectProperty<File> file = new SimpleObjectProperty<>(); // private ObjectProperty<E> content = new SimpleObjectProperty<>(); // // public boolean isFileChanged() { // return fileChanged.get(); // } // // public BooleanProperty fileChangedProperty() { // return fileChanged; // } // // public void setFileChanged(boolean fileChanged) { // this.fileChanged.set(fileChanged); // } // // public File getFile() { // return file.get(); // } // // public ObjectProperty<File> fileProperty() { // return file; // } // // public void setFile(File file) { // this.file.set(file); // } // // public E getContent() { // return content.get(); // } // // public ObjectProperty<E> contentProperty() { // return content; // } // // public void setContent(E content) { // this.content.set(content); // } // // public void load() throws IOException { // reader.read(file.get()); // setContent(reader.getContent()); // setFileChanged(false); // } // // public void save() throws IOException { // writer.setContent(content.get()); // writer.write(file.get()); // setFileChanged(false); // } // }
import javafx.concurrent.Service; import javafx.concurrent.Task; import ninja.javafx.smartcsv.files.FileStorage;
/* The MIT License (MIT) ----------------------------------------------------------------------------- Copyright (c) 2015-2021 javafx.ninja <info@javafx.ninja> Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ package ninja.javafx.smartcsv.fx.util; /** * Service class for async save of a csv file */ @org.springframework.stereotype.Service public class SaveFileService extends Service<Void> {
// Path: src/main/java/ninja/javafx/smartcsv/files/FileStorage.java // public class FileStorage<E> { // // private FileReader<E> reader; // private FileWriter<E> writer; // // public FileStorage(FileReader<E> reader, FileWriter<E> writer) { // this.reader = reader; // this.writer = writer; // } // // private BooleanProperty fileChanged = new SimpleBooleanProperty(true); // private ObjectProperty<File> file = new SimpleObjectProperty<>(); // private ObjectProperty<E> content = new SimpleObjectProperty<>(); // // public boolean isFileChanged() { // return fileChanged.get(); // } // // public BooleanProperty fileChangedProperty() { // return fileChanged; // } // // public void setFileChanged(boolean fileChanged) { // this.fileChanged.set(fileChanged); // } // // public File getFile() { // return file.get(); // } // // public ObjectProperty<File> fileProperty() { // return file; // } // // public void setFile(File file) { // this.file.set(file); // } // // public E getContent() { // return content.get(); // } // // public ObjectProperty<E> contentProperty() { // return content; // } // // public void setContent(E content) { // this.content.set(content); // } // // public void load() throws IOException { // reader.read(file.get()); // setContent(reader.getContent()); // setFileChanged(false); // } // // public void save() throws IOException { // writer.setContent(content.get()); // writer.write(file.get()); // setFileChanged(false); // } // } // Path: src/main/java/ninja/javafx/smartcsv/fx/util/SaveFileService.java import javafx.concurrent.Service; import javafx.concurrent.Task; import ninja.javafx.smartcsv.files.FileStorage; /* The MIT License (MIT) ----------------------------------------------------------------------------- Copyright (c) 2015-2021 javafx.ninja <info@javafx.ninja> Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ package ninja.javafx.smartcsv.fx.util; /** * Service class for async save of a csv file */ @org.springframework.stereotype.Service public class SaveFileService extends Service<Void> {
private FileStorage<?> file;
frosch95/SmartCSV.fx
src/test/java/ninja/javafx/smartcsv/files/FileStorageTest.java
// Path: src/main/java/ninja/javafx/smartcsv/FileReader.java // public interface FileReader<E> { // E getContent(); // void read(File filename) throws IOException; // } // // Path: src/main/java/ninja/javafx/smartcsv/FileWriter.java // public interface FileWriter<E> { // void setContent(E content); // void write(File filename) throws IOException; // }
import ninja.javafx.smartcsv.FileReader; import ninja.javafx.smartcsv.FileWriter; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; import java.io.File; import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.Matchers.*; import static org.mockito.Mockito.*;
package ninja.javafx.smartcsv.files; public class FileStorageTest { private FileReader<String> reader;
// Path: src/main/java/ninja/javafx/smartcsv/FileReader.java // public interface FileReader<E> { // E getContent(); // void read(File filename) throws IOException; // } // // Path: src/main/java/ninja/javafx/smartcsv/FileWriter.java // public interface FileWriter<E> { // void setContent(E content); // void write(File filename) throws IOException; // } // Path: src/test/java/ninja/javafx/smartcsv/files/FileStorageTest.java import ninja.javafx.smartcsv.FileReader; import ninja.javafx.smartcsv.FileWriter; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; import java.io.File; import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.Matchers.*; import static org.mockito.Mockito.*; package ninja.javafx.smartcsv.files; public class FileStorageTest { private FileReader<String> reader;
private FileWriter<String> writer;
abarisain/dmix
MPDroid/src/main/java/com/namelessdev/mpdroid/views/AlbumDataBinder.java
// Path: MPDroid/src/main/java/com/namelessdev/mpdroid/views/holders/AbstractViewHolder.java // public abstract class AbstractViewHolder { // // }
import android.widget.ImageView; import android.widget.ProgressBar; import android.widget.TextView; import java.util.List; import com.namelessdev.mpdroid.R; import com.namelessdev.mpdroid.helpers.AlbumInfo; import com.namelessdev.mpdroid.helpers.CoverAsyncHelper; import com.namelessdev.mpdroid.views.holders.AbstractViewHolder; import com.namelessdev.mpdroid.views.holders.AlbumViewHolder; import org.a0z.mpd.item.Album; import org.a0z.mpd.item.Artist; import org.a0z.mpd.item.Item; import org.a0z.mpd.item.Music; import android.content.Context; import android.support.annotation.LayoutRes; import android.view.View;
/* * Copyright (C) 2010-2014 The MPDroid Project * * Licensed 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 com.namelessdev.mpdroid.views; public class AlbumDataBinder extends BaseDataBinder { @Override
// Path: MPDroid/src/main/java/com/namelessdev/mpdroid/views/holders/AbstractViewHolder.java // public abstract class AbstractViewHolder { // // } // Path: MPDroid/src/main/java/com/namelessdev/mpdroid/views/AlbumDataBinder.java import android.widget.ImageView; import android.widget.ProgressBar; import android.widget.TextView; import java.util.List; import com.namelessdev.mpdroid.R; import com.namelessdev.mpdroid.helpers.AlbumInfo; import com.namelessdev.mpdroid.helpers.CoverAsyncHelper; import com.namelessdev.mpdroid.views.holders.AbstractViewHolder; import com.namelessdev.mpdroid.views.holders.AlbumViewHolder; import org.a0z.mpd.item.Album; import org.a0z.mpd.item.Artist; import org.a0z.mpd.item.Item; import org.a0z.mpd.item.Music; import android.content.Context; import android.support.annotation.LayoutRes; import android.view.View; /* * Copyright (C) 2010-2014 The MPDroid Project * * Licensed 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 com.namelessdev.mpdroid.views; public class AlbumDataBinder extends BaseDataBinder { @Override
public AbstractViewHolder findInnerViews(final View targetView) {
abarisain/dmix
MPDroid/src/main/java/com/namelessdev/mpdroid/AboutActivity.java
// Path: MPDroid/src/main/java/com/namelessdev/mpdroid/adapters/SeparatedListDataBinder.java // public interface SeparatedListDataBinder { // // boolean isEnabled(int position, List<?> items, Object item); // // void onDataBind(Context context, View targetView, List<?> items, // Object item, int position); // }
import android.widget.TextView; import java.util.ArrayList; import java.util.List; import com.namelessdev.mpdroid.adapters.SeparatedListAdapter; import com.namelessdev.mpdroid.adapters.SeparatedListDataBinder; import android.app.Activity; import android.content.ComponentName; import android.content.Context; import android.content.pm.PackageInfo; import android.content.pm.PackageManager; import android.os.Bundle; import android.support.v7.app.ActionBarActivity; import android.util.Log; import android.view.LayoutInflater; import android.view.View; import android.widget.ListView;
@Override public void onCreate(final Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.about); final ListView listView = (ListView) findViewById(android.R.id.list); final LayoutInflater inflater = LayoutInflater.from(this); final View headerView = inflater.inflate(R.layout.about_header, null, false); final TextView versionInfo = (TextView) headerView.findViewById(R.id.text_version); versionInfo.setText(R.string.version); versionInfo.append(": " + getVersionName(Activity.class)); listView.setHeaderDividersEnabled(false); listView.addHeaderView(headerView); String[] tmpStringArray; final List<Object> listItems = new ArrayList<>(); listItems.add(getString(R.string.about_libraries)); tmpStringArray = getResources().getStringArray(R.array.libraries_array); for (final String tmpString : tmpStringArray) { listItems.add(new AboutListItem(tmpString)); } listItems.add(getString(R.string.about_authors)); tmpStringArray = getResources().getStringArray(R.array.authors_array); for (final String tmpString : tmpStringArray) { listItems.add(new AboutListItem(tmpString)); } listView.setAdapter(new SeparatedListAdapter(this, android.R.layout.simple_list_item_1,
// Path: MPDroid/src/main/java/com/namelessdev/mpdroid/adapters/SeparatedListDataBinder.java // public interface SeparatedListDataBinder { // // boolean isEnabled(int position, List<?> items, Object item); // // void onDataBind(Context context, View targetView, List<?> items, // Object item, int position); // } // Path: MPDroid/src/main/java/com/namelessdev/mpdroid/AboutActivity.java import android.widget.TextView; import java.util.ArrayList; import java.util.List; import com.namelessdev.mpdroid.adapters.SeparatedListAdapter; import com.namelessdev.mpdroid.adapters.SeparatedListDataBinder; import android.app.Activity; import android.content.ComponentName; import android.content.Context; import android.content.pm.PackageInfo; import android.content.pm.PackageManager; import android.os.Bundle; import android.support.v7.app.ActionBarActivity; import android.util.Log; import android.view.LayoutInflater; import android.view.View; import android.widget.ListView; @Override public void onCreate(final Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.about); final ListView listView = (ListView) findViewById(android.R.id.list); final LayoutInflater inflater = LayoutInflater.from(this); final View headerView = inflater.inflate(R.layout.about_header, null, false); final TextView versionInfo = (TextView) headerView.findViewById(R.id.text_version); versionInfo.setText(R.string.version); versionInfo.append(": " + getVersionName(Activity.class)); listView.setHeaderDividersEnabled(false); listView.addHeaderView(headerView); String[] tmpStringArray; final List<Object> listItems = new ArrayList<>(); listItems.add(getString(R.string.about_libraries)); tmpStringArray = getResources().getStringArray(R.array.libraries_array); for (final String tmpString : tmpStringArray) { listItems.add(new AboutListItem(tmpString)); } listItems.add(getString(R.string.about_authors)); tmpStringArray = getResources().getStringArray(R.array.authors_array); for (final String tmpString : tmpStringArray) { listItems.add(new AboutListItem(tmpString)); } listView.setAdapter(new SeparatedListAdapter(this, android.R.layout.simple_list_item_1,
R.layout.list_separator, new SeparatedListDataBinder() {
abarisain/dmix
MPDroid/src/main/java/com/namelessdev/mpdroid/fragments/AlbumsGridFragment.java
// Path: JMPDComm/backends/java/src/main/java/org/a0z/mpd/item/Genre.java // public class Genre extends AbstractGenre { // // public Genre(final Genre genre) { // super(genre); // } // // public Genre(final String name) { // super(name); // } // }
import android.widget.TextView; import uk.co.senab.actionbarpulltorefresh.library.PullToRefreshLayout; import com.namelessdev.mpdroid.R; import com.namelessdev.mpdroid.adapters.ArrayAdapter; import com.namelessdev.mpdroid.views.AlbumGridDataBinder; import org.a0z.mpd.item.Artist; import org.a0z.mpd.item.Genre; import android.os.Bundle; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.AbsListView; import android.widget.ListAdapter; import android.widget.ProgressBar;
/* * Copyright (C) 2010-2014 The MPDroid Project * * Licensed 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 com.namelessdev.mpdroid.fragments; public class AlbumsGridFragment extends AlbumsFragment { private static final int MIN_ITEMS_BEFORE_FAST_SCROLL = 6; public AlbumsGridFragment() { this(null); } public AlbumsGridFragment(final Artist artist) { this(artist, null); }
// Path: JMPDComm/backends/java/src/main/java/org/a0z/mpd/item/Genre.java // public class Genre extends AbstractGenre { // // public Genre(final Genre genre) { // super(genre); // } // // public Genre(final String name) { // super(name); // } // } // Path: MPDroid/src/main/java/com/namelessdev/mpdroid/fragments/AlbumsGridFragment.java import android.widget.TextView; import uk.co.senab.actionbarpulltorefresh.library.PullToRefreshLayout; import com.namelessdev.mpdroid.R; import com.namelessdev.mpdroid.adapters.ArrayAdapter; import com.namelessdev.mpdroid.views.AlbumGridDataBinder; import org.a0z.mpd.item.Artist; import org.a0z.mpd.item.Genre; import android.os.Bundle; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.AbsListView; import android.widget.ListAdapter; import android.widget.ProgressBar; /* * Copyright (C) 2010-2014 The MPDroid Project * * Licensed 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 com.namelessdev.mpdroid.fragments; public class AlbumsGridFragment extends AlbumsFragment { private static final int MIN_ITEMS_BEFORE_FAST_SCROLL = 6; public AlbumsGridFragment() { this(null); } public AlbumsGridFragment(final Artist artist) { this(artist, null); }
public AlbumsGridFragment(final Artist artist, final Genre genre) {
Prodevelop/POIProxy
es.alrocar.map.vector/src/main/java/es/alrocar/map/vector/provider/driver/buzz/BuzzDriverV1.java
// Path: es.alrocar.map.vector/src/main/java/es/alrocar/map/vector/provider/driver/impl/JSONDriver.java // public abstract class JSONDriver extends BaseDriver { // // protected String[] keys; // // public ArrayList getData(int[] tile, Extent boundingBox, // Cancellable cancellable, int zoom) { // // String query = null; // String jsonTweets = null; // JSONTokener tokener = null; // JSONObject o = null; // // ArrayList points = new ArrayList(); // try { // if (cancellable != null && cancellable.getCanceled()) // return null; // // query = buildQuery(boundingBox); // // jsonTweets = download(query); // // tokener = new JSONTokener(jsonTweets); // // o = new JSONObject(tokener); // // points = processJSON(o, cancellable); // // } catch (Exception e) { // // TODO Auto-generated catch block // e.printStackTrace(); // return points; // } finally { // tokener = null; // jsonTweets = null; // query = null; // o = null; // } // return points; // } // // public ArrayList processJSON(JSONObject o, Cancellable cancellable) // throws JSONException { // ArrayList points = new ArrayList(); // JSONArray results = getJSONArray(o); // // final int size = results.length(); // // JSONObject object; // for (int i = 0; i < size; i++) { // try { // if (cancellable != null && cancellable.getCanceled()) // return null; // object = results.getJSONObject(i); // Point f = processResult(object); // if (f != null) // points.add(f); // } catch (Exception e) { // e.printStackTrace(); // } // } // return points; // } // // public abstract String buildQuery(Extent boundingBox); // // public abstract JSONArray getJSONArray(JSONObject o) throws JSONException; // // public abstract Point processResult(JSONObject object) throws JSONException; // } // // Path: es.alrocar.map.vector/src/main/java/es/alrocar/map/vector/provider/geom/AttributePoint.java // public class AttributePoint extends Point { // // private HashMap fields = new HashMap(); // // public void addField(String key, Object value, int type) { // fields.put(key, new Attribute(value, type)); // } // // public Attribute getAttribute(String key) { // return (Attribute) fields.get(key); // } // // public HashMap getAttributes() { // return fields; // } // // public static class Attribute { // // public final static int TYPE_UNKNOWN = -1; // public final static int TYPE_STRING = 0; // public final static int TYPE_INT = 1; // public final static int TYPE_DOUBLE = 2; // public final static int TYPE_LIST_STRING = 3; // public final static int TYPE_LIST_INT = 4; // public final static int TYPE_LIST_DOUBLE = 5; // public final static int TYPE_URL = 6; // public final static int TYPE_PHONE = 7; // public final static int TYPE_DATE = 8; // // public int type = TYPE_UNKNOWN; // public Object value; // // public Attribute(Object value, int type) { // this.value = value; // this.type = type; // } // } // }
import org.json.JSONArray; import org.json.JSONException; import org.json.JSONObject; import es.alrocar.map.vector.provider.driver.impl.JSONDriver; import es.alrocar.map.vector.provider.geom.AttributePoint; import es.prodevelop.gvsig.mini.geom.Extent; import es.prodevelop.gvsig.mini.geom.Point;
/* * Licensed to Prodevelop SL under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The Prodevelop SL 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. * * For more information, contact: * * Prodevelop, S.L. * Pza. Don Juan de Villarrasa, 14 - 5 * 46001 Valencia * Spain * * +34 963 510 612 * +34 963 510 968 * prode@prodevelop.es * http://www.prodevelop.es * * @author Alberto Romeu Carrasco http://www.albertoromeu.com */ package es.alrocar.map.vector.provider.driver.buzz; public class BuzzDriverV1 extends JSONDriver { private String API_KEY = "AIzaSyDM7V5F3X0g4_aH6YSwsR4Hbd_uBuQ3QeA"; private String url = "https://www.googleapis.com/buzz/v1/activities/search?key=" + API_KEY + "&lat=_LAT_&lon=_LON_&radius=_DIST_&alt=json"; @Override public String buildQuery(Extent boundingBox) { Point center = boundingBox.getCenter(); String url = this.url.replaceAll("_LAT_", "" + center.getY()); url = url.replaceAll("_LON_", "" + center.getX()); url = url.replace("_DIST_", getDistanceMeters(boundingBox) + ""); return url; } @Override public JSONArray getJSONArray(JSONObject o) throws JSONException { return o.getJSONObject("data").getJSONArray("items"); } @Override public Point processResult(JSONObject object) {
// Path: es.alrocar.map.vector/src/main/java/es/alrocar/map/vector/provider/driver/impl/JSONDriver.java // public abstract class JSONDriver extends BaseDriver { // // protected String[] keys; // // public ArrayList getData(int[] tile, Extent boundingBox, // Cancellable cancellable, int zoom) { // // String query = null; // String jsonTweets = null; // JSONTokener tokener = null; // JSONObject o = null; // // ArrayList points = new ArrayList(); // try { // if (cancellable != null && cancellable.getCanceled()) // return null; // // query = buildQuery(boundingBox); // // jsonTweets = download(query); // // tokener = new JSONTokener(jsonTweets); // // o = new JSONObject(tokener); // // points = processJSON(o, cancellable); // // } catch (Exception e) { // // TODO Auto-generated catch block // e.printStackTrace(); // return points; // } finally { // tokener = null; // jsonTweets = null; // query = null; // o = null; // } // return points; // } // // public ArrayList processJSON(JSONObject o, Cancellable cancellable) // throws JSONException { // ArrayList points = new ArrayList(); // JSONArray results = getJSONArray(o); // // final int size = results.length(); // // JSONObject object; // for (int i = 0; i < size; i++) { // try { // if (cancellable != null && cancellable.getCanceled()) // return null; // object = results.getJSONObject(i); // Point f = processResult(object); // if (f != null) // points.add(f); // } catch (Exception e) { // e.printStackTrace(); // } // } // return points; // } // // public abstract String buildQuery(Extent boundingBox); // // public abstract JSONArray getJSONArray(JSONObject o) throws JSONException; // // public abstract Point processResult(JSONObject object) throws JSONException; // } // // Path: es.alrocar.map.vector/src/main/java/es/alrocar/map/vector/provider/geom/AttributePoint.java // public class AttributePoint extends Point { // // private HashMap fields = new HashMap(); // // public void addField(String key, Object value, int type) { // fields.put(key, new Attribute(value, type)); // } // // public Attribute getAttribute(String key) { // return (Attribute) fields.get(key); // } // // public HashMap getAttributes() { // return fields; // } // // public static class Attribute { // // public final static int TYPE_UNKNOWN = -1; // public final static int TYPE_STRING = 0; // public final static int TYPE_INT = 1; // public final static int TYPE_DOUBLE = 2; // public final static int TYPE_LIST_STRING = 3; // public final static int TYPE_LIST_INT = 4; // public final static int TYPE_LIST_DOUBLE = 5; // public final static int TYPE_URL = 6; // public final static int TYPE_PHONE = 7; // public final static int TYPE_DATE = 8; // // public int type = TYPE_UNKNOWN; // public Object value; // // public Attribute(Object value, int type) { // this.value = value; // this.type = type; // } // } // } // Path: es.alrocar.map.vector/src/main/java/es/alrocar/map/vector/provider/driver/buzz/BuzzDriverV1.java import org.json.JSONArray; import org.json.JSONException; import org.json.JSONObject; import es.alrocar.map.vector.provider.driver.impl.JSONDriver; import es.alrocar.map.vector.provider.geom.AttributePoint; import es.prodevelop.gvsig.mini.geom.Extent; import es.prodevelop.gvsig.mini.geom.Point; /* * Licensed to Prodevelop SL under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The Prodevelop SL 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. * * For more information, contact: * * Prodevelop, S.L. * Pza. Don Juan de Villarrasa, 14 - 5 * 46001 Valencia * Spain * * +34 963 510 612 * +34 963 510 968 * prode@prodevelop.es * http://www.prodevelop.es * * @author Alberto Romeu Carrasco http://www.albertoromeu.com */ package es.alrocar.map.vector.provider.driver.buzz; public class BuzzDriverV1 extends JSONDriver { private String API_KEY = "AIzaSyDM7V5F3X0g4_aH6YSwsR4Hbd_uBuQ3QeA"; private String url = "https://www.googleapis.com/buzz/v1/activities/search?key=" + API_KEY + "&lat=_LAT_&lon=_LON_&radius=_DIST_&alt=json"; @Override public String buildQuery(Extent boundingBox) { Point center = boundingBox.getCenter(); String url = this.url.replaceAll("_LAT_", "" + center.getY()); url = url.replaceAll("_LON_", "" + center.getX()); url = url.replace("_DIST_", getDistanceMeters(boundingBox) + ""); return url; } @Override public JSONArray getJSONArray(JSONObject o) throws JSONException { return o.getJSONObject("data").getJSONArray("items"); } @Override public Point processResult(JSONObject object) {
AttributePoint p = new AttributePoint();
Prodevelop/POIProxy
es.alrocar.map.vector/src/main/java/es/alrocar/map/vector/provider/VectorialProvider.java
// Path: es.alrocar.map.vector/src/main/java/es/alrocar/map/vector/provider/driver/ProviderDriver.java // public interface ProviderDriver { // // public ArrayList getData(int[] tile, Extent booundingBox, // Cancellable cancellable, int zoom); // // public boolean needsExtentToWork(); // // public String getSRS(); // // public VectorialProvider getProvider(); // // public void setProvider(VectorialProvider provider); // // public String getName(); // // public IVectorFileSystemProvider getFileSystemProvider(); // // // public void write(int[] tile, int zoomLevel, ArrayList data, // // Cancellable cancellable); // // // // public void write(int[] tile, int zoomLevel, InputStream in, // // Cancellable cancellable); // // // // public ArrayList loadFromDisk(int[] tile, Extent boundingBox, // // Cancellable cancellable); // // // // public boolean supportsLocalCache(); // // // // public boolean isOverwriteLocalCache(); // // // // public boolean isLocalCacheEnable(); // } // // Path: es.alrocar.map.vector/src/main/java/es/alrocar/map/vector/provider/observer/VectorialProviderListener.java // public interface VectorialProviderListener { // // public void onVectorDataRetrieved(int[] tile, ArrayList data, // Cancellable cancellable, int zoomLevel); // // public void onRawDataRetrieved(int[] tile, Object data, // Cancellable cancellable, ProviderDriver driver, int zoomLevel); // // } // // Path: es.alrocar.map.vector/src/main/java/es/alrocar/map/vector/provider/strategy/IVectorProviderStrategy.java // public interface IVectorProviderStrategy { // // public void getVectorialData(int[][] tiles, int zoomlevel, Extent viewExtent, // VectorialProviderListener observer, Cancellable cancellable); // // public VectorialProvider getProvider(); // // public void setProvider(VectorialProvider provider); // }
import java.util.ArrayList; import java.util.HashSet; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; import es.alrocar.map.vector.provider.driver.ProviderDriver; import es.alrocar.map.vector.provider.observer.VectorialProviderListener; import es.alrocar.map.vector.provider.strategy.IVectorProviderStrategy; import es.prodevelop.gvsig.mini.geom.Extent; import es.prodevelop.gvsig.mini.utiles.Cancellable; import es.prodevelop.tilecache.renderer.MapRenderer;
/* * Licensed to Prodevelop SL under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The Prodevelop SL 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. * * For more information, contact: * * Prodevelop, S.L. * Pza. Don Juan de Villarrasa, 14 - 5 * 46001 Valencia * Spain * * +34 963 510 612 * +34 963 510 968 * prode@prodevelop.es * http://www.prodevelop.es * * @author Alberto Romeu Carrasco http://www.albertoromeu.com */ package es.alrocar.map.vector.provider; /** * * @author albertoromeu * */ public class VectorialProvider implements VectorialProviderListener { private MapRenderer renderer;
// Path: es.alrocar.map.vector/src/main/java/es/alrocar/map/vector/provider/driver/ProviderDriver.java // public interface ProviderDriver { // // public ArrayList getData(int[] tile, Extent booundingBox, // Cancellable cancellable, int zoom); // // public boolean needsExtentToWork(); // // public String getSRS(); // // public VectorialProvider getProvider(); // // public void setProvider(VectorialProvider provider); // // public String getName(); // // public IVectorFileSystemProvider getFileSystemProvider(); // // // public void write(int[] tile, int zoomLevel, ArrayList data, // // Cancellable cancellable); // // // // public void write(int[] tile, int zoomLevel, InputStream in, // // Cancellable cancellable); // // // // public ArrayList loadFromDisk(int[] tile, Extent boundingBox, // // Cancellable cancellable); // // // // public boolean supportsLocalCache(); // // // // public boolean isOverwriteLocalCache(); // // // // public boolean isLocalCacheEnable(); // } // // Path: es.alrocar.map.vector/src/main/java/es/alrocar/map/vector/provider/observer/VectorialProviderListener.java // public interface VectorialProviderListener { // // public void onVectorDataRetrieved(int[] tile, ArrayList data, // Cancellable cancellable, int zoomLevel); // // public void onRawDataRetrieved(int[] tile, Object data, // Cancellable cancellable, ProviderDriver driver, int zoomLevel); // // } // // Path: es.alrocar.map.vector/src/main/java/es/alrocar/map/vector/provider/strategy/IVectorProviderStrategy.java // public interface IVectorProviderStrategy { // // public void getVectorialData(int[][] tiles, int zoomlevel, Extent viewExtent, // VectorialProviderListener observer, Cancellable cancellable); // // public VectorialProvider getProvider(); // // public void setProvider(VectorialProvider provider); // } // Path: es.alrocar.map.vector/src/main/java/es/alrocar/map/vector/provider/VectorialProvider.java import java.util.ArrayList; import java.util.HashSet; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; import es.alrocar.map.vector.provider.driver.ProviderDriver; import es.alrocar.map.vector.provider.observer.VectorialProviderListener; import es.alrocar.map.vector.provider.strategy.IVectorProviderStrategy; import es.prodevelop.gvsig.mini.geom.Extent; import es.prodevelop.gvsig.mini.utiles.Cancellable; import es.prodevelop.tilecache.renderer.MapRenderer; /* * Licensed to Prodevelop SL under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The Prodevelop SL 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. * * For more information, contact: * * Prodevelop, S.L. * Pza. Don Juan de Villarrasa, 14 - 5 * 46001 Valencia * Spain * * +34 963 510 612 * +34 963 510 968 * prode@prodevelop.es * http://www.prodevelop.es * * @author Alberto Romeu Carrasco http://www.albertoromeu.com */ package es.alrocar.map.vector.provider; /** * * @author albertoromeu * */ public class VectorialProvider implements VectorialProviderListener { private MapRenderer renderer;
private IVectorProviderStrategy strategy;
Prodevelop/POIProxy
es.alrocar.map.vector/src/main/java/es/alrocar/map/vector/provider/VectorialProvider.java
// Path: es.alrocar.map.vector/src/main/java/es/alrocar/map/vector/provider/driver/ProviderDriver.java // public interface ProviderDriver { // // public ArrayList getData(int[] tile, Extent booundingBox, // Cancellable cancellable, int zoom); // // public boolean needsExtentToWork(); // // public String getSRS(); // // public VectorialProvider getProvider(); // // public void setProvider(VectorialProvider provider); // // public String getName(); // // public IVectorFileSystemProvider getFileSystemProvider(); // // // public void write(int[] tile, int zoomLevel, ArrayList data, // // Cancellable cancellable); // // // // public void write(int[] tile, int zoomLevel, InputStream in, // // Cancellable cancellable); // // // // public ArrayList loadFromDisk(int[] tile, Extent boundingBox, // // Cancellable cancellable); // // // // public boolean supportsLocalCache(); // // // // public boolean isOverwriteLocalCache(); // // // // public boolean isLocalCacheEnable(); // } // // Path: es.alrocar.map.vector/src/main/java/es/alrocar/map/vector/provider/observer/VectorialProviderListener.java // public interface VectorialProviderListener { // // public void onVectorDataRetrieved(int[] tile, ArrayList data, // Cancellable cancellable, int zoomLevel); // // public void onRawDataRetrieved(int[] tile, Object data, // Cancellable cancellable, ProviderDriver driver, int zoomLevel); // // } // // Path: es.alrocar.map.vector/src/main/java/es/alrocar/map/vector/provider/strategy/IVectorProviderStrategy.java // public interface IVectorProviderStrategy { // // public void getVectorialData(int[][] tiles, int zoomlevel, Extent viewExtent, // VectorialProviderListener observer, Cancellable cancellable); // // public VectorialProvider getProvider(); // // public void setProvider(VectorialProvider provider); // }
import java.util.ArrayList; import java.util.HashSet; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; import es.alrocar.map.vector.provider.driver.ProviderDriver; import es.alrocar.map.vector.provider.observer.VectorialProviderListener; import es.alrocar.map.vector.provider.strategy.IVectorProviderStrategy; import es.prodevelop.gvsig.mini.geom.Extent; import es.prodevelop.gvsig.mini.utiles.Cancellable; import es.prodevelop.tilecache.renderer.MapRenderer;
/* * Licensed to Prodevelop SL under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The Prodevelop SL 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. * * For more information, contact: * * Prodevelop, S.L. * Pza. Don Juan de Villarrasa, 14 - 5 * 46001 Valencia * Spain * * +34 963 510 612 * +34 963 510 968 * prode@prodevelop.es * http://www.prodevelop.es * * @author Alberto Romeu Carrasco http://www.albertoromeu.com */ package es.alrocar.map.vector.provider; /** * * @author albertoromeu * */ public class VectorialProvider implements VectorialProviderListener { private MapRenderer renderer; private IVectorProviderStrategy strategy;
// Path: es.alrocar.map.vector/src/main/java/es/alrocar/map/vector/provider/driver/ProviderDriver.java // public interface ProviderDriver { // // public ArrayList getData(int[] tile, Extent booundingBox, // Cancellable cancellable, int zoom); // // public boolean needsExtentToWork(); // // public String getSRS(); // // public VectorialProvider getProvider(); // // public void setProvider(VectorialProvider provider); // // public String getName(); // // public IVectorFileSystemProvider getFileSystemProvider(); // // // public void write(int[] tile, int zoomLevel, ArrayList data, // // Cancellable cancellable); // // // // public void write(int[] tile, int zoomLevel, InputStream in, // // Cancellable cancellable); // // // // public ArrayList loadFromDisk(int[] tile, Extent boundingBox, // // Cancellable cancellable); // // // // public boolean supportsLocalCache(); // // // // public boolean isOverwriteLocalCache(); // // // // public boolean isLocalCacheEnable(); // } // // Path: es.alrocar.map.vector/src/main/java/es/alrocar/map/vector/provider/observer/VectorialProviderListener.java // public interface VectorialProviderListener { // // public void onVectorDataRetrieved(int[] tile, ArrayList data, // Cancellable cancellable, int zoomLevel); // // public void onRawDataRetrieved(int[] tile, Object data, // Cancellable cancellable, ProviderDriver driver, int zoomLevel); // // } // // Path: es.alrocar.map.vector/src/main/java/es/alrocar/map/vector/provider/strategy/IVectorProviderStrategy.java // public interface IVectorProviderStrategy { // // public void getVectorialData(int[][] tiles, int zoomlevel, Extent viewExtent, // VectorialProviderListener observer, Cancellable cancellable); // // public VectorialProvider getProvider(); // // public void setProvider(VectorialProvider provider); // } // Path: es.alrocar.map.vector/src/main/java/es/alrocar/map/vector/provider/VectorialProvider.java import java.util.ArrayList; import java.util.HashSet; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; import es.alrocar.map.vector.provider.driver.ProviderDriver; import es.alrocar.map.vector.provider.observer.VectorialProviderListener; import es.alrocar.map.vector.provider.strategy.IVectorProviderStrategy; import es.prodevelop.gvsig.mini.geom.Extent; import es.prodevelop.gvsig.mini.utiles.Cancellable; import es.prodevelop.tilecache.renderer.MapRenderer; /* * Licensed to Prodevelop SL under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The Prodevelop SL 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. * * For more information, contact: * * Prodevelop, S.L. * Pza. Don Juan de Villarrasa, 14 - 5 * 46001 Valencia * Spain * * +34 963 510 612 * +34 963 510 968 * prode@prodevelop.es * http://www.prodevelop.es * * @author Alberto Romeu Carrasco http://www.albertoromeu.com */ package es.alrocar.map.vector.provider; /** * * @author albertoromeu * */ public class VectorialProvider implements VectorialProviderListener { private MapRenderer renderer; private IVectorProviderStrategy strategy;
private ProviderDriver driver;
Prodevelop/POIProxy
es.alrocar.poiproxy.fiware.poidp/src/main/java/es/alrocar/poiproxy/fiware/poidp/schema/fw_contact_class.java
// Path: es.alrocar.poiproxy.fiware.poidp/src/main/java/es/alrocar/poiproxy/fiware/poidp/schema/utils/Source.java // public class Source extends HashMap<String, String> { // // public Source() { // // } // // public void setName(String name) { // this.put("name", name); // // website id license // } // // public void setWebsite(String str) { // this.put("website", str); // // website id license // } // // public void setId(String str) { // this.put("id", str); // // website id license // } // // public void setLicense(String str) { // this.put("license", str); // // website id license // } // // } // // Path: es.alrocar.poiproxy.fiware.poidp/src/main/java/es/alrocar/poiproxy/fiware/poidp/schema/utils/UpdateStamp.java // public class UpdateStamp { // // private long timestamp = 0; // private String responsible = ""; // // public long getTimestamp() { // return timestamp; // } // // public void setTimestamp(long timestamp) { // this.timestamp = timestamp; // } // // public String getResponsible() { // return responsible; // } // // public void setResponsible(String responsible) { // this.responsible = responsible; // } // // }
import es.alrocar.poiproxy.fiware.poidp.schema.utils.Source; import es.alrocar.poiproxy.fiware.poidp.schema.utils.UpdateStamp;
/* * Licensed to Prodevelop SL under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The Prodevelop SL 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. * * For more information, contact: * * Prodevelop, S.L. * Pza. Don Juan de Villarrasa, 14 - 5 * 46001 Valencia * Spain * * +34 963 510 612 * +34 963 510 968 * prode@prodevelop.es * http://www.prodevelop.es * * @author Alberto Romeu Carrasco aromeu@prodevelop.es */ package es.alrocar.poiproxy.fiware.poidp.schema; public class fw_contact_class { private String visit = ""; private String[] postal = new String[0]; private String mailto = ""; private String[] phone = new String[0];
// Path: es.alrocar.poiproxy.fiware.poidp/src/main/java/es/alrocar/poiproxy/fiware/poidp/schema/utils/Source.java // public class Source extends HashMap<String, String> { // // public Source() { // // } // // public void setName(String name) { // this.put("name", name); // // website id license // } // // public void setWebsite(String str) { // this.put("website", str); // // website id license // } // // public void setId(String str) { // this.put("id", str); // // website id license // } // // public void setLicense(String str) { // this.put("license", str); // // website id license // } // // } // // Path: es.alrocar.poiproxy.fiware.poidp/src/main/java/es/alrocar/poiproxy/fiware/poidp/schema/utils/UpdateStamp.java // public class UpdateStamp { // // private long timestamp = 0; // private String responsible = ""; // // public long getTimestamp() { // return timestamp; // } // // public void setTimestamp(long timestamp) { // this.timestamp = timestamp; // } // // public String getResponsible() { // return responsible; // } // // public void setResponsible(String responsible) { // this.responsible = responsible; // } // // } // Path: es.alrocar.poiproxy.fiware.poidp/src/main/java/es/alrocar/poiproxy/fiware/poidp/schema/fw_contact_class.java import es.alrocar.poiproxy.fiware.poidp.schema.utils.Source; import es.alrocar.poiproxy.fiware.poidp.schema.utils.UpdateStamp; /* * Licensed to Prodevelop SL under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The Prodevelop SL 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. * * For more information, contact: * * Prodevelop, S.L. * Pza. Don Juan de Villarrasa, 14 - 5 * 46001 Valencia * Spain * * +34 963 510 612 * +34 963 510 968 * prode@prodevelop.es * http://www.prodevelop.es * * @author Alberto Romeu Carrasco aromeu@prodevelop.es */ package es.alrocar.poiproxy.fiware.poidp.schema; public class fw_contact_class { private String visit = ""; private String[] postal = new String[0]; private String mailto = ""; private String[] phone = new String[0];
private Source source = null;
Prodevelop/POIProxy
es.alrocar.poiproxy.fiware.poidp/src/main/java/es/alrocar/poiproxy/fiware/poidp/schema/fw_contact_class.java
// Path: es.alrocar.poiproxy.fiware.poidp/src/main/java/es/alrocar/poiproxy/fiware/poidp/schema/utils/Source.java // public class Source extends HashMap<String, String> { // // public Source() { // // } // // public void setName(String name) { // this.put("name", name); // // website id license // } // // public void setWebsite(String str) { // this.put("website", str); // // website id license // } // // public void setId(String str) { // this.put("id", str); // // website id license // } // // public void setLicense(String str) { // this.put("license", str); // // website id license // } // // } // // Path: es.alrocar.poiproxy.fiware.poidp/src/main/java/es/alrocar/poiproxy/fiware/poidp/schema/utils/UpdateStamp.java // public class UpdateStamp { // // private long timestamp = 0; // private String responsible = ""; // // public long getTimestamp() { // return timestamp; // } // // public void setTimestamp(long timestamp) { // this.timestamp = timestamp; // } // // public String getResponsible() { // return responsible; // } // // public void setResponsible(String responsible) { // this.responsible = responsible; // } // // }
import es.alrocar.poiproxy.fiware.poidp.schema.utils.Source; import es.alrocar.poiproxy.fiware.poidp.schema.utils.UpdateStamp;
/* * Licensed to Prodevelop SL under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The Prodevelop SL 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. * * For more information, contact: * * Prodevelop, S.L. * Pza. Don Juan de Villarrasa, 14 - 5 * 46001 Valencia * Spain * * +34 963 510 612 * +34 963 510 968 * prode@prodevelop.es * http://www.prodevelop.es * * @author Alberto Romeu Carrasco aromeu@prodevelop.es */ package es.alrocar.poiproxy.fiware.poidp.schema; public class fw_contact_class { private String visit = ""; private String[] postal = new String[0]; private String mailto = ""; private String[] phone = new String[0]; private Source source = null;
// Path: es.alrocar.poiproxy.fiware.poidp/src/main/java/es/alrocar/poiproxy/fiware/poidp/schema/utils/Source.java // public class Source extends HashMap<String, String> { // // public Source() { // // } // // public void setName(String name) { // this.put("name", name); // // website id license // } // // public void setWebsite(String str) { // this.put("website", str); // // website id license // } // // public void setId(String str) { // this.put("id", str); // // website id license // } // // public void setLicense(String str) { // this.put("license", str); // // website id license // } // // } // // Path: es.alrocar.poiproxy.fiware.poidp/src/main/java/es/alrocar/poiproxy/fiware/poidp/schema/utils/UpdateStamp.java // public class UpdateStamp { // // private long timestamp = 0; // private String responsible = ""; // // public long getTimestamp() { // return timestamp; // } // // public void setTimestamp(long timestamp) { // this.timestamp = timestamp; // } // // public String getResponsible() { // return responsible; // } // // public void setResponsible(String responsible) { // this.responsible = responsible; // } // // } // Path: es.alrocar.poiproxy.fiware.poidp/src/main/java/es/alrocar/poiproxy/fiware/poidp/schema/fw_contact_class.java import es.alrocar.poiproxy.fiware.poidp.schema.utils.Source; import es.alrocar.poiproxy.fiware.poidp.schema.utils.UpdateStamp; /* * Licensed to Prodevelop SL under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The Prodevelop SL 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. * * For more information, contact: * * Prodevelop, S.L. * Pza. Don Juan de Villarrasa, 14 - 5 * 46001 Valencia * Spain * * +34 963 510 612 * +34 963 510 968 * prode@prodevelop.es * http://www.prodevelop.es * * @author Alberto Romeu Carrasco aromeu@prodevelop.es */ package es.alrocar.poiproxy.fiware.poidp.schema; public class fw_contact_class { private String visit = ""; private String[] postal = new String[0]; private String mailto = ""; private String[] phone = new String[0]; private Source source = null;
private UpdateStamp last_update = null;
Prodevelop/POIProxy
es.alrocar.map.vector/src/main/java/es/alrocar/map/vector/provider/strategy/impl/TileStrategy.java
// Path: es.alrocar.map.vector/src/main/java/es/alrocar/map/vector/provider/driver/ProviderDriver.java // public interface ProviderDriver { // // public ArrayList getData(int[] tile, Extent booundingBox, // Cancellable cancellable, int zoom); // // public boolean needsExtentToWork(); // // public String getSRS(); // // public VectorialProvider getProvider(); // // public void setProvider(VectorialProvider provider); // // public String getName(); // // public IVectorFileSystemProvider getFileSystemProvider(); // // // public void write(int[] tile, int zoomLevel, ArrayList data, // // Cancellable cancellable); // // // // public void write(int[] tile, int zoomLevel, InputStream in, // // Cancellable cancellable); // // // // public ArrayList loadFromDisk(int[] tile, Extent boundingBox, // // Cancellable cancellable); // // // // public boolean supportsLocalCache(); // // // // public boolean isOverwriteLocalCache(); // // // // public boolean isLocalCacheEnable(); // } // // Path: es.alrocar.map.vector/src/main/java/es/alrocar/map/vector/provider/observer/VectorialProviderListener.java // public interface VectorialProviderListener { // // public void onVectorDataRetrieved(int[] tile, ArrayList data, // Cancellable cancellable, int zoomLevel); // // public void onRawDataRetrieved(int[] tile, Object data, // Cancellable cancellable, ProviderDriver driver, int zoomLevel); // // }
import es.alrocar.map.vector.provider.driver.ProviderDriver; import es.alrocar.map.vector.provider.observer.VectorialProviderListener; import es.prodevelop.gvsig.mini.geom.Extent; import es.prodevelop.gvsig.mini.utiles.Cancellable; import es.prodevelop.tilecache.renderer.MapRenderer;
/* * Licensed to Prodevelop SL under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The Prodevelop SL 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. * * For more information, contact: * * Prodevelop, S.L. * Pza. Don Juan de Villarrasa, 14 - 5 * 46001 Valencia * Spain * * +34 963 510 612 * +34 963 510 968 * prode@prodevelop.es * http://www.prodevelop.es * * @author Alberto Romeu Carrasco http://www.albertoromeu.com */ package es.alrocar.map.vector.provider.strategy.impl; /** * * @author albertoromeu * */ public class TileStrategy extends BaseStrategy { public void getVectorialData(int[][] tiles, int zoomLevel,
// Path: es.alrocar.map.vector/src/main/java/es/alrocar/map/vector/provider/driver/ProviderDriver.java // public interface ProviderDriver { // // public ArrayList getData(int[] tile, Extent booundingBox, // Cancellable cancellable, int zoom); // // public boolean needsExtentToWork(); // // public String getSRS(); // // public VectorialProvider getProvider(); // // public void setProvider(VectorialProvider provider); // // public String getName(); // // public IVectorFileSystemProvider getFileSystemProvider(); // // // public void write(int[] tile, int zoomLevel, ArrayList data, // // Cancellable cancellable); // // // // public void write(int[] tile, int zoomLevel, InputStream in, // // Cancellable cancellable); // // // // public ArrayList loadFromDisk(int[] tile, Extent boundingBox, // // Cancellable cancellable); // // // // public boolean supportsLocalCache(); // // // // public boolean isOverwriteLocalCache(); // // // // public boolean isLocalCacheEnable(); // } // // Path: es.alrocar.map.vector/src/main/java/es/alrocar/map/vector/provider/observer/VectorialProviderListener.java // public interface VectorialProviderListener { // // public void onVectorDataRetrieved(int[] tile, ArrayList data, // Cancellable cancellable, int zoomLevel); // // public void onRawDataRetrieved(int[] tile, Object data, // Cancellable cancellable, ProviderDriver driver, int zoomLevel); // // } // Path: es.alrocar.map.vector/src/main/java/es/alrocar/map/vector/provider/strategy/impl/TileStrategy.java import es.alrocar.map.vector.provider.driver.ProviderDriver; import es.alrocar.map.vector.provider.observer.VectorialProviderListener; import es.prodevelop.gvsig.mini.geom.Extent; import es.prodevelop.gvsig.mini.utiles.Cancellable; import es.prodevelop.tilecache.renderer.MapRenderer; /* * Licensed to Prodevelop SL under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The Prodevelop SL 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. * * For more information, contact: * * Prodevelop, S.L. * Pza. Don Juan de Villarrasa, 14 - 5 * 46001 Valencia * Spain * * +34 963 510 612 * +34 963 510 968 * prode@prodevelop.es * http://www.prodevelop.es * * @author Alberto Romeu Carrasco http://www.albertoromeu.com */ package es.alrocar.map.vector.provider.strategy.impl; /** * * @author albertoromeu * */ public class TileStrategy extends BaseStrategy { public void getVectorialData(int[][] tiles, int zoomLevel,
Extent viewExtent, VectorialProviderListener observer,
Prodevelop/POIProxy
es.alrocar.map.vector/src/main/java/es/alrocar/map/vector/provider/strategy/impl/TileStrategy.java
// Path: es.alrocar.map.vector/src/main/java/es/alrocar/map/vector/provider/driver/ProviderDriver.java // public interface ProviderDriver { // // public ArrayList getData(int[] tile, Extent booundingBox, // Cancellable cancellable, int zoom); // // public boolean needsExtentToWork(); // // public String getSRS(); // // public VectorialProvider getProvider(); // // public void setProvider(VectorialProvider provider); // // public String getName(); // // public IVectorFileSystemProvider getFileSystemProvider(); // // // public void write(int[] tile, int zoomLevel, ArrayList data, // // Cancellable cancellable); // // // // public void write(int[] tile, int zoomLevel, InputStream in, // // Cancellable cancellable); // // // // public ArrayList loadFromDisk(int[] tile, Extent boundingBox, // // Cancellable cancellable); // // // // public boolean supportsLocalCache(); // // // // public boolean isOverwriteLocalCache(); // // // // public boolean isLocalCacheEnable(); // } // // Path: es.alrocar.map.vector/src/main/java/es/alrocar/map/vector/provider/observer/VectorialProviderListener.java // public interface VectorialProviderListener { // // public void onVectorDataRetrieved(int[] tile, ArrayList data, // Cancellable cancellable, int zoomLevel); // // public void onRawDataRetrieved(int[] tile, Object data, // Cancellable cancellable, ProviderDriver driver, int zoomLevel); // // }
import es.alrocar.map.vector.provider.driver.ProviderDriver; import es.alrocar.map.vector.provider.observer.VectorialProviderListener; import es.prodevelop.gvsig.mini.geom.Extent; import es.prodevelop.gvsig.mini.utiles.Cancellable; import es.prodevelop.tilecache.renderer.MapRenderer;
/* * Licensed to Prodevelop SL under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The Prodevelop SL 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. * * For more information, contact: * * Prodevelop, S.L. * Pza. Don Juan de Villarrasa, 14 - 5 * 46001 Valencia * Spain * * +34 963 510 612 * +34 963 510 968 * prode@prodevelop.es * http://www.prodevelop.es * * @author Alberto Romeu Carrasco http://www.albertoromeu.com */ package es.alrocar.map.vector.provider.strategy.impl; /** * * @author albertoromeu * */ public class TileStrategy extends BaseStrategy { public void getVectorialData(int[][] tiles, int zoomLevel, Extent viewExtent, VectorialProviderListener observer, Cancellable cancellable) { try { final int size = tiles.length;
// Path: es.alrocar.map.vector/src/main/java/es/alrocar/map/vector/provider/driver/ProviderDriver.java // public interface ProviderDriver { // // public ArrayList getData(int[] tile, Extent booundingBox, // Cancellable cancellable, int zoom); // // public boolean needsExtentToWork(); // // public String getSRS(); // // public VectorialProvider getProvider(); // // public void setProvider(VectorialProvider provider); // // public String getName(); // // public IVectorFileSystemProvider getFileSystemProvider(); // // // public void write(int[] tile, int zoomLevel, ArrayList data, // // Cancellable cancellable); // // // // public void write(int[] tile, int zoomLevel, InputStream in, // // Cancellable cancellable); // // // // public ArrayList loadFromDisk(int[] tile, Extent boundingBox, // // Cancellable cancellable); // // // // public boolean supportsLocalCache(); // // // // public boolean isOverwriteLocalCache(); // // // // public boolean isLocalCacheEnable(); // } // // Path: es.alrocar.map.vector/src/main/java/es/alrocar/map/vector/provider/observer/VectorialProviderListener.java // public interface VectorialProviderListener { // // public void onVectorDataRetrieved(int[] tile, ArrayList data, // Cancellable cancellable, int zoomLevel); // // public void onRawDataRetrieved(int[] tile, Object data, // Cancellable cancellable, ProviderDriver driver, int zoomLevel); // // } // Path: es.alrocar.map.vector/src/main/java/es/alrocar/map/vector/provider/strategy/impl/TileStrategy.java import es.alrocar.map.vector.provider.driver.ProviderDriver; import es.alrocar.map.vector.provider.observer.VectorialProviderListener; import es.prodevelop.gvsig.mini.geom.Extent; import es.prodevelop.gvsig.mini.utiles.Cancellable; import es.prodevelop.tilecache.renderer.MapRenderer; /* * Licensed to Prodevelop SL under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The Prodevelop SL 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. * * For more information, contact: * * Prodevelop, S.L. * Pza. Don Juan de Villarrasa, 14 - 5 * 46001 Valencia * Spain * * +34 963 510 612 * +34 963 510 968 * prode@prodevelop.es * http://www.prodevelop.es * * @author Alberto Romeu Carrasco http://www.albertoromeu.com */ package es.alrocar.map.vector.provider.strategy.impl; /** * * @author albertoromeu * */ public class TileStrategy extends BaseStrategy { public void getVectorialData(int[][] tiles, int zoomLevel, Extent viewExtent, VectorialProviderListener observer, Cancellable cancellable) { try { final int size = tiles.length;
final ProviderDriver driver = getProvider().getDriver();
Prodevelop/POIProxy
es.alrocar.poiproxy.fiware.poidp/src/main/java/es/alrocar/poiproxy/fiware/poidp/schema/fw_xml3d_class.java
// Path: es.alrocar.poiproxy.fiware.poidp/src/main/java/es/alrocar/poiproxy/fiware/poidp/schema/utils/Source.java // public class Source extends HashMap<String, String> { // // public Source() { // // } // // public void setName(String name) { // this.put("name", name); // // website id license // } // // public void setWebsite(String str) { // this.put("website", str); // // website id license // } // // public void setId(String str) { // this.put("id", str); // // website id license // } // // public void setLicense(String str) { // this.put("license", str); // // website id license // } // // } // // Path: es.alrocar.poiproxy.fiware.poidp/src/main/java/es/alrocar/poiproxy/fiware/poidp/schema/utils/UpdateStamp.java // public class UpdateStamp { // // private long timestamp = 0; // private String responsible = ""; // // public long getTimestamp() { // return timestamp; // } // // public void setTimestamp(long timestamp) { // this.timestamp = timestamp; // } // // public String getResponsible() { // return responsible; // } // // public void setResponsible(String responsible) { // this.responsible = responsible; // } // // }
import es.alrocar.poiproxy.fiware.poidp.schema.utils.Source; import es.alrocar.poiproxy.fiware.poidp.schema.utils.UpdateStamp;
/* * Licensed to Prodevelop SL under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The Prodevelop SL 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. * * For more information, contact: * * Prodevelop, S.L. * Pza. Don Juan de Villarrasa, 14 - 5 * 46001 Valencia * Spain * * +34 963 510 612 * +34 963 510 968 * prode@prodevelop.es * http://www.prodevelop.es * * @author Alberto Romeu Carrasco aromeu@prodevelop.es */ package es.alrocar.poiproxy.fiware.poidp.schema; public class fw_xml3d_class { private String model_id = ""; private String model = "";
// Path: es.alrocar.poiproxy.fiware.poidp/src/main/java/es/alrocar/poiproxy/fiware/poidp/schema/utils/Source.java // public class Source extends HashMap<String, String> { // // public Source() { // // } // // public void setName(String name) { // this.put("name", name); // // website id license // } // // public void setWebsite(String str) { // this.put("website", str); // // website id license // } // // public void setId(String str) { // this.put("id", str); // // website id license // } // // public void setLicense(String str) { // this.put("license", str); // // website id license // } // // } // // Path: es.alrocar.poiproxy.fiware.poidp/src/main/java/es/alrocar/poiproxy/fiware/poidp/schema/utils/UpdateStamp.java // public class UpdateStamp { // // private long timestamp = 0; // private String responsible = ""; // // public long getTimestamp() { // return timestamp; // } // // public void setTimestamp(long timestamp) { // this.timestamp = timestamp; // } // // public String getResponsible() { // return responsible; // } // // public void setResponsible(String responsible) { // this.responsible = responsible; // } // // } // Path: es.alrocar.poiproxy.fiware.poidp/src/main/java/es/alrocar/poiproxy/fiware/poidp/schema/fw_xml3d_class.java import es.alrocar.poiproxy.fiware.poidp.schema.utils.Source; import es.alrocar.poiproxy.fiware.poidp.schema.utils.UpdateStamp; /* * Licensed to Prodevelop SL under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The Prodevelop SL 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. * * For more information, contact: * * Prodevelop, S.L. * Pza. Don Juan de Villarrasa, 14 - 5 * 46001 Valencia * Spain * * +34 963 510 612 * +34 963 510 968 * prode@prodevelop.es * http://www.prodevelop.es * * @author Alberto Romeu Carrasco aromeu@prodevelop.es */ package es.alrocar.poiproxy.fiware.poidp.schema; public class fw_xml3d_class { private String model_id = ""; private String model = "";
private Source source = null;
Prodevelop/POIProxy
es.alrocar.poiproxy.fiware.poidp/src/main/java/es/alrocar/poiproxy/fiware/poidp/schema/fw_xml3d_class.java
// Path: es.alrocar.poiproxy.fiware.poidp/src/main/java/es/alrocar/poiproxy/fiware/poidp/schema/utils/Source.java // public class Source extends HashMap<String, String> { // // public Source() { // // } // // public void setName(String name) { // this.put("name", name); // // website id license // } // // public void setWebsite(String str) { // this.put("website", str); // // website id license // } // // public void setId(String str) { // this.put("id", str); // // website id license // } // // public void setLicense(String str) { // this.put("license", str); // // website id license // } // // } // // Path: es.alrocar.poiproxy.fiware.poidp/src/main/java/es/alrocar/poiproxy/fiware/poidp/schema/utils/UpdateStamp.java // public class UpdateStamp { // // private long timestamp = 0; // private String responsible = ""; // // public long getTimestamp() { // return timestamp; // } // // public void setTimestamp(long timestamp) { // this.timestamp = timestamp; // } // // public String getResponsible() { // return responsible; // } // // public void setResponsible(String responsible) { // this.responsible = responsible; // } // // }
import es.alrocar.poiproxy.fiware.poidp.schema.utils.Source; import es.alrocar.poiproxy.fiware.poidp.schema.utils.UpdateStamp;
/* * Licensed to Prodevelop SL under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The Prodevelop SL 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. * * For more information, contact: * * Prodevelop, S.L. * Pza. Don Juan de Villarrasa, 14 - 5 * 46001 Valencia * Spain * * +34 963 510 612 * +34 963 510 968 * prode@prodevelop.es * http://www.prodevelop.es * * @author Alberto Romeu Carrasco aromeu@prodevelop.es */ package es.alrocar.poiproxy.fiware.poidp.schema; public class fw_xml3d_class { private String model_id = ""; private String model = ""; private Source source = null;
// Path: es.alrocar.poiproxy.fiware.poidp/src/main/java/es/alrocar/poiproxy/fiware/poidp/schema/utils/Source.java // public class Source extends HashMap<String, String> { // // public Source() { // // } // // public void setName(String name) { // this.put("name", name); // // website id license // } // // public void setWebsite(String str) { // this.put("website", str); // // website id license // } // // public void setId(String str) { // this.put("id", str); // // website id license // } // // public void setLicense(String str) { // this.put("license", str); // // website id license // } // // } // // Path: es.alrocar.poiproxy.fiware.poidp/src/main/java/es/alrocar/poiproxy/fiware/poidp/schema/utils/UpdateStamp.java // public class UpdateStamp { // // private long timestamp = 0; // private String responsible = ""; // // public long getTimestamp() { // return timestamp; // } // // public void setTimestamp(long timestamp) { // this.timestamp = timestamp; // } // // public String getResponsible() { // return responsible; // } // // public void setResponsible(String responsible) { // this.responsible = responsible; // } // // } // Path: es.alrocar.poiproxy.fiware.poidp/src/main/java/es/alrocar/poiproxy/fiware/poidp/schema/fw_xml3d_class.java import es.alrocar.poiproxy.fiware.poidp.schema.utils.Source; import es.alrocar.poiproxy.fiware.poidp.schema.utils.UpdateStamp; /* * Licensed to Prodevelop SL under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The Prodevelop SL 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. * * For more information, contact: * * Prodevelop, S.L. * Pza. Don Juan de Villarrasa, 14 - 5 * 46001 Valencia * Spain * * +34 963 510 612 * +34 963 510 968 * prode@prodevelop.es * http://www.prodevelop.es * * @author Alberto Romeu Carrasco aromeu@prodevelop.es */ package es.alrocar.poiproxy.fiware.poidp.schema; public class fw_xml3d_class { private String model_id = ""; private String model = ""; private Source source = null;
private UpdateStamp last_update = null;
Prodevelop/POIProxy
es.alrocar.poiproxy/src/main/java/es/alrocar/poiproxy/configuration/AuthTypeEnum.java
// Path: es.alrocar.poiproxy/src/main/java/es/alrocar/poiproxy/request/OauthRequestService.java // public class OauthRequestService implements RequestService { // // @Override // public byte[] download(String URL, String fileName, String downloadPath, // Auth authElem) throws Exception { // AuthTypeEnum authType = AuthTypeEnum.valueOf(authElem.getType()); // // OAuthService service = new ServiceBuilder().provider(authType._class) // .apiKey(authElem.getApiKey()) // .apiSecret(authElem.getApiSecret()).build(); // // OAuthRequest request = new OAuthRequest(Verb.GET, URL); // Token myToken = new Token(authElem.getAccessToken(), // authElem.getAccessTokenSecret()); // // service.signRequest(myToken, request); // Response response = request.send(); // // return response.getBody().getBytes(); // } // } // // Path: es.alrocar.poiproxy/src/main/java/es/alrocar/poiproxy/request/RequestService.java // public interface RequestService { // // /** // * // * @param URL // * The URL where download data from // * @param fileName // * The name of the file to store the data in // * @param downloadPath // * The path where to store the file // * @param authElement // * The {@link Auth} configuration that can have, apiKeys, // * credentials, etc. // * @return An array of bytes with the data // * @throws Exception // */ // public byte[] download(String URL, String fileName, String downloadPath, // Auth authElement) throws Exception; // } // // Path: es.alrocar.poiproxy/src/main/java/es/alrocar/poiproxy/request/SimpleHttpRequestServiceForceJson.java // public class SimpleHttpRequestServiceForceJson implements RequestService, Api { // // private DownloaderJson d = new DownloaderJson(); // // @Override // public byte[] download(String URL, String fileName, String downloadPath, Auth authElem) throws Exception { // return d.downloadFromUrl(URL, fileName, downloadPath, null); // } // // @Override // public OAuthService createService(OAuthConfig config) { // // TODO Auto-generated method stub // return null; // } // }
import org.scribe.builder.api.Api; import org.scribe.builder.api.TwitterApi; import es.alrocar.poiproxy.request.OauthRequestService; import es.alrocar.poiproxy.request.RequestService; import es.alrocar.poiproxy.request.SimpleHttpRequestServiceForceJson;
/* * Licensed to Prodevelop SL under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The Prodevelop SL 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. * * For more information, contact: * * Prodevelop, S.L. * Pza. Don Juan de Villarrasa, 14 - 5 * 46001 Valencia * Spain * * +34 963 510 612 * +34 963 510 968 * prode@prodevelop.es * http://www.prodevelop.es * * @author Alberto Romeu Carrasco http://www.albertoromeu.com */ package es.alrocar.poiproxy.configuration; public enum AuthTypeEnum { none("simple", null, null),
// Path: es.alrocar.poiproxy/src/main/java/es/alrocar/poiproxy/request/OauthRequestService.java // public class OauthRequestService implements RequestService { // // @Override // public byte[] download(String URL, String fileName, String downloadPath, // Auth authElem) throws Exception { // AuthTypeEnum authType = AuthTypeEnum.valueOf(authElem.getType()); // // OAuthService service = new ServiceBuilder().provider(authType._class) // .apiKey(authElem.getApiKey()) // .apiSecret(authElem.getApiSecret()).build(); // // OAuthRequest request = new OAuthRequest(Verb.GET, URL); // Token myToken = new Token(authElem.getAccessToken(), // authElem.getAccessTokenSecret()); // // service.signRequest(myToken, request); // Response response = request.send(); // // return response.getBody().getBytes(); // } // } // // Path: es.alrocar.poiproxy/src/main/java/es/alrocar/poiproxy/request/RequestService.java // public interface RequestService { // // /** // * // * @param URL // * The URL where download data from // * @param fileName // * The name of the file to store the data in // * @param downloadPath // * The path where to store the file // * @param authElement // * The {@link Auth} configuration that can have, apiKeys, // * credentials, etc. // * @return An array of bytes with the data // * @throws Exception // */ // public byte[] download(String URL, String fileName, String downloadPath, // Auth authElement) throws Exception; // } // // Path: es.alrocar.poiproxy/src/main/java/es/alrocar/poiproxy/request/SimpleHttpRequestServiceForceJson.java // public class SimpleHttpRequestServiceForceJson implements RequestService, Api { // // private DownloaderJson d = new DownloaderJson(); // // @Override // public byte[] download(String URL, String fileName, String downloadPath, Auth authElem) throws Exception { // return d.downloadFromUrl(URL, fileName, downloadPath, null); // } // // @Override // public OAuthService createService(OAuthConfig config) { // // TODO Auto-generated method stub // return null; // } // } // Path: es.alrocar.poiproxy/src/main/java/es/alrocar/poiproxy/configuration/AuthTypeEnum.java import org.scribe.builder.api.Api; import org.scribe.builder.api.TwitterApi; import es.alrocar.poiproxy.request.OauthRequestService; import es.alrocar.poiproxy.request.RequestService; import es.alrocar.poiproxy.request.SimpleHttpRequestServiceForceJson; /* * Licensed to Prodevelop SL under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The Prodevelop SL 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. * * For more information, contact: * * Prodevelop, S.L. * Pza. Don Juan de Villarrasa, 14 - 5 * 46001 Valencia * Spain * * +34 963 510 612 * +34 963 510 968 * prode@prodevelop.es * http://www.prodevelop.es * * @author Alberto Romeu Carrasco http://www.albertoromeu.com */ package es.alrocar.poiproxy.configuration; public enum AuthTypeEnum { none("simple", null, null),
twitter_oauth("twitter_oauth", TwitterApi.class, OauthRequestService.class),
Prodevelop/POIProxy
es.alrocar.poiproxy/src/main/java/es/alrocar/poiproxy/configuration/AuthTypeEnum.java
// Path: es.alrocar.poiproxy/src/main/java/es/alrocar/poiproxy/request/OauthRequestService.java // public class OauthRequestService implements RequestService { // // @Override // public byte[] download(String URL, String fileName, String downloadPath, // Auth authElem) throws Exception { // AuthTypeEnum authType = AuthTypeEnum.valueOf(authElem.getType()); // // OAuthService service = new ServiceBuilder().provider(authType._class) // .apiKey(authElem.getApiKey()) // .apiSecret(authElem.getApiSecret()).build(); // // OAuthRequest request = new OAuthRequest(Verb.GET, URL); // Token myToken = new Token(authElem.getAccessToken(), // authElem.getAccessTokenSecret()); // // service.signRequest(myToken, request); // Response response = request.send(); // // return response.getBody().getBytes(); // } // } // // Path: es.alrocar.poiproxy/src/main/java/es/alrocar/poiproxy/request/RequestService.java // public interface RequestService { // // /** // * // * @param URL // * The URL where download data from // * @param fileName // * The name of the file to store the data in // * @param downloadPath // * The path where to store the file // * @param authElement // * The {@link Auth} configuration that can have, apiKeys, // * credentials, etc. // * @return An array of bytes with the data // * @throws Exception // */ // public byte[] download(String URL, String fileName, String downloadPath, // Auth authElement) throws Exception; // } // // Path: es.alrocar.poiproxy/src/main/java/es/alrocar/poiproxy/request/SimpleHttpRequestServiceForceJson.java // public class SimpleHttpRequestServiceForceJson implements RequestService, Api { // // private DownloaderJson d = new DownloaderJson(); // // @Override // public byte[] download(String URL, String fileName, String downloadPath, Auth authElem) throws Exception { // return d.downloadFromUrl(URL, fileName, downloadPath, null); // } // // @Override // public OAuthService createService(OAuthConfig config) { // // TODO Auto-generated method stub // return null; // } // }
import org.scribe.builder.api.Api; import org.scribe.builder.api.TwitterApi; import es.alrocar.poiproxy.request.OauthRequestService; import es.alrocar.poiproxy.request.RequestService; import es.alrocar.poiproxy.request.SimpleHttpRequestServiceForceJson;
/* * Licensed to Prodevelop SL under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The Prodevelop SL 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. * * For more information, contact: * * Prodevelop, S.L. * Pza. Don Juan de Villarrasa, 14 - 5 * 46001 Valencia * Spain * * +34 963 510 612 * +34 963 510 968 * prode@prodevelop.es * http://www.prodevelop.es * * @author Alberto Romeu Carrasco http://www.albertoromeu.com */ package es.alrocar.poiproxy.configuration; public enum AuthTypeEnum { none("simple", null, null), twitter_oauth("twitter_oauth", TwitterApi.class, OauthRequestService.class),
// Path: es.alrocar.poiproxy/src/main/java/es/alrocar/poiproxy/request/OauthRequestService.java // public class OauthRequestService implements RequestService { // // @Override // public byte[] download(String URL, String fileName, String downloadPath, // Auth authElem) throws Exception { // AuthTypeEnum authType = AuthTypeEnum.valueOf(authElem.getType()); // // OAuthService service = new ServiceBuilder().provider(authType._class) // .apiKey(authElem.getApiKey()) // .apiSecret(authElem.getApiSecret()).build(); // // OAuthRequest request = new OAuthRequest(Verb.GET, URL); // Token myToken = new Token(authElem.getAccessToken(), // authElem.getAccessTokenSecret()); // // service.signRequest(myToken, request); // Response response = request.send(); // // return response.getBody().getBytes(); // } // } // // Path: es.alrocar.poiproxy/src/main/java/es/alrocar/poiproxy/request/RequestService.java // public interface RequestService { // // /** // * // * @param URL // * The URL where download data from // * @param fileName // * The name of the file to store the data in // * @param downloadPath // * The path where to store the file // * @param authElement // * The {@link Auth} configuration that can have, apiKeys, // * credentials, etc. // * @return An array of bytes with the data // * @throws Exception // */ // public byte[] download(String URL, String fileName, String downloadPath, // Auth authElement) throws Exception; // } // // Path: es.alrocar.poiproxy/src/main/java/es/alrocar/poiproxy/request/SimpleHttpRequestServiceForceJson.java // public class SimpleHttpRequestServiceForceJson implements RequestService, Api { // // private DownloaderJson d = new DownloaderJson(); // // @Override // public byte[] download(String URL, String fileName, String downloadPath, Auth authElem) throws Exception { // return d.downloadFromUrl(URL, fileName, downloadPath, null); // } // // @Override // public OAuthService createService(OAuthConfig config) { // // TODO Auto-generated method stub // return null; // } // } // Path: es.alrocar.poiproxy/src/main/java/es/alrocar/poiproxy/configuration/AuthTypeEnum.java import org.scribe.builder.api.Api; import org.scribe.builder.api.TwitterApi; import es.alrocar.poiproxy.request.OauthRequestService; import es.alrocar.poiproxy.request.RequestService; import es.alrocar.poiproxy.request.SimpleHttpRequestServiceForceJson; /* * Licensed to Prodevelop SL under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The Prodevelop SL 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. * * For more information, contact: * * Prodevelop, S.L. * Pza. Don Juan de Villarrasa, 14 - 5 * 46001 Valencia * Spain * * +34 963 510 612 * +34 963 510 968 * prode@prodevelop.es * http://www.prodevelop.es * * @author Alberto Romeu Carrasco http://www.albertoromeu.com */ package es.alrocar.poiproxy.configuration; public enum AuthTypeEnum { none("simple", null, null), twitter_oauth("twitter_oauth", TwitterApi.class, OauthRequestService.class),
forceJson("forceJson", SimpleHttpRequestServiceForceJson.class, SimpleHttpRequestServiceForceJson.class);
Prodevelop/POIProxy
es.alrocar.poiproxy/src/main/java/es/alrocar/poiproxy/configuration/AuthTypeEnum.java
// Path: es.alrocar.poiproxy/src/main/java/es/alrocar/poiproxy/request/OauthRequestService.java // public class OauthRequestService implements RequestService { // // @Override // public byte[] download(String URL, String fileName, String downloadPath, // Auth authElem) throws Exception { // AuthTypeEnum authType = AuthTypeEnum.valueOf(authElem.getType()); // // OAuthService service = new ServiceBuilder().provider(authType._class) // .apiKey(authElem.getApiKey()) // .apiSecret(authElem.getApiSecret()).build(); // // OAuthRequest request = new OAuthRequest(Verb.GET, URL); // Token myToken = new Token(authElem.getAccessToken(), // authElem.getAccessTokenSecret()); // // service.signRequest(myToken, request); // Response response = request.send(); // // return response.getBody().getBytes(); // } // } // // Path: es.alrocar.poiproxy/src/main/java/es/alrocar/poiproxy/request/RequestService.java // public interface RequestService { // // /** // * // * @param URL // * The URL where download data from // * @param fileName // * The name of the file to store the data in // * @param downloadPath // * The path where to store the file // * @param authElement // * The {@link Auth} configuration that can have, apiKeys, // * credentials, etc. // * @return An array of bytes with the data // * @throws Exception // */ // public byte[] download(String URL, String fileName, String downloadPath, // Auth authElement) throws Exception; // } // // Path: es.alrocar.poiproxy/src/main/java/es/alrocar/poiproxy/request/SimpleHttpRequestServiceForceJson.java // public class SimpleHttpRequestServiceForceJson implements RequestService, Api { // // private DownloaderJson d = new DownloaderJson(); // // @Override // public byte[] download(String URL, String fileName, String downloadPath, Auth authElem) throws Exception { // return d.downloadFromUrl(URL, fileName, downloadPath, null); // } // // @Override // public OAuthService createService(OAuthConfig config) { // // TODO Auto-generated method stub // return null; // } // }
import org.scribe.builder.api.Api; import org.scribe.builder.api.TwitterApi; import es.alrocar.poiproxy.request.OauthRequestService; import es.alrocar.poiproxy.request.RequestService; import es.alrocar.poiproxy.request.SimpleHttpRequestServiceForceJson;
/* * Licensed to Prodevelop SL under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The Prodevelop SL 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. * * For more information, contact: * * Prodevelop, S.L. * Pza. Don Juan de Villarrasa, 14 - 5 * 46001 Valencia * Spain * * +34 963 510 612 * +34 963 510 968 * prode@prodevelop.es * http://www.prodevelop.es * * @author Alberto Romeu Carrasco http://www.albertoromeu.com */ package es.alrocar.poiproxy.configuration; public enum AuthTypeEnum { none("simple", null, null), twitter_oauth("twitter_oauth", TwitterApi.class, OauthRequestService.class), forceJson("forceJson", SimpleHttpRequestServiceForceJson.class, SimpleHttpRequestServiceForceJson.class); public String type; public Class<? extends Api> _class;
// Path: es.alrocar.poiproxy/src/main/java/es/alrocar/poiproxy/request/OauthRequestService.java // public class OauthRequestService implements RequestService { // // @Override // public byte[] download(String URL, String fileName, String downloadPath, // Auth authElem) throws Exception { // AuthTypeEnum authType = AuthTypeEnum.valueOf(authElem.getType()); // // OAuthService service = new ServiceBuilder().provider(authType._class) // .apiKey(authElem.getApiKey()) // .apiSecret(authElem.getApiSecret()).build(); // // OAuthRequest request = new OAuthRequest(Verb.GET, URL); // Token myToken = new Token(authElem.getAccessToken(), // authElem.getAccessTokenSecret()); // // service.signRequest(myToken, request); // Response response = request.send(); // // return response.getBody().getBytes(); // } // } // // Path: es.alrocar.poiproxy/src/main/java/es/alrocar/poiproxy/request/RequestService.java // public interface RequestService { // // /** // * // * @param URL // * The URL where download data from // * @param fileName // * The name of the file to store the data in // * @param downloadPath // * The path where to store the file // * @param authElement // * The {@link Auth} configuration that can have, apiKeys, // * credentials, etc. // * @return An array of bytes with the data // * @throws Exception // */ // public byte[] download(String URL, String fileName, String downloadPath, // Auth authElement) throws Exception; // } // // Path: es.alrocar.poiproxy/src/main/java/es/alrocar/poiproxy/request/SimpleHttpRequestServiceForceJson.java // public class SimpleHttpRequestServiceForceJson implements RequestService, Api { // // private DownloaderJson d = new DownloaderJson(); // // @Override // public byte[] download(String URL, String fileName, String downloadPath, Auth authElem) throws Exception { // return d.downloadFromUrl(URL, fileName, downloadPath, null); // } // // @Override // public OAuthService createService(OAuthConfig config) { // // TODO Auto-generated method stub // return null; // } // } // Path: es.alrocar.poiproxy/src/main/java/es/alrocar/poiproxy/configuration/AuthTypeEnum.java import org.scribe.builder.api.Api; import org.scribe.builder.api.TwitterApi; import es.alrocar.poiproxy.request.OauthRequestService; import es.alrocar.poiproxy.request.RequestService; import es.alrocar.poiproxy.request.SimpleHttpRequestServiceForceJson; /* * Licensed to Prodevelop SL under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The Prodevelop SL 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. * * For more information, contact: * * Prodevelop, S.L. * Pza. Don Juan de Villarrasa, 14 - 5 * 46001 Valencia * Spain * * +34 963 510 612 * +34 963 510 968 * prode@prodevelop.es * http://www.prodevelop.es * * @author Alberto Romeu Carrasco http://www.albertoromeu.com */ package es.alrocar.poiproxy.configuration; public enum AuthTypeEnum { none("simple", null, null), twitter_oauth("twitter_oauth", TwitterApi.class, OauthRequestService.class), forceJson("forceJson", SimpleHttpRequestServiceForceJson.class, SimpleHttpRequestServiceForceJson.class); public String type; public Class<? extends Api> _class;
public Class<? extends RequestService> _downloader;
Prodevelop/POIProxy
es.alrocar.poiproxy.fiware.poidp/src/main/java/es/alrocar/poiproxy/fiware/poidp/schema/fw_media_class.java
// Path: es.alrocar.poiproxy.fiware.poidp/src/main/java/es/alrocar/poiproxy/fiware/poidp/schema/utils/UpdateStamp.java // public class UpdateStamp { // // private long timestamp = 0; // private String responsible = ""; // // public long getTimestamp() { // return timestamp; // } // // public void setTimestamp(long timestamp) { // this.timestamp = timestamp; // } // // public String getResponsible() { // return responsible; // } // // public void setResponsible(String responsible) { // this.responsible = responsible; // } // // }
import java.util.ArrayList; import java.util.List; import es.alrocar.poiproxy.fiware.poidp.schema.utils.UpdateStamp;
/* * Licensed to Prodevelop SL under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The Prodevelop SL 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. * * For more information, contact: * * Prodevelop, S.L. * Pza. Don Juan de Villarrasa, 14 - 5 * 46001 Valencia * Spain * * +34 963 510 612 * +34 963 510 968 * prode@prodevelop.es * http://www.prodevelop.es * * @author Alberto Romeu Carrasco aromeu@prodevelop.es */ package es.alrocar.poiproxy.fiware.poidp.schema; public class fw_media_class { private List<fw_media_entity> entities = new ArrayList<fw_media_entity>();
// Path: es.alrocar.poiproxy.fiware.poidp/src/main/java/es/alrocar/poiproxy/fiware/poidp/schema/utils/UpdateStamp.java // public class UpdateStamp { // // private long timestamp = 0; // private String responsible = ""; // // public long getTimestamp() { // return timestamp; // } // // public void setTimestamp(long timestamp) { // this.timestamp = timestamp; // } // // public String getResponsible() { // return responsible; // } // // public void setResponsible(String responsible) { // this.responsible = responsible; // } // // } // Path: es.alrocar.poiproxy.fiware.poidp/src/main/java/es/alrocar/poiproxy/fiware/poidp/schema/fw_media_class.java import java.util.ArrayList; import java.util.List; import es.alrocar.poiproxy.fiware.poidp.schema.utils.UpdateStamp; /* * Licensed to Prodevelop SL under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The Prodevelop SL 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. * * For more information, contact: * * Prodevelop, S.L. * Pza. Don Juan de Villarrasa, 14 - 5 * 46001 Valencia * Spain * * +34 963 510 612 * +34 963 510 968 * prode@prodevelop.es * http://www.prodevelop.es * * @author Alberto Romeu Carrasco aromeu@prodevelop.es */ package es.alrocar.poiproxy.fiware.poidp.schema; public class fw_media_class { private List<fw_media_entity> entities = new ArrayList<fw_media_entity>();
private UpdateStamp last_update = null;
Prodevelop/POIProxy
es.alrocar.map.vector/src/main/java/es/alrocar/map/vector/provider/strategy/impl/FixedStrategy.java
// Path: es.alrocar.map.vector/src/main/java/es/alrocar/map/vector/provider/observer/VectorialProviderListener.java // public interface VectorialProviderListener { // // public void onVectorDataRetrieved(int[] tile, ArrayList data, // Cancellable cancellable, int zoomLevel); // // public void onRawDataRetrieved(int[] tile, Object data, // Cancellable cancellable, ProviderDriver driver, int zoomLevel); // // }
import es.alrocar.map.vector.provider.observer.VectorialProviderListener; import es.prodevelop.gvsig.mini.geom.Extent; import es.prodevelop.gvsig.mini.utiles.Cancellable;
/* * Licensed to Prodevelop SL under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The Prodevelop SL 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. * * For more information, contact: * * Prodevelop, S.L. * Pza. Don Juan de Villarrasa, 14 - 5 * 46001 Valencia * Spain * * +34 963 510 612 * +34 963 510 968 * prode@prodevelop.es * http://www.prodevelop.es * * @author Alberto Romeu Carrasco http://www.albertoromeu.com */ package es.alrocar.map.vector.provider.strategy.impl; public class FixedStrategy extends BBoxTiledStrategy { private Extent extent; private int zoomLevel; public FixedStrategy(Extent extent, int zoomLevel) { this.extent = extent; this.zoomLevel = zoomLevel; } public void getVectorialData(int[][] tiles, int zoomlevel,
// Path: es.alrocar.map.vector/src/main/java/es/alrocar/map/vector/provider/observer/VectorialProviderListener.java // public interface VectorialProviderListener { // // public void onVectorDataRetrieved(int[] tile, ArrayList data, // Cancellable cancellable, int zoomLevel); // // public void onRawDataRetrieved(int[] tile, Object data, // Cancellable cancellable, ProviderDriver driver, int zoomLevel); // // } // Path: es.alrocar.map.vector/src/main/java/es/alrocar/map/vector/provider/strategy/impl/FixedStrategy.java import es.alrocar.map.vector.provider.observer.VectorialProviderListener; import es.prodevelop.gvsig.mini.geom.Extent; import es.prodevelop.gvsig.mini.utiles.Cancellable; /* * Licensed to Prodevelop SL under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The Prodevelop SL 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. * * For more information, contact: * * Prodevelop, S.L. * Pza. Don Juan de Villarrasa, 14 - 5 * 46001 Valencia * Spain * * +34 963 510 612 * +34 963 510 968 * prode@prodevelop.es * http://www.prodevelop.es * * @author Alberto Romeu Carrasco http://www.albertoromeu.com */ package es.alrocar.map.vector.provider.strategy.impl; public class FixedStrategy extends BBoxTiledStrategy { private Extent extent; private int zoomLevel; public FixedStrategy(Extent extent, int zoomLevel) { this.extent = extent; this.zoomLevel = zoomLevel; } public void getVectorialData(int[][] tiles, int zoomlevel,
Extent viewExtent, VectorialProviderListener observer,
Prodevelop/POIProxy
es.alrocar.poiproxy.fiware.poidp/src/main/java/es/alrocar/poiproxy/fiware/poidp/schema/fw_core_class.java
// Path: es.alrocar.poiproxy.fiware.poidp/src/main/java/es/alrocar/poiproxy/fiware/poidp/schema/utils/IntString.java // public class IntString extends HashMap<String, String> { // // public IntString(String tit) { // this.put("", tit); // } // // public void setDefLang(String def) { // this.put("_def", def); // } // // } // // Path: es.alrocar.poiproxy.fiware.poidp/src/main/java/es/alrocar/poiproxy/fiware/poidp/schema/utils/IntUri.java // public class IntUri extends HashMap<String, String> { // // public IntUri(String tit) { // this.put("", tit); // } // // public void setDefLang(String def) { // this.put("_def", def); // } // // } // // Path: es.alrocar.poiproxy.fiware.poidp/src/main/java/es/alrocar/poiproxy/fiware/poidp/schema/utils/Location.java // public class Location extends HashMap<String, Map> { // // /* // * private double longitude = 0; private double latitude = 0; private double // * height = 0; // */ // // public Location(double lon, double lat, double hei) { // /* // * longitude = lon; latitude = lat; height = hei; // */ // // Map m = new HashMap<String, Double>(); // m.put("longitude", lon); // m.put("latitude", lat); // m.put("height", hei); // // this.put("wgs84", m); // } // // public Location(double lon, double lat) { // this(lon, lat, 0); // } // // } // // Path: es.alrocar.poiproxy.fiware.poidp/src/main/java/es/alrocar/poiproxy/fiware/poidp/schema/utils/Source.java // public class Source extends HashMap<String, String> { // // public Source() { // // } // // public void setName(String name) { // this.put("name", name); // // website id license // } // // public void setWebsite(String str) { // this.put("website", str); // // website id license // } // // public void setId(String str) { // this.put("id", str); // // website id license // } // // public void setLicense(String str) { // this.put("license", str); // // website id license // } // // } // // Path: es.alrocar.poiproxy.fiware.poidp/src/main/java/es/alrocar/poiproxy/fiware/poidp/schema/utils/UpdateStamp.java // public class UpdateStamp { // // private long timestamp = 0; // private String responsible = ""; // // public long getTimestamp() { // return timestamp; // } // // public void setTimestamp(long timestamp) { // this.timestamp = timestamp; // } // // public String getResponsible() { // return responsible; // } // // public void setResponsible(String responsible) { // this.responsible = responsible; // } // // }
import java.util.HashMap; import java.util.Map; import es.alrocar.poiproxy.fiware.poidp.schema.utils.IntString; import es.alrocar.poiproxy.fiware.poidp.schema.utils.IntUri; import es.alrocar.poiproxy.fiware.poidp.schema.utils.Location; import es.alrocar.poiproxy.fiware.poidp.schema.utils.Source; import es.alrocar.poiproxy.fiware.poidp.schema.utils.UpdateStamp;
/* * Licensed to Prodevelop SL under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The Prodevelop SL 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. * * For more information, contact: * * Prodevelop, S.L. * Pza. Don Juan de Villarrasa, 14 - 5 * 46001 Valencia * Spain * * +34 963 510 612 * +34 963 510 968 * prode@prodevelop.es * http://www.prodevelop.es * * @author Alberto Romeu Carrasco aromeu@prodevelop.es */ package es.alrocar.poiproxy.fiware.poidp.schema; public class fw_core_class { private String category = "";
// Path: es.alrocar.poiproxy.fiware.poidp/src/main/java/es/alrocar/poiproxy/fiware/poidp/schema/utils/IntString.java // public class IntString extends HashMap<String, String> { // // public IntString(String tit) { // this.put("", tit); // } // // public void setDefLang(String def) { // this.put("_def", def); // } // // } // // Path: es.alrocar.poiproxy.fiware.poidp/src/main/java/es/alrocar/poiproxy/fiware/poidp/schema/utils/IntUri.java // public class IntUri extends HashMap<String, String> { // // public IntUri(String tit) { // this.put("", tit); // } // // public void setDefLang(String def) { // this.put("_def", def); // } // // } // // Path: es.alrocar.poiproxy.fiware.poidp/src/main/java/es/alrocar/poiproxy/fiware/poidp/schema/utils/Location.java // public class Location extends HashMap<String, Map> { // // /* // * private double longitude = 0; private double latitude = 0; private double // * height = 0; // */ // // public Location(double lon, double lat, double hei) { // /* // * longitude = lon; latitude = lat; height = hei; // */ // // Map m = new HashMap<String, Double>(); // m.put("longitude", lon); // m.put("latitude", lat); // m.put("height", hei); // // this.put("wgs84", m); // } // // public Location(double lon, double lat) { // this(lon, lat, 0); // } // // } // // Path: es.alrocar.poiproxy.fiware.poidp/src/main/java/es/alrocar/poiproxy/fiware/poidp/schema/utils/Source.java // public class Source extends HashMap<String, String> { // // public Source() { // // } // // public void setName(String name) { // this.put("name", name); // // website id license // } // // public void setWebsite(String str) { // this.put("website", str); // // website id license // } // // public void setId(String str) { // this.put("id", str); // // website id license // } // // public void setLicense(String str) { // this.put("license", str); // // website id license // } // // } // // Path: es.alrocar.poiproxy.fiware.poidp/src/main/java/es/alrocar/poiproxy/fiware/poidp/schema/utils/UpdateStamp.java // public class UpdateStamp { // // private long timestamp = 0; // private String responsible = ""; // // public long getTimestamp() { // return timestamp; // } // // public void setTimestamp(long timestamp) { // this.timestamp = timestamp; // } // // public String getResponsible() { // return responsible; // } // // public void setResponsible(String responsible) { // this.responsible = responsible; // } // // } // Path: es.alrocar.poiproxy.fiware.poidp/src/main/java/es/alrocar/poiproxy/fiware/poidp/schema/fw_core_class.java import java.util.HashMap; import java.util.Map; import es.alrocar.poiproxy.fiware.poidp.schema.utils.IntString; import es.alrocar.poiproxy.fiware.poidp.schema.utils.IntUri; import es.alrocar.poiproxy.fiware.poidp.schema.utils.Location; import es.alrocar.poiproxy.fiware.poidp.schema.utils.Source; import es.alrocar.poiproxy.fiware.poidp.schema.utils.UpdateStamp; /* * Licensed to Prodevelop SL under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The Prodevelop SL 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. * * For more information, contact: * * Prodevelop, S.L. * Pza. Don Juan de Villarrasa, 14 - 5 * 46001 Valencia * Spain * * +34 963 510 612 * +34 963 510 968 * prode@prodevelop.es * http://www.prodevelop.es * * @author Alberto Romeu Carrasco aromeu@prodevelop.es */ package es.alrocar.poiproxy.fiware.poidp.schema; public class fw_core_class { private String category = "";
private Location location = new Location(0, 0);
Prodevelop/POIProxy
es.alrocar.poiproxy.fiware.poidp/src/main/java/es/alrocar/poiproxy/fiware/poidp/schema/fw_core_class.java
// Path: es.alrocar.poiproxy.fiware.poidp/src/main/java/es/alrocar/poiproxy/fiware/poidp/schema/utils/IntString.java // public class IntString extends HashMap<String, String> { // // public IntString(String tit) { // this.put("", tit); // } // // public void setDefLang(String def) { // this.put("_def", def); // } // // } // // Path: es.alrocar.poiproxy.fiware.poidp/src/main/java/es/alrocar/poiproxy/fiware/poidp/schema/utils/IntUri.java // public class IntUri extends HashMap<String, String> { // // public IntUri(String tit) { // this.put("", tit); // } // // public void setDefLang(String def) { // this.put("_def", def); // } // // } // // Path: es.alrocar.poiproxy.fiware.poidp/src/main/java/es/alrocar/poiproxy/fiware/poidp/schema/utils/Location.java // public class Location extends HashMap<String, Map> { // // /* // * private double longitude = 0; private double latitude = 0; private double // * height = 0; // */ // // public Location(double lon, double lat, double hei) { // /* // * longitude = lon; latitude = lat; height = hei; // */ // // Map m = new HashMap<String, Double>(); // m.put("longitude", lon); // m.put("latitude", lat); // m.put("height", hei); // // this.put("wgs84", m); // } // // public Location(double lon, double lat) { // this(lon, lat, 0); // } // // } // // Path: es.alrocar.poiproxy.fiware.poidp/src/main/java/es/alrocar/poiproxy/fiware/poidp/schema/utils/Source.java // public class Source extends HashMap<String, String> { // // public Source() { // // } // // public void setName(String name) { // this.put("name", name); // // website id license // } // // public void setWebsite(String str) { // this.put("website", str); // // website id license // } // // public void setId(String str) { // this.put("id", str); // // website id license // } // // public void setLicense(String str) { // this.put("license", str); // // website id license // } // // } // // Path: es.alrocar.poiproxy.fiware.poidp/src/main/java/es/alrocar/poiproxy/fiware/poidp/schema/utils/UpdateStamp.java // public class UpdateStamp { // // private long timestamp = 0; // private String responsible = ""; // // public long getTimestamp() { // return timestamp; // } // // public void setTimestamp(long timestamp) { // this.timestamp = timestamp; // } // // public String getResponsible() { // return responsible; // } // // public void setResponsible(String responsible) { // this.responsible = responsible; // } // // }
import java.util.HashMap; import java.util.Map; import es.alrocar.poiproxy.fiware.poidp.schema.utils.IntString; import es.alrocar.poiproxy.fiware.poidp.schema.utils.IntUri; import es.alrocar.poiproxy.fiware.poidp.schema.utils.Location; import es.alrocar.poiproxy.fiware.poidp.schema.utils.Source; import es.alrocar.poiproxy.fiware.poidp.schema.utils.UpdateStamp;
/* * Licensed to Prodevelop SL under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The Prodevelop SL 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. * * For more information, contact: * * Prodevelop, S.L. * Pza. Don Juan de Villarrasa, 14 - 5 * 46001 Valencia * Spain * * +34 963 510 612 * +34 963 510 968 * prode@prodevelop.es * http://www.prodevelop.es * * @author Alberto Romeu Carrasco aromeu@prodevelop.es */ package es.alrocar.poiproxy.fiware.poidp.schema; public class fw_core_class { private String category = ""; private Location location = new Location(0, 0); private String geometry = ""; private String short_name = ""; private String name = "";
// Path: es.alrocar.poiproxy.fiware.poidp/src/main/java/es/alrocar/poiproxy/fiware/poidp/schema/utils/IntString.java // public class IntString extends HashMap<String, String> { // // public IntString(String tit) { // this.put("", tit); // } // // public void setDefLang(String def) { // this.put("_def", def); // } // // } // // Path: es.alrocar.poiproxy.fiware.poidp/src/main/java/es/alrocar/poiproxy/fiware/poidp/schema/utils/IntUri.java // public class IntUri extends HashMap<String, String> { // // public IntUri(String tit) { // this.put("", tit); // } // // public void setDefLang(String def) { // this.put("_def", def); // } // // } // // Path: es.alrocar.poiproxy.fiware.poidp/src/main/java/es/alrocar/poiproxy/fiware/poidp/schema/utils/Location.java // public class Location extends HashMap<String, Map> { // // /* // * private double longitude = 0; private double latitude = 0; private double // * height = 0; // */ // // public Location(double lon, double lat, double hei) { // /* // * longitude = lon; latitude = lat; height = hei; // */ // // Map m = new HashMap<String, Double>(); // m.put("longitude", lon); // m.put("latitude", lat); // m.put("height", hei); // // this.put("wgs84", m); // } // // public Location(double lon, double lat) { // this(lon, lat, 0); // } // // } // // Path: es.alrocar.poiproxy.fiware.poidp/src/main/java/es/alrocar/poiproxy/fiware/poidp/schema/utils/Source.java // public class Source extends HashMap<String, String> { // // public Source() { // // } // // public void setName(String name) { // this.put("name", name); // // website id license // } // // public void setWebsite(String str) { // this.put("website", str); // // website id license // } // // public void setId(String str) { // this.put("id", str); // // website id license // } // // public void setLicense(String str) { // this.put("license", str); // // website id license // } // // } // // Path: es.alrocar.poiproxy.fiware.poidp/src/main/java/es/alrocar/poiproxy/fiware/poidp/schema/utils/UpdateStamp.java // public class UpdateStamp { // // private long timestamp = 0; // private String responsible = ""; // // public long getTimestamp() { // return timestamp; // } // // public void setTimestamp(long timestamp) { // this.timestamp = timestamp; // } // // public String getResponsible() { // return responsible; // } // // public void setResponsible(String responsible) { // this.responsible = responsible; // } // // } // Path: es.alrocar.poiproxy.fiware.poidp/src/main/java/es/alrocar/poiproxy/fiware/poidp/schema/fw_core_class.java import java.util.HashMap; import java.util.Map; import es.alrocar.poiproxy.fiware.poidp.schema.utils.IntString; import es.alrocar.poiproxy.fiware.poidp.schema.utils.IntUri; import es.alrocar.poiproxy.fiware.poidp.schema.utils.Location; import es.alrocar.poiproxy.fiware.poidp.schema.utils.Source; import es.alrocar.poiproxy.fiware.poidp.schema.utils.UpdateStamp; /* * Licensed to Prodevelop SL under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The Prodevelop SL 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. * * For more information, contact: * * Prodevelop, S.L. * Pza. Don Juan de Villarrasa, 14 - 5 * 46001 Valencia * Spain * * +34 963 510 612 * +34 963 510 968 * prode@prodevelop.es * http://www.prodevelop.es * * @author Alberto Romeu Carrasco aromeu@prodevelop.es */ package es.alrocar.poiproxy.fiware.poidp.schema; public class fw_core_class { private String category = ""; private Location location = new Location(0, 0); private String geometry = ""; private String short_name = ""; private String name = "";
private IntString label = null;
Prodevelop/POIProxy
es.alrocar.poiproxy.fiware.poidp/src/main/java/es/alrocar/poiproxy/fiware/poidp/schema/fw_core_class.java
// Path: es.alrocar.poiproxy.fiware.poidp/src/main/java/es/alrocar/poiproxy/fiware/poidp/schema/utils/IntString.java // public class IntString extends HashMap<String, String> { // // public IntString(String tit) { // this.put("", tit); // } // // public void setDefLang(String def) { // this.put("_def", def); // } // // } // // Path: es.alrocar.poiproxy.fiware.poidp/src/main/java/es/alrocar/poiproxy/fiware/poidp/schema/utils/IntUri.java // public class IntUri extends HashMap<String, String> { // // public IntUri(String tit) { // this.put("", tit); // } // // public void setDefLang(String def) { // this.put("_def", def); // } // // } // // Path: es.alrocar.poiproxy.fiware.poidp/src/main/java/es/alrocar/poiproxy/fiware/poidp/schema/utils/Location.java // public class Location extends HashMap<String, Map> { // // /* // * private double longitude = 0; private double latitude = 0; private double // * height = 0; // */ // // public Location(double lon, double lat, double hei) { // /* // * longitude = lon; latitude = lat; height = hei; // */ // // Map m = new HashMap<String, Double>(); // m.put("longitude", lon); // m.put("latitude", lat); // m.put("height", hei); // // this.put("wgs84", m); // } // // public Location(double lon, double lat) { // this(lon, lat, 0); // } // // } // // Path: es.alrocar.poiproxy.fiware.poidp/src/main/java/es/alrocar/poiproxy/fiware/poidp/schema/utils/Source.java // public class Source extends HashMap<String, String> { // // public Source() { // // } // // public void setName(String name) { // this.put("name", name); // // website id license // } // // public void setWebsite(String str) { // this.put("website", str); // // website id license // } // // public void setId(String str) { // this.put("id", str); // // website id license // } // // public void setLicense(String str) { // this.put("license", str); // // website id license // } // // } // // Path: es.alrocar.poiproxy.fiware.poidp/src/main/java/es/alrocar/poiproxy/fiware/poidp/schema/utils/UpdateStamp.java // public class UpdateStamp { // // private long timestamp = 0; // private String responsible = ""; // // public long getTimestamp() { // return timestamp; // } // // public void setTimestamp(long timestamp) { // this.timestamp = timestamp; // } // // public String getResponsible() { // return responsible; // } // // public void setResponsible(String responsible) { // this.responsible = responsible; // } // // }
import java.util.HashMap; import java.util.Map; import es.alrocar.poiproxy.fiware.poidp.schema.utils.IntString; import es.alrocar.poiproxy.fiware.poidp.schema.utils.IntUri; import es.alrocar.poiproxy.fiware.poidp.schema.utils.Location; import es.alrocar.poiproxy.fiware.poidp.schema.utils.Source; import es.alrocar.poiproxy.fiware.poidp.schema.utils.UpdateStamp;
/* * Licensed to Prodevelop SL under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The Prodevelop SL 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. * * For more information, contact: * * Prodevelop, S.L. * Pza. Don Juan de Villarrasa, 14 - 5 * 46001 Valencia * Spain * * +34 963 510 612 * +34 963 510 968 * prode@prodevelop.es * http://www.prodevelop.es * * @author Alberto Romeu Carrasco aromeu@prodevelop.es */ package es.alrocar.poiproxy.fiware.poidp.schema; public class fw_core_class { private String category = ""; private Location location = new Location(0, 0); private String geometry = ""; private String short_name = ""; private String name = ""; private IntString label = null; private IntString description = null; private String thumbnail = "";
// Path: es.alrocar.poiproxy.fiware.poidp/src/main/java/es/alrocar/poiproxy/fiware/poidp/schema/utils/IntString.java // public class IntString extends HashMap<String, String> { // // public IntString(String tit) { // this.put("", tit); // } // // public void setDefLang(String def) { // this.put("_def", def); // } // // } // // Path: es.alrocar.poiproxy.fiware.poidp/src/main/java/es/alrocar/poiproxy/fiware/poidp/schema/utils/IntUri.java // public class IntUri extends HashMap<String, String> { // // public IntUri(String tit) { // this.put("", tit); // } // // public void setDefLang(String def) { // this.put("_def", def); // } // // } // // Path: es.alrocar.poiproxy.fiware.poidp/src/main/java/es/alrocar/poiproxy/fiware/poidp/schema/utils/Location.java // public class Location extends HashMap<String, Map> { // // /* // * private double longitude = 0; private double latitude = 0; private double // * height = 0; // */ // // public Location(double lon, double lat, double hei) { // /* // * longitude = lon; latitude = lat; height = hei; // */ // // Map m = new HashMap<String, Double>(); // m.put("longitude", lon); // m.put("latitude", lat); // m.put("height", hei); // // this.put("wgs84", m); // } // // public Location(double lon, double lat) { // this(lon, lat, 0); // } // // } // // Path: es.alrocar.poiproxy.fiware.poidp/src/main/java/es/alrocar/poiproxy/fiware/poidp/schema/utils/Source.java // public class Source extends HashMap<String, String> { // // public Source() { // // } // // public void setName(String name) { // this.put("name", name); // // website id license // } // // public void setWebsite(String str) { // this.put("website", str); // // website id license // } // // public void setId(String str) { // this.put("id", str); // // website id license // } // // public void setLicense(String str) { // this.put("license", str); // // website id license // } // // } // // Path: es.alrocar.poiproxy.fiware.poidp/src/main/java/es/alrocar/poiproxy/fiware/poidp/schema/utils/UpdateStamp.java // public class UpdateStamp { // // private long timestamp = 0; // private String responsible = ""; // // public long getTimestamp() { // return timestamp; // } // // public void setTimestamp(long timestamp) { // this.timestamp = timestamp; // } // // public String getResponsible() { // return responsible; // } // // public void setResponsible(String responsible) { // this.responsible = responsible; // } // // } // Path: es.alrocar.poiproxy.fiware.poidp/src/main/java/es/alrocar/poiproxy/fiware/poidp/schema/fw_core_class.java import java.util.HashMap; import java.util.Map; import es.alrocar.poiproxy.fiware.poidp.schema.utils.IntString; import es.alrocar.poiproxy.fiware.poidp.schema.utils.IntUri; import es.alrocar.poiproxy.fiware.poidp.schema.utils.Location; import es.alrocar.poiproxy.fiware.poidp.schema.utils.Source; import es.alrocar.poiproxy.fiware.poidp.schema.utils.UpdateStamp; /* * Licensed to Prodevelop SL under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The Prodevelop SL 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. * * For more information, contact: * * Prodevelop, S.L. * Pza. Don Juan de Villarrasa, 14 - 5 * 46001 Valencia * Spain * * +34 963 510 612 * +34 963 510 968 * prode@prodevelop.es * http://www.prodevelop.es * * @author Alberto Romeu Carrasco aromeu@prodevelop.es */ package es.alrocar.poiproxy.fiware.poidp.schema; public class fw_core_class { private String category = ""; private Location location = new Location(0, 0); private String geometry = ""; private String short_name = ""; private String name = ""; private IntString label = null; private IntString description = null; private String thumbnail = "";
private IntUri url = null;
Prodevelop/POIProxy
es.alrocar.poiproxy.fiware.poidp/src/main/java/es/alrocar/poiproxy/fiware/poidp/schema/fw_core_class.java
// Path: es.alrocar.poiproxy.fiware.poidp/src/main/java/es/alrocar/poiproxy/fiware/poidp/schema/utils/IntString.java // public class IntString extends HashMap<String, String> { // // public IntString(String tit) { // this.put("", tit); // } // // public void setDefLang(String def) { // this.put("_def", def); // } // // } // // Path: es.alrocar.poiproxy.fiware.poidp/src/main/java/es/alrocar/poiproxy/fiware/poidp/schema/utils/IntUri.java // public class IntUri extends HashMap<String, String> { // // public IntUri(String tit) { // this.put("", tit); // } // // public void setDefLang(String def) { // this.put("_def", def); // } // // } // // Path: es.alrocar.poiproxy.fiware.poidp/src/main/java/es/alrocar/poiproxy/fiware/poidp/schema/utils/Location.java // public class Location extends HashMap<String, Map> { // // /* // * private double longitude = 0; private double latitude = 0; private double // * height = 0; // */ // // public Location(double lon, double lat, double hei) { // /* // * longitude = lon; latitude = lat; height = hei; // */ // // Map m = new HashMap<String, Double>(); // m.put("longitude", lon); // m.put("latitude", lat); // m.put("height", hei); // // this.put("wgs84", m); // } // // public Location(double lon, double lat) { // this(lon, lat, 0); // } // // } // // Path: es.alrocar.poiproxy.fiware.poidp/src/main/java/es/alrocar/poiproxy/fiware/poidp/schema/utils/Source.java // public class Source extends HashMap<String, String> { // // public Source() { // // } // // public void setName(String name) { // this.put("name", name); // // website id license // } // // public void setWebsite(String str) { // this.put("website", str); // // website id license // } // // public void setId(String str) { // this.put("id", str); // // website id license // } // // public void setLicense(String str) { // this.put("license", str); // // website id license // } // // } // // Path: es.alrocar.poiproxy.fiware.poidp/src/main/java/es/alrocar/poiproxy/fiware/poidp/schema/utils/UpdateStamp.java // public class UpdateStamp { // // private long timestamp = 0; // private String responsible = ""; // // public long getTimestamp() { // return timestamp; // } // // public void setTimestamp(long timestamp) { // this.timestamp = timestamp; // } // // public String getResponsible() { // return responsible; // } // // public void setResponsible(String responsible) { // this.responsible = responsible; // } // // }
import java.util.HashMap; import java.util.Map; import es.alrocar.poiproxy.fiware.poidp.schema.utils.IntString; import es.alrocar.poiproxy.fiware.poidp.schema.utils.IntUri; import es.alrocar.poiproxy.fiware.poidp.schema.utils.Location; import es.alrocar.poiproxy.fiware.poidp.schema.utils.Source; import es.alrocar.poiproxy.fiware.poidp.schema.utils.UpdateStamp;
/* * Licensed to Prodevelop SL under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The Prodevelop SL 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. * * For more information, contact: * * Prodevelop, S.L. * Pza. Don Juan de Villarrasa, 14 - 5 * 46001 Valencia * Spain * * +34 963 510 612 * +34 963 510 968 * prode@prodevelop.es * http://www.prodevelop.es * * @author Alberto Romeu Carrasco aromeu@prodevelop.es */ package es.alrocar.poiproxy.fiware.poidp.schema; public class fw_core_class { private String category = ""; private Location location = new Location(0, 0); private String geometry = ""; private String short_name = ""; private String name = ""; private IntString label = null; private IntString description = null; private String thumbnail = ""; private IntUri url = null;
// Path: es.alrocar.poiproxy.fiware.poidp/src/main/java/es/alrocar/poiproxy/fiware/poidp/schema/utils/IntString.java // public class IntString extends HashMap<String, String> { // // public IntString(String tit) { // this.put("", tit); // } // // public void setDefLang(String def) { // this.put("_def", def); // } // // } // // Path: es.alrocar.poiproxy.fiware.poidp/src/main/java/es/alrocar/poiproxy/fiware/poidp/schema/utils/IntUri.java // public class IntUri extends HashMap<String, String> { // // public IntUri(String tit) { // this.put("", tit); // } // // public void setDefLang(String def) { // this.put("_def", def); // } // // } // // Path: es.alrocar.poiproxy.fiware.poidp/src/main/java/es/alrocar/poiproxy/fiware/poidp/schema/utils/Location.java // public class Location extends HashMap<String, Map> { // // /* // * private double longitude = 0; private double latitude = 0; private double // * height = 0; // */ // // public Location(double lon, double lat, double hei) { // /* // * longitude = lon; latitude = lat; height = hei; // */ // // Map m = new HashMap<String, Double>(); // m.put("longitude", lon); // m.put("latitude", lat); // m.put("height", hei); // // this.put("wgs84", m); // } // // public Location(double lon, double lat) { // this(lon, lat, 0); // } // // } // // Path: es.alrocar.poiproxy.fiware.poidp/src/main/java/es/alrocar/poiproxy/fiware/poidp/schema/utils/Source.java // public class Source extends HashMap<String, String> { // // public Source() { // // } // // public void setName(String name) { // this.put("name", name); // // website id license // } // // public void setWebsite(String str) { // this.put("website", str); // // website id license // } // // public void setId(String str) { // this.put("id", str); // // website id license // } // // public void setLicense(String str) { // this.put("license", str); // // website id license // } // // } // // Path: es.alrocar.poiproxy.fiware.poidp/src/main/java/es/alrocar/poiproxy/fiware/poidp/schema/utils/UpdateStamp.java // public class UpdateStamp { // // private long timestamp = 0; // private String responsible = ""; // // public long getTimestamp() { // return timestamp; // } // // public void setTimestamp(long timestamp) { // this.timestamp = timestamp; // } // // public String getResponsible() { // return responsible; // } // // public void setResponsible(String responsible) { // this.responsible = responsible; // } // // } // Path: es.alrocar.poiproxy.fiware.poidp/src/main/java/es/alrocar/poiproxy/fiware/poidp/schema/fw_core_class.java import java.util.HashMap; import java.util.Map; import es.alrocar.poiproxy.fiware.poidp.schema.utils.IntString; import es.alrocar.poiproxy.fiware.poidp.schema.utils.IntUri; import es.alrocar.poiproxy.fiware.poidp.schema.utils.Location; import es.alrocar.poiproxy.fiware.poidp.schema.utils.Source; import es.alrocar.poiproxy.fiware.poidp.schema.utils.UpdateStamp; /* * Licensed to Prodevelop SL under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The Prodevelop SL 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. * * For more information, contact: * * Prodevelop, S.L. * Pza. Don Juan de Villarrasa, 14 - 5 * 46001 Valencia * Spain * * +34 963 510 612 * +34 963 510 968 * prode@prodevelop.es * http://www.prodevelop.es * * @author Alberto Romeu Carrasco aromeu@prodevelop.es */ package es.alrocar.poiproxy.fiware.poidp.schema; public class fw_core_class { private String category = ""; private Location location = new Location(0, 0); private String geometry = ""; private String short_name = ""; private String name = ""; private IntString label = null; private IntString description = null; private String thumbnail = ""; private IntUri url = null;
private Source source = null;
Prodevelop/POIProxy
es.alrocar.poiproxy.fiware.poidp/src/main/java/es/alrocar/poiproxy/fiware/poidp/schema/fw_core_class.java
// Path: es.alrocar.poiproxy.fiware.poidp/src/main/java/es/alrocar/poiproxy/fiware/poidp/schema/utils/IntString.java // public class IntString extends HashMap<String, String> { // // public IntString(String tit) { // this.put("", tit); // } // // public void setDefLang(String def) { // this.put("_def", def); // } // // } // // Path: es.alrocar.poiproxy.fiware.poidp/src/main/java/es/alrocar/poiproxy/fiware/poidp/schema/utils/IntUri.java // public class IntUri extends HashMap<String, String> { // // public IntUri(String tit) { // this.put("", tit); // } // // public void setDefLang(String def) { // this.put("_def", def); // } // // } // // Path: es.alrocar.poiproxy.fiware.poidp/src/main/java/es/alrocar/poiproxy/fiware/poidp/schema/utils/Location.java // public class Location extends HashMap<String, Map> { // // /* // * private double longitude = 0; private double latitude = 0; private double // * height = 0; // */ // // public Location(double lon, double lat, double hei) { // /* // * longitude = lon; latitude = lat; height = hei; // */ // // Map m = new HashMap<String, Double>(); // m.put("longitude", lon); // m.put("latitude", lat); // m.put("height", hei); // // this.put("wgs84", m); // } // // public Location(double lon, double lat) { // this(lon, lat, 0); // } // // } // // Path: es.alrocar.poiproxy.fiware.poidp/src/main/java/es/alrocar/poiproxy/fiware/poidp/schema/utils/Source.java // public class Source extends HashMap<String, String> { // // public Source() { // // } // // public void setName(String name) { // this.put("name", name); // // website id license // } // // public void setWebsite(String str) { // this.put("website", str); // // website id license // } // // public void setId(String str) { // this.put("id", str); // // website id license // } // // public void setLicense(String str) { // this.put("license", str); // // website id license // } // // } // // Path: es.alrocar.poiproxy.fiware.poidp/src/main/java/es/alrocar/poiproxy/fiware/poidp/schema/utils/UpdateStamp.java // public class UpdateStamp { // // private long timestamp = 0; // private String responsible = ""; // // public long getTimestamp() { // return timestamp; // } // // public void setTimestamp(long timestamp) { // this.timestamp = timestamp; // } // // public String getResponsible() { // return responsible; // } // // public void setResponsible(String responsible) { // this.responsible = responsible; // } // // }
import java.util.HashMap; import java.util.Map; import es.alrocar.poiproxy.fiware.poidp.schema.utils.IntString; import es.alrocar.poiproxy.fiware.poidp.schema.utils.IntUri; import es.alrocar.poiproxy.fiware.poidp.schema.utils.Location; import es.alrocar.poiproxy.fiware.poidp.schema.utils.Source; import es.alrocar.poiproxy.fiware.poidp.schema.utils.UpdateStamp;
/* * Licensed to Prodevelop SL under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The Prodevelop SL 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. * * For more information, contact: * * Prodevelop, S.L. * Pza. Don Juan de Villarrasa, 14 - 5 * 46001 Valencia * Spain * * +34 963 510 612 * +34 963 510 968 * prode@prodevelop.es * http://www.prodevelop.es * * @author Alberto Romeu Carrasco aromeu@prodevelop.es */ package es.alrocar.poiproxy.fiware.poidp.schema; public class fw_core_class { private String category = ""; private Location location = new Location(0, 0); private String geometry = ""; private String short_name = ""; private String name = ""; private IntString label = null; private IntString description = null; private String thumbnail = ""; private IntUri url = null; private Source source = null;
// Path: es.alrocar.poiproxy.fiware.poidp/src/main/java/es/alrocar/poiproxy/fiware/poidp/schema/utils/IntString.java // public class IntString extends HashMap<String, String> { // // public IntString(String tit) { // this.put("", tit); // } // // public void setDefLang(String def) { // this.put("_def", def); // } // // } // // Path: es.alrocar.poiproxy.fiware.poidp/src/main/java/es/alrocar/poiproxy/fiware/poidp/schema/utils/IntUri.java // public class IntUri extends HashMap<String, String> { // // public IntUri(String tit) { // this.put("", tit); // } // // public void setDefLang(String def) { // this.put("_def", def); // } // // } // // Path: es.alrocar.poiproxy.fiware.poidp/src/main/java/es/alrocar/poiproxy/fiware/poidp/schema/utils/Location.java // public class Location extends HashMap<String, Map> { // // /* // * private double longitude = 0; private double latitude = 0; private double // * height = 0; // */ // // public Location(double lon, double lat, double hei) { // /* // * longitude = lon; latitude = lat; height = hei; // */ // // Map m = new HashMap<String, Double>(); // m.put("longitude", lon); // m.put("latitude", lat); // m.put("height", hei); // // this.put("wgs84", m); // } // // public Location(double lon, double lat) { // this(lon, lat, 0); // } // // } // // Path: es.alrocar.poiproxy.fiware.poidp/src/main/java/es/alrocar/poiproxy/fiware/poidp/schema/utils/Source.java // public class Source extends HashMap<String, String> { // // public Source() { // // } // // public void setName(String name) { // this.put("name", name); // // website id license // } // // public void setWebsite(String str) { // this.put("website", str); // // website id license // } // // public void setId(String str) { // this.put("id", str); // // website id license // } // // public void setLicense(String str) { // this.put("license", str); // // website id license // } // // } // // Path: es.alrocar.poiproxy.fiware.poidp/src/main/java/es/alrocar/poiproxy/fiware/poidp/schema/utils/UpdateStamp.java // public class UpdateStamp { // // private long timestamp = 0; // private String responsible = ""; // // public long getTimestamp() { // return timestamp; // } // // public void setTimestamp(long timestamp) { // this.timestamp = timestamp; // } // // public String getResponsible() { // return responsible; // } // // public void setResponsible(String responsible) { // this.responsible = responsible; // } // // } // Path: es.alrocar.poiproxy.fiware.poidp/src/main/java/es/alrocar/poiproxy/fiware/poidp/schema/fw_core_class.java import java.util.HashMap; import java.util.Map; import es.alrocar.poiproxy.fiware.poidp.schema.utils.IntString; import es.alrocar.poiproxy.fiware.poidp.schema.utils.IntUri; import es.alrocar.poiproxy.fiware.poidp.schema.utils.Location; import es.alrocar.poiproxy.fiware.poidp.schema.utils.Source; import es.alrocar.poiproxy.fiware.poidp.schema.utils.UpdateStamp; /* * Licensed to Prodevelop SL under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The Prodevelop SL 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. * * For more information, contact: * * Prodevelop, S.L. * Pza. Don Juan de Villarrasa, 14 - 5 * 46001 Valencia * Spain * * +34 963 510 612 * +34 963 510 968 * prode@prodevelop.es * http://www.prodevelop.es * * @author Alberto Romeu Carrasco aromeu@prodevelop.es */ package es.alrocar.poiproxy.fiware.poidp.schema; public class fw_core_class { private String category = ""; private Location location = new Location(0, 0); private String geometry = ""; private String short_name = ""; private String name = ""; private IntString label = null; private IntString description = null; private String thumbnail = ""; private IntUri url = null; private Source source = null;
private UpdateStamp last_update = null;
Prodevelop/POIProxy
es.alrocar.poiproxy/src/main/java/es/alrocar/poiproxy/request/OauthRequestService.java
// Path: es.alrocar.poiproxy/src/main/java/es/alrocar/poiproxy/configuration/Auth.java // public class Auth { // // /** // * @see AuthTypeEnum. Default value is {@link AuthTypeEnum#none} // */ // private String type = AuthTypeEnum.none.toString(); // private String apiKey; // private String apiSecret; // private String accessToken; // private String accessTokenSecret; // // /** // * @see AuthTypeEnum // * @return // */ // public String getType() { // return type; // } // // /** // * // * @param type // * One of {@link AuthTypeEnum} // */ // public void setType(String type) { // this.type = type; // } // // public String getApiKey() { // return apiKey; // } // // public void setApiKey(String apiKey) { // this.apiKey = apiKey; // } // // public String getApiSecret() { // return apiSecret; // } // // public void setApiSecret(String apiSecret) { // this.apiSecret = apiSecret; // } // // public String getAccessToken() { // return accessToken; // } // // public void setAccessToken(String accessToken) { // this.accessToken = accessToken; // } // // public String getAccessTokenSecret() { // return accessTokenSecret; // } // // public void setAccessTokenSecret(String accessTokenSecret) { // this.accessTokenSecret = accessTokenSecret; // } // // } // // Path: es.alrocar.poiproxy/src/main/java/es/alrocar/poiproxy/configuration/AuthTypeEnum.java // public enum AuthTypeEnum { // // none("simple", null, null), // // twitter_oauth("twitter_oauth", TwitterApi.class, OauthRequestService.class), // // forceJson("forceJson", SimpleHttpRequestServiceForceJson.class, SimpleHttpRequestServiceForceJson.class); // // public String type; // public Class<? extends Api> _class; // public Class<? extends RequestService> _downloader; // // private AuthTypeEnum(String type, Class<? extends Api> _class, Class<? extends RequestService> _downloader) { // this.type = type; // this._class = _class; // this._downloader = _downloader; // } // // public boolean isOauth() { // return type.indexOf("oauth") != -1; // } // }
import org.scribe.builder.ServiceBuilder; import org.scribe.model.OAuthRequest; import org.scribe.model.Response; import org.scribe.model.Token; import org.scribe.model.Verb; import org.scribe.oauth.OAuthService; import es.alrocar.poiproxy.configuration.Auth; import es.alrocar.poiproxy.configuration.AuthTypeEnum;
/* * Licensed to Prodevelop SL under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The Prodevelop SL 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. * * For more information, contact: * * Prodevelop, S.L. * Pza. Don Juan de Villarrasa, 14 - 5 * 46001 Valencia * Spain * * +34 963 510 612 * +34 963 510 968 * prode@prodevelop.es * http://www.prodevelop.es * * @author Alberto Romeu Carrasco http://www.albertoromeu.com */ package es.alrocar.poiproxy.request; /** * Makes Oauth requests using Scribe * https://github.com/fernandezpablo85/scribe-java * * @author aromeu * */ public class OauthRequestService implements RequestService { @Override public byte[] download(String URL, String fileName, String downloadPath,
// Path: es.alrocar.poiproxy/src/main/java/es/alrocar/poiproxy/configuration/Auth.java // public class Auth { // // /** // * @see AuthTypeEnum. Default value is {@link AuthTypeEnum#none} // */ // private String type = AuthTypeEnum.none.toString(); // private String apiKey; // private String apiSecret; // private String accessToken; // private String accessTokenSecret; // // /** // * @see AuthTypeEnum // * @return // */ // public String getType() { // return type; // } // // /** // * // * @param type // * One of {@link AuthTypeEnum} // */ // public void setType(String type) { // this.type = type; // } // // public String getApiKey() { // return apiKey; // } // // public void setApiKey(String apiKey) { // this.apiKey = apiKey; // } // // public String getApiSecret() { // return apiSecret; // } // // public void setApiSecret(String apiSecret) { // this.apiSecret = apiSecret; // } // // public String getAccessToken() { // return accessToken; // } // // public void setAccessToken(String accessToken) { // this.accessToken = accessToken; // } // // public String getAccessTokenSecret() { // return accessTokenSecret; // } // // public void setAccessTokenSecret(String accessTokenSecret) { // this.accessTokenSecret = accessTokenSecret; // } // // } // // Path: es.alrocar.poiproxy/src/main/java/es/alrocar/poiproxy/configuration/AuthTypeEnum.java // public enum AuthTypeEnum { // // none("simple", null, null), // // twitter_oauth("twitter_oauth", TwitterApi.class, OauthRequestService.class), // // forceJson("forceJson", SimpleHttpRequestServiceForceJson.class, SimpleHttpRequestServiceForceJson.class); // // public String type; // public Class<? extends Api> _class; // public Class<? extends RequestService> _downloader; // // private AuthTypeEnum(String type, Class<? extends Api> _class, Class<? extends RequestService> _downloader) { // this.type = type; // this._class = _class; // this._downloader = _downloader; // } // // public boolean isOauth() { // return type.indexOf("oauth") != -1; // } // } // Path: es.alrocar.poiproxy/src/main/java/es/alrocar/poiproxy/request/OauthRequestService.java import org.scribe.builder.ServiceBuilder; import org.scribe.model.OAuthRequest; import org.scribe.model.Response; import org.scribe.model.Token; import org.scribe.model.Verb; import org.scribe.oauth.OAuthService; import es.alrocar.poiproxy.configuration.Auth; import es.alrocar.poiproxy.configuration.AuthTypeEnum; /* * Licensed to Prodevelop SL under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The Prodevelop SL 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. * * For more information, contact: * * Prodevelop, S.L. * Pza. Don Juan de Villarrasa, 14 - 5 * 46001 Valencia * Spain * * +34 963 510 612 * +34 963 510 968 * prode@prodevelop.es * http://www.prodevelop.es * * @author Alberto Romeu Carrasco http://www.albertoromeu.com */ package es.alrocar.poiproxy.request; /** * Makes Oauth requests using Scribe * https://github.com/fernandezpablo85/scribe-java * * @author aromeu * */ public class OauthRequestService implements RequestService { @Override public byte[] download(String URL, String fileName, String downloadPath,
Auth authElem) throws Exception {
Prodevelop/POIProxy
es.alrocar.poiproxy/src/main/java/es/alrocar/poiproxy/request/OauthRequestService.java
// Path: es.alrocar.poiproxy/src/main/java/es/alrocar/poiproxy/configuration/Auth.java // public class Auth { // // /** // * @see AuthTypeEnum. Default value is {@link AuthTypeEnum#none} // */ // private String type = AuthTypeEnum.none.toString(); // private String apiKey; // private String apiSecret; // private String accessToken; // private String accessTokenSecret; // // /** // * @see AuthTypeEnum // * @return // */ // public String getType() { // return type; // } // // /** // * // * @param type // * One of {@link AuthTypeEnum} // */ // public void setType(String type) { // this.type = type; // } // // public String getApiKey() { // return apiKey; // } // // public void setApiKey(String apiKey) { // this.apiKey = apiKey; // } // // public String getApiSecret() { // return apiSecret; // } // // public void setApiSecret(String apiSecret) { // this.apiSecret = apiSecret; // } // // public String getAccessToken() { // return accessToken; // } // // public void setAccessToken(String accessToken) { // this.accessToken = accessToken; // } // // public String getAccessTokenSecret() { // return accessTokenSecret; // } // // public void setAccessTokenSecret(String accessTokenSecret) { // this.accessTokenSecret = accessTokenSecret; // } // // } // // Path: es.alrocar.poiproxy/src/main/java/es/alrocar/poiproxy/configuration/AuthTypeEnum.java // public enum AuthTypeEnum { // // none("simple", null, null), // // twitter_oauth("twitter_oauth", TwitterApi.class, OauthRequestService.class), // // forceJson("forceJson", SimpleHttpRequestServiceForceJson.class, SimpleHttpRequestServiceForceJson.class); // // public String type; // public Class<? extends Api> _class; // public Class<? extends RequestService> _downloader; // // private AuthTypeEnum(String type, Class<? extends Api> _class, Class<? extends RequestService> _downloader) { // this.type = type; // this._class = _class; // this._downloader = _downloader; // } // // public boolean isOauth() { // return type.indexOf("oauth") != -1; // } // }
import org.scribe.builder.ServiceBuilder; import org.scribe.model.OAuthRequest; import org.scribe.model.Response; import org.scribe.model.Token; import org.scribe.model.Verb; import org.scribe.oauth.OAuthService; import es.alrocar.poiproxy.configuration.Auth; import es.alrocar.poiproxy.configuration.AuthTypeEnum;
/* * Licensed to Prodevelop SL under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The Prodevelop SL 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. * * For more information, contact: * * Prodevelop, S.L. * Pza. Don Juan de Villarrasa, 14 - 5 * 46001 Valencia * Spain * * +34 963 510 612 * +34 963 510 968 * prode@prodevelop.es * http://www.prodevelop.es * * @author Alberto Romeu Carrasco http://www.albertoromeu.com */ package es.alrocar.poiproxy.request; /** * Makes Oauth requests using Scribe * https://github.com/fernandezpablo85/scribe-java * * @author aromeu * */ public class OauthRequestService implements RequestService { @Override public byte[] download(String URL, String fileName, String downloadPath, Auth authElem) throws Exception {
// Path: es.alrocar.poiproxy/src/main/java/es/alrocar/poiproxy/configuration/Auth.java // public class Auth { // // /** // * @see AuthTypeEnum. Default value is {@link AuthTypeEnum#none} // */ // private String type = AuthTypeEnum.none.toString(); // private String apiKey; // private String apiSecret; // private String accessToken; // private String accessTokenSecret; // // /** // * @see AuthTypeEnum // * @return // */ // public String getType() { // return type; // } // // /** // * // * @param type // * One of {@link AuthTypeEnum} // */ // public void setType(String type) { // this.type = type; // } // // public String getApiKey() { // return apiKey; // } // // public void setApiKey(String apiKey) { // this.apiKey = apiKey; // } // // public String getApiSecret() { // return apiSecret; // } // // public void setApiSecret(String apiSecret) { // this.apiSecret = apiSecret; // } // // public String getAccessToken() { // return accessToken; // } // // public void setAccessToken(String accessToken) { // this.accessToken = accessToken; // } // // public String getAccessTokenSecret() { // return accessTokenSecret; // } // // public void setAccessTokenSecret(String accessTokenSecret) { // this.accessTokenSecret = accessTokenSecret; // } // // } // // Path: es.alrocar.poiproxy/src/main/java/es/alrocar/poiproxy/configuration/AuthTypeEnum.java // public enum AuthTypeEnum { // // none("simple", null, null), // // twitter_oauth("twitter_oauth", TwitterApi.class, OauthRequestService.class), // // forceJson("forceJson", SimpleHttpRequestServiceForceJson.class, SimpleHttpRequestServiceForceJson.class); // // public String type; // public Class<? extends Api> _class; // public Class<? extends RequestService> _downloader; // // private AuthTypeEnum(String type, Class<? extends Api> _class, Class<? extends RequestService> _downloader) { // this.type = type; // this._class = _class; // this._downloader = _downloader; // } // // public boolean isOauth() { // return type.indexOf("oauth") != -1; // } // } // Path: es.alrocar.poiproxy/src/main/java/es/alrocar/poiproxy/request/OauthRequestService.java import org.scribe.builder.ServiceBuilder; import org.scribe.model.OAuthRequest; import org.scribe.model.Response; import org.scribe.model.Token; import org.scribe.model.Verb; import org.scribe.oauth.OAuthService; import es.alrocar.poiproxy.configuration.Auth; import es.alrocar.poiproxy.configuration.AuthTypeEnum; /* * Licensed to Prodevelop SL under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The Prodevelop SL 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. * * For more information, contact: * * Prodevelop, S.L. * Pza. Don Juan de Villarrasa, 14 - 5 * 46001 Valencia * Spain * * +34 963 510 612 * +34 963 510 968 * prode@prodevelop.es * http://www.prodevelop.es * * @author Alberto Romeu Carrasco http://www.albertoromeu.com */ package es.alrocar.poiproxy.request; /** * Makes Oauth requests using Scribe * https://github.com/fernandezpablo85/scribe-java * * @author aromeu * */ public class OauthRequestService implements RequestService { @Override public byte[] download(String URL, String fileName, String downloadPath, Auth authElem) throws Exception {
AuthTypeEnum authType = AuthTypeEnum.valueOf(authElem.getType());
Prodevelop/POIProxy
es.alrocar.map.vector/src/main/java/es/alrocar/map/vector/provider/observer/VectorialProviderListener.java
// Path: es.alrocar.map.vector/src/main/java/es/alrocar/map/vector/provider/driver/ProviderDriver.java // public interface ProviderDriver { // // public ArrayList getData(int[] tile, Extent booundingBox, // Cancellable cancellable, int zoom); // // public boolean needsExtentToWork(); // // public String getSRS(); // // public VectorialProvider getProvider(); // // public void setProvider(VectorialProvider provider); // // public String getName(); // // public IVectorFileSystemProvider getFileSystemProvider(); // // // public void write(int[] tile, int zoomLevel, ArrayList data, // // Cancellable cancellable); // // // // public void write(int[] tile, int zoomLevel, InputStream in, // // Cancellable cancellable); // // // // public ArrayList loadFromDisk(int[] tile, Extent boundingBox, // // Cancellable cancellable); // // // // public boolean supportsLocalCache(); // // // // public boolean isOverwriteLocalCache(); // // // // public boolean isLocalCacheEnable(); // }
import java.util.ArrayList; import es.alrocar.map.vector.provider.driver.ProviderDriver; import es.prodevelop.gvsig.mini.utiles.Cancellable;
/* * Licensed to Prodevelop SL under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The Prodevelop SL 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. * * For more information, contact: * * Prodevelop, S.L. * Pza. Don Juan de Villarrasa, 14 - 5 * 46001 Valencia * Spain * * +34 963 510 612 * +34 963 510 968 * prode@prodevelop.es * http://www.prodevelop.es * * @author Alberto Romeu Carrasco http://www.albertoromeu.com */ package es.alrocar.map.vector.provider.observer; /** * * @author albertoromeu * */ public interface VectorialProviderListener { public void onVectorDataRetrieved(int[] tile, ArrayList data, Cancellable cancellable, int zoomLevel); public void onRawDataRetrieved(int[] tile, Object data,
// Path: es.alrocar.map.vector/src/main/java/es/alrocar/map/vector/provider/driver/ProviderDriver.java // public interface ProviderDriver { // // public ArrayList getData(int[] tile, Extent booundingBox, // Cancellable cancellable, int zoom); // // public boolean needsExtentToWork(); // // public String getSRS(); // // public VectorialProvider getProvider(); // // public void setProvider(VectorialProvider provider); // // public String getName(); // // public IVectorFileSystemProvider getFileSystemProvider(); // // // public void write(int[] tile, int zoomLevel, ArrayList data, // // Cancellable cancellable); // // // // public void write(int[] tile, int zoomLevel, InputStream in, // // Cancellable cancellable); // // // // public ArrayList loadFromDisk(int[] tile, Extent boundingBox, // // Cancellable cancellable); // // // // public boolean supportsLocalCache(); // // // // public boolean isOverwriteLocalCache(); // // // // public boolean isLocalCacheEnable(); // } // Path: es.alrocar.map.vector/src/main/java/es/alrocar/map/vector/provider/observer/VectorialProviderListener.java import java.util.ArrayList; import es.alrocar.map.vector.provider.driver.ProviderDriver; import es.prodevelop.gvsig.mini.utiles.Cancellable; /* * Licensed to Prodevelop SL under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The Prodevelop SL 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. * * For more information, contact: * * Prodevelop, S.L. * Pza. Don Juan de Villarrasa, 14 - 5 * 46001 Valencia * Spain * * +34 963 510 612 * +34 963 510 968 * prode@prodevelop.es * http://www.prodevelop.es * * @author Alberto Romeu Carrasco http://www.albertoromeu.com */ package es.alrocar.map.vector.provider.observer; /** * * @author albertoromeu * */ public interface VectorialProviderListener { public void onVectorDataRetrieved(int[] tile, ArrayList data, Cancellable cancellable, int zoomLevel); public void onRawDataRetrieved(int[] tile, Object data,
Cancellable cancellable, ProviderDriver driver, int zoomLevel);
Prodevelop/POIProxy
es.alrocar.poiproxy/src/main/java/es/alrocar/poiproxy/request/RequestService.java
// Path: es.alrocar.poiproxy/src/main/java/es/alrocar/poiproxy/configuration/Auth.java // public class Auth { // // /** // * @see AuthTypeEnum. Default value is {@link AuthTypeEnum#none} // */ // private String type = AuthTypeEnum.none.toString(); // private String apiKey; // private String apiSecret; // private String accessToken; // private String accessTokenSecret; // // /** // * @see AuthTypeEnum // * @return // */ // public String getType() { // return type; // } // // /** // * // * @param type // * One of {@link AuthTypeEnum} // */ // public void setType(String type) { // this.type = type; // } // // public String getApiKey() { // return apiKey; // } // // public void setApiKey(String apiKey) { // this.apiKey = apiKey; // } // // public String getApiSecret() { // return apiSecret; // } // // public void setApiSecret(String apiSecret) { // this.apiSecret = apiSecret; // } // // public String getAccessToken() { // return accessToken; // } // // public void setAccessToken(String accessToken) { // this.accessToken = accessToken; // } // // public String getAccessTokenSecret() { // return accessTokenSecret; // } // // public void setAccessTokenSecret(String accessTokenSecret) { // this.accessTokenSecret = accessTokenSecret; // } // // }
import es.alrocar.poiproxy.configuration.Auth;
/* * Licensed to Prodevelop SL under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The Prodevelop SL 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. * * For more information, contact: * * Prodevelop, S.L. * Pza. Don Juan de Villarrasa, 14 - 5 * 46001 Valencia * Spain * * +34 963 510 612 * +34 963 510 968 * prode@prodevelop.es * http://www.prodevelop.es * * @author Alberto Romeu Carrasco http://www.albertoromeu.com */ package es.alrocar.poiproxy.request; public interface RequestService { /** * * @param URL * The URL where download data from * @param fileName * The name of the file to store the data in * @param downloadPath * The path where to store the file * @param authElement * The {@link Auth} configuration that can have, apiKeys, * credentials, etc. * @return An array of bytes with the data * @throws Exception */ public byte[] download(String URL, String fileName, String downloadPath,
// Path: es.alrocar.poiproxy/src/main/java/es/alrocar/poiproxy/configuration/Auth.java // public class Auth { // // /** // * @see AuthTypeEnum. Default value is {@link AuthTypeEnum#none} // */ // private String type = AuthTypeEnum.none.toString(); // private String apiKey; // private String apiSecret; // private String accessToken; // private String accessTokenSecret; // // /** // * @see AuthTypeEnum // * @return // */ // public String getType() { // return type; // } // // /** // * // * @param type // * One of {@link AuthTypeEnum} // */ // public void setType(String type) { // this.type = type; // } // // public String getApiKey() { // return apiKey; // } // // public void setApiKey(String apiKey) { // this.apiKey = apiKey; // } // // public String getApiSecret() { // return apiSecret; // } // // public void setApiSecret(String apiSecret) { // this.apiSecret = apiSecret; // } // // public String getAccessToken() { // return accessToken; // } // // public void setAccessToken(String accessToken) { // this.accessToken = accessToken; // } // // public String getAccessTokenSecret() { // return accessTokenSecret; // } // // public void setAccessTokenSecret(String accessTokenSecret) { // this.accessTokenSecret = accessTokenSecret; // } // // } // Path: es.alrocar.poiproxy/src/main/java/es/alrocar/poiproxy/request/RequestService.java import es.alrocar.poiproxy.configuration.Auth; /* * Licensed to Prodevelop SL under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The Prodevelop SL 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. * * For more information, contact: * * Prodevelop, S.L. * Pza. Don Juan de Villarrasa, 14 - 5 * 46001 Valencia * Spain * * +34 963 510 612 * +34 963 510 968 * prode@prodevelop.es * http://www.prodevelop.es * * @author Alberto Romeu Carrasco http://www.albertoromeu.com */ package es.alrocar.poiproxy.request; public interface RequestService { /** * * @param URL * The URL where download data from * @param fileName * The name of the file to store the data in * @param downloadPath * The path where to store the file * @param authElement * The {@link Auth} configuration that can have, apiKeys, * credentials, etc. * @return An array of bytes with the data * @throws Exception */ public byte[] download(String URL, String fileName, String downloadPath,
Auth authElement) throws Exception;
Prodevelop/POIProxy
es.alrocar.poiproxy/src/main/java/es/alrocar/poiproxy/servlet/BrowseQueryServerResource.java
// Path: es.alrocar.poiproxy/src/main/java/es/alrocar/poiproxy/configuration/ParamEnum.java // public enum ParamEnum { // // QUERY("query"), // APIKEY("apiKey"), // SERVICE("service"), // X("x"), // Y("y"), // Z("z"), // MINX("minX"), // MINY("minY"), // MAXX("maxX"), // MAXY("maxY"), // LON("lon"), // LAT("lat"), // DIST("dist"), // RADIUS("radius"), // COMPONENT("component"), // CALLBACK("callback"), // FROMDATE("fromDate"), // TODATE("toDate"), // LIMIT("limit"), // OFFSET("offset"), // SEARCH("search"); // // public String name; // // ParamEnum(String name) { // this.name = name; // } // // public static boolean from(String key) { // for (ParamEnum pe : values()) { // if (pe.name.compareTo(key) == 0) { // return true; // } // } // // return false; // } // }
import java.util.ArrayList; import es.alrocar.poiproxy.configuration.ParamEnum;
/* * Licensed to Prodevelop SL under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The Prodevelop SL 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. * * For more information, contact: * * Prodevelop, S.L. * Pza. Don Juan de Villarrasa, 14 - 5 * 46001 Valencia * Spain * * +34 963 510 612 * +34 963 510 968 * prode@prodevelop.es * http://www.prodevelop.es * * @author Alberto Romeu Carrasco http://www.albertoromeu.com */ package es.alrocar.poiproxy.servlet; public class BrowseQueryServerResource extends BaseServerResource { private ArrayList<String> optParams; @Override public ArrayList<String> getOptionalParamsNames() { if (optParams == null) { optParams = new ArrayList<String>();
// Path: es.alrocar.poiproxy/src/main/java/es/alrocar/poiproxy/configuration/ParamEnum.java // public enum ParamEnum { // // QUERY("query"), // APIKEY("apiKey"), // SERVICE("service"), // X("x"), // Y("y"), // Z("z"), // MINX("minX"), // MINY("minY"), // MAXX("maxX"), // MAXY("maxY"), // LON("lon"), // LAT("lat"), // DIST("dist"), // RADIUS("radius"), // COMPONENT("component"), // CALLBACK("callback"), // FROMDATE("fromDate"), // TODATE("toDate"), // LIMIT("limit"), // OFFSET("offset"), // SEARCH("search"); // // public String name; // // ParamEnum(String name) { // this.name = name; // } // // public static boolean from(String key) { // for (ParamEnum pe : values()) { // if (pe.name.compareTo(key) == 0) { // return true; // } // } // // return false; // } // } // Path: es.alrocar.poiproxy/src/main/java/es/alrocar/poiproxy/servlet/BrowseQueryServerResource.java import java.util.ArrayList; import es.alrocar.poiproxy.configuration.ParamEnum; /* * Licensed to Prodevelop SL under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The Prodevelop SL 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. * * For more information, contact: * * Prodevelop, S.L. * Pza. Don Juan de Villarrasa, 14 - 5 * 46001 Valencia * Spain * * +34 963 510 612 * +34 963 510 968 * prode@prodevelop.es * http://www.prodevelop.es * * @author Alberto Romeu Carrasco http://www.albertoromeu.com */ package es.alrocar.poiproxy.servlet; public class BrowseQueryServerResource extends BaseServerResource { private ArrayList<String> optParams; @Override public ArrayList<String> getOptionalParamsNames() { if (optParams == null) { optParams = new ArrayList<String>();
optParams.add(ParamEnum.QUERY.name);
Prodevelop/POIProxy
es.alrocar.poiproxy.fiware.poidp/src/main/java/es/alrocar/poiproxy/fiware/poidp/schema/fw_marker_class.java
// Path: es.alrocar.poiproxy.fiware.poidp/src/main/java/es/alrocar/poiproxy/fiware/poidp/schema/utils/Source.java // public class Source extends HashMap<String, String> { // // public Source() { // // } // // public void setName(String name) { // this.put("name", name); // // website id license // } // // public void setWebsite(String str) { // this.put("website", str); // // website id license // } // // public void setId(String str) { // this.put("id", str); // // website id license // } // // public void setLicense(String str) { // this.put("license", str); // // website id license // } // // } // // Path: es.alrocar.poiproxy.fiware.poidp/src/main/java/es/alrocar/poiproxy/fiware/poidp/schema/utils/UpdateStamp.java // public class UpdateStamp { // // private long timestamp = 0; // private String responsible = ""; // // public long getTimestamp() { // return timestamp; // } // // public void setTimestamp(long timestamp) { // this.timestamp = timestamp; // } // // public String getResponsible() { // return responsible; // } // // public void setResponsible(String responsible) { // this.responsible = responsible; // } // // }
import java.util.HashMap; import java.util.Map; import es.alrocar.poiproxy.fiware.poidp.schema.utils.Source; import es.alrocar.poiproxy.fiware.poidp.schema.utils.UpdateStamp;
/* * Licensed to Prodevelop SL under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The Prodevelop SL 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. * * For more information, contact: * * Prodevelop, S.L. * Pza. Don Juan de Villarrasa, 14 - 5 * 46001 Valencia * Spain * * +34 963 510 612 * +34 963 510 968 * prode@prodevelop.es * http://www.prodevelop.es * * @author Alberto Romeu Carrasco aromeu@prodevelop.es */ package es.alrocar.poiproxy.fiware.poidp.schema; public class fw_marker_class { // alvar3x3, alvar5x5 private Map<String, String> image = new HashMap<String, String>(); public void setImageRef(String uri) { image.put("image_ref", uri); }
// Path: es.alrocar.poiproxy.fiware.poidp/src/main/java/es/alrocar/poiproxy/fiware/poidp/schema/utils/Source.java // public class Source extends HashMap<String, String> { // // public Source() { // // } // // public void setName(String name) { // this.put("name", name); // // website id license // } // // public void setWebsite(String str) { // this.put("website", str); // // website id license // } // // public void setId(String str) { // this.put("id", str); // // website id license // } // // public void setLicense(String str) { // this.put("license", str); // // website id license // } // // } // // Path: es.alrocar.poiproxy.fiware.poidp/src/main/java/es/alrocar/poiproxy/fiware/poidp/schema/utils/UpdateStamp.java // public class UpdateStamp { // // private long timestamp = 0; // private String responsible = ""; // // public long getTimestamp() { // return timestamp; // } // // public void setTimestamp(long timestamp) { // this.timestamp = timestamp; // } // // public String getResponsible() { // return responsible; // } // // public void setResponsible(String responsible) { // this.responsible = responsible; // } // // } // Path: es.alrocar.poiproxy.fiware.poidp/src/main/java/es/alrocar/poiproxy/fiware/poidp/schema/fw_marker_class.java import java.util.HashMap; import java.util.Map; import es.alrocar.poiproxy.fiware.poidp.schema.utils.Source; import es.alrocar.poiproxy.fiware.poidp.schema.utils.UpdateStamp; /* * Licensed to Prodevelop SL under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The Prodevelop SL 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. * * For more information, contact: * * Prodevelop, S.L. * Pza. Don Juan de Villarrasa, 14 - 5 * 46001 Valencia * Spain * * +34 963 510 612 * +34 963 510 968 * prode@prodevelop.es * http://www.prodevelop.es * * @author Alberto Romeu Carrasco aromeu@prodevelop.es */ package es.alrocar.poiproxy.fiware.poidp.schema; public class fw_marker_class { // alvar3x3, alvar5x5 private Map<String, String> image = new HashMap<String, String>(); public void setImageRef(String uri) { image.put("image_ref", uri); }
private Source source = null;
Prodevelop/POIProxy
es.alrocar.poiproxy.fiware.poidp/src/main/java/es/alrocar/poiproxy/fiware/poidp/schema/fw_marker_class.java
// Path: es.alrocar.poiproxy.fiware.poidp/src/main/java/es/alrocar/poiproxy/fiware/poidp/schema/utils/Source.java // public class Source extends HashMap<String, String> { // // public Source() { // // } // // public void setName(String name) { // this.put("name", name); // // website id license // } // // public void setWebsite(String str) { // this.put("website", str); // // website id license // } // // public void setId(String str) { // this.put("id", str); // // website id license // } // // public void setLicense(String str) { // this.put("license", str); // // website id license // } // // } // // Path: es.alrocar.poiproxy.fiware.poidp/src/main/java/es/alrocar/poiproxy/fiware/poidp/schema/utils/UpdateStamp.java // public class UpdateStamp { // // private long timestamp = 0; // private String responsible = ""; // // public long getTimestamp() { // return timestamp; // } // // public void setTimestamp(long timestamp) { // this.timestamp = timestamp; // } // // public String getResponsible() { // return responsible; // } // // public void setResponsible(String responsible) { // this.responsible = responsible; // } // // }
import java.util.HashMap; import java.util.Map; import es.alrocar.poiproxy.fiware.poidp.schema.utils.Source; import es.alrocar.poiproxy.fiware.poidp.schema.utils.UpdateStamp;
/* * Licensed to Prodevelop SL under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The Prodevelop SL 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. * * For more information, contact: * * Prodevelop, S.L. * Pza. Don Juan de Villarrasa, 14 - 5 * 46001 Valencia * Spain * * +34 963 510 612 * +34 963 510 968 * prode@prodevelop.es * http://www.prodevelop.es * * @author Alberto Romeu Carrasco aromeu@prodevelop.es */ package es.alrocar.poiproxy.fiware.poidp.schema; public class fw_marker_class { // alvar3x3, alvar5x5 private Map<String, String> image = new HashMap<String, String>(); public void setImageRef(String uri) { image.put("image_ref", uri); } private Source source = null;
// Path: es.alrocar.poiproxy.fiware.poidp/src/main/java/es/alrocar/poiproxy/fiware/poidp/schema/utils/Source.java // public class Source extends HashMap<String, String> { // // public Source() { // // } // // public void setName(String name) { // this.put("name", name); // // website id license // } // // public void setWebsite(String str) { // this.put("website", str); // // website id license // } // // public void setId(String str) { // this.put("id", str); // // website id license // } // // public void setLicense(String str) { // this.put("license", str); // // website id license // } // // } // // Path: es.alrocar.poiproxy.fiware.poidp/src/main/java/es/alrocar/poiproxy/fiware/poidp/schema/utils/UpdateStamp.java // public class UpdateStamp { // // private long timestamp = 0; // private String responsible = ""; // // public long getTimestamp() { // return timestamp; // } // // public void setTimestamp(long timestamp) { // this.timestamp = timestamp; // } // // public String getResponsible() { // return responsible; // } // // public void setResponsible(String responsible) { // this.responsible = responsible; // } // // } // Path: es.alrocar.poiproxy.fiware.poidp/src/main/java/es/alrocar/poiproxy/fiware/poidp/schema/fw_marker_class.java import java.util.HashMap; import java.util.Map; import es.alrocar.poiproxy.fiware.poidp.schema.utils.Source; import es.alrocar.poiproxy.fiware.poidp.schema.utils.UpdateStamp; /* * Licensed to Prodevelop SL under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The Prodevelop SL 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. * * For more information, contact: * * Prodevelop, S.L. * Pza. Don Juan de Villarrasa, 14 - 5 * 46001 Valencia * Spain * * +34 963 510 612 * +34 963 510 968 * prode@prodevelop.es * http://www.prodevelop.es * * @author Alberto Romeu Carrasco aromeu@prodevelop.es */ package es.alrocar.poiproxy.fiware.poidp.schema; public class fw_marker_class { // alvar3x3, alvar5x5 private Map<String, String> image = new HashMap<String, String>(); public void setImageRef(String uri) { image.put("image_ref", uri); } private Source source = null;
private UpdateStamp last_update = null;
Prodevelop/POIProxy
es.alrocar.poiproxy.fiware.poidp/src/main/java/es/alrocar/poiproxy/fiware/poidp/schema/POISet.java
// Path: es.alrocar.poiproxy.fiware.poidp/src/main/java/es/alrocar/poiproxy/fiware/poidp/schema/utils/DateTypeAdapter.java // public class DateTypeAdapter extends TypeAdapter<Date> { // /** // * yyyy/MM/dd HH:mm:ss // */ // public static final String DEFAULT_FORMAT = "yyyy/MM/dd HH:mm:ss"; // // private String format; // // /** // * Default format {@link DateTypeAdapter#DEFAULT_FORMAT} // */ // public DateTypeAdapter() { // this(DEFAULT_FORMAT); // } // // public DateTypeAdapter(String format) { // this.format = format; // } // // public String getFormat() { // return format; // } // // public void setFormat(String format) { // this.format = format; // } // // @Override // public void write(JsonWriter out, Date value) throws IOException { // if (value == null) { // out.value((String) null); // } else { // SimpleDateFormat sdf = new SimpleDateFormat(format); // String val = sdf.format(value); // out.value(val); // } // } // // @Override // public Date read(JsonReader in) throws IOException { // if (in.peek() == JsonToken.NULL) { // in.nextNull(); // return null; // } // // String result = in.nextString(); // if (result.isEmpty()) { // return null; // } // Date date = DateUtil.stringToDate(result); // return date; // } // // } // // Path: es.alrocar.poiproxy.fiware.poidp/src/main/java/es/alrocar/poiproxy/fiware/poidp/schema/utils/Source.java // public class Source extends HashMap<String, String> { // // public Source() { // // } // // public void setName(String name) { // this.put("name", name); // // website id license // } // // public void setWebsite(String str) { // this.put("website", str); // // website id license // } // // public void setId(String str) { // this.put("id", str); // // website id license // } // // public void setLicense(String str) { // this.put("license", str); // // website id license // } // // } // // Path: es.alrocar.poiproxy.fiware.poidp/src/main/java/es/alrocar/poiproxy/fiware/poidp/schema/utils/UpdateStamp.java // public class UpdateStamp { // // private long timestamp = 0; // private String responsible = ""; // // public long getTimestamp() { // return timestamp; // } // // public void setTimestamp(long timestamp) { // this.timestamp = timestamp; // } // // public String getResponsible() { // return responsible; // } // // public void setResponsible(String responsible) { // this.responsible = responsible; // } // // }
import java.util.Date; import java.util.LinkedHashMap; import java.util.Map; import com.google.gson.Gson; import com.google.gson.GsonBuilder; import es.alrocar.poiproxy.fiware.poidp.schema.utils.DateTypeAdapter; import es.alrocar.poiproxy.fiware.poidp.schema.utils.Source; import es.alrocar.poiproxy.fiware.poidp.schema.utils.UpdateStamp;
/* * Licensed to Prodevelop SL under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The Prodevelop SL 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. * * For more information, contact: * * Prodevelop, S.L. * Pza. Don Juan de Villarrasa, 14 - 5 * 46001 Valencia * Spain * * +34 963 510 612 * +34 963 510 968 * prode@prodevelop.es * http://www.prodevelop.es * * @author Alberto Romeu Carrasco aromeu@prodevelop.es */ package es.alrocar.poiproxy.fiware.poidp.schema; public class POISet { private Gson gson = null; private Map<String, POI> pois = new LinkedHashMap<String, POI>(); public String asJSON() { return gson().toJson(pois); } protected Gson gson() { if (gson == null) { GsonBuilder lObjJson = new GsonBuilder(); lObjJson.setDateFormat("yyyy/MM/dd HH:mm:ss");
// Path: es.alrocar.poiproxy.fiware.poidp/src/main/java/es/alrocar/poiproxy/fiware/poidp/schema/utils/DateTypeAdapter.java // public class DateTypeAdapter extends TypeAdapter<Date> { // /** // * yyyy/MM/dd HH:mm:ss // */ // public static final String DEFAULT_FORMAT = "yyyy/MM/dd HH:mm:ss"; // // private String format; // // /** // * Default format {@link DateTypeAdapter#DEFAULT_FORMAT} // */ // public DateTypeAdapter() { // this(DEFAULT_FORMAT); // } // // public DateTypeAdapter(String format) { // this.format = format; // } // // public String getFormat() { // return format; // } // // public void setFormat(String format) { // this.format = format; // } // // @Override // public void write(JsonWriter out, Date value) throws IOException { // if (value == null) { // out.value((String) null); // } else { // SimpleDateFormat sdf = new SimpleDateFormat(format); // String val = sdf.format(value); // out.value(val); // } // } // // @Override // public Date read(JsonReader in) throws IOException { // if (in.peek() == JsonToken.NULL) { // in.nextNull(); // return null; // } // // String result = in.nextString(); // if (result.isEmpty()) { // return null; // } // Date date = DateUtil.stringToDate(result); // return date; // } // // } // // Path: es.alrocar.poiproxy.fiware.poidp/src/main/java/es/alrocar/poiproxy/fiware/poidp/schema/utils/Source.java // public class Source extends HashMap<String, String> { // // public Source() { // // } // // public void setName(String name) { // this.put("name", name); // // website id license // } // // public void setWebsite(String str) { // this.put("website", str); // // website id license // } // // public void setId(String str) { // this.put("id", str); // // website id license // } // // public void setLicense(String str) { // this.put("license", str); // // website id license // } // // } // // Path: es.alrocar.poiproxy.fiware.poidp/src/main/java/es/alrocar/poiproxy/fiware/poidp/schema/utils/UpdateStamp.java // public class UpdateStamp { // // private long timestamp = 0; // private String responsible = ""; // // public long getTimestamp() { // return timestamp; // } // // public void setTimestamp(long timestamp) { // this.timestamp = timestamp; // } // // public String getResponsible() { // return responsible; // } // // public void setResponsible(String responsible) { // this.responsible = responsible; // } // // } // Path: es.alrocar.poiproxy.fiware.poidp/src/main/java/es/alrocar/poiproxy/fiware/poidp/schema/POISet.java import java.util.Date; import java.util.LinkedHashMap; import java.util.Map; import com.google.gson.Gson; import com.google.gson.GsonBuilder; import es.alrocar.poiproxy.fiware.poidp.schema.utils.DateTypeAdapter; import es.alrocar.poiproxy.fiware.poidp.schema.utils.Source; import es.alrocar.poiproxy.fiware.poidp.schema.utils.UpdateStamp; /* * Licensed to Prodevelop SL under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The Prodevelop SL 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. * * For more information, contact: * * Prodevelop, S.L. * Pza. Don Juan de Villarrasa, 14 - 5 * 46001 Valencia * Spain * * +34 963 510 612 * +34 963 510 968 * prode@prodevelop.es * http://www.prodevelop.es * * @author Alberto Romeu Carrasco aromeu@prodevelop.es */ package es.alrocar.poiproxy.fiware.poidp.schema; public class POISet { private Gson gson = null; private Map<String, POI> pois = new LinkedHashMap<String, POI>(); public String asJSON() { return gson().toJson(pois); } protected Gson gson() { if (gson == null) { GsonBuilder lObjJson = new GsonBuilder(); lObjJson.setDateFormat("yyyy/MM/dd HH:mm:ss");
lObjJson.registerTypeAdapter(Date.class, new DateTypeAdapter());
Prodevelop/POIProxy
es.alrocar.map.vector/src/main/java/es/alrocar/map/vector/provider/strategy/impl/BBoxTiledStrategy.java
// Path: es.alrocar.map.vector/src/main/java/es/alrocar/map/vector/provider/driver/ProviderDriver.java // public interface ProviderDriver { // // public ArrayList getData(int[] tile, Extent booundingBox, // Cancellable cancellable, int zoom); // // public boolean needsExtentToWork(); // // public String getSRS(); // // public VectorialProvider getProvider(); // // public void setProvider(VectorialProvider provider); // // public String getName(); // // public IVectorFileSystemProvider getFileSystemProvider(); // // // public void write(int[] tile, int zoomLevel, ArrayList data, // // Cancellable cancellable); // // // // public void write(int[] tile, int zoomLevel, InputStream in, // // Cancellable cancellable); // // // // public ArrayList loadFromDisk(int[] tile, Extent boundingBox, // // Cancellable cancellable); // // // // public boolean supportsLocalCache(); // // // // public boolean isOverwriteLocalCache(); // // // // public boolean isLocalCacheEnable(); // } // // Path: es.alrocar.map.vector/src/main/java/es/alrocar/map/vector/provider/observer/VectorialProviderListener.java // public interface VectorialProviderListener { // // public void onVectorDataRetrieved(int[] tile, ArrayList data, // Cancellable cancellable, int zoomLevel); // // public void onRawDataRetrieved(int[] tile, Object data, // Cancellable cancellable, ProviderDriver driver, int zoomLevel); // // }
import java.util.ArrayList; import es.alrocar.map.vector.provider.driver.ProviderDriver; import es.alrocar.map.vector.provider.observer.VectorialProviderListener; import es.prodevelop.gvsig.mini.geom.Extent; import es.prodevelop.gvsig.mini.geom.Point; import es.prodevelop.gvsig.mini.utiles.Cancellable; import es.prodevelop.tilecache.renderer.MapRenderer;
/* * Licensed to Prodevelop SL under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The Prodevelop SL 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. * * For more information, contact: * * Prodevelop, S.L. * Pza. Don Juan de Villarrasa, 14 - 5 * 46001 Valencia * Spain * * +34 963 510 612 * +34 963 510 968 * prode@prodevelop.es * http://www.prodevelop.es * * @author Alberto Romeu Carrasco http://www.albertoromeu.com */ package es.alrocar.map.vector.provider.strategy.impl; /** * * @author albertoromeu * */ public class BBoxTiledStrategy extends BaseStrategy { private Extent viewExtent; private int[][] tiles; private int zoomLevel; public void getVectorialData(int[][] tiles, int zoomLevel,
// Path: es.alrocar.map.vector/src/main/java/es/alrocar/map/vector/provider/driver/ProviderDriver.java // public interface ProviderDriver { // // public ArrayList getData(int[] tile, Extent booundingBox, // Cancellable cancellable, int zoom); // // public boolean needsExtentToWork(); // // public String getSRS(); // // public VectorialProvider getProvider(); // // public void setProvider(VectorialProvider provider); // // public String getName(); // // public IVectorFileSystemProvider getFileSystemProvider(); // // // public void write(int[] tile, int zoomLevel, ArrayList data, // // Cancellable cancellable); // // // // public void write(int[] tile, int zoomLevel, InputStream in, // // Cancellable cancellable); // // // // public ArrayList loadFromDisk(int[] tile, Extent boundingBox, // // Cancellable cancellable); // // // // public boolean supportsLocalCache(); // // // // public boolean isOverwriteLocalCache(); // // // // public boolean isLocalCacheEnable(); // } // // Path: es.alrocar.map.vector/src/main/java/es/alrocar/map/vector/provider/observer/VectorialProviderListener.java // public interface VectorialProviderListener { // // public void onVectorDataRetrieved(int[] tile, ArrayList data, // Cancellable cancellable, int zoomLevel); // // public void onRawDataRetrieved(int[] tile, Object data, // Cancellable cancellable, ProviderDriver driver, int zoomLevel); // // } // Path: es.alrocar.map.vector/src/main/java/es/alrocar/map/vector/provider/strategy/impl/BBoxTiledStrategy.java import java.util.ArrayList; import es.alrocar.map.vector.provider.driver.ProviderDriver; import es.alrocar.map.vector.provider.observer.VectorialProviderListener; import es.prodevelop.gvsig.mini.geom.Extent; import es.prodevelop.gvsig.mini.geom.Point; import es.prodevelop.gvsig.mini.utiles.Cancellable; import es.prodevelop.tilecache.renderer.MapRenderer; /* * Licensed to Prodevelop SL under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The Prodevelop SL 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. * * For more information, contact: * * Prodevelop, S.L. * Pza. Don Juan de Villarrasa, 14 - 5 * 46001 Valencia * Spain * * +34 963 510 612 * +34 963 510 968 * prode@prodevelop.es * http://www.prodevelop.es * * @author Alberto Romeu Carrasco http://www.albertoromeu.com */ package es.alrocar.map.vector.provider.strategy.impl; /** * * @author albertoromeu * */ public class BBoxTiledStrategy extends BaseStrategy { private Extent viewExtent; private int[][] tiles; private int zoomLevel; public void getVectorialData(int[][] tiles, int zoomLevel,
Extent viewExtent, VectorialProviderListener observer,
Prodevelop/POIProxy
es.alrocar.map.vector/src/main/java/es/alrocar/map/vector/provider/strategy/impl/BBoxTiledStrategy.java
// Path: es.alrocar.map.vector/src/main/java/es/alrocar/map/vector/provider/driver/ProviderDriver.java // public interface ProviderDriver { // // public ArrayList getData(int[] tile, Extent booundingBox, // Cancellable cancellable, int zoom); // // public boolean needsExtentToWork(); // // public String getSRS(); // // public VectorialProvider getProvider(); // // public void setProvider(VectorialProvider provider); // // public String getName(); // // public IVectorFileSystemProvider getFileSystemProvider(); // // // public void write(int[] tile, int zoomLevel, ArrayList data, // // Cancellable cancellable); // // // // public void write(int[] tile, int zoomLevel, InputStream in, // // Cancellable cancellable); // // // // public ArrayList loadFromDisk(int[] tile, Extent boundingBox, // // Cancellable cancellable); // // // // public boolean supportsLocalCache(); // // // // public boolean isOverwriteLocalCache(); // // // // public boolean isLocalCacheEnable(); // } // // Path: es.alrocar.map.vector/src/main/java/es/alrocar/map/vector/provider/observer/VectorialProviderListener.java // public interface VectorialProviderListener { // // public void onVectorDataRetrieved(int[] tile, ArrayList data, // Cancellable cancellable, int zoomLevel); // // public void onRawDataRetrieved(int[] tile, Object data, // Cancellable cancellable, ProviderDriver driver, int zoomLevel); // // }
import java.util.ArrayList; import es.alrocar.map.vector.provider.driver.ProviderDriver; import es.alrocar.map.vector.provider.observer.VectorialProviderListener; import es.prodevelop.gvsig.mini.geom.Extent; import es.prodevelop.gvsig.mini.geom.Point; import es.prodevelop.gvsig.mini.utiles.Cancellable; import es.prodevelop.tilecache.renderer.MapRenderer;
/* * Licensed to Prodevelop SL under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The Prodevelop SL 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. * * For more information, contact: * * Prodevelop, S.L. * Pza. Don Juan de Villarrasa, 14 - 5 * 46001 Valencia * Spain * * +34 963 510 612 * +34 963 510 968 * prode@prodevelop.es * http://www.prodevelop.es * * @author Alberto Romeu Carrasco http://www.albertoromeu.com */ package es.alrocar.map.vector.provider.strategy.impl; /** * * @author albertoromeu * */ public class BBoxTiledStrategy extends BaseStrategy { private Extent viewExtent; private int[][] tiles; private int zoomLevel; public void getVectorialData(int[][] tiles, int zoomLevel, Extent viewExtent, VectorialProviderListener observer, Cancellable cancellable) { try { cacheValues(tiles, zoomLevel, viewExtent); final int size = tiles.length;
// Path: es.alrocar.map.vector/src/main/java/es/alrocar/map/vector/provider/driver/ProviderDriver.java // public interface ProviderDriver { // // public ArrayList getData(int[] tile, Extent booundingBox, // Cancellable cancellable, int zoom); // // public boolean needsExtentToWork(); // // public String getSRS(); // // public VectorialProvider getProvider(); // // public void setProvider(VectorialProvider provider); // // public String getName(); // // public IVectorFileSystemProvider getFileSystemProvider(); // // // public void write(int[] tile, int zoomLevel, ArrayList data, // // Cancellable cancellable); // // // // public void write(int[] tile, int zoomLevel, InputStream in, // // Cancellable cancellable); // // // // public ArrayList loadFromDisk(int[] tile, Extent boundingBox, // // Cancellable cancellable); // // // // public boolean supportsLocalCache(); // // // // public boolean isOverwriteLocalCache(); // // // // public boolean isLocalCacheEnable(); // } // // Path: es.alrocar.map.vector/src/main/java/es/alrocar/map/vector/provider/observer/VectorialProviderListener.java // public interface VectorialProviderListener { // // public void onVectorDataRetrieved(int[] tile, ArrayList data, // Cancellable cancellable, int zoomLevel); // // public void onRawDataRetrieved(int[] tile, Object data, // Cancellable cancellable, ProviderDriver driver, int zoomLevel); // // } // Path: es.alrocar.map.vector/src/main/java/es/alrocar/map/vector/provider/strategy/impl/BBoxTiledStrategy.java import java.util.ArrayList; import es.alrocar.map.vector.provider.driver.ProviderDriver; import es.alrocar.map.vector.provider.observer.VectorialProviderListener; import es.prodevelop.gvsig.mini.geom.Extent; import es.prodevelop.gvsig.mini.geom.Point; import es.prodevelop.gvsig.mini.utiles.Cancellable; import es.prodevelop.tilecache.renderer.MapRenderer; /* * Licensed to Prodevelop SL under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The Prodevelop SL 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. * * For more information, contact: * * Prodevelop, S.L. * Pza. Don Juan de Villarrasa, 14 - 5 * 46001 Valencia * Spain * * +34 963 510 612 * +34 963 510 968 * prode@prodevelop.es * http://www.prodevelop.es * * @author Alberto Romeu Carrasco http://www.albertoromeu.com */ package es.alrocar.map.vector.provider.strategy.impl; /** * * @author albertoromeu * */ public class BBoxTiledStrategy extends BaseStrategy { private Extent viewExtent; private int[][] tiles; private int zoomLevel; public void getVectorialData(int[][] tiles, int zoomLevel, Extent viewExtent, VectorialProviderListener observer, Cancellable cancellable) { try { cacheValues(tiles, zoomLevel, viewExtent); final int size = tiles.length;
final ProviderDriver driver = getProvider().getDriver();
Prodevelop/POIProxy
es.alrocar.poiproxy.fiware.poidp/src/main/java/es/alrocar/poiproxy/fiware/poidp/schema/fw_time_class.java
// Path: es.alrocar.poiproxy.fiware.poidp/src/main/java/es/alrocar/poiproxy/fiware/poidp/schema/utils/Schedule.java // public class Schedule { // // } // // Path: es.alrocar.poiproxy.fiware.poidp/src/main/java/es/alrocar/poiproxy/fiware/poidp/schema/utils/Source.java // public class Source extends HashMap<String, String> { // // public Source() { // // } // // public void setName(String name) { // this.put("name", name); // // website id license // } // // public void setWebsite(String str) { // this.put("website", str); // // website id license // } // // public void setId(String str) { // this.put("id", str); // // website id license // } // // public void setLicense(String str) { // this.put("license", str); // // website id license // } // // } // // Path: es.alrocar.poiproxy.fiware.poidp/src/main/java/es/alrocar/poiproxy/fiware/poidp/schema/utils/UpdateStamp.java // public class UpdateStamp { // // private long timestamp = 0; // private String responsible = ""; // // public long getTimestamp() { // return timestamp; // } // // public void setTimestamp(long timestamp) { // this.timestamp = timestamp; // } // // public String getResponsible() { // return responsible; // } // // public void setResponsible(String responsible) { // this.responsible = responsible; // } // // }
import es.alrocar.poiproxy.fiware.poidp.schema.utils.Schedule; import es.alrocar.poiproxy.fiware.poidp.schema.utils.Source; import es.alrocar.poiproxy.fiware.poidp.schema.utils.UpdateStamp;
/* * Licensed to Prodevelop SL under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The Prodevelop SL 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. * * For more information, contact: * * Prodevelop, S.L. * Pza. Don Juan de Villarrasa, 14 - 5 * 46001 Valencia * Spain * * +34 963 510 612 * +34 963 510 968 * prode@prodevelop.es * http://www.prodevelop.es * * @author Alberto Romeu Carrasco aromeu@prodevelop.es */ package es.alrocar.poiproxy.fiware.poidp.schema; public class fw_time_class { private String type = "open"; // "open", "show_time private String time_zone = "time_zone"; // not decided
// Path: es.alrocar.poiproxy.fiware.poidp/src/main/java/es/alrocar/poiproxy/fiware/poidp/schema/utils/Schedule.java // public class Schedule { // // } // // Path: es.alrocar.poiproxy.fiware.poidp/src/main/java/es/alrocar/poiproxy/fiware/poidp/schema/utils/Source.java // public class Source extends HashMap<String, String> { // // public Source() { // // } // // public void setName(String name) { // this.put("name", name); // // website id license // } // // public void setWebsite(String str) { // this.put("website", str); // // website id license // } // // public void setId(String str) { // this.put("id", str); // // website id license // } // // public void setLicense(String str) { // this.put("license", str); // // website id license // } // // } // // Path: es.alrocar.poiproxy.fiware.poidp/src/main/java/es/alrocar/poiproxy/fiware/poidp/schema/utils/UpdateStamp.java // public class UpdateStamp { // // private long timestamp = 0; // private String responsible = ""; // // public long getTimestamp() { // return timestamp; // } // // public void setTimestamp(long timestamp) { // this.timestamp = timestamp; // } // // public String getResponsible() { // return responsible; // } // // public void setResponsible(String responsible) { // this.responsible = responsible; // } // // } // Path: es.alrocar.poiproxy.fiware.poidp/src/main/java/es/alrocar/poiproxy/fiware/poidp/schema/fw_time_class.java import es.alrocar.poiproxy.fiware.poidp.schema.utils.Schedule; import es.alrocar.poiproxy.fiware.poidp.schema.utils.Source; import es.alrocar.poiproxy.fiware.poidp.schema.utils.UpdateStamp; /* * Licensed to Prodevelop SL under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The Prodevelop SL 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. * * For more information, contact: * * Prodevelop, S.L. * Pza. Don Juan de Villarrasa, 14 - 5 * 46001 Valencia * Spain * * +34 963 510 612 * +34 963 510 968 * prode@prodevelop.es * http://www.prodevelop.es * * @author Alberto Romeu Carrasco aromeu@prodevelop.es */ package es.alrocar.poiproxy.fiware.poidp.schema; public class fw_time_class { private String type = "open"; // "open", "show_time private String time_zone = "time_zone"; // not decided
private Schedule schedule = null;
Prodevelop/POIProxy
es.alrocar.poiproxy.fiware.poidp/src/main/java/es/alrocar/poiproxy/fiware/poidp/schema/fw_time_class.java
// Path: es.alrocar.poiproxy.fiware.poidp/src/main/java/es/alrocar/poiproxy/fiware/poidp/schema/utils/Schedule.java // public class Schedule { // // } // // Path: es.alrocar.poiproxy.fiware.poidp/src/main/java/es/alrocar/poiproxy/fiware/poidp/schema/utils/Source.java // public class Source extends HashMap<String, String> { // // public Source() { // // } // // public void setName(String name) { // this.put("name", name); // // website id license // } // // public void setWebsite(String str) { // this.put("website", str); // // website id license // } // // public void setId(String str) { // this.put("id", str); // // website id license // } // // public void setLicense(String str) { // this.put("license", str); // // website id license // } // // } // // Path: es.alrocar.poiproxy.fiware.poidp/src/main/java/es/alrocar/poiproxy/fiware/poidp/schema/utils/UpdateStamp.java // public class UpdateStamp { // // private long timestamp = 0; // private String responsible = ""; // // public long getTimestamp() { // return timestamp; // } // // public void setTimestamp(long timestamp) { // this.timestamp = timestamp; // } // // public String getResponsible() { // return responsible; // } // // public void setResponsible(String responsible) { // this.responsible = responsible; // } // // }
import es.alrocar.poiproxy.fiware.poidp.schema.utils.Schedule; import es.alrocar.poiproxy.fiware.poidp.schema.utils.Source; import es.alrocar.poiproxy.fiware.poidp.schema.utils.UpdateStamp;
/* * Licensed to Prodevelop SL under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The Prodevelop SL 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. * * For more information, contact: * * Prodevelop, S.L. * Pza. Don Juan de Villarrasa, 14 - 5 * 46001 Valencia * Spain * * +34 963 510 612 * +34 963 510 968 * prode@prodevelop.es * http://www.prodevelop.es * * @author Alberto Romeu Carrasco aromeu@prodevelop.es */ package es.alrocar.poiproxy.fiware.poidp.schema; public class fw_time_class { private String type = "open"; // "open", "show_time private String time_zone = "time_zone"; // not decided private Schedule schedule = null;
// Path: es.alrocar.poiproxy.fiware.poidp/src/main/java/es/alrocar/poiproxy/fiware/poidp/schema/utils/Schedule.java // public class Schedule { // // } // // Path: es.alrocar.poiproxy.fiware.poidp/src/main/java/es/alrocar/poiproxy/fiware/poidp/schema/utils/Source.java // public class Source extends HashMap<String, String> { // // public Source() { // // } // // public void setName(String name) { // this.put("name", name); // // website id license // } // // public void setWebsite(String str) { // this.put("website", str); // // website id license // } // // public void setId(String str) { // this.put("id", str); // // website id license // } // // public void setLicense(String str) { // this.put("license", str); // // website id license // } // // } // // Path: es.alrocar.poiproxy.fiware.poidp/src/main/java/es/alrocar/poiproxy/fiware/poidp/schema/utils/UpdateStamp.java // public class UpdateStamp { // // private long timestamp = 0; // private String responsible = ""; // // public long getTimestamp() { // return timestamp; // } // // public void setTimestamp(long timestamp) { // this.timestamp = timestamp; // } // // public String getResponsible() { // return responsible; // } // // public void setResponsible(String responsible) { // this.responsible = responsible; // } // // } // Path: es.alrocar.poiproxy.fiware.poidp/src/main/java/es/alrocar/poiproxy/fiware/poidp/schema/fw_time_class.java import es.alrocar.poiproxy.fiware.poidp.schema.utils.Schedule; import es.alrocar.poiproxy.fiware.poidp.schema.utils.Source; import es.alrocar.poiproxy.fiware.poidp.schema.utils.UpdateStamp; /* * Licensed to Prodevelop SL under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The Prodevelop SL 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. * * For more information, contact: * * Prodevelop, S.L. * Pza. Don Juan de Villarrasa, 14 - 5 * 46001 Valencia * Spain * * +34 963 510 612 * +34 963 510 968 * prode@prodevelop.es * http://www.prodevelop.es * * @author Alberto Romeu Carrasco aromeu@prodevelop.es */ package es.alrocar.poiproxy.fiware.poidp.schema; public class fw_time_class { private String type = "open"; // "open", "show_time private String time_zone = "time_zone"; // not decided private Schedule schedule = null;
private Source source = null;
Prodevelop/POIProxy
es.alrocar.poiproxy.fiware.poidp/src/main/java/es/alrocar/poiproxy/fiware/poidp/schema/fw_time_class.java
// Path: es.alrocar.poiproxy.fiware.poidp/src/main/java/es/alrocar/poiproxy/fiware/poidp/schema/utils/Schedule.java // public class Schedule { // // } // // Path: es.alrocar.poiproxy.fiware.poidp/src/main/java/es/alrocar/poiproxy/fiware/poidp/schema/utils/Source.java // public class Source extends HashMap<String, String> { // // public Source() { // // } // // public void setName(String name) { // this.put("name", name); // // website id license // } // // public void setWebsite(String str) { // this.put("website", str); // // website id license // } // // public void setId(String str) { // this.put("id", str); // // website id license // } // // public void setLicense(String str) { // this.put("license", str); // // website id license // } // // } // // Path: es.alrocar.poiproxy.fiware.poidp/src/main/java/es/alrocar/poiproxy/fiware/poidp/schema/utils/UpdateStamp.java // public class UpdateStamp { // // private long timestamp = 0; // private String responsible = ""; // // public long getTimestamp() { // return timestamp; // } // // public void setTimestamp(long timestamp) { // this.timestamp = timestamp; // } // // public String getResponsible() { // return responsible; // } // // public void setResponsible(String responsible) { // this.responsible = responsible; // } // // }
import es.alrocar.poiproxy.fiware.poidp.schema.utils.Schedule; import es.alrocar.poiproxy.fiware.poidp.schema.utils.Source; import es.alrocar.poiproxy.fiware.poidp.schema.utils.UpdateStamp;
/* * Licensed to Prodevelop SL under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The Prodevelop SL 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. * * For more information, contact: * * Prodevelop, S.L. * Pza. Don Juan de Villarrasa, 14 - 5 * 46001 Valencia * Spain * * +34 963 510 612 * +34 963 510 968 * prode@prodevelop.es * http://www.prodevelop.es * * @author Alberto Romeu Carrasco aromeu@prodevelop.es */ package es.alrocar.poiproxy.fiware.poidp.schema; public class fw_time_class { private String type = "open"; // "open", "show_time private String time_zone = "time_zone"; // not decided private Schedule schedule = null; private Source source = null;
// Path: es.alrocar.poiproxy.fiware.poidp/src/main/java/es/alrocar/poiproxy/fiware/poidp/schema/utils/Schedule.java // public class Schedule { // // } // // Path: es.alrocar.poiproxy.fiware.poidp/src/main/java/es/alrocar/poiproxy/fiware/poidp/schema/utils/Source.java // public class Source extends HashMap<String, String> { // // public Source() { // // } // // public void setName(String name) { // this.put("name", name); // // website id license // } // // public void setWebsite(String str) { // this.put("website", str); // // website id license // } // // public void setId(String str) { // this.put("id", str); // // website id license // } // // public void setLicense(String str) { // this.put("license", str); // // website id license // } // // } // // Path: es.alrocar.poiproxy.fiware.poidp/src/main/java/es/alrocar/poiproxy/fiware/poidp/schema/utils/UpdateStamp.java // public class UpdateStamp { // // private long timestamp = 0; // private String responsible = ""; // // public long getTimestamp() { // return timestamp; // } // // public void setTimestamp(long timestamp) { // this.timestamp = timestamp; // } // // public String getResponsible() { // return responsible; // } // // public void setResponsible(String responsible) { // this.responsible = responsible; // } // // } // Path: es.alrocar.poiproxy.fiware.poidp/src/main/java/es/alrocar/poiproxy/fiware/poidp/schema/fw_time_class.java import es.alrocar.poiproxy.fiware.poidp.schema.utils.Schedule; import es.alrocar.poiproxy.fiware.poidp.schema.utils.Source; import es.alrocar.poiproxy.fiware.poidp.schema.utils.UpdateStamp; /* * Licensed to Prodevelop SL under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The Prodevelop SL 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. * * For more information, contact: * * Prodevelop, S.L. * Pza. Don Juan de Villarrasa, 14 - 5 * 46001 Valencia * Spain * * +34 963 510 612 * +34 963 510 968 * prode@prodevelop.es * http://www.prodevelop.es * * @author Alberto Romeu Carrasco aromeu@prodevelop.es */ package es.alrocar.poiproxy.fiware.poidp.schema; public class fw_time_class { private String type = "open"; // "open", "show_time private String time_zone = "time_zone"; // not decided private Schedule schedule = null; private Source source = null;
private UpdateStamp last_update = null;
OHDSI/WhiteRabbit
rabbitinahat/src/main/java/org/ohdsi/rabbitInAHat/LabeledRectangle.java
// Path: rabbit-core/src/main/java/org/ohdsi/rabbitInAHat/dataModel/MappableItem.java // public interface MappableItem extends Serializable{ // public String outputName(); // public String getName(); // public Database getDb(); // public boolean isStem(); // public void setStem(boolean isStem); // }
import org.ohdsi.rabbitInAHat.dataModel.MappableItem; import java.awt.BasicStroke; import java.awt.Color; import java.awt.Font; import java.awt.FontMetrics; import java.awt.Graphics; import java.awt.Graphics2D; import java.awt.Point; import java.awt.Stroke; import java.awt.geom.Rectangle2D; import java.util.ArrayList; import java.util.List; import javax.swing.event.ChangeListener;
/******************************************************************************* * Copyright 2019 Observational Health Data Sciences and Informatics * * This file is part of WhiteRabbit * * Licensed 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 org.ohdsi.rabbitInAHat; public class LabeledRectangle implements MappingComponent { public static int FONT_SIZE = 18; private static Stroke stroke = new BasicStroke(2); private static BasicStroke dashed = new BasicStroke(2.0f, BasicStroke.CAP_BUTT, BasicStroke.JOIN_MITER, 10.0f, new float[] { 10.f }, 0.0f); private List<ChangeListener> changeListeners = new ArrayList<ChangeListener>(); private int x; private int y; private int width; private int height;
// Path: rabbit-core/src/main/java/org/ohdsi/rabbitInAHat/dataModel/MappableItem.java // public interface MappableItem extends Serializable{ // public String outputName(); // public String getName(); // public Database getDb(); // public boolean isStem(); // public void setStem(boolean isStem); // } // Path: rabbitinahat/src/main/java/org/ohdsi/rabbitInAHat/LabeledRectangle.java import org.ohdsi.rabbitInAHat.dataModel.MappableItem; import java.awt.BasicStroke; import java.awt.Color; import java.awt.Font; import java.awt.FontMetrics; import java.awt.Graphics; import java.awt.Graphics2D; import java.awt.Point; import java.awt.Stroke; import java.awt.geom.Rectangle2D; import java.util.ArrayList; import java.util.List; import javax.swing.event.ChangeListener; /******************************************************************************* * Copyright 2019 Observational Health Data Sciences and Informatics * * This file is part of WhiteRabbit * * Licensed 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 org.ohdsi.rabbitInAHat; public class LabeledRectangle implements MappingComponent { public static int FONT_SIZE = 18; private static Stroke stroke = new BasicStroke(2); private static BasicStroke dashed = new BasicStroke(2.0f, BasicStroke.CAP_BUTT, BasicStroke.JOIN_MITER, 10.0f, new float[] { 10.f }, 0.0f); private List<ChangeListener> changeListeners = new ArrayList<ChangeListener>(); private int x; private int y; private int width; private int height;
private MappableItem item;
OHDSI/WhiteRabbit
whiterabbit/src/main/java/org/ohdsi/whiteRabbit/DbSettings.java
// Path: rabbit-core/src/main/java/org/ohdsi/databases/DbType.java // public class DbType { // public static DbType MYSQL = new DbType("mysql"); // public static DbType MSSQL = new DbType("mssql"); // public static DbType PDW = new DbType("pdw"); // public static DbType ORACLE = new DbType("oracle"); // public static DbType POSTGRESQL = new DbType("postgresql"); // public static DbType MSACCESS = new DbType("msaccess"); // public static DbType REDSHIFT = new DbType("redshift"); // public static DbType TERADATA = new DbType("teradata"); // public static DbType BIGQUERY = new DbType("bigquery"); // public static DbType AZURE = new DbType("azure"); // // private enum Type { // MYSQL, MSSQL, PDW, ORACLE, POSTGRESQL, MSACCESS, REDSHIFT, TERADATA, BIGQUERY, AZURE // }; // // private Type type; // // public DbType(String type) { // this.type = Type.valueOf(type.toUpperCase()); // } // // public boolean equals(Object other) { // if (other instanceof DbType && ((DbType) other).type == type) // return true; // else // return false; // } // // public String getTypeName() { // return this.type.name(); // } // }
import java.util.ArrayList; import java.util.List; import org.apache.commons.csv.CSVFormat; import org.ohdsi.databases.DbType;
/******************************************************************************* * Copyright 2019 Observational Health Data Sciences and Informatics * * This file is part of WhiteRabbit * * Licensed 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 org.ohdsi.whiteRabbit; public class DbSettings { public enum SourceType { DATABASE, CSV_FILES, SAS_FILES } public SourceType sourceType; public List<String> tables = new ArrayList<>(); // Database settings
// Path: rabbit-core/src/main/java/org/ohdsi/databases/DbType.java // public class DbType { // public static DbType MYSQL = new DbType("mysql"); // public static DbType MSSQL = new DbType("mssql"); // public static DbType PDW = new DbType("pdw"); // public static DbType ORACLE = new DbType("oracle"); // public static DbType POSTGRESQL = new DbType("postgresql"); // public static DbType MSACCESS = new DbType("msaccess"); // public static DbType REDSHIFT = new DbType("redshift"); // public static DbType TERADATA = new DbType("teradata"); // public static DbType BIGQUERY = new DbType("bigquery"); // public static DbType AZURE = new DbType("azure"); // // private enum Type { // MYSQL, MSSQL, PDW, ORACLE, POSTGRESQL, MSACCESS, REDSHIFT, TERADATA, BIGQUERY, AZURE // }; // // private Type type; // // public DbType(String type) { // this.type = Type.valueOf(type.toUpperCase()); // } // // public boolean equals(Object other) { // if (other instanceof DbType && ((DbType) other).type == type) // return true; // else // return false; // } // // public String getTypeName() { // return this.type.name(); // } // } // Path: whiterabbit/src/main/java/org/ohdsi/whiteRabbit/DbSettings.java import java.util.ArrayList; import java.util.List; import org.apache.commons.csv.CSVFormat; import org.ohdsi.databases.DbType; /******************************************************************************* * Copyright 2019 Observational Health Data Sciences and Informatics * * This file is part of WhiteRabbit * * Licensed 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 org.ohdsi.whiteRabbit; public class DbSettings { public enum SourceType { DATABASE, CSV_FILES, SAS_FILES } public SourceType sourceType; public List<String> tables = new ArrayList<>(); // Database settings
public DbType dbType;
OHDSI/WhiteRabbit
rabbitinahat/src/main/java/org/ohdsi/rabbitInAHat/MappingPanel.java
// Path: rabbit-core/src/main/java/org/ohdsi/utilities/collections/IntegerComparator.java // public class IntegerComparator implements Comparator<Integer> { // // @Override // public int compare(Integer arg0, Integer arg1) { // if (arg0 < arg1) // return -1; // else if (arg0 > arg1) // return 1; // else // return 0; // } // // public static int compare(int arg0, int arg1) { // if (arg0 < arg1) // return -1; // else if (arg0 > arg1) // return 1; // else // return 0; // } // }
import java.awt.Color; import java.awt.Dimension; import java.awt.Font; import java.awt.FontMetrics; import java.awt.Graphics; import java.awt.Graphics2D; import java.awt.Image; import java.awt.Point; import java.awt.Rectangle; import java.awt.RenderingHints; import java.awt.Toolkit; import java.awt.event.ActionEvent; import java.awt.event.KeyEvent; import java.awt.event.MouseEvent; import java.awt.event.MouseListener; import java.awt.event.MouseMotionListener; import java.awt.geom.Rectangle2D; import java.util.ArrayList; import java.util.Collections; import java.util.Comparator; import java.util.Iterator; import java.util.List; import java.util.Hashtable; import javax.swing.AbstractAction; import javax.swing.JPanel; import javax.swing.KeyStroke; import org.ohdsi.rabbitInAHat.Arrow.HighlightStatus; import org.ohdsi.rabbitInAHat.dataModel.*; import org.ohdsi.utilities.collections.IntegerComparator;
if (dragArrow != null) { if (event.getX() < sourceX + ITEM_WIDTH + Arrow.headThickness) dragArrow.setTargetPoint(null); else dragArrow.setTargetPoint(event.getPoint()); repaint(); } this.scrollRectToVisible(new Rectangle(event.getX() - 40, event.getY() - 40, 80, 80)); } @Override public void mouseMoved(MouseEvent event) { if (event.getX() > sourceX + ITEM_WIDTH && event.getX() < sourceX + ITEM_WIDTH + ARROW_START_WIDTH && dragArrow == null) { if (!showingArrowStarts) { showingArrowStarts = true; repaint(); } } else { if (showingArrowStarts) { showingArrowStarts = false; repaint(); } } } private class YComparator implements Comparator<LabeledRectangle> { @Override public int compare(LabeledRectangle o1, LabeledRectangle o2) {
// Path: rabbit-core/src/main/java/org/ohdsi/utilities/collections/IntegerComparator.java // public class IntegerComparator implements Comparator<Integer> { // // @Override // public int compare(Integer arg0, Integer arg1) { // if (arg0 < arg1) // return -1; // else if (arg0 > arg1) // return 1; // else // return 0; // } // // public static int compare(int arg0, int arg1) { // if (arg0 < arg1) // return -1; // else if (arg0 > arg1) // return 1; // else // return 0; // } // } // Path: rabbitinahat/src/main/java/org/ohdsi/rabbitInAHat/MappingPanel.java import java.awt.Color; import java.awt.Dimension; import java.awt.Font; import java.awt.FontMetrics; import java.awt.Graphics; import java.awt.Graphics2D; import java.awt.Image; import java.awt.Point; import java.awt.Rectangle; import java.awt.RenderingHints; import java.awt.Toolkit; import java.awt.event.ActionEvent; import java.awt.event.KeyEvent; import java.awt.event.MouseEvent; import java.awt.event.MouseListener; import java.awt.event.MouseMotionListener; import java.awt.geom.Rectangle2D; import java.util.ArrayList; import java.util.Collections; import java.util.Comparator; import java.util.Iterator; import java.util.List; import java.util.Hashtable; import javax.swing.AbstractAction; import javax.swing.JPanel; import javax.swing.KeyStroke; import org.ohdsi.rabbitInAHat.Arrow.HighlightStatus; import org.ohdsi.rabbitInAHat.dataModel.*; import org.ohdsi.utilities.collections.IntegerComparator; if (dragArrow != null) { if (event.getX() < sourceX + ITEM_WIDTH + Arrow.headThickness) dragArrow.setTargetPoint(null); else dragArrow.setTargetPoint(event.getPoint()); repaint(); } this.scrollRectToVisible(new Rectangle(event.getX() - 40, event.getY() - 40, 80, 80)); } @Override public void mouseMoved(MouseEvent event) { if (event.getX() > sourceX + ITEM_WIDTH && event.getX() < sourceX + ITEM_WIDTH + ARROW_START_WIDTH && dragArrow == null) { if (!showingArrowStarts) { showingArrowStarts = true; repaint(); } } else { if (showingArrowStarts) { showingArrowStarts = false; repaint(); } } } private class YComparator implements Comparator<LabeledRectangle> { @Override public int compare(LabeledRectangle o1, LabeledRectangle o2) {
return IntegerComparator.compare(o1.getY(), o2.getY());
OHDSI/WhiteRabbit
rabbitinahat/src/main/java/org/ohdsi/rabbitInAHat/dataModel/StemTableFactory.java
// Path: rabbit-core/src/main/java/org/ohdsi/utilities/collections/Pair.java // public class Pair<A, B> implements Serializable { // // private A object1; // private B object2; // private static final long serialVersionUID = 1784282381416947673L; // // public Pair(A item1, B item2) { // this.object1 = item1; // this.object2 = item2; // } // // public String toString() { // return "[[" + object1.toString() + "],[" + object2.toString() + "]]"; // } // // public int hashCode() { // return object1.hashCode() + object2.hashCode(); // } // // public A getItem1() { // return object1; // } // // public B getItem2() { // return object2; // } // // public void setItem1(A item1) { // object1 = item1; // } // // public void setItem2(B item2) { // object2 = item2; // } // // @SuppressWarnings("rawtypes") // public boolean equals(Object other) { // if (other instanceof Pair) // if (((Pair) other).object1.equals(object1)) // if (((Pair) other).object2.equals(object2)) // return true; // return false; // } // }
import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; import javax.swing.JOptionPane; import org.apache.commons.csv.CSVFormat; import org.apache.commons.csv.CSVRecord; import org.ohdsi.utilities.collections.Pair;
sourceDatabase.getTables().add(sourceStemTable); Table targetStemTable = new Table(sourceStemTable); targetStemTable.setDb(targetDatabase); targetDatabase.getTables().add(targetStemTable); Mapping<Table> mapping = etl.getTableToTableMapping(); Map<String, Table> nameToTable = new HashMap<>(); for (CSVRecord row : csvFormat.parse(new InputStreamReader(mappingStream))) { String targetTableName = row.get("TARGET_TABLE"); Table targetTable = nameToTable.get(targetTableName); if (targetTable == null) { targetTable = targetDatabase.getTableByName(targetTableName); mapping.addSourceToTargetMap(sourceStemTable, targetTable); nameToTable.put(targetTableName, targetTable); } Mapping<Field> fieldToFieldMapping = etl.getFieldToFieldMapping(sourceStemTable, targetTable); Field sourceField = sourceStemTable.getFieldByName(row.get("SOURCE_FIELD")); Field targetField = targetTable.getFieldByName(row.get("TARGET_FIELD")); fieldToFieldMapping.addSourceToTargetMap(sourceField, targetField); } } catch (IOException e) { throw new RuntimeException(e.getMessage()); } } public static void removeStemTable(ETL etl) { // Find stem source and target tables Mapping<Table> mapping = etl.getTableToTableMapping();
// Path: rabbit-core/src/main/java/org/ohdsi/utilities/collections/Pair.java // public class Pair<A, B> implements Serializable { // // private A object1; // private B object2; // private static final long serialVersionUID = 1784282381416947673L; // // public Pair(A item1, B item2) { // this.object1 = item1; // this.object2 = item2; // } // // public String toString() { // return "[[" + object1.toString() + "],[" + object2.toString() + "]]"; // } // // public int hashCode() { // return object1.hashCode() + object2.hashCode(); // } // // public A getItem1() { // return object1; // } // // public B getItem2() { // return object2; // } // // public void setItem1(A item1) { // object1 = item1; // } // // public void setItem2(B item2) { // object2 = item2; // } // // @SuppressWarnings("rawtypes") // public boolean equals(Object other) { // if (other instanceof Pair) // if (((Pair) other).object1.equals(object1)) // if (((Pair) other).object2.equals(object2)) // return true; // return false; // } // } // Path: rabbitinahat/src/main/java/org/ohdsi/rabbitInAHat/dataModel/StemTableFactory.java import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; import javax.swing.JOptionPane; import org.apache.commons.csv.CSVFormat; import org.apache.commons.csv.CSVRecord; import org.ohdsi.utilities.collections.Pair; sourceDatabase.getTables().add(sourceStemTable); Table targetStemTable = new Table(sourceStemTable); targetStemTable.setDb(targetDatabase); targetDatabase.getTables().add(targetStemTable); Mapping<Table> mapping = etl.getTableToTableMapping(); Map<String, Table> nameToTable = new HashMap<>(); for (CSVRecord row : csvFormat.parse(new InputStreamReader(mappingStream))) { String targetTableName = row.get("TARGET_TABLE"); Table targetTable = nameToTable.get(targetTableName); if (targetTable == null) { targetTable = targetDatabase.getTableByName(targetTableName); mapping.addSourceToTargetMap(sourceStemTable, targetTable); nameToTable.put(targetTableName, targetTable); } Mapping<Field> fieldToFieldMapping = etl.getFieldToFieldMapping(sourceStemTable, targetTable); Field sourceField = sourceStemTable.getFieldByName(row.get("SOURCE_FIELD")); Field targetField = targetTable.getFieldByName(row.get("TARGET_FIELD")); fieldToFieldMapping.addSourceToTargetMap(sourceField, targetField); } } catch (IOException e) { throw new RuntimeException(e.getMessage()); } } public static void removeStemTable(ETL etl) { // Find stem source and target tables Mapping<Table> mapping = etl.getTableToTableMapping();
List<Pair<Table, Table>> tablesMappingsToRemove = new ArrayList<>();
OHDSI/WhiteRabbit
rabbitinahat/src/main/java/org/ohdsi/rabbitInAHat/ETLTestFrameWorkGenerator.java
// Path: rabbitinahat/src/main/java/org/ohdsi/rabbitInAHat/dataModel/ETL.java // public enum FileFormat { // Binary, Json, GzipJson // }
import java.io.BufferedWriter; import java.io.FileNotFoundException; import java.io.IOException; import java.io.PrintWriter; import java.nio.charset.StandardCharsets; import java.nio.file.Files; import java.nio.file.Path; import java.nio.file.Paths; import java.util.*; import java.util.stream.Collectors; import org.ohdsi.rabbitInAHat.dataModel.*; import org.ohdsi.rabbitInAHat.dataModel.ETL.FileFormat;
/******************************************************************************* * Copyright 2019 Observational Health Data Sciences and Informatics * * This file is part of WhiteRabbit * * Licensed 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 org.ohdsi.rabbitInAHat; // TODO: use templating to generate the R code (e.g. Jinja/Apache FreeMarker/Mustache). At least put static R code in separate (.R) files. public class ETLTestFrameWorkGenerator { private static int DEFAULT = 0; private static int NEGATE = 1; private static int COUNT = 2; private static final Set<String> keywordSet = new HashSet<>(Arrays.asList("ADD", "ALL", "ALTER", "AND", "ANY", "AS", "ASC", "AUTHORIZATION", "BACKUP", "BEGIN", "BETWEEN", "BREAK", "BROWSE", "BULK", "BY", "CASCADE", "CASE", "CHECK", "CHECKPOINT", "CLOSE", "CLUSTERED", "COALESCE", "COLLATE", "COLUMN", "COMMIT", "COMPUTE", "CONSTRAINT", "CONTAINS", "CONTAINSTABLE", "CONTINUE", "CONVERT", "CREATE", "CROSS", "CURRENT", "CURRENT_DATE", "CURRENT_TIME", "CURRENT_TIMESTAMP", "CURRENT_USER", "CURSOR", "DATABASE", "DBCC", "DEALLOCATE", "DECLARE", "DEFAULT", "DELETE", "DENY", "DESC", "DISK", "DISTINCT", "DISTRIBUTED", "DOUBLE", "DROP", "DUMP", "ELSE", "END", "ERRLVL", "ESCAPE", "EXCEPT", "EXEC", "EXECUTE", "EXISTS", "EXIT", "EXTERNAL", "FETCH", "FILE", "FILLFACTOR", "FOR", "FOREIGN", "FREETEXT", "FREETEXTTABLE", "FROM", "FULL", "FUNCTION", "GOTO", "GRANT", "GROUP", "HAVING", "HOLDLOCK", "IDENTITY", "IDENTITY_INSERT", "IDENTITYCOL", "IF", "IN", "INDEX", "INNER", "INSERT", "INTERSECT", "INTO", "IS", "JOIN", "KEY", "KILL", "LEFT", "LIKE", "LINENO", "LOAD", "MERGE", "NATIONAL", "NOCHECK", "NONCLUSTERED", "NOT", "NULL", "NULLIF", "OF", "OFF", "OFFSETS", "ON", "OPEN", "OPENDATASOURCE", "OPENQUERY", "OPENROWSET", "OPENXML", "OPTION", "OR", "ORDER", "OUTER", "OVER", "PERCENT", "PIVOT", "PLAN", "PRECISION", "PRIMARY", "PRINT", "PROC", "PROCEDURE", "PUBLIC", "RAISERROR", "READ", "READTEXT", "RECONFIGURE", "REFERENCES", "REPLICATION", "RESTORE", "RESTRICT", "RETURN", "REVERT", "REVOKE", "RIGHT", "ROLLBACK", "ROWCOUNT", "ROWGUIDCOL", "RULE", "SAVE", "SCHEMA", "SECURITYAUDIT", "SELECT", "SEMANTICKEYPHRASETABLE", "SEMANTICSIMILARITYDETAILSTABLE", "SEMANTICSIMILARITYTABLE", "SESSION_USER", "SET", "SETUSER", "SHUTDOWN", "SOME", "STATISTICS", "SYSTEM_USER", "TABLE", "TABLESAMPLE", "TEXTSIZE", "THEN", "TO", "TOP", "TRAN", "TRANSACTION", "TRIGGER", "TRUNCATE", "TRY_CONVERT", "TSEQUAL", "UNION", "UNIQUE", "UNPIVOT", "UPDATE", "UPDATETEXT", "USE", "USER", "VALUES", "VARYING", "VIEW", "WAITFOR", "WHEN", "WHERE", "WHILE", "WITH", "WITHIN GROUP", "WRITETEXT")); private PrintWriter writer; private ETL etl; public static void main(String[] args) {
// Path: rabbitinahat/src/main/java/org/ohdsi/rabbitInAHat/dataModel/ETL.java // public enum FileFormat { // Binary, Json, GzipJson // } // Path: rabbitinahat/src/main/java/org/ohdsi/rabbitInAHat/ETLTestFrameWorkGenerator.java import java.io.BufferedWriter; import java.io.FileNotFoundException; import java.io.IOException; import java.io.PrintWriter; import java.nio.charset.StandardCharsets; import java.nio.file.Files; import java.nio.file.Path; import java.nio.file.Paths; import java.util.*; import java.util.stream.Collectors; import org.ohdsi.rabbitInAHat.dataModel.*; import org.ohdsi.rabbitInAHat.dataModel.ETL.FileFormat; /******************************************************************************* * Copyright 2019 Observational Health Data Sciences and Informatics * * This file is part of WhiteRabbit * * Licensed 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 org.ohdsi.rabbitInAHat; // TODO: use templating to generate the R code (e.g. Jinja/Apache FreeMarker/Mustache). At least put static R code in separate (.R) files. public class ETLTestFrameWorkGenerator { private static int DEFAULT = 0; private static int NEGATE = 1; private static int COUNT = 2; private static final Set<String> keywordSet = new HashSet<>(Arrays.asList("ADD", "ALL", "ALTER", "AND", "ANY", "AS", "ASC", "AUTHORIZATION", "BACKUP", "BEGIN", "BETWEEN", "BREAK", "BROWSE", "BULK", "BY", "CASCADE", "CASE", "CHECK", "CHECKPOINT", "CLOSE", "CLUSTERED", "COALESCE", "COLLATE", "COLUMN", "COMMIT", "COMPUTE", "CONSTRAINT", "CONTAINS", "CONTAINSTABLE", "CONTINUE", "CONVERT", "CREATE", "CROSS", "CURRENT", "CURRENT_DATE", "CURRENT_TIME", "CURRENT_TIMESTAMP", "CURRENT_USER", "CURSOR", "DATABASE", "DBCC", "DEALLOCATE", "DECLARE", "DEFAULT", "DELETE", "DENY", "DESC", "DISK", "DISTINCT", "DISTRIBUTED", "DOUBLE", "DROP", "DUMP", "ELSE", "END", "ERRLVL", "ESCAPE", "EXCEPT", "EXEC", "EXECUTE", "EXISTS", "EXIT", "EXTERNAL", "FETCH", "FILE", "FILLFACTOR", "FOR", "FOREIGN", "FREETEXT", "FREETEXTTABLE", "FROM", "FULL", "FUNCTION", "GOTO", "GRANT", "GROUP", "HAVING", "HOLDLOCK", "IDENTITY", "IDENTITY_INSERT", "IDENTITYCOL", "IF", "IN", "INDEX", "INNER", "INSERT", "INTERSECT", "INTO", "IS", "JOIN", "KEY", "KILL", "LEFT", "LIKE", "LINENO", "LOAD", "MERGE", "NATIONAL", "NOCHECK", "NONCLUSTERED", "NOT", "NULL", "NULLIF", "OF", "OFF", "OFFSETS", "ON", "OPEN", "OPENDATASOURCE", "OPENQUERY", "OPENROWSET", "OPENXML", "OPTION", "OR", "ORDER", "OUTER", "OVER", "PERCENT", "PIVOT", "PLAN", "PRECISION", "PRIMARY", "PRINT", "PROC", "PROCEDURE", "PUBLIC", "RAISERROR", "READ", "READTEXT", "RECONFIGURE", "REFERENCES", "REPLICATION", "RESTORE", "RESTRICT", "RETURN", "REVERT", "REVOKE", "RIGHT", "ROLLBACK", "ROWCOUNT", "ROWGUIDCOL", "RULE", "SAVE", "SCHEMA", "SECURITYAUDIT", "SELECT", "SEMANTICKEYPHRASETABLE", "SEMANTICSIMILARITYDETAILSTABLE", "SEMANTICSIMILARITYTABLE", "SESSION_USER", "SET", "SETUSER", "SHUTDOWN", "SOME", "STATISTICS", "SYSTEM_USER", "TABLE", "TABLESAMPLE", "TEXTSIZE", "THEN", "TO", "TOP", "TRAN", "TRANSACTION", "TRIGGER", "TRUNCATE", "TRY_CONVERT", "TSEQUAL", "UNION", "UNIQUE", "UNPIVOT", "UPDATE", "UPDATETEXT", "USE", "USER", "VALUES", "VARYING", "VIEW", "WAITFOR", "WHEN", "WHERE", "WHILE", "WITH", "WITHIN GROUP", "WRITETEXT")); private PrintWriter writer; private ETL etl; public static void main(String[] args) {
ETL etl = ETL.fromFile("C:\\Home\\Research\\ETLs\\JMDC ETL\\JMDC ETL CDMv5\\JMDC to CDMv5 ETL v08.json.gz", FileFormat.GzipJson);
OHDSI/WhiteRabbit
whiterabbit/src/main/java/org/ohdsi/whiteRabbit/Console.java
// Path: rabbit-core/src/main/java/org/ohdsi/utilities/files/WriteTextFile.java // public class WriteTextFile { // // public WriteTextFile(String filename){ // FileOutputStream stream; // try { // stream = new FileOutputStream(filename); // bufferedWrite = new BufferedWriter( new OutputStreamWriter(stream, "UTF-8"),10000); // } catch (FileNotFoundException e) { // e.printStackTrace(); // } catch (UnsupportedEncodingException e) { // System.err.println("Computer does not support UTF-8 encoding"); // e.printStackTrace(); // } // } // // public void writeln(String string){ // try { // bufferedWrite.write(string); // bufferedWrite.newLine(); // } catch (IOException e) { // e.printStackTrace(); // } // } // // public void writeln(int integer){ // writeln(Integer.toString(integer)); // } // // public void writeln(Object object){ // writeln(object.toString()); // } // // public void flush(){ // try { // bufferedWrite.flush(); // } catch (IOException e) { // e.printStackTrace(); // } // } // // public void close() { // try { // bufferedWrite.close(); // } catch (IOException e) { // e.printStackTrace(); // } // } // // private BufferedWriter bufferedWrite; // }
import java.io.IOException; import java.io.OutputStream; import javax.swing.JTextArea; import javax.swing.text.BadLocationException; import org.ohdsi.utilities.files.WriteTextFile;
/******************************************************************************* * Copyright 2019 Observational Health Data Sciences and Informatics * * This file is part of WhiteRabbit * * Licensed 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 org.ohdsi.whiteRabbit; public class Console extends OutputStream { private StringBuffer buffer = new StringBuffer();
// Path: rabbit-core/src/main/java/org/ohdsi/utilities/files/WriteTextFile.java // public class WriteTextFile { // // public WriteTextFile(String filename){ // FileOutputStream stream; // try { // stream = new FileOutputStream(filename); // bufferedWrite = new BufferedWriter( new OutputStreamWriter(stream, "UTF-8"),10000); // } catch (FileNotFoundException e) { // e.printStackTrace(); // } catch (UnsupportedEncodingException e) { // System.err.println("Computer does not support UTF-8 encoding"); // e.printStackTrace(); // } // } // // public void writeln(String string){ // try { // bufferedWrite.write(string); // bufferedWrite.newLine(); // } catch (IOException e) { // e.printStackTrace(); // } // } // // public void writeln(int integer){ // writeln(Integer.toString(integer)); // } // // public void writeln(Object object){ // writeln(object.toString()); // } // // public void flush(){ // try { // bufferedWrite.flush(); // } catch (IOException e) { // e.printStackTrace(); // } // } // // public void close() { // try { // bufferedWrite.close(); // } catch (IOException e) { // e.printStackTrace(); // } // } // // private BufferedWriter bufferedWrite; // } // Path: whiterabbit/src/main/java/org/ohdsi/whiteRabbit/Console.java import java.io.IOException; import java.io.OutputStream; import javax.swing.JTextArea; import javax.swing.text.BadLocationException; import org.ohdsi.utilities.files.WriteTextFile; /******************************************************************************* * Copyright 2019 Observational Health Data Sciences and Informatics * * This file is part of WhiteRabbit * * Licensed 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 org.ohdsi.whiteRabbit; public class Console extends OutputStream { private StringBuffer buffer = new StringBuffer();
private WriteTextFile debug = null;
yuqirong/Koku
app/src/main/java/com/yuqirong/koku/fragment/BaseFragment.java
// Path: app/src/main/java/com/yuqirong/koku/application/MyApplication.java // public class MyApplication extends Application { // // private static Context context; // private static ThreadPoolExecutor executor; // private static final int CPU_COUNT = Runtime.getRuntime().availableProcessors(); // private static final int CORE_POOL_SIZE = CPU_COUNT + 1; // private static final int MAXIMUM_POOL_SIZE = CPU_COUNT * 2 + 1; // private static final int KEEP_ALIVE = 1; // private static final BlockingQueue<Runnable> sPoolWorkQueue = // new LinkedBlockingQueue<Runnable>(128); // private static final ThreadFactory sThreadFactory = new ThreadFactory() { // private final AtomicInteger mCount = new AtomicInteger(1); // // public Thread newThread(Runnable r) { // return new Thread(r, "AsyncTask #" + mCount.getAndIncrement()); // } // }; // private static RequestQueue mQueue; // // /** // * 得到volley队列 // * @return // */ // public static RequestQueue getRequestQueue() { // return mQueue; // } // // public static Context getContext() { // return context; // } // // public static ThreadPoolExecutor getExecutor() { // return executor; // } // // @Override // public void onCreate() { // super.onCreate(); // context = this; // ImageLoaderConfiguration config = new ImageLoaderConfiguration.Builder(this) // .threadPriority(Thread.NORM_PRIORITY - 1).denyCacheImageMultipleSizesInMemory() // .memoryCache(new LruMemoryCache(2 * 1024 * 1024)).memoryCacheSize(2 * 1024 * 1024) // .diskCacheFileNameGenerator(new Md5FileNameGenerator()).diskCacheSize(50 * 1024 * 1024) // .diskCacheFileCount(300).tasksProcessingOrder(QueueProcessingType.LIFO) // .build(); // ImageLoader.getInstance().init(config); // executor = new ThreadPoolExecutor(CORE_POOL_SIZE, MAXIMUM_POOL_SIZE, KEEP_ALIVE, // TimeUnit.SECONDS, sPoolWorkQueue, sThreadFactory); // mQueue = Volley.newRequestQueue(context); // } // // }
import android.content.Context; import android.os.Bundle; import android.support.v4.app.Fragment; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import com.android.volley.Request; import com.android.volley.RequestQueue; import com.android.volley.Response; import com.android.volley.toolbox.JsonObjectRequest; import com.android.volley.toolbox.StringRequest; import com.android.volley.toolbox.Volley; import com.yuqirong.koku.application.MyApplication;
package com.yuqirong.koku.fragment; /** * Created by Anyway on 2015/8/28. */ public abstract class BaseFragment extends Fragment { public Context context; protected RequestQueue mQueue; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); context = getActivity();
// Path: app/src/main/java/com/yuqirong/koku/application/MyApplication.java // public class MyApplication extends Application { // // private static Context context; // private static ThreadPoolExecutor executor; // private static final int CPU_COUNT = Runtime.getRuntime().availableProcessors(); // private static final int CORE_POOL_SIZE = CPU_COUNT + 1; // private static final int MAXIMUM_POOL_SIZE = CPU_COUNT * 2 + 1; // private static final int KEEP_ALIVE = 1; // private static final BlockingQueue<Runnable> sPoolWorkQueue = // new LinkedBlockingQueue<Runnable>(128); // private static final ThreadFactory sThreadFactory = new ThreadFactory() { // private final AtomicInteger mCount = new AtomicInteger(1); // // public Thread newThread(Runnable r) { // return new Thread(r, "AsyncTask #" + mCount.getAndIncrement()); // } // }; // private static RequestQueue mQueue; // // /** // * 得到volley队列 // * @return // */ // public static RequestQueue getRequestQueue() { // return mQueue; // } // // public static Context getContext() { // return context; // } // // public static ThreadPoolExecutor getExecutor() { // return executor; // } // // @Override // public void onCreate() { // super.onCreate(); // context = this; // ImageLoaderConfiguration config = new ImageLoaderConfiguration.Builder(this) // .threadPriority(Thread.NORM_PRIORITY - 1).denyCacheImageMultipleSizesInMemory() // .memoryCache(new LruMemoryCache(2 * 1024 * 1024)).memoryCacheSize(2 * 1024 * 1024) // .diskCacheFileNameGenerator(new Md5FileNameGenerator()).diskCacheSize(50 * 1024 * 1024) // .diskCacheFileCount(300).tasksProcessingOrder(QueueProcessingType.LIFO) // .build(); // ImageLoader.getInstance().init(config); // executor = new ThreadPoolExecutor(CORE_POOL_SIZE, MAXIMUM_POOL_SIZE, KEEP_ALIVE, // TimeUnit.SECONDS, sPoolWorkQueue, sThreadFactory); // mQueue = Volley.newRequestQueue(context); // } // // } // Path: app/src/main/java/com/yuqirong/koku/fragment/BaseFragment.java import android.content.Context; import android.os.Bundle; import android.support.v4.app.Fragment; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import com.android.volley.Request; import com.android.volley.RequestQueue; import com.android.volley.Response; import com.android.volley.toolbox.JsonObjectRequest; import com.android.volley.toolbox.StringRequest; import com.android.volley.toolbox.Volley; import com.yuqirong.koku.application.MyApplication; package com.yuqirong.koku.fragment; /** * Created by Anyway on 2015/8/28. */ public abstract class BaseFragment extends Fragment { public Context context; protected RequestQueue mQueue; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); context = getActivity();
mQueue = MyApplication.getRequestQueue();
yuqirong/Koku
app/src/main/java/com/yuqirong/koku/view/CropImageView.java
// Path: app/src/main/java/com/yuqirong/koku/util/ImageUtils.java // public class ImageUtils { // public static Bitmap getResizeBitmap(String path, int[] imageSize) { // BitmapFactory.Options options = new BitmapFactory.Options(); // options.inJustDecodeBounds = true; // only get bitmap infomation // BitmapFactory.decodeFile(path, options); // options.inSampleSize = calcSampleSize(options, imageSize); // options.inJustDecodeBounds = false; // return BitmapFactory.decodeFile(path, options); // } // // private static int calcSampleSize(BitmapFactory.Options options, int[] imageSize) { // Log.i("", options.outWidth + "," + imageSize[0] + "\n" + options.outHeight + "," + imageSize[1] + "\n------------\n"); // int inSampleSize = 1; // if (imageSize[0] < options.outWidth || imageSize[1] < options.outHeight) { // int widthRadio = Math.round(options.outWidth * 1.0f / imageSize[0]); // int heightRadio = Math.round(options.outHeight * 1.0f / imageSize[1]); // inSampleSize = Math.min(widthRadio, heightRadio); // } // return inSampleSize; // } // // // public static void getImageViewSize(ImageView imageView, int[] imageSize) { // ViewGroup.LayoutParams layoutParams = imageView.getLayoutParams(); // imageSize[0] = imageView.getWidth(); // if (imageSize[0] <= 0) { // imageSize[0] = layoutParams.width; // } // // if (imageSize[0] <= 0) { // imageSize[0] = getImageViewField(imageView, "mMaxWidth"); // } // // if (imageSize[0] <= 0) { // DisplayMetrics displayMetrics = imageView.getContext().getResources().getDisplayMetrics(); // imageSize[0] = displayMetrics.widthPixels; // } // // imageSize[1] = imageView.getHeight(); // if (imageSize[1] <= 0) { // imageSize[1] = layoutParams.height; // } // // if (imageSize[1] <= 0) { // imageSize[1] = getImageViewField(imageView, "mMaxHeight"); // } // // if (imageSize[1] <= 0) { // DisplayMetrics displayMetrics = imageView.getContext().getResources().getDisplayMetrics(); // imageSize[1] = displayMetrics.heightPixels; // } // // } // // private static int getImageViewField(Object object, String fieldName) { // int value = 0; // try { // Field field = object.getClass().getDeclaredField(fieldName); // field.setAccessible(true); // // int fieldValue = field.getInt(object); // if (fieldValue > 0 && fieldValue < Integer.MAX_VALUE) { // value = fieldValue; // } // } catch (Exception e) { // e.printStackTrace(); // } // return value; // } // // public static void setImageBitmap(ImageView imageView, String imagePath) { // //resize image and load image // int[] imageSize = new int[2]; // getImageViewSize(imageView, imageSize); // //resize bitmap // Bitmap bitmap = ImageUtils.getResizeBitmap(imagePath, imageSize); // imageView.setImageBitmap(bitmap); // } // }
import android.annotation.TargetApi; import android.content.Context; import android.graphics.Bitmap; import android.graphics.Canvas; import android.graphics.Color; import android.graphics.Matrix; import android.graphics.Paint; import android.graphics.PointF; import android.graphics.Rect; import android.os.Build; import android.util.AttributeSet; import android.util.Log; import android.view.MotionEvent; import android.view.View; import com.yuqirong.koku.util.ImageUtils;
int x1 = (int) (f[0] * 0 + f[1] * 0 + f[2]); int y1 = (int) (f[3] * 0 + f[4] * 0 + f[5]); int x2 = (int) (f[0] * mBitmap.getWidth() + f[1] * 0 + f[2]); int y2 = (int) (f[3] * mBitmap.getWidth() + f[4] * 0 + f[5]); int x3 = (int) (f[0] * 0 + f[1] * mBitmap.getHeight() + f[2]); int y3 = (int) (f[3] * 0 + f[4] * mBitmap.getHeight() + f[5]); int x4 = (int) (f[0] * mBitmap.getWidth() + f[1] * mBitmap.getHeight() + f[2]); int y4 = (int) (f[3] * mBitmap.getWidth() + f[4] * mBitmap.getHeight() + f[5]); showL("x1:" + x1 + ",y1:" + y1); showL("x2:" + x2 + ",y2:" + y2); showL("x3:" + x3 + ",y3:" + y3); showL("x4:" + x4 + ",y4:" + y4); boolean result; if (scale > 1) { //放大 result = true; } else { //缩小 result = x1 + ((centerX-x1)*1f/(x2-x2)) * ( (x2-x1) - (x2-x1)*Math.sqrt(scale)) <= -dp2px(5) && x2 - ((centerX-x1)*1f/(x2-x2)) * ( (x2-x1) - (x2-x1)*Math.sqrt(scale)) >= viewWidth + dp2px(5) ; } return result; } public void setImagePath(String imagePath) { int[] imageSize = new int[2]; imageSize[0] = viewWidth; imageSize[1] = viewHeight;
// Path: app/src/main/java/com/yuqirong/koku/util/ImageUtils.java // public class ImageUtils { // public static Bitmap getResizeBitmap(String path, int[] imageSize) { // BitmapFactory.Options options = new BitmapFactory.Options(); // options.inJustDecodeBounds = true; // only get bitmap infomation // BitmapFactory.decodeFile(path, options); // options.inSampleSize = calcSampleSize(options, imageSize); // options.inJustDecodeBounds = false; // return BitmapFactory.decodeFile(path, options); // } // // private static int calcSampleSize(BitmapFactory.Options options, int[] imageSize) { // Log.i("", options.outWidth + "," + imageSize[0] + "\n" + options.outHeight + "," + imageSize[1] + "\n------------\n"); // int inSampleSize = 1; // if (imageSize[0] < options.outWidth || imageSize[1] < options.outHeight) { // int widthRadio = Math.round(options.outWidth * 1.0f / imageSize[0]); // int heightRadio = Math.round(options.outHeight * 1.0f / imageSize[1]); // inSampleSize = Math.min(widthRadio, heightRadio); // } // return inSampleSize; // } // // // public static void getImageViewSize(ImageView imageView, int[] imageSize) { // ViewGroup.LayoutParams layoutParams = imageView.getLayoutParams(); // imageSize[0] = imageView.getWidth(); // if (imageSize[0] <= 0) { // imageSize[0] = layoutParams.width; // } // // if (imageSize[0] <= 0) { // imageSize[0] = getImageViewField(imageView, "mMaxWidth"); // } // // if (imageSize[0] <= 0) { // DisplayMetrics displayMetrics = imageView.getContext().getResources().getDisplayMetrics(); // imageSize[0] = displayMetrics.widthPixels; // } // // imageSize[1] = imageView.getHeight(); // if (imageSize[1] <= 0) { // imageSize[1] = layoutParams.height; // } // // if (imageSize[1] <= 0) { // imageSize[1] = getImageViewField(imageView, "mMaxHeight"); // } // // if (imageSize[1] <= 0) { // DisplayMetrics displayMetrics = imageView.getContext().getResources().getDisplayMetrics(); // imageSize[1] = displayMetrics.heightPixels; // } // // } // // private static int getImageViewField(Object object, String fieldName) { // int value = 0; // try { // Field field = object.getClass().getDeclaredField(fieldName); // field.setAccessible(true); // // int fieldValue = field.getInt(object); // if (fieldValue > 0 && fieldValue < Integer.MAX_VALUE) { // value = fieldValue; // } // } catch (Exception e) { // e.printStackTrace(); // } // return value; // } // // public static void setImageBitmap(ImageView imageView, String imagePath) { // //resize image and load image // int[] imageSize = new int[2]; // getImageViewSize(imageView, imageSize); // //resize bitmap // Bitmap bitmap = ImageUtils.getResizeBitmap(imagePath, imageSize); // imageView.setImageBitmap(bitmap); // } // } // Path: app/src/main/java/com/yuqirong/koku/view/CropImageView.java import android.annotation.TargetApi; import android.content.Context; import android.graphics.Bitmap; import android.graphics.Canvas; import android.graphics.Color; import android.graphics.Matrix; import android.graphics.Paint; import android.graphics.PointF; import android.graphics.Rect; import android.os.Build; import android.util.AttributeSet; import android.util.Log; import android.view.MotionEvent; import android.view.View; import com.yuqirong.koku.util.ImageUtils; int x1 = (int) (f[0] * 0 + f[1] * 0 + f[2]); int y1 = (int) (f[3] * 0 + f[4] * 0 + f[5]); int x2 = (int) (f[0] * mBitmap.getWidth() + f[1] * 0 + f[2]); int y2 = (int) (f[3] * mBitmap.getWidth() + f[4] * 0 + f[5]); int x3 = (int) (f[0] * 0 + f[1] * mBitmap.getHeight() + f[2]); int y3 = (int) (f[3] * 0 + f[4] * mBitmap.getHeight() + f[5]); int x4 = (int) (f[0] * mBitmap.getWidth() + f[1] * mBitmap.getHeight() + f[2]); int y4 = (int) (f[3] * mBitmap.getWidth() + f[4] * mBitmap.getHeight() + f[5]); showL("x1:" + x1 + ",y1:" + y1); showL("x2:" + x2 + ",y2:" + y2); showL("x3:" + x3 + ",y3:" + y3); showL("x4:" + x4 + ",y4:" + y4); boolean result; if (scale > 1) { //放大 result = true; } else { //缩小 result = x1 + ((centerX-x1)*1f/(x2-x2)) * ( (x2-x1) - (x2-x1)*Math.sqrt(scale)) <= -dp2px(5) && x2 - ((centerX-x1)*1f/(x2-x2)) * ( (x2-x1) - (x2-x1)*Math.sqrt(scale)) >= viewWidth + dp2px(5) ; } return result; } public void setImagePath(String imagePath) { int[] imageSize = new int[2]; imageSize[0] = viewWidth; imageSize[1] = viewHeight;
mBitmap = ImageUtils.getResizeBitmap(imagePath, imageSize);
supaldubey/storm
src/main/java/in/cubestack/android/lib/storm/criteria/PageableRestriction.java
// Path: src/main/java/in/cubestack/android/lib/storm/core/StormRuntimeException.java // public class StormRuntimeException extends RuntimeException { // // private static final long serialVersionUID = -563476450614494464L; // // // public StormRuntimeException(String msg) { // super(msg); // } // // // public StormRuntimeException(String msg, Exception ex) { // super(msg, ex); // } // // // } // // Path: src/main/java/in/cubestack/android/lib/storm/core/TableInformation.java // public class TableInformation { // // private Class<?> mappedClass; // private int tableVersion; // private String tableName; // private ColumnMetaData primaryKeyData; // private List<ColumnMetaData> columnMetaDataList = new LinkedList<ColumnMetaData>(); // private List<RelationMetaData> relations = new LinkedList<RelationMetaData>(); // private String alias; // private LifeCycleHandler<?> handler; // private String insertSql; // private boolean autoGenerated; // // public String getTableName() { // return tableName; // } // // public void setTableName(String tableName) { // this.tableName = tableName; // } // // // /** // * @return the columnMetaDataList // */ // public List<ColumnMetaData> getColumnMetaDataList() { // return columnMetaDataList; // } // // /** // * @param primaryKeyData // * the primaryKeyData to set // */ // public void setPrimaryKeyData(ColumnMetaData primaryKeyData) { // this.primaryKeyData = primaryKeyData; // } // // /** // * @return the primaryKeyData // */ // public ColumnMetaData getPrimaryKeyData() { // return primaryKeyData; // } // // public int getTableVersion() { // return tableVersion; // } // // public void setTableVersion(int tableVersion) { // this.tableVersion = tableVersion; // } // // @Override // public String toString() { // return "[TableInfo {name=" + tableName + "}, {primaryKey=" + primaryKeyData.getAlias() + "/" + primaryKeyData.getColumnName() + "\n " // + "Mapped class = " + getMappedClass() + "}]"; // } // // public List<RelationMetaData> getRelations() { // return relations; // } // // // public String getAlias() { // return alias; // } // // public void setAlias(String alias) { // this.alias = alias; // } // // public LifeCycleHandler<?> getHandler() { // return handler; // } // // public void setHandler(LifeCycleHandler<?> class1) { // this.handler = class1; // } // // public boolean isRelational() { // return relations != null && !relations.isEmpty(); // } // // public ColumnMetaData getColumnMetaData(String alias) { // // if (getPrimaryKeyData().getAlias().equals(alias)) { // return getPrimaryKeyData(); // } // for (ColumnMetaData columnMetaData : getColumnMetaDataList()) { // if (columnMetaData.getAlias().equals(alias)) { // return columnMetaData; // } // } // return null; // } // // public String getColumnName(String alias) { // ColumnMetaData columnMetaData = getColumnMetaData(alias); // if (columnMetaData != null) { // return columnMetaData.getColumnName(); // } // return null; // } // // public String getProperty(String columnNme) { // if (getPrimaryKeyData().getColumnName().equals(columnNme)) { // return getPrimaryKeyData().getAlias(); // } // for (ColumnMetaData columnMetaData : getColumnMetaDataList()) { // if (columnMetaData.getColumnName().equals(columnNme)) { // return columnMetaData.getAlias(); // } // } // return null; // } // // public String getInsertSql() { // return insertSql; // } // // public void setInsertSql(String insertSql) { // this.insertSql = insertSql; // } // // public boolean isAutoGenerated() { // return autoGenerated; // } // // public void setAutoGenerated(boolean autoGenerated) { // this.autoGenerated = autoGenerated; // } // // public Class<?> getMappedClass() { // return mappedClass; // } // // public void setMappedClass(Class<?> mappedClass) { // this.mappedClass = mappedClass; // } // // }
import in.cubestack.android.lib.storm.core.StormRuntimeException; import in.cubestack.android.lib.storm.core.TableInformation;
/** * */ package in.cubestack.android.lib.storm.criteria; /** * @author supal * */ public abstract class PageableRestriction implements Restriction { private static final String OFF_ST = " OFFSET "; private static final String LMT = " LIMIT "; private static final int PAGE_SIZE = 20; protected static final String SPACES = " ";
// Path: src/main/java/in/cubestack/android/lib/storm/core/StormRuntimeException.java // public class StormRuntimeException extends RuntimeException { // // private static final long serialVersionUID = -563476450614494464L; // // // public StormRuntimeException(String msg) { // super(msg); // } // // // public StormRuntimeException(String msg, Exception ex) { // super(msg, ex); // } // // // } // // Path: src/main/java/in/cubestack/android/lib/storm/core/TableInformation.java // public class TableInformation { // // private Class<?> mappedClass; // private int tableVersion; // private String tableName; // private ColumnMetaData primaryKeyData; // private List<ColumnMetaData> columnMetaDataList = new LinkedList<ColumnMetaData>(); // private List<RelationMetaData> relations = new LinkedList<RelationMetaData>(); // private String alias; // private LifeCycleHandler<?> handler; // private String insertSql; // private boolean autoGenerated; // // public String getTableName() { // return tableName; // } // // public void setTableName(String tableName) { // this.tableName = tableName; // } // // // /** // * @return the columnMetaDataList // */ // public List<ColumnMetaData> getColumnMetaDataList() { // return columnMetaDataList; // } // // /** // * @param primaryKeyData // * the primaryKeyData to set // */ // public void setPrimaryKeyData(ColumnMetaData primaryKeyData) { // this.primaryKeyData = primaryKeyData; // } // // /** // * @return the primaryKeyData // */ // public ColumnMetaData getPrimaryKeyData() { // return primaryKeyData; // } // // public int getTableVersion() { // return tableVersion; // } // // public void setTableVersion(int tableVersion) { // this.tableVersion = tableVersion; // } // // @Override // public String toString() { // return "[TableInfo {name=" + tableName + "}, {primaryKey=" + primaryKeyData.getAlias() + "/" + primaryKeyData.getColumnName() + "\n " // + "Mapped class = " + getMappedClass() + "}]"; // } // // public List<RelationMetaData> getRelations() { // return relations; // } // // // public String getAlias() { // return alias; // } // // public void setAlias(String alias) { // this.alias = alias; // } // // public LifeCycleHandler<?> getHandler() { // return handler; // } // // public void setHandler(LifeCycleHandler<?> class1) { // this.handler = class1; // } // // public boolean isRelational() { // return relations != null && !relations.isEmpty(); // } // // public ColumnMetaData getColumnMetaData(String alias) { // // if (getPrimaryKeyData().getAlias().equals(alias)) { // return getPrimaryKeyData(); // } // for (ColumnMetaData columnMetaData : getColumnMetaDataList()) { // if (columnMetaData.getAlias().equals(alias)) { // return columnMetaData; // } // } // return null; // } // // public String getColumnName(String alias) { // ColumnMetaData columnMetaData = getColumnMetaData(alias); // if (columnMetaData != null) { // return columnMetaData.getColumnName(); // } // return null; // } // // public String getProperty(String columnNme) { // if (getPrimaryKeyData().getColumnName().equals(columnNme)) { // return getPrimaryKeyData().getAlias(); // } // for (ColumnMetaData columnMetaData : getColumnMetaDataList()) { // if (columnMetaData.getColumnName().equals(columnNme)) { // return columnMetaData.getAlias(); // } // } // return null; // } // // public String getInsertSql() { // return insertSql; // } // // public void setInsertSql(String insertSql) { // this.insertSql = insertSql; // } // // public boolean isAutoGenerated() { // return autoGenerated; // } // // public void setAutoGenerated(boolean autoGenerated) { // this.autoGenerated = autoGenerated; // } // // public Class<?> getMappedClass() { // return mappedClass; // } // // public void setMappedClass(Class<?> mappedClass) { // this.mappedClass = mappedClass; // } // // } // Path: src/main/java/in/cubestack/android/lib/storm/criteria/PageableRestriction.java import in.cubestack.android.lib.storm.core.StormRuntimeException; import in.cubestack.android.lib.storm.core.TableInformation; /** * */ package in.cubestack.android.lib.storm.criteria; /** * @author supal * */ public abstract class PageableRestriction implements Restriction { private static final String OFF_ST = " OFFSET "; private static final String LMT = " LIMIT "; private static final int PAGE_SIZE = 20; protected static final String SPACES = " ";
private TableInformation tableInfo;
supaldubey/storm
src/main/java/in/cubestack/android/lib/storm/criteria/PageableRestriction.java
// Path: src/main/java/in/cubestack/android/lib/storm/core/StormRuntimeException.java // public class StormRuntimeException extends RuntimeException { // // private static final long serialVersionUID = -563476450614494464L; // // // public StormRuntimeException(String msg) { // super(msg); // } // // // public StormRuntimeException(String msg, Exception ex) { // super(msg, ex); // } // // // } // // Path: src/main/java/in/cubestack/android/lib/storm/core/TableInformation.java // public class TableInformation { // // private Class<?> mappedClass; // private int tableVersion; // private String tableName; // private ColumnMetaData primaryKeyData; // private List<ColumnMetaData> columnMetaDataList = new LinkedList<ColumnMetaData>(); // private List<RelationMetaData> relations = new LinkedList<RelationMetaData>(); // private String alias; // private LifeCycleHandler<?> handler; // private String insertSql; // private boolean autoGenerated; // // public String getTableName() { // return tableName; // } // // public void setTableName(String tableName) { // this.tableName = tableName; // } // // // /** // * @return the columnMetaDataList // */ // public List<ColumnMetaData> getColumnMetaDataList() { // return columnMetaDataList; // } // // /** // * @param primaryKeyData // * the primaryKeyData to set // */ // public void setPrimaryKeyData(ColumnMetaData primaryKeyData) { // this.primaryKeyData = primaryKeyData; // } // // /** // * @return the primaryKeyData // */ // public ColumnMetaData getPrimaryKeyData() { // return primaryKeyData; // } // // public int getTableVersion() { // return tableVersion; // } // // public void setTableVersion(int tableVersion) { // this.tableVersion = tableVersion; // } // // @Override // public String toString() { // return "[TableInfo {name=" + tableName + "}, {primaryKey=" + primaryKeyData.getAlias() + "/" + primaryKeyData.getColumnName() + "\n " // + "Mapped class = " + getMappedClass() + "}]"; // } // // public List<RelationMetaData> getRelations() { // return relations; // } // // // public String getAlias() { // return alias; // } // // public void setAlias(String alias) { // this.alias = alias; // } // // public LifeCycleHandler<?> getHandler() { // return handler; // } // // public void setHandler(LifeCycleHandler<?> class1) { // this.handler = class1; // } // // public boolean isRelational() { // return relations != null && !relations.isEmpty(); // } // // public ColumnMetaData getColumnMetaData(String alias) { // // if (getPrimaryKeyData().getAlias().equals(alias)) { // return getPrimaryKeyData(); // } // for (ColumnMetaData columnMetaData : getColumnMetaDataList()) { // if (columnMetaData.getAlias().equals(alias)) { // return columnMetaData; // } // } // return null; // } // // public String getColumnName(String alias) { // ColumnMetaData columnMetaData = getColumnMetaData(alias); // if (columnMetaData != null) { // return columnMetaData.getColumnName(); // } // return null; // } // // public String getProperty(String columnNme) { // if (getPrimaryKeyData().getColumnName().equals(columnNme)) { // return getPrimaryKeyData().getAlias(); // } // for (ColumnMetaData columnMetaData : getColumnMetaDataList()) { // if (columnMetaData.getColumnName().equals(columnNme)) { // return columnMetaData.getAlias(); // } // } // return null; // } // // public String getInsertSql() { // return insertSql; // } // // public void setInsertSql(String insertSql) { // this.insertSql = insertSql; // } // // public boolean isAutoGenerated() { // return autoGenerated; // } // // public void setAutoGenerated(boolean autoGenerated) { // this.autoGenerated = autoGenerated; // } // // public Class<?> getMappedClass() { // return mappedClass; // } // // public void setMappedClass(Class<?> mappedClass) { // this.mappedClass = mappedClass; // } // // }
import in.cubestack.android.lib.storm.core.StormRuntimeException; import in.cubestack.android.lib.storm.core.TableInformation;
/** * */ package in.cubestack.android.lib.storm.criteria; /** * @author supal * */ public abstract class PageableRestriction implements Restriction { private static final String OFF_ST = " OFFSET "; private static final String LMT = " LIMIT "; private static final int PAGE_SIZE = 20; protected static final String SPACES = " "; private TableInformation tableInfo; private int offset; private int limit; protected void validate(TableInformation tableInfo, String property) { this.setTableInfo(tableInfo); if (tableInfo.getColumnName(property) == null) {
// Path: src/main/java/in/cubestack/android/lib/storm/core/StormRuntimeException.java // public class StormRuntimeException extends RuntimeException { // // private static final long serialVersionUID = -563476450614494464L; // // // public StormRuntimeException(String msg) { // super(msg); // } // // // public StormRuntimeException(String msg, Exception ex) { // super(msg, ex); // } // // // } // // Path: src/main/java/in/cubestack/android/lib/storm/core/TableInformation.java // public class TableInformation { // // private Class<?> mappedClass; // private int tableVersion; // private String tableName; // private ColumnMetaData primaryKeyData; // private List<ColumnMetaData> columnMetaDataList = new LinkedList<ColumnMetaData>(); // private List<RelationMetaData> relations = new LinkedList<RelationMetaData>(); // private String alias; // private LifeCycleHandler<?> handler; // private String insertSql; // private boolean autoGenerated; // // public String getTableName() { // return tableName; // } // // public void setTableName(String tableName) { // this.tableName = tableName; // } // // // /** // * @return the columnMetaDataList // */ // public List<ColumnMetaData> getColumnMetaDataList() { // return columnMetaDataList; // } // // /** // * @param primaryKeyData // * the primaryKeyData to set // */ // public void setPrimaryKeyData(ColumnMetaData primaryKeyData) { // this.primaryKeyData = primaryKeyData; // } // // /** // * @return the primaryKeyData // */ // public ColumnMetaData getPrimaryKeyData() { // return primaryKeyData; // } // // public int getTableVersion() { // return tableVersion; // } // // public void setTableVersion(int tableVersion) { // this.tableVersion = tableVersion; // } // // @Override // public String toString() { // return "[TableInfo {name=" + tableName + "}, {primaryKey=" + primaryKeyData.getAlias() + "/" + primaryKeyData.getColumnName() + "\n " // + "Mapped class = " + getMappedClass() + "}]"; // } // // public List<RelationMetaData> getRelations() { // return relations; // } // // // public String getAlias() { // return alias; // } // // public void setAlias(String alias) { // this.alias = alias; // } // // public LifeCycleHandler<?> getHandler() { // return handler; // } // // public void setHandler(LifeCycleHandler<?> class1) { // this.handler = class1; // } // // public boolean isRelational() { // return relations != null && !relations.isEmpty(); // } // // public ColumnMetaData getColumnMetaData(String alias) { // // if (getPrimaryKeyData().getAlias().equals(alias)) { // return getPrimaryKeyData(); // } // for (ColumnMetaData columnMetaData : getColumnMetaDataList()) { // if (columnMetaData.getAlias().equals(alias)) { // return columnMetaData; // } // } // return null; // } // // public String getColumnName(String alias) { // ColumnMetaData columnMetaData = getColumnMetaData(alias); // if (columnMetaData != null) { // return columnMetaData.getColumnName(); // } // return null; // } // // public String getProperty(String columnNme) { // if (getPrimaryKeyData().getColumnName().equals(columnNme)) { // return getPrimaryKeyData().getAlias(); // } // for (ColumnMetaData columnMetaData : getColumnMetaDataList()) { // if (columnMetaData.getColumnName().equals(columnNme)) { // return columnMetaData.getAlias(); // } // } // return null; // } // // public String getInsertSql() { // return insertSql; // } // // public void setInsertSql(String insertSql) { // this.insertSql = insertSql; // } // // public boolean isAutoGenerated() { // return autoGenerated; // } // // public void setAutoGenerated(boolean autoGenerated) { // this.autoGenerated = autoGenerated; // } // // public Class<?> getMappedClass() { // return mappedClass; // } // // public void setMappedClass(Class<?> mappedClass) { // this.mappedClass = mappedClass; // } // // } // Path: src/main/java/in/cubestack/android/lib/storm/criteria/PageableRestriction.java import in.cubestack.android.lib.storm.core.StormRuntimeException; import in.cubestack.android.lib.storm.core.TableInformation; /** * */ package in.cubestack.android.lib.storm.criteria; /** * @author supal * */ public abstract class PageableRestriction implements Restriction { private static final String OFF_ST = " OFFSET "; private static final String LMT = " LIMIT "; private static final int PAGE_SIZE = 20; protected static final String SPACES = " "; private TableInformation tableInfo; private int offset; private int limit; protected void validate(TableInformation tableInfo, String property) { this.setTableInfo(tableInfo); if (tableInfo.getColumnName(property) == null) {
throw new StormRuntimeException(
supaldubey/storm
src/main/java/in/cubestack/android/lib/storm/annotation/Database.java
// Path: src/main/java/in/cubestack/android/lib/storm/lifecycle/BasicDatabaseUpdateHandler.java // public class BasicDatabaseUpdateHandler implements DatabaseUpdatesHandler { // // @Override // public void onCreate(SQLiteDatabase db) { // // } // // @Override // public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) { // // } // // } // // Path: src/main/java/in/cubestack/android/lib/storm/lifecycle/DatabaseUpdatesHandler.java // public interface DatabaseUpdatesHandler { // // public void onCreate(SQLiteDatabase db); // // public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion); // // }
import java.lang.annotation.ElementType; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; import in.cubestack.android.lib.storm.lifecycle.BasicDatabaseUpdateHandler; import in.cubestack.android.lib.storm.lifecycle.DatabaseUpdatesHandler;
/** * A core Android SQLite ORM framework build for speed and raw execution. * Copyright (c) 2016 CubeStack. Built for performance, scalability and ease to use. * <p/> * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * <p/> * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * <p/> * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN * NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE * USE OR OTHER DEALINGS IN THE SOFTWARE. */ package in.cubestack.android.lib.storm.annotation; /** * * This annotation defines the master Meta data for any database to be used within Storm. <br> * To declare new tables and the version to be managed by Storm, this annotation needs to be provided to the services. * * <br><br> <code> * * @Database(name="STORM_DB", tables = {Entity.class, AnotherEntity.class, version=3})<br> * public class DatabaseDeclaration {} * </code> * <br><br> * You may also choose to have more control on what happens once update or create has been run by Storm by providing implementation to <code> DatabaseUpdatesHandler.class </code> * <br> * The class DatabaseUpdatesHandler would be called after the internal update or create has been completed. <br><br> * It is critical to include all the proposed tables to the annotation to take advantage of Fail-Fast checks in case any details are missing. * * @author Supal Dubey */ @Retention(RetentionPolicy.RUNTIME) @Target(ElementType.TYPE) public @interface Database { /** * The version of the SQLIte database, this version is passed directly to SQLIteOpenerHelper and hence manages the lifecycle and udpates.<br> * In case of upgrades to your application, please change the database version for the annotation to take advantage of Auto Updates. */ int version() default 1; /** * The logical name of the database to be passed down to SQLite */ String name(); /** * The list of managed entities that are a part of this Database. * <br> All the tables defined or supposed to work should be added to this list. */ Class<?>[] tables(); /** * In case of new installation or Upgrades to the application, Storm passes a callback to the below class in case more control is needed. <br> * * <br> For instance; if you need to clean up the old data once update is performed you may implement <code>DatabaseUpdatesHandler</code> class or extend * <code>BasicDatabaseUpdateHandler</code> class and implement the <code>onUpgrade</code> method. */
// Path: src/main/java/in/cubestack/android/lib/storm/lifecycle/BasicDatabaseUpdateHandler.java // public class BasicDatabaseUpdateHandler implements DatabaseUpdatesHandler { // // @Override // public void onCreate(SQLiteDatabase db) { // // } // // @Override // public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) { // // } // // } // // Path: src/main/java/in/cubestack/android/lib/storm/lifecycle/DatabaseUpdatesHandler.java // public interface DatabaseUpdatesHandler { // // public void onCreate(SQLiteDatabase db); // // public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion); // // } // Path: src/main/java/in/cubestack/android/lib/storm/annotation/Database.java import java.lang.annotation.ElementType; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; import in.cubestack.android.lib.storm.lifecycle.BasicDatabaseUpdateHandler; import in.cubestack.android.lib.storm.lifecycle.DatabaseUpdatesHandler; /** * A core Android SQLite ORM framework build for speed and raw execution. * Copyright (c) 2016 CubeStack. Built for performance, scalability and ease to use. * <p/> * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * <p/> * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * <p/> * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN * NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE * USE OR OTHER DEALINGS IN THE SOFTWARE. */ package in.cubestack.android.lib.storm.annotation; /** * * This annotation defines the master Meta data for any database to be used within Storm. <br> * To declare new tables and the version to be managed by Storm, this annotation needs to be provided to the services. * * <br><br> <code> * * @Database(name="STORM_DB", tables = {Entity.class, AnotherEntity.class, version=3})<br> * public class DatabaseDeclaration {} * </code> * <br><br> * You may also choose to have more control on what happens once update or create has been run by Storm by providing implementation to <code> DatabaseUpdatesHandler.class </code> * <br> * The class DatabaseUpdatesHandler would be called after the internal update or create has been completed. <br><br> * It is critical to include all the proposed tables to the annotation to take advantage of Fail-Fast checks in case any details are missing. * * @author Supal Dubey */ @Retention(RetentionPolicy.RUNTIME) @Target(ElementType.TYPE) public @interface Database { /** * The version of the SQLIte database, this version is passed directly to SQLIteOpenerHelper and hence manages the lifecycle and udpates.<br> * In case of upgrades to your application, please change the database version for the annotation to take advantage of Auto Updates. */ int version() default 1; /** * The logical name of the database to be passed down to SQLite */ String name(); /** * The list of managed entities that are a part of this Database. * <br> All the tables defined or supposed to work should be added to this list. */ Class<?>[] tables(); /** * In case of new installation or Upgrades to the application, Storm passes a callback to the below class in case more control is needed. <br> * * <br> For instance; if you need to clean up the old data once update is performed you may implement <code>DatabaseUpdatesHandler</code> class or extend * <code>BasicDatabaseUpdateHandler</code> class and implement the <code>onUpgrade</code> method. */
Class<? extends DatabaseUpdatesHandler> handler() default BasicDatabaseUpdateHandler.class;
supaldubey/storm
src/main/java/in/cubestack/android/lib/storm/annotation/Database.java
// Path: src/main/java/in/cubestack/android/lib/storm/lifecycle/BasicDatabaseUpdateHandler.java // public class BasicDatabaseUpdateHandler implements DatabaseUpdatesHandler { // // @Override // public void onCreate(SQLiteDatabase db) { // // } // // @Override // public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) { // // } // // } // // Path: src/main/java/in/cubestack/android/lib/storm/lifecycle/DatabaseUpdatesHandler.java // public interface DatabaseUpdatesHandler { // // public void onCreate(SQLiteDatabase db); // // public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion); // // }
import java.lang.annotation.ElementType; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; import in.cubestack.android.lib.storm.lifecycle.BasicDatabaseUpdateHandler; import in.cubestack.android.lib.storm.lifecycle.DatabaseUpdatesHandler;
/** * A core Android SQLite ORM framework build for speed and raw execution. * Copyright (c) 2016 CubeStack. Built for performance, scalability and ease to use. * <p/> * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * <p/> * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * <p/> * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN * NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE * USE OR OTHER DEALINGS IN THE SOFTWARE. */ package in.cubestack.android.lib.storm.annotation; /** * * This annotation defines the master Meta data for any database to be used within Storm. <br> * To declare new tables and the version to be managed by Storm, this annotation needs to be provided to the services. * * <br><br> <code> * * @Database(name="STORM_DB", tables = {Entity.class, AnotherEntity.class, version=3})<br> * public class DatabaseDeclaration {} * </code> * <br><br> * You may also choose to have more control on what happens once update or create has been run by Storm by providing implementation to <code> DatabaseUpdatesHandler.class </code> * <br> * The class DatabaseUpdatesHandler would be called after the internal update or create has been completed. <br><br> * It is critical to include all the proposed tables to the annotation to take advantage of Fail-Fast checks in case any details are missing. * * @author Supal Dubey */ @Retention(RetentionPolicy.RUNTIME) @Target(ElementType.TYPE) public @interface Database { /** * The version of the SQLIte database, this version is passed directly to SQLIteOpenerHelper and hence manages the lifecycle and udpates.<br> * In case of upgrades to your application, please change the database version for the annotation to take advantage of Auto Updates. */ int version() default 1; /** * The logical name of the database to be passed down to SQLite */ String name(); /** * The list of managed entities that are a part of this Database. * <br> All the tables defined or supposed to work should be added to this list. */ Class<?>[] tables(); /** * In case of new installation or Upgrades to the application, Storm passes a callback to the below class in case more control is needed. <br> * * <br> For instance; if you need to clean up the old data once update is performed you may implement <code>DatabaseUpdatesHandler</code> class or extend * <code>BasicDatabaseUpdateHandler</code> class and implement the <code>onUpgrade</code> method. */
// Path: src/main/java/in/cubestack/android/lib/storm/lifecycle/BasicDatabaseUpdateHandler.java // public class BasicDatabaseUpdateHandler implements DatabaseUpdatesHandler { // // @Override // public void onCreate(SQLiteDatabase db) { // // } // // @Override // public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) { // // } // // } // // Path: src/main/java/in/cubestack/android/lib/storm/lifecycle/DatabaseUpdatesHandler.java // public interface DatabaseUpdatesHandler { // // public void onCreate(SQLiteDatabase db); // // public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion); // // } // Path: src/main/java/in/cubestack/android/lib/storm/annotation/Database.java import java.lang.annotation.ElementType; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; import in.cubestack.android.lib.storm.lifecycle.BasicDatabaseUpdateHandler; import in.cubestack.android.lib.storm.lifecycle.DatabaseUpdatesHandler; /** * A core Android SQLite ORM framework build for speed and raw execution. * Copyright (c) 2016 CubeStack. Built for performance, scalability and ease to use. * <p/> * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * <p/> * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * <p/> * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN * NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE * USE OR OTHER DEALINGS IN THE SOFTWARE. */ package in.cubestack.android.lib.storm.annotation; /** * * This annotation defines the master Meta data for any database to be used within Storm. <br> * To declare new tables and the version to be managed by Storm, this annotation needs to be provided to the services. * * <br><br> <code> * * @Database(name="STORM_DB", tables = {Entity.class, AnotherEntity.class, version=3})<br> * public class DatabaseDeclaration {} * </code> * <br><br> * You may also choose to have more control on what happens once update or create has been run by Storm by providing implementation to <code> DatabaseUpdatesHandler.class </code> * <br> * The class DatabaseUpdatesHandler would be called after the internal update or create has been completed. <br><br> * It is critical to include all the proposed tables to the annotation to take advantage of Fail-Fast checks in case any details are missing. * * @author Supal Dubey */ @Retention(RetentionPolicy.RUNTIME) @Target(ElementType.TYPE) public @interface Database { /** * The version of the SQLIte database, this version is passed directly to SQLIteOpenerHelper and hence manages the lifecycle and udpates.<br> * In case of upgrades to your application, please change the database version for the annotation to take advantage of Auto Updates. */ int version() default 1; /** * The logical name of the database to be passed down to SQLite */ String name(); /** * The list of managed entities that are a part of this Database. * <br> All the tables defined or supposed to work should be added to this list. */ Class<?>[] tables(); /** * In case of new installation or Upgrades to the application, Storm passes a callback to the below class in case more control is needed. <br> * * <br> For instance; if you need to clean up the old data once update is performed you may implement <code>DatabaseUpdatesHandler</code> class or extend * <code>BasicDatabaseUpdateHandler</code> class and implement the <code>onUpgrade</code> method. */
Class<? extends DatabaseUpdatesHandler> handler() default BasicDatabaseUpdateHandler.class;
supaldubey/storm
src/test/java/in/cubestack/android/lib/storm/AllTests.java
// Path: src/test/java/in/cubestack/android/lib/storm/core/AllCoreTests.java // @RunWith(Suite.class) // @SuiteClasses({ // AliasGeneratorTest.class, // MetaReaderTest.class, // QueryGeneratorTest.class // }) // public class AllCoreTests { // // } // // Path: src/test/java/in/cubestack/android/lib/storm/criteria/AllCriteriaTests.java // @RunWith(Suite.class) // @SuiteClasses({ // LikeRestrictionTest.class, // NullRestrictionTest.class, // SQLFunctionsTest.class, // StormRestrictionTest.class, // ProjectionTest.class, // MultiCriteriaTests.class // }) // public class AllCriteriaTests { // // } // // Path: src/test/java/in/cubestack/android/lib/storm/service/AllServiceTests.java // @RunWith(Suite.class) // @SuiteClasses({ // TableGeneratorTest.class, // BaseServiceTest.class, // StormDBWrapperTest.class // }) // public class AllServiceTests { // // }
import org.junit.runner.RunWith; import org.junit.runners.Suite; import org.junit.runners.Suite.SuiteClasses; import in.cubestack.android.lib.storm.core.AllCoreTests; import in.cubestack.android.lib.storm.criteria.AllCriteriaTests; import in.cubestack.android.lib.storm.service.AllServiceTests;
/** * */ package in.cubestack.android.lib.storm; /** * A core Android SQLite ORM framework build for speed and raw execution. * Copyright (c) 2011 Supal Dubey, supal.dubey@gmail.com * <p/> * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * <p/> * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * <p/> * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ @RunWith(Suite.class) @SuiteClasses({
// Path: src/test/java/in/cubestack/android/lib/storm/core/AllCoreTests.java // @RunWith(Suite.class) // @SuiteClasses({ // AliasGeneratorTest.class, // MetaReaderTest.class, // QueryGeneratorTest.class // }) // public class AllCoreTests { // // } // // Path: src/test/java/in/cubestack/android/lib/storm/criteria/AllCriteriaTests.java // @RunWith(Suite.class) // @SuiteClasses({ // LikeRestrictionTest.class, // NullRestrictionTest.class, // SQLFunctionsTest.class, // StormRestrictionTest.class, // ProjectionTest.class, // MultiCriteriaTests.class // }) // public class AllCriteriaTests { // // } // // Path: src/test/java/in/cubestack/android/lib/storm/service/AllServiceTests.java // @RunWith(Suite.class) // @SuiteClasses({ // TableGeneratorTest.class, // BaseServiceTest.class, // StormDBWrapperTest.class // }) // public class AllServiceTests { // // } // Path: src/test/java/in/cubestack/android/lib/storm/AllTests.java import org.junit.runner.RunWith; import org.junit.runners.Suite; import org.junit.runners.Suite.SuiteClasses; import in.cubestack.android.lib.storm.core.AllCoreTests; import in.cubestack.android.lib.storm.criteria.AllCriteriaTests; import in.cubestack.android.lib.storm.service.AllServiceTests; /** * */ package in.cubestack.android.lib.storm; /** * A core Android SQLite ORM framework build for speed and raw execution. * Copyright (c) 2011 Supal Dubey, supal.dubey@gmail.com * <p/> * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * <p/> * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * <p/> * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ @RunWith(Suite.class) @SuiteClasses({
AllCoreTests.class,
supaldubey/storm
src/test/java/in/cubestack/android/lib/storm/AllTests.java
// Path: src/test/java/in/cubestack/android/lib/storm/core/AllCoreTests.java // @RunWith(Suite.class) // @SuiteClasses({ // AliasGeneratorTest.class, // MetaReaderTest.class, // QueryGeneratorTest.class // }) // public class AllCoreTests { // // } // // Path: src/test/java/in/cubestack/android/lib/storm/criteria/AllCriteriaTests.java // @RunWith(Suite.class) // @SuiteClasses({ // LikeRestrictionTest.class, // NullRestrictionTest.class, // SQLFunctionsTest.class, // StormRestrictionTest.class, // ProjectionTest.class, // MultiCriteriaTests.class // }) // public class AllCriteriaTests { // // } // // Path: src/test/java/in/cubestack/android/lib/storm/service/AllServiceTests.java // @RunWith(Suite.class) // @SuiteClasses({ // TableGeneratorTest.class, // BaseServiceTest.class, // StormDBWrapperTest.class // }) // public class AllServiceTests { // // }
import org.junit.runner.RunWith; import org.junit.runners.Suite; import org.junit.runners.Suite.SuiteClasses; import in.cubestack.android.lib.storm.core.AllCoreTests; import in.cubestack.android.lib.storm.criteria.AllCriteriaTests; import in.cubestack.android.lib.storm.service.AllServiceTests;
/** * */ package in.cubestack.android.lib.storm; /** * A core Android SQLite ORM framework build for speed and raw execution. * Copyright (c) 2011 Supal Dubey, supal.dubey@gmail.com * <p/> * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * <p/> * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * <p/> * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ @RunWith(Suite.class) @SuiteClasses({ AllCoreTests.class,
// Path: src/test/java/in/cubestack/android/lib/storm/core/AllCoreTests.java // @RunWith(Suite.class) // @SuiteClasses({ // AliasGeneratorTest.class, // MetaReaderTest.class, // QueryGeneratorTest.class // }) // public class AllCoreTests { // // } // // Path: src/test/java/in/cubestack/android/lib/storm/criteria/AllCriteriaTests.java // @RunWith(Suite.class) // @SuiteClasses({ // LikeRestrictionTest.class, // NullRestrictionTest.class, // SQLFunctionsTest.class, // StormRestrictionTest.class, // ProjectionTest.class, // MultiCriteriaTests.class // }) // public class AllCriteriaTests { // // } // // Path: src/test/java/in/cubestack/android/lib/storm/service/AllServiceTests.java // @RunWith(Suite.class) // @SuiteClasses({ // TableGeneratorTest.class, // BaseServiceTest.class, // StormDBWrapperTest.class // }) // public class AllServiceTests { // // } // Path: src/test/java/in/cubestack/android/lib/storm/AllTests.java import org.junit.runner.RunWith; import org.junit.runners.Suite; import org.junit.runners.Suite.SuiteClasses; import in.cubestack.android.lib.storm.core.AllCoreTests; import in.cubestack.android.lib.storm.criteria.AllCriteriaTests; import in.cubestack.android.lib.storm.service.AllServiceTests; /** * */ package in.cubestack.android.lib.storm; /** * A core Android SQLite ORM framework build for speed and raw execution. * Copyright (c) 2011 Supal Dubey, supal.dubey@gmail.com * <p/> * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * <p/> * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * <p/> * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ @RunWith(Suite.class) @SuiteClasses({ AllCoreTests.class,
AllCriteriaTests.class,
supaldubey/storm
src/test/java/in/cubestack/android/lib/storm/AllTests.java
// Path: src/test/java/in/cubestack/android/lib/storm/core/AllCoreTests.java // @RunWith(Suite.class) // @SuiteClasses({ // AliasGeneratorTest.class, // MetaReaderTest.class, // QueryGeneratorTest.class // }) // public class AllCoreTests { // // } // // Path: src/test/java/in/cubestack/android/lib/storm/criteria/AllCriteriaTests.java // @RunWith(Suite.class) // @SuiteClasses({ // LikeRestrictionTest.class, // NullRestrictionTest.class, // SQLFunctionsTest.class, // StormRestrictionTest.class, // ProjectionTest.class, // MultiCriteriaTests.class // }) // public class AllCriteriaTests { // // } // // Path: src/test/java/in/cubestack/android/lib/storm/service/AllServiceTests.java // @RunWith(Suite.class) // @SuiteClasses({ // TableGeneratorTest.class, // BaseServiceTest.class, // StormDBWrapperTest.class // }) // public class AllServiceTests { // // }
import org.junit.runner.RunWith; import org.junit.runners.Suite; import org.junit.runners.Suite.SuiteClasses; import in.cubestack.android.lib.storm.core.AllCoreTests; import in.cubestack.android.lib.storm.criteria.AllCriteriaTests; import in.cubestack.android.lib.storm.service.AllServiceTests;
/** * */ package in.cubestack.android.lib.storm; /** * A core Android SQLite ORM framework build for speed and raw execution. * Copyright (c) 2011 Supal Dubey, supal.dubey@gmail.com * <p/> * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * <p/> * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * <p/> * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ @RunWith(Suite.class) @SuiteClasses({ AllCoreTests.class, AllCriteriaTests.class,
// Path: src/test/java/in/cubestack/android/lib/storm/core/AllCoreTests.java // @RunWith(Suite.class) // @SuiteClasses({ // AliasGeneratorTest.class, // MetaReaderTest.class, // QueryGeneratorTest.class // }) // public class AllCoreTests { // // } // // Path: src/test/java/in/cubestack/android/lib/storm/criteria/AllCriteriaTests.java // @RunWith(Suite.class) // @SuiteClasses({ // LikeRestrictionTest.class, // NullRestrictionTest.class, // SQLFunctionsTest.class, // StormRestrictionTest.class, // ProjectionTest.class, // MultiCriteriaTests.class // }) // public class AllCriteriaTests { // // } // // Path: src/test/java/in/cubestack/android/lib/storm/service/AllServiceTests.java // @RunWith(Suite.class) // @SuiteClasses({ // TableGeneratorTest.class, // BaseServiceTest.class, // StormDBWrapperTest.class // }) // public class AllServiceTests { // // } // Path: src/test/java/in/cubestack/android/lib/storm/AllTests.java import org.junit.runner.RunWith; import org.junit.runners.Suite; import org.junit.runners.Suite.SuiteClasses; import in.cubestack.android.lib.storm.core.AllCoreTests; import in.cubestack.android.lib.storm.criteria.AllCriteriaTests; import in.cubestack.android.lib.storm.service.AllServiceTests; /** * */ package in.cubestack.android.lib.storm; /** * A core Android SQLite ORM framework build for speed and raw execution. * Copyright (c) 2011 Supal Dubey, supal.dubey@gmail.com * <p/> * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * <p/> * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * <p/> * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ @RunWith(Suite.class) @SuiteClasses({ AllCoreTests.class, AllCriteriaTests.class,
AllServiceTests.class
supaldubey/storm
src/main/java/in/cubestack/android/lib/storm/core/QueryGenerator.java
// Path: src/main/java/in/cubestack/android/lib/storm/FetchType.java // public enum FetchType { // // EAGER, LAZY; // } // // Path: src/main/java/in/cubestack/android/lib/storm/SortOrder.java // public enum SortOrder { // ASC, // DESC // } // // Path: src/main/java/in/cubestack/android/lib/storm/criteria/Order.java // public class Order { // // private SortOrder sortOrder; // private String orderSql; // private TableInformation information; // private QueryGenerator queryGenerator = new QueryGenerator(); // // public Order(SortOrder order, TableInformation information) { // this.sortOrder = order; // this.information = information; // } // // public static <T> Order orderFor(Class<T> entity, String[] props, SortOrder sortOrder) { // try { // TableInformation information = EntityMetaDataCache.getMetaData(entity); // Order order = new Order(sortOrder, information); // validate(props, information); // order.addProperty(props); // return order; // } catch (Exception e) { // throw new StormRuntimeException("Invalid entity, please check your mapppings for " + entity, e); // } // } // // private static void validate(String[] props, TableInformation tabInformation) { // for(String prop: props) { // ColumnMetaData columnInfo = tabInformation.getColumnMetaData(prop); // if(columnInfo == null) { // throw new StormRuntimeException("Could not find column mapped to alias " + prop +". Pl check your mapppings for " + tabInformation.getMappedClass()); // } // } // } // // public void addProperty(String[] props) { // orderSql = queryGenerator.orderBy(props, information, sortOrder); // } // // public String orderSql() { // return orderSql; // } // // } // // Path: src/main/java/in/cubestack/android/lib/storm/criteria/Projection.java // public interface Projection { // // Projection add(String property); // // Projection sum(String property); // // Projection count(String property); // // Projection max(String property); // // Projection min(String property); // // Projection average(String property); // // Projection total(String property); // // List<SQLFunction> getAggregateFunctions() ; // List<String> getColumns(); // } // // Path: src/main/java/in/cubestack/android/lib/storm/criteria/Restriction.java // public interface Restriction { // // public String toSqlString(); // // boolean valueStored(); // // String[] values(); // // Restriction page(int page); // // Restriction limit(int offset, int limit); // // public Object sqlString(Order order); // // public TableInformation getTableInformation(); // } // // Path: src/main/java/in/cubestack/android/lib/storm/criteria/SQLFunction.java // public interface SQLFunction { // // public String toSqlString(); // }
import in.cubestack.android.lib.storm.FetchType; import in.cubestack.android.lib.storm.SortOrder; import in.cubestack.android.lib.storm.criteria.Order; import in.cubestack.android.lib.storm.criteria.Projection; import in.cubestack.android.lib.storm.criteria.Restriction; import in.cubestack.android.lib.storm.criteria.SQLFunction;
/** * */ package in.cubestack.android.lib.storm.core; /** * A core Android SQLite ORM framework build for speed and raw execution. * Copyright (c) 2014 CubeStack. Version built for Flash Back.. * <p/> * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * <p/> * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * <p/> * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ public class QueryGenerator { private static final String DELETE = "DELETE "; private static final String ORDER_BY = " ORDER BY "; private static final String INSERT_INTO = "INSERT INTO "; private static final String GROUP_BY = " GROUP BY "; private static final String WHERE = " WHERE "; private static final String EQUALS = " = "; private static final String ON = " ON "; private static final String LEFT_JOIN = " LEFT OUTER JOIN "; private static final String FROM = " FROM "; private static final String SELECT_INIT = "SELECT "; private static final char DOT = '.'; private static final char COMMA = ','; private static final char SPACE = ' '; private static final char OPEN_BRACES = '('; private static final char CLOSE_BRACES = ')'; private static final String VALUES = " VALUES ( "; private static final char QUESTION_MARK = '?';
// Path: src/main/java/in/cubestack/android/lib/storm/FetchType.java // public enum FetchType { // // EAGER, LAZY; // } // // Path: src/main/java/in/cubestack/android/lib/storm/SortOrder.java // public enum SortOrder { // ASC, // DESC // } // // Path: src/main/java/in/cubestack/android/lib/storm/criteria/Order.java // public class Order { // // private SortOrder sortOrder; // private String orderSql; // private TableInformation information; // private QueryGenerator queryGenerator = new QueryGenerator(); // // public Order(SortOrder order, TableInformation information) { // this.sortOrder = order; // this.information = information; // } // // public static <T> Order orderFor(Class<T> entity, String[] props, SortOrder sortOrder) { // try { // TableInformation information = EntityMetaDataCache.getMetaData(entity); // Order order = new Order(sortOrder, information); // validate(props, information); // order.addProperty(props); // return order; // } catch (Exception e) { // throw new StormRuntimeException("Invalid entity, please check your mapppings for " + entity, e); // } // } // // private static void validate(String[] props, TableInformation tabInformation) { // for(String prop: props) { // ColumnMetaData columnInfo = tabInformation.getColumnMetaData(prop); // if(columnInfo == null) { // throw new StormRuntimeException("Could not find column mapped to alias " + prop +". Pl check your mapppings for " + tabInformation.getMappedClass()); // } // } // } // // public void addProperty(String[] props) { // orderSql = queryGenerator.orderBy(props, information, sortOrder); // } // // public String orderSql() { // return orderSql; // } // // } // // Path: src/main/java/in/cubestack/android/lib/storm/criteria/Projection.java // public interface Projection { // // Projection add(String property); // // Projection sum(String property); // // Projection count(String property); // // Projection max(String property); // // Projection min(String property); // // Projection average(String property); // // Projection total(String property); // // List<SQLFunction> getAggregateFunctions() ; // List<String> getColumns(); // } // // Path: src/main/java/in/cubestack/android/lib/storm/criteria/Restriction.java // public interface Restriction { // // public String toSqlString(); // // boolean valueStored(); // // String[] values(); // // Restriction page(int page); // // Restriction limit(int offset, int limit); // // public Object sqlString(Order order); // // public TableInformation getTableInformation(); // } // // Path: src/main/java/in/cubestack/android/lib/storm/criteria/SQLFunction.java // public interface SQLFunction { // // public String toSqlString(); // } // Path: src/main/java/in/cubestack/android/lib/storm/core/QueryGenerator.java import in.cubestack.android.lib.storm.FetchType; import in.cubestack.android.lib.storm.SortOrder; import in.cubestack.android.lib.storm.criteria.Order; import in.cubestack.android.lib.storm.criteria.Projection; import in.cubestack.android.lib.storm.criteria.Restriction; import in.cubestack.android.lib.storm.criteria.SQLFunction; /** * */ package in.cubestack.android.lib.storm.core; /** * A core Android SQLite ORM framework build for speed and raw execution. * Copyright (c) 2014 CubeStack. Version built for Flash Back.. * <p/> * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * <p/> * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * <p/> * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ public class QueryGenerator { private static final String DELETE = "DELETE "; private static final String ORDER_BY = " ORDER BY "; private static final String INSERT_INTO = "INSERT INTO "; private static final String GROUP_BY = " GROUP BY "; private static final String WHERE = " WHERE "; private static final String EQUALS = " = "; private static final String ON = " ON "; private static final String LEFT_JOIN = " LEFT OUTER JOIN "; private static final String FROM = " FROM "; private static final String SELECT_INIT = "SELECT "; private static final char DOT = '.'; private static final char COMMA = ','; private static final char SPACE = ' '; private static final char OPEN_BRACES = '('; private static final char CLOSE_BRACES = ')'; private static final String VALUES = " VALUES ( "; private static final char QUESTION_MARK = '?';
public String rawQuery(Class<?> entityClass, Restriction restriction, Projection projection) throws IllegalArgumentException, IllegalAccessException, InstantiationException, StormException {
supaldubey/storm
src/main/java/in/cubestack/android/lib/storm/core/QueryGenerator.java
// Path: src/main/java/in/cubestack/android/lib/storm/FetchType.java // public enum FetchType { // // EAGER, LAZY; // } // // Path: src/main/java/in/cubestack/android/lib/storm/SortOrder.java // public enum SortOrder { // ASC, // DESC // } // // Path: src/main/java/in/cubestack/android/lib/storm/criteria/Order.java // public class Order { // // private SortOrder sortOrder; // private String orderSql; // private TableInformation information; // private QueryGenerator queryGenerator = new QueryGenerator(); // // public Order(SortOrder order, TableInformation information) { // this.sortOrder = order; // this.information = information; // } // // public static <T> Order orderFor(Class<T> entity, String[] props, SortOrder sortOrder) { // try { // TableInformation information = EntityMetaDataCache.getMetaData(entity); // Order order = new Order(sortOrder, information); // validate(props, information); // order.addProperty(props); // return order; // } catch (Exception e) { // throw new StormRuntimeException("Invalid entity, please check your mapppings for " + entity, e); // } // } // // private static void validate(String[] props, TableInformation tabInformation) { // for(String prop: props) { // ColumnMetaData columnInfo = tabInformation.getColumnMetaData(prop); // if(columnInfo == null) { // throw new StormRuntimeException("Could not find column mapped to alias " + prop +". Pl check your mapppings for " + tabInformation.getMappedClass()); // } // } // } // // public void addProperty(String[] props) { // orderSql = queryGenerator.orderBy(props, information, sortOrder); // } // // public String orderSql() { // return orderSql; // } // // } // // Path: src/main/java/in/cubestack/android/lib/storm/criteria/Projection.java // public interface Projection { // // Projection add(String property); // // Projection sum(String property); // // Projection count(String property); // // Projection max(String property); // // Projection min(String property); // // Projection average(String property); // // Projection total(String property); // // List<SQLFunction> getAggregateFunctions() ; // List<String> getColumns(); // } // // Path: src/main/java/in/cubestack/android/lib/storm/criteria/Restriction.java // public interface Restriction { // // public String toSqlString(); // // boolean valueStored(); // // String[] values(); // // Restriction page(int page); // // Restriction limit(int offset, int limit); // // public Object sqlString(Order order); // // public TableInformation getTableInformation(); // } // // Path: src/main/java/in/cubestack/android/lib/storm/criteria/SQLFunction.java // public interface SQLFunction { // // public String toSqlString(); // }
import in.cubestack.android.lib.storm.FetchType; import in.cubestack.android.lib.storm.SortOrder; import in.cubestack.android.lib.storm.criteria.Order; import in.cubestack.android.lib.storm.criteria.Projection; import in.cubestack.android.lib.storm.criteria.Restriction; import in.cubestack.android.lib.storm.criteria.SQLFunction;
/** * */ package in.cubestack.android.lib.storm.core; /** * A core Android SQLite ORM framework build for speed and raw execution. * Copyright (c) 2014 CubeStack. Version built for Flash Back.. * <p/> * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * <p/> * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * <p/> * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ public class QueryGenerator { private static final String DELETE = "DELETE "; private static final String ORDER_BY = " ORDER BY "; private static final String INSERT_INTO = "INSERT INTO "; private static final String GROUP_BY = " GROUP BY "; private static final String WHERE = " WHERE "; private static final String EQUALS = " = "; private static final String ON = " ON "; private static final String LEFT_JOIN = " LEFT OUTER JOIN "; private static final String FROM = " FROM "; private static final String SELECT_INIT = "SELECT "; private static final char DOT = '.'; private static final char COMMA = ','; private static final char SPACE = ' '; private static final char OPEN_BRACES = '('; private static final char CLOSE_BRACES = ')'; private static final String VALUES = " VALUES ( "; private static final char QUESTION_MARK = '?';
// Path: src/main/java/in/cubestack/android/lib/storm/FetchType.java // public enum FetchType { // // EAGER, LAZY; // } // // Path: src/main/java/in/cubestack/android/lib/storm/SortOrder.java // public enum SortOrder { // ASC, // DESC // } // // Path: src/main/java/in/cubestack/android/lib/storm/criteria/Order.java // public class Order { // // private SortOrder sortOrder; // private String orderSql; // private TableInformation information; // private QueryGenerator queryGenerator = new QueryGenerator(); // // public Order(SortOrder order, TableInformation information) { // this.sortOrder = order; // this.information = information; // } // // public static <T> Order orderFor(Class<T> entity, String[] props, SortOrder sortOrder) { // try { // TableInformation information = EntityMetaDataCache.getMetaData(entity); // Order order = new Order(sortOrder, information); // validate(props, information); // order.addProperty(props); // return order; // } catch (Exception e) { // throw new StormRuntimeException("Invalid entity, please check your mapppings for " + entity, e); // } // } // // private static void validate(String[] props, TableInformation tabInformation) { // for(String prop: props) { // ColumnMetaData columnInfo = tabInformation.getColumnMetaData(prop); // if(columnInfo == null) { // throw new StormRuntimeException("Could not find column mapped to alias " + prop +". Pl check your mapppings for " + tabInformation.getMappedClass()); // } // } // } // // public void addProperty(String[] props) { // orderSql = queryGenerator.orderBy(props, information, sortOrder); // } // // public String orderSql() { // return orderSql; // } // // } // // Path: src/main/java/in/cubestack/android/lib/storm/criteria/Projection.java // public interface Projection { // // Projection add(String property); // // Projection sum(String property); // // Projection count(String property); // // Projection max(String property); // // Projection min(String property); // // Projection average(String property); // // Projection total(String property); // // List<SQLFunction> getAggregateFunctions() ; // List<String> getColumns(); // } // // Path: src/main/java/in/cubestack/android/lib/storm/criteria/Restriction.java // public interface Restriction { // // public String toSqlString(); // // boolean valueStored(); // // String[] values(); // // Restriction page(int page); // // Restriction limit(int offset, int limit); // // public Object sqlString(Order order); // // public TableInformation getTableInformation(); // } // // Path: src/main/java/in/cubestack/android/lib/storm/criteria/SQLFunction.java // public interface SQLFunction { // // public String toSqlString(); // } // Path: src/main/java/in/cubestack/android/lib/storm/core/QueryGenerator.java import in.cubestack.android.lib.storm.FetchType; import in.cubestack.android.lib.storm.SortOrder; import in.cubestack.android.lib.storm.criteria.Order; import in.cubestack.android.lib.storm.criteria.Projection; import in.cubestack.android.lib.storm.criteria.Restriction; import in.cubestack.android.lib.storm.criteria.SQLFunction; /** * */ package in.cubestack.android.lib.storm.core; /** * A core Android SQLite ORM framework build for speed and raw execution. * Copyright (c) 2014 CubeStack. Version built for Flash Back.. * <p/> * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * <p/> * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * <p/> * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ public class QueryGenerator { private static final String DELETE = "DELETE "; private static final String ORDER_BY = " ORDER BY "; private static final String INSERT_INTO = "INSERT INTO "; private static final String GROUP_BY = " GROUP BY "; private static final String WHERE = " WHERE "; private static final String EQUALS = " = "; private static final String ON = " ON "; private static final String LEFT_JOIN = " LEFT OUTER JOIN "; private static final String FROM = " FROM "; private static final String SELECT_INIT = "SELECT "; private static final char DOT = '.'; private static final char COMMA = ','; private static final char SPACE = ' '; private static final char OPEN_BRACES = '('; private static final char CLOSE_BRACES = ')'; private static final String VALUES = " VALUES ( "; private static final char QUESTION_MARK = '?';
public String rawQuery(Class<?> entityClass, Restriction restriction, Projection projection) throws IllegalArgumentException, IllegalAccessException, InstantiationException, StormException {
supaldubey/storm
src/main/java/in/cubestack/android/lib/storm/core/QueryGenerator.java
// Path: src/main/java/in/cubestack/android/lib/storm/FetchType.java // public enum FetchType { // // EAGER, LAZY; // } // // Path: src/main/java/in/cubestack/android/lib/storm/SortOrder.java // public enum SortOrder { // ASC, // DESC // } // // Path: src/main/java/in/cubestack/android/lib/storm/criteria/Order.java // public class Order { // // private SortOrder sortOrder; // private String orderSql; // private TableInformation information; // private QueryGenerator queryGenerator = new QueryGenerator(); // // public Order(SortOrder order, TableInformation information) { // this.sortOrder = order; // this.information = information; // } // // public static <T> Order orderFor(Class<T> entity, String[] props, SortOrder sortOrder) { // try { // TableInformation information = EntityMetaDataCache.getMetaData(entity); // Order order = new Order(sortOrder, information); // validate(props, information); // order.addProperty(props); // return order; // } catch (Exception e) { // throw new StormRuntimeException("Invalid entity, please check your mapppings for " + entity, e); // } // } // // private static void validate(String[] props, TableInformation tabInformation) { // for(String prop: props) { // ColumnMetaData columnInfo = tabInformation.getColumnMetaData(prop); // if(columnInfo == null) { // throw new StormRuntimeException("Could not find column mapped to alias " + prop +". Pl check your mapppings for " + tabInformation.getMappedClass()); // } // } // } // // public void addProperty(String[] props) { // orderSql = queryGenerator.orderBy(props, information, sortOrder); // } // // public String orderSql() { // return orderSql; // } // // } // // Path: src/main/java/in/cubestack/android/lib/storm/criteria/Projection.java // public interface Projection { // // Projection add(String property); // // Projection sum(String property); // // Projection count(String property); // // Projection max(String property); // // Projection min(String property); // // Projection average(String property); // // Projection total(String property); // // List<SQLFunction> getAggregateFunctions() ; // List<String> getColumns(); // } // // Path: src/main/java/in/cubestack/android/lib/storm/criteria/Restriction.java // public interface Restriction { // // public String toSqlString(); // // boolean valueStored(); // // String[] values(); // // Restriction page(int page); // // Restriction limit(int offset, int limit); // // public Object sqlString(Order order); // // public TableInformation getTableInformation(); // } // // Path: src/main/java/in/cubestack/android/lib/storm/criteria/SQLFunction.java // public interface SQLFunction { // // public String toSqlString(); // }
import in.cubestack.android.lib.storm.FetchType; import in.cubestack.android.lib.storm.SortOrder; import in.cubestack.android.lib.storm.criteria.Order; import in.cubestack.android.lib.storm.criteria.Projection; import in.cubestack.android.lib.storm.criteria.Restriction; import in.cubestack.android.lib.storm.criteria.SQLFunction;
public String rawQuery(Class<?> entityClass, Restriction restriction, Projection projection) throws IllegalArgumentException, IllegalAccessException, InstantiationException, StormException { return rawQuery(EntityMetaDataCache.getMetaData(entityClass), restriction, projection, null); } public String deleteRawQuery(TableInformation tableInformation, Restriction restriction) { return new StringBuilder(DELETE).append(FROM).append(tableInformation.getTableName()).append(SPACE).append(WHERE) .append(cleanAlias(restriction.toSqlString(), tableInformation.getAlias())).toString(); } private String cleanAlias(String sqlString, String alias) { return sqlString.replaceAll(alias + ".", ""); } public String rawQuery(TableInformation information, Restriction restriction, Projection projection, Order order) throws IllegalArgumentException, IllegalAccessException, InstantiationException, StormException { if(! restriction.getTableInformation().equals(information)) { throw new StormException("Meta information for Table and restrictions do not match. Please review: " + "\n Restriction meta: " + restriction.getTableInformation() + "\n Table information " + information); } StringBuilder sql = new StringBuilder(); sql.append(SELECT_INIT); generateColumnNames(information, sql, projection); if (information.getRelations() != null && ! information.getRelations().isEmpty()) { for (RelationMetaData relationMetaData : information.getRelations()) {
// Path: src/main/java/in/cubestack/android/lib/storm/FetchType.java // public enum FetchType { // // EAGER, LAZY; // } // // Path: src/main/java/in/cubestack/android/lib/storm/SortOrder.java // public enum SortOrder { // ASC, // DESC // } // // Path: src/main/java/in/cubestack/android/lib/storm/criteria/Order.java // public class Order { // // private SortOrder sortOrder; // private String orderSql; // private TableInformation information; // private QueryGenerator queryGenerator = new QueryGenerator(); // // public Order(SortOrder order, TableInformation information) { // this.sortOrder = order; // this.information = information; // } // // public static <T> Order orderFor(Class<T> entity, String[] props, SortOrder sortOrder) { // try { // TableInformation information = EntityMetaDataCache.getMetaData(entity); // Order order = new Order(sortOrder, information); // validate(props, information); // order.addProperty(props); // return order; // } catch (Exception e) { // throw new StormRuntimeException("Invalid entity, please check your mapppings for " + entity, e); // } // } // // private static void validate(String[] props, TableInformation tabInformation) { // for(String prop: props) { // ColumnMetaData columnInfo = tabInformation.getColumnMetaData(prop); // if(columnInfo == null) { // throw new StormRuntimeException("Could not find column mapped to alias " + prop +". Pl check your mapppings for " + tabInformation.getMappedClass()); // } // } // } // // public void addProperty(String[] props) { // orderSql = queryGenerator.orderBy(props, information, sortOrder); // } // // public String orderSql() { // return orderSql; // } // // } // // Path: src/main/java/in/cubestack/android/lib/storm/criteria/Projection.java // public interface Projection { // // Projection add(String property); // // Projection sum(String property); // // Projection count(String property); // // Projection max(String property); // // Projection min(String property); // // Projection average(String property); // // Projection total(String property); // // List<SQLFunction> getAggregateFunctions() ; // List<String> getColumns(); // } // // Path: src/main/java/in/cubestack/android/lib/storm/criteria/Restriction.java // public interface Restriction { // // public String toSqlString(); // // boolean valueStored(); // // String[] values(); // // Restriction page(int page); // // Restriction limit(int offset, int limit); // // public Object sqlString(Order order); // // public TableInformation getTableInformation(); // } // // Path: src/main/java/in/cubestack/android/lib/storm/criteria/SQLFunction.java // public interface SQLFunction { // // public String toSqlString(); // } // Path: src/main/java/in/cubestack/android/lib/storm/core/QueryGenerator.java import in.cubestack.android.lib.storm.FetchType; import in.cubestack.android.lib.storm.SortOrder; import in.cubestack.android.lib.storm.criteria.Order; import in.cubestack.android.lib.storm.criteria.Projection; import in.cubestack.android.lib.storm.criteria.Restriction; import in.cubestack.android.lib.storm.criteria.SQLFunction; public String rawQuery(Class<?> entityClass, Restriction restriction, Projection projection) throws IllegalArgumentException, IllegalAccessException, InstantiationException, StormException { return rawQuery(EntityMetaDataCache.getMetaData(entityClass), restriction, projection, null); } public String deleteRawQuery(TableInformation tableInformation, Restriction restriction) { return new StringBuilder(DELETE).append(FROM).append(tableInformation.getTableName()).append(SPACE).append(WHERE) .append(cleanAlias(restriction.toSqlString(), tableInformation.getAlias())).toString(); } private String cleanAlias(String sqlString, String alias) { return sqlString.replaceAll(alias + ".", ""); } public String rawQuery(TableInformation information, Restriction restriction, Projection projection, Order order) throws IllegalArgumentException, IllegalAccessException, InstantiationException, StormException { if(! restriction.getTableInformation().equals(information)) { throw new StormException("Meta information for Table and restrictions do not match. Please review: " + "\n Restriction meta: " + restriction.getTableInformation() + "\n Table information " + information); } StringBuilder sql = new StringBuilder(); sql.append(SELECT_INIT); generateColumnNames(information, sql, projection); if (information.getRelations() != null && ! information.getRelations().isEmpty()) { for (RelationMetaData relationMetaData : information.getRelations()) {
if (relationMetaData.getFetchType() == FetchType.EAGER) {
supaldubey/storm
src/main/java/in/cubestack/android/lib/storm/core/QueryGenerator.java
// Path: src/main/java/in/cubestack/android/lib/storm/FetchType.java // public enum FetchType { // // EAGER, LAZY; // } // // Path: src/main/java/in/cubestack/android/lib/storm/SortOrder.java // public enum SortOrder { // ASC, // DESC // } // // Path: src/main/java/in/cubestack/android/lib/storm/criteria/Order.java // public class Order { // // private SortOrder sortOrder; // private String orderSql; // private TableInformation information; // private QueryGenerator queryGenerator = new QueryGenerator(); // // public Order(SortOrder order, TableInformation information) { // this.sortOrder = order; // this.information = information; // } // // public static <T> Order orderFor(Class<T> entity, String[] props, SortOrder sortOrder) { // try { // TableInformation information = EntityMetaDataCache.getMetaData(entity); // Order order = new Order(sortOrder, information); // validate(props, information); // order.addProperty(props); // return order; // } catch (Exception e) { // throw new StormRuntimeException("Invalid entity, please check your mapppings for " + entity, e); // } // } // // private static void validate(String[] props, TableInformation tabInformation) { // for(String prop: props) { // ColumnMetaData columnInfo = tabInformation.getColumnMetaData(prop); // if(columnInfo == null) { // throw new StormRuntimeException("Could not find column mapped to alias " + prop +". Pl check your mapppings for " + tabInformation.getMappedClass()); // } // } // } // // public void addProperty(String[] props) { // orderSql = queryGenerator.orderBy(props, information, sortOrder); // } // // public String orderSql() { // return orderSql; // } // // } // // Path: src/main/java/in/cubestack/android/lib/storm/criteria/Projection.java // public interface Projection { // // Projection add(String property); // // Projection sum(String property); // // Projection count(String property); // // Projection max(String property); // // Projection min(String property); // // Projection average(String property); // // Projection total(String property); // // List<SQLFunction> getAggregateFunctions() ; // List<String> getColumns(); // } // // Path: src/main/java/in/cubestack/android/lib/storm/criteria/Restriction.java // public interface Restriction { // // public String toSqlString(); // // boolean valueStored(); // // String[] values(); // // Restriction page(int page); // // Restriction limit(int offset, int limit); // // public Object sqlString(Order order); // // public TableInformation getTableInformation(); // } // // Path: src/main/java/in/cubestack/android/lib/storm/criteria/SQLFunction.java // public interface SQLFunction { // // public String toSqlString(); // }
import in.cubestack.android.lib.storm.FetchType; import in.cubestack.android.lib.storm.SortOrder; import in.cubestack.android.lib.storm.criteria.Order; import in.cubestack.android.lib.storm.criteria.Projection; import in.cubestack.android.lib.storm.criteria.Restriction; import in.cubestack.android.lib.storm.criteria.SQLFunction;
return sql.toString(); } private boolean isEmpty(String joinOnColumn) { return joinOnColumn == null || "".equals(joinOnColumn); } private String validateClause(String alias, TableInformation tableInformation) { String column = tableInformation.getColumnName(alias); //Probably impossible, as there are prechecks, but lets still check. if (column == null) { // You have come till here, that is nothing has matched. GO AWAY AND throw new StormRuntimeException("No mapping found for " + alias + " in entity table " + tableInformation.getTableName()); } return column; } private void generateColumnNames(TableInformation tableInformation, StringBuilder builder, Projection projection) throws IllegalArgumentException, IllegalAccessException, InstantiationException { if (projection == null || projection.getColumns().contains(tableInformation.getAlias() + "." + tableInformation.getPrimaryKeyData().getAlias())) { builder.append(tableInformation.getAlias()).append(DOT).append(tableInformation.getPrimaryKeyData().getColumnName()).append(COMMA); } for (ColumnMetaData columnMetaData : tableInformation.getColumnMetaDataList()) { if (projection == null || projection.getColumns().contains(tableInformation.getAlias() + "." + columnMetaData.getAlias())) { builder.append(tableInformation.getAlias()).append(DOT).append(columnMetaData.getColumnName()).append(COMMA); } } if (projection != null) {
// Path: src/main/java/in/cubestack/android/lib/storm/FetchType.java // public enum FetchType { // // EAGER, LAZY; // } // // Path: src/main/java/in/cubestack/android/lib/storm/SortOrder.java // public enum SortOrder { // ASC, // DESC // } // // Path: src/main/java/in/cubestack/android/lib/storm/criteria/Order.java // public class Order { // // private SortOrder sortOrder; // private String orderSql; // private TableInformation information; // private QueryGenerator queryGenerator = new QueryGenerator(); // // public Order(SortOrder order, TableInformation information) { // this.sortOrder = order; // this.information = information; // } // // public static <T> Order orderFor(Class<T> entity, String[] props, SortOrder sortOrder) { // try { // TableInformation information = EntityMetaDataCache.getMetaData(entity); // Order order = new Order(sortOrder, information); // validate(props, information); // order.addProperty(props); // return order; // } catch (Exception e) { // throw new StormRuntimeException("Invalid entity, please check your mapppings for " + entity, e); // } // } // // private static void validate(String[] props, TableInformation tabInformation) { // for(String prop: props) { // ColumnMetaData columnInfo = tabInformation.getColumnMetaData(prop); // if(columnInfo == null) { // throw new StormRuntimeException("Could not find column mapped to alias " + prop +". Pl check your mapppings for " + tabInformation.getMappedClass()); // } // } // } // // public void addProperty(String[] props) { // orderSql = queryGenerator.orderBy(props, information, sortOrder); // } // // public String orderSql() { // return orderSql; // } // // } // // Path: src/main/java/in/cubestack/android/lib/storm/criteria/Projection.java // public interface Projection { // // Projection add(String property); // // Projection sum(String property); // // Projection count(String property); // // Projection max(String property); // // Projection min(String property); // // Projection average(String property); // // Projection total(String property); // // List<SQLFunction> getAggregateFunctions() ; // List<String> getColumns(); // } // // Path: src/main/java/in/cubestack/android/lib/storm/criteria/Restriction.java // public interface Restriction { // // public String toSqlString(); // // boolean valueStored(); // // String[] values(); // // Restriction page(int page); // // Restriction limit(int offset, int limit); // // public Object sqlString(Order order); // // public TableInformation getTableInformation(); // } // // Path: src/main/java/in/cubestack/android/lib/storm/criteria/SQLFunction.java // public interface SQLFunction { // // public String toSqlString(); // } // Path: src/main/java/in/cubestack/android/lib/storm/core/QueryGenerator.java import in.cubestack.android.lib.storm.FetchType; import in.cubestack.android.lib.storm.SortOrder; import in.cubestack.android.lib.storm.criteria.Order; import in.cubestack.android.lib.storm.criteria.Projection; import in.cubestack.android.lib.storm.criteria.Restriction; import in.cubestack.android.lib.storm.criteria.SQLFunction; return sql.toString(); } private boolean isEmpty(String joinOnColumn) { return joinOnColumn == null || "".equals(joinOnColumn); } private String validateClause(String alias, TableInformation tableInformation) { String column = tableInformation.getColumnName(alias); //Probably impossible, as there are prechecks, but lets still check. if (column == null) { // You have come till here, that is nothing has matched. GO AWAY AND throw new StormRuntimeException("No mapping found for " + alias + " in entity table " + tableInformation.getTableName()); } return column; } private void generateColumnNames(TableInformation tableInformation, StringBuilder builder, Projection projection) throws IllegalArgumentException, IllegalAccessException, InstantiationException { if (projection == null || projection.getColumns().contains(tableInformation.getAlias() + "." + tableInformation.getPrimaryKeyData().getAlias())) { builder.append(tableInformation.getAlias()).append(DOT).append(tableInformation.getPrimaryKeyData().getColumnName()).append(COMMA); } for (ColumnMetaData columnMetaData : tableInformation.getColumnMetaDataList()) { if (projection == null || projection.getColumns().contains(tableInformation.getAlias() + "." + columnMetaData.getAlias())) { builder.append(tableInformation.getAlias()).append(DOT).append(columnMetaData.getColumnName()).append(COMMA); } } if (projection != null) {
for (SQLFunction sqlFunction : projection.getAggregateFunctions()) {
supaldubey/storm
src/main/java/in/cubestack/android/lib/storm/core/QueryGenerator.java
// Path: src/main/java/in/cubestack/android/lib/storm/FetchType.java // public enum FetchType { // // EAGER, LAZY; // } // // Path: src/main/java/in/cubestack/android/lib/storm/SortOrder.java // public enum SortOrder { // ASC, // DESC // } // // Path: src/main/java/in/cubestack/android/lib/storm/criteria/Order.java // public class Order { // // private SortOrder sortOrder; // private String orderSql; // private TableInformation information; // private QueryGenerator queryGenerator = new QueryGenerator(); // // public Order(SortOrder order, TableInformation information) { // this.sortOrder = order; // this.information = information; // } // // public static <T> Order orderFor(Class<T> entity, String[] props, SortOrder sortOrder) { // try { // TableInformation information = EntityMetaDataCache.getMetaData(entity); // Order order = new Order(sortOrder, information); // validate(props, information); // order.addProperty(props); // return order; // } catch (Exception e) { // throw new StormRuntimeException("Invalid entity, please check your mapppings for " + entity, e); // } // } // // private static void validate(String[] props, TableInformation tabInformation) { // for(String prop: props) { // ColumnMetaData columnInfo = tabInformation.getColumnMetaData(prop); // if(columnInfo == null) { // throw new StormRuntimeException("Could not find column mapped to alias " + prop +". Pl check your mapppings for " + tabInformation.getMappedClass()); // } // } // } // // public void addProperty(String[] props) { // orderSql = queryGenerator.orderBy(props, information, sortOrder); // } // // public String orderSql() { // return orderSql; // } // // } // // Path: src/main/java/in/cubestack/android/lib/storm/criteria/Projection.java // public interface Projection { // // Projection add(String property); // // Projection sum(String property); // // Projection count(String property); // // Projection max(String property); // // Projection min(String property); // // Projection average(String property); // // Projection total(String property); // // List<SQLFunction> getAggregateFunctions() ; // List<String> getColumns(); // } // // Path: src/main/java/in/cubestack/android/lib/storm/criteria/Restriction.java // public interface Restriction { // // public String toSqlString(); // // boolean valueStored(); // // String[] values(); // // Restriction page(int page); // // Restriction limit(int offset, int limit); // // public Object sqlString(Order order); // // public TableInformation getTableInformation(); // } // // Path: src/main/java/in/cubestack/android/lib/storm/criteria/SQLFunction.java // public interface SQLFunction { // // public String toSqlString(); // }
import in.cubestack.android.lib.storm.FetchType; import in.cubestack.android.lib.storm.SortOrder; import in.cubestack.android.lib.storm.criteria.Order; import in.cubestack.android.lib.storm.criteria.Projection; import in.cubestack.android.lib.storm.criteria.Restriction; import in.cubestack.android.lib.storm.criteria.SQLFunction;
public String insertQuery(TableInformation tableInformation, boolean autoGenerate) throws IllegalArgumentException, IllegalAccessException, InstantiationException { StringBuilder insert = new StringBuilder(INSERT_INTO).append(tableInformation.getTableName()).append(OPEN_BRACES); if ( ! autoGenerate) { insert.append(tableInformation.getPrimaryKeyData().getColumnName()).append(COMMA); } for (ColumnMetaData columnMetaData : tableInformation.getColumnMetaDataList()) { insert.append(columnMetaData.getColumnName()).append(COMMA); } insert = new StringBuilder(insert.substring(0, insert.length() - 1)); insert.append(CLOSE_BRACES).append(VALUES); if (! autoGenerate) { insert.append(QUESTION_MARK).append(COMMA); } for (int columns = 0; columns < tableInformation.getColumnMetaDataList().size(); columns++) { insert.append(QUESTION_MARK).append(COMMA); } insert = new StringBuilder(insert.substring(0, insert.length() - 1)); // Primary Key return insert.append(CLOSE_BRACES).toString(); }
// Path: src/main/java/in/cubestack/android/lib/storm/FetchType.java // public enum FetchType { // // EAGER, LAZY; // } // // Path: src/main/java/in/cubestack/android/lib/storm/SortOrder.java // public enum SortOrder { // ASC, // DESC // } // // Path: src/main/java/in/cubestack/android/lib/storm/criteria/Order.java // public class Order { // // private SortOrder sortOrder; // private String orderSql; // private TableInformation information; // private QueryGenerator queryGenerator = new QueryGenerator(); // // public Order(SortOrder order, TableInformation information) { // this.sortOrder = order; // this.information = information; // } // // public static <T> Order orderFor(Class<T> entity, String[] props, SortOrder sortOrder) { // try { // TableInformation information = EntityMetaDataCache.getMetaData(entity); // Order order = new Order(sortOrder, information); // validate(props, information); // order.addProperty(props); // return order; // } catch (Exception e) { // throw new StormRuntimeException("Invalid entity, please check your mapppings for " + entity, e); // } // } // // private static void validate(String[] props, TableInformation tabInformation) { // for(String prop: props) { // ColumnMetaData columnInfo = tabInformation.getColumnMetaData(prop); // if(columnInfo == null) { // throw new StormRuntimeException("Could not find column mapped to alias " + prop +". Pl check your mapppings for " + tabInformation.getMappedClass()); // } // } // } // // public void addProperty(String[] props) { // orderSql = queryGenerator.orderBy(props, information, sortOrder); // } // // public String orderSql() { // return orderSql; // } // // } // // Path: src/main/java/in/cubestack/android/lib/storm/criteria/Projection.java // public interface Projection { // // Projection add(String property); // // Projection sum(String property); // // Projection count(String property); // // Projection max(String property); // // Projection min(String property); // // Projection average(String property); // // Projection total(String property); // // List<SQLFunction> getAggregateFunctions() ; // List<String> getColumns(); // } // // Path: src/main/java/in/cubestack/android/lib/storm/criteria/Restriction.java // public interface Restriction { // // public String toSqlString(); // // boolean valueStored(); // // String[] values(); // // Restriction page(int page); // // Restriction limit(int offset, int limit); // // public Object sqlString(Order order); // // public TableInformation getTableInformation(); // } // // Path: src/main/java/in/cubestack/android/lib/storm/criteria/SQLFunction.java // public interface SQLFunction { // // public String toSqlString(); // } // Path: src/main/java/in/cubestack/android/lib/storm/core/QueryGenerator.java import in.cubestack.android.lib.storm.FetchType; import in.cubestack.android.lib.storm.SortOrder; import in.cubestack.android.lib.storm.criteria.Order; import in.cubestack.android.lib.storm.criteria.Projection; import in.cubestack.android.lib.storm.criteria.Restriction; import in.cubestack.android.lib.storm.criteria.SQLFunction; public String insertQuery(TableInformation tableInformation, boolean autoGenerate) throws IllegalArgumentException, IllegalAccessException, InstantiationException { StringBuilder insert = new StringBuilder(INSERT_INTO).append(tableInformation.getTableName()).append(OPEN_BRACES); if ( ! autoGenerate) { insert.append(tableInformation.getPrimaryKeyData().getColumnName()).append(COMMA); } for (ColumnMetaData columnMetaData : tableInformation.getColumnMetaDataList()) { insert.append(columnMetaData.getColumnName()).append(COMMA); } insert = new StringBuilder(insert.substring(0, insert.length() - 1)); insert.append(CLOSE_BRACES).append(VALUES); if (! autoGenerate) { insert.append(QUESTION_MARK).append(COMMA); } for (int columns = 0; columns < tableInformation.getColumnMetaDataList().size(); columns++) { insert.append(QUESTION_MARK).append(COMMA); } insert = new StringBuilder(insert.substring(0, insert.length() - 1)); // Primary Key return insert.append(CLOSE_BRACES).toString(); }
public String orderBy(String[] props, TableInformation information, SortOrder order) {
supaldubey/storm
src/main/java/in/cubestack/android/lib/storm/annotation/Column.java
// Path: src/main/java/in/cubestack/android/lib/storm/FieldType.java // public enum FieldType { // // INTEGER , // TEXT , // REAL, // OBJECT, LONG, DOUBLE ; // // public String getEscapeString() { // return "''"; // } // // public static final String STD_DATE_FORMAT = "yyyy/MM/dd"; // // }
import in.cubestack.android.lib.storm.FieldType; import java.lang.annotation.ElementType; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target;
/** * A core Android SQLite ORM framework build for speed and raw execution. * Copyright (c) 2016 CubeStack. Built for performance, scalability and ease to use. * <p/> * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * <p/> * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * <p/> * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN * NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE * USE OR OTHER DEALINGS IN THE SOFTWARE. */ package in.cubestack.android.lib.storm.annotation; /** * Used to define a Column for a table or entity declared with @Table annotation * * @author Supal Dubey */ @Retention(RetentionPolicy.RUNTIME) @Target(ElementType.FIELD) public @interface Column { /** * The name of the Column that is desired for SQLite table. * For all practical purposes the name of entity property would be used, the name would be used by framework to generate underlying queries. * */ String name(); /** * The logical most "relate-able" Java type for the column, this should match the defined field types. <br><br> * <code>@Column(type=FieldType.INTEGER)<br>private int count;</code> <br><br>should be used when field is defined as Integer or int. * * The implicit conversion works on the fieldtype, there are checks for auto conversions but works best if used precisely */
// Path: src/main/java/in/cubestack/android/lib/storm/FieldType.java // public enum FieldType { // // INTEGER , // TEXT , // REAL, // OBJECT, LONG, DOUBLE ; // // public String getEscapeString() { // return "''"; // } // // public static final String STD_DATE_FORMAT = "yyyy/MM/dd"; // // } // Path: src/main/java/in/cubestack/android/lib/storm/annotation/Column.java import in.cubestack.android.lib.storm.FieldType; import java.lang.annotation.ElementType; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; /** * A core Android SQLite ORM framework build for speed and raw execution. * Copyright (c) 2016 CubeStack. Built for performance, scalability and ease to use. * <p/> * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * <p/> * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * <p/> * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN * NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE * USE OR OTHER DEALINGS IN THE SOFTWARE. */ package in.cubestack.android.lib.storm.annotation; /** * Used to define a Column for a table or entity declared with @Table annotation * * @author Supal Dubey */ @Retention(RetentionPolicy.RUNTIME) @Target(ElementType.FIELD) public @interface Column { /** * The name of the Column that is desired for SQLite table. * For all practical purposes the name of entity property would be used, the name would be used by framework to generate underlying queries. * */ String name(); /** * The logical most "relate-able" Java type for the column, this should match the defined field types. <br><br> * <code>@Column(type=FieldType.INTEGER)<br>private int count;</code> <br><br>should be used when field is defined as Integer or int. * * The implicit conversion works on the fieldtype, there are checks for auto conversions but works best if used precisely */
FieldType type();
supaldubey/storm
src/main/java/in/cubestack/android/lib/storm/service/StormService.java
// Path: src/main/java/in/cubestack/android/lib/storm/core/StormException.java // public class StormException extends Exception { // // private static final long serialVersionUID = -563476450614494464L; // // public StormException(Throwable throwable) { // super(throwable); // } // // public StormException(String msg) { // super(msg); // } // // public StormException(String msg, Exception exception) { // super(msg, exception); // } // // // } // // Path: src/main/java/in/cubestack/android/lib/storm/criteria/Order.java // public class Order { // // private SortOrder sortOrder; // private String orderSql; // private TableInformation information; // private QueryGenerator queryGenerator = new QueryGenerator(); // // public Order(SortOrder order, TableInformation information) { // this.sortOrder = order; // this.information = information; // } // // public static <T> Order orderFor(Class<T> entity, String[] props, SortOrder sortOrder) { // try { // TableInformation information = EntityMetaDataCache.getMetaData(entity); // Order order = new Order(sortOrder, information); // validate(props, information); // order.addProperty(props); // return order; // } catch (Exception e) { // throw new StormRuntimeException("Invalid entity, please check your mapppings for " + entity, e); // } // } // // private static void validate(String[] props, TableInformation tabInformation) { // for(String prop: props) { // ColumnMetaData columnInfo = tabInformation.getColumnMetaData(prop); // if(columnInfo == null) { // throw new StormRuntimeException("Could not find column mapped to alias " + prop +". Pl check your mapppings for " + tabInformation.getMappedClass()); // } // } // } // // public void addProperty(String[] props) { // orderSql = queryGenerator.orderBy(props, information, sortOrder); // } // // public String orderSql() { // return orderSql; // } // // } // // Path: src/main/java/in/cubestack/android/lib/storm/criteria/Projection.java // public interface Projection { // // Projection add(String property); // // Projection sum(String property); // // Projection count(String property); // // Projection max(String property); // // Projection min(String property); // // Projection average(String property); // // Projection total(String property); // // List<SQLFunction> getAggregateFunctions() ; // List<String> getColumns(); // } // // Path: src/main/java/in/cubestack/android/lib/storm/criteria/Restriction.java // public interface Restriction { // // public String toSqlString(); // // boolean valueStored(); // // String[] values(); // // Restriction page(int page); // // Restriction limit(int offset, int limit); // // public Object sqlString(Order order); // // public TableInformation getTableInformation(); // } // // Path: src/main/java/in/cubestack/android/lib/storm/criteria/Restrictions.java // public interface Restrictions { // // public Restriction equals(String property, Object value); // // public Restriction notEquals(String property, Object value); // // public Restriction lessThen(String property, Object value); // // public Restriction greaterThen(String property, Object value); // // public Restriction like(String property, String value); // // public Restriction likeIgnoreCase(String property, String value); // // public Restriction or(Restriction expression1, Restriction expression2); // // public Restriction and(Restriction expression1, Restriction expression2); // // public Projection projection(); // // Restriction isNull(String property); // // Restriction notNull(String property); // // Restriction forAll(); // // Restriction in(String property, List<String> value); // }
import in.cubestack.android.lib.storm.core.StormException; import in.cubestack.android.lib.storm.criteria.Order; import in.cubestack.android.lib.storm.criteria.Projection; import in.cubestack.android.lib.storm.criteria.Restriction; import in.cubestack.android.lib.storm.criteria.Restrictions; import java.util.Collection; import java.util.List;
package in.cubestack.android.lib.storm.service; /** * A core Android SQLite ORM framework build for speed and raw execution. * Copyright (c) 2014 CubeStack. Version built for Flash Back.. * <p/> * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * <p/> * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * <p/> * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ public interface StormService { public <E> Projection projectionFor(Class<E> entity) throws StormException;
// Path: src/main/java/in/cubestack/android/lib/storm/core/StormException.java // public class StormException extends Exception { // // private static final long serialVersionUID = -563476450614494464L; // // public StormException(Throwable throwable) { // super(throwable); // } // // public StormException(String msg) { // super(msg); // } // // public StormException(String msg, Exception exception) { // super(msg, exception); // } // // // } // // Path: src/main/java/in/cubestack/android/lib/storm/criteria/Order.java // public class Order { // // private SortOrder sortOrder; // private String orderSql; // private TableInformation information; // private QueryGenerator queryGenerator = new QueryGenerator(); // // public Order(SortOrder order, TableInformation information) { // this.sortOrder = order; // this.information = information; // } // // public static <T> Order orderFor(Class<T> entity, String[] props, SortOrder sortOrder) { // try { // TableInformation information = EntityMetaDataCache.getMetaData(entity); // Order order = new Order(sortOrder, information); // validate(props, information); // order.addProperty(props); // return order; // } catch (Exception e) { // throw new StormRuntimeException("Invalid entity, please check your mapppings for " + entity, e); // } // } // // private static void validate(String[] props, TableInformation tabInformation) { // for(String prop: props) { // ColumnMetaData columnInfo = tabInformation.getColumnMetaData(prop); // if(columnInfo == null) { // throw new StormRuntimeException("Could not find column mapped to alias " + prop +". Pl check your mapppings for " + tabInformation.getMappedClass()); // } // } // } // // public void addProperty(String[] props) { // orderSql = queryGenerator.orderBy(props, information, sortOrder); // } // // public String orderSql() { // return orderSql; // } // // } // // Path: src/main/java/in/cubestack/android/lib/storm/criteria/Projection.java // public interface Projection { // // Projection add(String property); // // Projection sum(String property); // // Projection count(String property); // // Projection max(String property); // // Projection min(String property); // // Projection average(String property); // // Projection total(String property); // // List<SQLFunction> getAggregateFunctions() ; // List<String> getColumns(); // } // // Path: src/main/java/in/cubestack/android/lib/storm/criteria/Restriction.java // public interface Restriction { // // public String toSqlString(); // // boolean valueStored(); // // String[] values(); // // Restriction page(int page); // // Restriction limit(int offset, int limit); // // public Object sqlString(Order order); // // public TableInformation getTableInformation(); // } // // Path: src/main/java/in/cubestack/android/lib/storm/criteria/Restrictions.java // public interface Restrictions { // // public Restriction equals(String property, Object value); // // public Restriction notEquals(String property, Object value); // // public Restriction lessThen(String property, Object value); // // public Restriction greaterThen(String property, Object value); // // public Restriction like(String property, String value); // // public Restriction likeIgnoreCase(String property, String value); // // public Restriction or(Restriction expression1, Restriction expression2); // // public Restriction and(Restriction expression1, Restriction expression2); // // public Projection projection(); // // Restriction isNull(String property); // // Restriction notNull(String property); // // Restriction forAll(); // // Restriction in(String property, List<String> value); // } // Path: src/main/java/in/cubestack/android/lib/storm/service/StormService.java import in.cubestack.android.lib.storm.core.StormException; import in.cubestack.android.lib.storm.criteria.Order; import in.cubestack.android.lib.storm.criteria.Projection; import in.cubestack.android.lib.storm.criteria.Restriction; import in.cubestack.android.lib.storm.criteria.Restrictions; import java.util.Collection; import java.util.List; package in.cubestack.android.lib.storm.service; /** * A core Android SQLite ORM framework build for speed and raw execution. * Copyright (c) 2014 CubeStack. Version built for Flash Back.. * <p/> * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * <p/> * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * <p/> * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ public interface StormService { public <E> Projection projectionFor(Class<E> entity) throws StormException;
public <E> Restrictions restrictionsFor(Class<E> entity) throws StormException;