if (attributes.get("firstpage") != null) publication.setFirstPage((Integer) dynaForm.get("firstpage"));
if (attributes.get("firstPage") != null) publication.setFirstPage((Integer) dynaForm.get("firstPage"));
	public ActionForward edit(ActionMapping mapping, ActionForm form, HttpServletRequest request,			HttpServletResponse response) throws FenixFilterException, FenixServiceException {		        DynaActionForm dynaForm = (DynaActionForm) form;        IUserView userView = SessionUtils.getUserView(request);        //InfoPublication pub = (InfoPublication) infoObject;        Integer keyPublicationType = (Integer) dynaForm.get("infoPublicationTypeId");        Object[] argReqAtt = { userView.getUtilizador(), keyPublicationType };        List requiredAttributes = (List) ServiceUtils.executeService(userView, "ReadRequiredAttributes", argReqAtt);        //VALIDATION CODE EXTRACTED FROM PFON'S OLD VALIDATION        ActionErrors errors = new ActionErrors();        Iterator iter = requiredAttributes.iterator();        while (iter.hasNext()) {            InfoAttribute infoAttribute = (InfoAttribute) iter.next();            if (!infoAttribute.getAttributeType().equals(                    PublicationConstants.DIDATIC_PEDAGOGIC_TO_COMPARE)                    && !infoAttribute.getAttributeType().equals(                            PublicationConstants.AUTHOR_NAME_TO_COMPARE)) {                Object object = dynaForm.get(infoAttribute.getAttributeType());                if (object instanceof String) {                    String valueString = (String) object;                    if (valueString == null || valueString.length() == 0) {                        errors.add(infoAttribute.getAttributeType(), new ActionError(                                "message.publicationAttribute.notVAlidate."                                        + infoAttribute.getAttributeType()));                    }                } else {                    Integer valueInteger = (Integer) object;                    if (valueInteger == null || valueInteger.intValue() == 0) {                        errors.add(infoAttribute.getAttributeType(), new ActionError(                                "message.publicationAttribute.notVAlidate."                                        + infoAttribute.getAttributeType()));                    }                }            }        }        if (!errors.isEmpty()) {            saveErrors(request, errors);            return mapping.getInputForward();        }                List infoAuthors = new ArrayList();        InfoPublication publication = new InfoPublication();                Object[] arrayId = (Object[]) dynaForm.get("authorsId");        Object[] arrayName = (Object[]) dynaForm.get("authorsName");                for (int i=0; i<arrayId.length; i++) {        	if (((Integer)arrayId[i]).equals(new Integer(-1))) {        		//external author        		InfoAuthor author = new InfoAuthor();        		String[] array = ((String)arrayName[i]).split("'.'");        		author.setAuthor(array[0]);        		author.setOrganization(array[1]);        		//not actually required but explicit so the service will know this is an external author        		author.setKeyPerson(null);        		infoAuthors.add(author);        	}        	else {	        	Object[] argReadAuthor = { arrayId[i] };	        	InfoAuthor author = (InfoAuthor)ServiceUtils.executeService(userView, "ReadAuthorById", argReadAuthor);	        	InfoPerson person = (InfoPerson)ServiceUtils.executeService(userView, "ReadPerson", new Object[] { author.getKeyPerson() });	        	author.setInfoPessoa(person);	        	infoAuthors.add(author);        	}        }                publication.setInfoPublicationAuthors(infoAuthors);                publication.setTitle((String)dynaForm.get("title"));        //ERROR this is wrong... a domain object is up here :(        InfoPublicationType type = InfoPublicationType.newInfoFromDomain(        		(IPublicationType)ServiceUtils.executeService(userView,"ReadPublicationType",        				new Object[]{ keyPublicationType }));        HashMap attributes = (HashMap) ServiceUtils.executeService(userView,                "ReadAttributesByPublicationType", new Object[] { keyPublicationType });        resetPublication(publication);        publication.setInfoPublicationType(type);        publication.setPublicationType(type.getPublicationType());        publication.setKeyPublicationType(keyPublicationType);        if (attributes.get("subtype") != null)            publication.setSubType((String) dynaForm.get("subtype"));        if (attributes.get("journalName") != null)            publication.setJournalName((String) dynaForm.get("journalName"));        if (attributes.get("volume") != null)            publication.setVolume((String) dynaForm.get("volume"));        if (attributes.get("firstpage") != null)            publication.setFirstPage((Integer) dynaForm.get("firstpage"));        if (attributes.get("lastPage") != null)            publication.setLastPage((Integer) dynaForm.get("lastPage"));        if (attributes.get("language") != null)            publication.setLanguage((String) dynaForm.get("language"));        if (attributes.get("format") != null)            publication.setFormat((String) dynaForm.get("format"));        if (attributes.get("observation") != null)            publication.setObservation((String) dynaForm.get("observation"));        if (attributes.get("number") != null)            publication.setNumber((Integer) dynaForm.get("number"));        if (attributes.get("month") != null)            publication.setMonth((String) dynaForm.get("month"));        if (attributes.get("year") != null)            publication.setYear((String) dynaForm.get("year"));        if (attributes.get("month_end") != null)            publication.setMonth_end((String) dynaForm.get("month_end"));        if (attributes.get("year_end") != null)            publication.setYear_end((String) dynaForm.get("year_end"));        if (attributes.get("editor") != null)            publication.setEditor((String) dynaForm.get("editor"));        if (attributes.get("country") != null)            publication.setCountry((String) dynaForm.get("country"));        if (attributes.get("issn") != null)            publication.setIssn((Integer) dynaForm.get("issn"));        if (attributes.get("scope") != null)            publication.setScope((String) dynaForm.get("scope"));        if (attributes.get("url") != null)            publication.setUrl((String) dynaForm.get("url"));        if (attributes.get("editorCity") != null)            publication.setEditorCity((String) dynaForm.get("editorCity"));        if (attributes.get("numberPages") != null)            publication.setNumberPages((Integer) dynaForm.get("numberPages"));        if (attributes.get("edition") != null) {            String edition = (String) dynaForm.get("edition");            Integer ed;            if (edition.equals(""))                ed = new Integer(0);            else                ed = Integer.valueOf(edition);            publication.setEdition(ed);        }        if (attributes.get("fascicle") != null) {            String fascicle = (String) dynaForm.get("fascicle");            Integer fas;            if (fascicle.equals(""))                fas = new Integer(0);            else                fas = Integer.valueOf(fascicle);            publication.setFascicle(fas);        }        if (attributes.get("serie") != null) {            String serie = (String) dynaForm.get("serie");            Integer ser;            if (serie.equals(""))                ser = new Integer(0);            else                ser = Integer.valueOf(serie);            publication.setSerie(ser);        }        if (attributes.get("isbn") != null)            publication.setIsbn((Integer) dynaForm.get("isbn"));        if (attributes.get("local") != null)            publication.setLocal((String) dynaForm.get("local"));        if (attributes.get("conference") != null)            publication.setConference((String) dynaForm.get("conference"));        if (attributes.get("instituition") != null)            publication.setInstituition((String) dynaForm.get("instituition"));        if (attributes.get("originalLanguage") != null)            publication.setOriginalLanguage((String) dynaForm.get("originalLanguage"));        if (attributes.get("translatedAuthor") != null)            publication.setTranslatedAuthor((String) dynaForm.get("translatedAuthor"));        if (attributes.get("criticizedAuthor") != null)            publication.setCriticizedAuthor((String) dynaForm.get("criticizedAuthor"));        // publication.setPublicationType((String)dynaForm.get("publicationType"));        if (attributes.get("university") != null)            publication.setUniversity((String) dynaForm.get("university"));                publication.setIdInternal((Integer) dynaForm.get("idInternal"));        publication.setDidatic((Integer) dynaForm.get("isDidatic"));                Object[] argEditarPublication = { publication };        ServiceUtils.executeService(userView, "EditarPublication", argEditarPublication);				return mapping.findForward("done");	}