Example usage for java.lang Long longValue

List of usage examples for java.lang Long longValue

Introduction

In this page you can find the example usage for java.lang Long longValue.

Prototype

@HotSpotIntrinsicCandidate
public long longValue() 

Source Link

Document

Returns the value of this Long as a long value.

Usage

From source file:org.squale.squaleweb.applicationlayer.action.results.project.ProjectResultsAction.java

/**
 * Mise en place de la session pour le projet Les donnes concernant le projet sont places en session,  savoir le
 * formulaire du projet ainsi que le contenu du menu "Top"
 * /*w w w. j ava 2 s  .c  om*/
 * @param pProjectId id du projet
 * @param pRequest requte
 * @param pForm le form associ  l'action
 * @return form du projet ou null si erreur
 * @throws JrafEnterpriseException si erreur
 * @throws WTransformerException si erreur
 */
ProjectForm setupProject(Long pProjectId, HttpServletRequest pRequest, ActionForm pForm)
        throws JrafEnterpriseException, WTransformerException {
    ProjectForm project = null;
    // Rcupration de l'id de projet
    ComponentDTO dto = new ComponentDTO();
    dto.setID(pProjectId.longValue());
    IApplicationComponent ac = AccessDelegateHelper.getInstance("Component");
    Object[] paramIn = { dto };
    // Obtention du projet par la couche mtier
    dto = (ComponentDTO) ac.execute("get", paramIn);
    if (null != dto) {
        Object obj[] = { dto };
        project = (ProjectForm) WTransformerFactory.objToForm(ProjectTransformer.class, obj);
        ApplicationForm currentApplication = ActionUtils.getCurrentApplication(pRequest);
        // Mise  jour de l'application courante si besoin
        if (null == currentApplication || currentApplication.getId() != dto.getIDParent()) {
            ApplicationForm application = ActionUtils.getComponent(dto.getIDParent(),
                    getUserApplicationList(pRequest));
        }
        Object paramToTransform[] = { dto };
        // Cration du form pour afficher le composant
        ComponentForm projectCompForm = (ComponentForm) WTransformerFactory
                .objToForm(ComponentTransformer.class, paramToTransform);
        // on met  jour les valeurs concernant l'application et le projet
        // du componentForm qui va etre pass dans la requete
        projectCompForm.copyValues((ProjectSummaryForm) pForm);
        pRequest.setAttribute("componentForm", projectCompForm);
    }
    return project;
}

From source file:br.com.topsys.util.TSArrayUtil.java

/**
 * <p>/*from w  ww .  j  av  a  2s .c om*/
 * Converts an array of object Long to primitives handling <code>null</code>.
 * </p>
 * 
 * <p>
 * This method returns <code>null</code> if <code>null</code> array
 * input.
 * </p>
 * 
 * @param array
 *            a <code>Long</code> array, may be <code>null</code>
 * @param valueForNull
 *            the value to insert if <code>null</code> found
 * @return a <code>long</code> array, <code>null</code> if null array
 *         input
 */
public static long[] toPrimitive(final Long[] array, final long valueForNull) {
    if (array == null) {
        return null;
    } else if (array.length == 0) {
        return EMPTY_LONG_ARRAY;
    }
    final long[] result = new long[array.length];
    for (int i = 0; i < array.length; i++) {
        Long b = array[i];
        result[i] = (b == null ? valueForNull : b.longValue());
    }
    return result;
}

From source file:com.dotweblabs.twirl.gae.GaeUnmarshaller.java

private void doUnmarshall(Object destination, Transaction transaction, Entity entity) {
    //        Preconditions.checkNotNull(destination, "Destination object cannot be null");
    //        Preconditions.checkNotNull(entity, "Source entity cannot be null");
    assert validator.validate(destination) == true;

    Map<String, Object> props = entity.getProperties();
    Key key = entity.getKey();/* w w w .  j  a va  2  s  .  c  o  m*/
    String name = entity.getKey().getName();

    if (destination instanceof PrimitiveWrapper) {
        PrimitiveWrapper wrapper = (PrimitiveWrapper) destination;
        Object wrapped = wrapper.getValue();
        if (wrapped.getClass().isPrimitive() || wrapped.getClass().equals(String.class)
                || wrapped.getClass().equals(Integer.class) || wrapped.getClass().equals(Long.class)
                || wrapped.getClass().equals(Double.class) || wrapped.getClass().equals(Float.class)
                || wrapped.getClass().equals(Boolean.class)) {
            if (entity.getProperties().size() > 1) {
                LOG.warn(
                        "Unmarshalling entity with multiple properties into primitive type will be serialized");
                // TODO: Implement XStream serializer
                throw new RuntimeException(
                        "Serializing multiple properties into primitives not yet implemented");
            } else if (entity.getProperties().size() == 1) {
                String entityKey = entity.getProperties().keySet().iterator().next();
                wrapper.setValue(entity.getProperty(entityKey));
            }
        }
        return;
    } else if (destination instanceof Map) {
        Iterator<Map.Entry<String, Object>> it = entity.getProperties().entrySet().iterator();
        while (it.hasNext()) {
            Map.Entry<String, Object> entry = it.next();
            String entryKey = entry.getKey();
            Object entryVal = entry.getValue();
            if (entryVal instanceof EmbeddedEntity) {
                EmbeddedEntity ee = (EmbeddedEntity) entryVal;
                Object mapOrList = GaeMarshaller.getMapOrList(ee);
                ((Map) destination).put(entryKey, mapOrList);
            } else {
                ((Map) destination).put(entryKey, entryVal);
            }
        }
        ((Map) destination).put(Entity.KEY_RESERVED_PROPERTY, key.getName());
        return;
    }

    AnnotatedField parentKeyField = AnnotationUtil.getFieldWithAnnotation(GaeObjectStore.parent(), destination);
    if (parentKeyField != null) {
        if (parentKeyField.getFieldType().equals(Key.class)) {
            parentKeyField.setFieldValue(entity.getParent());
        } else {
            //                throw new RuntimeException("Only GAE Key can be used as @Ancestor");
        }
    }

    AnnotatedField ancestorKeyField = AnnotationUtil.getFieldWithAnnotation(GaeObjectStore.ancestor(),
            destination);
    if (ancestorKeyField != null) {
        if (ancestorKeyField.getFieldType().equals(Key.class)) {
            ancestorKeyField.setFieldValue(getAncestor(entity));
        } else {
            throw new RuntimeException("Only GAE Key can be used as @Ancestor");
        }
    }

    AnnotatedField idField = AnnotationUtil.getFieldWithAnnotation(GaeObjectStore.key(), destination);
    if (idField != null) {
        if (idField.getFieldType().equals(String.class)) {
            idField.setFieldValue(key.getName());
        } else if (idField.getFieldType().equals(Long.class)) {
            idField.setFieldValue(key.getId());
        } else if (idField.getFieldType().equals(long.class)) {
            idField.setFieldValue(key.getId());
        } else {
            throw new RuntimeException("Invalid key was retrieved with type " + idField.getFieldType());
        }
    }

    AnnotatedField objectIdField = AnnotationUtil.getFieldWithAnnotation(GaeObjectStore.objectId(),
            destination);
    if (objectIdField != null) {
        if (objectIdField.getFieldType().equals(String.class)) {
            String objectId = KeyFactory.keyToString(key);
            objectIdField.setFieldValue(objectId);
        } else {
            throw new RuntimeException(
                    "Invalid ObjectId key was retrieved with type " + objectIdField.getFieldType());
        }
    }

    AnnotatedField kindField = AnnotationUtil.getFieldWithAnnotation(GaeObjectStore.kind(), destination);
    if (kindField != null) {
        if (kindField.getFieldType().equals(String.class)) {
            kindField.setFieldValue(entity.getKind());
        } else {
            throw new RuntimeException("Invalid @Kind field is found for " + destination.getClass().getName());
        }
    }

    AnnotatedField flatField = AnnotationUtil.getFieldWithAnnotation(Flat.class, destination);
    if (flatField != null) {
        if (flatField.getFieldType().equals(Map.class)) {
            Iterator<Map.Entry<String, Object>> it = props.entrySet().iterator();
            Map map = new LinkedHashMap();
            while (it.hasNext()) {
                Map.Entry<String, Object> entry = it.next();
                String fieldName = entry.getKey();
                Object fieldValue = entry.getValue();
                // TODO: How about when by change a Map key would be the same with the POJO field name
                // TODO: Fix this or do not allow that to happen!
                boolean ok = true;
                Field[] fields = destination.getClass().getDeclaredFields();
                for (Field field : list(fields)) {
                    if (field.getName().equals(fieldName)) {
                        ok = false;
                    }
                }
                if (ok) {
                    if (fieldValue instanceof EmbeddedEntity) {
                        Map m = getMapFromEmbeddedEntity((EmbeddedEntity) fieldValue);
                        fieldValue = m;
                    }
                    map.put(fieldName, fieldValue);
                }
            }
            Field field = flatField.getField();
            setFieldValue(field, destination, map);
        } else {
            throw new RuntimeException("Only java.util.Map should be used for @Flat fields");
        }

    }

    Iterator<Map.Entry<String, Object>> it = props.entrySet().iterator();
    Class<?> clazz = destination.getClass();
    List<Field> fields = list(clazz.getDeclaredFields());

    while (it.hasNext()) {
        Map.Entry<String, Object> entry = it.next();
        String fieldName = entry.getKey();
        Object fieldValue = entry.getValue();
        try {
            for (Field field : fields) {
                if (field.getName().equals(fieldName)) {
                    if (fieldValue == null) {
                        setFieldValue(field, destination, fieldValue);
                    } else if (fieldValue instanceof Key) { // child
                        try {
                            Entity e = store.getDatastoreService()
                                    .get((com.google.appengine.api.datastore.Key) fieldValue);
                            AnnotatedField annotatedField = AnnotationUtil
                                    .getFieldWithAnnotation(GaeObjectStore.child(), destination);
                            Object childInstance = store.createInstance(annotatedField.getFieldType());
                            unmarshall(childInstance, e);
                            setFieldValue(field, destination, childInstance);
                        } catch (EntityNotFoundException e) {
                            fieldValue = null;
                        }
                    } else if (fieldValue instanceof String || fieldValue instanceof Boolean
                            || fieldValue instanceof Number || fieldValue instanceof Blob) {
                        if (field.getName().equals(fieldName)) {
                            if (field.getType().isEnum()) {
                                setFieldValue(field, destination,
                                        Enum.valueOf((Class<Enum>) field.getType(), (String) fieldValue));
                            }
                            if (field.getType().equals(String.class)) {
                                setFieldValue(field, destination, String.valueOf(fieldValue));
                            } else if (field.getType().equals(Boolean.class)) {
                                setFieldValue(field, destination, (Boolean) fieldValue);
                            } else if (field.getType().equals(Long.class)) {
                                setFieldValue(field, destination, (Long) fieldValue);
                            } else if (field.getType().equals(Integer.class)) {
                                if (fieldValue.getClass().equals(Long.class)) {
                                    Long value = (Long) fieldValue;
                                    setFieldValue(field, destination, value.intValue());
                                } else {
                                    setFieldValue(field, destination, (Integer) fieldValue);
                                }
                            } else if (field.getType().equals(int.class)) {
                                if (fieldValue.getClass().equals(Long.class)
                                        || fieldValue.getClass().equals(long.class)) {
                                    Long value = (Long) fieldValue;
                                    setFieldValue(field, destination, value.intValue());
                                } else {
                                    setFieldValue(field, destination, ((Integer) fieldValue).intValue());
                                }
                            } else if (field.getType().equals(long.class)) {
                                if (fieldValue.getClass().equals(Integer.class)
                                        || fieldValue.getClass().equals(int.class)) {
                                    Integer value = (Integer) fieldValue;
                                    setFieldValue(field, destination, value.longValue());
                                } else {
                                    setFieldValue(field, destination, ((Long) fieldValue).longValue());
                                }
                            } else if (field.getType().equals(boolean.class)) {
                                setFieldValue(field, destination, ((Boolean) fieldValue).booleanValue());
                            } else if (field.getType().equals(byte.class)) {
                                if (fieldValue.getClass().equals(Blob.class)) {
                                    // TODO: Need to have a second look with this code
                                    Blob blob = (Blob) fieldValue;
                                    setFieldValue(field, destination, blob.getBytes()[0]);
                                }
                            } else if (field.getType().equals(byte[].class)) {
                                if (fieldValue.getClass().equals(Blob.class)) {
                                    Blob blob = (Blob) fieldValue;
                                    setFieldValue(field, destination, blob.getBytes());
                                }
                            } else if (field.getType().equals(Date.class)) {
                                if (fieldValue.getClass().equals(String.class)) {
                                    Date date = DateUtil.parseDate((String) fieldValue);
                                    setFieldValue(field, destination, date);
                                } else if (fieldValue.getClass().equals(Long.class)) {
                                    Date date = new Date((Long) fieldValue);
                                    setFieldValue(field, destination, date);
                                } else if (fieldValue.getClass().equals(Date.class)) {
                                    setFieldValue(field, destination, fieldValue);
                                } else {
                                    throw new RuntimeException(
                                            "Unable to unmarshall " + fieldValue.getClass().getName() + " to "
                                                    + field.getType().getName());
                                }
                            } else if (field.getType().equals(Blob.class)) {
                                if (fieldValue.getClass().equals(Blob.class)) {
                                    Blob blob = (Blob) fieldValue;
                                    setFieldValue(field, destination, blob);
                                }
                            }
                        }
                    } else if (fieldValue instanceof Blob) {
                        setFieldValue(field, destination, fieldValue);
                    } else if (fieldValue instanceof Text) {
                        Text textField = (Text) fieldValue;
                        setFieldValue(field, destination, textField.getValue());
                    } else if (fieldValue instanceof Date) {
                        setFieldValue(field, destination, fieldValue);
                    } else if (fieldValue instanceof User) {
                        setFieldValue(field, destination, fieldValue);
                    } else if (fieldValue instanceof EmbeddedEntity) { // List or Java  primitive types and standard types, Map or  POJO's
                        Class<?> fieldValueType = fieldValue.getClass();
                        EmbeddedEntity ee = (EmbeddedEntity) fieldValue;
                        Map<String, Object> map = ee.getProperties();
                        store.createInstance(fieldValueType);
                        if (field.getType().equals(List.class) || field.getType().equals(Map.class)) {
                            Object mapOrList = getMapOrList((EmbeddedEntity) fieldValue);
                            setFieldValue(field, destination, mapOrList);
                        } else { // Must be a POJO
                            Map<String, Object> getMap = getMapFromEmbeddedEntity((EmbeddedEntity) fieldValue);
                            Object pojo = Maps.fromMap(getMap, field.getType());
                            setFieldValue(field, destination, pojo);
                        }
                    } else if (fieldValue instanceof GeoPt) {
                        setFieldValue(field, destination, fieldValue);
                    } else if (fieldValue instanceof List) {
                        setFieldValue(field, destination, fieldValue);
                    } else if (fieldValue.getClass().isPrimitive()) {
                        throw new RuntimeException("Not yet implemented");
                    }
                }
            }
        } catch (ClassCastException e) {
            if (fieldName != null && fieldValue != null) {
                LOG.error("Exception while unmarshalling GAE Entity field name=" + fieldName + " type="
                        + fieldValue.getClass().getName() + " value=" + fieldValue);
            }
            throw e;
        }
    }
    AnnotatedField aliasField = AnnotationUtil.getFieldWithAnnotation(Alias.class, destination);
    if (aliasField != null) {
        Alias alias = aliasField.getField().getAnnotation(Alias.class);
        String fieldName = alias.field();
        Object value = props.get(fieldName);

        String actualField = aliasField.getFieldName();
        Object actualValue = props.get(actualField);

        if (value != null) {
            setFieldValue(aliasField.getField(), destination, value);
        } else {
            setFieldValue(aliasField.getField(), destination, actualValue);
        }
    }
}

From source file:com.panet.imeta.job.Job.java

public boolean beginProcessing() throws KettleJobException {
    currentDate = new Date();
    logDate = new Date();
    startDate = Const.MIN_DATE;/* w  ww.j a  v a  2 s.c o  m*/
    endDate = currentDate;

    resetErrors();
    DatabaseMeta logcon = jobMeta.getLogConnection();
    if (logcon != null && !Const.isEmpty(jobMeta.getLogTable())) {
        Database ldb = new Database(logcon);
        ldb.shareVariablesWith(this);
        try {
            boolean lockedTable = false;
            ldb.connect();

            // Enable transactions to make table locking possible
            //
            ldb.setCommit(100);

            // See if we have to add a batch id...
            Long id_batch = new Long(1);
            if (jobMeta.isBatchIdUsed()) {
                // Make sure we lock that table to avoid concurrency issues
                //
                ldb.lockTables(new String[] { jobMeta.getLogTable(), });
                lockedTable = true;

                // Now insert value -1 to create a real write lock blocking
                // the other requests.. FCFS
                //
                String sql = "INSERT INTO " + logcon.quoteField(jobMeta.getLogTable()) + "("
                        + logcon.quoteField("ID_JOB") + ") values (-1)";
                ldb.execStatement(sql);

                // Now this next lookup will stall on the other connections
                //
                id_batch = ldb.getNextValue(null, jobMeta.getLogTable(), "ID_JOB");

                setBatchId(id_batch.longValue());
                if (getPassedBatchId() <= 0) {
                    setPassedBatchId(id_batch.longValue());
                }
            }

            Object[] lastr = ldb.getLastLogDate(jobMeta.getLogTable(), jobMeta.getName(), true,
                    Database.LOG_STATUS_END); // $NON-NLS-1$
            if (!Const.isEmpty(lastr)) {
                Date last;
                try {
                    last = ldb.getReturnRowMeta().getDate(lastr, 0);
                } catch (KettleValueException e) {
                    throw new KettleJobException(
                            Messages.getString("Job.Log.ConversionError", "" + jobMeta.getLogTable()), e);
                }
                if (last != null) {
                    startDate = last;
                }
            }

            depDate = currentDate;

            ldb.writeLogRecord(jobMeta.getLogTable(), jobMeta.isBatchIdUsed(), getBatchId(), true,
                    jobMeta.getName(), Database.LOG_STATUS_START, // $NON-NLS-1$
                    0L, 0L, 0L, 0L, 0L, 0L, startDate, endDate, logDate, depDate, currentDate,
                    ((LogWriterProxy) log).getOperateUser(), ((LogWriterProxy) log).getIvokeType(), null);
            if (lockedTable) {

                // Remove the -1 record again...
                //
                String sql = "DELETE FROM " + logcon.quoteField(jobMeta.getLogTable()) + " WHERE "
                        + logcon.quoteField("ID_JOB") + "= -1";
                ldb.execStatement(sql);

                ldb.unlockTables(new String[] { jobMeta.getLogTable(), });
            }
            ldb.disconnect();
        } catch (KettleDatabaseException dbe) {
            addErrors(1); // This is even before actual execution
            throw new KettleJobException(
                    Messages.getString("Job.Log.UnableToProcessLoggingStart", "" + jobMeta.getLogTable()), dbe);
        } finally {
            ldb.disconnect();
        }
    }

    if (jobMeta.isLogfieldUsed()) {
        stringAppender = LogWriter.createStringAppender();
        log.addAppender(stringAppender);
        stringAppender.setBuffer(new StringBuffer("START" + Const.CR));
    }

    return true;
}

From source file:net.sourceforge.msscodefactory.cfensyntax.v2_2.CFEnSyntaxMySql.CFEnSyntaxMySqlEnHeadTable.java

public void deleteEnHeadByScopeIdx(CFEnSyntaxAuthorization Authorization, Long argScopeId) {
    final String S_ProcName = "deleteEnHeadByScopeIdx";
    ResultSet resultSet = null;//from ww  w. j a v  a2  s .c om
    try {
        Connection cnx = schema.getCnx();
        String sql = "call " + schema.getLowerDbSchemaName() + ".sp_delete_enhead_by_scopeidx( ?, ?, ?, ?, ?"
                + ", " + "?" + " )";
        if (stmtDeleteByScopeIdx == null) {
            stmtDeleteByScopeIdx = cnx.prepareStatement(sql);
        }
        int argIdx = 1;
        stmtDeleteByScopeIdx.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId());
        stmtDeleteByScopeIdx.setString(argIdx++,
                (Authorization == null) ? "" : Authorization.getSecUserId().toString());
        stmtDeleteByScopeIdx.setString(argIdx++,
                (Authorization == null) ? "" : Authorization.getSecSessionId().toString());
        stmtDeleteByScopeIdx.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId());
        stmtDeleteByScopeIdx.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecTenantId());
        if (argScopeId != null) {
            stmtDeleteByScopeIdx.setLong(argIdx++, argScopeId.longValue());
        } else {
            stmtDeleteByScopeIdx.setNull(argIdx++, java.sql.Types.BIGINT);
        }
        stmtDeleteByScopeIdx.executeUpdate();
    } catch (SQLException e) {
        throw CFLib.getDefaultExceptionFactory().newDbException(getClass(), S_ProcName, e);
    } finally {
        if (resultSet != null) {
            try {
                resultSet.close();
            } catch (SQLException e) {
            }
            resultSet = null;
        }
    }
}

From source file:net.sourceforge.msscodefactory.cfensyntax.v2_2.CFEnSyntaxMySql.CFEnSyntaxMySqlEnWordTable.java

public void deleteEnWordByScopeIdx(CFEnSyntaxAuthorization Authorization, Long argScopeId) {
    final String S_ProcName = "deleteEnWordByScopeIdx";
    ResultSet resultSet = null;//from  ww w  . j a  va  2 s .  c o m
    try {
        Connection cnx = schema.getCnx();
        String sql = "call " + schema.getLowerDbSchemaName() + ".sp_delete_enword_by_scopeidx( ?, ?, ?, ?, ?"
                + ", " + "?" + " )";
        if (stmtDeleteByScopeIdx == null) {
            stmtDeleteByScopeIdx = cnx.prepareStatement(sql);
        }
        int argIdx = 1;
        stmtDeleteByScopeIdx.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId());
        stmtDeleteByScopeIdx.setString(argIdx++,
                (Authorization == null) ? "" : Authorization.getSecUserId().toString());
        stmtDeleteByScopeIdx.setString(argIdx++,
                (Authorization == null) ? "" : Authorization.getSecSessionId().toString());
        stmtDeleteByScopeIdx.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId());
        stmtDeleteByScopeIdx.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecTenantId());
        if (argScopeId != null) {
            stmtDeleteByScopeIdx.setLong(argIdx++, argScopeId.longValue());
        } else {
            stmtDeleteByScopeIdx.setNull(argIdx++, java.sql.Types.BIGINT);
        }
        stmtDeleteByScopeIdx.executeUpdate();
    } catch (SQLException e) {
        throw CFLib.getDefaultExceptionFactory().newDbException(getClass(), S_ProcName, e);
    } finally {
        if (resultSet != null) {
            try {
                resultSet.close();
            } catch (SQLException e) {
            }
            resultSet = null;
        }
    }
}

From source file:net.sourceforge.msscodefactory.cfensyntax.v2_2.CFEnSyntaxMySql.CFEnSyntaxMySqlEnObjectTable.java

public void deleteEnObjectByScopeIdx(CFEnSyntaxAuthorization Authorization, Long argScopeId) {
    final String S_ProcName = "deleteEnObjectByScopeIdx";
    ResultSet resultSet = null;//from  ww w  . ja  v  a 2s  . c  om
    try {
        Connection cnx = schema.getCnx();
        String sql = "call " + schema.getLowerDbSchemaName() + ".sp_delete_enobj_by_scopeidx( ?, ?, ?, ?, ?"
                + ", " + "?" + " )";
        if (stmtDeleteByScopeIdx == null) {
            stmtDeleteByScopeIdx = cnx.prepareStatement(sql);
        }
        int argIdx = 1;
        stmtDeleteByScopeIdx.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId());
        stmtDeleteByScopeIdx.setString(argIdx++,
                (Authorization == null) ? "" : Authorization.getSecUserId().toString());
        stmtDeleteByScopeIdx.setString(argIdx++,
                (Authorization == null) ? "" : Authorization.getSecSessionId().toString());
        stmtDeleteByScopeIdx.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId());
        stmtDeleteByScopeIdx.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecTenantId());
        if (argScopeId != null) {
            stmtDeleteByScopeIdx.setLong(argIdx++, argScopeId.longValue());
        } else {
            stmtDeleteByScopeIdx.setNull(argIdx++, java.sql.Types.BIGINT);
        }
        stmtDeleteByScopeIdx.executeUpdate();
    } catch (SQLException e) {
        throw CFLib.getDefaultExceptionFactory().newDbException(getClass(), S_ProcName, e);
    } finally {
        if (resultSet != null) {
            try {
                resultSet.close();
            } catch (SQLException e) {
            }
            resultSet = null;
        }
    }
}

From source file:net.sourceforge.msscodefactory.cfensyntax.v2_2.CFEnSyntaxMySql.CFEnSyntaxMySqlEnTenseTable.java

public void deleteEnTenseByScopeIdx(CFEnSyntaxAuthorization Authorization, Long argScopeId) {
    final String S_ProcName = "deleteEnTenseByScopeIdx";
    ResultSet resultSet = null;/*w  w  w  .java2s  .  c o m*/
    try {
        Connection cnx = schema.getCnx();
        String sql = "call " + schema.getLowerDbSchemaName() + ".sp_delete_entense_by_scopeidx( ?, ?, ?, ?, ?"
                + ", " + "?" + " )";
        if (stmtDeleteByScopeIdx == null) {
            stmtDeleteByScopeIdx = cnx.prepareStatement(sql);
        }
        int argIdx = 1;
        stmtDeleteByScopeIdx.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId());
        stmtDeleteByScopeIdx.setString(argIdx++,
                (Authorization == null) ? "" : Authorization.getSecUserId().toString());
        stmtDeleteByScopeIdx.setString(argIdx++,
                (Authorization == null) ? "" : Authorization.getSecSessionId().toString());
        stmtDeleteByScopeIdx.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId());
        stmtDeleteByScopeIdx.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecTenantId());
        if (argScopeId != null) {
            stmtDeleteByScopeIdx.setLong(argIdx++, argScopeId.longValue());
        } else {
            stmtDeleteByScopeIdx.setNull(argIdx++, java.sql.Types.BIGINT);
        }
        stmtDeleteByScopeIdx.executeUpdate();
    } catch (SQLException e) {
        throw CFLib.getDefaultExceptionFactory().newDbException(getClass(), S_ProcName, e);
    } finally {
        if (resultSet != null) {
            try {
                resultSet.close();
            } catch (SQLException e) {
            }
            resultSet = null;
        }
    }
}

From source file:net.sourceforge.msscodefactory.cfensyntax.v2_2.CFEnSyntaxMySql.CFEnSyntaxMySqlEnClauseTable.java

public void deleteEnClauseByScopeIdx(CFEnSyntaxAuthorization Authorization, Long argScopeId) {
    final String S_ProcName = "deleteEnClauseByScopeIdx";
    ResultSet resultSet = null;//from w w w.j a  v  a 2 s.c o m
    try {
        Connection cnx = schema.getCnx();
        String sql = "call " + schema.getLowerDbSchemaName() + ".sp_delete_enclause_by_scopeidx( ?, ?, ?, ?, ?"
                + ", " + "?" + " )";
        if (stmtDeleteByScopeIdx == null) {
            stmtDeleteByScopeIdx = cnx.prepareStatement(sql);
        }
        int argIdx = 1;
        stmtDeleteByScopeIdx.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId());
        stmtDeleteByScopeIdx.setString(argIdx++,
                (Authorization == null) ? "" : Authorization.getSecUserId().toString());
        stmtDeleteByScopeIdx.setString(argIdx++,
                (Authorization == null) ? "" : Authorization.getSecSessionId().toString());
        stmtDeleteByScopeIdx.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId());
        stmtDeleteByScopeIdx.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecTenantId());
        if (argScopeId != null) {
            stmtDeleteByScopeIdx.setLong(argIdx++, argScopeId.longValue());
        } else {
            stmtDeleteByScopeIdx.setNull(argIdx++, java.sql.Types.BIGINT);
        }
        stmtDeleteByScopeIdx.executeUpdate();
    } catch (SQLException e) {
        throw CFLib.getDefaultExceptionFactory().newDbException(getClass(), S_ProcName, e);
    } finally {
        if (resultSet != null) {
            try {
                resultSet.close();
            } catch (SQLException e) {
            }
            resultSet = null;
        }
    }
}

From source file:net.sourceforge.msscodefactory.cfensyntax.v2_2.CFEnSyntaxMySql.CFEnSyntaxMySqlEnPhraseTable.java

public void deleteEnPhraseByScopeIdx(CFEnSyntaxAuthorization Authorization, Long argScopeId) {
    final String S_ProcName = "deleteEnPhraseByScopeIdx";
    ResultSet resultSet = null;/*ww  w  . j ava 2  s. c  om*/
    try {
        Connection cnx = schema.getCnx();
        String sql = "call " + schema.getLowerDbSchemaName() + ".sp_delete_enphrase_by_scopeidx( ?, ?, ?, ?, ?"
                + ", " + "?" + " )";
        if (stmtDeleteByScopeIdx == null) {
            stmtDeleteByScopeIdx = cnx.prepareStatement(sql);
        }
        int argIdx = 1;
        stmtDeleteByScopeIdx.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId());
        stmtDeleteByScopeIdx.setString(argIdx++,
                (Authorization == null) ? "" : Authorization.getSecUserId().toString());
        stmtDeleteByScopeIdx.setString(argIdx++,
                (Authorization == null) ? "" : Authorization.getSecSessionId().toString());
        stmtDeleteByScopeIdx.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId());
        stmtDeleteByScopeIdx.setLong(argIdx++, (Authorization == null) ? 0 : Authorization.getSecTenantId());
        if (argScopeId != null) {
            stmtDeleteByScopeIdx.setLong(argIdx++, argScopeId.longValue());
        } else {
            stmtDeleteByScopeIdx.setNull(argIdx++, java.sql.Types.BIGINT);
        }
        stmtDeleteByScopeIdx.executeUpdate();
    } catch (SQLException e) {
        throw CFLib.getDefaultExceptionFactory().newDbException(getClass(), S_ProcName, e);
    } finally {
        if (resultSet != null) {
            try {
                resultSet.close();
            } catch (SQLException e) {
            }
            resultSet = null;
        }
    }
}