_id stringlengths 2 7 | title stringlengths 3 140 | partition stringclasses 3
values | text stringlengths 73 34.1k | language stringclasses 1
value | meta_information dict |
|---|---|---|---|---|---|
q18600 | ProxiedObject.getObject | train | public Object getObject()
{
Object ret = null;
try {
ret = this.proxy.getValue(this.object);
} catch (final EFapsException e) {
LOG.error("Catched", e);
}
return ret;
} | java | {
"resource": ""
} |
q18601 | Ellipse.setCenterColor | train | public void setCenterColor(Color color) {
if (centerColor == null) {
centerColor = new RGBColor(0.0, 0.0, 0.0);
}
setGradation(true);
this.centerColor = color;
} | java | {
"resource": ""
} |
q18602 | Attribute.copy | train | protected Attribute copy(final long _parentId)
{
final Attribute ret = new Attribute(getId(), _parentId, getName(), this.sqlTable, this.attributeType,
this.defaultValue, this.dimensionUUID, this.required, this.size, this.scale);
ret.getSqlColNames().addAll(getSqlColNames());
ret.setLink(this.link);
ret.setClassName(getClassName());
ret.getProperties().putAll(getProperties());
return ret;
} | java | {
"resource": ""
} |
q18603 | Attribute.getDimension | train | public Dimension getDimension()
{
Dimension ret = null;
try {
ret = Dimension.get(UUID.fromString(this.dimensionUUID));
} catch (final CacheReloadException e) {
Attribute.LOG.error("Catched CacheReloadException", e);
}
return ret;
} | java | {
"resource": ""
} |
q18604 | Attribute.initialize | train | public static void initialize(final Class<?> _class)
throws CacheReloadException
{
if (InfinispanCache.get().exists(Attribute.NAMECACHE)) {
InfinispanCache.get().<String, Attribute>getCache(Attribute.NAMECACHE).clear();
} else {
InfinispanCache.get().<String, Attribute>getCache(Attribute.NAMECACHE)
.addListener(new CacheLogListener(Attribute.LOG));
}
if (InfinispanCache.get().exists(Attribute.IDCACHE)) {
InfinispanCache.get().<Long, Attribute>getCache(Attribute.IDCACHE).clear();
} else {
InfinispanCache.get().<Long, Attribute>getCache(Attribute.IDCACHE)
.addListener(new CacheLogListener(Attribute.LOG));
}
} | java | {
"resource": ""
} |
q18605 | Error.toHtml | train | public String toHtml() {
StringBuilder stringBuilder = new StringBuilder();
stringBuilder
.append("<p>")
.append(objectNode.get(TYPE).asText()).append(": ")
.append(objectNode.get(MESSAGE).asText()).append(" -> ")
.append(objectNode.get(DETAILS).toString())
.append("</p>");
return stringBuilder.toString();
} | java | {
"resource": ""
} |
q18606 | ComapiChatClient.createLifecycleListener | train | LifecycleListener createLifecycleListener(final WeakReference<ComapiChatClient> ref) {
return new LifecycleListener() {
/**
* App foregrounded.
*
* @param context Application context
*/
public void onForegrounded(Context context) {
ComapiChatClient client = ref.get();
if (client != null) {
client.service().messaging().synchroniseStore(null);
}
}
/**
* App backgrounded.
*
* @param context Application context
*/
public void onBackgrounded(Context context) {
}
};
} | java | {
"resource": ""
} |
q18607 | ComapiChatClient.addListener | train | public void addListener(final ParticipantsListener participantsListener) {
if (participantsListener != null) {
MessagingListener messagingListener = new MessagingListener() {
@Override
public void onParticipantAdded(ParticipantAddedEvent event) {
participantsListener.onParticipantAdded(event);
}
@Override
public void onParticipantUpdated(ParticipantUpdatedEvent event) {
participantsListener.onParticipantUpdated(event);
}
@Override
public void onParticipantRemoved(ParticipantRemovedEvent event) {
participantsListener.onParticipantRemoved(event);
}
};
participantsListeners.put(participantsListener, messagingListener);
client.addListener(messagingListener);
}
} | java | {
"resource": ""
} |
q18608 | ComapiChatClient.removeListener | train | public void removeListener(final ParticipantsListener participantsListener) {
MessagingListener messagingListener = participantsListeners.get(participantsListener);
if (messagingListener != null) {
client.removeListener(messagingListener);
participantsListeners.remove(participantsListener);
}
} | java | {
"resource": ""
} |
q18609 | ComapiChatClient.addListener | train | public void addListener(final ProfileListener profileListener) {
if (profileListener != null) {
com.comapi.ProfileListener foundationListener = new com.comapi.ProfileListener() {
@Override
public void onProfileUpdate(ProfileUpdateEvent event) {
profileListener.onProfileUpdate(event);
}
};
profileListeners.put(profileListener, foundationListener);
client.addListener(foundationListener);
}
} | java | {
"resource": ""
} |
q18610 | ComapiChatClient.removeListener | train | public void removeListener(final ProfileListener profileListener) {
com.comapi.ProfileListener foundationListener = profileListeners.get(profileListener);
if (foundationListener != null) {
client.removeListener(foundationListener);
profileListeners.remove(profileListener);
}
} | java | {
"resource": ""
} |
q18611 | JAASSystem.initialize | train | public static void initialize()
throws CacheReloadException
{
if (InfinispanCache.get().exists(JAASSystem.IDCACHE)) {
InfinispanCache.get().<Long, JAASSystem>getCache(JAASSystem.IDCACHE).clear();
} else {
InfinispanCache.get().<Long, JAASSystem>getCache(JAASSystem.IDCACHE)
.addListener(new CacheLogListener(JAASSystem.LOG));
}
if (InfinispanCache.get().exists(JAASSystem.NAMECACHE)) {
InfinispanCache.get().<String, JAASSystem>getCache(JAASSystem.NAMECACHE).clear();
} else {
InfinispanCache.get().<String, JAASSystem>getCache(JAASSystem.NAMECACHE)
.addListener(new CacheLogListener(JAASSystem.LOG));
}
JAASSystem.getJAASSystemFromDB(JAASSystem.SQL_SELECT, null);
} | java | {
"resource": ""
} |
q18612 | JAASSystem.getAllJAASSystems | train | public static Set<JAASSystem> getAllJAASSystems()
{
final Set<JAASSystem> ret = new HashSet<>();
final Cache<Long, JAASSystem> cache = InfinispanCache.get().<Long, JAASSystem>getCache(JAASSystem.IDCACHE);
for (final Map.Entry<Long, JAASSystem> entry : cache.entrySet()) {
ret.add(entry.getValue());
}
return ret;
} | java | {
"resource": ""
} |
q18613 | Iobeam.reset | train | void reset(boolean deleteFile) {
String path = this.path;
this.path = null;
this.projectId = -1;
this.projectToken = null;
this.deviceId = null;
this.client = null;
synchronized (dataStoreLock) {
dataStore = null;
dataBatches.clear();
}
if (deleteFile) {
File f = new File(path, DEVICE_FILENAME);
if (f.exists()) {
f.delete();
}
}
} | java | {
"resource": ""
} |
q18614 | Iobeam.registerDeviceAsync | train | public void registerDeviceAsync(String deviceId, RegisterCallback callback) {
final Device d = new Device.Builder(projectId).id(deviceId).build();
registerDeviceAsync(d, callback);
} | java | {
"resource": ""
} |
q18615 | Iobeam.registerDeviceWithIdAsync | train | @Deprecated
public void registerDeviceWithIdAsync(String deviceId, String deviceName,
RegisterCallback callback) {
final Device d = new Device.Builder(projectId).id(deviceId).name(deviceName).build();
registerDeviceAsync(d, callback);
} | java | {
"resource": ""
} |
q18616 | Iobeam.setDeviceId | train | public void setDeviceId(String deviceId) throws CouldNotPersistException {
this.deviceId = deviceId;
if (deviceId != null && path != null) {
persistDeviceId();
}
} | java | {
"resource": ""
} |
q18617 | Iobeam.getDataStore | train | public DataStore getDataStore(final Collection<String> columns) {
for (DataStore ds : dataBatches) {
if (ds.hasColumns(columns)) {
return ds;
}
}
return null;
} | java | {
"resource": ""
} |
q18618 | Iobeam.getOrAddDataStore | train | public DataStore getOrAddDataStore(final Collection<String> columns) {
DataStore ret = getDataStore(columns);
if (ret == null) {
ret = this.createDataStore(columns);
}
return ret;
} | java | {
"resource": ""
} |
q18619 | Iobeam.addData | train | @Deprecated
public void addData(String seriesName, DataPoint dataPoint) {
synchronized (dataStoreLock) {
_addDataWithoutLock(seriesName, dataPoint);
}
} | java | {
"resource": ""
} |
q18620 | Iobeam.addDataMapToSeries | train | @Deprecated
public boolean addDataMapToSeries(String[] seriesNames, DataPoint[] points) {
if (seriesNames == null || points == null || points.length != seriesNames.length) {
return false;
}
synchronized (dataStoreLock) {
for (int i = 0; i < seriesNames.length; i++) {
_addDataWithoutLock(seriesNames[i], points[i]);
}
}
return true;
} | java | {
"resource": ""
} |
q18621 | Iobeam.createDataStore | train | public DataStore createDataStore(Collection<String> columns) {
DataStore b = new DataStore(columns);
trackDataStore(b);
return b;
} | java | {
"resource": ""
} |
q18622 | Iobeam.getDataSize | train | public long getDataSize() {
long size = 0;
synchronized (dataStoreLock) {
for (DataStore b : dataBatches) {
size += b.getDataSize();
}
}
return size;
} | java | {
"resource": ""
} |
q18623 | Iobeam.getSeriesSize | train | private int getSeriesSize(String series) {
synchronized (dataStoreLock) {
if (dataStore == null) {
return 0;
}
if (seriesToBatch.containsKey(series)) {
return (int) seriesToBatch.get(series).getDataSize();
} else {
return 0;
}
}
} | java | {
"resource": ""
} |
q18624 | SystemConfiguration.reload | train | public void reload()
{
InfinispanCache.get().<UUID, SystemConfiguration>getCache(SystemConfiguration.UUIDCACHE).remove(uuid);
InfinispanCache.get().<Long, SystemConfiguration>getCache(SystemConfiguration.IDCACHE).remove(id);
InfinispanCache.get().<String, SystemConfiguration>getCache(SystemConfiguration.NAMECACHE).remove(name);
} | java | {
"resource": ""
} |
q18625 | SystemConfiguration.readConfig | train | private void readConfig()
throws CacheReloadException
{
Connection con = null;
try {
boolean closeContext = false;
if (!Context.isThreadActive()) {
Context.begin();
closeContext = true;
}
final List<Object[]> dbValues = new ArrayList<>();
con = Context.getConnection();
PreparedStatement stmt = null;
try {
stmt = con.prepareStatement(SystemConfiguration.SQL_CONFIG);
stmt.setObject(1, getId());
final ResultSet rs = stmt.executeQuery();
while (rs.next()) {
dbValues.add(new Object[] {
rs.getLong(1),
rs.getString(2),
rs.getString(3),
rs.getLong(4),
rs.getString(5)
});
}
rs.close();
} finally {
if (stmt != null) {
stmt.close();
}
}
con.commit();
if (closeContext) {
Context.rollback();
}
for (final Object[] row : dbValues) {
final Long typeId = (Long) row[0];
final String key = (String) row[1];
final String value = (String) row[2];
final Long companyId = (Long) row[3];
final String appkey = (String) row[4];
final Type type = Type.get(typeId);
final ConfType confType;
if (type.equals(CIAdminCommon.SystemConfigurationLink.getType())) {
confType = ConfType.LINK;
} else if (type.equals(CIAdminCommon.SystemConfigurationObjectAttribute.getType())) {
confType = ConfType.OBJATTR;
} else {
confType = ConfType.ATTRIBUTE;
}
values.add(new Value(confType, key, value, companyId, appkey));
}
} catch (final SQLException e) {
throw new CacheReloadException("could not read SystemConfiguration attributes", e);
} catch (final EFapsException e) {
throw new CacheReloadException("could not read SystemConfiguration attributes", e);
} finally {
try {
if (con != null && !con.isClosed()) {
con.close();
}
} catch (final SQLException e) {
throw new CacheReloadException("Cannot read a type for an attribute.", e);
}
}
} | java | {
"resource": ""
} |
q18626 | CacheResource.put | train | @PUT
@Consumes(MediaType.APPLICATION_JSON)
public Response put(@PathParam("cacheName") String cacheName, Cache cache) {
if (!cacheService.isPresent(cacheName)) {
return Response.status(Response.Status.NOT_FOUND).build();
}
cacheService.update(cacheName, cache);
return Response.ok().build();
} | java | {
"resource": ""
} |
q18627 | Type.addAttributes | train | protected void addAttributes(final boolean _inherited,
final Attribute... _attributes)
throws CacheReloadException
{
for (final Attribute attribute : _attributes) {
if (!this.attributes.containsKey(attribute.getName())) {
Type.LOG.trace("adding Attribute:'{}' to type: '{}'", attribute.getName(), getName());
// evaluate for type attribute
if (attribute.getAttributeType().getClassRepr().equals(TypeType.class)) {
this.typeAttributeName = attribute.getName();
} else if (attribute.getAttributeType().getClassRepr().equals(StatusType.class) && !_inherited) {
// evaluate for status, an inherited attribute will not
// overwrite the original attribute
this.statusAttributeName = attribute.getName();
} else if (attribute.getAttributeType().getClassRepr().equals(CompanyLinkType.class)
|| attribute.getAttributeType().getClassRepr().equals(ConsortiumLinkType.class)) {
// evaluate for company
this.companyAttributeName = attribute.getName();
} else if (attribute.getAttributeType().getClassRepr().equals(GroupLinkType.class)) {
// evaluate for group
this.groupAttributeName = attribute.getName();
}
this.attributes.put(attribute.getName(), attribute);
if (attribute.getTable() != null) {
this.tables.add(attribute.getTable());
attribute.getTable().addType(getId());
if (getMainTable() == null) {
setMainTable(attribute.getTable());
}
}
setDirty();
}
}
} | java | {
"resource": ""
} |
q18628 | Type.inheritAttributes | train | protected void inheritAttributes()
throws CacheReloadException
{
Type parent = getParentType();
final List<Attribute> attributesTmp = new ArrayList<>();
while (parent != null) {
for (final Attribute attribute : getParentType().getAttributes().values()) {
attributesTmp.add(attribute.copy(getId()));
}
parent = parent.getParentType();
}
addAttributes(true, attributesTmp.toArray(new Attribute[attributesTmp.size()]));
} | java | {
"resource": ""
} |
q18629 | Type.getTypeAttribute | train | public Attribute getTypeAttribute()
{
final Attribute ret;
if (this.typeAttributeName == null && getParentType() != null) {
ret = getParentType().getTypeAttribute();
} else {
ret = this.attributes.get(this.typeAttributeName);
}
return ret;
} | java | {
"resource": ""
} |
q18630 | Type.checkAccess | train | @SuppressWarnings("unchecked")
public Map<Instance, Boolean> checkAccess(final Collection<Instance> _instances,
final AccessType _accessType)
throws EFapsException
{
Map<Instance, Boolean> ret = new HashMap<>();
if (_instances != null && !_instances.isEmpty() && _instances.size() == 1) {
final Instance instance = _instances.iterator().next();
ret.put(instance, hasAccess(instance, _accessType));
} else {
final List<EventDefinition> events = super.getEvents(EventType.ACCESSCHECK);
if (events != null) {
final Parameter parameter = new Parameter();
parameter.put(ParameterValues.OTHERS, _instances);
parameter.put(ParameterValues.ACCESSTYPE, _accessType);
parameter.put(ParameterValues.CLASS, this);
for (final EventDefinition event : events) {
final Return retrn = event.execute(parameter);
ret = (Map<Instance, Boolean>) retrn.get(ReturnValues.VALUES);
}
} else {
for (final Instance instance : _instances) {
ret.put(instance, true);
}
}
}
return ret;
} | java | {
"resource": ""
} |
q18631 | Type.addClassifiedByType | train | protected void addClassifiedByType(final Classification _classification)
{
this.checked4classifiedBy = true;
this.classifiedByTypes.add(_classification.getId());
setDirty();
} | java | {
"resource": ""
} |
q18632 | Type.cacheTypesByHierachy | train | protected static void cacheTypesByHierachy(final Type _type)
throws CacheReloadException
{
final Cache<UUID, Type> cache4UUID = InfinispanCache.get().<UUID, Type>getIgnReCache(Type.UUIDCACHE);
if (cache4UUID.getCacheConfiguration().clustering() != null
&& !cache4UUID.getCacheConfiguration().clustering().cacheMode().equals(CacheMode.LOCAL)) {
Type type = _type;
while (type.getParentTypeId() != null) {
final Cache<Long, Type> cache = InfinispanCache.get().<Long, Type>getIgnReCache(Type.IDCACHE);
if (cache.containsKey(type.getParentTypeId())) {
type = cache.get(type.getParentTypeId());
} else {
type = type.getParentType();
}
}
type.recacheChildren();
}
} | java | {
"resource": ""
} |
q18633 | Type.recacheChildren | train | private void recacheChildren()
throws CacheReloadException
{
if (isDirty()) {
Type.cacheType(this);
}
for (final Type child : getChildTypes()) {
child.recacheChildren();
}
} | java | {
"resource": ""
} |
q18634 | Matrix3D.transpose | train | @Override
public void transpose() {
double temp;
temp = m01; m01 = m10; m10 = temp;
temp = m02; m02 = m20; m20 = temp;
temp = m03; m03 = m30; m30 = temp;
temp = m12; m12 = m21; m21 = temp;
temp = m13; m13 = m31; m31 = temp;
temp = m23; m23 = m32; m32 = temp;
} | java | {
"resource": ""
} |
q18635 | Matrix3D.determinant3x3 | train | private double determinant3x3(double t00, double t01, double t02,
double t10, double t11, double t12,
double t20, double t21, double t22) {
return (t00 * (t11 * t22 - t12 * t21) +
t01 * (t12 * t20 - t10 * t22) +
t02 * (t10 * t21 - t11 * t20));
} | java | {
"resource": ""
} |
q18636 | Executors.createChannelExecutor | train | ThreadPoolExecutor createChannelExecutor(String channel, final String threadPrefix, final int workerCount, int queueSize) {
ThreadFactory threadFactory = new ThreadFactory() {
private int counter = 0;
@Override
public Thread newThread(Runnable runnable) {
return new Thread(runnable, threadPrefix + "-" + ++counter);
}
};
ThreadPoolExecutor executor = new ChannelThreadPoolExecutor(channel, workerCount,
new LinkedBlockingQueue<Runnable>(queueSize), threadFactory);
return executor;
} | java | {
"resource": ""
} |
q18637 | Executors.createExecutor | train | ThreadPoolExecutor createExecutor(final String threadPrefix, final int workerCount, int queueSize) {
ThreadFactory threadFactory = new ThreadFactory() {
private int counter = 0;
@Override
public Thread newThread(Runnable runnable) {
return new Thread(runnable, threadPrefix + "-" + ++counter);
}
};
ThreadPoolExecutor executor = new ThreadPoolExecutor(workerCount, workerCount,
0, TimeUnit.SECONDS,
new LinkedBlockingQueue<Runnable>(queueSize), threadFactory);
return executor;
} | java | {
"resource": ""
} |
q18638 | Executors.createSchedulerExecutor | train | ScheduledExecutorService createSchedulerExecutor(final String prefix) {
ThreadFactory threadFactory = new ThreadFactory() {
private int counter = 0;
@Override
public Thread newThread(Runnable runnable) {
return new Thread(runnable, prefix + ++counter);
}
};
ScheduledExecutorService executor = java.util.concurrent.Executors.newSingleThreadScheduledExecutor(threadFactory);
return executor;
} | java | {
"resource": ""
} |
q18639 | AbstractResource.open | train | protected void open()
throws EFapsException
{
AbstractResource.LOG.debug("open resource:{}", this);
if (this.opened) {
AbstractResource.LOG.error("resource already opened");
throw new EFapsException(AbstractResource.class, "open.AlreadyOpened");
}
try {
final Context context = Context.getThreadContext();
context.getTransaction().enlistResource(this);
} catch (final RollbackException e) {
AbstractResource.LOG.error("exception occurs while delisting in transaction, " + "commit not possible", e);
throw new EFapsException(AbstractResource.class, "open.RollbackException", e);
} catch (final SystemException e) {
AbstractResource.LOG.error("exception occurs while delisting in transaction, " + "commit not possible", e);
throw new EFapsException(AbstractResource.class, "open.SystemException", e);
}
this.opened = true;
} | java | {
"resource": ""
} |
q18640 | AbstractResource.end | train | @Override
public void end(final Xid _xid,
final int _flags)
{
AbstractResource.LOG.trace("end resource {}, flags {}" + _flags, _xid, _flags);
} | java | {
"resource": ""
} |
q18641 | Install.getUpdateLifecycles | train | private List<UpdateLifecycle> getUpdateLifecycles()
{
final List<UpdateLifecycle> ret = new ArrayList<>();
for (final UpdateLifecycle cycle : UpdateLifecycle.values()) {
ret.add(cycle);
}
Collections.sort(ret, (_cycle1, _cycle2) -> _cycle1.getOrder().compareTo(_cycle2.getOrder()));
return ret;
} | java | {
"resource": ""
} |
q18642 | Install.initialise | train | protected void initialise()
throws InstallationException
{
if (!this.initialised) {
this.initialised = true;
this.cache.clear();
AppDependency.initialise();
for (final FileType fileType : FileType.values()) {
if (fileType == FileType.XML) {
for (final InstallFile file : this.files) {
if (file.getType() == fileType) {
final SaxHandler handler = new SaxHandler();
try {
final IUpdate elem = handler.parse(file);
final List<IUpdate> list;
if (this.cache.containsKey(elem.getIdentifier())) {
list = this.cache.get(elem.getIdentifier());
} else {
list = new ArrayList<>();
this.cache.put(elem.getIdentifier(), list);
}
list.add(handler.getUpdate());
} catch (final SAXException e) {
throw new InstallationException("initialise()", e);
} catch (final IOException e) {
throw new InstallationException("initialise()", e);
}
}
}
} else {
for (final Class<? extends IUpdate> updateClass : fileType.getClazzes()) {
Method method = null;
try {
method = updateClass.getMethod("readFile", InstallFile.class);
} catch (final SecurityException e) {
throw new InstallationException("initialise()", e);
} catch (final NoSuchMethodException e) {
throw new InstallationException("initialise()", e);
}
for (final InstallFile file : this.files) {
if (file.getType() == fileType) {
Object obj = null;
try {
obj = method.invoke(null, file);
} catch (final IllegalArgumentException e) {
throw new InstallationException("initialise()", e);
} catch (final IllegalAccessException e) {
throw new InstallationException("initialise()", e);
} catch (final InvocationTargetException e) {
throw new InstallationException("initialise()", e);
}
if (obj != null && obj instanceof IUpdate) {
final IUpdate iUpdate = (IUpdate) obj;
final List<IUpdate> list;
if (this.cache.containsKey(iUpdate.getIdentifier())) {
list = this.cache.get(iUpdate.getIdentifier());
} else {
list = new ArrayList<>();
this.cache.put(iUpdate.getIdentifier(), list);
}
list.add(iUpdate);
}
}
}
}
}
}
}
} | java | {
"resource": ""
} |
q18643 | Line.set | train | public void set(boolean index, double x, double y) {
this.MODE = LINES;
if (index == true) {
this.x1 = x;
this.y1 = y;
} else {
this.x2 = x;
this.y2 = y;
}
calcG();
dx[0] = x1 - this.x;
dx[1] = x2 - this.x;
dy[0] = y1 - this.y;
dy[1] = y2 - this.y;
dz[0] = z1 - 0;
dz[1] = z2 - 0;
if (dashed) calcDashedLine();
} | java | {
"resource": ""
} |
q18644 | Line.setDashedLinePram | train | public void setDashedLinePram(double length, double interval) {
this.dashedLineLength = length;
this.dashedLineInterval = interval;
this.dashed = true;
calcDashedLine();
} | java | {
"resource": ""
} |
q18645 | Line.getCorner | train | public Vector3D getCorner(int index) {
Vector3D v = new Vector3D();
if (index <= 0)
v.set(x1, y1, z1);
else
v.set(x2, y2, z2);
return v;
} | java | {
"resource": ""
} |
q18646 | ValueList.getValueList | train | public String getValueList()
{
final StringBuffer buf = new StringBuffer();
for (final Token token : this.tokens) {
switch (token.type) {
case EXPRESSION:
buf.append("$<").append(token.value).append(">");
break;
case TEXT:
buf.append(token.value);
break;
default:
break;
}
}
return buf.toString();
} | java | {
"resource": ""
} |
q18647 | ValueList.addExpression | train | public void addExpression(final String _expression)
{
this.tokens.add(new Token(ValueList.TokenType.EXPRESSION, _expression));
getExpressions().add(_expression);
} | java | {
"resource": ""
} |
q18648 | ValueList.addText | train | public void addText(final String _text)
{
this.tokens.add(new Token(ValueList.TokenType.TEXT, _text));
} | java | {
"resource": ""
} |
q18649 | ValueList.makeSelect | train | public void makeSelect(final AbstractPrintQuery _print)
throws EFapsException
{
for (final String expression : getExpressions()) {
// TODO remove, only selects allowed
if (_print.getMainType().getAttributes().containsKey(expression)) {
_print.addAttribute(expression);
ValueList.LOG.warn(
"The arguments for ValueList must only contain selects. Invalid: '{}' for ValueList: {}",
expression, getValueList());
} else if (expression.contains("[") || expression.equals(expression.toLowerCase())) {
_print.addSelect(expression);
} else {
ValueList.LOG.warn(
"The arguments for ValueList must only contain selects. Invalid: '{}' for ValueList: {}",
expression, getValueList());
}
}
} | java | {
"resource": ""
} |
q18650 | ValueList.makeString | train | public String makeString(final Instance _callInstance,
final AbstractPrintQuery _print,
final TargetMode _mode)
throws EFapsException
{
final StringBuilder buf = new StringBuilder();
for (final Token token : this.tokens) {
switch (token.type) {
case EXPRESSION:
Attribute attr = null;
Object value = null;
if (_print.getMainType().getAttributes().containsKey(token.value)) {
attr = _print.getAttribute4Attribute(token.value);
value = _print.getAttribute(token.value);
} else {
attr = _print.getAttribute4Select(token.value);
value = _print.getSelect(token.value);
}
if (attr != null) {
buf.append(attr.getAttributeType().getUIProvider().getStringValue(
UIValue.get(null, attr, value)));
} else if (value != null) {
buf.append(value);
}
break;
case TEXT:
buf.append(token.value);
break;
default:
break;
}
}
return buf.toString();
} | java | {
"resource": ""
} |
q18651 | FileUtil.moveFile | train | public static void moveFile(File src, File dest) throws IOException {
copyFile(src, dest);
if (!delete(src)) {
throw new IOException("Failed to delete the src file '" + src + "' after copying.");
}
} | java | {
"resource": ""
} |
q18652 | FileUtil.copyFile | train | public static void copyFile(File src, File dest) throws IOException {
if (src == null)
throw new NullPointerException("Source must not be null");
if (dest == null)
throw new NullPointerException("Destination must not be null");
if (!src.exists())
throw new FileNotFoundException("Source '" + src + "' does not exist");
if (!src.isFile())
throw new IOException("Source '" + src + "' is not a file");
if (dest.exists())
throw new IOException("Destination '" + dest + "' is already exists");
FileChannel in = null, out = null;
try {
in = new FileInputStream(src).getChannel();
out = new FileOutputStream(dest).getChannel();
in.transferTo(0, in.size(), out);
} finally {
try {
in.close();
out.close();
} catch (IOException e) {
// Ignore.
}
}
if (src.length() != dest.length()) {
throw new IOException("Failed to copy full contents from '" +
src + "' to '" + dest + "'");
}
dest.setLastModified(src.lastModified());
} | java | {
"resource": ""
} |
q18653 | FileUtil.delete | train | public static boolean delete(File file) {
if (file == null) {
return false;
} else if (!file.isFile()) {
return false;
}
return file.delete();
} | java | {
"resource": ""
} |
q18654 | FileUtil.exist | train | public static boolean exist(String filePath) {
File f = new File(filePath);
if( !f.isFile() ) {
return false;
}
return true;
} | java | {
"resource": ""
} |
q18655 | FileUtil.getSuffix | train | public static String getSuffix(File file) {
String filename = file.getName();
int index = filename.lastIndexOf(".");
if (index != -1) {
return filename.substring(index + 1);
}
return filename;
} | java | {
"resource": ""
} |
q18656 | FileUtil.searchFilePath | train | public static String searchFilePath(String fileName) {
java.io.File dir = new java.io.File(System.getProperty("user.dir"));
return recursiveSearch(dir, fileName);
} | java | {
"resource": ""
} |
q18657 | FileUtil.recursiveSearch | train | private static String recursiveSearch(java.io.File dir, String fileName) {
for (String name : dir.list()) {
java.io.File file = new java.io.File(dir.getAbsolutePath() + "/" + name);
if (name.compareTo(fileName) == 0) return file.getAbsolutePath();
if (file.isDirectory()) {
String filePath = recursiveSearch(file, fileName);
if (filePath != null) return filePath;
}
}
return null;
} | java | {
"resource": ""
} |
q18658 | FileUtil.touch | train | public static void touch(File file) throws FileNotFoundException {
if (!file.exists()) {
OutputStream out = new FileOutputStream(file);
try {
out.close();
} catch (IOException e) {
// Ignore.
}
}
file.setLastModified(System.currentTimeMillis());
} | java | {
"resource": ""
} |
q18659 | CIType.isType | train | public boolean isType(final org.efaps.admin.datamodel.Type _type)
{
return getType().equals(_type);
} | java | {
"resource": ""
} |
q18660 | Texture.rotation | train | public void rotation(TextureRotationMode mode){
float[][] tmp = corner.clone();
switch (mode) {
case HALF:
corner[0] = tmp[2];
corner[1] = tmp[3];
corner[2] = tmp[0];
corner[3] = tmp[1];
break;
case CLOCKWIZE:
corner[0] = tmp[3];
corner[1] = tmp[0];
corner[2] = tmp[1];
corner[3] = tmp[2];
break;
case COUNTERCLOCKWIZE:
corner[0] = tmp[1];
corner[1] = tmp[2];
corner[2] = tmp[3];
corner[3] = tmp[0];
break;
default:
break;
}
} | java | {
"resource": ""
} |
q18661 | Texture.flip | train | public void flip(TextureFlipMode mode){
float[][] tmp = corner.clone();
switch (mode) {
case VERTICAL:
corner[0] = tmp[1];
corner[1] = tmp[0];
corner[2] = tmp[3];
corner[3] = tmp[2];
break;
case HORIZONTAL:
corner[0] = tmp[3];
corner[1] = tmp[2];
corner[2] = tmp[1];
corner[3] = tmp[0];
break;
default:
break;
}
} | java | {
"resource": ""
} |
q18662 | Select.addObject | train | public void addObject(final Object[] _row)
throws EFapsException
{
this.objects.add(this.elements.get(0).getObject(_row));
} | java | {
"resource": ""
} |
q18663 | Dependency.resolve | train | public void resolve()
throws InstallationException
{
final IvySettings ivySettings = new IvySettings();
try {
ivySettings.load(this.getClass().getResource("/org/efaps/update/version/ivy.xml"));
} catch (final IOException e) {
throw new InstallationException("IVY setting file could not be read", e);
} catch (final ParseException e) {
throw new InstallationException("IVY setting file could not be parsed", e);
}
final Ivy ivy = Ivy.newInstance(ivySettings);
ivy.getLoggerEngine().pushLogger(new IvyOverSLF4JLogger());
final Map<String, String> attr = new HashMap<String, String>();
attr.put("changing", "true");
final ModuleRevisionId modRevId = ModuleRevisionId.newInstance(this.groupId,
this.artifactId,
this.version,
attr);
final ResolveOptions options = new ResolveOptions();
options.setConfs(new String[] {"runtime"});
final ResolvedModuleRevision resModRev = ivy.findModule(modRevId);
Artifact dw = null;
for (final Artifact artifact : resModRev.getDescriptor().getAllArtifacts()) {
if ("jar".equals(artifact.getType())) {
dw = artifact;
break;
}
}
final DownloadOptions dwOptions = new DownloadOptions();
final ArtifactOrigin ao = resModRev.getArtifactResolver().locate(dw);
resModRev.getArtifactResolver().getRepositoryCacheManager().clean();
final ArtifactDownloadReport adw = resModRev.getArtifactResolver().download(ao, dwOptions);
this.jarFile = adw.getLocalFile();
} | java | {
"resource": ""
} |
q18664 | JasperReportCompiler.compileJasperReport | train | private void compileJasperReport(final Instance _instSource,
final Instance _instCompiled)
throws EFapsException
{
// make the classPath
final String sep = System.getProperty("os.name").startsWith("Windows") ? ";" : ":";
final StringBuilder classPath = new StringBuilder();
for (final String classPathElement : this.classPathElements) {
classPath.append(classPathElement).append(sep);
}
final DefaultJasperReportsContext reportContext = DefaultJasperReportsContext.getInstance();
reportContext.setProperty(JRCompiler.COMPILER_CLASSPATH, classPath.toString());
reportContext.setProperty("net.sf.jasperreports.compiler.groovy", JasperGroovyCompiler.class.getName());
reportContext.setProperty("net.sf.jasperreports.query.executer.factory.eFaps",
FakeQueryExecuterFactory.class.getName());
try {
final JasperDesign jasperDesign = JasperUtil.getJasperDesign(_instSource);
// the fault value for the language is no information but the used compiler needs a value,
// therefore it must be set explicitly
if (jasperDesign.getLanguage() == null) {
jasperDesign.setLanguage(JRReport.LANGUAGE_JAVA);
}
final ByteArrayOutputStream out = new ByteArrayOutputStream();
JasperCompileManager.compileReportToStream(jasperDesign, out);
final ByteArrayInputStream in = new ByteArrayInputStream(out.toByteArray());
final Checkin checkin = new Checkin(_instCompiled);
checkin.executeWithoutAccessCheck(jasperDesign.getName() + ".jasper", in, in.available());
out.close();
in.close();
} catch (final JRException e) {
throw new EFapsException(JasperReportCompiler.class, "JRException", e);
} catch (final IOException e) {
throw new EFapsException(JasperReportCompiler.class, "IOException", e);
}
} | java | {
"resource": ""
} |
q18665 | RestEQLInvoker.registerEQLStmt | train | protected void registerEQLStmt(final String _origin,
final String _stmt)
throws EFapsException
{
// Common_HistoryEQL
final Insert insert = new Insert(UUID.fromString("c96c63b5-2d4c-4bf9-9627-f335fd9c7a84"));
insert.add("Origin", "REST: " + (_origin == null ? "" : _origin));
insert.add("EQLStatement", _stmt);
insert.execute();
} | java | {
"resource": ""
} |
q18666 | EsjpValueSelect.getValue | train | @Override
public Object getValue(final Object _object)
throws EFapsException
{
final Instance inst = (Instance) super.getValue(_object);
if (this.esjp == null) {
try {
final Class<?> clazz = Class.forName(this.className, false, EFapsClassLoader.getInstance());
this.esjp = (IEsjpSelect) clazz.newInstance();
final List<Instance> instances = new ArrayList<>();
for (final Object obj : getOneSelect().getObjectList()) {
instances.add((Instance) super.getValue(obj));
}
if (this.parameters.isEmpty()) {
this.esjp.initialize(instances);
} else {
this.esjp.initialize(instances, this.parameters.toArray(new String[this.parameters.size()]));
}
} catch (final ClassNotFoundException | InstantiationException | IllegalAccessException e) {
LOG.error("Catched error", e);
}
}
return this.esjp.getValue(inst);
} | java | {
"resource": ""
} |
q18667 | AbstractStaticSourceImporter.evalApplication | train | @Override
protected String evalApplication()
{
String ret = null;
final Pattern revisionPattern = Pattern.compile("@eFapsApplication[\\s].*");
final Matcher revisionMatcher = revisionPattern.matcher(getCode());
if (revisionMatcher.find()) {
ret = revisionMatcher.group().replaceFirst("^@eFapsApplication", "");
}
return ret == null ? null : ret.trim();
} | java | {
"resource": ""
} |
q18668 | AbstractStaticSourceImporter.evalUUID | train | @Override
protected UUID evalUUID()
{
UUID uuid = null;
final Pattern uuidPattern = Pattern.compile("@eFapsUUID[\\s]*[0-9a-z\\-]*");
final Matcher uuidMatcher = uuidPattern.matcher(getCode());
if (uuidMatcher.find()) {
final String uuidStr = uuidMatcher.group().replaceFirst("^@eFapsUUID", "");
uuid = UUID.fromString(uuidStr.trim());
}
return uuid;
} | java | {
"resource": ""
} |
q18669 | AbstractStaticSourceImporter.evalExtends | train | protected String evalExtends()
{
String ret = null;
// regular expression for the package name
final Pattern exPattern = Pattern.compile("@eFapsExtends[\\s]*[a-zA-Z\\._-]*\\b");
final Matcher exMatcher = exPattern.matcher(getCode());
if (exMatcher.find()) {
ret = exMatcher.group().replaceFirst("^@eFapsExtends", "");
}
return ret == null ? null : ret.trim();
} | java | {
"resource": ""
} |
q18670 | Graphics.setBackground | train | public void setBackground(float x, float y, float z, float a) {
gl.glClearColor(x / 255, y / 255, z / 255, a / 255);
} | java | {
"resource": ""
} |
q18671 | Graphics.setBackgroud | train | public void setBackgroud(Color color) {
gl.glClearColor((float)color.getRed(),
(float)color.getGreen(),
(float)color.getBlue(),
(float)(color.getAlpha() * getAlpha()));
} | java | {
"resource": ""
} |
q18672 | Graphics.matrixMode | train | public void matrixMode(MatrixMode mode) {
switch (mode) {
case PROJECTION:
gl.glMatrixMode(GL2.GL_PROJECTION);
break;
case MODELVIEW:
gl.glMatrixMode(GL2.GL_MODELVIEW);
break;
default:
break;
}
} | java | {
"resource": ""
} |
q18673 | Graphics.setAmbientLight | train | public void setAmbientLight(float r, float g, float b) {
float ambient[] = { r, g, b, 255 };
normalize(ambient);
gl.glEnable(GL2.GL_LIGHTING);
gl.glEnable(GL2.GL_LIGHT0);
gl.glLightfv(GL2.GL_LIGHT0, GL2.GL_AMBIENT, ambient, 0);
} | java | {
"resource": ""
} |
q18674 | Graphics.setAmbientLight | train | public void setAmbientLight(int i, Color color, boolean enableColor) {
float ambient[] = {
(float)color.getRed(),
(float)color.getGreen(),
(float)color.getBlue(),
(float)color.getAlpha()
};
gl.glEnable(GL2.GL_LIGHTING);
gl.glEnable(GL2.GL_LIGHT0 + i);
if(enableColor)
gl.glLightfv(GL2.GL_LIGHT0 + i, GL2.GL_AMBIENT, ambient, 0);
} | java | {
"resource": ""
} |
q18675 | Graphics.setAmbientLight | train | public void setAmbientLight(int i, Color color, boolean enableColor, Vector3D v) {
float ambient[] = {
(float)color.getRed(),
(float)color.getGreen(),
(float)color.getBlue(),
(float)color.getAlpha()
};
float position[] = { (float)v.getX(), (float)v.getY(), (float)v.getZ(), 1.0f };
gl.glEnable(GL2.GL_LIGHTING);
gl.glEnable(GL2.GL_LIGHT0 + i);
gl.glLightfv(GL2.GL_LIGHT0 + i, GL2.GL_POSITION, position, 0);
if(enableColor)
gl.glLightfv(GL2.GL_LIGHT0 + i, GL2.GL_AMBIENT, ambient, 0);
} | java | {
"resource": ""
} |
q18676 | Graphics.setSpotLight | train | public void setSpotLight(int i, Color color, boolean enableColor, Vector3D v, float nx, float ny, float nz, float angle) {
float spotColor[] = {
(float)color.getRed(),
(float)color.getGreen(),
(float)color.getBlue(),
(float)color.getAlpha()
};
float pos[] = {
(float)v.getX(),
(float)v.getY(),
(float)v.getZ(),
0.0f
};
float direction[] = { nx, ny, nz };
float a[] = { angle };
gl.glEnable(GL2.GL_LIGHTING);
gl.glEnable(GL2.GL_LIGHT0 + i);
gl.glLightfv(GL2.GL_LIGHT0 + i, GL2.GL_POSITION, pos, 0);
if(enableColor)
gl.glLightfv(GL2.GL_LIGHT0 + i, GL2.GL_DIFFUSE, spotColor, 0);
gl.glLightfv(GL2.GL_LIGHT0 + i, GL2.GL_SPOT_DIRECTION, direction, 0);
gl.glLightfv(GL2.GL_LIGHT0 + i, GL2.GL_SPOT_CUTOFF, a, 0);
} | java | {
"resource": ""
} |
q18677 | Graphics.setLightAttenuation | train | public void setLightAttenuation(int i, float constant, float liner, float quadratic) {
float c[] = { constant };
float l[] = { liner };
float q[] = { quadratic };
gl.glEnable(GL2.GL_LIGHTING);
gl.glEnable(GL2.GL_LIGHT0 + i);
gl.glLightfv(GL2.GL_LIGHT0 + i, GL2.GL_CONSTANT_ATTENUATION, c, 0);
gl.glLightfv(GL2.GL_LIGHT0 + i, GL2.GL_LINEAR_ATTENUATION, l, 0);
gl.glLightfv(GL2.GL_LIGHT0 + i, GL2.GL_QUADRATIC_ATTENUATION, q, 0);
} | java | {
"resource": ""
} |
q18678 | Graphics.setLightSpecular | train | public void setLightSpecular(int i, Color color) {
float[] tmpColor = {
(float)color.getRed(),
(float)color.getGreen(),
(float)color.getBlue(),
(float)color.getAlpha()
};
gl.glLightfv(GL2.GL_LIGHT0 + i, GL2.GL_SPECULAR, tmpColor, 0);
} | java | {
"resource": ""
} |
q18679 | Graphics.setLightDiffuse | train | public void setLightDiffuse(int i, Color color) {
float[] tmpColor = {
(float)color.getRed(),
(float)color.getGreen(),
(float)color.getBlue(),
(float)color.getAlpha()
};
gl.glLightfv(GL2.GL_LIGHT0 + i, GL2.GL_DIFFUSE, tmpColor, 0);
} | java | {
"resource": ""
} |
q18680 | Graphics.normalize | train | private static float[] normalize(float[] in) {
float[] out = new float[in.length];
for (int i = 0; i < in.length; i++) {
out[i] = (in[i] / 255.0f);
}
return out;
} | java | {
"resource": ""
} |
q18681 | Graphics.setPerspective | train | public void setPerspective(double fov, double aspect, double zNear, double zFar) {
matrixMode(MatrixMode.PROJECTION);
resetMatrix();
glu.gluPerspective(fov, aspect, zNear, zFar);
matrixMode(MatrixMode.MODELVIEW);
resetMatrix();
} | java | {
"resource": ""
} |
q18682 | Graphics.setPerspective | train | public void setPerspective() {
double cameraZ = ((height / 2.0) / Math.tan(Math.PI * 60.0 / 360.0));
matrixMode(MatrixMode.PROJECTION);
resetMatrix();
glu.gluPerspective(Math.PI / 3.0, this.width
/ this.height, cameraZ / 10.0, cameraZ * 10.0);
matrixMode(MatrixMode.MODELVIEW);
resetMatrix();
} | java | {
"resource": ""
} |
q18683 | Graphics.setOrtho | train | public void setOrtho(double left, double right, double bottom, double top,
double near, double far) {
matrixMode(MatrixMode.PROJECTION);
resetMatrix();
gl.glOrtho(left, right, bottom, top, near, far);
matrixMode(MatrixMode.MODELVIEW);
resetMatrix();
} | java | {
"resource": ""
} |
q18684 | Graphics.setOrtho | train | public void setOrtho() {
matrixMode(MatrixMode.PROJECTION);
resetMatrix();
gl.glOrtho(0, this.width, 0, this.height, -1.0e10, 1.0e10);
matrixMode(MatrixMode.MODELVIEW);
resetMatrix();
} | java | {
"resource": ""
} |
q18685 | Graphics.setFrustum | train | public void setFrustum(double left, double right, double bottom, double top,
double near, double far) {
matrixMode(MatrixMode.PROJECTION);
resetMatrix();
gl.glFrustum(left, right, bottom, top, near, far);
matrixMode(MatrixMode.MODELVIEW);
resetMatrix();
} | java | {
"resource": ""
} |
q18686 | Graphics.setCamera | train | public void setCamera() {
glu.gluLookAt(width / 2.0, height / 2.0,
(height / 2.0) / Math.tan(Math.PI * 60.0 / 360.0), width / 2.0,
height / 2.0, 0, 0, 1, 0);
} | java | {
"resource": ""
} |
q18687 | PermissionSet.getKey | train | public Key getKey()
{
final Key ret = new Key().setPersonId(getPersonId())
.setCompanyId(getCompanyId())
.setTypeId(getTypeId());
return ret;
} | java | {
"resource": ""
} |
q18688 | URLTemplateSource.getTag | train | @Override
public String getTag() throws IOException {
URLConnection urlConnection = url.openConnection();
String tag = urlConnection.getHeaderField(ETAG);
if(tag == null) {
String key = url.toString() + "@" + urlConnection.getLastModified();
tag = md5Cache.getIfPresent(key);
if(tag == null) {
try(InputStream urlStream = urlConnection.getInputStream()) {
byte[] data = ByteStreams.toByteArray(urlConnection.getInputStream());
tag = Hashing.md5().hashBytes(data).toString();
md5Cache.put(key, tag);
}
}
}
return tag;
} | java | {
"resource": ""
} |
q18689 | RegistrationBindingHandler.getSuppliers | train | private List<Pair<Id, GuiceSupplier>> getSuppliers() {
ImmutableList.Builder<Pair<Id, GuiceSupplier>> suppliersBuilder = ImmutableList.builder();
for (Binding<GuiceRegistration> registrationBinding : injector.findBindingsByType(TypeLiteral.get(GuiceRegistration.class))) {
Key<?> key = registrationBinding.getProvider().get().key();
suppliersBuilder.add(newPair(key));
}
return suppliersBuilder.build();
} | java | {
"resource": ""
} |
q18690 | SQLSelect.column | train | public SQLSelect column(final String _name)
{
columns.add(new Column(tablePrefix, null, _name));
return this;
} | java | {
"resource": ""
} |
q18691 | SQLSelect.columnIndex | train | public int columnIndex(final int _tableIndex, final String _columnName)
{
final Optional<Column> colOpt = getColumns().stream()
.filter(column -> column.tableIndex == _tableIndex && column.columnName.equals(_columnName))
.findFirst();
final int ret;
if (colOpt.isPresent()) {
ret = getColumns().indexOf(colOpt.get());
} else {
columns.add(new Column(tablePrefix, _tableIndex, _columnName));
ret = getColumnIdx();
}
return ret;
} | java | {
"resource": ""
} |
q18692 | SQLSelect.getSQL | train | public String getSQL()
{
final StringBuilder cmd = new StringBuilder().append(" ")
.append(Context.getDbType().getSQLPart(SQLPart.SELECT)).append(" ");
if (distinct) {
cmd.append(Context.getDbType().getSQLPart(SQLPart.DISTINCT)).append(" ");
}
boolean first = true;
for (final Column column : columns) {
if (first) {
first = false;
} else {
cmd.append(Context.getDbType().getSQLPart(SQLPart.COMMA));
}
column.appendSQL(cmd);
}
cmd.append(" ").append(Context.getDbType().getSQLPart(SQLPart.FROM)).append(" ");
first = true;
for (final FromTable fromTable : fromTables) {
fromTable.appendSQL(first, cmd);
if (first) {
first = false;
}
}
cmd.append(" ");
boolean whereAdded = false;
for (final SQLSelectPart part : parts) {
part.appendSQL(cmd);
cmd.append(" ");
whereAdded = whereAdded || !whereAdded && SQLPart.WHERE.equals(part.sqlpart);
}
if (where != null) {
where.setStarted(whereAdded);
where.appendSQL(tablePrefix, cmd);
}
if (order != null) {
order.appendSQL(tablePrefix, cmd);
}
return cmd.toString();
} | java | {
"resource": ""
} |
q18693 | SQLSelect.addColumnPart | train | public SQLSelect addColumnPart(final Integer _tableIndex,
final String _columnName)
{
parts.add(new Column(tablePrefix, _tableIndex, _columnName));
return this;
} | java | {
"resource": ""
} |
q18694 | SQLSelect.addTablePart | train | public SQLSelect addTablePart(final String _tableName,
final Integer _tableIndex)
{
parts.add(new FromTable(tablePrefix, _tableName, _tableIndex));
return this;
} | java | {
"resource": ""
} |
q18695 | SQLSelect.addTimestampValue | train | public SQLSelect addTimestampValue(final String _isoDateTime)
{
parts.add(new Value(Context.getDbType().getTimestampValue(_isoDateTime)));
return this;
} | java | {
"resource": ""
} |
q18696 | CachedPrintQuery.get4Request | train | public static CachedPrintQuery get4Request(final Instance _instance)
throws EFapsException
{
return new CachedPrintQuery(_instance, Context.getThreadContext().getRequestId()).setLifespan(5)
.setLifespanUnit(TimeUnit.MINUTES);
} | java | {
"resource": ""
} |
q18697 | OwnerLinkType.prepare | train | @Override
protected void prepare(final AbstractSQLInsertUpdate<?> _insertUpdate,
final Attribute _attribute,
final Object... _values)
throws SQLException
{
checkSQLColumnSize(_attribute, 1);
try {
_insertUpdate.column(_attribute.getSqlColNames().get(0),
Context.getThreadContext().getPerson().getId());
} catch (final EFapsException e) {
throw new SQLException("could not fetch current context person id", e);
}
} | java | {
"resource": ""
} |
q18698 | AbstractDatabase.addMapping | train | protected void addMapping(final ColumnType _columnType,
final String _writeTypeName,
final String _nullValueSelect,
final String... _readTypeNames)
{
this.writeColTypeMap.put(_columnType, _writeTypeName);
this.nullValueColTypeMap.put(_columnType, _nullValueSelect);
for (final String readTypeName : _readTypeNames) {
Set<AbstractDatabase.ColumnType> colTypes = this.readColTypeMap.get(readTypeName);
if (colTypes == null) {
colTypes = new HashSet<>();
this.readColTypeMap.put(readTypeName, colTypes);
}
colTypes.add(_columnType);
}
} | java | {
"resource": ""
} |
q18699 | AbstractDatabase.existsView | train | public boolean existsView(final Connection _con,
final String _viewName)
throws SQLException
{
boolean ret = false;
final DatabaseMetaData metaData = _con.getMetaData();
// first test with lower case
final ResultSet rs = metaData.getTables(null, null, _viewName.toLowerCase(), new String[] { "VIEW" });
if (rs.next()) {
ret = true;
}
rs.close();
// then test with upper case
if (!ret) {
final ResultSet rsUC = metaData.getTables(null, null, _viewName.toUpperCase(), new String[] { "VIEW" });
if (rsUC.next()) {
ret = true;
}
rsUC.close();
}
return ret;
} | java | {
"resource": ""
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.