All Downloads are FREE. Search and download functionalities are using the official Maven repository.

src.com.ibm.as400.resource.ProgramAttributeSetter Maven / Gradle / Ivy

The newest version!
///////////////////////////////////////////////////////////////////////////////
//                                                                             
// JTOpen (IBM Toolbox for Java - OSS version)                              
//                                                                             
// Filename: ProgramAttributeSetter.java
//                                                                             
// The source code contained herein is licensed under the IBM Public License   
// Version 1.0, which has been approved by the Open Source Initiative.         
// Copyright (C) 1997-2000 International Business Machines Corporation and     
// others. All rights reserved.                                                
//                                                                             
///////////////////////////////////////////////////////////////////////////////

package com.ibm.as400.resource;

import com.ibm.as400.access.AS400;
import com.ibm.as400.access.AS400BidiTransform;
import com.ibm.as400.access.ExtendedIllegalArgumentException;
import com.ibm.as400.access.Trace;
import com.ibm.as400.data.PcmlException;
import com.ibm.as400.data.ProgramCallDocument;
import java.io.Serializable;
import java.util.Enumeration;
import java.util.Vector;



/**
The ProgramAttributeSetter class sets attribute values by calling a
program on the system.  The program call is specified using Program Call
Markup Language (PCML).  

This class uses a {@link com.ibm.as400.resource.ProgramMap ProgramMap} object to define how attribute values are specified in the PCML definition. This class is intended as a helper class for implementing subclasses of {@link com.ibm.as400.resource.Resource Resource}. @deprecated Use packages com.ibm.as400.access and com.ibm.as400.access.list instead. **/ public class ProgramAttributeSetter implements Serializable { private static final String copyright = "Copyright (C) 1997-2000 International Business Machines Corporation and others."; static final long serialVersionUID = 4L; // Private data. private ProgramMap attributeMap_ = null; private int defaultBidiStringType_ = -1; // @A2A private ProgramCallDocument document_ = null; private AS400 system_ = null; /** Constructs a ProgramAttributeSetter object. @param system The system. @param document The PCML document. @param attributeMap The attribute map. **/ public ProgramAttributeSetter(AS400 system, ProgramCallDocument document, ProgramMap attributeMap) { if (system == null) throw new NullPointerException("system"); if (document == null) throw new NullPointerException("document"); if (attributeMap == null) throw new NullPointerException("attributeMap"); system_ = system; document_ = document; attributeMap_ = attributeMap; } /** Initializes the attribute values for the setter. This is useful for "setter" programs that have multiple fields, all of which must contain valid values. @param attributeGetter The attribute getter with which to retrieve the current values from the system. @exception ResourceException If an error occurs. **/ public void initializeAttributeValues(ProgramAttributeGetter attributeGetter) throws ResourceException { initializeAttributeValues(attributeGetter, null); } /** Initializes the attribute values for the setter. This is useful for "setter" programs that have multiple fields, all of which must contain valid values. @param attributeGetter The attribute getter with which to retrieve the current values from the system. @param attrsToInitializeFirst The IDs of the attributes to initialize first, in desired order of initialization. These will typically be "length of another field" attributes. @exception ResourceException If an error occurs. **/ public void initializeAttributeValues(ProgramAttributeGetter attributeGetter, Object[] attrsToInitializeFirst) throws ResourceException { attributeGetter.clearBuffer(); if (defaultBidiStringType_ == -1) // @A2A defaultBidiStringType_ = AS400BidiTransform.getStringType((char)system_.getCcsid()); // @A2A try { synchronized(this) { Object[] attrIDs = attributeMap_.getIDs(); // First rearrange the ids into the desired order of initialization. if (attrsToInitializeFirst != null) { for (int i=0; i





© 2015 - 2024 Weber Informatics LLC | Privacy Policy