• Welcome to TUKE FÓRUM - Fórum pre študentov Technickej Univerzity v Košiciach.
 

MaGSA - Modelovanie a generovanie softvérových architektúr

Started by jan, 04.02.2011, 22:09:45

« predchdzajce - alie »

mishelka

Quote from: Kvacinka on  29.03.2011, 06:00:06
Ide vam ten regex na databze ??? ja pouzivam normalnu derby JAVA a ked davam check like porovnat tak mi to nefunguje a na nete som nasiel ze sa regex v sql robi pomocou check like. Tabulku vytvori ale potom musim zadat presne do property kde mam regex presne ten string ktory som dal ako regex pricom cez test mi to prejde.

http://www.java2s.com/Tutorial/Oracle/0120__Table/SettingtheRegularexpressioncheckforvarcharfield.htm

tu je prikald ale mne to tak nefunguje neviem ci to derby nepodporuje.

a moj create

CREATE TABLE Zamestanenec (
 ident INTEGER PRIMARY KEY GENERATED ALWAYS AS IDENTITY,
 meno  VARCHAR(32) NOT NULL CHECK( (LENGTH(meno) >= 2) AND (LENGTH(meno) <= 32)  AND (meno LIKE '[A-Za-z]+')),
 priezvisko  VARCHAR(16) NOT NULL CHECK( (LENGTH(priezvisko) >= 0) AND (LENGTH(priezvisko) <= 16) ),
 vek INT NOT NULL CHECK((vek >= 0) AND (vek <= 150))
);

cez test v dao mi prejde meno ale pri vkladani do db hodi ze sa nezhoduje z regexom a musim napisat presne [A-Za-z]+ inak nesplnim podmienku

a nefunguje ani ten ich regex neviem ci to derby potporuje alebo nie...
http://www.network-theory.co.uk/docs/postgresql/vol1/SIMILARTORegularExpressions.html

neviem ci to pojde aj v javadb :)
  

#define TRUE FALSE //Happy debugging suckers :D

Kvacinka

ja som nato prisiel mne neslo o regular. vyraz ako zapisat ja co som tam dal tak to nebralo. Samotni test v projecte co sa tam robi mi presiel ale db ma nepustila pridat ten prvok ze zly constraint. Ale som si zaregistroval jednu mysql db a na tej mi to ide v pohode... cize to nepodoporuje java db...

jardo

ludia neviete cim to asi bude ze mi vyhodi tuto chybu
Exception in thread "main" java.lang.NullPointerException
        at sk.tuke.magsa.framework.CRUDDaoImpl.create(CRUDDaoImpl.java:32)
        at Make.main(Make.java:34)
Java Result: 1
BUILD SUCCESSFUL (total time: 0 seconds)


uz som sputil databzu a vytvoril v nej tieto tabulky
CREATE TABLE Oddelenie (
  ident INTEGER PRIMARY KEY GENERATED ALWAYS AS IDENTITY,
  nazov VARCHAR(100),
  kod VARCHAR(100),
  poschodie INTEGER
);

CREATE TABLE Zamestnanec (
  ident INTEGER PRIMARY KEY GENERATED ALWAYS AS IDENTITY,
  priezvisko VARCHAR(16) NOT NULL CHECK((LENGTH(priezvisko) BETWEEN 0 AND 16)),
  vek INTEGER NOT NULL CHECK(vek BETWEEN 18 AND 120),
  adresa VARCHAR(250) CHECK((LENGTH(adresa) BETWEEN 3 AND 250)),
  mzda FLOAT
);


a ked cchem sputit magsa generated tak mi to vyhodi tu chybu

mishelka

NullPointer sa tazko zistuje, daj si vsade vypisy cez sout a zisti co mas null...
  

#define TRUE FALSE //Happy debugging suckers :D

mishelka

Quote from: tuxik on  26.03.2011, 05:09:33
Quote from: jan on  26.03.2011, 01:11:33
toto mi to vygenerovalo po 8. cviceni

z chybami:
-----------
- package sk.tuke.magsa.tools.parserext.javacc does not exist
- can not find symbol ParseException

package sk.tuke.magsa.tools.parserext;

public class Parser {
 private static sk.tuke.magsa.tools.parserext.javacc.Parser _parser;

 public sk.tuke.magsa.tools.metamodel.Model parse(String input) throws ParseException {
   sk.tuke.magsa.tools.parserext.javacc.ParserTokenManager tm = new sk.tuke.magsa.tools.parserext.javacc.ParserTokenManager(input);
   if (_parser == null) {
     _parser = new sk.tuke.magsa.tools.parserext.javacc.Parser(tm);
   } else {
     _parser.ReInit(tm);
   }

   try {
     tuke.pargen.ReferenceResolver referenceResolver = tuke.pargen.ReferenceResolver.createInstance();
     sk.tuke.magsa.tools.metamodel.Model root = sk.tuke.magsa.tools.parserext.javacc.Parser.parse();
     referenceResolver.resolveReferences();
     return root;
   } catch (sk.tuke.magsa.tools.parserext.javacc.ParseException e) {
     throw new ParseException("Problem parsing source code ", e);
   }
 }

 public sk.tuke.magsa.tools.metamodel.Model parse(java.io.Reader reader) throws ParseException {
   try {
     return parse(readAsString(reader));
   } catch(java.io.IOException e) {
     throw new ParseException("Problem reading input file", e);
   }
 }

 private String readAsString(java.io.Reader r) throws java.io.IOException {
   StringBuilder sb = new StringBuilder();
   java.io.BufferedReader br = new java.io.BufferedReader(r);
   String line;
   while ((line = br.readLine()) != null) {
     sb.append(line + "\n");
   }
   return sb.toString();
 }
}


Vyskusaj súbor nbproject/project.properties zmenit takto: build.generated.sources.dir=${basedir}/src-framework ... mne to takto ide
Cely navod:

1. v subore magsa/nbproject/project.properties
editovat obsah premennej build.generated.sources.dir na:
   build.generated.sources.dir=${basedir}/src-framework

2. v subore magsa/nbproject/build-impl.xml
editovat riadok 213 a 253 z:
   <attribute default="${build.generated.sources.dir}/ap-source-output" name="apgeneratedsrcdir"/>
na
   <attribute default="${build.generated.sources.dir}" name="apgeneratedsrcdir"/>

Nasledne to generuje normalne, ze da ine baliky si netreba vsimat (ide to aj bez toho aby boli spravne napisane).
Tato uprava je potrebna len pre Netbeansy 6.9.1tky
Vdaka jednemu mojmu studentovi za navod :) :thumbs-up:
Dufam ze to kolegovia daju cim skor do cviceni  :banana_guitar:
  

#define TRUE FALSE //Happy debugging suckers :D

jim-beam33

ja mam Netbeans 6.8 a tiez mi vypisuje chybu s Parserom a po tvojej rade  mi to teraz hadze toto:
D:\štúdium\4.ročník\leto\Modelovanie a gener. softver. architektur\ZADANIE 8,9\magsa\nbproject\build-impl.xml:530: The following error occurred while executing this line:
D:\štúdium\4.ročník\leto\Modelovanie a gener. softver. architektur\ZADANIE 8,9\magsa\nbproject\build-impl.xml:224: Compile failed; see the compiler error output for detail

mishelka

Quote from: jim-beam33 on  08.04.2011, 18:07:54
ja mam Netbeans 6.8 a tiez mi vypisuje chybu s Parserom a po tvojej rade  mi to teraz hadze toto:
D:\štúdium\4.ročník\leto\Modelovanie a gener. softver. architektur\ZADANIE 8,9\magsa\nbproject\build-impl.xml:530: The following error occurred while executing this line:
D:\štúdium\4.ročník\leto\Modelovanie a gener. softver. architektur\ZADANIE 8,9\magsa\nbproject\build-impl.xml:224: Compile failed; see the compiler error output for detail
tak toto je velavravna chyba :))) musela by som vidiet
  

#define TRUE FALSE //Happy debugging suckers :D

jan

robit 11. cvicenie je vzrusujuce ako prechadzka Jurskym parkom. Taky kratky popis ulohy prinuti kodu skutocne porozumiet, len to zaberie vela casu  :)
- Understanding is a three edged sword. (Your side, their side, and the truth) [Vorlons' saying]
(thanks to Agamemnon)

gabikke


jim-beam33

Quote from: mishelka on  07.04.2011, 15:58:55
Quote from: tuxik on  26.03.2011, 05:09:33
Quote from: jan on  26.03.2011, 01:11:33
toto mi to vygenerovalo po 8. cviceni

z chybami:
-----------
- package sk.tuke.magsa.tools.parserext.javacc does not exist
- can not find symbol ParseException

package sk.tuke.magsa.tools.parserext;

public class Parser {
 private static sk.tuke.magsa.tools.parserext.javacc.Parser _parser;

 public sk.tuke.magsa.tools.metamodel.Model parse(String input) throws ParseException {
   sk.tuke.magsa.tools.parserext.javacc.ParserTokenManager tm = new sk.tuke.magsa.tools.parserext.javacc.ParserTokenManager(input);
   if (_parser == null) {
     _parser = new sk.tuke.magsa.tools.parserext.javacc.Parser(tm);
   } else {
     _parser.ReInit(tm);
   }

   try {
     tuke.pargen.ReferenceResolver referenceResolver = tuke.pargen.ReferenceResolver.createInstance();
     sk.tuke.magsa.tools.metamodel.Model root = sk.tuke.magsa.tools.parserext.javacc.Parser.parse();
     referenceResolver.resolveReferences();
     return root;
   } catch (sk.tuke.magsa.tools.parserext.javacc.ParseException e) {
     throw new ParseException("Problem parsing source code ", e);
   }
 }

 public sk.tuke.magsa.tools.metamodel.Model parse(java.io.Reader reader) throws ParseException {
   try {
     return parse(readAsString(reader));
   } catch(java.io.IOException e) {
     throw new ParseException("Problem reading input file", e);
   }
 }

 private String readAsString(java.io.Reader r) throws java.io.IOException {
   StringBuilder sb = new StringBuilder();
   java.io.BufferedReader br = new java.io.BufferedReader(r);
   String line;
   while ((line = br.readLine()) != null) {
     sb.append(line + "\n");
   }
   return sb.toString();
 }
}


Vyskusaj súbor nbproject/project.properties zmenit takto: build.generated.sources.dir=${basedir}/src-framework ... mne to takto ide
Cely navod:

1. v subore magsa/nbproject/project.properties
editovat obsah premennej build.generated.sources.dir na:
   build.generated.sources.dir=${basedir}/src-framework

2. v subore magsa/nbproject/build-impl.xml
editovat riadok 213 a 253 z:
   <attribute default="${build.generated.sources.dir}/ap-source-output" name="apgeneratedsrcdir"/>
na
   <attribute default="${build.generated.sources.dir}" name="apgeneratedsrcdir"/>

Nasledne to generuje normalne, ze da ine baliky si netreba vsimat (ide to aj bez toho aby boli spravne napisane).
Tato uprava je potrebna len pre Netbeansy 6.9.1tky
Vdaka jednemu mojmu studentovi za navod :) :thumbs-up:
Dufam ze to kolegovia daju cim skor do cviceni  :banana_guitar:

Nema niekto problem po tomto navode s tym ze mu to zacne podciarkovat vsetky baliky magse???? :buttrock: :buttrock: v

Dulus

No ja s tym mam taky problem tiez, mi vypisuje mi teda ze balik sk.tuke.magsa.... atd atd ako neplatny a vraj platny je tuke.magsa......... plus D:\FEI TUKE\1.rocik ING\MaGSA\zadanie\new\In progress\magsa\src-framework\sk\tuke\magsa\tools\parserext\Parser.java:4: cannot find symbol
symbol  : class Parser
location: package sk.tuke.magsa.tools.parserext.javacc
 private static sk.tuke.magsa.tools.parserext.javacc.Parser _parser;
D:\FEI TUKE\1.rocik ING\MaGSA\zadanie\new\In progress\magsa\src-framework\sk\tuke\magsa\tools\parserext\javacc\ParserTokenManager.java:10: cannot find symbol
symbol: class TokenManager
public class ParserTokenManager implements TokenManager, ParserConstants {
plus dalsie errory velmi podobne teda ze nevie najst symbol parseru ...


Inac na zaciatku suboru nbproject/build-impl.xml je napsiane :D ... esteze to mame menit ... och mama mia komu som co spravil .. asi preto to ide "kazdemu"

*** GENERATED FROM project.xml - DO NOT EDIT  ***
***         EDIT ../build.xml INSTEAD         ***


Este taka vec kedze menime build.generated.sources.dir=${basedir}/src na build.generated.sources.dir=${basedir}/src-framework nie je cirou nahodou potom potrebne aj v package-info.java zmenit className = "sk.tuke.magsa.tools.parserext.Parser" na className = "sk.tuke.magsa.framework.parserext.Parser", ????????
Zivot je ako jazda na vytahu.Raz si hore,raz dole.

Indian

nestretol sa niekto s podobnou chybou?

Caused by: java.lang.NullPointerException
        at sk.tuke.magsa.tools.metamodel.Entity.addOutgoingReference(Entity.java:38)
        at sk.tuke.magsa.tools.metamodel.Reference.setFrom(Reference.java:25)

vyzera to tak, ze v triede Reference su from a to null

MackoZlesa

Quote from: Indian on  19.04.2011, 01:48:03
nestretol sa niekto s podobnou chybou?

Caused by: java.lang.NullPointerException
        at sk.tuke.magsa.tools.metamodel.Entity.addOutgoingReference(Entity.java:38)
        at sk.tuke.magsa.tools.metamodel.Reference.setFrom(Reference.java:25)

vyzera to tak, ze v triede Reference su from a to null

Cauko Mato, my sme sa stretli s takou chybou a tiez nevieme ako na to :D

Indian

nazdar, odpisal mi aj cviciaci na mail a zajtra sa nato pozrieme na cviku, tak som zvedavy, co som domotal :))

mircoo

Quote from: Indian on  19.04.2011, 04:12:05
nazdar, odpisal mi aj cviciaci na mail a zajtra sa nato pozrieme na cviku, tak som zvedavy, co som domotal :))

cau, pravdepodobne nemas clensku premennu outgoingReferences inicializovanu, ja som mal taku chybu, teda by to malo vyzerat takto:

private List<Reference> outgoingReferences = new ArrayList<Reference>();
Praise Him with the strings....

Indian

Quote from: mircoo on  19.04.2011, 04:33:16
Quote from: Indian on  19.04.2011, 04:12:05
nazdar, odpisal mi aj cviciaci na mail a zajtra sa nato pozrieme na cviku, tak som zvedavy, co som domotal :))

cau, pravdepodobne nemas clensku premennu outgoingReferences inicializovanu, ja som mal taku chybu, teda by to malo vyzerat takto:

private List<Reference> outgoingReferences = new ArrayList<Reference>();

dakujem, to ten problem vyriesilo. tusil som, ze to bude nejaka prkotina, na ktoru som zabudol. diky este raz ;)

thom

Quote from: Indian on  19.04.2011, 04:12:05
nazdar, odpisal mi aj cviciaci na mail a zajtra sa nato pozrieme na cviku, tak som zvedavy, co som domotal :))
Aj my sme riesili presne rovnaky problem, problem je v triede Main v magsa-generated. Cize ak mate zamestnanca a ten ma vlastnosti :
meno, priezvisko, vek. Tak mu musite v tej triede nastavit vsetky tieto vlastnosti- cize setMeno, setPriezvisko, setVek.Staci, ze jednu vlastnost nenastavite a hadze to "NullPointerException"  :). Takisto treba spravit aj s triedou oddelenie, pripadne dalsimi.

pinderko

Quote from: thom on  20.04.2011, 03:12:38
Quote from: Indian on  19.04.2011, 04:12:05
nazdar, odpisal mi aj cviciaci na mail a zajtra sa nato pozrieme na cviku, tak som zvedavy, co som domotal :))
Aj my sme riesili presne rovnaky problem, problem je v triede Main v magsa-generated. Cize ak mate zamestnanca a ten ma vlastnosti :
meno, priezvisko, vek. Tak mu musite v tej triede nastavit vsetky tieto vlastnosti- cize setMeno, setPriezvisko, setVek.Staci, ze jednu vlastnost nenastavite a hadze to "NullPointerException"  :). Takisto treba spravit aj s triedou oddelenie, pripadne dalsimi.
+ nastavit referenciu v zamestnancovi aj na oddelenie {zamestnanec.setOddelenie(cislo alebo oddelenie.setIdent())}

jim-beam33


qwerty

Quote from: jim-beam33 on  21.04.2011, 16:06:03
Neviete ako generovat XML v 11.cviku?
XML sa negeneruje. To si staci len stiahnut http://hornad.fei.tuke.sk/~wassermann/magsa/cvicenia/11/ui.xml a nakopirovat do magsa adresara. Generuje sa len XSD schema pomocou schemagenu...
Theory is when you know something, but it doesn't work. Practice is when something works, but you don't know why. Programmers combine theory and practice: Nothing works and they don't know why.

mishelka

 :bananawrite: Nezabudnite ze ui.xml aj ui.xsl musite mat v magsa adresari - mimo src,mimo akykolvek adresar. Ak ho date inde, vypadne vam exception ze nevie najst ui element... :ringsmiley:
br
  

#define TRUE FALSE //Happy debugging suckers :D

qwerty

Rozumiem spravne tomu pouzivatelskemu rozhraniu? Ak mam takto definovany formular pre zamestnanca

<form name="ZamestnanecForm" entity="Zamestnanec" label="Zamestnanec">
<field property="priezvisko" />
<field property="meno" />
<field property="vek" />
<lookupField property="nazov" table="OddelenieTable" />
</form>


tak pri operaciach CREATE a EDIT sa od uzivatela bude pozadovat priezvisko,meno,vek zamestnanca plus nazov oddelenia do ktoreho patri?
Lebo ak ano, tak pre dokoncenia zadania je nutne mat vypracovanu doplnujucu ulohu z cvicenia c.9 (vyhladavanie podla lubovolnej entity...)
Alebo to len pri operacii EDIT, a pri CREATE sa budu pozadovat vsetky property zamestnanca a id oddelenia?
Please help, lebo sa do toho nejako zamotavam  bu
Theory is when you know something, but it doesn't work. Practice is when something works, but you don't know why. Programmers combine theory and practice: Nothing works and they don't know why.

drtic

V databaze v tabulke Zamestnanec mas stlpec ident_Oddelenie, cize pri vytvarani a editovani zamestnanca tam potrebujes zadat id zvoleneho oddelenia.

qwerty

Quote from: drtic on  04.05.2011, 23:58:07
V databaze v tabulke Zamestnanec mas stlpec ident_Oddelenie, cize pri vytvarani a editovani zamestnanca tam potrebujes zadat id zvoleneho oddelenia.
...no takto som to mal, ale potom aky vyznam ma element lookupField
<lookupField property="nazov" table="OddelenieTable" />
lebo takto uzivatel nijak nepouzije vo formulari nazov oddelenia...
Theory is when you know something, but it doesn't work. Practice is when something works, but you don't know why. Programmers combine theory and practice: Nothing works and they don't know why.