String sql = "UPDATE entity SET name = ?, value = ? WHERE id = ?"; // ... statement = connection.prepareStatement(sql); for (Entity entity : entities) { statement.setString(1, entity.getName()); statement.setInt(2, entity.getValue()); statement.setLong(3, entity.getId()); // ... statement.addBatch(); } statement.executeBatch(); // ...
public class Bean { private List<Entity> entities; private Map<Long, Boolean> checked = new HashMap<Long, Boolean>(); public void submit() { for (Entity entity : entities) { if (checked.get(entity.getId())) { // Entity is checked. Do your thing here. } } } // ... }
public String createPermissionsReference(String pageSpace) { // Page space is assumed to be a ppage space reference // Turn into an entity and then get a reference Reference ref = entityManager .newReference(RWikiObjectService.REFERENCE_ROOT + pageSpace + "."); //$NON-NLS-1$ return ref.getReference(); }
public String getContext(String ref) { return entityManager.newReference(ref).getContext(); }
public Object fetchEntity(String reference) { Object entity = null; try { // cannot test this in a meaningful way so the tests are designed to not get here -AZ entity = entityManager.newReference(reference).getEntity(); } catch (Exception e) { log.warn("Failed to look up reference '" + reference + "' to an entity in Sakai legacy entity system", e); } return entity; }
/** * Return the url unchanged, unless it's a reference, then return the reference url */ protected String convertReferenceUrl(String url) { // make a reference Reference ref = entityManager().newReference(url); // if it didn't recognize this, return it unchanged if (!ref.isKnownType()) return url; // return the reference's url return ref.getUrl(); }
/** * {@inheritDoc} * * @param rwo * @return */ public Reference getReference(RWikiObject rwo) { return entityManager.newReference(getEntity(rwo).getReference()); }
@Override public String getId() { return (reference != null) ? reference.getId() : null; }
private Reference getReference(String reference) { try { return entityManager.newReference(reference); } catch ( Exception ex ) { } return null; }
@Override public String getReference() { return (reference != null) ? reference.getReference() : null; }
/** * <b>NOTE VERY CAREFULLY</b> - current implementation of EntityManager ignores referenceRoot! * This will fail if this ever changes */ public void init() { entityManager.registerEntityProducer(this, "/"); }
/** * {@inheritDoc} */ public ResourceProperties getProperties(Entity entity) { return entity.getProperties(); }
/** * Access the attachments of the event. * * @return An copy of the set of attachments (a ReferenceVector containing Reference objects) (may be empty). */ public List getAttachments() { return m_entityManager.newReferenceList(m_attachments); } // getAttachments
@Override public ResourceProperties getProperties() { return (reference != null) ? reference.getProperties() : null; }
/** * Access the creator of this object. * * @return String The creator's user id. */ public String getCreator() { return m_properties.getProperty(ResourceProperties.PROP_CREATOR); }
for(Entity e : entities){ if(!e.isRight()) entityTypes[e.getId()].getAtlas().findRegion(e.getFrame()).flip(true, false); batch.draw(entityTypes[e.getId()].getAtlas().findRegion(e.getFrame()), e.getPosition().x, e.getPosition().y); if(!e.isRight()) entityTypes[e.getId()].getAtlas().findRegion(e.getFrame()).flip(true, false); }
private EntityProducer getProducer(Reference ref) { try { return ref.getEntityProducer(); } catch ( Exception ex ) { } return null; }
public boolean isConditionallyReleased() { try { return this.m_properties.getBooleanProperty(ConditionService.PROP_CONDITIONAL_RELEASE); } catch (EntityPropertyNotDefinedException e) { return false; } catch (EntityPropertyTypeException e) { return false; } }
/** * Access the attachments of the event. * * @return An copy of the set of attachments (a ReferenceVector containing Reference objects) (may be empty). */ public List getAttachments() { return m_entityManager.newReferenceList(m_attachments); } // getAttachments
/** * Access the person of last modificaiton * * @return the User's Id */ public String getAuthorLastModified() { return m_properties.getProperty(ResourceProperties.PROP_MODIFIED_BY); }