Search in sources :

Example 11 with NO_RESOURCES

use of org.omg.CORBA.NO_RESOURCES in project ACS by ACS-Community.

the class CommonROEnumPropertyImpl method condition.

/* (non-Javadoc)
	 */
public Condition[] condition() {
    try {
        int[] temp = characteristicModelImpl.getIntegerSeq("condition");
        Condition[] ret = new Condition[temp.length];
        for (int i = 0; i < temp.length; i++) ret[i] = Condition.from_int(temp[i]);
        return ret;
    } catch (NoSuchCharacteristic e) {
        throw new NO_RESOURCES();
    }
}
Also used : Condition(alma.ACS.Condition) NoSuchCharacteristic(alma.ACS.NoSuchCharacteristic) NO_RESOURCES(org.omg.CORBA.NO_RESOURCES)

Example 12 with NO_RESOURCES

use of org.omg.CORBA.NO_RESOURCES in project ACS by ACS-Community.

the class CommonROEnumPropertyImpl method getEnumArrayFromCharacteristicModel.

/* (non-Javadoc)
	 */
private Object getEnumArrayFromCharacteristicModel(String name) {
    try {
        int[] temp = characteristicModelImpl.getIntegerSeq(name);
        Object ret = Array.newInstance(propertyType, temp.length);
        for (int i = 0; i < temp.length; i++) Array.set(ret, i, from_int(temp[i]));
        return ret;
    } catch (NoSuchCharacteristic e) {
        throw new NO_RESOURCES();
    }
}
Also used : NoSuchCharacteristic(alma.ACS.NoSuchCharacteristic) NO_RESOURCES(org.omg.CORBA.NO_RESOURCES)

Example 13 with NO_RESOURCES

use of org.omg.CORBA.NO_RESOURCES in project ACS by ACS-Community.

the class ROpatternImpl method whenSet.

/**
	 * @see alma.ACS.PpatternOperations#whenSet()
	 */
public Condition[] whenSet() {
    try {
        int[] values = characteristicModelImpl.getIntegerSeq("whenSet");
        Condition[] conditions = new Condition[values.length];
        for (int i = 0; i < conditions.length; i++) conditions[i] = Condition.from_int(values[i]);
        return conditions;
    } catch (NoSuchCharacteristic ncs) {
        throw new NO_RESOURCES();
    }
}
Also used : Condition(alma.ACS.Condition) NoSuchCharacteristic(alma.ACS.NoSuchCharacteristic) NO_RESOURCES(org.omg.CORBA.NO_RESOURCES)

Example 14 with NO_RESOURCES

use of org.omg.CORBA.NO_RESOURCES in project ACS by ACS-Community.

the class RWpatternImpl method whenCleared.

/**
	 * @see alma.ACS.PpatternOperations#whenCleared()
	 */
public Condition[] whenCleared() {
    try {
        int[] values = characteristicModelImpl.getIntegerSeq("whenCleared");
        Condition[] conditions = new Condition[values.length];
        for (int i = 0; i < conditions.length; i++) conditions[i] = Condition.from_int(values[i]);
        return conditions;
    } catch (NoSuchCharacteristic ncs) {
        throw new NO_RESOURCES();
    }
}
Also used : Condition(alma.ACS.Condition) NoSuchCharacteristic(alma.ACS.NoSuchCharacteristic) NO_RESOURCES(org.omg.CORBA.NO_RESOURCES)

Example 15 with NO_RESOURCES

use of org.omg.CORBA.NO_RESOURCES in project ACS by ACS-Community.

the class HibernateWDAOImpl method set_long_seq.

/* (non-Javadoc)
	 * @see com.cosylab.CDB.WDAOOperations#set_long_seq(java.lang.String, int[])
	 */
@SuppressWarnings("unchecked")
public void set_long_seq(String propertyName, int[] value) throws CDBFieldIsReadOnlyEx, CDBFieldDoesNotExistEx {
    NodeAndMutator nodeAndMutator = DOMJavaClassIntrospector.getRecursiveMutatorMethod(propertyName, m_rootNode);
    if (nodeAndMutator == null) {
        AcsJCDBFieldDoesNotExistEx ex = new AcsJCDBFieldDoesNotExistEx();
        ex.setFieldName(propertyName);
        throw ex.toCDBFieldDoesNotExistEx();
    }
    Transaction tr = null;
    try {
        if (nodeAndMutator.mutator.getParameterTypes().length != 1) {
            AcsJCDBFieldIsReadOnlyEx acsex = new AcsJCDBFieldIsReadOnlyEx();
            acsex.setFieldName(propertyName);
            throw acsex.toCDBFieldIsReadOnlyEx();
        }
        Object toSet;
        Class parameterClass = nodeAndMutator.mutator.getParameterTypes()[0];
        if (parameterClass.isAssignableFrom(String.class)) {
            StringBuilder strValue = new StringBuilder(64);
            if (value.length > 0) {
                for (int i = 0; i < value.length - 1; i++) {
                    strValue.append(value[i]).append(',');
                }
                strValue.append(value[value.length - 1]);
            }
            toSet = strValue.toString();
        } else if (parameterClass.isAssignableFrom(String[].class)) {
            String[] arr = new String[value.length];
            for (int i = 0; i < arr.length; i++) arr[i] = String.valueOf(value[i]);
            toSet = arr;
        } else if (parameterClass.isAssignableFrom(int[].class)) {
            int[] arr = new int[value.length];
            for (int i = 0; i < arr.length; i++) arr[i] = (int) value[i];
            toSet = arr;
        } else if (parameterClass.isAssignableFrom(long[].class)) {
            toSet = value;
        } else if (parameterClass.isAssignableFrom(byte[].class)) {
            byte[] arr = new byte[value.length];
            for (int i = 0; i < arr.length; i++) arr[i] = (byte) value[i];
            toSet = arr;
        } else if (parameterClass.isAssignableFrom(short[].class)) {
            short[] arr = new short[value.length];
            for (int i = 0; i < arr.length; i++) arr[i] = (short) value[i];
            toSet = arr;
        } else if (parameterClass.isAssignableFrom(double[].class)) {
            double[] arr = new double[value.length];
            for (int i = 0; i < arr.length; i++) arr[i] = (double) value[i];
            toSet = arr;
        } else if (parameterClass.isAssignableFrom(float[].class)) {
            float[] arr = new float[value.length];
            for (int i = 0; i < arr.length; i++) arr[i] = (float) value[i];
            toSet = arr;
        } else if (parameterClass.isAssignableFrom(boolean[].class)) {
            boolean[] arr = new boolean[value.length];
            for (int i = 0; i < arr.length; i++) arr[i] = (value[i] != 0);
            toSet = arr;
        } else
            throw new NO_RESOURCES("cannot convert value");
        if (m_autoCommit)
            tr = m_session.beginTransaction();
        nodeAndMutator.mutator.invoke(nodeAndMutator.node, new Object[] { toSet });
        if (tr != null)
            tr.commit();
    } catch (Throwable th) {
        if (tr != null)
            tr.rollback();
        if (!m_silent)
            m_logger.log(AcsLogLevel.NOTICE, "Failed to set '" + Arrays.toString(value) + "' to : " + (this.m_name + "/" + propertyName), th);
        throw new NO_RESOURCES(th.getMessage());
    }
}
Also used : AcsJCDBFieldDoesNotExistEx(alma.cdbErrType.wrappers.AcsJCDBFieldDoesNotExistEx) NodeAndMutator(com.cosylab.cdb.jdal.hibernate.DOMJavaClassIntrospector.NodeAndMutator) Transaction(org.hibernate.Transaction) AcsJCDBFieldIsReadOnlyEx(alma.cdbErrType.wrappers.AcsJCDBFieldIsReadOnlyEx) NO_RESOURCES(org.omg.CORBA.NO_RESOURCES)

Aggregations

NO_RESOURCES (org.omg.CORBA.NO_RESOURCES)28 AcsJNoPermissionEx (alma.maciErrType.wrappers.AcsJNoPermissionEx)12 BadParametersException (com.cosylab.acs.maci.BadParametersException)12 CoreException (com.cosylab.acs.maci.CoreException)12 NoResourcesException (com.cosylab.acs.maci.NoResourcesException)12 BAD_PARAM (org.omg.CORBA.BAD_PARAM)12 UNKNOWN (org.omg.CORBA.UNKNOWN)12 Object (org.omg.CORBA.Object)8 NoSuchCharacteristic (alma.ACS.NoSuchCharacteristic)6 AcsJCDBFieldDoesNotExistEx (alma.cdbErrType.wrappers.AcsJCDBFieldDoesNotExistEx)6 AcsJCDBFieldIsReadOnlyEx (alma.cdbErrType.wrappers.AcsJCDBFieldIsReadOnlyEx)6 AcsJCannotGetComponentEx (alma.maciErrType.wrappers.AcsJCannotGetComponentEx)6 NodeAndMutator (com.cosylab.cdb.jdal.hibernate.DOMJavaClassIntrospector.NodeAndMutator)6 URI (java.net.URI)6 URISyntaxException (java.net.URISyntaxException)6 Transaction (org.hibernate.Transaction)6 Condition (alma.ACS.Condition)5 Component (com.cosylab.acs.maci.Component)4 ComponentInfo (si.ijs.maci.ComponentInfo)4 AcsJComponentNotAlreadyActivatedEx (alma.maciErrType.wrappers.AcsJComponentNotAlreadyActivatedEx)2